aboutsummaryrefslogtreecommitdiffstats
path: root/policy-management/src/main/java/org/onap/policy/drools/system
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2019-08-05 15:27:16 -0400
committerJim Hahn <jrh3@att.com>2019-08-13 15:58:15 -0400
commita156cf3cbad6512510ae9a02a13c0408f901c734 (patch)
tree0a69bffb2a6c9f961bda1408153cf44f360c6a17 /policy-management/src/main/java/org/onap/policy/drools/system
parent62d1ff054b0ec6348ab6f7415063fdaa3f425215 (diff)
Fix sonar issues in drools-pdp
Address sonar issue, "Move constants to a class or enum", by moving them from interfaces to classes: ActiveStandbyFeatureApi StateManagementFeatureApi PolicyResourceLockFeatureApi PolicySessionFeatureApi DroolsController DroolsControllerFeatureApi PolicyControllerFeatureApi PolicyEngineFeatureApi HealthCheck SystemPersistence EventProtocolCoder PolicyController PolicyEngine TestTransaction MdcTransaction Address sonar issue, "Move constants to a class or enum", by change the interface to a class: DroolsProperties Address sonar issue, "Override the "equals" method in this class", by adding equals & hashCode to: DroolsPdpEntity DroolsPdpImpl Use lombok for a number of getters & setters. Address sonar issue, "Define a constant instead of duplicating this literal" in: DroolsPdpsElectionHandler JpaDroolsPdpsConnector MavenDroolsController GenericEventProtocolCoder GsonProtocolCoderToolset RestManager Address sonar issue, "Remove the parentheses around the parameter" in: MavenDroolsController Address sonar issue, "Replace this lambda with a method reference" in: LifecycleFsm Address sonar issue, "Move this constructor to comply with Java Code Conventions" in: LifecycleStateRunning Address sonar issue, "Replace this 'switch' statement by 'if' statements to increase readability", as specified in: PolicyEngineManager Address sonar issue, "Rename field to prevent any misunderstanding/clash with field" in: MdcTransactionImpl Address sonar issue, "Either log or rethrow this exception", in: RestManager Address sonar issue, "Rename this constant name to" uppercase, by replacing enums with static lists in: RestManager Addressed review comments: Fixed license dates. Renamed getSiteName/setSiteName methods to getSite/setSite in the interface to match the field names in the implementation classes. Renamed *Instance classes to *Constants. Next round of review comments. Change-Id: I1c26af9f194833dd773f2b25dc5f60cde163201c Issue-ID: POLICY-1968 Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'policy-management/src/main/java/org/onap/policy/drools/system')
-rw-r--r--policy-management/src/main/java/org/onap/policy/drools/system/IndexedPolicyControllerFactory.java3
-rw-r--r--policy-management/src/main/java/org/onap/policy/drools/system/Main.java34
-rw-r--r--policy-management/src/main/java/org/onap/policy/drools/system/PolicyController.java17
-rw-r--r--policy-management/src/main/java/org/onap/policy/drools/system/PolicyControllerConstants.java36
-rw-r--r--policy-management/src/main/java/org/onap/policy/drools/system/PolicyEngine.java19
-rw-r--r--policy-management/src/main/java/org/onap/policy/drools/system/PolicyEngineConstants.java51
-rw-r--r--policy-management/src/main/java/org/onap/policy/drools/system/PolicyEngineManager.java59
-rw-r--r--policy-management/src/main/java/org/onap/policy/drools/system/internal/AggregatedPolicyController.java25
8 files changed, 163 insertions, 81 deletions
diff --git a/policy-management/src/main/java/org/onap/policy/drools/system/IndexedPolicyControllerFactory.java b/policy-management/src/main/java/org/onap/policy/drools/system/IndexedPolicyControllerFactory.java
index 38085101..0d7806c6 100644
--- a/policy-management/src/main/java/org/onap/policy/drools/system/IndexedPolicyControllerFactory.java
+++ b/policy-management/src/main/java/org/onap/policy/drools/system/IndexedPolicyControllerFactory.java
@@ -29,6 +29,7 @@ import java.util.Properties;
import org.onap.policy.common.gson.annotation.GsonJsonIgnore;
import org.onap.policy.drools.controller.DroolsController;
import org.onap.policy.drools.features.PolicyControllerFeatureApi;
+import org.onap.policy.drools.features.PolicyControllerFeatureApiConstants;
import org.onap.policy.drools.protocol.configuration.DroolsConfiguration;
import org.onap.policy.drools.system.internal.AggregatedPolicyController;
import org.slf4j.Logger;
@@ -382,6 +383,6 @@ class IndexedPolicyControllerFactory implements PolicyControllerFactory {
}
protected List<PolicyControllerFeatureApi> getProviders() {
- return PolicyControllerFeatureApi.providers.getList();
+ return PolicyControllerFeatureApiConstants.getProviders().getList();
}
}
diff --git a/policy-management/src/main/java/org/onap/policy/drools/system/Main.java b/policy-management/src/main/java/org/onap/policy/drools/system/Main.java
index 11ffd689..1ef578c1 100644
--- a/policy-management/src/main/java/org/onap/policy/drools/system/Main.java
+++ b/policy-management/src/main/java/org/onap/policy/drools/system/Main.java
@@ -22,8 +22,8 @@ package org.onap.policy.drools.system;
import java.util.Properties;
import org.onap.policy.common.endpoints.event.comm.TopicEndpointManager;
-import org.onap.policy.drools.persistence.SystemPersistence;
-import org.onap.policy.drools.properties.DroolsProperties;
+import org.onap.policy.drools.persistence.SystemPersistenceConstants;
+import org.onap.policy.drools.properties.DroolsPropertyConstants;
import org.onap.policy.drools.utils.PropertyUtil;
import org.onap.policy.drools.utils.logging.LoggerUtil;
import org.onap.policy.drools.utils.logging.MdcTransaction;
@@ -51,35 +51,35 @@ public class Main {
/* system properties */
- for (Properties systemProperties : SystemPersistence.manager.getSystemProperties()) {
+ for (Properties systemProperties : SystemPersistenceConstants.getManager().getSystemProperties()) {
PropertyUtil.setSystemProperties(systemProperties);
}
/* 0. boot */
- PolicyEngine.manager.boot(args);
+ PolicyEngineConstants.getManager().boot(args);
/* 1.a. Configure Engine */
Properties engineProperties;
try {
- engineProperties = SystemPersistence.manager.getEngineProperties();
+ engineProperties = SystemPersistenceConstants.getManager().getEngineProperties();
} catch (IllegalArgumentException iae) {
logger.warn("Main: engine properties not found. Using default configuration.", iae);
- engineProperties = PolicyEngine.manager.defaultTelemetryConfig();
+ engineProperties = PolicyEngineConstants.getManager().defaultTelemetryConfig();
}
- PolicyEngine.manager.configure(engineProperties);
+ PolicyEngineConstants.getManager().configure(engineProperties);
/* 1.b. Load Installation Environment(s) */
- for (Properties env : SystemPersistence.manager.getEnvironmentProperties()) {
- PolicyEngine.manager.setEnvironment(env);
+ for (Properties env : SystemPersistenceConstants.getManager().getEnvironmentProperties()) {
+ PolicyEngineConstants.getManager().setEnvironment(env);
}
/* 2. Add topics */
- for (Properties topicProperties : SystemPersistence.manager.getTopicProperties()) {
+ for (Properties topicProperties : SystemPersistenceConstants.getManager().getTopicProperties()) {
TopicEndpointManager.getManager().addTopics(topicProperties);
}
@@ -91,13 +91,13 @@ public class Main {
.setTargetEntity("engine")
.setTargetServiceName("start");
try {
- final boolean success = PolicyEngine.manager.start();
+ final boolean success = PolicyEngineConstants.getManager().start();
if (!success) {
trans.setStatusCode(false).setResponseDescription("partial start").flush();
logger.warn(
LoggerUtil.TRANSACTION_LOG_MARKER,
"Main: {} has been partially started",
- PolicyEngine.manager);
+ PolicyEngineConstants.getManager());
} else {
trans.setStatusCode(true).transaction();
}
@@ -110,7 +110,7 @@ public class Main {
logger.warn(
LoggerUtil.TRANSACTION_LOG_MARKER,
"Main: cannot start {} (bad state) because of {}",
- PolicyEngine.manager,
+ PolicyEngineConstants.getManager(),
e.getMessage(),
e);
} catch (final Exception e) {
@@ -122,7 +122,7 @@ public class Main {
logger.warn(
LoggerUtil.TRANSACTION_LOG_MARKER,
"Main: cannot start {} because of {}",
- PolicyEngine.manager,
+ PolicyEngineConstants.getManager(),
e.getMessage(),
e);
System.exit(1);
@@ -131,9 +131,9 @@ public class Main {
/* 4. Create and start the controllers */
for (final Properties controllerProperties :
- SystemPersistence.manager.getControllerProperties()) {
+ SystemPersistenceConstants.getManager().getControllerProperties()) {
final String controllerName =
- controllerProperties.getProperty(DroolsProperties.PROPERTY_CONTROLLER_NAME);
+ controllerProperties.getProperty(DroolsPropertyConstants.PROPERTY_CONTROLLER_NAME);
try {
trans =
MdcTransaction.newTransaction(null, null)
@@ -142,7 +142,7 @@ public class Main {
.setTargetServiceName("start");
final PolicyController controller =
- PolicyEngine.manager.createPolicyController(controllerName, controllerProperties);
+ PolicyEngineConstants.getManager().createPolicyController(controllerName, controllerProperties);
controller.start();
trans
diff --git a/policy-management/src/main/java/org/onap/policy/drools/system/PolicyController.java b/policy-management/src/main/java/org/onap/policy/drools/system/PolicyController.java
index 9bc75b39..17247f41 100644
--- a/policy-management/src/main/java/org/onap/policy/drools/system/PolicyController.java
+++ b/policy-management/src/main/java/org/onap/policy/drools/system/PolicyController.java
@@ -7,9 +7,9 @@
* Licensed 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.
@@ -41,11 +41,6 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyTypeIdentifi
public interface PolicyController extends Startable, Lockable {
/**
- * Factory that tracks and manages Policy Controllers.
- */
- static PolicyControllerFactory factory = new IndexedPolicyControllerFactory();
-
- /**
* name of this Policy Controller.
*/
String getName();
@@ -72,7 +67,7 @@ public interface PolicyController extends Startable, Lockable {
/**
* Update maven configuration.
- *
+ *
* @param newDroolsConfiguration new drools configuration
* @return true if the update was successful, false otherwise
*/
@@ -90,11 +85,11 @@ public interface PolicyController extends Startable, Lockable {
/**
* Attempts delivering of an String over communication infrastructure "busType".
- *
+ *
* @param busType bus type
* @param topic topic
* @param event Communication infrastructure identifier
- *
+ *
* @return true if successful, false if a failure has occurred.
* @throws IllegalArgumentException when invalid or insufficient properties are provided
* @throws IllegalStateException when the engine is in a state where this operation is not
@@ -106,7 +101,7 @@ public interface PolicyController extends Startable, Lockable {
/**
* halts and permanently releases all resources.
- *
+ *
* @throws IllegalStateException throws illegal state exception
*/
void halt();
diff --git a/policy-management/src/main/java/org/onap/policy/drools/system/PolicyControllerConstants.java b/policy-management/src/main/java/org/onap/policy/drools/system/PolicyControllerConstants.java
new file mode 100644
index 00000000..78d24129
--- /dev/null
+++ b/policy-management/src/main/java/org/onap/policy/drools/system/PolicyControllerConstants.java
@@ -0,0 +1,36 @@
+/*
+ * ============LICENSE_START=======================================================
+ * ONAP
+ * ================================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.drools.system;
+
+import lombok.Getter;
+
+public class PolicyControllerConstants {
+
+ /**
+ * Factory that tracks and manages Policy Controllers.
+ */
+ @Getter
+ private static final PolicyControllerFactory factory = new IndexedPolicyControllerFactory();
+
+ private PolicyControllerConstants() {
+ // do nothing
+ }
+}
diff --git a/policy-management/src/main/java/org/onap/policy/drools/system/PolicyEngine.java b/policy-management/src/main/java/org/onap/policy/drools/system/PolicyEngine.java
index eb2ed3df..506474cb 100644
--- a/policy-management/src/main/java/org/onap/policy/drools/system/PolicyEngine.java
+++ b/policy-management/src/main/java/org/onap/policy/drools/system/PolicyEngine.java
@@ -46,25 +46,6 @@ import org.onap.policy.drools.protocol.configuration.PdpdConfiguration;
* RestTopicWriter <br> PolicyEngine 1 --- 1 ManagementServer
*/
public interface PolicyEngine extends Startable, Lockable, TopicListener {
- /**
- * Policy Engine Manager.
- */
- PolicyEngine manager = new PolicyEngineManager();
-
- /**
- * Default Telemetry Server Port.
- */
- int TELEMETRY_SERVER_DEFAULT_PORT = 9696;
-
- /**
- * Default Telemetry Server Hostname.
- */
- String TELEMETRY_SERVER_DEFAULT_HOST = "localhost";
-
- /**
- * Default Telemetry Server Name.
- */
- String TELEMETRY_SERVER_DEFAULT_NAME = "TELEMETRY";
/**
* Boot the engine.
diff --git a/policy-management/src/main/java/org/onap/policy/drools/system/PolicyEngineConstants.java b/policy-management/src/main/java/org/onap/policy/drools/system/PolicyEngineConstants.java
new file mode 100644
index 00000000..4d18d6b8
--- /dev/null
+++ b/policy-management/src/main/java/org/onap/policy/drools/system/PolicyEngineConstants.java
@@ -0,0 +1,51 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * policy-management
+ * ================================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.drools.system;
+
+import lombok.Getter;
+
+public class PolicyEngineConstants {
+
+ /**
+ * Default Telemetry Server Port.
+ */
+ public static final int TELEMETRY_SERVER_DEFAULT_PORT = 9696;
+
+ /**
+ * Default Telemetry Server Hostname.
+ */
+ public static final String TELEMETRY_SERVER_DEFAULT_HOST = "localhost";
+
+ /**
+ * Default Telemetry Server Name.
+ */
+ public static final String TELEMETRY_SERVER_DEFAULT_NAME = "TELEMETRY";
+
+ /**
+ * Policy Engine Manager.
+ */
+ @Getter
+ private static final PolicyEngine manager = new PolicyEngineManager();
+
+ private PolicyEngineConstants() {
+ // do nothing
+ }
+}
diff --git a/policy-management/src/main/java/org/onap/policy/drools/system/PolicyEngineManager.java b/policy-management/src/main/java/org/onap/policy/drools/system/PolicyEngineManager.java
index 1c02d705..36d8ca59 100644
--- a/policy-management/src/main/java/org/onap/policy/drools/system/PolicyEngineManager.java
+++ b/policy-management/src/main/java/org/onap/policy/drools/system/PolicyEngineManager.java
@@ -20,6 +20,10 @@
package org.onap.policy.drools.system;
+import static org.onap.policy.drools.system.PolicyEngineConstants.TELEMETRY_SERVER_DEFAULT_HOST;
+import static org.onap.policy.drools.system.PolicyEngineConstants.TELEMETRY_SERVER_DEFAULT_NAME;
+import static org.onap.policy.drools.system.PolicyEngineConstants.TELEMETRY_SERVER_DEFAULT_PORT;
+
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.gson.Gson;
@@ -40,13 +44,18 @@ import org.onap.policy.common.endpoints.properties.PolicyEndPointProperties;
import org.onap.policy.common.gson.annotation.GsonJsonIgnore;
import org.onap.policy.common.gson.annotation.GsonJsonProperty;
import org.onap.policy.drools.controller.DroolsController;
+import org.onap.policy.drools.controller.DroolsControllerConstants;
import org.onap.policy.drools.core.PolicyContainer;
import org.onap.policy.drools.core.jmx.PdpJmxListener;
import org.onap.policy.drools.features.PolicyControllerFeatureApi;
+import org.onap.policy.drools.features.PolicyControllerFeatureApiConstants;
import org.onap.policy.drools.features.PolicyEngineFeatureApi;
+import org.onap.policy.drools.features.PolicyEngineFeatureApiConstants;
import org.onap.policy.drools.persistence.SystemPersistence;
-import org.onap.policy.drools.properties.DroolsProperties;
+import org.onap.policy.drools.persistence.SystemPersistenceConstants;
+import org.onap.policy.drools.properties.DroolsPropertyConstants;
import org.onap.policy.drools.protocol.coders.EventProtocolCoder;
+import org.onap.policy.drools.protocol.coders.EventProtocolCoderConstants;
import org.onap.policy.drools.protocol.configuration.ControllerConfiguration;
import org.onap.policy.drools.protocol.configuration.PdpdConfiguration;
import org.onap.policy.drools.server.restful.RestManager;
@@ -279,16 +288,17 @@ class PolicyEngineManager implements PolicyEngine {
.setTargetEntity(config.getEntity());
}
- switch (entity) {
- case PdpdConfiguration.CONFIG_ENTITY_CONTROLLER:
- boolean success = controllerConfig(config);
- mdcTrans.resetSubTransaction().setStatusCode(success).transaction();
- return success;
- default:
- final String msg = "Configuration Entity is not supported: " + entity;
- mdcTrans.resetSubTransaction().setStatusCode(false).setResponseDescription(msg).flush();
- logger.warn(LoggerUtil.TRANSACTION_LOG_MARKER_NAME, msg);
- throw new IllegalArgumentException(msg);
+
+ if (PdpdConfiguration.CONFIG_ENTITY_CONTROLLER.equals(entity)) {
+ boolean success = controllerConfig(config);
+ mdcTrans.resetSubTransaction().setStatusCode(success).transaction();
+ return success;
+
+ } else {
+ final String msg = "Configuration Entity is not supported: " + entity;
+ mdcTrans.resetSubTransaction().setStatusCode(false).setResponseDescription(msg).flush();
+ logger.warn(LoggerUtil.TRANSACTION_LOG_MARKER_NAME, msg);
+ throw new IllegalArgumentException(msg);
}
}
@@ -299,7 +309,7 @@ class PolicyEngineManager implements PolicyEngine {
// check if a PROPERTY_CONTROLLER_NAME property is present
// if so, override the given name
- final String propertyControllerName = properties.getProperty(DroolsProperties.PROPERTY_CONTROLLER_NAME);
+ final String propertyControllerName = properties.getProperty(DroolsPropertyConstants.PROPERTY_CONTROLLER_NAME);
if (propertyControllerName != null && !propertyControllerName.isEmpty()) {
if (!propertyControllerName.equals(tempName)) {
throw new IllegalStateException("Proposed name (" + tempName + ") and properties name ("
@@ -425,12 +435,15 @@ class PolicyEngineManager implements PolicyEngine {
controllerName);
/*
- * try to bring up bad controller in brainless mode, after having it working, apply
- * the new create/update operation.
+ * try to bring up bad controller in brainless mode, after having it
+ * working, apply the new create/update operation.
*/
- controllerProperties.setProperty(DroolsProperties.RULES_GROUPID, DroolsController.NO_GROUP_ID);
- controllerProperties.setProperty(DroolsProperties.RULES_ARTIFACTID, DroolsController.NO_ARTIFACT_ID);
- controllerProperties.setProperty(DroolsProperties.RULES_VERSION, DroolsController.NO_VERSION);
+ controllerProperties.setProperty(DroolsPropertyConstants.RULES_GROUPID,
+ DroolsControllerConstants.NO_GROUP_ID);
+ controllerProperties.setProperty(DroolsPropertyConstants.RULES_ARTIFACTID,
+ DroolsControllerConstants.NO_ARTIFACT_ID);
+ controllerProperties.setProperty(DroolsPropertyConstants.RULES_VERSION,
+ DroolsControllerConstants.NO_VERSION);
policyController = getPolicyEngine().createPolicyController(controllerName, controllerProperties);
@@ -1272,11 +1285,11 @@ class PolicyEngineManager implements PolicyEngine {
// these methods may be overridden by junit tests
protected List<PolicyEngineFeatureApi> getEngineProviders() {
- return PolicyEngineFeatureApi.providers.getList();
+ return PolicyEngineFeatureApiConstants.getProviders().getList();
}
protected List<PolicyControllerFeatureApi> getControllerProviders() {
- return PolicyControllerFeatureApi.providers.getList();
+ return PolicyControllerFeatureApiConstants.getProviders().getList();
}
protected void globalInitContainer(String[] cliArgs) {
@@ -1292,7 +1305,7 @@ class PolicyEngineManager implements PolicyEngine {
}
protected PolicyControllerFactory getControllerFactory() {
- return PolicyController.factory;
+ return PolicyControllerConstants.getFactory();
}
protected void startPdpJmxListener() {
@@ -1308,14 +1321,14 @@ class PolicyEngineManager implements PolicyEngine {
}
protected EventProtocolCoder getProtocolCoder() {
- return EventProtocolCoder.manager;
+ return EventProtocolCoderConstants.getManager();
}
protected SystemPersistence getPersistenceManager() {
- return SystemPersistence.manager;
+ return SystemPersistenceConstants.getManager();
}
protected PolicyEngine getPolicyEngine() {
- return PolicyEngine.manager;
+ return PolicyEngineConstants.getManager();
}
}
diff --git a/policy-management/src/main/java/org/onap/policy/drools/system/internal/AggregatedPolicyController.java b/policy-management/src/main/java/org/onap/policy/drools/system/internal/AggregatedPolicyController.java
index 51280eb3..5d915104 100644
--- a/policy-management/src/main/java/org/onap/policy/drools/system/internal/AggregatedPolicyController.java
+++ b/policy-management/src/main/java/org/onap/policy/drools/system/internal/AggregatedPolicyController.java
@@ -35,10 +35,13 @@ import org.onap.policy.common.endpoints.event.comm.TopicSink;
import org.onap.policy.common.endpoints.event.comm.TopicSource;
import org.onap.policy.common.gson.annotation.GsonJsonIgnore;
import org.onap.policy.drools.controller.DroolsController;
+import org.onap.policy.drools.controller.DroolsControllerConstants;
import org.onap.policy.drools.controller.DroolsControllerFactory;
import org.onap.policy.drools.features.PolicyControllerFeatureApi;
+import org.onap.policy.drools.features.PolicyControllerFeatureApiConstants;
import org.onap.policy.drools.persistence.SystemPersistence;
-import org.onap.policy.drools.properties.DroolsProperties;
+import org.onap.policy.drools.persistence.SystemPersistenceConstants;
+import org.onap.policy.drools.properties.DroolsPropertyConstants;
import org.onap.policy.drools.protocol.configuration.DroolsConfiguration;
import org.onap.policy.drools.system.PolicyController;
import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyTypeIdentifier;
@@ -148,14 +151,15 @@ public class AggregatedPolicyController implements PolicyController, TopicListen
return droolsController
.getBaseDomainNames()
.stream()
- .map(d -> new ToscaPolicyTypeIdentifier(d, DroolsProperties.DEFAULT_CONTROLLER_POLICY_TYPE_VERSION))
+ .map(d -> new ToscaPolicyTypeIdentifier(d,
+ DroolsPropertyConstants.DEFAULT_CONTROLLER_POLICY_TYPE_VERSION))
.collect(Collectors.toList());
}
protected List<ToscaPolicyTypeIdentifier> getPolicyTypesFromProperties() {
List<ToscaPolicyTypeIdentifier> policyTypeIds = new ArrayList<>();
- String ptiPropValue = properties.getProperty(DroolsProperties.PROPERTY_CONTROLLER_POLICY_TYPES);
+ String ptiPropValue = properties.getProperty(DroolsPropertyConstants.PROPERTY_CONTROLLER_POLICY_TYPES);
if (ptiPropValue == null) {
return policyTypeIds;
}
@@ -165,7 +169,7 @@ public class AggregatedPolicyController implements PolicyController, TopicListen
String[] ptv = pti.split(":");
if (ptv.length == 1) {
policyTypeIds.add(new ToscaPolicyTypeIdentifier(ptv[0],
- DroolsProperties.DEFAULT_CONTROLLER_POLICY_TYPE_VERSION));
+ DroolsPropertyConstants.DEFAULT_CONTROLLER_POLICY_TYPE_VERSION));
} else if (ptv.length == 2) {
policyTypeIds.add(new ToscaPolicyTypeIdentifier(ptv[0], ptv[1]));
}
@@ -221,9 +225,10 @@ public class AggregatedPolicyController implements PolicyController, TopicListen
try {
/* Drools Controller created, update initialization properties for restarts */
- this.properties.setProperty(DroolsProperties.RULES_GROUPID, newDroolsConfiguration.getGroupId());
- this.properties.setProperty(DroolsProperties.RULES_ARTIFACTID, newDroolsConfiguration.getArtifactId());
- this.properties.setProperty(DroolsProperties.RULES_VERSION, newDroolsConfiguration.getVersion());
+ this.properties.setProperty(DroolsPropertyConstants.RULES_GROUPID, newDroolsConfiguration.getGroupId());
+ this.properties.setProperty(DroolsPropertyConstants.RULES_ARTIFACTID,
+ newDroolsConfiguration.getArtifactId());
+ this.properties.setProperty(DroolsPropertyConstants.RULES_VERSION, newDroolsConfiguration.getVersion());
getPersistenceManager().storeController(name, this.properties);
@@ -719,7 +724,7 @@ public class AggregatedPolicyController implements PolicyController, TopicListen
// the following methods may be overridden by junit tests
protected SystemPersistence getPersistenceManager() {
- return SystemPersistence.manager;
+ return SystemPersistenceConstants.getManager();
}
protected TopicEndpoint getEndpointManager() {
@@ -727,11 +732,11 @@ public class AggregatedPolicyController implements PolicyController, TopicListen
}
protected DroolsControllerFactory getDroolsFactory() {
- return DroolsController.factory;
+ return DroolsControllerConstants.getFactory();
}
protected List<PolicyControllerFeatureApi> getProviders() {
- return PolicyControllerFeatureApi.providers.getList();
+ return PolicyControllerFeatureApiConstants.getProviders().getList();
}
}