Package org.frankframework.pipes
Class UnzipPipe
java.lang.Object
org.frankframework.core.TransactionAttributes
org.frankframework.pipes.AbstractPipe
org.frankframework.pipes.FixedForwardPipe
org.frankframework.pipes.UnzipPipe
- All Implemented Interfaces:
HasTransactionAttribute
,IConfigurable
,IConfigurationAware
,IForwardTarget
,INamedObject
,IPipe
,IScopeProvider
,IWithParameters
,EventThrowing
,HasStatistics
,org.springframework.beans.factory.Aware
,org.springframework.context.ApplicationContextAware
Assumes input to be the file name of a ZIP archive, and unzips it to a
directory and/or an XML message.
The output of each unzipped item is returned in XML as follows when collectFileContents is false:
The output of each unzipped item is returned in XML as follows when collectFileContents is true:
By default, this pipe takes care to produce unique file names, as follows. When the filename within the archive is:
The output of each unzipped item is returned in XML as follows when collectFileContents is false:
<results count="num_of_items"> <result item="1"> <zipEntry>name in ZIP archive of first item</zipEntry> <fileName>filename of first item</fileName> </result> <result item="2"> <zipEntry>name in ZIP archive of second item</zipEntry> <fileName>filename of second item</fileName> </result> ... </results>
The output of each unzipped item is returned in XML as follows when collectFileContents is true:
<results count="num_of_items"> <result item="1"> <zipEntry>name in ZIP archive of first item</zipEntry> <fileContent>content of first item</fileContent> </result> <result item="2"> <zipEntry>name in ZIP archive of second item</zipEntry> <fileContent>content of second item</fileContent> </result> ... </results>
By default, this pipe takes care to produce unique file names, as follows. When the filename within the archive is:
<basename> + "." + <extension>then the extracted filename (path omitted) becomes
<basename> + <unique number> + "." + <extension>
- Since:
- 4.9
- Author:
- Gerrit van Brakel
-
Field Summary
Fields inherited from class org.frankframework.pipes.AbstractPipe
parameterNamesMustBeUnique
Fields inherited from class org.frankframework.core.TransactionAttributes
log
Fields inherited from interface org.frankframework.core.IPipe
LONG_DURATION_MONITORING_EVENT, MESSAGE_SIZE_MONITORING_EVENT, PIPE_EXCEPTION_MONITORING_EVENT
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
checks for correct configuration of forwarddoPipe
(Message message, PipeLineSession session) This is where the action takes place.protected InputStream
getInputStream
(Message message, PipeLineSession session) boolean
boolean
boolean
boolean
Deprecated.boolean
boolean
boolean
void
setAssumeDirectoryExists
(boolean assumeDirectoryExists) If settrue
, validation of directory is ignoredvoid
setCheckDirectory
(boolean checkDirectory) Deprecated.void
setCollectFileContents
(boolean b) If settrue
, the contents of the files in the zip are returned in the result xml message of this pipe.void
Comma separated list of file extensions.void
setCollectResults
(boolean b) If setfalse
, only a small summary (count of items in zip) is returnedvoid
setCreateSubDirectories
(boolean b) Deprecated.void
setDeleteOnExit
(boolean b) Deprecated.void
setDirectory
(String string) Directory to extract the archive tovoid
setDirectorySessionKey
(String directorySessionKey) Sessionkey with a directory value to extract the archive tovoid
setKeepOriginalFileName
(boolean b) If setfalse
, a suffix is added to the original filename to be sure it is uniquevoid
setKeepOriginalFilePath
(boolean b) If settrue
, the path of the zip entry will be preserved.void
setProcessFile
(boolean b) Deprecated.Methods inherited from class org.frankframework.pipes.FixedForwardPipe
getIfParam, getIfValue, getOnlyIfSessionKey, getOnlyIfValue, getParameterValue, getSuccessForward, getUnlessSessionKey, getUnlessValue, isSkipOnEmptyInput, setIfParam, setIfValue, setOnlyIfSessionKey, setOnlyIfValue, setSkipOnEmptyInput, setUnlessSessionKey, setUnlessValue, skipPipe
Methods inherited from class org.frankframework.pipes.AbstractPipe
addParameter, consumesSessionVariable, createBean, findForward, getAdapter, getApplicationContext, getChompCharSize, getConfigurationClassLoader, getDurationThreshold, getElementToMove, getElementToMoveChain, getElementToMoveSessionKey, getEmptyInputReplacement, getEventSourceName, getForwards, getGetInputFromFixedValue, getGetInputFromSessionKey, getHideRegex, getLocker, getLogIntermediaryResults, getMaxThreads, getName, getParameterList, getPipeLine, getSecLogSessionKeys, getStoreResultInSessionKey, hasRegisteredForward, isPreserveInput, isRemoveCompactMsgNamespaces, isRestoreMovedElements, isWriteToSecLog, registerEvent, registerForward, setApplicationContext, setChompCharSize, setDurationThreshold, setElementToMove, setElementToMoveChain, setElementToMoveSessionKey, setEmptyInputReplacement, setEventPublisher, setGetInputFromFixedValue, setGetInputFromSessionKey, setHideRegex, setLocker, setLogIntermediaryResults, setMaxThreads, setName, setPipeLine, setPreserveInput, setRemoveCompactMsgNamespaces, setRestoreMovedElements, setSecLogSessionKeys, setSizeStatistics, setStoreResultInSessionKey, setWriteToSecLog, sizeStatisticsEnabled, start, stop, throwEvent
Methods inherited from class org.frankframework.core.TransactionAttributes
configureTransactionAttributes, getTransactionAttribute, getTransactionTimeout, getTxDef, isTransacted, isTransacted, setTransacted, setTransactionAttribute, setTransactionTimeout
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.frankframework.core.IPipe
throwEvent
-
Constructor Details
-
UnzipPipe
public UnzipPipe()
-
-
Method Details
-
configure
Description copied from class:FixedForwardPipe
checks for correct configuration of forward- Specified by:
configure
in interfaceIConfigurable
- Specified by:
configure
in interfaceIPipe
- Overrides:
configure
in classFixedForwardPipe
- Throws:
ConfigurationException
-
getInputStream
protected InputStream getInputStream(Message message, PipeLineSession session) throws PipeRunException - Throws:
PipeRunException
-
doPipe
Description copied from interface:IPipe
This is where the action takes place. Pipes may only throw a PipeRunException, to be handled by the caller of this object. Implementations must either consume the message, or pass it on to the next Pipe in the PipeRunResult. If the result of the Pipe does not depend on the input, like for theFixedResultPipe
, the Pipe can schedule the input to be closed at session exit, by callingMessage.closeOnCloseOf(PipeLineSession, String)
This allows the previous Pipe to release any resources (e.g. connections) that it might have kept open until the message was consumed. Doing so avoids connections leaking from pools, while it enables efficient streaming processing of data while it is being read from a stream.- Throws:
PipeRunException
-
setDirectory
Directory to extract the archive to -
setDirectorySessionKey
Sessionkey with a directory value to extract the archive to -
setDeleteOnExit
@Deprecated @ConfigurationWarning("This flag is no longer supported as it leaks server memory. Temporary files should be removed by other means.") public void setDeleteOnExit(boolean b) Deprecated.If true, file is automatically deleted upon normal JVM termination- Default value
- true
-
setCollectResults
public void setCollectResults(boolean b) If setfalse
, only a small summary (count of items in zip) is returned- Default value
- true
-
setCollectFileContents
public void setCollectFileContents(boolean b) If settrue
, the contents of the files in the zip are returned in the result xml message of this pipe. Please note this can consume a lot of memory for large files or a large number of files- Default value
- false
-
setCollectFileContentsBase64Encoded
Comma separated list of file extensions. Files with an extension which is part of this list will be base64 encoded. All other files are assumed to have UTF-8 when reading it from the zip and are added as escaped xml with non-unicode-characters being replaced by inverted question mark appended with #, the character number and ;- Default value
- false
-
setKeepOriginalFileName
public void setKeepOriginalFileName(boolean b) If setfalse
, a suffix is added to the original filename to be sure it is unique- Default value
- false
-
setCreateSubDirectories
@Deprecated @ConfigurationWarning("the attribute \'createSubDirectories\' has been renamed to \'keepOriginalFilePath\'") public void setCreateSubDirectories(boolean b) Deprecated. -
setKeepOriginalFilePath
public void setKeepOriginalFilePath(boolean b) If settrue
, the path of the zip entry will be preserved. Otherwise, the zip entries will be extracted to the root folder- Default value
- false
-
setAssumeDirectoryExists
public void setAssumeDirectoryExists(boolean assumeDirectoryExists) If settrue
, validation of directory is ignored- Default value
- false
-
setCheckDirectory
@Deprecated @ConfigurationWarning("the attribute \'checkDirectory\' has been renamed to \'assumeDirectoryExists\'") public void setCheckDirectory(boolean checkDirectory) Deprecated. -
setProcessFile
@Deprecated @ConfigurationWarning("Please add a LocalFileSystemPipe with action=read in front of this pipe instead") public void setProcessFile(boolean b) Deprecated.If settrue
, the input is assumed to be the name of a file to be processed. Otherwise, the input itself is used.- Default value
- false
-
getDirectory
-
getDirectorySessionKey
-
isDeleteOnExit
Deprecated. -
isCollectResults
public boolean isCollectResults() -
isCollectFileContents
public boolean isCollectFileContents() -
getCollectFileContentsBase64Encoded
-
isKeepOriginalFileName
public boolean isKeepOriginalFileName() -
isKeepOriginalFilePath
public boolean isKeepOriginalFilePath() -
isAssumeDirectoryExists
public boolean isAssumeDirectoryExists() -
isProcessFile
public boolean isProcessFile()
-