Package org.apache.camel.component.file
Class GenericFile<T>
- java.lang.Object
-
- org.apache.camel.component.file.GenericFile<T>
-
- All Implemented Interfaces:
GenericFileResumable<T>,org.apache.camel.Resumable<T,Long>,org.apache.camel.WrappedFile<T>
public class GenericFile<T> extends Object implements org.apache.camel.WrappedFile<T>, GenericFileResumable<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 Deprecated Methods Modifier and Type Method Description voidbindToExchange(org.apache.camel.Exchange exchange)Bind this GenericFile to an ExchangevoidbindToExchange(org.apache.camel.Exchange exchange, boolean isProbeContentTypeFromEndpoint)Bind this GenericFile to an ExchangevoidchangeFileName(String newName)Changes the name of this remote file.voidcopyFrom(GenericFile source, GenericFile result)Deprecated.voidcopyFromPopulateAdditional(GenericFile<T> source, GenericFile<T> result)Copies additional information from the source to the result.StringgetAbsoluteFilePath()TgetAddressable()GenericFileBinding<T>getBinding()ObjectgetBody()StringgetCharset()StringgetCopyFromAbsoluteFilePath()StringgetEndpointPath()Map<String,Object>getExtendedAttributes()TgetFile()longgetFileLength()StringgetFileName()StringgetFileNameOnly()chargetFileSeparator()longgetLastModified()org.apache.camel.Offset<Long>getLastOffset()StringgetParent()StringgetRelativeFilePath()booleanisAbsolute()protected booleanisAbsolute(String name)booleanisDirectory()protected StringnormalizePath(String name)protected StringnormalizePathToProtocol(String path)Fixes the path separator to be according to the protocolvoidpopulateHeaders(GenericFileMessage<T> message, boolean isProbeContentTypeFromEndpoint)Populates theGenericFileMessagerelevant headersvoidsetAbsolute(boolean absolute)voidsetAbsoluteFilePath(String absoluteFilePath)voidsetBinding(GenericFileBinding<T> binding)voidsetBody(Object os)voidsetCharset(String charset)voidsetCopyFromAbsoluteFilePath(String copyFromAbsoluteFilePath)voidsetDirectory(boolean directory)voidsetEndpointPath(String endpointPath)voidsetExtendedAttributes(Map<String,Object> extendedAttributes)voidsetFile(T file)voidsetFileLength(long fileLength)voidsetFileName(String fileName)voidsetFileNameOnly(String fileNameOnly)voidsetLastModified(long lastModified)voidsetRelativeFilePath(String relativeFilePath)StringtoString()voidupdateLastOffset(Long offset)
-
-
-
Method Detail
-
getFileSeparator
public char getFileSeparator()
-
copyFrom
@Deprecated public void copyFrom(GenericFile source, GenericFile result)
Deprecated.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 theGenericFileMessagerelevant 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)
-
updateLastOffset
public void updateLastOffset(Long offset)
-
getLastOffset
public org.apache.camel.Offset<Long> getLastOffset()
-
getAddressable
public T getAddressable()
-
normalizePathToProtocol
protected String normalizePathToProtocol(String path)
Fixes the path separator to be according to the protocol
-
-