summaryrefslogtreecommitdiffstats
path: root/policy-management/src/main
diff options
context:
space:
mode:
authoradheli.tavares <adheli.tavares@est.tech>2024-03-14 21:48:25 +0000
committeradheli.tavares <adheli.tavares@est.tech>2024-03-15 08:39:39 +0000
commit12142469280ab15d3c38802e6be7d7676435c2b9 (patch)
tree7b2803fb67ecd28c3f2d2c099c5ca35a55fe0627 /policy-management/src/main
parente51bea1cd5dff02cd00ab93fd4a7f5726fa9a2fb (diff)
Make drools-pdp work with drools and java versions compatible
with current DRL rules files syntax. Issue-ID: POLICY-4857 Change-Id: If4b385bdef865d07114b8ea0e69abb4589f3a97b Signed-off-by: adheli.tavares <adheli.tavares@est.tech>
Diffstat (limited to 'policy-management/src/main')
-rw-r--r--policy-management/src/main/java/org/onap/policy/drools/protocol/configuration/PdpdConfiguration.java38
-rw-r--r--policy-management/src/main/java/org/onap/policy/drools/server/restful/RestManager.java6
2 files changed, 24 insertions, 20 deletions
diff --git a/policy-management/src/main/java/org/onap/policy/drools/protocol/configuration/PdpdConfiguration.java b/policy-management/src/main/java/org/onap/policy/drools/protocol/configuration/PdpdConfiguration.java
index 76836ba2..1201c26e 100644
--- a/policy-management/src/main/java/org/onap/policy/drools/protocol/configuration/PdpdConfiguration.java
+++ b/policy-management/src/main/java/org/onap/policy/drools/protocol/configuration/PdpdConfiguration.java
@@ -165,30 +165,32 @@ public class PdpdConfiguration {
}
protected boolean declaredProperty(String name, Object value) {
- return switch (name) {
- case "requestID" -> {
+ switch (name) {
+ case "requestID":
callSetRequestId(value);
- yield true;
- }
- case "entity" -> {
+ return true;
+ case "entity":
callSetEntity(value);
- yield true;
- }
- case "controllers" -> {
+ return true;
+ case "controllers":
callSetControllers(value);
- yield true;
- }
- default -> false;
- };
+ return true;
+ default:
+ return false;
+ }
}
protected Object declaredPropertyOrNotFound(String name, Object notFoundValue) {
- return switch (name) {
- case "requestID" -> getRequestId();
- case "entity" -> getEntity();
- case "controllers" -> getControllers();
- default -> notFoundValue;
- };
+ switch (name) {
+ case "requestID":
+ return getRequestId();
+ case "entity":
+ return getEntity();
+ case "controllers":
+ return getControllers();
+ default:
+ return notFoundValue;
+ }
}
/**
diff --git a/policy-management/src/main/java/org/onap/policy/drools/server/restful/RestManager.java b/policy-management/src/main/java/org/onap/policy/drools/server/restful/RestManager.java
index ecc6c083..ec06882f 100644
--- a/policy-management/src/main/java/org/onap/policy/drools/server/restful/RestManager.java
+++ b/policy-management/src/main/java/org/onap/policy/drools/server/restful/RestManager.java
@@ -1722,11 +1722,12 @@ public class RestManager implements SwaggerApi, DefaultApi, FeaturesApi, InputsA
@Path("engine/tools/loggers")
public Response loggers() {
final List<String> names = new ArrayList<>();
- if (!(LoggerFactory.getILoggerFactory() instanceof LoggerContext context)) {
+ if (!(LoggerFactory.getILoggerFactory() instanceof LoggerContext)) {
logger.warn("The SLF4J logger factory is not configured for logback");
return Response.status(Status.INTERNAL_SERVER_ERROR).entity(names).build();
}
+ final LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory();
for (final Logger lgr : context.getLoggerList()) {
names.add(lgr.getName());
}
@@ -1744,11 +1745,12 @@ public class RestManager implements SwaggerApi, DefaultApi, FeaturesApi, InputsA
@Path("engine/tools/loggers/{logger}")
@Produces(MediaType.TEXT_PLAIN)
public Response loggerName1(@PathParam("logger") String loggerName) {
- if (!(LoggerFactory.getILoggerFactory() instanceof LoggerContext context)) {
+ if (!(LoggerFactory.getILoggerFactory() instanceof LoggerContext)) {
logger.warn("The SLF4J logger factory is not configured for logback");
return Response.status(Status.INTERNAL_SERVER_ERROR).build();
}
+ final LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory();
var lgr = context.getLogger(loggerName);
if (lgr == null) {
return Response.status(Status.NOT_FOUND).build();