Repository: nifi
Updated Branches:
  refs/heads/master dd8b25ab4 -> f7035f049


NIFI-4637: Fix ExtensionManager warning on VisibilityLabelService

This closes #2729

Signed-off-by: Mike Thomsen <[email protected]>


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

Branch: refs/heads/master
Commit: f7035f0497314d10d0e245a22127dfbedb36e850
Parents: dd8b25a
Author: Koji Kawamura <[email protected]>
Authored: Tue May 22 13:25:08 2018 +0900
Committer: Mike Thomsen <[email protected]>
Committed: Wed May 23 07:34:49 2018 -0400

----------------------------------------------------------------------
 .../HBase_1_1_2_ClientMapCacheService.java      |  7 +--
 .../hbase/HBase_1_1_2_RecordLookupService.java  |  6 ++-
 .../hbase/IntegrationTestClientService.java     | 47 ------------------
 .../nifi/hbase/VisibilityLabelService.java      | 50 --------------------
 .../apache/nifi/hbase/VisibilityLabelUtils.java | 50 ++++++++++++++++++++
 5 files changed, 58 insertions(+), 102 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/nifi/blob/f7035f04/nifi-nar-bundles/nifi-standard-services/nifi-hbase_1_1_2-client-service-bundle/nifi-hbase_1_1_2-client-service/src/main/java/org/apache/nifi/hbase/HBase_1_1_2_ClientMapCacheService.java
----------------------------------------------------------------------
diff --git 
a/nifi-nar-bundles/nifi-standard-services/nifi-hbase_1_1_2-client-service-bundle/nifi-hbase_1_1_2-client-service/src/main/java/org/apache/nifi/hbase/HBase_1_1_2_ClientMapCacheService.java
 
b/nifi-nar-bundles/nifi-standard-services/nifi-hbase_1_1_2-client-service-bundle/nifi-hbase_1_1_2-client-service/src/main/java/org/apache/nifi/hbase/HBase_1_1_2_ClientMapCacheService.java
index 634ebd9..3991584 100644
--- 
a/nifi-nar-bundles/nifi-standard-services/nifi-hbase_1_1_2-client-service-bundle/nifi-hbase_1_1_2-client-service/src/main/java/org/apache/nifi/hbase/HBase_1_1_2_ClientMapCacheService.java
+++ 
b/nifi-nar-bundles/nifi-standard-services/nifi-hbase_1_1_2-client-service-bundle/nifi-hbase_1_1_2-client-service/src/main/java/org/apache/nifi/hbase/HBase_1_1_2_ClientMapCacheService.java
@@ -34,7 +34,6 @@ import 
org.apache.nifi.distributed.cache.client.DistributedMapCacheClient;
 import org.apache.nifi.distributed.cache.client.Serializer;
 import org.apache.nifi.expression.ExpressionLanguageScope;
 import org.apache.nifi.distributed.cache.client.Deserializer;
-import java.io.ByteArrayOutputStream;
 import org.apache.nifi.reporting.InitializationException;
 
 import java.nio.charset.StandardCharsets;
@@ -46,12 +45,14 @@ import org.apache.nifi.hbase.put.PutColumn;
 
 import org.apache.nifi.processor.util.StandardValidators;
 
+import static org.apache.nifi.hbase.VisibilityLabelUtils.AUTHORIZATIONS;
+
 @Tags({"distributed", "cache", "state", "map", "cluster","hbase"})
 @SeeAlso(classNames = {"org.apache.nifi.hbase.HBase_1_1_2_ClientService"})
 @CapabilityDescription("Provides the ability to use an HBase table as a cache, 
in place of a DistributedMapCache."
     + " Uses a HBase_1_1_2_ClientService controller to communicate with 
HBase.")
 
-public class HBase_1_1_2_ClientMapCacheService extends 
AbstractControllerService implements DistributedMapCacheClient, 
VisibilityLabelService {
+public class HBase_1_1_2_ClientMapCacheService extends 
AbstractControllerService implements DistributedMapCacheClient {
 
     static final PropertyDescriptor HBASE_CLIENT_SERVICE = new 
PropertyDescriptor.Builder()
         .name("HBase Client Service")
@@ -120,7 +121,7 @@ public class HBase_1_1_2_ClientMapCacheService extends 
AbstractControllerService
         hBaseColumnFamilyBytes    = 
hBaseColumnFamily.getBytes(StandardCharsets.UTF_8);
         hBaseColumnQualifierBytes = 
hBaseColumnQualifier.getBytes(StandardCharsets.UTF_8);
 
-        authorizations = getAuthorizations(context);
+        authorizations = VisibilityLabelUtils.getAuthorizations(context);
     }
 
     private <T> byte[] serialize(final T value, final Serializer<T> 
serializer) throws IOException {

http://git-wip-us.apache.org/repos/asf/nifi/blob/f7035f04/nifi-nar-bundles/nifi-standard-services/nifi-hbase_1_1_2-client-service-bundle/nifi-hbase_1_1_2-client-service/src/main/java/org/apache/nifi/hbase/HBase_1_1_2_RecordLookupService.java
----------------------------------------------------------------------
diff --git 
a/nifi-nar-bundles/nifi-standard-services/nifi-hbase_1_1_2-client-service-bundle/nifi-hbase_1_1_2-client-service/src/main/java/org/apache/nifi/hbase/HBase_1_1_2_RecordLookupService.java
 
b/nifi-nar-bundles/nifi-standard-services/nifi-hbase_1_1_2-client-service-bundle/nifi-hbase_1_1_2-client-service/src/main/java/org/apache/nifi/hbase/HBase_1_1_2_RecordLookupService.java
index 12fb6cf..50e526e 100644
--- 
a/nifi-nar-bundles/nifi-standard-services/nifi-hbase_1_1_2-client-service-bundle/nifi-hbase_1_1_2-client-service/src/main/java/org/apache/nifi/hbase/HBase_1_1_2_RecordLookupService.java
+++ 
b/nifi-nar-bundles/nifi-standard-services/nifi-hbase_1_1_2-client-service-bundle/nifi-hbase_1_1_2-client-service/src/main/java/org/apache/nifi/hbase/HBase_1_1_2_RecordLookupService.java
@@ -51,10 +51,12 @@ import java.util.Map;
 import java.util.Optional;
 import java.util.Set;
 
+import static org.apache.nifi.hbase.VisibilityLabelUtils.AUTHORIZATIONS;
+
 @Tags({"hbase", "record", "lookup", "service"})
 @CapabilityDescription("A lookup service that retrieves one or more columns 
from HBase and returns them as a record. The lookup coordinates " +
         "must contain 'rowKey' which will be the HBase row id.")
-public class HBase_1_1_2_RecordLookupService extends AbstractControllerService 
implements LookupService<Record>, VisibilityLabelService {
+public class HBase_1_1_2_RecordLookupService extends AbstractControllerService 
implements LookupService<Record> {
 
     static final String ROW_KEY_KEY = "rowKey";
     private static final Set<String> REQUIRED_KEYS = 
Collections.unmodifiableSet(new HashSet<>(Arrays.asList(ROW_KEY_KEY)));
@@ -170,7 +172,7 @@ public class HBase_1_1_2_RecordLookupService extends 
AbstractControllerService i
         this.tableName = context.getProperty(TABLE_NAME).getValue();
         this.columns = 
getColumns(context.getProperty(RETURN_COLUMNS).getValue());
         this.charset = 
Charset.forName(context.getProperty(CHARSET).getValue());
-        this.authorizations = getAuthorizations(context);
+        this.authorizations = VisibilityLabelUtils.getAuthorizations(context);
     }
 
     @OnDisabled

http://git-wip-us.apache.org/repos/asf/nifi/blob/f7035f04/nifi-nar-bundles/nifi-standard-services/nifi-hbase_1_1_2-client-service-bundle/nifi-hbase_1_1_2-client-service/src/main/java/org/apache/nifi/hbase/IntegrationTestClientService.java
----------------------------------------------------------------------
diff --git 
a/nifi-nar-bundles/nifi-standard-services/nifi-hbase_1_1_2-client-service-bundle/nifi-hbase_1_1_2-client-service/src/main/java/org/apache/nifi/hbase/IntegrationTestClientService.java
 
b/nifi-nar-bundles/nifi-standard-services/nifi-hbase_1_1_2-client-service-bundle/nifi-hbase_1_1_2-client-service/src/main/java/org/apache/nifi/hbase/IntegrationTestClientService.java
deleted file mode 100644
index 452f6c2..0000000
--- 
a/nifi-nar-bundles/nifi-standard-services/nifi-hbase_1_1_2-client-service-bundle/nifi-hbase_1_1_2-client-service/src/main/java/org/apache/nifi/hbase/IntegrationTestClientService.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * 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.nifi.hbase;
-
-import org.apache.hadoop.hbase.client.Connection;
-import org.apache.nifi.annotation.lifecycle.OnEnabled;
-import org.apache.nifi.components.ValidationContext;
-import org.apache.nifi.components.ValidationResult;
-import org.apache.nifi.controller.ConfigurationContext;
-import org.apache.nifi.reporting.InitializationException;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collection;
-
-public class IntegrationTestClientService extends HBase_1_1_2_ClientService {
-    IntegrationTestClientService(Connection hbaseConnection) {
-        super();
-        setConnection(hbaseConnection);
-    }
-
-
-    @Override
-    protected Collection<ValidationResult> customValidate(ValidationContext 
validationContext) {
-        return new ArrayList<>();
-    }
-
-    @OnEnabled
-    public void onEnabled(final ConfigurationContext context) throws 
InitializationException, IOException, InterruptedException {
-
-    }
-}

http://git-wip-us.apache.org/repos/asf/nifi/blob/f7035f04/nifi-nar-bundles/nifi-standard-services/nifi-hbase_1_1_2-client-service-bundle/nifi-hbase_1_1_2-client-service/src/main/java/org/apache/nifi/hbase/VisibilityLabelService.java
----------------------------------------------------------------------
diff --git 
a/nifi-nar-bundles/nifi-standard-services/nifi-hbase_1_1_2-client-service-bundle/nifi-hbase_1_1_2-client-service/src/main/java/org/apache/nifi/hbase/VisibilityLabelService.java
 
b/nifi-nar-bundles/nifi-standard-services/nifi-hbase_1_1_2-client-service-bundle/nifi-hbase_1_1_2-client-service/src/main/java/org/apache/nifi/hbase/VisibilityLabelService.java
deleted file mode 100644
index 9c9ab72..0000000
--- 
a/nifi-nar-bundles/nifi-standard-services/nifi-hbase_1_1_2-client-service-bundle/nifi-hbase_1_1_2-client-service/src/main/java/org/apache/nifi/hbase/VisibilityLabelService.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * 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.nifi.hbase;
-
-import org.apache.nifi.components.PropertyDescriptor;
-import org.apache.nifi.controller.ConfigurationContext;
-import org.apache.nifi.processor.util.StandardValidators;
-import org.apache.nifi.util.StringUtils;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-public interface VisibilityLabelService {
-    PropertyDescriptor AUTHORIZATIONS = new PropertyDescriptor.Builder()
-        .name("hb-lu-authorizations")
-        .displayName("Authorizations")
-        .description("The list of authorization tokens to be used with cell 
visibility if it is enabled. These will be used to " +
-                "override the default authorization list for the user 
accessing HBase.")
-        .required(false)
-        .addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
-        .build();
-
-    default List<String> getAuthorizations(ConfigurationContext context) {
-        List<String> tokens = new ArrayList<>();
-        String authorizationString = 
context.getProperty(AUTHORIZATIONS).isSet()
-                ? context.getProperty(AUTHORIZATIONS).getValue()
-                : "";
-        if (!StringUtils.isEmpty(authorizationString)) {
-            tokens = Arrays.asList(authorizationString.split(",[\\s]*"));
-        }
-
-        return tokens;
-    }
-}

http://git-wip-us.apache.org/repos/asf/nifi/blob/f7035f04/nifi-nar-bundles/nifi-standard-services/nifi-hbase_1_1_2-client-service-bundle/nifi-hbase_1_1_2-client-service/src/main/java/org/apache/nifi/hbase/VisibilityLabelUtils.java
----------------------------------------------------------------------
diff --git 
a/nifi-nar-bundles/nifi-standard-services/nifi-hbase_1_1_2-client-service-bundle/nifi-hbase_1_1_2-client-service/src/main/java/org/apache/nifi/hbase/VisibilityLabelUtils.java
 
b/nifi-nar-bundles/nifi-standard-services/nifi-hbase_1_1_2-client-service-bundle/nifi-hbase_1_1_2-client-service/src/main/java/org/apache/nifi/hbase/VisibilityLabelUtils.java
new file mode 100644
index 0000000..8366696
--- /dev/null
+++ 
b/nifi-nar-bundles/nifi-standard-services/nifi-hbase_1_1_2-client-service-bundle/nifi-hbase_1_1_2-client-service/src/main/java/org/apache/nifi/hbase/VisibilityLabelUtils.java
@@ -0,0 +1,50 @@
+/*
+ * 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.nifi.hbase;
+
+import org.apache.nifi.components.PropertyDescriptor;
+import org.apache.nifi.controller.ConfigurationContext;
+import org.apache.nifi.processor.util.StandardValidators;
+import org.apache.nifi.util.StringUtils;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+class VisibilityLabelUtils {
+    static final PropertyDescriptor AUTHORIZATIONS = new 
PropertyDescriptor.Builder()
+        .name("hb-lu-authorizations")
+        .displayName("Authorizations")
+        .description("The list of authorization tokens to be used with cell 
visibility if it is enabled. These will be used to " +
+                "override the default authorization list for the user 
accessing HBase.")
+        .required(false)
+        .addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
+        .build();
+
+    static List<String> getAuthorizations(ConfigurationContext context) {
+        List<String> tokens = new ArrayList<>();
+        String authorizationString = 
context.getProperty(AUTHORIZATIONS).isSet()
+                ? context.getProperty(AUTHORIZATIONS).getValue()
+                : "";
+        if (!StringUtils.isEmpty(authorizationString)) {
+            tokens = Arrays.asList(authorizationString.split(",[\\s]*"));
+        }
+
+        return tokens;
+    }
+}

Reply via email to