Repository: nifi
Updated Branches:
  refs/heads/master d63fa8a82 -> ba49b8427


NIFI-3191 - HDFS Processors Should Allow Choosing LZO Compression

This closes #1802.

Signed-off-by: Bryan Bende <bbe...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/nifi/repo
Commit: http://git-wip-us.apache.org/repos/asf/nifi/commit/ba49b842
Tree: http://git-wip-us.apache.org/repos/asf/nifi/tree/ba49b842
Diff: http://git-wip-us.apache.org/repos/asf/nifi/diff/ba49b842

Branch: refs/heads/master
Commit: ba49b8427c3c4be0a5a972f95286e29b08350f2e
Parents: d63fa8a
Author: Pierre Villard <pierre.villard...@gmail.com>
Authored: Mon May 15 19:55:48 2017 +0200
Committer: Bryan Bende <bbe...@apache.org>
Committed: Wed May 24 11:04:00 2017 -0400

----------------------------------------------------------------------
 .../hadoop/AbstractHadoopProcessor.java         |  2 +-
 .../nifi/processors/hadoop/CompressionType.java | 39 ++++++++++++++++----
 2 files changed, 33 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/nifi/blob/ba49b842/nifi-nar-bundles/nifi-extension-utils/nifi-hadoop-utils/src/main/java/org/apache/nifi/processors/hadoop/AbstractHadoopProcessor.java
----------------------------------------------------------------------
diff --git 
a/nifi-nar-bundles/nifi-extension-utils/nifi-hadoop-utils/src/main/java/org/apache/nifi/processors/hadoop/AbstractHadoopProcessor.java
 
b/nifi-nar-bundles/nifi-extension-utils/nifi-hadoop-utils/src/main/java/org/apache/nifi/processors/hadoop/AbstractHadoopProcessor.java
index 0a8ed12..9f99500 100644
--- 
a/nifi-nar-bundles/nifi-extension-utils/nifi-hadoop-utils/src/main/java/org/apache/nifi/processors/hadoop/AbstractHadoopProcessor.java
+++ 
b/nifi-nar-bundles/nifi-extension-utils/nifi-hadoop-utils/src/main/java/org/apache/nifi/processors/hadoop/AbstractHadoopProcessor.java
@@ -82,7 +82,7 @@ public abstract class AbstractHadoopProcessor extends 
AbstractProcessor {
     public static final PropertyDescriptor COMPRESSION_CODEC = new 
PropertyDescriptor.Builder()
             .name("Compression codec")
             .required(true)
-            .allowableValues(CompressionType.values())
+            .allowableValues(CompressionType.allowableValues())
             .defaultValue(CompressionType.NONE.toString())
             .build();
 

http://git-wip-us.apache.org/repos/asf/nifi/blob/ba49b842/nifi-nar-bundles/nifi-extension-utils/nifi-hadoop-utils/src/main/java/org/apache/nifi/processors/hadoop/CompressionType.java
----------------------------------------------------------------------
diff --git 
a/nifi-nar-bundles/nifi-extension-utils/nifi-hadoop-utils/src/main/java/org/apache/nifi/processors/hadoop/CompressionType.java
 
b/nifi-nar-bundles/nifi-extension-utils/nifi-hadoop-utils/src/main/java/org/apache/nifi/processors/hadoop/CompressionType.java
index 43e6e80..bf0eb08 100644
--- 
a/nifi-nar-bundles/nifi-extension-utils/nifi-hadoop-utils/src/main/java/org/apache/nifi/processors/hadoop/CompressionType.java
+++ 
b/nifi-nar-bundles/nifi-extension-utils/nifi-hadoop-utils/src/main/java/org/apache/nifi/processors/hadoop/CompressionType.java
@@ -16,23 +16,39 @@
  */
 package org.apache.nifi.processors.hadoop;
 
+import java.util.ArrayList;
+import java.util.List;
+
 import org.apache.hadoop.io.compress.BZip2Codec;
 import org.apache.hadoop.io.compress.DefaultCodec;
 import org.apache.hadoop.io.compress.GzipCodec;
 import org.apache.hadoop.io.compress.Lz4Codec;
 import org.apache.hadoop.io.compress.SnappyCodec;
+import org.apache.nifi.components.AllowableValue;
 
 /**
  * Compression Type Enum for Hadoop related processors.
  */
 public enum CompressionType {
-    NONE,
-    DEFAULT,
-    BZIP,
-    GZIP,
-    LZ4,
-    SNAPPY,
-    AUTOMATIC;
+
+    NONE("No compression"),
+    DEFAULT("Default ZLIB compression"),
+    BZIP("BZIP compression"),
+    GZIP("GZIP compression"),
+    LZ4("LZ4 compression"),
+    LZO("LZO compression - it assumes LD_LIBRARY_PATH has been set and jar is 
available"),
+    SNAPPY("Snappy compression"),
+    AUTOMATIC("Will attempt to automatically detect the compression codec.");
+
+    private final String description;
+
+    private CompressionType(String description) {
+        this.description = description;
+    }
+
+    private String getDescription() {
+        return this.description;
+    }
 
     @Override
     public String toString() {
@@ -42,10 +58,19 @@ public enum CompressionType {
             case BZIP: return BZip2Codec.class.getName();
             case GZIP: return GzipCodec.class.getName();
             case LZ4: return Lz4Codec.class.getName();
+            case LZO: return "com.hadoop.compression.lzo.LzoCodec";
             case SNAPPY: return SnappyCodec.class.getName();
             case AUTOMATIC: return "Automatically Detected";
         }
         return null;
     }
 
+    public static AllowableValue[] allowableValues() {
+        List<AllowableValue> values = new ArrayList<AllowableValue>();
+        for (CompressionType type : CompressionType.values()) {
+            values.add(new AllowableValue(type.name(), type.name(), 
type.getDescription()));
+        }
+        return values.toArray(new AllowableValue[values.size()]);
+    }
+
 }

Reply via email to