aboutsummaryrefslogtreecommitdiffstats
path: root/main/src/main/java/org/onap/policy/pdpx/main/comm/XacmlPdpMessage.java
diff options
context:
space:
mode:
Diffstat (limited to 'main/src/main/java/org/onap/policy/pdpx/main/comm/XacmlPdpMessage.java')
-rw-r--r--main/src/main/java/org/onap/policy/pdpx/main/comm/XacmlPdpMessage.java114
1 files changed, 0 insertions, 114 deletions
diff --git a/main/src/main/java/org/onap/policy/pdpx/main/comm/XacmlPdpMessage.java b/main/src/main/java/org/onap/policy/pdpx/main/comm/XacmlPdpMessage.java
deleted file mode 100644
index 066e3f23..00000000
--- a/main/src/main/java/org/onap/policy/pdpx/main/comm/XacmlPdpMessage.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP
- * ================================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.pdpx.main.comm;
-
-import lombok.Getter;
-import org.onap.policy.common.utils.network.NetworkUtil;
-import org.onap.policy.models.pdp.concepts.PdpStateChange;
-import org.onap.policy.models.pdp.concepts.PdpStatus;
-import org.onap.policy.models.pdp.concepts.PdpUpdate;
-import org.onap.policy.models.pdp.enums.PdpHealthStatus;
-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;
-
-@Getter
-public class XacmlPdpMessage {
-
- // The logger for this class
- private static final Logger LOGGER = LoggerFactory.getLogger(XacmlPdpMessage.class);
- private String pdpGroup;
- private String pdpSubGroup;
- private PdpState pdpState;
- private String pdpName = NetworkUtil.getHostname();
-
- /**
- * Method used to format the initial registration status message.
- *
- * @param state of the PDP
- * @return status message of the PDP
- */
- public PdpStatus formatInitialStatusMessage(PdpState state) {
- PdpStatus status = new PdpStatus();
- status.setName(pdpName);
-
- if (XacmlPdpActivator.getCurrent().isAlive()) {
- status.setHealthy(PdpHealthStatus.HEALTHY);
- } else {
- status.setHealthy(PdpHealthStatus.NOT_HEALTHY);
- }
-
- status.setPdpType("xacml");
- status.setState(state);
- status.setSupportedPolicyTypes(XacmlPdpApplicationManager.getToscaPolicyTypeIdents());
-
- LOGGER.debug("formatStatusMessage state {} status{}", state, status);
-
- return status;
-
- }
-
- /**
- * Method used to format the PdpStatus message for heartbeat and PDP Updates.
- *
- * @return status message of the PDP
- */
- public PdpStatus formatPdpStatusMessage() {
- PdpStatus status = new PdpStatus();
- status.setName(pdpName);
-
- if (XacmlPdpActivator.getCurrent() != null && XacmlPdpActivator.getCurrent().isAlive()) {
- status.setHealthy(PdpHealthStatus.HEALTHY);
- } else {
- status.setHealthy(PdpHealthStatus.NOT_HEALTHY);
- }
-
- status.setPdpType("xacml");
- status.setState(pdpState);
- status.setPdpGroup(pdpGroup);
- status.setPdpSubgroup(pdpSubGroup);
- status.setSupportedPolicyTypes(XacmlPdpApplicationManager.getToscaPolicyTypeIdents());
- status.setPolicies(XacmlPdpApplicationManager.getToscaPolicyIdentifiers());
-
- return status;
- }
-
- /**
- * Method used to update PDP status attributes from PdpStateChange.
- */
- public void updateInternalStatus(PdpStateChange message) {
- pdpGroup = message.getPdpGroup();
- pdpSubGroup = message.getPdpSubgroup();
- pdpState = message.getState();
- }
-
- /**
- * Method used to update PDP status attributes from PdpUpdate.
- */
- public void updateInternalStatus(PdpUpdate message) {
- pdpGroup = message.getPdpGroup();
- pdpSubGroup = message.getPdpSubgroup();
- }
-}