diff options
author | Jim Hahn <jrh3@att.com> | 2020-03-26 09:53:53 -0400 |
---|---|---|
committer | Jim Hahn <jrh3@att.com> | 2020-03-26 10:20:33 -0400 |
commit | 266520e74db287e0d1fd0ce3715088ce9ffcc883 (patch) | |
tree | 7abdc8d8c537b541534de4df73ee8780208c3362 /controlloop/common/eventmanager/src/main | |
parent | 5582113b8f017f9cdae475d3198ab7a495c26657 (diff) |
Expand env variables in frankfurt properties
Issue-ID: POLICY-2434
Signed-off-by: Jim Hahn <jrh3@att.com>
Change-Id: I1109a053e46dc8201ff9676da0c9ff93d8b631d5
Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'controlloop/common/eventmanager/src/main')
2 files changed, 5 insertions, 25 deletions
diff --git a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManager2.java b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManager2.java index 69cbe7839..05563ca8d 100644 --- a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManager2.java +++ b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManager2.java @@ -75,7 +75,7 @@ public class ControlLoopEventManager2 implements ManagerContext, Serializable { private static final Logger logger = LoggerFactory.getLogger(ControlLoopEventManager2.class); private static final long serialVersionUID = -1216568161322872641L; - private static final String EVENT_MANAGER_SERVICE_CONFIG = "config/event-manager.properties"; + private static final String EVENT_MANAGER_SERVICE_CONFIG = "event-manager"; public static final String PROV_STATUS_ACTIVE = "ACTIVE"; private static final String VM_NAME = "VM_NAME"; private static final String VNF_NAME = "VNF_NAME"; diff --git a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/EventManagerServices.java b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/EventManagerServices.java index 3fbedcb1f..8ce3cb188 100644 --- a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/EventManagerServices.java +++ b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/EventManagerServices.java @@ -20,15 +20,11 @@ package org.onap.policy.controlloop.eventmanager; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.InputStream; import java.util.Map; import java.util.Properties; import lombok.Getter; import org.onap.policy.common.parameters.ValidationResult; import org.onap.policy.common.utils.properties.PropertyObjectUtils; -import org.onap.policy.common.utils.resources.ResourceUtils; import org.onap.policy.controlloop.actor.guard.GuardActorServiceProvider; import org.onap.policy.controlloop.actor.guard.GuardConfig; import org.onap.policy.controlloop.actor.guard.GuardOperation; @@ -39,6 +35,7 @@ import org.onap.policy.controlloop.ophistory.OperationHistoryDataManager; import org.onap.policy.controlloop.ophistory.OperationHistoryDataManagerImpl; import org.onap.policy.controlloop.ophistory.OperationHistoryDataManagerParams; import org.onap.policy.controlloop.ophistory.OperationHistoryDataManagerStub; +import org.onap.policy.drools.persistence.SystemPersistenceConstants; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -82,9 +79,8 @@ public class EventManagerServices { * @return the properties that were loaded from the configuration file */ public Properties startActorService(String configFileName) { - try (InputStream inpstr = openConfigFile(configFileName)) { - Properties props = new Properties(); - props.load(inpstr); + try { + Properties props = SystemPersistenceConstants.getManager().getProperties(configFileName); Map<String, Object> parameters = PropertyObjectUtils.toObject(props, ACTOR_SERVICE_PROPERTIES); PropertyObjectUtils.compressLists(parameters); @@ -94,29 +90,13 @@ public class EventManagerServices { return props; - } catch (RuntimeException | IOException e) { + } catch (RuntimeException e) { logger.error("cannot configure/start actor service"); throw new IllegalStateException(e); } } /** - * Opens the config file. - * - * @param configFileName configuration file name - * @return the file's input stream - * @throws FileNotFoundException if the file cannot be found - */ - private InputStream openConfigFile(String configFileName) throws FileNotFoundException { - InputStream inpstr = ResourceUtils.getResourceAsStream(configFileName); - if (inpstr == null) { - throw new FileNotFoundException(configFileName); - } - - return inpstr; - } - - /** * Determines if guards are enabled. * * @return {@code true} if guards are enabled, {@code false} otherwise |