This is an automated email from the ASF dual-hosted git repository.
bamaer pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/hop.git
The following commit(s) were added to refs/heads/main by this push:
new 568e8d42ad Serialize to file and Zip file: a compression level option,
fixes #9474 (#9475)
568e8d42ad is described below
commit 568e8d42add3008c77fcd4b5d9cbff98ea2885a5
Author: Hans Van Akelyen <[email protected]>
AuthorDate: Sat Nov 14 13:42:49 2026 +0100
Serialize to file and Zip file: a compression level option, fixes #9474
(#9475)
---
.../pipeline/transforms/serialize-to-file.adoc | 6 +
.../ROOT/pages/pipeline/transforms/zipfile.adoc | 3 +
.../pipeline/transforms/cubeoutput/CubeOutput.java | 6 +-
.../transforms/cubeoutput/CubeOutputMeta.java | 18 ++
.../cubeoutput/messages/messages_en_US.properties | 2 +
.../cubeoutput/CubeOutputCompressionTest.java | 262 +++++++++++++++++++++
.../resources/serialize-with-compression-level.xml | 42 ++++
.../hop/pipeline/transforms/zipfile/ZipFile.java | 3 +-
.../pipeline/transforms/zipfile/ZipFileDialog.java | 35 +++
.../pipeline/transforms/zipfile/ZipFileMeta.java | 30 +++
.../zipfile/messages/messages_en_US.properties | 2 +
.../transforms/zipfile/ZipFileCompressionTest.java | 247 +++++++++++++++++++
.../zipfile/ZipFileMetaLoadSaveTest.java | 6 +
.../resources/zip-file-with-compression-level.xml | 43 ++++
.../zip-file-without-compression-level.xml | 42 ++++
15 files changed, 743 insertions(+), 4 deletions(-)
diff --git
a/docs/hop-user-manual/modules/ROOT/pages/pipeline/transforms/serialize-to-file.adoc
b/docs/hop-user-manual/modules/ROOT/pages/pipeline/transforms/serialize-to-file.adoc
index 008feae235..0beb0fa61c 100644
---
a/docs/hop-user-manual/modules/ROOT/pages/pipeline/transforms/serialize-to-file.adoc
+++
b/docs/hop-user-manual/modules/ROOT/pages/pipeline/transforms/serialize-to-file.adoc
@@ -52,6 +52,12 @@ The Serialize to file transform supports a write-once access
pattern, and does n
|Add filenames to result
|Add the written filename to the list of result filenames.
+
+|Compression level
+|How hard to compress the file: 1 - Fastest, 2 - Very fast, 3 - Fast, 4 -
Balanced, faster, 5 - Balanced, 6 - Standard (the Java default), 7 - Smaller
files, 8 - Very small files, 9 - Smallest files.
+A low level writes much faster and gives a somewhat larger file.
+De-serialize from file reads every level.
+A new transform uses 6 - Standard, and so does a transform saved before this
option existed.
|===
== Several files at once
diff --git
a/docs/hop-user-manual/modules/ROOT/pages/pipeline/transforms/zipfile.adoc
b/docs/hop-user-manual/modules/ROOT/pages/pipeline/transforms/zipfile.adoc
index 455473fb7c..57c1ad79c1 100644
--- a/docs/hop-user-manual/modules/ROOT/pages/pipeline/transforms/zipfile.adoc
+++ b/docs/hop-user-manual/modules/ROOT/pages/pipeline/transforms/zipfile.adoc
@@ -44,4 +44,7 @@ The Zip File transform creates a standard ZIP archive using
the options you spec
*Move source file: Moves the source file to the location specified in the Move
to folder fieldname box.
*Delete source file: Deletes the source file from the folder.
|Move to folder fieldname|Define the field that contains the target folder to
move the source file to after zipping.
+|Compression level|How hard to compress the files: 1 - Fastest, 2 - Very fast,
3 - Fast, 4 - Balanced, faster, 5 - Balanced, 6 - Standard (the Java default),
7 - Smaller files, 8 - Very small files, 9 - Smallest files.
+A lower level zips faster and gives a somewhat larger archive.
+A new transform uses 6 - Standard. A transform saved before this option
existed keeps 9 - Smallest files, the level it always used.
|===
diff --git
a/plugins/transforms/cube/src/main/java/org/apache/hop/pipeline/transforms/cubeoutput/CubeOutput.java
b/plugins/transforms/cube/src/main/java/org/apache/hop/pipeline/transforms/cubeoutput/CubeOutput.java
index 8614a334f4..e10cb81eb7 100644
---
a/plugins/transforms/cube/src/main/java/org/apache/hop/pipeline/transforms/cubeoutput/CubeOutput.java
+++
b/plugins/transforms/cube/src/main/java/org/apache/hop/pipeline/transforms/cubeoutput/CubeOutput.java
@@ -18,9 +18,9 @@
package org.apache.hop.pipeline.transforms.cubeoutput;
import java.io.IOException;
-import java.util.zip.GZIPOutputStream;
import org.apache.commons.vfs2.FileObject;
import org.apache.hop.core.ResultFile;
+import org.apache.hop.core.compress.gzip.GzipCompressionLevel;
import org.apache.hop.core.exception.HopException;
import org.apache.hop.core.exception.HopFileException;
import org.apache.hop.core.exception.HopTransformException;
@@ -228,7 +228,9 @@ public class CubeOutput extends
BaseTransform<CubeOutputMeta, CubeOutputData> {
data.fos = HopVfs.getOutputStream(filename, false, variables);
data.countingOutputStream = new CountingOutputStream(data.fos);
- data.zip = new GZIPOutputStream(data.countingOutputStream);
+ data.zip =
+ GzipCompressionLevel.orNotStoredDefault(meta.getCompressionLevel())
+ .newOutputStream(data.countingOutputStream);
data.dos = CubeStreams.dataOutput(data.zip);
} catch (Exception e) {
throw new HopFileException(e);
diff --git
a/plugins/transforms/cube/src/main/java/org/apache/hop/pipeline/transforms/cubeoutput/CubeOutputMeta.java
b/plugins/transforms/cube/src/main/java/org/apache/hop/pipeline/transforms/cubeoutput/CubeOutputMeta.java
index 28fe5a2e7e..7e9f4dd4de 100644
---
a/plugins/transforms/cube/src/main/java/org/apache/hop/pipeline/transforms/cubeoutput/CubeOutputMeta.java
+++
b/plugins/transforms/cube/src/main/java/org/apache/hop/pipeline/transforms/cubeoutput/CubeOutputMeta.java
@@ -24,6 +24,7 @@ import lombok.Setter;
import org.apache.hop.core.CheckResult;
import org.apache.hop.core.ICheckResult;
import org.apache.hop.core.annotations.Transform;
+import org.apache.hop.core.compress.gzip.GzipCompressionLevel;
import org.apache.hop.core.exception.HopException;
import org.apache.hop.core.gui.plugin.GuiElementType;
import org.apache.hop.core.gui.plugin.GuiPlugin;
@@ -126,6 +127,22 @@ public class CubeOutputMeta extends
BaseTransformMeta<CubeOutput, CubeOutputData
@HopMetadataProperty(key = "add_to_result_filenames")
private boolean addToResultFilenames;
+ /**
+ * How hard to compress the file, from 1 (fastest) to 9 (smallest file). A
transform saved before
+ * the level could be chosen has none stored and keeps level 6, the level it
always wrote with.
+ */
+ @GuiWidgetElement(
+ id = "compressionLevel",
+ order = "0600",
+ type = GuiElementType.COMBO,
+ label = "i18n::CubeOutputDialog.CompressionLevel.Label",
+ toolTip = "i18n::CubeOutputDialog.CompressionLevel.Tooltip",
+ parentId = GUI_PLUGIN_ELEMENT_PARENT_ID,
+ groupType = GuiWidgetGroupType.BOXES,
+ group = GROUP_FILE)
+ @HopMetadataProperty(key = "compression_level", storeWithCode = true)
+ private GzipCompressionLevel compressionLevel =
GzipCompressionLevel.NOT_STORED_DEFAULT;
+
public CubeOutputMeta() {
super();
}
@@ -136,6 +153,7 @@ public class CubeOutputMeta extends
BaseTransformMeta<CubeOutput, CubeOutputData
doNotOpenNewFileInit = false;
filenameCreatingParentFolders = false;
includeTransformNr = false;
+ compressionLevel = GzipCompressionLevel.NOT_STORED_DEFAULT;
}
@Override
diff --git
a/plugins/transforms/cube/src/main/resources/org/apache/hop/pipeline/transforms/cubeoutput/messages/messages_en_US.properties
b/plugins/transforms/cube/src/main/resources/org/apache/hop/pipeline/transforms/cubeoutput/messages/messages_en_US.properties
index c0397bfd36..ba957031c9 100644
---
a/plugins/transforms/cube/src/main/resources/org/apache/hop/pipeline/transforms/cubeoutput/messages/messages_en_US.properties
+++
b/plugins/transforms/cube/src/main/resources/org/apache/hop/pipeline/transforms/cubeoutput/messages/messages_en_US.properties
@@ -26,6 +26,8 @@ CubeOutput.Name=Serialize to file
CubeOutputDialog.AddFileToResult.Label=Add filenames to result
CubeOutputDialog.AddFileToResult.Tooltip=Check this if you wan to add
filenames to result filenames.
CubeOutputDialog.Browse.Button=&Browse...
+CubeOutputDialog.CompressionLevel.Label=Compression level
+CubeOutputDialog.CompressionLevel.Tooltip=How hard to compress the file. 1 is
the fastest, 9 gives the smallest file. A low level writes much faster for a
somewhat larger file. Every level is read by De-serialize from file.
CubeOutputDialog.CreatingParentFolders.Label=Create parent folders
CubeOutputDialog.CreatingParentFolders.Tooltip=Create parent folders if they
don''t exist
CubeOutputDialog.DefaultTransformName=write to cube file
diff --git
a/plugins/transforms/cube/src/test/java/org/apache/hop/pipeline/transforms/cubeoutput/CubeOutputCompressionTest.java
b/plugins/transforms/cube/src/test/java/org/apache/hop/pipeline/transforms/cubeoutput/CubeOutputCompressionTest.java
new file mode 100644
index 0000000000..acbfab0b4d
--- /dev/null
+++
b/plugins/transforms/cube/src/test/java/org/apache/hop/pipeline/transforms/cubeoutput/CubeOutputCompressionTest.java
@@ -0,0 +1,262 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hop.pipeline.transforms.cubeoutput;
+
+import static org.junit.jupiter.api.Assertions.assertArrayEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.DataInputStream;
+import java.io.InputStream;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Date;
+import java.util.List;
+import java.util.zip.GZIPInputStream;
+import java.util.zip.GZIPOutputStream;
+import org.apache.hop.core.HopEnvironment;
+import org.apache.hop.core.annotations.Transform;
+import org.apache.hop.core.compress.gzip.GzipCompressionLevel;
+import org.apache.hop.core.exception.HopEofException;
+import org.apache.hop.core.logging.LoggingObject;
+import org.apache.hop.core.plugins.PluginRegistry;
+import org.apache.hop.core.plugins.TransformPluginType;
+import org.apache.hop.core.row.IRowMeta;
+import org.apache.hop.core.row.RowMeta;
+import org.apache.hop.core.row.value.ValueMetaDate;
+import org.apache.hop.core.row.value.ValueMetaInteger;
+import org.apache.hop.core.row.value.ValueMetaNumber;
+import org.apache.hop.core.row.value.ValueMetaString;
+import org.apache.hop.core.variables.Variables;
+import org.apache.hop.pipeline.PipelineHopMeta;
+import org.apache.hop.pipeline.PipelineMeta;
+import org.apache.hop.pipeline.RowProducer;
+import org.apache.hop.pipeline.engines.local.LocalPipelineEngine;
+import org.apache.hop.pipeline.transform.ITransformMeta;
+import org.apache.hop.pipeline.transform.TransformMeta;
+import org.apache.hop.pipeline.transform.TransformSerializationTestUtil;
+import org.apache.hop.pipeline.transforms.injector.InjectorMeta;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.io.TempDir;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.EnumSource;
+
+/**
+ * The compression level Serialize to file writes with. The rows repeat enough
for every level to
+ * give another file, so the bytes of a file tell which level wrote it.
+ */
+class CubeOutputCompressionTest {
+
+ private static final int NR_ROWS = 20_000;
+
+ @TempDir Path tempDir;
+
+ @BeforeAll
+ static void initHop() throws Exception {
+ HopEnvironment.init();
+ PluginRegistry registry = PluginRegistry.getInstance();
+ for (ITransformMeta meta : List.of(new CubeOutputMeta(), new
InjectorMeta())) {
+ if (registry.getPluginId(TransformPluginType.class, meta) == null) {
+ registry.registerPluginClass(
+ meta.getClass().getName(), TransformPluginType.class,
Transform.class);
+ }
+ }
+ }
+
+ /** A pipeline saved before the level could be chosen writes the same bytes
as it always did. */
+ @Test
+ void transformSavedWithoutALevelWritesAtLevelSix() throws Exception {
+ CubeOutputMeta meta =
+ TransformSerializationTestUtil.testSerialization(
+ "/serialize-transform.xml", CubeOutputMeta.class);
+
+ byte[] file = write(meta, "saved.cube");
+
+ assertEquals(GzipCompressionLevel.STANDARD, meta.getCompressionLevel());
+ assertArrayEquals(gzip(gunzip(file), 6), file);
+ assertRows(file);
+ }
+
+ /** A null level is what code that builds the transform itself leaves
behind. */
+ @Test
+ void transformWithoutALevelWritesAtLevelSix() throws Exception {
+ CubeOutputMeta meta = new CubeOutputMeta();
+ meta.setCompressionLevel(null);
+
+ byte[] file = write(meta, "null.cube");
+
+ assertArrayEquals(gzip(gunzip(file), 6), file);
+ }
+
+ @Test
+ void newTransformWritesAtLevelSix() throws Exception {
+ CubeOutputMeta meta = new CubeOutputMeta();
+ meta.setDefault();
+
+ byte[] file = write(meta, "new.cube");
+
+ assertEquals(GzipCompressionLevel.STANDARD, meta.getCompressionLevel());
+ assertArrayEquals(gzip(gunzip(file), 6), file);
+ }
+
+ @Test
+ void theLevelIsSavedAndLoaded() throws Exception {
+ CubeOutputMeta meta =
+ TransformSerializationTestUtil.testSerialization(
+ "/serialize-with-compression-level.xml", CubeOutputMeta.class);
+
+ assertEquals(GzipCompressionLevel.FASTEST, meta.getCompressionLevel());
+
assertTrue(meta.getXml().contains("<compression_level>FASTEST</compression_level>"));
+ }
+
+ /** Every level writes the bytes of that level, and a file that holds the
same rows. */
+ @ParameterizedTest
+ @EnumSource(GzipCompressionLevel.class)
+ void fileIsWrittenAtTheChosenLevel(GzipCompressionLevel level) throws
Exception {
+ CubeOutputMeta meta = new CubeOutputMeta();
+ meta.setDefault();
+ meta.setCompressionLevel(level);
+
+ byte[] file = write(meta, level + ".cube");
+
+ assertArrayEquals(gzip(gunzip(file), level.getLevel()), file);
+ assertRows(file);
+ }
+
+ @Test
+ void lowerLevelGivesALargerFileWithTheSameContent() throws Exception {
+ CubeOutputMeta fastest = new CubeOutputMeta();
+ fastest.setCompressionLevel(GzipCompressionLevel.FASTEST);
+ CubeOutputMeta standard = new CubeOutputMeta();
+ standard.setCompressionLevel(GzipCompressionLevel.STANDARD);
+ CubeOutputMeta smallest = new CubeOutputMeta();
+ smallest.setCompressionLevel(GzipCompressionLevel.SMALLEST);
+
+ byte[] fastestFile = write(fastest, "fastest.cube");
+ byte[] standardFile = write(standard, "standard.cube");
+ byte[] smallestFile = write(smallest, "smallest.cube");
+
+ assertTrue(fastestFile.length > standardFile.length);
+ assertTrue(standardFile.length > smallestFile.length);
+ assertArrayEquals(gunzip(standardFile), gunzip(fastestFile));
+ assertArrayEquals(gunzip(standardFile), gunzip(smallestFile));
+ }
+
+ private byte[] write(CubeOutputMeta meta, String name) throws Exception {
+ Path file = tempDir.resolve(name);
+ meta.setFilename(file.toString());
+ PipelineMeta pipelineMeta = new PipelineMeta();
+ pipelineMeta.setName("write cube");
+ TransformMeta input = addTransform(pipelineMeta, "input", new
InjectorMeta());
+ TransformMeta output = addTransform(pipelineMeta, "cube output", meta);
+ pipelineMeta.addPipelineHop(new PipelineHopMeta(input, output));
+
+ LocalPipelineEngine pipeline =
+ new LocalPipelineEngine(pipelineMeta, new Variables(), new
LoggingObject("test"));
+ pipeline.prepareExecution();
+ RowProducer producer = pipeline.addRowProducer("input", 0);
+ pipeline.startThreads();
+ IRowMeta layout = layout();
+ for (Object[] row : rows()) {
+ producer.putRow(layout, row);
+ }
+ producer.finished();
+ pipeline.waitUntilFinished();
+ assertEquals(0, pipeline.getErrors());
+ return Files.readAllBytes(file);
+ }
+
+ /** The file holds the layout and every row, whatever the level. */
+ private static void assertRows(byte[] file) throws Exception {
+ List<Object[]> read = new ArrayList<>();
+ try (DataInputStream dis =
+ new DataInputStream(new GZIPInputStream(new
ByteArrayInputStream(file)))) {
+ IRowMeta readLayout = new RowMeta(dis);
+ assertEquals(List.of(layout().getFieldNames()),
List.of(readLayout.getFieldNames()));
+ while (true) {
+ try {
+ read.add(readLayout.readData(dis));
+ } catch (HopEofException eof) {
+ break;
+ }
+ }
+ }
+ List<Object[]> expected = rows();
+ assertEquals(expected.size(), read.size());
+ for (int i = 0; i < expected.size(); i++) {
+ assertTrue(
+ Arrays.deepEquals(expected.get(i), read.get(i)),
+ "row " + i + ": " + Arrays.deepToString(read.get(i)));
+ }
+ }
+
+ private static byte[] gunzip(byte[] compressed) throws Exception {
+ try (InputStream in = new GZIPInputStream(new
ByteArrayInputStream(compressed))) {
+ return in.readAllBytes();
+ }
+ }
+
+ /** What java.util.zip gives for this content at a level. */
+ private static byte[] gzip(byte[] content, int level) throws Exception {
+ ByteArrayOutputStream bytes = new ByteArrayOutputStream();
+ try (GZIPOutputStream out =
+ new GZIPOutputStream(bytes) {
+ {
+ def.setLevel(level);
+ }
+ }) {
+ out.write(content);
+ }
+ return bytes.toByteArray();
+ }
+
+ private static IRowMeta layout() {
+ IRowMeta layout = new RowMeta();
+ layout.addValueMeta(new ValueMetaString("name"));
+ layout.addValueMeta(new ValueMetaInteger("id"));
+ layout.addValueMeta(new ValueMetaNumber("price"));
+ layout.addValueMeta(new ValueMetaDate("ordered"));
+ return layout;
+ }
+
+ private static List<Object[]> rows() {
+ List<Object[]> rows = new ArrayList<>();
+ for (long i = 0; i < NR_ROWS; i++) {
+ rows.add(
+ new Object[] {
+ "customer " + (i % 97) + " in city " + (i * 31 % 113),
+ i,
+ (i % 1000) * 1.25,
+ new Date(1_700_000_000_000L + i * 86_400_000L)
+ });
+ }
+ return rows;
+ }
+
+ private static TransformMeta addTransform(
+ PipelineMeta pipelineMeta, String name, ITransformMeta meta) {
+ String pluginId =
PluginRegistry.getInstance().getPluginId(TransformPluginType.class, meta);
+ TransformMeta transformMeta = new TransformMeta(pluginId, name, meta);
+ pipelineMeta.addTransform(transformMeta);
+ return transformMeta;
+ }
+}
diff --git
a/plugins/transforms/cube/src/test/resources/serialize-with-compression-level.xml
b/plugins/transforms/cube/src/test/resources/serialize-with-compression-level.xml
new file mode 100644
index 0000000000..c8b2631a9d
--- /dev/null
+++
b/plugins/transforms/cube/src/test/resources/serialize-with-compression-level.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one or more
+ ~ contributor license agreements. See the NOTICE file distributed with
+ ~ this work for additional information regarding copyright ownership.
+ ~ The ASF licenses this file to You under the Apache License, Version 2.0
+ ~ (the "License"); you may not use this file except in compliance with
+ ~ the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ ~
+ -->
+<transform>
+ <name>/tmp/file-0050.cube</name>
+ <type>CubeOutput</type>
+ <description/>
+ <distribute>Y</distribute>
+ <custom_distribution/>
+ <copies>1</copies>
+ <partitioning>
+ <method>none</method>
+ <schema_name/>
+ </partitioning>
+ <file>
+ <name>${java.io.tmpdir}/file-0050.cube</name>
+ <add_to_result_filenames>N</add_to_result_filenames>
+ <do_not_open_newfile_init>N</do_not_open_newfile_init>
+ <compression_level>FASTEST</compression_level>
+ </file>
+ <attributes></attributes>
+ <GUI>
+ <xloc>416</xloc>
+ <yloc>64</yloc>
+ </GUI>
+</transform>
+
diff --git
a/plugins/transforms/zipfile/src/main/java/org/apache/hop/pipeline/transforms/zipfile/ZipFile.java
b/plugins/transforms/zipfile/src/main/java/org/apache/hop/pipeline/transforms/zipfile/ZipFile.java
index f3ead6bfef..88588d3c2a 100644
---
a/plugins/transforms/zipfile/src/main/java/org/apache/hop/pipeline/transforms/zipfile/ZipFile.java
+++
b/plugins/transforms/zipfile/src/main/java/org/apache/hop/pipeline/transforms/zipfile/ZipFile.java
@@ -24,7 +24,6 @@ import java.io.OutputStream;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
-import java.util.zip.Deflater;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
import java.util.zip.ZipOutputStream;
@@ -374,7 +373,7 @@ public class ZipFile extends BaseTransform<ZipFileMeta,
ZipFileData> {
// Set the method
out.setMethod(ZipOutputStream.DEFLATED);
- out.setLevel(Deflater.BEST_COMPRESSION);
+ out.setLevel(meta.compressionLevelOrNotStored().getLevel());
// Add ZIP entry to output stream.
//
diff --git
a/plugins/transforms/zipfile/src/main/java/org/apache/hop/pipeline/transforms/zipfile/ZipFileDialog.java
b/plugins/transforms/zipfile/src/main/java/org/apache/hop/pipeline/transforms/zipfile/ZipFileDialog.java
index 7b19064677..df36551008 100644
---
a/plugins/transforms/zipfile/src/main/java/org/apache/hop/pipeline/transforms/zipfile/ZipFileDialog.java
+++
b/plugins/transforms/zipfile/src/main/java/org/apache/hop/pipeline/transforms/zipfile/ZipFileDialog.java
@@ -17,11 +17,13 @@
package org.apache.hop.pipeline.transforms.zipfile;
+import org.apache.hop.core.compress.gzip.GzipCompressionLevel;
import org.apache.hop.core.exception.HopException;
import org.apache.hop.core.row.IRowMeta;
import org.apache.hop.core.util.Utils;
import org.apache.hop.core.variables.IVariables;
import org.apache.hop.i18n.BaseMessages;
+import org.apache.hop.metadata.api.IEnumHasCodeAndDescription;
import org.apache.hop.pipeline.PipelineMeta;
import org.apache.hop.ui.core.PropsUi;
import org.apache.hop.ui.core.dialog.BaseDialog;
@@ -72,6 +74,8 @@ public class ZipFileDialog extends BaseTransformDialog {
private Label wlMoveToFolderField;
private CCombo wMoveToFolderField;
+ private CCombo wCompressionLevel;
+
private boolean gotPreviousFields = false;
public ZipFileDialog(
@@ -374,6 +378,31 @@ public class ZipFileDialog extends BaseTransformDialog {
}
});
+ // How hard to compress the entries
+ Label wlCompressionLevel = new Label(wContent, SWT.RIGHT);
+ wlCompressionLevel.setText(BaseMessages.getString(PKG,
"ZipFileDialog.CompressionLevel.Label"));
+ wlCompressionLevel.setToolTipText(
+ BaseMessages.getString(PKG, "ZipFileDialog.CompressionLevel.Tooltip"));
+ PropsUi.setLook(wlCompressionLevel);
+ FormData fdlCompressionLevel = new FormData();
+ fdlCompressionLevel.left = new FormAttachment(0, 0);
+ fdlCompressionLevel.right = new FormAttachment(middle, -margin);
+ fdlCompressionLevel.top = new FormAttachment(wMoveToFolderField, margin);
+ wlCompressionLevel.setLayoutData(fdlCompressionLevel);
+
+ wCompressionLevel = new CCombo(wContent, SWT.BORDER | SWT.READ_ONLY);
+ wCompressionLevel.setItems(
+
IEnumHasCodeAndDescription.getDescriptions(GzipCompressionLevel.class));
+ wCompressionLevel.setToolTipText(
+ BaseMessages.getString(PKG, "ZipFileDialog.CompressionLevel.Tooltip"));
+ PropsUi.setLook(wCompressionLevel);
+ wCompressionLevel.addModifyListener(lsMod);
+ FormData fdCompressionLevel = new FormData();
+ fdCompressionLevel.left = new FormAttachment(middle, 0);
+ fdCompressionLevel.top = new FormAttachment(wMoveToFolderField, margin);
+ fdCompressionLevel.right = new FormAttachment(100, -margin);
+ wCompressionLevel.setLayoutData(fdCompressionLevel);
+
wContent.pack();
Rectangle bounds = wContent.getBounds();
sc.setContent(wContent);
@@ -417,6 +446,7 @@ public class ZipFileDialog extends BaseTransformDialog {
wOverwriteZipEntry.setSelection(input.isOverwriteZipEntry());
wCreateParentFolder.setSelection(input.isCreateParentFolder());
wKeepFolders.setSelection(input.isKeepSourceFolder());
+ wCompressionLevel.select(input.compressionLevelOrNotStored().getIndex());
}
private void cancel() {
@@ -441,6 +471,11 @@ public class ZipFileDialog extends BaseTransformDialog {
input.setCreateParentFolder(wCreateParentFolder.getSelection());
input.setKeepSourceFolder(wKeepFolders.getSelection());
input.setOperationType(ZipFileMeta.getOperationTypeByDesc(wOperation.getText()));
+ input.setCompressionLevel(
+ IEnumHasCodeAndDescription.lookupDescription(
+ GzipCompressionLevel.class,
+ wCompressionLevel.getText(),
+ ZipFileMeta.COMPRESSION_LEVEL_NOT_STORED));
input.setMoveToFolderField(wMoveToFolderField.getText());
transformName = wTransformName.getText(); // return value
diff --git
a/plugins/transforms/zipfile/src/main/java/org/apache/hop/pipeline/transforms/zipfile/ZipFileMeta.java
b/plugins/transforms/zipfile/src/main/java/org/apache/hop/pipeline/transforms/zipfile/ZipFileMeta.java
index a70f2f9c0e..6476131b74 100644
---
a/plugins/transforms/zipfile/src/main/java/org/apache/hop/pipeline/transforms/zipfile/ZipFileMeta.java
+++
b/plugins/transforms/zipfile/src/main/java/org/apache/hop/pipeline/transforms/zipfile/ZipFileMeta.java
@@ -18,9 +18,12 @@
package org.apache.hop.pipeline.transforms.zipfile;
import java.util.List;
+import lombok.Getter;
+import lombok.Setter;
import org.apache.hop.core.CheckResult;
import org.apache.hop.core.ICheckResult;
import org.apache.hop.core.annotations.Transform;
+import org.apache.hop.core.compress.gzip.GzipCompressionLevel;
import org.apache.hop.core.row.IRowMeta;
import org.apache.hop.core.util.Utils;
import org.apache.hop.core.variables.IVariables;
@@ -73,6 +76,22 @@ public class ZipFileMeta extends BaseTransformMeta<ZipFile,
ZipFileData> {
/** Operations type */
private int operationType;
+ /**
+ * The level of a transform saved before the level could be chosen: the
level Zip file always
+ * compressed with, so those transforms keep writing the same archives.
+ */
+ public static final GzipCompressionLevel COMPRESSION_LEVEL_NOT_STORED =
+ GzipCompressionLevel.SMALLEST;
+
+ /** How hard to compress the entries, from 1 (fastest) to 9 (smallest
archive). */
+ @Getter
+ @Setter
+ @HopMetadataProperty(
+ key = "compression_level",
+ storeWithCode = true,
+ injectionKeyDescription = "ZipFileDialog.CompressionLevel.Label")
+ private GzipCompressionLevel compressionLevel;
+
/** The operations description */
public static final String[] operationTypeDesc = {
BaseMessages.getString(PKG, "ZipFileMeta.operationType.DoNothing"),
@@ -241,6 +260,17 @@ public class ZipFileMeta extends
BaseTransformMeta<ZipFile, ZipFileData> {
createParentFolder = false;
keepSourceFolder = false;
operationType = OPERATION_TYPE_NOTHING;
+ // A newly created transform only: a saved one without a level keeps
+ // COMPRESSION_LEVEL_NOT_STORED.
+ compressionLevel = GzipCompressionLevel.STANDARD;
+ }
+
+ /**
+ * @return the level to compress with: the stored one, or {@link
#COMPRESSION_LEVEL_NOT_STORED}
+ * for a transform saved without a level
+ */
+ public GzipCompressionLevel compressionLevelOrNotStored() {
+ return compressionLevel == null ? COMPRESSION_LEVEL_NOT_STORED :
compressionLevel;
}
private static String getOperationTypeCode(int i) {
diff --git
a/plugins/transforms/zipfile/src/main/resources/org/apache/hop/pipeline/transforms/zipfile/messages/messages_en_US.properties
b/plugins/transforms/zipfile/src/main/resources/org/apache/hop/pipeline/transforms/zipfile/messages/messages_en_US.properties
index 8c1cab6745..9092c621a9 100644
---
a/plugins/transforms/zipfile/src/main/resources/org/apache/hop/pipeline/transforms/zipfile/messages/messages_en_US.properties
+++
b/plugins/transforms/zipfile/src/main/resources/org/apache/hop/pipeline/transforms/zipfile/messages/messages_en_US.properties
@@ -46,6 +46,8 @@ ZipFile.Name=Zip file
ZipFileDialog.AddResult.Label=Add zip filename to result
ZipFileDialog.AddResult.Tooltip=Add target zip filename to result
ZipFileDialog.BaseFolderField.Label=Base folder fieldname
+ZipFileDialog.CompressionLevel.Label=Compression level
+ZipFileDialog.CompressionLevel.Tooltip=How hard to compress the files. 1 is
the fastest, 9 gives the smallest archive. A lower level zips faster for a
somewhat larger archive.
ZipFileDialog.CreateParentFolder.Label=Create target parent folder
ZipFileDialog.CreateParentFolder.Tooltip=Create target parent folder if
necessary
ZipFileDialog.FailedToGetFields.DialogMessage=Unable to get fields from
previous transforms because of an error
diff --git
a/plugins/transforms/zipfile/src/test/java/org/apache/hop/pipeline/transforms/zipfile/ZipFileCompressionTest.java
b/plugins/transforms/zipfile/src/test/java/org/apache/hop/pipeline/transforms/zipfile/ZipFileCompressionTest.java
new file mode 100644
index 0000000000..e2f9d87ab9
--- /dev/null
+++
b/plugins/transforms/zipfile/src/test/java/org/apache/hop/pipeline/transforms/zipfile/ZipFileCompressionTest.java
@@ -0,0 +1,247 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hop.pipeline.transforms.zipfile;
+
+import static org.junit.jupiter.api.Assertions.assertArrayEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.when;
+
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.zip.Deflater;
+import java.util.zip.DeflaterOutputStream;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipOutputStream;
+import org.apache.hop.core.BlockingRowSet;
+import org.apache.hop.core.HopEnvironment;
+import org.apache.hop.core.compress.gzip.GzipCompressionLevel;
+import org.apache.hop.core.logging.ILoggingObject;
+import org.apache.hop.core.row.RowMeta;
+import org.apache.hop.core.row.value.ValueMetaString;
+import org.apache.hop.junit.rules.RestoreHopEngineEnvironmentExtension;
+import org.apache.hop.pipeline.transform.TransformSerializationTestUtil;
+import org.apache.hop.pipeline.transforms.mock.TransformMockHelper;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
+import org.junit.jupiter.api.io.TempDir;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.EnumSource;
+
+/**
+ * The compression level Zip file writes its entries with. The content repeats
enough for the levels
+ * to give another size, so the compressed size of an entry tells which level
wrote it.
+ */
+class ZipFileCompressionTest {
+
+ @RegisterExtension
+ static RestoreHopEngineEnvironmentExtension env = new
RestoreHopEngineEnvironmentExtension();
+
+ @TempDir Path tempDir;
+
+ private TransformMockHelper<ZipFileMeta, ZipFileData> helper;
+
+ @BeforeAll
+ static void initHop() throws Exception {
+ HopEnvironment.init();
+ }
+
+ @BeforeEach
+ void setUp() {
+ helper =
+ new TransformMockHelper<>("ZipFileCompressionTest", ZipFileMeta.class,
ZipFileData.class);
+ when(helper.logChannelFactory.create(any(), any(ILoggingObject.class)))
+ .thenReturn(helper.iLogChannel);
+
when(helper.logChannelFactory.create(any())).thenReturn(helper.iLogChannel);
+ when(helper.pipeline.isRunning()).thenReturn(true);
+ }
+
+ @AfterEach
+ void tearDown() {
+ helper.cleanUp();
+ }
+
+ @Test
+ void theLevelsGiveAnotherSizeForTheTestContent() throws Exception {
+ assertTrue(deflatedSize(1) > deflatedSize(6));
+ assertTrue(deflatedSize(6) > deflatedSize(9));
+ }
+
+ /** A pipeline saved before the level could be chosen compresses as hard as
it always did. */
+ @Test
+ void transformSavedWithoutALevelCompressesAtLevelNine() throws Exception {
+ ZipFileMeta meta = meta();
+
+ assertNull(meta.getCompressionLevel());
+ Path zip = zip(meta, "saved.zip");
+
+ assertEntry(zip, 9);
+ }
+
+ @Test
+ void transformLoadedWithoutALevelCompressesAtLevelNine() throws Exception {
+ ZipFileMeta meta =
+ TransformSerializationTestUtil.testSerialization(
+ "/zip-file-without-compression-level.xml", ZipFileMeta.class);
+
+ assertNull(meta.getCompressionLevel());
+ assertEquals(GzipCompressionLevel.SMALLEST,
meta.compressionLevelOrNotStored());
+ assertFalse(meta.getXml().contains("compression_level>"), "no level
appears by loading");
+ assertEntry(zip(meta, "loaded.zip"), 9);
+ }
+
+ @Test
+ void theLevelIsSavedAndLoaded() throws Exception {
+ ZipFileMeta meta =
+ TransformSerializationTestUtil.testSerialization(
+ "/zip-file-with-compression-level.xml", ZipFileMeta.class);
+
+ assertEquals(GzipCompressionLevel.FASTEST, meta.getCompressionLevel());
+
assertTrue(meta.getXml().contains("<compression_level>FASTEST</compression_level>"));
+ assertEntry(zip(meta, "loaded.zip"), 1);
+ }
+
+ @Test
+ void newTransformCompressesAtLevelSix() throws Exception {
+ ZipFileMeta meta = meta();
+ meta.setDefault();
+
+ assertEquals(GzipCompressionLevel.STANDARD, meta.getCompressionLevel());
+ assertEntry(zip(meta, "new.zip"), 6);
+ }
+
+ @ParameterizedTest
+ @EnumSource(GzipCompressionLevel.class)
+ void entryIsCompressedAtTheChosenLevel(GzipCompressionLevel level) throws
Exception {
+ ZipFileMeta meta = meta();
+ meta.setCompressionLevel(level);
+
+ assertEntry(zip(meta, level + ".zip"), level.getLevel());
+ }
+
+ /** Updating an archive keeps what is in it and adds the new entry at the
chosen level. */
+ @Test
+ void updatedArchiveKeepsItsEntriesAndAddsTheNewOneAtTheChosenLevel() throws
Exception {
+ Path zip = tempDir.resolve("update.zip");
+ try (ZipOutputStream out = new
ZipOutputStream(Files.newOutputStream(zip))) {
+ out.putNextEntry(new ZipEntry("old.txt"));
+ out.write("old".getBytes(StandardCharsets.UTF_8));
+ out.closeEntry();
+ }
+ ZipFileMeta meta = meta();
+ meta.setOverwriteZipEntry(true); // update the existing zip instead of
replacing it
+ meta.setCompressionLevel(GzipCompressionLevel.FASTEST);
+
+ zip(meta, "update.zip");
+
+ try (java.util.zip.ZipFile archive = new
java.util.zip.ZipFile(zip.toFile())) {
+ assertEquals(2, archive.size());
+ try (InputStream in =
archive.getInputStream(archive.getEntry("old.txt"))) {
+ assertEquals("old", new String(in.readAllBytes(),
StandardCharsets.UTF_8));
+ }
+ ZipEntry added = archive.getEntry("source.txt");
+ assertEquals(deflatedSize(1), added.getCompressedSize());
+ try (InputStream in = archive.getInputStream(added)) {
+ assertArrayEquals(content(), in.readAllBytes());
+ }
+ }
+ }
+
+ private static ZipFileMeta meta() {
+ ZipFileMeta meta = new ZipFileMeta();
+ meta.setSourceFilenameField("source");
+ meta.setTargetFilenameField("zip");
+ return meta;
+ }
+
+ private Path zip(ZipFileMeta meta, String name) throws Exception {
+ Path source = tempDir.resolve("source.txt");
+ Files.write(source, content());
+ Path zip = tempDir.resolve(name);
+
+ RowMeta rowMeta = new RowMeta();
+ rowMeta.addValueMeta(new ValueMetaString("source"));
+ rowMeta.addValueMeta(new ValueMetaString("zip"));
+ ZipFile transform =
+ new ZipFile(
+ helper.transformMeta, meta, new ZipFileData(), 0,
helper.pipelineMeta, helper.pipeline);
+ BlockingRowSet input = new BlockingRowSet(1);
+ input.putRow(rowMeta, new Object[] {source.toString(), zip.toString()});
+ input.setDone();
+ transform.setInputRowSets(new ArrayList<>(List.of(input)));
+ transform.setOutputRowSets(List.of(new BlockingRowSet(2)));
+ while (transform.processRow()) {
+ // Process all rows. A row that fails stops the transform.
+ }
+ assertEquals(0, transform.getErrors());
+ return zip;
+ }
+
+ /** The archive has the one entry, with the content of the source and the
size of the level. */
+ private static void assertEntry(Path zip, int level) throws Exception {
+ try (java.util.zip.ZipFile archive = new
java.util.zip.ZipFile(zip.toFile())) {
+ assertEquals(1, archive.size());
+ ZipEntry entry = archive.entries().nextElement();
+ assertEquals(ZipEntry.DEFLATED, entry.getMethod());
+ assertEquals(deflatedSize(level), entry.getCompressedSize());
+ try (InputStream in = archive.getInputStream(entry)) {
+ assertEquals(
+ new String(content(), StandardCharsets.UTF_8),
+ new String(in.readAllBytes(), StandardCharsets.UTF_8));
+ }
+ }
+ }
+
+ /** The size java.util.zip gives a zip entry with this content at a level. */
+ private static long deflatedSize(int level) throws Exception {
+ ByteArrayOutputStream bytes = new ByteArrayOutputStream();
+ Deflater deflater = new Deflater(level, true);
+ try (DeflaterOutputStream out = new DeflaterOutputStream(bytes, deflater))
{
+ out.write(content());
+ } finally {
+ deflater.end();
+ }
+ return bytes.size();
+ }
+
+ private static byte[] content() {
+ StringBuilder content = new StringBuilder();
+ for (int i = 0; i < 20_000; i++) {
+ content
+ .append(i)
+ .append(";customer ")
+ .append(i % 97)
+ .append(";city ")
+ .append(i * 31 % 113)
+ .append(';')
+ .append((i % 1000) * 1.25)
+ .append('\n');
+ }
+ return content.toString().getBytes(StandardCharsets.UTF_8);
+ }
+}
diff --git
a/plugins/transforms/zipfile/src/test/java/org/apache/hop/pipeline/transforms/zipfile/ZipFileMetaLoadSaveTest.java
b/plugins/transforms/zipfile/src/test/java/org/apache/hop/pipeline/transforms/zipfile/ZipFileMetaLoadSaveTest.java
index 9644c6caa2..83dd793cce 100644
---
a/plugins/transforms/zipfile/src/test/java/org/apache/hop/pipeline/transforms/zipfile/ZipFileMetaLoadSaveTest.java
+++
b/plugins/transforms/zipfile/src/test/java/org/apache/hop/pipeline/transforms/zipfile/ZipFileMetaLoadSaveTest.java
@@ -21,10 +21,12 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.hop.core.HopEnvironment;
+import org.apache.hop.core.compress.gzip.GzipCompressionLevel;
import org.apache.hop.core.exception.HopException;
import org.apache.hop.core.plugins.PluginRegistry;
import org.apache.hop.junit.rules.RestoreHopEngineEnvironmentExtension;
import org.apache.hop.pipeline.transforms.loadsave.LoadSaveTester;
+import
org.apache.hop.pipeline.transforms.loadsave.validator.EnumLoadSaveValidator;
import
org.apache.hop.pipeline.transforms.loadsave.validator.IFieldLoadSaveValidator;
import
org.apache.hop.pipeline.transforms.loadsave.validator.IntLoadSaveValidator;
import org.junit.jupiter.api.BeforeEach;
@@ -53,6 +55,7 @@ class ZipFileMetaLoadSaveTest {
"createParentFolder",
"keepSourceFolder",
"operationType",
+ "compressionLevel",
"operationTypeMeta");
Map<String, String> getterMap = new HashMap<>();
@@ -64,6 +67,9 @@ class ZipFileMetaLoadSaveTest {
attrValidatorMap.put(
"operationType", new
IntLoadSaveValidator(ZipFileMeta.operationTypeCode.length));
+ attrValidatorMap.put(
+ "compressionLevel", new
EnumLoadSaveValidator<>(GzipCompressionLevel.STANDARD));
+
Map<String, IFieldLoadSaveValidator<?>> typeValidatorMap = new HashMap<>();
loadSaveTester =
diff --git
a/plugins/transforms/zipfile/src/test/resources/zip-file-with-compression-level.xml
b/plugins/transforms/zipfile/src/test/resources/zip-file-with-compression-level.xml
new file mode 100644
index 0000000000..0ac28d5359
--- /dev/null
+++
b/plugins/transforms/zipfile/src/test/resources/zip-file-with-compression-level.xml
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one or more
+ ~ contributor license agreements. See the NOTICE file distributed with
+ ~ this work for additional information regarding copyright ownership.
+ ~ The ASF licenses this file to You under the Apache License, Version 2.0
+ ~ (the "License"); you may not use this file except in compliance with
+ ~ the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ ~
+ -->
+<transform>
+ <name>Zip file</name>
+ <type>ZipFile</type>
+ <description/>
+ <distribute>Y</distribute>
+ <custom_distribution/>
+ <copies>1</copies>
+ <partitioning>
+ <method>none</method>
+ <schema_name/>
+ </partitioning>
+ <sourcefilenamefield>source</sourcefilenamefield>
+ <targetfilenamefield>zip</targetfilenamefield>
+ <operation_type/>
+ <addresultfilenames>N</addresultfilenames>
+ <overwritezipentry>N</overwritezipentry>
+ <createparentfolder>N</createparentfolder>
+ <keepsourcefolder>N</keepsourcefolder>
+ <compression_level>FASTEST</compression_level>
+ <attributes/>
+ <GUI>
+ <xloc>416</xloc>
+ <yloc>64</yloc>
+ </GUI>
+</transform>
diff --git
a/plugins/transforms/zipfile/src/test/resources/zip-file-without-compression-level.xml
b/plugins/transforms/zipfile/src/test/resources/zip-file-without-compression-level.xml
new file mode 100644
index 0000000000..4d39e9058d
--- /dev/null
+++
b/plugins/transforms/zipfile/src/test/resources/zip-file-without-compression-level.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one or more
+ ~ contributor license agreements. See the NOTICE file distributed with
+ ~ this work for additional information regarding copyright ownership.
+ ~ The ASF licenses this file to You under the Apache License, Version 2.0
+ ~ (the "License"); you may not use this file except in compliance with
+ ~ the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ ~
+ -->
+<transform>
+ <name>Zip file</name>
+ <type>ZipFile</type>
+ <description/>
+ <distribute>Y</distribute>
+ <custom_distribution/>
+ <copies>1</copies>
+ <partitioning>
+ <method>none</method>
+ <schema_name/>
+ </partitioning>
+ <sourcefilenamefield>source</sourcefilenamefield>
+ <targetfilenamefield>zip</targetfilenamefield>
+ <operation_type/>
+ <addresultfilenames>N</addresultfilenames>
+ <overwritezipentry>N</overwritezipentry>
+ <createparentfolder>N</createparentfolder>
+ <keepsourcefolder>N</keepsourcefolder>
+ <attributes/>
+ <GUI>
+ <xloc>416</xloc>
+ <yloc>64</yloc>
+ </GUI>
+</transform>