public class TarAggregationStrategy extends Object implements org.apache.camel.processor.aggregate.AggregationStrategy
If the incoming exchanges contain GenericFileMessage
file name will
be taken from the body otherwise the body content will be treated as a byte
array and the TAR entry will be named using the message id (unless the flag
useFilenameHeader is set to true.
NOTE 1: Please note that this aggregation strategy requires eager completion check to work properly.
NOTE 2: This implementation is very inefficient especially on big files since the tar file is completely rewritten for each file that is added to it. Investigate if the files can be collected and at completion stored to tar file.
Constructor and Description |
---|
TarAggregationStrategy() |
TarAggregationStrategy(boolean preserveFolderStructure) |
TarAggregationStrategy(boolean preserveFolderStructure,
boolean useFilenameHeader) |
Modifier and Type | Method and Description |
---|---|
org.apache.camel.Exchange |
aggregate(org.apache.camel.Exchange oldExchange,
org.apache.camel.Exchange newExchange) |
String |
getFilePrefix() |
String |
getFileSuffix() |
File |
getParentDir() |
void |
setFilePrefix(String filePrefix)
Sets the prefix that will be used when creating the TAR filename.
|
void |
setFileSuffix(String fileSuffix)
Sets the suffix that will be used when creating the ZIP filename.
|
void |
setParentDir(File parentDir)
Sets the parent directory to use for writing temporary files.
|
void |
setParentDir(String parentDir)
Sets the parent directory to use for writing temporary files.
|
public TarAggregationStrategy()
public TarAggregationStrategy(boolean preserveFolderStructure)
preserveFolderStructure
- if true, the folder structure is preserved when the source is
a type of GenericFileMessage
. If used with a file, use recursive=true.public TarAggregationStrategy(boolean preserveFolderStructure, boolean useFilenameHeader)
preserveFolderStructure
- if true, the folder structure is preserved when the source is
a type of GenericFileMessage
. If used with a file, use recursive=true.useFilenameHeader
- if true, the filename header will be used to name aggregated byte arrays
within the TAR file.public String getFilePrefix()
public void setFilePrefix(String filePrefix)
public String getFileSuffix()
public void setFileSuffix(String fileSuffix)
public File getParentDir()
public void setParentDir(File parentDir)
public void setParentDir(String parentDir)
public org.apache.camel.Exchange aggregate(org.apache.camel.Exchange oldExchange, org.apache.camel.Exchange newExchange)
aggregate
in interface org.apache.camel.processor.aggregate.AggregationStrategy
Apache Camel