diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/state/config/StateManagerConfiguration.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/state/config/StateManagerConfiguration.java index c8beceecd7..7565d9a6b1 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/state/config/StateManagerConfiguration.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/state/config/StateManagerConfiguration.java @@ -29,6 +29,7 @@ import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; +import org.apache.nifi.components.state.Scope; import org.apache.nifi.controller.state.ConfigParseException; import org.apache.nifi.util.DomUtils; import org.w3c.dom.Document; @@ -50,7 +51,7 @@ public class StateManagerConfiguration { return providers.get(providerId); } - public List getStateProviderConfigurations(final StateProviderScope scope) { + public List getStateProviderConfigurations(final Scope scope) { final List configs = new ArrayList<>(); for (final StateProviderConfiguration config : providers.values()) { if (config.getScope() == scope) { @@ -83,7 +84,7 @@ public class StateManagerConfiguration { final Map configs = new HashMap<>(); for (final Element localProviderElement : localProviderElements) { - final StateProviderConfiguration providerConfig = parseProviderConfiguration(localProviderElement, StateProviderScope.LOCAL, configFile); + final StateProviderConfiguration providerConfig = parseProviderConfiguration(localProviderElement, Scope.LOCAL, configFile); if (configs.containsKey(providerConfig.getId())) { throw new ConfigParseException("State Management config file " + configFile + " is not a valid configuration file, " + "as it contains multiple providers with the \"id\" of \"" + providerConfig.getId() + "\""); @@ -94,7 +95,7 @@ public class StateManagerConfiguration { final List clusterProviderElements = DomUtils.getChildElementsByTagName(rootElement, "cluster-provider"); for (final Element clusterProviderElement : clusterProviderElements) { - final StateProviderConfiguration providerConfig = parseProviderConfiguration(clusterProviderElement, StateProviderScope.CLUSTER, configFile); + final StateProviderConfiguration providerConfig = parseProviderConfiguration(clusterProviderElement, Scope.CLUSTER, configFile); if (configs.containsKey(providerConfig.getId())) { throw new ConfigParseException("State Management config file " + configFile + " is not a valid configuration file, " + "as it contains multiple providers with the \"id\" of \"" + providerConfig.getId() + "\""); @@ -106,7 +107,7 @@ public class StateManagerConfiguration { return new StateManagerConfiguration(configs); } - private static StateProviderConfiguration parseProviderConfiguration(final Element providerElement, final StateProviderScope scope, final File configFile) throws ConfigParseException { + private static StateProviderConfiguration parseProviderConfiguration(final Element providerElement, final Scope scope, final File configFile) throws ConfigParseException { final String elementName = providerElement.getNodeName(); final String id = DomUtils.getChildText(providerElement, "id"); diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/state/config/StateProviderConfiguration.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/state/config/StateProviderConfiguration.java index 290a750c51..f8d29ee6c4 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/state/config/StateProviderConfiguration.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/state/config/StateProviderConfiguration.java @@ -17,16 +17,18 @@ package org.apache.nifi.controller.state.config; +import org.apache.nifi.components.state.Scope; + import java.util.HashMap; import java.util.Map; public class StateProviderConfiguration { private final String id; - private final StateProviderScope scope; + private final Scope scope; private final String className; private final Map properties; - public StateProviderConfiguration(final String id, final String className, final StateProviderScope scope, final Map properties) { + public StateProviderConfiguration(final String id, final String className, final Scope scope, final Map properties) { this.id = id; this.className = className; this.scope = scope; @@ -45,7 +47,7 @@ public class StateProviderConfiguration { return properties; } - public StateProviderScope getScope() { + public Scope getScope() { return scope; } } diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/state/config/StateProviderScope.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/state/config/StateProviderScope.java deleted file mode 100644 index 40e1865910..0000000000 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/state/config/StateProviderScope.java +++ /dev/null @@ -1,30 +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.controller.state.config; - -public enum StateProviderScope { - /** - * Provider is a Local State Provider - */ - LOCAL, - - /** - * Provider is a Cluster State Provider - */ - CLUSTER; -} diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/state/manager/StandardStateManagerProvider.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/state/manager/StandardStateManagerProvider.java index f88752778e..b7671f6c79 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/state/manager/StandardStateManagerProvider.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/state/manager/StandardStateManagerProvider.java @@ -42,7 +42,6 @@ import org.apache.nifi.controller.state.StandardStateManager; import org.apache.nifi.controller.state.StandardStateProviderInitializationContext; import org.apache.nifi.controller.state.config.StateManagerConfiguration; import org.apache.nifi.controller.state.config.StateProviderConfiguration; -import org.apache.nifi.controller.state.config.StateProviderScope; import org.apache.nifi.framework.security.util.SslContextFactory; import org.apache.nifi.nar.ExtensionManager; import org.apache.nifi.processor.StandardValidationContext; @@ -77,17 +76,17 @@ public class StandardStateManagerProvider implements StateManagerProvider { private static StateProvider createLocalStateProvider(final NiFiProperties properties) throws IOException, ConfigParseException { final File configFile = properties.getStateManagementConfigFile(); - return createStateProvider(configFile, StateProviderScope.LOCAL, properties); + return createStateProvider(configFile, Scope.LOCAL, properties); } private static StateProvider createClusteredStateProvider(final NiFiProperties properties) throws IOException, ConfigParseException { final File configFile = properties.getStateManagementConfigFile(); - return createStateProvider(configFile, StateProviderScope.CLUSTER, properties); + return createStateProvider(configFile, Scope.CLUSTER, properties); } - private static StateProvider createStateProvider(final File configFile, final StateProviderScope scope, final NiFiProperties properties) throws ConfigParseException, IOException { + private static StateProvider createStateProvider(final File configFile, final Scope scope, final NiFiProperties properties) throws ConfigParseException, IOException { final String providerId; final String providerIdPropertyName; final String providerDescription; @@ -121,7 +120,7 @@ public class StandardStateManagerProvider implements StateManagerProvider { } if (providerId == null) { - if (scope == StateProviderScope.CLUSTER) { + if (scope == Scope.CLUSTER) { throw new IllegalStateException("Cannot create Cluster State Provider because the '" + providerIdPropertyName + "' property is missing from the NiFi Properties file. In order to run NiFi in a cluster, the " + providerIdPropertyName + " property must be configured in nifi.properties");