summaryrefslogtreecommitdiffstats
path: root/feature-pooling-dmaap/src/main
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2018-06-18 17:10:44 -0400
committerJim Hahn <jrh3@att.com>2018-06-19 11:44:16 -0400
commit35d4e5606dbbe055f29afb5e837c000863d5a15f (patch)
treecb0b918e687826cef0ddec42af9019dece60ab20 /feature-pooling-dmaap/src/main
parentfd7593078cddbed63a8c68bc8f6352283a3fb849 (diff)
Remove references to SpecPropertyConfiguration
Change-Id: Ib4779611f124277cf8be2b3eddfe41bf69dfd74b Issue-ID: POLICY-907 Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'feature-pooling-dmaap/src/main')
-rw-r--r--feature-pooling-dmaap/src/main/java/org/onap/policy/drools/pooling/PoolingFeature.java4
-rw-r--r--feature-pooling-dmaap/src/main/java/org/onap/policy/drools/pooling/PoolingManagerImpl.java1
-rw-r--r--feature-pooling-dmaap/src/main/java/org/onap/policy/drools/pooling/PoolingProperties.java38
-rw-r--r--feature-pooling-dmaap/src/main/java/org/onap/policy/drools/pooling/SpecProperties.java117
4 files changed, 18 insertions, 142 deletions
diff --git a/feature-pooling-dmaap/src/main/java/org/onap/policy/drools/pooling/PoolingFeature.java b/feature-pooling-dmaap/src/main/java/org/onap/policy/drools/pooling/PoolingFeature.java
index d42b8de1..bf35bcf5 100644
--- a/feature-pooling-dmaap/src/main/java/org/onap/policy/drools/pooling/PoolingFeature.java
+++ b/feature-pooling-dmaap/src/main/java/org/onap/policy/drools/pooling/PoolingFeature.java
@@ -25,6 +25,7 @@ import java.util.Properties;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CountDownLatch;
+import org.onap.policy.common.utils.properties.SpecProperties;
import org.onap.policy.common.utils.properties.exception.PropertyException;
import org.onap.policy.drools.controller.DroolsController;
import org.onap.policy.drools.event.comm.TopicEndpoint;
@@ -128,6 +129,9 @@ public class PoolingFeature implements PolicyEngineFeatureAPI, PolicyControllerF
logger.info("initializing " + PoolingProperties.FEATURE_NAME);
featProps = factory.getProperties(PoolingProperties.FEATURE_NAME);
+ // remove any generic pooling topic - always use controller-specific property
+ featProps.remove(PoolingProperties.POOLING_TOPIC);
+
factory.initTopicSources(featProps);
factory.initTopicSinks(featProps);
diff --git a/feature-pooling-dmaap/src/main/java/org/onap/policy/drools/pooling/PoolingManagerImpl.java b/feature-pooling-dmaap/src/main/java/org/onap/policy/drools/pooling/PoolingManagerImpl.java
index 33f45085..86cec4c3 100644
--- a/feature-pooling-dmaap/src/main/java/org/onap/policy/drools/pooling/PoolingManagerImpl.java
+++ b/feature-pooling-dmaap/src/main/java/org/onap/policy/drools/pooling/PoolingManagerImpl.java
@@ -29,6 +29,7 @@ import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
+import org.onap.policy.common.utils.properties.SpecProperties;
import org.onap.policy.drools.controller.DroolsController;
import org.onap.policy.drools.event.comm.Topic.CommInfrastructure;
import org.onap.policy.drools.event.comm.TopicListener;
diff --git a/feature-pooling-dmaap/src/main/java/org/onap/policy/drools/pooling/PoolingProperties.java b/feature-pooling-dmaap/src/main/java/org/onap/policy/drools/pooling/PoolingProperties.java
index ad118727..1482366f 100644
--- a/feature-pooling-dmaap/src/main/java/org/onap/policy/drools/pooling/PoolingProperties.java
+++ b/feature-pooling-dmaap/src/main/java/org/onap/policy/drools/pooling/PoolingProperties.java
@@ -21,13 +21,14 @@
package org.onap.policy.drools.pooling;
import java.util.Properties;
-import org.onap.policy.common.utils.properties.SpecPropertyConfiguration;
+import org.onap.policy.common.utils.properties.PropertyConfiguration;
+import org.onap.policy.common.utils.properties.SpecProperties;
import org.onap.policy.common.utils.properties.exception.PropertyException;
/**
* Properties used by the pooling feature, specific to a controller.
*/
-public class PoolingProperties extends SpecPropertyConfiguration {
+public class PoolingProperties extends PropertyConfiguration {
/**
* The feature name, used to retrieve properties.
@@ -39,29 +40,16 @@ public class PoolingProperties extends SpecPropertyConfiguration {
*/
public static final String PREFIX = "pooling.";
- /*
- * These properties are not used by a SpecPropertyConfiguration, thus
- * they do not use any of the "{xxx}" forms.
- */
public static final String FEATURE_ENABLED = PREFIX + "enabled";
-
- /*
- * These properties REQUIRE a controller name, thus they use the "{$}" form.
- */
- public static final String POOLING_TOPIC = PREFIX + "{$}.topic";
-
- /*
- * These properties allow the controller name to be left out, thus they use
- * the "{prefix?suffix}" form.
- */
- public static final String OFFLINE_LIMIT = PREFIX + "{?.}offline.queue.limit";
- public static final String OFFLINE_AGE_MS = PREFIX + "{?.}offline.queue.age.milliseconds";
- public static final String OFFLINE_PUB_WAIT_MS = PREFIX + "{?.}offline.publish.wait.milliseconds";
- public static final String START_HEARTBEAT_MS = PREFIX + "{?.}start.heartbeat.milliseconds";
- public static final String REACTIVATE_MS = PREFIX + "{?.}reactivate.milliseconds";
- public static final String IDENTIFICATION_MS = PREFIX + "{?.}identification.milliseconds";
- public static final String ACTIVE_HEARTBEAT_MS = PREFIX + "{?.}active.heartbeat.milliseconds";
- public static final String INTER_HEARTBEAT_MS = PREFIX + "{?.}inter.heartbeat.milliseconds";
+ public static final String POOLING_TOPIC = PREFIX + "topic";
+ public static final String OFFLINE_LIMIT = PREFIX + "offline.queue.limit";
+ public static final String OFFLINE_AGE_MS = PREFIX + "offline.queue.age.milliseconds";
+ public static final String OFFLINE_PUB_WAIT_MS = PREFIX + "offline.publish.wait.milliseconds";
+ public static final String START_HEARTBEAT_MS = PREFIX + "start.heartbeat.milliseconds";
+ public static final String REACTIVATE_MS = PREFIX + "reactivate.milliseconds";
+ public static final String IDENTIFICATION_MS = PREFIX + "identification.milliseconds";
+ public static final String ACTIVE_HEARTBEAT_MS = PREFIX + "active.heartbeat.milliseconds";
+ public static final String INTER_HEARTBEAT_MS = PREFIX + "inter.heartbeat.milliseconds";
/**
* Type of item that the extractors will be extracting.
@@ -147,7 +135,7 @@ public class PoolingProperties extends SpecPropertyConfiguration {
*
*/
public PoolingProperties(String controllerName, Properties props) throws PropertyException {
- super(controllerName, props);
+ super(new SpecProperties(PREFIX, controllerName, props));
source = props;
}
diff --git a/feature-pooling-dmaap/src/main/java/org/onap/policy/drools/pooling/SpecProperties.java b/feature-pooling-dmaap/src/main/java/org/onap/policy/drools/pooling/SpecProperties.java
deleted file mode 100644
index c831f706..00000000
--- a/feature-pooling-dmaap/src/main/java/org/onap/policy/drools/pooling/SpecProperties.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- * ONAP
- * ================================================================================
- * Copyright (C) 2018 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.pooling;
-
-import java.util.Properties;
-
-/**
- * Properties with an optional specialization (e.g., session name, controller name).
- */
-public class SpecProperties extends Properties {
- private static final long serialVersionUID = 1L;
-
- /**
- * The property prefix, ending with ".".
- */
- private final String prefix;
-
- /**
- * The specialized property prefix, ending with ".".
- */
- private final String specPrefix;
-
- /**
- *
- * @param prefix the property name prefix that appears before any specialization, may
- * be ""
- * @param specialization the property name specialization (e.g., session name)
- */
- public SpecProperties(String prefix, String specialization) {
- this.prefix = withTrailingDot(prefix);
- this.specPrefix = withTrailingDot(this.prefix + specialization);
- }
-
- /**
- *
- * @param prefix the property name prefix that appears before any specialization, may
- * be ""
- * @param specialization the property name specialization (e.g., session name)
- * @param props the default properties
- */
- public SpecProperties(String prefix, String specialization, Properties props) {
- super(props);
-
- this.prefix = withTrailingDot(prefix);
- this.specPrefix = withTrailingDot(this.prefix + specialization);
- }
-
- /**
- * Adds a trailing "." to a String, if it doesn't already have one.
- *
- * @param text text to which the "." should be added
- * @return the text, with a trailing "."
- */
- private static String withTrailingDot(String text) {
- return text.isEmpty() || text.endsWith(".") ? text : text + ".";
- }
-
- /**
- * Gets the property whose value has the given key, looking first for the specialized
- * property name, and then for the generalized property name.
- *
- * @param key property name, without the specialization
- * @return the value from the property set, or {@code null} if the property set does
- * not contain the value
- */
- @Override
- public String getProperty(String key) {
- if (!key.startsWith(prefix)) {
- return super.getProperty(key);
- }
-
- String suffix = key.substring(prefix.length());
-
- String val = super.getProperty(specPrefix + suffix);
- if (val != null) {
- return val;
- }
-
- return super.getProperty(key);
- }
-
- protected String getPrefix() {
- return prefix;
- }
-
- protected String getSpecPrefix() {
- return specPrefix;
- }
-
- @Override
- public final int hashCode() {
- throw new UnsupportedOperationException("SpecProperties cannot be hashed");
- }
-
- @Override
- public final boolean equals(Object obj) {
- throw new UnsupportedOperationException("cannot compare SpecProperties");
- }
-}