import org.onap.policy.models.pdp.enums.PdpState;
import org.onap.policy.pdpx.main.rest.XacmlPdpApplicationManager;
import org.onap.policy.pdpx.main.startstop.XacmlPdpActivator;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
/**
* Current state of this XACML PDP.
*/
public class XacmlState {
- private static final Logger LOGGER = LoggerFactory.getLogger(XacmlState.class);
-
/**
* The application manager.
*/
* @return {@code true} if this PDP should handle the message, {@code false} otherwise
*/
public boolean shouldHandle(PdpMessage message) {
- return message.appliesTo(status.getName(), status.getPdpGroup(), status.getPdpType());
+ return message.appliesTo(status.getName(), status.getPdpGroup(), status.getPdpSubgroup());
}
/**
*
* @return a new heart beat message
*/
- public synchronized PdpStatus genHeartbeat() {
+ public PdpStatus genHeartbeat() {
// first, update status fields
status.setHealthy(XacmlPdpActivator.getCurrent().isAlive() ? PdpHealthStatus.HEALTHY
: PdpHealthStatus.NOT_HEALTHY);
* @param message message from which to update the internal state
* @return a response to the message
*/
- public synchronized PdpStatus updateInternalState(PdpStateChange message) {
- LOGGER.info("set state of {} to {}", this, message.getState());
+ public PdpStatus updateInternalState(PdpStateChange message) {
status.setState(message.getState());
/*
* @param message message from which to update the internal state
* @return a response to the message
*/
- public synchronized PdpStatus updateInternalState(PdpUpdate message, String errMessage) {
+ public PdpStatus updateInternalState(PdpUpdate message, String errMessage) {
status.setPdpSubgroup(message.getPdpSubgroup());
status.setPolicies(appManager.getToscaPolicyIdentifiers());
*
* @return the current PdpStatus with Terminated state
*/
- public synchronized PdpStatus terminatePdpMessage() {
- LOGGER.info("set state of {} to {}", this, PdpState.TERMINATED);
+ public PdpStatus terminatePdpMessage() {
status.setState(PdpState.TERMINATED);
return new PdpStatus(status);
}