From d1fcd126f971380f3e6a2401902ca4a261147324 Mon Sep 17 00:00:00 2001 From: "Smokowski, Kevin (ks6305)" Date: Mon, 5 Mar 2018 16:41:54 -0500 Subject: re-use parser instance add an additional logging statement and save memory Change-Id: Idc8bdefb00ac61317cc38848dce670d76b6d89f7 Issue-ID: CCSDK-204 Signed-off-by: Smokowski, Kevin (ks6305) --- .../java/org/onap/ccsdk/sli/core/sli/SvcLogicLoader.java | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicLoader.java') diff --git a/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicLoader.java b/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicLoader.java index 95f73f96..37d7faae 100644 --- a/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicLoader.java +++ b/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicLoader.java @@ -39,15 +39,18 @@ public class SvcLogicLoader { private static final Logger LOGGER = LoggerFactory.getLogger(SvcLogicLoader.class); protected SvcLogicStore store; protected String directoryRoot; + protected SvcLogicParser parser; public SvcLogicLoader(String directoryRoot, SvcLogicStore store) { this.store = store; this.directoryRoot = directoryRoot; + this.parser = new SvcLogicParser(); } - + public SvcLogicLoader(String directoryRoot, String propFile) { this.store = SvcLogicParser.getStore(propFile); this.directoryRoot = directoryRoot; + this.parser = new SvcLogicParser(); } public void loadAndActivate() throws IOException { @@ -58,7 +61,7 @@ public class SvcLogicLoader { activateGraphs(activationEntries); } - private List processActivationFiles(List activationPaths) { + protected List processActivationFiles(List activationPaths) { List activationEntries = new ArrayList(); for (Path activationFile : activationPaths) { activationEntries.addAll(getActivationEntries(activationFile)); @@ -66,10 +69,12 @@ public class SvcLogicLoader { return activationEntries; } - private void activateGraphs(List activationEntries) { + protected void activateGraphs(List activationEntries) { for (ActivationEntry entry : activationEntries) { try { if (store.hasGraph(entry.module, entry.rpc, entry.version, entry.mode)) { + LOGGER.info("Activating SvcLogicGraph [module=" + entry.module + ", rpc=" + entry.rpc + ", mode=" + + entry.mode + ", version=" + entry.version + "]"); store.activate(entry.module, entry.rpc, entry.version, entry.mode); } else { LOGGER.error("hasGraph returned false for " + entry.toString()); @@ -113,13 +118,12 @@ public class SvcLogicLoader { } } - private void saveGraph(String xmlFile) throws SvcLogicException { + protected void saveGraph(String xmlFile) throws SvcLogicException { File f = new File(xmlFile); if (!f.canRead()) { throw new ConfigurationException("Cannot read xml file (" + xmlFile + ")"); } - SvcLogicParser parser = new SvcLogicParser(); LinkedList graphs = null; try { -- cgit 1.2.3-korg