mirror of https://github.com/apache/nifi.git
NIFI-4637: Fix ExtensionManager warning on VisibilityLabelService
This closes #2729 Signed-off-by: Mike Thomsen <mikerthomsen@gmail.com>
This commit is contained in:
parent
dd8b25ab48
commit
f7035f0497
|
@ -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 {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 {
|
||||
|
||||
}
|
||||
}
|
|
@ -26,8 +26,8 @@ import java.util.ArrayList;
|
|||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public interface VisibilityLabelService {
|
||||
PropertyDescriptor AUTHORIZATIONS = new PropertyDescriptor.Builder()
|
||||
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 " +
|
||||
|
@ -36,7 +36,7 @@ public interface VisibilityLabelService {
|
|||
.addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
|
||||
.build();
|
||||
|
||||
default List<String> getAuthorizations(ConfigurationContext context) {
|
||||
static List<String> getAuthorizations(ConfigurationContext context) {
|
||||
List<String> tokens = new ArrayList<>();
|
||||
String authorizationString = context.getProperty(AUTHORIZATIONS).isSet()
|
||||
? context.getProperty(AUTHORIZATIONS).getValue()
|
Loading…
Reference in New Issue