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:
FrankElement,HasApplicationContext,HasName,HasTransactionAttribute,IConfigurable,IForwardTarget,IPipe,IScopeProvider,IWithParameters,NameAware,EventThrowing,org.springframework.beans.factory.Aware,org.springframework.context.ApplicationContextAware,org.springframework.context.Lifecycle
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
parameterNamesMustBeUniqueFields inherited from class org.frankframework.core.TransactionAttributes
logFields inherited from interface org.frankframework.core.IPipe
LONG_DURATION_MONITORING_EVENT, MESSAGE_SIZE_MONITORING_EVENT, PIPE_EXCEPTION_MONITORING_EVENT -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidChecks for correct configuration of forward.doPipe(Message message, PipeLineSession session) This is where the action takes place.protected InputStreamgetInputStream(Message message, PipeLineSession session) voidsetAssumeDirectoryExists(boolean assumeDirectoryExists) Iftrue, validation of directory is ignoredvoidsetCheckDirectory(boolean checkDirectory) Deprecated.voidsetCollectFileContents(boolean b) Iftrue, the contents of the files in the zip are returned in the result xml message of this pipe.voidComma separated list of file extensions.voidsetCollectResults(boolean b) Iffalse, only a small summary (count of items in zip) is returnedvoidsetCreateSubDirectories(boolean b) Deprecated.voidsetDeleteOnExit(boolean b) Deprecated.voidsetDirectory(String string) Directory to extract the archive tovoidsetDirectorySessionKey(String directorySessionKey) Sessionkey with a directory value to extract the archive tovoidsetKeepOriginalFileName(boolean b) Iffalse, a suffix is added to the original filename to be sure it is uniquevoidsetKeepOriginalFilePath(boolean b) Iftrue, the path of the zip entry will be preserved.voidsetProcessFile(boolean b) Deprecated.Methods inherited from class org.frankframework.pipes.FixedForwardPipe
getParameterValue, setIfParam, setIfValue, setOnlyIfSessionKey, setOnlyIfValue, setSkipOnEmptyInput, setUnlessSessionKey, setUnlessValue, skipPipeMethods inherited from class org.frankframework.pipes.AbstractPipe
addForward, addParameter, consumesSessionVariable, createBean, findForward, getAdapter, getEventSourceName, getForwards, getParameterList, hasRegisteredForward, isRunning, registerEvent, setApplicationContext, setChompCharSize, setDurationThreshold, setElementToMove, setElementToMoveChain, setElementToMoveSessionKey, setEmptyInputReplacement, setGetInputFromFixedValue, setGetInputFromSessionKey, setHideRegex, setLocker, setLogIntermediaryResults, setMaxThreads, setName, setPreserveInput, setRemoveCompactMsgNamespaces, setRestoreMovedElements, setSecLogSessionKeys, setSizeStatistics, setStoreResultInSessionKey, setWriteToSecLog, sizeStatisticsEnabled, start, stop, throwEventMethods inherited from class org.frankframework.core.TransactionAttributes
configureTransactionAttributes, isTransacted, isTransacted, setTransacted, setTransactionTimeoutMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.frankframework.core.FrankElement
addConfigWarningMethods inherited from interface org.frankframework.core.HasApplicationContext
getApplicationContext, getConfigurationClassLoaderMethods inherited from interface org.frankframework.core.HasTransactionAttribute
getTransactionAttribute, getTransactionTimeout, getTxDef, setTransactionAttributeMethods inherited from interface org.frankframework.core.IForwardTarget
getNameMethods inherited from interface org.frankframework.core.IPipe
getChompCharSize, getDurationThreshold, getElementToMove, getElementToMoveChain, getElementToMoveSessionKey, getEmptyInputReplacement, getGetInputFromFixedValue, getGetInputFromSessionKey, getHideRegex, getLocker, getLogIntermediaryResults, getMaxThreads, getSecLogSessionKeys, getStoreResultInSessionKey, isPreserveInput, isRemoveCompactMsgNamespaces, isRestoreMovedElements, isWriteToSecLog, setPipeLine, throwEvent
-
Constructor Details
-
UnzipPipe
public UnzipPipe()
-
-
Method Details
-
configure
Description copied from class:FixedForwardPipeChecks for correct configuration of forward.- Specified by:
configurein interfaceIConfigurable- Overrides:
configurein classFixedForwardPipe- Throws:
ConfigurationException- in case it was not able to configure the component.
-
getInputStream
protected InputStream getInputStream(Message message, PipeLineSession session) throws PipeRunException - Throws:
PipeRunException
-
doPipe
Description copied from interface:IPipeThis 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.- 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.Iftrue, file is automatically deleted upon normal JVM termination- Default value
- true
-
setCollectResults
public void setCollectResults(boolean b) Iffalse, only a small summary (count of items in zip) is returned- Default value
- true
-
setCollectFileContents
public void setCollectFileContents(boolean b) Iftrue, 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) Iffalse, 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) Iftrue, 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) Iftrue, 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.Iftrue, the input is assumed to be the name of a file to be processed. Otherwise, the input itself is used.- Default value
- false
-