summary |
shortlog |
log |
commit | commitdiff |
review |
tree
raw |
patch |
inline | side by side (from parent 1:
05045cd)
Fixed checkstyle issues
Made changes to include PdpGroup and PdpSubGroup in termination message
Change-Id: I772404adbbe9be18001554616eb0c935317bdaba
Issue-ID: POLICY-1645
Signed-off-by: Michael Mokry <michael.mokry@att.com>
return makeResponse(message);
}
return makeResponse(message);
}
+ /**
+ * Updates the internal state to Terminated.
+ *
+ * @return the current PdpStatus with Terminated state
+ */
+ public PdpStatus terminatePdpMessage() {
+ status.setState(PdpState.TERMINATED);
+ return status;
+ }
+
/**
* Makes a response to the given message, based on the current state.
*
/**
* Makes a response to the given message, based on the current state.
*
import java.nio.file.Paths;
import java.util.Arrays;
import java.nio.file.Paths;
import java.util.Arrays;
+import java.util.Collections;
import java.util.Properties;
import lombok.Getter;
import lombok.Setter;
import java.util.Properties;
import lombok.Getter;
import lombok.Setter;
import org.onap.policy.common.endpoints.event.comm.client.TopicSinkClientException;
import org.onap.policy.common.endpoints.listeners.MessageTypeDispatcher;
import org.onap.policy.common.parameters.ParameterService;
import org.onap.policy.common.endpoints.event.comm.client.TopicSinkClientException;
import org.onap.policy.common.endpoints.listeners.MessageTypeDispatcher;
import org.onap.policy.common.parameters.ParameterService;
+import org.onap.policy.common.utils.network.NetworkUtil;
import org.onap.policy.common.utils.services.ServiceManagerContainer;
import org.onap.policy.models.pdp.concepts.PdpStatus;
import org.onap.policy.models.pdp.enums.PdpMessageType;
import org.onap.policy.common.utils.services.ServiceManagerContainer;
import org.onap.policy.models.pdp.concepts.PdpStatus;
import org.onap.policy.models.pdp.enums.PdpMessageType;
+import org.onap.policy.models.pdp.enums.PdpState;
import org.onap.policy.pdpx.main.PolicyXacmlPdpRuntimeException;
import org.onap.policy.pdpx.main.XacmlState;
import org.onap.policy.pdpx.main.comm.XacmlPdpHearbeatPublisher;
import org.onap.policy.pdpx.main.PolicyXacmlPdpRuntimeException;
import org.onap.policy.pdpx.main.XacmlState;
import org.onap.policy.pdpx.main.comm.XacmlPdpHearbeatPublisher;
TopicEndpoint.manager.addTopicSources(topicProperties);
XacmlPdpHearbeatPublisher heartbeat;
TopicEndpoint.manager.addTopicSources(topicProperties);
XacmlPdpHearbeatPublisher heartbeat;
+ TopicSinkClient sinkClient;
+ final XacmlState state;
try {
XacmlPdpApplicationManager appmgr =
try {
XacmlPdpApplicationManager appmgr =
XacmlPdpStatisticsManager.setCurrent(stats);
stats.setTotalPolicyTypesCount(appmgr.getPolicyTypeCount());
XacmlPdpStatisticsManager.setCurrent(stats);
stats.setTotalPolicyTypesCount(appmgr.getPolicyTypeCount());
- XacmlState state = new XacmlState(appmgr);
+ state = new XacmlState(appmgr);
this.xacmlPdpParameterGroup = xacmlPdpParameterGroup;
this.msgDispatcher = new MessageTypeDispatcher(MSG_TYPE_NAMES);
this.xacmlPdpParameterGroup = xacmlPdpParameterGroup;
this.msgDispatcher = new MessageTypeDispatcher(MSG_TYPE_NAMES);
- TopicSinkClient sinkClient = new TopicSinkClient(TOPIC);
+ sinkClient = new TopicSinkClient(TOPIC);
heartbeat = new XacmlPdpHearbeatPublisher(sinkClient, state);
/*
heartbeat = new XacmlPdpHearbeatPublisher(sinkClient, state);
/*
TopicEndpoint.manager::start,
TopicEndpoint.manager::shutdown);
TopicEndpoint.manager::start,
TopicEndpoint.manager::shutdown);
+ addAction("Terminate PDP",
+ () -> { },
+ () -> sendTerminateMessage(sinkClient, state));
// initial heart beats act as registration messages
addAction("Heartbeat Publisher",
heartbeat::start,
// initial heart beats act as registration messages
addAction("Heartbeat Publisher",
heartbeat::start,
addAction("REST server",
() -> restServer.start(),
() -> restServer.stop());
addAction("REST server",
() -> restServer.start(),
() -> restServer.stop());
+ /*
+ * Method used to send a terminate message to the PAP.
+ */
+ private void sendTerminateMessage(TopicSinkClient sinkClient, XacmlState state) {
+ PdpStatus terminateStatus = state.terminatePdpMessage();
+ sinkClient.send(terminateStatus);
+ }
+
/**
* Get the parameters used by the activator.
*
/**
* Get the parameters used by the activator.
*