Package org.apache.camel.component.file
Class GenericFile<T>
- java.lang.Object
-
- org.apache.camel.component.file.GenericFile<T>
-
- All Implemented Interfaces:
org.apache.camel.WrappedFile<T>
public class GenericFile<T> extends Object implements org.apache.camel.WrappedFile<T>
Generic File. Specific implementations of a file based endpoint need to provide a File for transfer.
-
-
Constructor Summary
Constructors Constructor Description GenericFile()
GenericFile(boolean probeContentType)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
bindToExchange(org.apache.camel.Exchange exchange)
Bind this GenericFile to an Exchangevoid
bindToExchange(org.apache.camel.Exchange exchange, boolean isProbeContentTypeFromEndpoint)
Bind this GenericFile to an Exchangevoid
changeFileName(String newName)
Changes the name of this remote file.void
copyFrom(GenericFile source, GenericFile result)
Creates a copy based on the sourcevoid
copyFromPopulateAdditional(GenericFile<T> source, GenericFile<T> result)
Copies additional information from the source to the result.String
getAbsoluteFilePath()
GenericFileBinding<T>
getBinding()
Object
getBody()
String
getCharset()
String
getCopyFromAbsoluteFilePath()
String
getEndpointPath()
Map<String,Object>
getExtendedAttributes()
T
getFile()
long
getFileLength()
String
getFileName()
String
getFileNameOnly()
char
getFileSeparator()
long
getLastModified()
Long
getLastOffsetValue()
String
getParent()
String
getRelativeFilePath()
boolean
isAbsolute()
protected boolean
isAbsolute(String name)
boolean
isDirectory()
protected String
normalizePath(String name)
protected String
normalizePathToProtocol(String path)
Fixes the path separator to be according to the protocolvoid
populateHeaders(GenericFileMessage<T> message, boolean isProbeContentTypeFromEndpoint)
Populates theGenericFileMessage
relevant headersvoid
setAbsolute(boolean absolute)
void
setAbsoluteFilePath(String absoluteFilePath)
void
setBinding(GenericFileBinding<T> binding)
void
setBody(Object os)
void
setCharset(String charset)
void
setCopyFromAbsoluteFilePath(String copyFromAbsoluteFilePath)
void
setDirectory(boolean directory)
void
setEndpointPath(String endpointPath)
void
setExtendedAttributes(Map<String,Object> extendedAttributes)
void
setFile(T file)
void
setFileLength(long fileLength)
void
setFileName(String fileName)
void
setFileNameOnly(String fileNameOnly)
void
setLastModified(long lastModified)
void
setRelativeFilePath(String relativeFilePath)
String
toString()
void
updateLastOffsetValue(Long offset)
-
-
-
Method Detail
-
getFileSeparator
public char getFileSeparator()
-
copyFrom
public void copyFrom(GenericFile source, GenericFile result)
Creates a copy based on the source- Parameters:
source
- the sourceresult
- the result
-
copyFromPopulateAdditional
public void copyFromPopulateAdditional(GenericFile<T> source, GenericFile<T> result)
Copies additional information from the source to the result. Inherited classes can override this method and copy their specific data.- Parameters:
source
- the sourceresult
- the result
-
bindToExchange
public void bindToExchange(org.apache.camel.Exchange exchange)
Bind this GenericFile to an Exchange
-
bindToExchange
public void bindToExchange(org.apache.camel.Exchange exchange, boolean isProbeContentTypeFromEndpoint)
Bind this GenericFile to an Exchange
-
populateHeaders
public void populateHeaders(GenericFileMessage<T> message, boolean isProbeContentTypeFromEndpoint)
Populates theGenericFileMessage
relevant headers- Parameters:
message
- the message to populate with headers
-
isAbsolute
protected boolean isAbsolute(String name)
-
changeFileName
public void changeFileName(String newName)
Changes the name of this remote file. This method alters the absolute and relative names as well.- Parameters:
newName
- the new name
-
getRelativeFilePath
public String getRelativeFilePath()
-
setRelativeFilePath
public void setRelativeFilePath(String relativeFilePath)
-
getFileName
public String getFileName()
-
setFileName
public void setFileName(String fileName)
-
getFileLength
public long getFileLength()
-
setFileLength
public void setFileLength(long fileLength)
-
getLastModified
public long getLastModified()
-
setLastModified
public void setLastModified(long lastModified)
-
getCharset
public String getCharset()
-
setCharset
public void setCharset(String charset)
-
setFile
public void setFile(T file)
-
setBody
public void setBody(Object os)
-
getParent
public String getParent()
-
getBinding
public GenericFileBinding<T> getBinding()
-
setBinding
public void setBinding(GenericFileBinding<T> binding)
-
setAbsoluteFilePath
public void setAbsoluteFilePath(String absoluteFilePath)
-
getAbsoluteFilePath
public String getAbsoluteFilePath()
-
isAbsolute
public boolean isAbsolute()
-
setAbsolute
public void setAbsolute(boolean absolute)
-
getEndpointPath
public String getEndpointPath()
-
setEndpointPath
public void setEndpointPath(String endpointPath)
-
getFileNameOnly
public String getFileNameOnly()
-
setFileNameOnly
public void setFileNameOnly(String fileNameOnly)
-
isDirectory
public boolean isDirectory()
-
setDirectory
public void setDirectory(boolean directory)
-
getCopyFromAbsoluteFilePath
public String getCopyFromAbsoluteFilePath()
-
setCopyFromAbsoluteFilePath
public void setCopyFromAbsoluteFilePath(String copyFromAbsoluteFilePath)
-
updateLastOffsetValue
public void updateLastOffsetValue(Long offset)
-
getLastOffsetValue
public Long getLastOffsetValue()
-
normalizePathToProtocol
protected String normalizePathToProtocol(String path)
Fixes the path separator to be according to the protocol
-
-