diff options
author | adheli.tavares <adheli.tavares@est.tech> | 2024-01-26 15:28:56 +0000 |
---|---|---|
committer | Adheli Tavares <adheli.tavares@est.tech> | 2024-02-09 10:31:15 +0000 |
commit | cc1d3d352771d1fa35d297e90663539e34b022f6 (patch) | |
tree | b1b00d678b0157742b91be1262fbf614a62063b1 /policy-management/src/main/java/org/onap | |
parent | cce79248655f484e007769ba81b092148f940d27 (diff) |
Removing deprecated DMAAP library
Issue-ID: POLICY-4402
Change-Id: I4ce5b303cb3a775010683d3c7102b0bd065280ea
Signed-off-by: adheli.tavares <adheli.tavares@est.tech>
Diffstat (limited to 'policy-management/src/main/java/org/onap')
7 files changed, 49 insertions, 139 deletions
diff --git a/policy-management/src/main/java/org/onap/policy/drools/controller/IndexedDroolsControllerFactory.java b/policy-management/src/main/java/org/onap/policy/drools/controller/IndexedDroolsControllerFactory.java index 0c732246..1965e22f 100644 --- a/policy-management/src/main/java/org/onap/policy/drools/controller/IndexedDroolsControllerFactory.java +++ b/policy-management/src/main/java/org/onap/policy/drools/controller/IndexedDroolsControllerFactory.java @@ -3,7 +3,7 @@ * ONAP * ================================================================================ * Copyright (C) 2019-2021 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2023 Nordix Foundation. + * Modifications Copyright (C) 2023-2024 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -60,6 +60,11 @@ class IndexedDroolsControllerFactory implements DroolsControllerFactory { protected Map<String, DroolsController> droolsControllers = new HashMap<>(); /** + * Null Drools Controller. + */ + protected NullDroolsController nullDroolsController = new NullDroolsController(); + + /** * Constructs the object. */ public IndexedDroolsControllerFactory() { @@ -259,12 +264,6 @@ class IndexedDroolsControllerFactory implements DroolsControllerFactory { } else { return PolicyEndPointProperties.PROPERTY_UEB_SINK_TOPICS + "."; } - } else if (commInfra == CommInfrastructure.DMAAP) { - if (isSource) { - return PolicyEndPointProperties.PROPERTY_DMAAP_SOURCE_TOPICS + "."; - } else { - return PolicyEndPointProperties.PROPERTY_DMAAP_SINK_TOPICS + "."; - } } else if (commInfra == CommInfrastructure.NOOP) { if (isSource) { return PolicyEndPointProperties.PROPERTY_NOOP_SOURCE_TOPICS + "."; diff --git a/policy-management/src/main/java/org/onap/policy/drools/controller/internal/MavenDroolsController.java b/policy-management/src/main/java/org/onap/policy/drools/controller/internal/MavenDroolsController.java index e93adec5..68a69159 100644 --- a/policy-management/src/main/java/org/onap/policy/drools/controller/internal/MavenDroolsController.java +++ b/policy-management/src/main/java/org/onap/policy/drools/controller/internal/MavenDroolsController.java @@ -119,8 +119,6 @@ public class MavenDroolsController implements DroolsController { /** * original Drools Model/Rules classloader hash. - * -- GETTER -- - * Get model class loader hash. */ @Getter protected int modelClassLoaderHash; @@ -208,7 +206,7 @@ public class MavenDroolsController implements DroolsController { logger.warn("{} UPGRADE results: {}", this, messages); /* - * If all sucessful (can load new container), now we can remove all coders from previous sessions + * If all successful (can load new container), now we can remove all coders from previous sessions */ this.removeCoders(); @@ -533,7 +531,7 @@ public class MavenDroolsController implements DroolsController { this.recentSourceEvents.add(event); } - PdpJmx.getInstance().updateOccured(); + PdpJmx.getInstance().updateOccurred(); // Broadcast 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 f3a422e7..76836ba2 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 @@ -3,6 +3,7 @@ * policy-management * ================================================================================ * Copyright (C) 2017-2021 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2024 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -56,7 +57,8 @@ public class PdpdConfiguration { @GsonJsonProperty("controllers") private List<ControllerConfiguration> controllers = new ArrayList<>(); - @GsonJsonIgnore private Map<String, Object> additionalProperties = new HashMap<>(); + @GsonJsonIgnore + private final Map<String, Object> additionalProperties = new HashMap<>(); /** * Constructor. @@ -163,32 +165,30 @@ public class PdpdConfiguration { } protected boolean declaredProperty(String name, Object value) { - switch (name) { - case "requestID": + return switch (name) { + case "requestID" -> { callSetRequestId(value); - return true; - case "entity": + yield true; + } + case "entity" -> { callSetEntity(value); - return true; - case "controllers": + yield true; + } + case "controllers" -> { callSetControllers(value); - return true; - default: - return false; - } + yield true; + } + default -> false; + }; } protected Object declaredPropertyOrNotFound(String name, Object notFoundValue) { - switch (name) { - case "requestID": - return getRequestId(); - case "entity": - return getEntity(); - case "controllers": - return getControllers(); - default: - return notFoundValue; - } + return switch (name) { + case "requestID" -> getRequestId(); + case "entity" -> getEntity(); + case "controllers" -> getControllers(); + default -> notFoundValue; + }; } /** @@ -273,7 +273,7 @@ public class PdpdConfiguration { "property \"controllers\" is of type " + "\"java.util.List<org.onap.policy.drools.protocol.configuration.Controller>\", " + "but got " - + value.getClass().toString()); + + value.getClass()); } } } 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 ad23ff3a..ecc6c083 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 @@ -3,7 +3,7 @@ * ONAP * ================================================================================ * Copyright (C) 2017-2021 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2021,2023 Nordix Foundation. + * Modifications Copyright (C) 2021, 2023-2024 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -1392,7 +1392,7 @@ public class RestManager implements SwaggerApi, DefaultApi, FeaturesApi, InputsA */ @Override @GET - @Path("engine/topics/sources/{comm: ueb|dmaap|noop}") + @Path("engine/topics/sources/{comm: ueb|kafka|noop}") public Response commSources( @PathParam("comm") String comm) { if (!checkValidNameInput(comm)) { @@ -1408,9 +1408,6 @@ public class RestManager implements SwaggerApi, DefaultApi, FeaturesApi, InputsA case UEB: sources.addAll(TopicEndpointManager.getManager().getUebTopicSources()); break; - case DMAAP: - sources.addAll(TopicEndpointManager.getManager().getDmaapTopicSources()); - break; case NOOP: sources.addAll(TopicEndpointManager.getManager().getNoopTopicSources()); break; @@ -1430,7 +1427,7 @@ public class RestManager implements SwaggerApi, DefaultApi, FeaturesApi, InputsA */ @Override @GET - @Path("engine/topics/sinks/{comm: ueb|dmaap|noop}") + @Path("engine/topics/sinks/{comm: ueb|kafka|noop}") public Response commSinks( @PathParam("comm") String comm) { if (!checkValidNameInput(comm)) { @@ -1446,9 +1443,6 @@ public class RestManager implements SwaggerApi, DefaultApi, FeaturesApi, InputsA case UEB: sinks.addAll(TopicEndpointManager.getManager().getUebTopicSinks()); break; - case DMAAP: - sinks.addAll(TopicEndpointManager.getManager().getDmaapTopicSinks()); - break; case NOOP: sinks.addAll(TopicEndpointManager.getManager().getNoopTopicSinks()); break; @@ -1468,7 +1462,7 @@ public class RestManager implements SwaggerApi, DefaultApi, FeaturesApi, InputsA */ @Override @GET - @Path("engine/topics/sources/{comm: ueb|dmaap|noop}/{topic}") + @Path("engine/topics/sources/{comm: ueb|kafka|noop}/{topic}") public Response sourceTopic( @PathParam("comm") String comm, @PathParam("topic") String topic) { @@ -1484,7 +1478,7 @@ public class RestManager implements SwaggerApi, DefaultApi, FeaturesApi, InputsA */ @Override @GET - @Path("engine/topics/sinks/{comm: ueb|dmaap|noop}/{topic}") + @Path("engine/topics/sinks/{comm: ueb|kafka|noop}/{topic}") public Response sinkTopic( @PathParam("comm") String comm, @PathParam("topic") String topic) { @@ -1500,7 +1494,7 @@ public class RestManager implements SwaggerApi, DefaultApi, FeaturesApi, InputsA */ @Override @GET - @Path("engine/topics/sources/{comm: ueb|dmaap|noop}/{topic}/events") + @Path("engine/topics/sources/{comm: ueb|kafka|noop}/{topic}/events") public Response sourceEvents( @PathParam("comm") String comm, @PathParam("topic") String topic) { @@ -1516,7 +1510,7 @@ public class RestManager implements SwaggerApi, DefaultApi, FeaturesApi, InputsA */ @Override @GET - @Path("engine/topics/sinks/{comm: ueb|dmaap|noop}/{topic}/events") + @Path("engine/topics/sinks/{comm: ueb|kafka|noop}/{topic}/events") public Response sinkEvents( @PathParam("comm") String comm, @PathParam("topic") String topic) { @@ -1532,7 +1526,7 @@ public class RestManager implements SwaggerApi, DefaultApi, FeaturesApi, InputsA */ @Override @GET - @Path("engine/topics/sources/{comm: ueb|dmaap|noop}/{topic}/switches") + @Path("engine/topics/sources/{comm: ueb|kafka|noop}/{topic}/switches") public Response commSourceTopicSwitches( @PathParam("comm") String comm, @PathParam("topic") String topic) { @@ -1544,7 +1538,7 @@ public class RestManager implements SwaggerApi, DefaultApi, FeaturesApi, InputsA */ @Override @GET - @Path("engine/topics/sinks/{comm: ueb|dmaap|noop}/{topic}/switches") + @Path("engine/topics/sinks/{comm: ueb|kafka|noop}/{topic}/switches") public Response commSinkTopicSwitches( @PathParam("comm") String comm, @PathParam("topic") String topic) { @@ -1556,7 +1550,7 @@ public class RestManager implements SwaggerApi, DefaultApi, FeaturesApi, InputsA */ @Override @PUT - @Path("engine/topics/sources/{comm: ueb|dmaap|noop}/{topic}/switches/lock") + @Path("engine/topics/sources/{comm: ueb|kafka|noop}/{topic}/switches/lock") public Response commSourceTopicLock( @PathParam("comm") String comm, @PathParam("topic") String topic) { @@ -1570,7 +1564,7 @@ public class RestManager implements SwaggerApi, DefaultApi, FeaturesApi, InputsA */ @Override @DELETE - @Path("engine/topics/sources/{comm: ueb|dmaap|noop}/{topic}/switches/lock") + @Path("engine/topics/sources/{comm: ueb|kafka|noop}/{topic}/switches/lock") public Response commSourceTopicUnlock( @PathParam("comm") String comm, @PathParam("topic") String topic) { @@ -1584,7 +1578,7 @@ public class RestManager implements SwaggerApi, DefaultApi, FeaturesApi, InputsA */ @Override @PUT - @Path("engine/topics/sources/{comm: ueb|dmaap|noop}/{topic}/switches/activation") + @Path("engine/topics/sources/{comm: ueb|kafka|noop}/{topic}/switches/activation") public Response commSourceTopicActivation( @PathParam("comm") String comm, @PathParam("topic") String topic) { @@ -1598,7 +1592,7 @@ public class RestManager implements SwaggerApi, DefaultApi, FeaturesApi, InputsA */ @Override @DELETE - @Path("engine/topics/sources/{comm: ueb|dmaap|noop}/{topic}/switches/activation") + @Path("engine/topics/sources/{comm: ueb|kafka|noop}/{topic}/switches/activation") public Response commSourceTopicDeactivation( @PathParam("comm") String comm, @PathParam("topic") String topic) { @@ -1612,7 +1606,7 @@ public class RestManager implements SwaggerApi, DefaultApi, FeaturesApi, InputsA */ @Override @PUT - @Path("engine/topics/sinks/{comm: ueb|dmaap|noop}/{topic}/switches/lock") + @Path("engine/topics/sinks/{comm: ueb|kafka|noop}/{topic}/switches/lock") public Response commSinkTopicLock( @PathParam("comm") String comm, @PathParam("topic") String topic) { @@ -1626,7 +1620,7 @@ public class RestManager implements SwaggerApi, DefaultApi, FeaturesApi, InputsA */ @Override @DELETE - @Path("engine/topics/sinks/{comm: ueb|dmaap|noop}/{topic}/switches/lock") + @Path("engine/topics/sinks/{comm: ueb|kafka|noop}/{topic}/switches/lock") public Response commSinkTopicUnlock( @PathParam("comm") String comm, @PathParam("topic") String topic) { @@ -1640,7 +1634,7 @@ public class RestManager implements SwaggerApi, DefaultApi, FeaturesApi, InputsA */ @Override @PUT - @Path("engine/topics/sinks/{comm: ueb|dmaap|noop}/{topic}/switches/activation") + @Path("engine/topics/sinks/{comm: ueb|kafka|noop}/{topic}/switches/activation") public Response commSinkTopicActivation( @PathParam("comm") String comm, @PathParam("topic") String topic) { @@ -1654,7 +1648,7 @@ public class RestManager implements SwaggerApi, DefaultApi, FeaturesApi, InputsA */ @Override @DELETE - @Path("engine/topics/sinks/{comm: ueb|dmaap|noop}/{topic}/switches/activation") + @Path("engine/topics/sinks/{comm: ueb|kafka|noop}/{topic}/switches/activation") public Response commSinkTopicDeactivation( @PathParam("comm") String comm, @PathParam("topic") String topic) { @@ -1682,7 +1676,7 @@ public class RestManager implements SwaggerApi, DefaultApi, FeaturesApi, InputsA */ @Override @PUT - @Path("engine/topics/sources/{comm: ueb|dmaap|noop}/{topic}/events") + @Path("engine/topics/sources/{comm: ueb|kafka|noop}/{topic}/events") @Consumes(MediaType.TEXT_PLAIN) public Response commEventOffer( @PathParam("comm") String comm, diff --git a/policy-management/src/main/java/org/onap/policy/drools/server/restful/aaf/AafBase.java b/policy-management/src/main/java/org/onap/policy/drools/server/restful/aaf/AafBase.java deleted file mode 100644 index 67725955..00000000 --- a/policy-management/src/main/java/org/onap/policy/drools/server/restful/aaf/AafBase.java +++ /dev/null @@ -1,35 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - * ================================================================================ - * Copyright (C) 2018-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. - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.drools.server.restful.aaf; - -import org.onap.policy.common.endpoints.http.server.aaf.AafAuthFilter; -import org.onap.policy.drools.system.PolicyEngineConstants; - -/** - * AAF Base Class. - */ -public abstract class AafBase extends AafAuthFilter { - public static final String AAF_NODETYPE = "pdpd"; - public static final String AAF_ROOT_PERMISSION_PROPERTY = "aaf.root.permission"; - public static final String AAF_ROOT_PERMISSION = - PolicyEngineConstants.getManager().getProperties().getProperty( - AAF_ROOT_PERMISSION_PROPERTY, DEFAULT_NAMESPACE + "." + AAF_NODETYPE); -} diff --git a/policy-management/src/main/java/org/onap/policy/drools/server/restful/aaf/AafTelemetryAuthFilter.java b/policy-management/src/main/java/org/onap/policy/drools/server/restful/aaf/AafTelemetryAuthFilter.java deleted file mode 100644 index 1f7ef8c3..00000000 --- a/policy-management/src/main/java/org/onap/policy/drools/server/restful/aaf/AafTelemetryAuthFilter.java +++ /dev/null @@ -1,41 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - * ================================================================================ - * Copyright (C) 2018 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. - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.drools.server.restful.aaf; - -import jakarta.servlet.http.HttpServletRequest; -import org.onap.policy.common.utils.network.NetworkUtil; - -/** - * AAF Telemetry Authorization. - */ -public class AafTelemetryAuthFilter extends AafBase { - private static final String RESOURCE_TYPE = AAF_ROOT_PERMISSION + "." + "telemetry"; - - @Override - protected String getPermissionType(HttpServletRequest request) { - return RESOURCE_TYPE; - } - - @Override - protected String getPermissionInstance(HttpServletRequest request) { - return NetworkUtil.getHostname(); - } -} diff --git a/policy-management/src/main/java/org/onap/policy/drools/system/PolicyEngineManager.java b/policy-management/src/main/java/org/onap/policy/drools/system/PolicyEngineManager.java index 43ab5e47..0bc2318b 100644 --- a/policy-management/src/main/java/org/onap/policy/drools/system/PolicyEngineManager.java +++ b/policy-management/src/main/java/org/onap/policy/drools/system/PolicyEngineManager.java @@ -3,6 +3,7 @@ * ONAP * ================================================================================ * Copyright (C) 2019-2022 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2024 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -85,7 +86,6 @@ import org.onap.policy.drools.protocol.coders.EventProtocolCoderConstants; import org.onap.policy.drools.protocol.configuration.ControllerConfiguration; import org.onap.policy.drools.protocol.configuration.PdpdConfiguration; import org.onap.policy.drools.server.restful.RestManager; -import org.onap.policy.drools.server.restful.aaf.AafTelemetryAuthFilter; import org.onap.policy.drools.stats.PolicyStatsManager; import org.onap.policy.drools.system.internal.SimpleLockManager; import org.onap.policy.drools.utils.PropertyUtil; @@ -408,11 +408,6 @@ class PolicyEngineManager implements PolicyEngine { try { this.httpServers = getServletFactory().build(properties); - for (HttpServletServer server : this.httpServers) { - if (server.isAaf()) { - server.addFilterClass(null, AafTelemetryAuthFilter.class.getName()); - } - } } catch (final IllegalArgumentException e) { logger.error("{}: add-http-servers failed", this, e); } |