X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=main%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Fpolicy%2Fpdpx%2Fmain%2Fstartstop%2FMain.java;h=b5915e11efbe3ec4748cfd899983829c5aa1f4f9;hb=5dd6d165a0b3ee88563e5bcabd4c2a7fc42a676b;hp=65e0a31e5753c4ccbf9a1f16a805c40ed83b3a96;hpb=9bf471abe906598ffd2cd280d372e7cb9474a418;p=policy%2Fxacml-pdp.git diff --git a/main/src/main/java/org/onap/policy/pdpx/main/startstop/Main.java b/main/src/main/java/org/onap/policy/pdpx/main/startstop/Main.java index 65e0a31e..b5915e11 100644 --- a/main/src/main/java/org/onap/policy/pdpx/main/startstop/Main.java +++ b/main/src/main/java/org/onap/policy/pdpx/main/startstop/Main.java @@ -20,8 +20,13 @@ package org.onap.policy.pdpx.main.startstop; +import java.io.FileInputStream; +import java.net.UnknownHostException; import java.util.Arrays; +import java.util.Properties; +import org.onap.policy.common.endpoints.event.comm.client.TopicSinkClientException; import org.onap.policy.pdpx.main.PolicyXacmlPdpException; +import org.onap.policy.pdpx.main.comm.XacmlPdpPapRegistration; import org.onap.policy.pdpx.main.parameters.XacmlPdpParameterGroup; import org.onap.policy.pdpx.main.parameters.XacmlPdpParameterHandler; import org.slf4j.Logger; @@ -78,13 +83,25 @@ public class Main { return; } + // Read the properties + Properties props = new Properties(); + try { + String propFile = arguments.getFullPropertyFilePath(); + try (FileInputStream stream = new FileInputStream(propFile)) { + props.load(stream); + } + } catch (final Exception e) { + LOGGER.error("start of xacml pdp service failed", e); + return; + } + // Now, create the activator for the policy xacml pdp service - activator = new XacmlPdpActivator(parameterGroup); + activator = new XacmlPdpActivator(parameterGroup, props); // Start the activator try { - activator.initialize(); - } catch (final PolicyXacmlPdpException e) { + activator.start(); + } catch (final RuntimeException e) { LOGGER.error("start of policy xacml pdp service failed, used parameters are " + Arrays.toString(args), e); return; } @@ -117,13 +134,13 @@ public class Main { * * @throws PolicyXacmlPdpException on shutdown errors */ - public void shutdown() throws PolicyXacmlPdpException { + public void shutdown() { // clear the parameterGroup variable parameterGroup = null; // clear the xacml pdp activator if (activator != null) { - activator.terminate(); + activator.stop(); } } @@ -139,12 +156,8 @@ public class Main { */ @Override public void run() { - try { - // Shutdown the policy xacml pdp service and wait for everything to stop - activator.terminate(); - } catch (final PolicyXacmlPdpException e) { - LOGGER.warn("error occured during shut down of the policy xacml pdp service", e); - } + // Shutdown the policy xacml pdp service and wait for everything to stop + activator.stop(); } }