summaryrefslogtreecommitdiffstats
path: root/main
diff options
context:
space:
mode:
Diffstat (limited to 'main')
-rw-r--r--main/src/main/java/org/onap/policy/pdpx/main/XacmlState.java4
-rw-r--r--main/src/main/java/org/onap/policy/pdpx/main/comm/XacmlPdpUpdatePublisher.java6
-rw-r--r--main/src/main/java/org/onap/policy/pdpx/main/parameters/XacmlPdpParameterGroup.java2
-rw-r--r--main/src/main/java/org/onap/policy/pdpx/main/rest/XacmlPdpApplicationManager.java4
-rw-r--r--main/src/main/java/org/onap/policy/pdpx/main/rest/provider/HealthCheckProvider.java4
-rw-r--r--main/src/main/java/org/onap/policy/pdpx/main/rest/provider/StatisticsProvider.java6
-rw-r--r--main/src/main/java/org/onap/policy/pdpx/main/rest/serialization/XacmlJsonMessageBodyHandler.java6
-rw-r--r--main/src/main/java/org/onap/policy/pdpx/main/rest/serialization/XacmlXmlMessageBodyHandler.java6
-rw-r--r--main/src/main/java/org/onap/policy/pdpx/main/startstop/Main.java8
-rw-r--r--main/src/main/java/org/onap/policy/pdpx/main/startstop/XacmlPdpActivator.java4
-rw-r--r--main/src/main/java/org/onap/policy/pdpx/main/startstop/XacmlPdpCommandLineArguments.java13
-rw-r--r--main/src/main/java/org/onap/policy/pdpx/main/startstop/XacmlPdpRestServer.java4
12 files changed, 33 insertions, 34 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 5ca75a62..8ec5ed2b 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
@@ -148,7 +148,7 @@ public class XacmlState {
* @return a new response
*/
private PdpStatus makeResponse(PdpMessage message, String errMessage) {
- PdpResponseDetails resp = new PdpResponseDetails();
+ var resp = new PdpResponseDetails();
if (StringUtils.isBlank(errMessage)) {
resp.setResponseStatus(PdpResponseStatus.SUCCESS);
@@ -158,7 +158,7 @@ public class XacmlState {
}
resp.setResponseTo(message.getRequestId());
- PdpStatus status2 = new PdpStatus(status);
+ var status2 = new PdpStatus(status);
status2.setResponse(resp);
return status2;
}
diff --git a/main/src/main/java/org/onap/policy/pdpx/main/comm/XacmlPdpUpdatePublisher.java b/main/src/main/java/org/onap/policy/pdpx/main/comm/XacmlPdpUpdatePublisher.java
index 4882760e..7806fead 100644
--- a/main/src/main/java/org/onap/policy/pdpx/main/comm/XacmlPdpUpdatePublisher.java
+++ b/main/src/main/java/org/onap/policy/pdpx/main/comm/XacmlPdpUpdatePublisher.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019-2021 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.
@@ -76,7 +76,7 @@ public class XacmlPdpUpdatePublisher {
}
}
- StringBuilder errorMessage = new StringBuilder();
+ var errorMessage = new StringBuilder();
// Deploy a policy
// if deployed policies do not contain the incoming policy load it
for (ToscaPolicy policy : incomingPolicies) {
@@ -96,7 +96,7 @@ public class XacmlPdpUpdatePublisher {
LOGGER.debug("Returning current deployed policies: {} ", message.getPolicies());
// update the policy count statistic
- XacmlPdpStatisticsManager stats = XacmlPdpStatisticsManager.getCurrent();
+ var stats = XacmlPdpStatisticsManager.getCurrent();
if (stats != null) {
stats.setTotalPolicyCount(appManager.getPolicyCount());
}
diff --git a/main/src/main/java/org/onap/policy/pdpx/main/parameters/XacmlPdpParameterGroup.java b/main/src/main/java/org/onap/policy/pdpx/main/parameters/XacmlPdpParameterGroup.java
index 12fec484..7afa480a 100644
--- a/main/src/main/java/org/onap/policy/pdpx/main/parameters/XacmlPdpParameterGroup.java
+++ b/main/src/main/java/org/onap/policy/pdpx/main/parameters/XacmlPdpParameterGroup.java
@@ -82,7 +82,7 @@ public class XacmlPdpParameterGroup extends ParameterGroupImpl {
final BeanValidationResult validationResult = super.validate();
if (policyApiParameters != null && StringUtils.isBlank(policyApiParameters.getHostname())) {
- BeanValidationResult sub = new BeanValidationResult(PARAM_POLICY_API, policyApiParameters);
+ var sub = new BeanValidationResult(PARAM_POLICY_API, policyApiParameters);
sub.addResult("hostname", policyApiParameters.getHostname(), ValidationStatus.INVALID, Validated.IS_NULL);
validationResult.addResult(sub);
}
diff --git a/main/src/main/java/org/onap/policy/pdpx/main/rest/XacmlPdpApplicationManager.java b/main/src/main/java/org/onap/policy/pdpx/main/rest/XacmlPdpApplicationManager.java
index 3553b4c4..e144ba3e 100644
--- a/main/src/main/java/org/onap/policy/pdpx/main/rest/XacmlPdpApplicationManager.java
+++ b/main/src/main/java/org/onap/policy/pdpx/main/rest/XacmlPdpApplicationManager.java
@@ -78,7 +78,7 @@ public class XacmlPdpApplicationManager {
// We are not going to make this available unless the application can
// install correctly.
//
- boolean applicationInitialized = false;
+ var applicationInitialized = false;
//
// Have it initialize at a path
//
@@ -237,7 +237,7 @@ public class XacmlPdpApplicationManager {
// Making an assumption that all application names are unique, and
// they can result in a valid directory being created.
//
- Path path = Paths.get(basePath.toAbsolutePath().toString(), application.applicationName());
+ var path = Paths.get(basePath.toAbsolutePath().toString(), application.applicationName());
if (LOGGER.isInfoEnabled()) {
LOGGER.info("initializeApplicationPath {} at this path {}", application.applicationName(), path);
}
diff --git a/main/src/main/java/org/onap/policy/pdpx/main/rest/provider/HealthCheckProvider.java b/main/src/main/java/org/onap/policy/pdpx/main/rest/provider/HealthCheckProvider.java
index 71a4e4e6..bc791872 100644
--- a/main/src/main/java/org/onap/policy/pdpx/main/rest/provider/HealthCheckProvider.java
+++ b/main/src/main/java/org/onap/policy/pdpx/main/rest/provider/HealthCheckProvider.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019, 2021 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.
@@ -40,7 +40,7 @@ public class HealthCheckProvider {
* @return Report containing health check status
*/
public HealthCheckReport performHealthCheck() {
- final HealthCheckReport report = new HealthCheckReport();
+ final var report = new HealthCheckReport();
report.setName(NAME);
report.setUrl(URL);
diff --git a/main/src/main/java/org/onap/policy/pdpx/main/rest/provider/StatisticsProvider.java b/main/src/main/java/org/onap/policy/pdpx/main/rest/provider/StatisticsProvider.java
index cf2fd608..6c7a7cd9 100644
--- a/main/src/main/java/org/onap/policy/pdpx/main/rest/provider/StatisticsProvider.java
+++ b/main/src/main/java/org/onap/policy/pdpx/main/rest/provider/StatisticsProvider.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019, 2021 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.
@@ -36,10 +36,10 @@ public class StatisticsProvider {
* @return Report containing statistics of xacmlPdp service
*/
public StatisticsReport fetchCurrentStatistics() {
- final StatisticsReport report = new StatisticsReport();
+ final var report = new StatisticsReport();
report.setCode(XacmlPdpActivator.getCurrent().isAlive() ? 200 : 500);
- XacmlPdpStatisticsManager stats = XacmlPdpStatisticsManager.getCurrent();
+ var stats = XacmlPdpStatisticsManager.getCurrent();
report.setTotalPolicyTypesCount(stats.getTotalPolicyTypesCount());
report.setTotalPoliciesCount(stats.getTotalPoliciesCount());
report.setTotalErrorCount(stats.getErrorCount());
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 9b59a003..a6d9952e 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,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2020-2021 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.
@@ -61,7 +61,7 @@ public class XacmlJsonMessageBodyHandler implements MessageBodyReader<Request>,
MediaType mediaType, MultivaluedMap<String, Object> httpHeaders, OutputStream entityStream)
throws IOException {
- try (OutputStreamWriter writer = new OutputStreamWriter(entityStream, StandardCharsets.UTF_8)) {
+ try (var writer = new OutputStreamWriter(entityStream, StandardCharsets.UTF_8)) {
writer.write(JsonResponseTranslator.toString(response, true));
} catch (Exception exc) {
throw new IOException("failed to convert a json response to a string");
@@ -100,4 +100,4 @@ public class XacmlJsonMessageBodyHandler implements MessageBodyReader<Request>,
return ("xacml+json".equals(mediaType.getSubtype()))
&& (type == Request.class || type == Response.class);
}
-} \ No newline at end of file
+}
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 ddd77528..4ddfbe26 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,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2020-2021 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.
@@ -62,7 +62,7 @@ public class XacmlXmlMessageBodyHandler implements MessageBodyReader<Request>, M
MediaType mediaType, MultivaluedMap<String, Object> httpHeaders, OutputStream entityStream)
throws IOException {
- try (OutputStreamWriter writer = new OutputStreamWriter(entityStream, StandardCharsets.UTF_8)) {
+ try (var writer = new OutputStreamWriter(entityStream, StandardCharsets.UTF_8)) {
writer.write(DOMResponse.toString(response, true));
} catch (Exception exc) {
throw new IOException("failed to convert a dom response to a string");
@@ -100,4 +100,4 @@ public class XacmlXmlMessageBodyHandler implements MessageBodyReader<Request>, M
return ("xacml+xml".equals(mediaType.getSubtype()))
&& (type == Request.class || type == Response.class);
}
-} \ No newline at end of file
+}
diff --git a/main/src/main/java/org/onap/policy/pdpx/main/startstop/Main.java b/main/src/main/java/org/onap/policy/pdpx/main/startstop/Main.java
index 64c41330..b19f31b8 100644
--- a/main/src/main/java/org/onap/policy/pdpx/main/startstop/Main.java
+++ b/main/src/main/java/org/onap/policy/pdpx/main/startstop/Main.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019-2021 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2019 Nordix Foundation.
* Modifications Copyright (C) 2020 Bell Canada. All rights reserved.
* ================================================================================
@@ -53,11 +53,11 @@ public class Main {
* @throws PolicyXacmlPdpException if an error occurs
*/
public Main(final String[] args) throws PolicyXacmlPdpException {
- final String argumentString = Arrays.toString(args);
+ final var argumentString = Arrays.toString(args);
LOGGER.info("Starting policy xacml pdp service with arguments - {}", argumentString);
// Check the arguments
- final XacmlPdpCommandLineArguments arguments = new XacmlPdpCommandLineArguments();
+ final var arguments = new XacmlPdpCommandLineArguments();
// The arguments return a string if there is a message to print and we should exit
argumentMessage = arguments.parse(args);
@@ -81,7 +81,7 @@ public class Main {
// Add a shutdown hook to shut everything down in an orderly manner
Runtime.getRuntime().addShutdownHook(new Thread(this::shutdown));
- String successMsg = String.format(MessageConstants.START_SUCCESS_MSG, MessageConstants.POLICY_XACML_PDP);
+ var successMsg = String.format(MessageConstants.START_SUCCESS_MSG, MessageConstants.POLICY_XACML_PDP);
LOGGER.info(successMsg);
}
diff --git a/main/src/main/java/org/onap/policy/pdpx/main/startstop/XacmlPdpActivator.java b/main/src/main/java/org/onap/policy/pdpx/main/startstop/XacmlPdpActivator.java
index 0a32d234..e17cecf7 100644
--- a/main/src/main/java/org/onap/policy/pdpx/main/startstop/XacmlPdpActivator.java
+++ b/main/src/main/java/org/onap/policy/pdpx/main/startstop/XacmlPdpActivator.java
@@ -87,12 +87,12 @@ public class XacmlPdpActivator extends ServiceManagerContainer {
final XacmlState state;
try {
- XacmlPdpApplicationManager appmgr =
+ var appmgr =
new XacmlPdpApplicationManager(Paths.get(xacmlPdpParameterGroup.getApplicationPath()),
xacmlPdpParameterGroup.getPolicyApiParameters());
XacmlPdpApplicationManager.setCurrent(appmgr);
- XacmlPdpStatisticsManager stats = new XacmlPdpStatisticsManager();
+ var stats = new XacmlPdpStatisticsManager();
XacmlPdpStatisticsManager.setCurrent(stats);
stats.setTotalPolicyTypesCount(appmgr.getPolicyTypeCount());
stats.setTotalPolicyCount(appmgr.getPolicyCount());
diff --git a/main/src/main/java/org/onap/policy/pdpx/main/startstop/XacmlPdpCommandLineArguments.java b/main/src/main/java/org/onap/policy/pdpx/main/startstop/XacmlPdpCommandLineArguments.java
index f393fc91..1267d858 100644
--- a/main/src/main/java/org/onap/policy/pdpx/main/startstop/XacmlPdpCommandLineArguments.java
+++ b/main/src/main/java/org/onap/policy/pdpx/main/startstop/XacmlPdpCommandLineArguments.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019, 2021 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.
@@ -23,7 +23,6 @@ package org.onap.policy.pdpx.main.startstop;
import java.io.File;
import java.io.PrintWriter;
import java.io.StringWriter;
-import java.net.URL;
import java.util.Arrays;
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.DefaultParser;
@@ -180,9 +179,9 @@ public class XacmlPdpCommandLineArguments {
* @return the help string
*/
public String help(final String mainClassName) {
- final HelpFormatter helpFormatter = new HelpFormatter();
- final StringWriter stringWriter = new StringWriter();
- final PrintWriter printWriter = new PrintWriter(stringWriter);
+ final var helpFormatter = new HelpFormatter();
+ final var stringWriter = new StringWriter();
+ final var printWriter = new PrintWriter(stringWriter);
helpFormatter.printHelp(printWriter, HELP_LINE_LENGTH, mainClassName + " [options...]", "options", options, 0,
0, "");
@@ -268,12 +267,12 @@ public class XacmlPdpCommandLineArguments {
}
// The file name refers to a resource on the local file system
- final URL fileUrl = ResourceUtils.getUrl4Resource(fileName);
+ final var fileUrl = ResourceUtils.getUrl4Resource(fileName);
if (fileUrl == null) {
throw new PolicyXacmlPdpException(fileTag + FILE_MESSAGE_PREAMBLE + fileName + "\" does not exist");
}
- final File theFile = new File(fileUrl.getPath());
+ final var theFile = new File(fileUrl.getPath());
if (!theFile.exists()) {
throw new PolicyXacmlPdpException(fileTag + FILE_MESSAGE_PREAMBLE + fileName + "\" does not exist");
}
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 b0f3b8c0..487253b2 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,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2020-2021 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.
@@ -57,7 +57,7 @@ public class XacmlPdpRestServer extends RestServer {
@Override
protected Properties getServerProperties(RestServerParameters restServerParameters, String names) {
- final Properties props = super.getServerProperties(restServerParameters, names);
+ final var props = super.getServerProperties(restServerParameters, names);
final String svcpfx =
PolicyEndPointProperties.PROPERTY_HTTP_SERVER_SERVICES + "." + restServerParameters.getName();