package org.onap.policy.pdpx.main.startstop;
+import java.util.List;
import lombok.Getter;
import lombok.Setter;
import org.onap.policy.common.endpoints.event.comm.TopicEndpointManager;
import org.onap.policy.pdpx.main.rest.XacmlPdpAafFilter;
import org.onap.policy.pdpx.main.rest.XacmlPdpApplicationManager;
import org.onap.policy.pdpx.main.rest.XacmlPdpRestController;
+import org.onap.policy.pdpx.main.rest.XacmlPdpServiceFilter;
import org.onap.policy.pdpx.main.rest.XacmlPdpStatisticsManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
msgDispatcher.register(PdpMessageType.PDP_UPDATE.name(),
new XacmlPdpUpdateListener(sinkClient, state, heartbeat, appmgr));
+ XacmlPdpServiceFilter.disableApi();
+
restServer = new XacmlPdpRestServer(xacmlPdpParameterGroup.getRestServerParameters(),
- XacmlPdpAafFilter.class, XacmlPdpRestController.class);
+ List.of(XacmlPdpServiceFilter.class, XacmlPdpAafFilter.class),
+ List.of(XacmlPdpRestController.class));
} catch (RuntimeException | HttpClientConfigException | BidirectionalTopicClientException e) {
throw new PolicyXacmlPdpRuntimeException(e.getMessage(), e);
heartbeat::terminate);
// @formatter:on
+ addAction("REST Server",
+ restServer::start,
+ restServer::stop);
}
/*
/**
* Start the xacmlpdp rest controller.
*/
- public void startXacmlRestController() {
- if (isXacmlRestControllerAlive()) {
- LOGGER.info("Xacml rest controller already running");
- } else {
- restServer.start();
- }
+ public void enableApi() {
+ XacmlPdpServiceFilter.enableApi();
}
/**
* Stop the xacmlpdp rest controller.
*/
- public void stopXacmlRestController() {
- if (isXacmlRestControllerAlive()) {
- restServer.stop();
- } else {
- LOGGER.info("Xacml rest controller already stopped");
- }
+ public void disableApi() {
+ XacmlPdpServiceFilter.disableApi();
}
- public boolean isXacmlRestControllerAlive() {
- return restServer.isAlive();
+ public boolean isApiEnabled() {
+ return XacmlPdpServiceFilter.isApiEnabled();
}
}