Class AbstractZipTransformer
java.lang.Object
org.springframework.integration.context.IntegrationObjectSupport
org.springframework.integration.transformer.AbstractTransformer
org.springframework.integration.zip.transformer.AbstractZipTransformer
- All Implemented Interfaces:
Aware
,BeanFactoryAware
,BeanNameAware
,InitializingBean
,ApplicationContextAware
,ExpressionCapable
,GenericTransformer<Message<?>,
,Message<?>> NamedComponent
,Transformer
- Direct Known Subclasses:
UnZipTransformer
,ZipTransformer
Base class for transformers that provide Zip compression.
- Since:
- 6.1
- Author:
- Gunnar Hillert, Artem Bilan
-
Field Summary
Modifier and TypeFieldDescriptionprotected Charset
protected boolean
protected FileNameGenerator
protected File
protected ZipResultType
Fields inherited from class org.springframework.integration.context.IntegrationObjectSupport
EXPRESSION_PARSER, logger
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected Object
doTransform
(Message<?> message) Subclasses must implement this method to provide the transformation logic.protected abstract Object
doZipTransform
(Message<?> message) Subclasses must implement this method to provide the Zip transformation logic.protected void
onInit()
Subclasses may implement this for initialization logic.void
setDeleteFiles
(boolean deleteFiles) void
setWorkDirectory
(File workDirectory) Set the work-directory.void
setZipResultType
(ZipResultType zipResultType) Define the format of the data returned after transformation.Methods inherited from class org.springframework.integration.transformer.AbstractTransformer
transform
Methods inherited from class org.springframework.integration.context.IntegrationObjectSupport
afterPropertiesSet, extractTypeIfPossible, generateId, getApplicationContext, getApplicationContextId, getBeanDescription, getBeanFactory, getBeanName, getChannelResolver, getComponentName, getComponentType, getConversionService, getExpression, getIntegrationProperties, getIntegrationProperty, getMessageBuilderFactory, getTaskScheduler, isInitialized, setApplicationContext, setBeanFactory, setBeanName, setChannelResolver, setComponentName, setConversionService, setMessageBuilderFactory, setPrimaryExpression, setTaskScheduler, toString
-
Field Details
-
charset
-
fileNameGenerator
-
zipResultType
-
workDirectory
-
deleteFiles
protected boolean deleteFiles
-
-
Constructor Details
-
AbstractZipTransformer
public AbstractZipTransformer()
-
-
Method Details
-
setDeleteFiles
public void setDeleteFiles(boolean deleteFiles) If the payload is an instance ofFile
, this property specifies whether to delete theFile
after transformation. Default is false.- Parameters:
deleteFiles
- Defaults to false if not set
-
setWorkDirectory
Set the work-directory. The work directory is used when theZipResultType
is set toZipResultType.FILE
. By default, this property is set to the System temporary directory containing a subdirectory "ziptransformer".- Parameters:
workDirectory
- Must not be null and must not represent a file.
-
setZipResultType
Define the format of the data returned after transformation. Available options are:- File
- Byte Array
ZipResultType.FILE
.- Parameters:
zipResultType
- Must not be null
-
onInit
protected void onInit()Description copied from class:IntegrationObjectSupport
Subclasses may implement this for initialization logic.- Overrides:
onInit
in classIntegrationObjectSupport
-
doTransform
Description copied from class:AbstractTransformer
Subclasses must implement this method to provide the transformation logic. If the return value is itself a Message, it will be used as the result. Otherwise, any non-null return value will be used as the payload of the result Message.- Specified by:
doTransform
in classAbstractTransformer
- Parameters:
message
- the message and its payload must not be null.- Returns:
- The result of the transformation.
-
doZipTransform
Subclasses must implement this method to provide the Zip transformation logic.- Parameters:
message
- The message will never be null.- Returns:
- The result of the Zip transformation.
-