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;
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;
}
*
* @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();
}
}
*/
@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();
}
}