Class ZipAggregationStrategy
java.lang.Object
org.apache.camel.processor.aggregate.zipfile.ZipAggregationStrategy
- All Implemented Interfaces:
org.apache.camel.AggregationStrategy
@Metadata(label="bean",
description="AggregationStrategy to zip together incoming messages into a zip file. Please note that this aggregation strategy requires eager completion check to work properly.",
annotations="interfaceName=org.apache.camel.AggregationStrategy")
@Configurer(metadataOnly=true)
public class ZipAggregationStrategy
extends Object
implements org.apache.camel.AggregationStrategy
This aggregation strategy will aggregate all incoming messages into a ZIP file.
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 ZIP entry will be named using the message id (unless the flag
useFilenameHeader is set to true.
Note: Please note that this aggregation strategy requires eager completion check to work properly.
-
Constructor Summary
ConstructorsConstructorDescriptionZipAggregationStrategy
(boolean preserveFolderStructure) ZipAggregationStrategy
(boolean preserveFolderStructure, boolean useFilenameHeader) ZipAggregationStrategy
(boolean preserveFolderStructure, boolean useFilenameHeader, boolean useTempFile) ZipAggregationStrategy
(boolean preserveFolderStructure, boolean useFilenameHeader, boolean useTempFile, boolean allowEmptyFiles) -
Method Summary
Modifier and TypeMethodDescriptionorg.apache.camel.Exchange
aggregate
(org.apache.camel.Exchange oldExchange, org.apache.camel.Exchange newExchange) Gets the prefix used when creating the ZIP file name.Gets the suffix used when creating the ZIP file name.boolean
boolean
boolean
boolean
void
onCompletion
(org.apache.camel.Exchange exchange, org.apache.camel.Exchange inputExchange) void
setAllowEmptyFiles
(boolean allowEmptyFiles) void
setFilePrefix
(String filePrefix) Sets the prefix that will be used when creating the ZIP 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.void
setPreserveFolderStructure
(boolean preserveFolderStructure) void
setUseFilenameHeader
(boolean useFilenameHeader) void
setUseTempFile
(boolean useTempFile) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.apache.camel.AggregationStrategy
aggregate, canPreComplete, onCompletion, onOptimisticLockFailure, preComplete, timeout
-
Constructor Details
-
ZipAggregationStrategy
public ZipAggregationStrategy() -
ZipAggregationStrategy
public ZipAggregationStrategy(boolean preserveFolderStructure) - Parameters:
preserveFolderStructure
- if true, the folder structure is preserved when the source is a type ofGenericFileMessage
. If used with a file, use recursive=true.
-
ZipAggregationStrategy
public ZipAggregationStrategy(boolean preserveFolderStructure, boolean useFilenameHeader) - Parameters:
preserveFolderStructure
- if true, the folder structure is preserved when the source is a type ofGenericFileMessage
. If used with a file, use recursive=true.useFilenameHeader
- if true, the filename header will be used to name aggregated byte arrays within the ZIP file.
-
ZipAggregationStrategy
public ZipAggregationStrategy(boolean preserveFolderStructure, boolean useFilenameHeader, boolean useTempFile) - Parameters:
preserveFolderStructure
- if true, the folder structure is preserved when the source is a type ofGenericFileMessage
. If used with a file, use recursive=true.useFilenameHeader
- if true, the filename header will be used to name aggregated byte arrays within the ZIP file.useTempFile
- if true, the ZipFileSystem will use temporary files for zip manipulations instead of memory.
-
ZipAggregationStrategy
public ZipAggregationStrategy(boolean preserveFolderStructure, boolean useFilenameHeader, boolean useTempFile, boolean allowEmptyFiles) - Parameters:
preserveFolderStructure
- if true, the folder structure is preserved when the source is a type ofGenericFileMessage
. If used with a file, use recursive=true.useFilenameHeader
- if true, the filename header will be used to name aggregated byte arrays within the ZIP file.useTempFile
- if true, the ZipFileSystem will use temporary files for zip manipulations instead of memory.allowEmptyFiles
- if true, the Aggregation will also add empty files to the zip.
-
-
Method Details
-
getFilePrefix
Gets the prefix used when creating the ZIP file name. -
setFilePrefix
Sets the prefix that will be used when creating the ZIP filename. -
getFileSuffix
Gets the suffix used when creating the ZIP file name. -
setFileSuffix
Sets the suffix that will be used when creating the ZIP filename. -
isAllowEmptyFiles
public boolean isAllowEmptyFiles() -
setAllowEmptyFiles
public void setAllowEmptyFiles(boolean allowEmptyFiles) -
getParentDir
-
setParentDir
Sets the parent directory to use for writing temporary files. -
setParentDir
Sets the parent directory to use for writing temporary files. -
isPreserveFolderStructure
public boolean isPreserveFolderStructure() -
setPreserveFolderStructure
public void setPreserveFolderStructure(boolean preserveFolderStructure) -
isUseTempFile
public boolean isUseTempFile() -
setUseTempFile
public void setUseTempFile(boolean useTempFile) -
isUseFilenameHeader
public boolean isUseFilenameHeader() -
setUseFilenameHeader
public void setUseFilenameHeader(boolean useFilenameHeader) -
aggregate
public org.apache.camel.Exchange aggregate(org.apache.camel.Exchange oldExchange, org.apache.camel.Exchange newExchange) - Specified by:
aggregate
in interfaceorg.apache.camel.AggregationStrategy
-
onCompletion
public void onCompletion(org.apache.camel.Exchange exchange, org.apache.camel.Exchange inputExchange) - Specified by:
onCompletion
in interfaceorg.apache.camel.AggregationStrategy
-