From ca2f61793ab1d971414c25c68f9007c7c9abfaac Mon Sep 17 00:00:00 2001 From: liamfallon Date: Mon, 4 Jan 2021 15:58:25 +0000 Subject: Changed identifiers to concept identifiers The policy models tosca classes ToscaPolicyIdentifier and ToscaPolicyIdentifierOptVersion can be used to identify any TOSCA concept, not just TOSCA policies so they are renamed to ToscaConceptIdentifier and ToscaCinceptIdentifierOptVersion respectively. The class ToscaPolicyTypeIdentifier is redundant and is replaced by ToscaConceptIdentifier. Issue-ID: POLICY-2900 Change-Id: I677cc1f8730001b300ab2041f2d57c2485cbc4ed Signed-off-by: liamfallon --- .../org/onap/policy/drools/system/PolicyController.java | 5 +++-- .../system/internal/AggregatedPolicyController.java | 17 +++++++++-------- 2 files changed, 12 insertions(+), 10 deletions(-) (limited to 'policy-management') diff --git a/policy-management/src/main/java/org/onap/policy/drools/system/PolicyController.java b/policy-management/src/main/java/org/onap/policy/drools/system/PolicyController.java index 82cd015e..7501aed5 100644 --- a/policy-management/src/main/java/org/onap/policy/drools/system/PolicyController.java +++ b/policy-management/src/main/java/org/onap/policy/drools/system/PolicyController.java @@ -3,6 +3,7 @@ * policy-management * ================================================================================ * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2021 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,7 +30,7 @@ import org.onap.policy.common.endpoints.event.comm.TopicSink; import org.onap.policy.common.endpoints.event.comm.TopicSource; import org.onap.policy.drools.controller.DroolsController; import org.onap.policy.drools.protocol.configuration.DroolsConfiguration; -import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyTypeIdentifier; +import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; /** * A Policy Controller is the higher level unit of control. It corresponds to the ncomp equivalent @@ -63,7 +64,7 @@ public interface PolicyController extends Startable, Lockable { /** * Get Policy Types supported by this controller. */ - List getPolicyTypes(); + List getPolicyTypes(); /** * Update maven configuration. diff --git a/policy-management/src/main/java/org/onap/policy/drools/system/internal/AggregatedPolicyController.java b/policy-management/src/main/java/org/onap/policy/drools/system/internal/AggregatedPolicyController.java index 3f744024..e14b1620 100644 --- a/policy-management/src/main/java/org/onap/policy/drools/system/internal/AggregatedPolicyController.java +++ b/policy-management/src/main/java/org/onap/policy/drools/system/internal/AggregatedPolicyController.java @@ -3,6 +3,7 @@ * ONAP * ================================================================================ * Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2021 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -46,7 +47,7 @@ import org.onap.policy.drools.properties.DroolsPropertyConstants; import org.onap.policy.drools.protocol.configuration.DroolsConfiguration; import org.onap.policy.drools.system.PolicyController; import org.onap.policy.drools.utils.PropertyUtil; -import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyTypeIdentifier; +import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -110,7 +111,7 @@ public class AggregatedPolicyController implements PolicyController, TopicListen /** * Policy Types. */ - private List policyTypes; + private List policyTypes; /** * Constructor version mainly used for bootstrapping at initialization time a policy engine @@ -147,7 +148,7 @@ public class AggregatedPolicyController implements PolicyController, TopicListen } @Override - public List getPolicyTypes() { + public List getPolicyTypes() { if (!policyTypes.isEmpty()) { return policyTypes; } @@ -156,13 +157,13 @@ public class AggregatedPolicyController implements PolicyController, TopicListen .get() .getBaseDomainNames() .stream() - .map(d -> new ToscaPolicyTypeIdentifier(d, + .map(d -> new ToscaConceptIdentifier(d, DroolsPropertyConstants.DEFAULT_CONTROLLER_POLICY_TYPE_VERSION)) .collect(Collectors.toList()); } - protected List getPolicyTypesFromProperties() { - List policyTypeIds = new ArrayList<>(); + protected List getPolicyTypesFromProperties() { + List policyTypeIds = new ArrayList<>(); String ptiPropValue = properties.getProperty(DroolsPropertyConstants.PROPERTY_CONTROLLER_POLICY_TYPES); if (ptiPropValue == null) { @@ -173,10 +174,10 @@ public class AggregatedPolicyController implements PolicyController, TopicListen for (String pti : ptiPropList) { String[] ptv = pti.split(":"); if (ptv.length == 1) { - policyTypeIds.add(new ToscaPolicyTypeIdentifier(ptv[0], + policyTypeIds.add(new ToscaConceptIdentifier(ptv[0], DroolsPropertyConstants.DEFAULT_CONTROLLER_POLICY_TYPE_VERSION)); } else if (ptv.length == 2) { - policyTypeIds.add(new ToscaPolicyTypeIdentifier(ptv[0], ptv[1])); + policyTypeIds.add(new ToscaConceptIdentifier(ptv[0], ptv[1])); } } -- cgit 1.2.3-korg