You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by bb...@apache.org on 2016/09/13 15:13:23 UTC

nifi git commit: NIFI-2765: Fixed Kerberos support for PutHiveStreaming

Repository: nifi
Updated Branches:
  refs/heads/master b48355e75 -> 6c9291ad5


NIFI-2765: Fixed Kerberos support for PutHiveStreaming

This closes #1012.

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


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

Branch: refs/heads/master
Commit: 6c9291ad530c3b47ed58db9d2c23195cf5f07df7
Parents: b48355e
Author: Matt Burgess <ma...@apache.org>
Authored: Tue Sep 13 10:20:27 2016 -0400
Committer: Bryan Bende <bb...@apache.org>
Committed: Tue Sep 13 11:13:06 2016 -0400

----------------------------------------------------------------------
 .../nifi/processors/hive/PutHiveStreaming.java  | 45 +++++++++-----------
 1 file changed, 20 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/nifi/blob/6c9291ad/nifi-nar-bundles/nifi-hive-bundle/nifi-hive-processors/src/main/java/org/apache/nifi/processors/hive/PutHiveStreaming.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-hive-bundle/nifi-hive-processors/src/main/java/org/apache/nifi/processors/hive/PutHiveStreaming.java b/nifi-nar-bundles/nifi-hive-bundle/nifi-hive-processors/src/main/java/org/apache/nifi/processors/hive/PutHiveStreaming.java
index b4822b2..84eda83 100644
--- a/nifi-nar-bundles/nifi-hive-bundle/nifi-hive-processors/src/main/java/org/apache/nifi/processors/hive/PutHiveStreaming.java
+++ b/nifi-nar-bundles/nifi-hive-bundle/nifi-hive-processors/src/main/java/org/apache/nifi/processors/hive/PutHiveStreaming.java
@@ -238,8 +238,8 @@ public class PutHiveStreaming extends AbstractProcessor {
                     + "can be used to provide a retry capability since full rollback is not possible.")
             .build();
 
-    private final static List<PropertyDescriptor> propertyDescriptors;
-    private final static Set<Relationship> relationships;
+    private List<PropertyDescriptor> propertyDescriptors;
+    private Set<Relationship> relationships;
 
     private static final long TICKET_RENEWAL_PERIOD = 60000;
 
@@ -258,21 +258,24 @@ public class PutHiveStreaming extends AbstractProcessor {
     protected Map<HiveEndPoint, HiveWriter> allWriters;
 
 
-    /*
-     * Will ensure that the list of property descriptors is build only once.
-     * Will also create a Set of relationships
-     */
-    static {
-        propertyDescriptors = new ArrayList<>();
-        propertyDescriptors.add(METASTORE_URI);
-        propertyDescriptors.add(HIVE_CONFIGURATION_RESOURCES);
-        propertyDescriptors.add(DB_NAME);
-        propertyDescriptors.add(TABLE_NAME);
-        propertyDescriptors.add(PARTITION_COLUMNS);
-        propertyDescriptors.add(AUTOCREATE_PARTITIONS);
-        propertyDescriptors.add(MAX_OPEN_CONNECTIONS);
-        propertyDescriptors.add(HEARTBEAT_INTERVAL);
-        propertyDescriptors.add(TXNS_PER_BATCH);
+    @Override
+    protected void init(ProcessorInitializationContext context) {
+        List<PropertyDescriptor> props = new ArrayList<>();
+        props.add(METASTORE_URI);
+        props.add(HIVE_CONFIGURATION_RESOURCES);
+        props.add(DB_NAME);
+        props.add(TABLE_NAME);
+        props.add(PARTITION_COLUMNS);
+        props.add(AUTOCREATE_PARTITIONS);
+        props.add(MAX_OPEN_CONNECTIONS);
+        props.add(HEARTBEAT_INTERVAL);
+        props.add(TXNS_PER_BATCH);
+
+        kerberosConfigFile = context.getKerberosConfigurationFile();
+        kerberosProperties = new KerberosProperties(kerberosConfigFile);
+        props.add(kerberosProperties.getKerberosPrincipal());
+        props.add(kerberosProperties.getKerberosKeytab());
+        propertyDescriptors = Collections.unmodifiableList(props);
 
         Set<Relationship> _relationships = new HashSet<>();
         _relationships.add(REL_SUCCESS);
@@ -282,14 +285,6 @@ public class PutHiveStreaming extends AbstractProcessor {
     }
 
     @Override
-    protected void init(ProcessorInitializationContext context) {
-        kerberosConfigFile = context.getKerberosConfigurationFile();
-        kerberosProperties = new KerberosProperties(kerberosConfigFile);
-        propertyDescriptors.add(kerberosProperties.getKerberosPrincipal());
-        propertyDescriptors.add(kerberosProperties.getKerberosKeytab());
-    }
-
-    @Override
     protected List<PropertyDescriptor> getSupportedPropertyDescriptors() {
         return propertyDescriptors;
     }