nifi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ald...@apache.org
Subject [37/50] nifi git commit: NIFI-259 Removing StateProviderScope and refactoring to use Scope in its place.
Date Sat, 06 Feb 2016 03:36:33 GMT
NIFI-259 Removing StateProviderScope and refactoring to use Scope in its place.


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

Branch: refs/heads/master
Commit: 257eca9c46a8dae94ca76fa79b829db6bde091eb
Parents: f2c366c
Author: Aldrin Piri <aldrin@apache.org>
Authored: Mon Feb 1 16:26:56 2016 -0500
Committer: Aldrin Piri <aldrin@apache.org>
Committed: Mon Feb 1 16:29:11 2016 -0500

----------------------------------------------------------------------
 .../state/config/StateManagerConfiguration.java |  9 +++---
 .../config/StateProviderConfiguration.java      |  8 ++++--
 .../state/config/StateProviderScope.java        | 30 --------------------
 .../manager/StandardStateManagerProvider.java   |  9 +++---
 4 files changed, 14 insertions(+), 42 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/nifi/blob/257eca9c/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/state/config/StateManagerConfiguration.java
----------------------------------------------------------------------
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 c8becee..7565d9a 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<StateProviderConfiguration> getStateProviderConfigurations(final StateProviderScope
scope) {
+    public List<StateProviderConfiguration> getStateProviderConfigurations(final Scope
scope) {
         final List<StateProviderConfiguration> configs = new ArrayList<>();
         for (final StateProviderConfiguration config : providers.values()) {
             if (config.getScope() == scope) {
@@ -83,7 +84,7 @@ public class StateManagerConfiguration {
 
         final Map<String, StateProviderConfiguration> 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<Element> 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");

http://git-wip-us.apache.org/repos/asf/nifi/blob/257eca9c/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/state/config/StateProviderConfiguration.java
----------------------------------------------------------------------
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 290a750..f8d29ee 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<String, String> properties;
 
-    public StateProviderConfiguration(final String id, final String className, final StateProviderScope
scope, final Map<String, String> properties) {
+    public StateProviderConfiguration(final String id, final String className, final Scope
scope, final Map<String, String> 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;
     }
 }

http://git-wip-us.apache.org/repos/asf/nifi/blob/257eca9c/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/state/config/StateProviderScope.java
----------------------------------------------------------------------
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 40e1865..0000000
--- 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;
-}

http://git-wip-us.apache.org/repos/asf/nifi/blob/257eca9c/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/state/manager/StandardStateManagerProvider.java
----------------------------------------------------------------------
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 f887527..b7671f6 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");


Mime
View raw message