aboutsummaryrefslogtreecommitdiffstats
path: root/main/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'main/src/main')
-rw-r--r--main/src/main/java/org/onap/policy/pdpx/main/XacmlState.java37
-rw-r--r--main/src/main/java/org/onap/policy/pdpx/main/rest/XacmlPdpRestController.java22
-rw-r--r--main/src/main/java/org/onap/policy/pdpx/main/rest/XacmlPdpServiceFilter.java15
-rw-r--r--main/src/main/java/org/onap/policy/pdpx/main/rest/provider/DecisionProvider.java10
-rw-r--r--main/src/main/java/org/onap/policy/pdpx/main/rest/serialization/XacmlExceptionMapper.java5
-rw-r--r--main/src/main/java/org/onap/policy/pdpx/main/rest/serialization/XacmlJsonExceptionMapper.java5
-rw-r--r--main/src/main/java/org/onap/policy/pdpx/main/rest/serialization/XacmlJsonMessageBodyHandler.java15
-rw-r--r--main/src/main/java/org/onap/policy/pdpx/main/rest/serialization/XacmlXmlExceptionMapper.java5
-rw-r--r--main/src/main/java/org/onap/policy/pdpx/main/rest/serialization/XacmlXmlMessageBodyHandler.java15
-rw-r--r--main/src/main/java/org/onap/policy/pdpx/main/startstop/XacmlPdpRestServer.java3
-rw-r--r--main/src/main/resources/META-INF/persistence.xml2
11 files changed, 52 insertions, 82 deletions
diff --git a/main/src/main/java/org/onap/policy/pdpx/main/XacmlState.java b/main/src/main/java/org/onap/policy/pdpx/main/XacmlState.java
index 3635a21a..d67a1fad 100644
--- a/main/src/main/java/org/onap/policy/pdpx/main/XacmlState.java
+++ b/main/src/main/java/org/onap/policy/pdpx/main/XacmlState.java
@@ -1,6 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2019, 2021-2022 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2023 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,21 +21,18 @@
package org.onap.policy.pdpx.main;
-import java.time.Instant;
import java.util.Collections;
import org.apache.commons.lang3.StringUtils;
import org.onap.policy.common.utils.network.NetworkUtil;
import org.onap.policy.models.pdp.concepts.PdpMessage;
import org.onap.policy.models.pdp.concepts.PdpResponseDetails;
import org.onap.policy.models.pdp.concepts.PdpStateChange;
-import org.onap.policy.models.pdp.concepts.PdpStatistics;
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.PdpResponseStatus;
import org.onap.policy.models.pdp.enums.PdpState;
import org.onap.policy.pdpx.main.rest.XacmlPdpApplicationManager;
-import org.onap.policy.pdpx.main.rest.XacmlPdpStatisticsManager;
import org.onap.policy.pdpx.main.startstop.XacmlPdpActivator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -96,43 +94,10 @@ public class XacmlState {
: PdpHealthStatus.NOT_HEALTHY);
PdpStatus heartbeat = new PdpStatus(status);
- heartbeat.setStatistics(getStatistics());
return heartbeat;
}
/**
- * Generates statistics to be used in a heart beat message.
- *
- * @return statistics for heart beat message
- */
- protected PdpStatistics getStatistics() {
- XacmlPdpStatisticsManager stats = XacmlPdpStatisticsManager.getCurrent();
- if (stats == null) {
- LOGGER.warn("XacmlPdpStatisticsManager is null");
- return null;
- }
- stats.setTotalPolicyCount(appManager.getPolicyCount());
-
- PdpStatistics pdpStats = new PdpStatistics();
- pdpStats.setPdpGroupName(this.status.getPdpGroup());
- pdpStats.setPdpSubGroupName(this.status.getPdpSubgroup());
- pdpStats.setTimeStamp(Instant.ofEpochSecond(this.status.getTimestampMs()));
-
- pdpStats.setPolicyExecutedCount(stats.getPermitDecisionsCount() + stats.getDenyDecisionsCount());
- pdpStats.setPolicyExecutedSuccessCount(stats.getPermitDecisionsCount());
- pdpStats.setPolicyExecutedFailCount(stats.getDenyDecisionsCount());
-
- pdpStats.setPolicyDeployCount(stats.getDeploySuccessCount() + stats.getDeployFailureCount());
- pdpStats.setPolicyDeploySuccessCount(stats.getDeploySuccessCount());
- pdpStats.setPolicyDeployFailCount(stats.getDeployFailureCount());
-
- pdpStats.setPolicyUndeployCount(stats.getUndeploySuccessCount() + stats.getUndeployFailureCount());
- pdpStats.setPolicyUndeploySuccessCount(stats.getUndeploySuccessCount());
- pdpStats.setPolicyUndeployFailCount(stats.getUndeployFailureCount());
- return pdpStats;
- }
-
- /**
* Updates the internal state based on the given message.
*
* @param message message from which to update the internal state
diff --git a/main/src/main/java/org/onap/policy/pdpx/main/rest/XacmlPdpRestController.java b/main/src/main/java/org/onap/policy/pdpx/main/rest/XacmlPdpRestController.java
index 05f40cc5..3adf0b1f 100644
--- a/main/src/main/java/org/onap/policy/pdpx/main/rest/XacmlPdpRestController.java
+++ b/main/src/main/java/org/onap/policy/pdpx/main/rest/XacmlPdpRestController.java
@@ -22,18 +22,18 @@
package org.onap.policy.pdpx.main.rest;
import com.att.research.xacml.api.Request;
+import jakarta.servlet.http.HttpServletRequest;
+import jakarta.ws.rs.Consumes;
+import jakarta.ws.rs.GET;
+import jakarta.ws.rs.HeaderParam;
+import jakarta.ws.rs.POST;
+import jakarta.ws.rs.Path;
+import jakarta.ws.rs.Produces;
+import jakarta.ws.rs.core.Context;
+import jakarta.ws.rs.core.MediaType;
+import jakarta.ws.rs.core.Response;
+import jakarta.ws.rs.core.Response.ResponseBuilder;
import java.util.UUID;
-import javax.servlet.http.HttpServletRequest;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.GET;
-import javax.ws.rs.HeaderParam;
-import javax.ws.rs.POST;
-import javax.ws.rs.Path;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.Context;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.Response.ResponseBuilder;
import org.onap.policy.models.decisions.concepts.DecisionException;
import org.onap.policy.models.decisions.concepts.DecisionRequest;
import org.onap.policy.pdpx.main.rest.provider.DecisionProvider;
diff --git a/main/src/main/java/org/onap/policy/pdpx/main/rest/XacmlPdpServiceFilter.java b/main/src/main/java/org/onap/policy/pdpx/main/rest/XacmlPdpServiceFilter.java
index 8e34414d..3a16d54d 100644
--- a/main/src/main/java/org/onap/policy/pdpx/main/rest/XacmlPdpServiceFilter.java
+++ b/main/src/main/java/org/onap/policy/pdpx/main/rest/XacmlPdpServiceFilter.java
@@ -3,6 +3,7 @@
* ONAP
* ================================================================================
* Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2023 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,16 +21,16 @@
package org.onap.policy.pdpx.main.rest;
+import jakarta.servlet.Filter;
+import jakarta.servlet.FilterChain;
+import jakarta.servlet.ServletException;
+import jakarta.servlet.ServletRequest;
+import jakarta.servlet.ServletResponse;
+import jakarta.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Set;
import java.util.concurrent.atomic.AtomicBoolean;
-import javax.servlet.Filter;
-import javax.servlet.FilterChain;
-import javax.servlet.ServletException;
-import javax.servlet.ServletRequest;
-import javax.servlet.ServletResponse;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
/**
* Filter that verifies that the API services (i.e., decision services) are enabled
diff --git a/main/src/main/java/org/onap/policy/pdpx/main/rest/provider/DecisionProvider.java b/main/src/main/java/org/onap/policy/pdpx/main/rest/provider/DecisionProvider.java
index 98340b2d..7bc23b15 100644
--- a/main/src/main/java/org/onap/policy/pdpx/main/rest/provider/DecisionProvider.java
+++ b/main/src/main/java/org/onap/policy/pdpx/main/rest/provider/DecisionProvider.java
@@ -1,6 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2019-2020, 2022 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2023 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -98,7 +99,7 @@ public class DecisionProvider {
if (application != null) {
return application;
}
- throw new DecisionException(javax.ws.rs.core.Response.Status.BAD_REQUEST,
+ throw new DecisionException(jakarta.ws.rs.core.Response.Status.BAD_REQUEST,
"No application for action " + request.getAction());
}
@@ -107,7 +108,7 @@ public class DecisionProvider {
if (application instanceof NativePdpApplication) {
return application;
}
- throw new DecisionException(javax.ws.rs.core.Response.Status.INTERNAL_SERVER_ERROR,
+ throw new DecisionException(jakarta.ws.rs.core.Response.Status.INTERNAL_SERVER_ERROR,
"Native PDP application cannot be found");
}
@@ -126,10 +127,7 @@ public class DecisionProvider {
XacmlPdpStatisticsManager.getCurrent().updateDenyDecisionsCount(appName);
break;
- case INDETERMINATE:
- case INDETERMINATE_DENY:
- case INDETERMINATE_DENYPERMIT:
- case INDETERMINATE_PERMIT:
+ case INDETERMINATE, INDETERMINATE_DENY, INDETERMINATE_DENYPERMIT, INDETERMINATE_PERMIT:
XacmlPdpStatisticsManager.getCurrent().updateIndeterminantDecisionsCount(appName);
break;
diff --git a/main/src/main/java/org/onap/policy/pdpx/main/rest/serialization/XacmlExceptionMapper.java b/main/src/main/java/org/onap/policy/pdpx/main/rest/serialization/XacmlExceptionMapper.java
index a2a78a89..91a63922 100644
--- a/main/src/main/java/org/onap/policy/pdpx/main/rest/serialization/XacmlExceptionMapper.java
+++ b/main/src/main/java/org/onap/policy/pdpx/main/rest/serialization/XacmlExceptionMapper.java
@@ -1,6 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2020-2021 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2023 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,9 +21,9 @@
package org.onap.policy.pdpx.main.rest.serialization;
+import jakarta.ws.rs.core.Response;
+import jakarta.ws.rs.ext.ExceptionMapper;
import java.io.IOException;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.ext.ExceptionMapper;
import lombok.Getter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/main/src/main/java/org/onap/policy/pdpx/main/rest/serialization/XacmlJsonExceptionMapper.java b/main/src/main/java/org/onap/policy/pdpx/main/rest/serialization/XacmlJsonExceptionMapper.java
index 03f3ddce..431169b8 100644
--- a/main/src/main/java/org/onap/policy/pdpx/main/rest/serialization/XacmlJsonExceptionMapper.java
+++ b/main/src/main/java/org/onap/policy/pdpx/main/rest/serialization/XacmlJsonExceptionMapper.java
@@ -1,6 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2023 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,8 +21,8 @@
package org.onap.policy.pdpx.main.rest.serialization;
-import javax.ws.rs.Produces;
-import javax.ws.rs.ext.Provider;
+import jakarta.ws.rs.Produces;
+import jakarta.ws.rs.ext.Provider;
/**
* Catches IOException when decoding/encoding a REST xacml request/response and converts them from an HTTP 500
diff --git a/main/src/main/java/org/onap/policy/pdpx/main/rest/serialization/XacmlJsonMessageBodyHandler.java b/main/src/main/java/org/onap/policy/pdpx/main/rest/serialization/XacmlJsonMessageBodyHandler.java
index 58ed5f76..3ebe89d1 100644
--- a/main/src/main/java/org/onap/policy/pdpx/main/rest/serialization/XacmlJsonMessageBodyHandler.java
+++ b/main/src/main/java/org/onap/policy/pdpx/main/rest/serialization/XacmlJsonMessageBodyHandler.java
@@ -1,6 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2020-2022 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2023 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,6 +25,13 @@ import com.att.research.xacml.api.Request;
import com.att.research.xacml.api.Response;
import com.att.research.xacml.std.json.JsonRequestTranslator;
import com.att.research.xacml.std.json.JsonResponseTranslator;
+import jakarta.ws.rs.Consumes;
+import jakarta.ws.rs.Produces;
+import jakarta.ws.rs.core.MediaType;
+import jakarta.ws.rs.core.MultivaluedMap;
+import jakarta.ws.rs.ext.MessageBodyReader;
+import jakarta.ws.rs.ext.MessageBodyWriter;
+import jakarta.ws.rs.ext.Provider;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@@ -31,13 +39,6 @@ import java.io.OutputStreamWriter;
import java.lang.annotation.Annotation;
import java.lang.reflect.Type;
import java.nio.charset.StandardCharsets;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.MultivaluedMap;
-import javax.ws.rs.ext.MessageBodyReader;
-import javax.ws.rs.ext.MessageBodyWriter;
-import javax.ws.rs.ext.Provider;
/**
* Provider that serializes and de-serializes xacml request/response json.
diff --git a/main/src/main/java/org/onap/policy/pdpx/main/rest/serialization/XacmlXmlExceptionMapper.java b/main/src/main/java/org/onap/policy/pdpx/main/rest/serialization/XacmlXmlExceptionMapper.java
index 562c0e91..aaedc912 100644
--- a/main/src/main/java/org/onap/policy/pdpx/main/rest/serialization/XacmlXmlExceptionMapper.java
+++ b/main/src/main/java/org/onap/policy/pdpx/main/rest/serialization/XacmlXmlExceptionMapper.java
@@ -1,6 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2023 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,8 +21,8 @@
package org.onap.policy.pdpx.main.rest.serialization;
-import javax.ws.rs.Produces;
-import javax.ws.rs.ext.Provider;
+import jakarta.ws.rs.Produces;
+import jakarta.ws.rs.ext.Provider;
/**
* Catches IOException when decoding/encoding a REST xacml request/response and converts them from an HTTP 500
diff --git a/main/src/main/java/org/onap/policy/pdpx/main/rest/serialization/XacmlXmlMessageBodyHandler.java b/main/src/main/java/org/onap/policy/pdpx/main/rest/serialization/XacmlXmlMessageBodyHandler.java
index 5ec17634..61160faa 100644
--- a/main/src/main/java/org/onap/policy/pdpx/main/rest/serialization/XacmlXmlMessageBodyHandler.java
+++ b/main/src/main/java/org/onap/policy/pdpx/main/rest/serialization/XacmlXmlMessageBodyHandler.java
@@ -1,6 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2020-2022 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2023 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -25,6 +26,13 @@ import com.att.research.xacml.api.Response;
import com.att.research.xacml.std.dom.DOMRequest;
import com.att.research.xacml.std.dom.DOMResponse;
import com.att.research.xacml.std.dom.DOMStructureException;
+import jakarta.ws.rs.Consumes;
+import jakarta.ws.rs.Produces;
+import jakarta.ws.rs.core.MediaType;
+import jakarta.ws.rs.core.MultivaluedMap;
+import jakarta.ws.rs.ext.MessageBodyReader;
+import jakarta.ws.rs.ext.MessageBodyWriter;
+import jakarta.ws.rs.ext.Provider;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@@ -32,13 +40,6 @@ import java.io.OutputStreamWriter;
import java.lang.annotation.Annotation;
import java.lang.reflect.Type;
import java.nio.charset.StandardCharsets;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.MultivaluedMap;
-import javax.ws.rs.ext.MessageBodyReader;
-import javax.ws.rs.ext.MessageBodyWriter;
-import javax.ws.rs.ext.Provider;
/**
* Provider that serializes and de-serializes xacml request/response xml.
diff --git a/main/src/main/java/org/onap/policy/pdpx/main/startstop/XacmlPdpRestServer.java b/main/src/main/java/org/onap/policy/pdpx/main/startstop/XacmlPdpRestServer.java
index 683d013e..33cf8934 100644
--- a/main/src/main/java/org/onap/policy/pdpx/main/startstop/XacmlPdpRestServer.java
+++ b/main/src/main/java/org/onap/policy/pdpx/main/startstop/XacmlPdpRestServer.java
@@ -1,6 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2020-2021 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2023 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,9 +21,9 @@
package org.onap.policy.pdpx.main.startstop;
+import jakarta.servlet.Filter;
import java.util.List;
import java.util.Properties;
-import javax.servlet.Filter;
import org.onap.policy.common.endpoints.http.server.JsonExceptionMapper;
import org.onap.policy.common.endpoints.http.server.RestServer;
import org.onap.policy.common.endpoints.http.server.YamlExceptionMapper;
diff --git a/main/src/main/resources/META-INF/persistence.xml b/main/src/main/resources/META-INF/persistence.xml
index 5e589d69..c2d7d078 100644
--- a/main/src/main/resources/META-INF/persistence.xml
+++ b/main/src/main/resources/META-INF/persistence.xml
@@ -28,7 +28,7 @@
<class>org.onap.policy.guard.OperationsHistory</class>
<properties>
- <property name="javax.persistence.schema-generation.database.action" value="create" />
+ <property name="jakarta.persistence.schema-generation.database.action" value="create" />
<property name="hibernate.dialect" value="org.hibernate.dialect.H2Dialect"/>
<property name="hibernate.show_sql" value="false" />
</properties>