aboutsummaryrefslogtreecommitdiffstats
path: root/appc-event-listener/appc-event-listener-bundle
diff options
context:
space:
mode:
authorbeili.zhou <beili.zhou@amdocs.com>2017-08-11 21:48:22 -0400
committerbeili.zhou <beili.zhou@amdocs.com>2017-08-14 13:32:25 -0400
commit5ac1e8648e03877d72e145ba59d2c6f9cca78ad2 (patch)
treeded1faffd10865b02b5af1e6ad57becf117fd9c8 /appc-event-listener/appc-event-listener-bundle
parent5305576bceed02424d9ba92cbe14bfcd9190a9e4 (diff)
OAM operations 1 - miscellaneous
OAM operations changes are large, need to break down to multiple submissions based on size and compilability. This is the first set which covers: feature installation, audit log message, listener instantiation and etc. Includes these user stories: APPC-39/41/43/44/45/46/52/77. Issue Id: APPC-38 Change-Id: Ifc0f5bd2468732d04ae462be09a6ad720aefba2b Signed-off-by: beili.zhou <beili.zhou@amdocs.com>
Diffstat (limited to 'appc-event-listener/appc-event-listener-bundle')
-rw-r--r--appc-event-listener/appc-event-listener-bundle/src/main/java/org/openecomp/appc/listener/AppcEventListenerActivator.java40
1 files changed, 26 insertions, 14 deletions
diff --git a/appc-event-listener/appc-event-listener-bundle/src/main/java/org/openecomp/appc/listener/AppcEventListenerActivator.java b/appc-event-listener/appc-event-listener-bundle/src/main/java/org/openecomp/appc/listener/AppcEventListenerActivator.java
index 86abd6057..b8cfa2ef7 100644
--- a/appc-event-listener/appc-event-listener-bundle/src/main/java/org/openecomp/appc/listener/AppcEventListenerActivator.java
+++ b/appc-event-listener/appc-event-listener-bundle/src/main/java/org/openecomp/appc/listener/AppcEventListenerActivator.java
@@ -43,8 +43,8 @@ import java.util.Set;
* <p>
* The DMaaP listener is responsible for listening to a topic on the Universal Event Bus and reading in messages that
* conform to the DCAE message format for APPC. These messages will then be parsed and passed along to the APPC Provider
- * to take action on. The listener will also send messages out on DMaaP during critical phases. The messages sent out will
- * have a status of:
+ * to take action on. The listener will also send messages out on DMaaP during critical phases. The messages sent out
+ * will have a status of:
* <ul>
* <li><i>PENDING</i> - The listener has read the message off of DMaaP and has put it in the queue to be processed</li>
* <li><i>ACTIVE</i> - The listener has begun actually processing the request and is waiting on the appc provider to
@@ -119,29 +119,28 @@ public class AppcEventListenerActivator implements BundleActivator {
Properties props = configuration.getProperties();
- Set<ListenerProperties> listeners = new HashSet<ListenerProperties>();
+ Set<ListenerProperties> listeners = new HashSet<>();
// Configure event listener for the demo use case
ListenerProperties demoProps = new ListenerProperties("appc.demo", props);
demoProps.setListenerClass(org.openecomp.appc.listener.demo.impl.ListenerImpl.class);
listeners.add(demoProps);
- // ===========================================================================
+ // ===========================================================================
ListenerProperties clLCMProps = new ListenerProperties("appc.LCM", props);
clLCMProps.setListenerClass(org.openecomp.appc.listener.LCM.impl.ListenerImpl.class);
listeners.add(clLCMProps);
- //Configure the OAM properties
- clLCMProps = new ListenerProperties("appc.OAM", props);
- clLCMProps.setListenerClass(org.openecomp.appc.listener.LCM.impl.ListenerImpl.class);
- listeners.add(clLCMProps);
-
-/*
- ListenerProperties clLCMProps1607 = new ListenerProperties("appc.LCM1607", props);
- clLCMProps1607.setListenerClass(org.openecomp.appc.listener.LCM1607.impl.ListenerImpl.class);
- listeners.add(clLCMProps1607);
-*/
+ // Configure the OAM properties
+ String oamPropKeyPrefix = "appc.OAM";
+ ListenerProperties oamProps = new ListenerProperties(oamPropKeyPrefix, props);
+ if (isAppcOamPropsListenerEnabled(oamProps)) {
+ oamProps.setListenerClass(org.openecomp.appc.listener.LCM.impl.ListenerImpl.class);
+ listeners.add(oamProps);
+ } else {
+ LOG.warn(String.format("The listener %s is disabled and will not be run", oamPropKeyPrefix));
+ }
adapter = new ControllerImpl(listeners);
if (ctx != null && registration == null) {
@@ -186,4 +185,17 @@ public class AppcEventListenerActivator implements BundleActivator {
return "DMaaP Listener";
}
+ /**
+ * Check if AppcOam props disable listener or not
+ *
+ * @param listenerProperties of ListenerProperties objext
+ * @return false only if AppcOam disabled key is defined and equal to true. Otherwise, return true.
+ */
+ private boolean isAppcOamPropsListenerEnabled(ListenerProperties listenerProperties) {
+ final Properties appcOamProperties = listenerProperties.getProperties();
+
+ return appcOamProperties == null
+ || !Boolean.parseBoolean(appcOamProperties.getProperty(
+ ListenerProperties.KEYS.DISABLED.getPropertySuffix()));
+ }
}