/n software Connectors for MuleSoft
Version 22.0 [Build 8376]

SevenZip Modules

Properties   Config Settings  

The SevenZip transformer implements a 7zip-compatible Zip compressor and decompressor.

Remarks

The SevenZip module is used when generating BizTalk Pipelines for sending and receiving messages which are desired to be compressed or decompressed.

SevenZip Compressor Module

The SevenZip Compress operation creates an archive based on the specified files. The SevenZip Compressor relies on a Map of filenames to file content as input, e.g. Map<Filename,InputStream>. The elements will be compressed into a Binary SevenZip archive in the output payload.

Compression strength is regulated by the CompressionLevel property. You may also control encryption behavior by setting the Password and EncryptionAlgorithm properties on this module.

Archive Example

In the body of your flow, configure the File List connector to list the contents of the target directory.

Behind the File List connector, transform the output of File List so it can be correctly interpreted by the SevenZip Compressor. The easiest way to do this is with the Set Payload connector. Paste in the following DataWeave code to properly format the File List output so it can be used by the Compressor. output application/java --- (0 to sizeOf(payload) - 1) as Array reduce (index, acc={}) -> acc ++ { (payload[index].attributes.fileName): payload[index].payload} Finally, add the SevenZip Compressor. That is all that is required to begin compressing data. Behind the SevenZip Compressor you can write the new archive to disk with a File Write connector or perform further processing.

SevenZip Decompressor Module

The SevenZip Decompress operation extracts the inner files of the input archive. The SevenZip Decompressor relies on a Binary archive in the incoming message payload as input. The elements in the archive will be decompressed into a Map of filenames to decompressed content as key:value pairs in the output payload, e.g. Map<Filename,OutputStream>. The Map elements can be accessed with a For Each scope.

The Password property must be set in order to extract files which have been encrypted. You may also use the ExcludedFiles property to regulate which files are to be extracted from the archive.

Extract Example

First, create an event source such as a Scheduler endpoint to start the flow. Then in the body of your flow, drag an instance of the File Read connector into the project and configure it to read in a particular archive file.

Add an instance of the SevenZip Decompressor behind the File Read connector. There is no need to transform the output data of the File Read connector before passing it to the Decompressor.

Behind the Decompressor add a For Each Scope and set the collection property to payload. This will configure the For Each Scope to iterate over the output of the Decompressor. Then inside the For Each Scope, the filename and decompressed file data are available as key:value pairs.

As an example, to write the file to disk you can use a File Write connector inside the For Each Scope and MuleSoft pluck function. Set the Path property of the File Write connector to:

output application/json --- "c:/temp/mule/output/" ++ (payload pluck $$)[0]

Set the Content property of the File Write connector to:

output application/java --- ( payload pluck $ )[0]

That is all that is required to configure the File Write connector to write the inner file to disk.

Compressor Property List


The following is the full list of the properties of the compressor Module with short descriptions. Click on the links for further details.

CompressionLevelThe compression level to use.
CompressionMethodUsed to set the method of compression.
ExcludedFilesA list of files to exclude.
LogFileThe file to write logging information to at runtime.
LogModeWhat information gets logged during component execution.
LogTypeHow information gets logged during component execution.
OtherDefines a set of configuration settings to be used by the transformer.
PasswordA password for the zip archive.
RuntimeLicenseSpecifies the component runtime license key.
TempPathA temporary directory where uncompressed and compressed data can be stored.

Decompressor Property List


The following is the full list of the properties of the decompressor Module with short descriptions. Click on the links for further details.

ExcludedFilesA list of files to exclude.
LogFileThe file to write logging information to at runtime.
LogModeWhat information gets logged during component execution.
LogTypeHow information gets logged during component execution.
OtherDefines a set of configuration settings to be used by the transformer.
PasswordA password for the zip archive.
RuntimeLicenseSpecifies the component runtime license key.
SevenZipAttributesTBD.
TempPathA temporary directory where uncompressed and compressed data can be stored.

Config Settings


The following is a list of config settings for the Module with short descriptions. Click on the links for further details.

CompressionLevel Property (SevenZip Module)

The compression level to use.

Data Type

Integer

Default Value

3

Remarks

This property is only applicable when using the LZMA CompressionMethod. This property specifies the level of compression to be used. Valid values are: 1, 2, 3, 4 and 5. Higher values will cause the component to compress better; lower values will cause the component to compress faster. The default value is 3.

This property is not available in the Decompressor/Decoder.

CompressionMethod Property (SevenZip Module)

Used to set the method of compression.

Data Type

Enumeration

Possible Values

Lzma (0)
Bzip 2 (1)
Delta (2)
Copy (3)
Deflate (4)
Lzma 2 (5)

Default Value

0

Remarks

This is used to specify different compression methods. By default the connector uses the LZMA compression method (a value of 0). Supported values are:

ValueMethod
cmszLzma (0 - default) LZMA
cmszBzip2 (1) BZip2
cmszDelta (2) Delta
cmszCopy (3) Copy (no compression)
cmszDefalte (4) Deflate
cmszDefalte (5) LZMA2

This property is not available in the Decompressor/Decoder.

ExcludedFiles Property (SevenZip Module)

A list of files to exclude.

Data Type

String

Default Value

""

Remarks

This property specifies files that should be excluded when compressing or extracting a file. When either compression or extraction occurs, each file will be compared to ExcludedFiles, and each file that matches will be excluded.

This property may be set to one or more file names. These file names may be specified with or without a path, and with or without wildcards. If a path is specified, files in the indicated extraction directory will be excluded. If no path is specified but wildcards are, matching files in all directories will be excluded. If a single file name without a path is specified, it must correspond exactly to the appropriate value of a valid file name.

Directories should end with a slash ("/" or "\", as appropriate.) If a directory is specified, all files and subdirectories in the specified directory will be excluded during extraction.

A pipe character ("|") should be used to separate multiple file or directory names.

If the property is set to the empty string, no files will be excluded.

LogFile Property (SevenZip Module)

The file to write logging information to at runtime.

Data Type

String

Default Value

""

Remarks

To write logging information to a file instead of using the connector's logging API, set this property to a valid file on disk and set the LogType property to "File".

LogMode Property (SevenZip Module)

What information gets logged during component execution.

Data Type

Enumeration

Possible Values

Verbose (0)
Info (1)
Warning (2)
Error (3)
Fatal (4)

Default Value

3

Remarks

This property controls what information the connector logs. The possible values have the following affect on the connector's behavior:

VerboseThe connector will report all information regarding the transport.
InfoThe connector will report all major operations, as well as all warnings and errors.
WarningThe connector will report any conditions that could result in unpredictable behavior as well as errors.
ErrorThe connector will report all errors that prevent normal operations from completing.
FatalThe connector will report only serious errors that cause the connector to completely stop functioning.

LogType Property (SevenZip Module)

How information gets logged during component execution.

Data Type

Enumeration

Possible Values

None (0)
Console (1)
File (2)

Default Value

1

Remarks

This property controls where the connector will log the information. The possible values have the following affect on the connector's behavior:

NoneThe connector will not report any logging information.
ConsoleThe connector will report all logging information to the console.
FileThe connector will report all logging information to a file. The desired file must be specified in the LogFile when this type has been selected.

Other Property (SevenZip Module)

Defines a set of configuration settings to be used by the transformer.

Data Type

String

Default Value

""

Remarks

The module accepts one or more configuration settings. These settings are similar in functionality to properties, but they are rarely used. In order to avoid "polluting" the property namespace of the module, access to these internal properties is provided through the Other property.

The Other property may be set to one or more configuration settings (name/value pairs). Set one setting per line. For example: configname1=value1 configname2=value2

Password Property (SevenZip Module)

A password for the zip archive.

Data Type

Password

Default Value

""

Remarks

This property specifies the case-sensitive password used to encrypt or decrypt the archive. If set to an empty string, no password is used.

Example (Compressing an Archive)

ZipControl.ArchiveFile = "c:\test.zip" ZipControl.RecurseSubdirectories = true ZipControl.IncludeFiles("c:\foo\*") ZipControl.Password = "nsoftware" ZipControl.Compress()

RuntimeLicense Property (SevenZip Module)

Specifies the component runtime license key.

Data Type

String

Default Value

""

Remarks

You can use the RuntimeLicense property to set the runtime key for the connector license.

SevenZipAttributes Property (SevenZip Module)

TBD.

Data Type

SevenZipFileList

Remarks

TBD.

This property is only available at runtime by reading it from the context of a message generated by the connector.

This property is not available in the Compressor/Encoder.

TempPath Property (SevenZip Module)

A temporary directory where uncompressed and compressed data can be stored.

Data Type

String

Default Value

""

Remarks

This property indicates a temporary directory where the module can store any data before the module processes it. If TempPath is empty, the module will receive all data to memory. If set, the module will generate and write all inbound data to a temporary file in the specified directory.

Once the file is submitted to BizTalk, the module will handle closing the file stream and deleting the temporary file. However, if the module is shut down during a transfer some temporary files may be left in the directory. To ensure optimal performance, server administrators should check the directory regularly and remove old or extraneous files.

This property accepts the "%TEMP%" macro, which will be replaced with the default system temporary directory at runtime.

Note: by default, this property is empty and the module will use memory streams to store all inbound data before submitting it to BizTalk. It is recommended that you use a temporary directory when downloading large batches or batches containing large files to alleviate potential increased memory requirements.

SevenZipFile Type

The SevenZip file in the archive.

Remarks

This type contains information about the SevenZip file that exists in the archive.

Fields

CompressedDate
String

The last modified date of the file, as stored within the archive (it does not generally correspond to when the file was compressed).

CompressedName
String

The entry name, as stored within the archive.

CompressedSize
Long

The size of the compressed data, as compressed within the archive. Headers, footers, etc., are not included in the size.

DecompressedName
String

The name of the file in the archive, as stored on the file system, outside the archive.

DecompressedSize
Long

The size of the file, as decompressed outside the archive.

Constructors

Constructors are only relevant when configuring adapters in orchestrations.

public SevenZipFile();

Config Settings (SevenZip Module)

The connector accepts one or more of the following configuration settings. Configuration settings are similar in functionality to properties, but they are rarely used. In order to avoid "polluting" the property namespace of the connector, access to these internal properties is provided through the Other property.

Copyright (c) 2022 /n software inc. - All rights reserved.
/n software Connectors for MuleSoft - Version 22.0 [Build 8376]