diff options
author | 2021-01-04 13:55:46 +0000 | |
---|---|---|
committer | 2021-01-04 16:26:58 +0000 | |
commit | f9455834e7e014fed6e941184ab80eb9fe91d89f (patch) | |
tree | 1770a8a258a2516530581d60e50f3841bfd74eaa /services/services-engine/src/main/java/org/onap | |
parent | e267120c204303088f3c15e580a5e1a364e014f5 (diff) |
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: I5df89d023949cdf0f649951dbbd81a0b30f44ef6
Signed-off-by: liamfallon <liam.fallon@est.tech>
Diffstat (limited to 'services/services-engine/src/main/java/org/onap')
2 files changed, 20 insertions, 20 deletions
diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/main/ApexActivator.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/main/ApexActivator.java index 4d3349b83..cadcc7ee8 100644 --- a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/main/ApexActivator.java +++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/main/ApexActivator.java @@ -1,7 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2019-2020 Nordix Foundation. + * Modifications Copyright (C) 2019-2021 Nordix Foundation. * Modifications Copyright (C) 2020 Bell Canada. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -50,7 +50,7 @@ import org.onap.policy.apex.service.parameters.engineservice.EngineServiceParame import org.onap.policy.apex.service.parameters.eventhandler.EventHandlerParameters; import org.onap.policy.apex.service.parameters.eventhandler.EventHandlerPeeredMode; import org.onap.policy.common.parameters.ParameterService; -import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyIdentifier; +import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; import org.slf4j.ext.XLogger; import org.slf4j.ext.XLoggerFactory; @@ -69,10 +69,10 @@ public class ApexActivator { // The parameters of the Apex activator when running with multiple policies @Getter @Setter - private Map<ToscaPolicyIdentifier, ApexParameters> apexParametersMap; + private Map<ToscaConceptIdentifier, ApexParameters> apexParametersMap; @Getter - Map<ToscaPolicyIdentifier, AxPolicyModel> policyModelsMap; + Map<ToscaConceptIdentifier, AxPolicyModel> policyModelsMap; // Event unmarshalers are used to receive events asynchronously into Apex private final Map<String, ApexEventUnmarshaller> unmarshallerMap = new LinkedHashMap<>(); @@ -95,7 +95,7 @@ public class ApexActivator { * * @param parametersMap the apex parameters map for the Apex service */ - public ApexActivator(Map<ToscaPolicyIdentifier, ApexParameters> parametersMap) { + public ApexActivator(Map<ToscaConceptIdentifier, ApexParameters> parametersMap) { apexParametersMap = parametersMap; } @@ -128,7 +128,7 @@ public class ApexActivator { policyModelsMap = new LinkedHashMap<>(); Map<String, EventHandlerParameters> inputParametersMap = new LinkedHashMap<>(); Map<String, EventHandlerParameters> outputParametersMap = new LinkedHashMap<>(); - Set<Entry<ToscaPolicyIdentifier, ApexParameters>> apexParamsEntrySet = new LinkedHashSet<>( + Set<Entry<ToscaConceptIdentifier, ApexParameters>> apexParamsEntrySet = new LinkedHashSet<>( apexParametersMap.entrySet()); apexParamsEntrySet.stream().forEach(apexParamsEntry -> { ApexParameters apexParams = apexParamsEntry.getValue(); @@ -175,12 +175,12 @@ public class ApexActivator { startUnmarshallers(inputParametersMap); } - private AxPolicyModel aggregatePolicyModels(Map<ToscaPolicyIdentifier, AxPolicyModel> policyModelsMap) { + private AxPolicyModel aggregatePolicyModels(Map<ToscaConceptIdentifier, AxPolicyModel> policyModelsMap) { // Doing a deep copy so that original values in policyModelsMap is retained // after reduction operation - Set<Entry<ToscaPolicyIdentifier, AxPolicyModel>> policyModelsEntries = policyModelsMap.entrySet().stream() + Set<Entry<ToscaConceptIdentifier, AxPolicyModel>> policyModelsEntries = policyModelsMap.entrySet().stream() .map(entry -> new AbstractMap.SimpleEntry<>(entry.getKey(), entry.getValue())).collect(Collectors.toSet()); - Optional<Entry<ToscaPolicyIdentifier, AxPolicyModel>> finalPolicyModelEntry = policyModelsEntries.stream() + Optional<Entry<ToscaConceptIdentifier, AxPolicyModel>> finalPolicyModelEntry = policyModelsEntries.stream() .reduce((entry1, entry2) -> { try { entry1.setValue( @@ -303,7 +303,7 @@ public class ApexActivator { * @param apexParamsMap the apex parameters map for the Apex service * @throws ApexException on errors */ - public void updateModel(Map<ToscaPolicyIdentifier, ApexParameters> apexParamsMap) throws ApexException { + public void updateModel(Map<ToscaConceptIdentifier, ApexParameters> apexParamsMap) throws ApexException { try { ApexParameters apexParameters = apexParamsMap.values().iterator().next(); setUpModelMarshallerAndUnmarshaller(apexParameters); diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/main/ApexMain.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/main/ApexMain.java index 459cdff24..5707c95ad 100644 --- a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/main/ApexMain.java +++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/main/ApexMain.java @@ -1,7 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * Modification Copyright (C) 2019-2020 Nordix Foundation. + * Modification Copyright (C) 2019-2021 Nordix Foundation. * Modifications Copyright (C) 2020 Bell Canada. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -43,7 +43,7 @@ import org.onap.policy.apex.service.parameters.ApexParameterHandler; import org.onap.policy.apex.service.parameters.ApexParameters; import org.onap.policy.apex.service.parameters.eventhandler.EventHandlerParameters; import org.onap.policy.common.parameters.ParameterService; -import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyIdentifier; +import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; import org.slf4j.ext.XLogger; import org.slf4j.ext.XLoggerFactory; @@ -62,7 +62,7 @@ public class ApexMain { // The parameters read in from JSON for each policy @Getter - private Map<ToscaPolicyIdentifier, ApexParameters> apexParametersMap; + private Map<ToscaConceptIdentifier, ApexParameters> apexParametersMap; //engineParameters are aggregated in case of multiple policies private EngineParameters aggregatedEngineParameters; @@ -83,7 +83,7 @@ public class ApexMain { apexParametersMap = new LinkedHashMap<>(); aggregatedEngineParameters = new EngineParameters(); try { - apexParametersMap.put(new ToscaPolicyIdentifier(), populateApexParameters(args)); + apexParametersMap.put(new ToscaConceptIdentifier(), populateApexParameters(args)); } catch (ApexException e) { LOGGER.error(APEX_SERVICE_FAILED_MSG, e); return; @@ -112,10 +112,10 @@ public class ApexMain { * @param policyArgumentsMap the map with command line arguments as value and policy-id as key * @throws ApexException on errors */ - public ApexMain(Map<ToscaPolicyIdentifier, String[]> policyArgumentsMap) throws ApexException { + public ApexMain(Map<ToscaConceptIdentifier, String[]> policyArgumentsMap) throws ApexException { apexParametersMap = new LinkedHashMap<>(); aggregatedEngineParameters = new EngineParameters(); - for (Entry<ToscaPolicyIdentifier, String[]> policyArgsEntry: policyArgumentsMap.entrySet()) { + for (Entry<ToscaConceptIdentifier, String[]> policyArgsEntry: policyArgumentsMap.entrySet()) { try { apexParametersMap.put(policyArgsEntry.getKey(), populateApexParameters(policyArgsEntry.getValue())); } catch (ApexException e) { @@ -157,14 +157,14 @@ public class ApexMain { * @param policyArgsMap the map with command line arguments as value and policy-id as key * @throws ApexException on errors */ - public void updateModel(Map<ToscaPolicyIdentifier, String[]> policyArgsMap) throws ApexException { + public void updateModel(Map<ToscaConceptIdentifier, String[]> policyArgsMap) throws ApexException { // flag that determines if any policy received in PDP_UPDATE is already deployed in the engine boolean isAnyPolicyDeployed = policyArgsMap.keySet().stream().anyMatch(apexParametersMap::containsKey); apexParametersMap.clear(); aggregatedEngineParameters = new EngineParameters(); AxContextAlbums albums = ModelService.getModel(AxContextAlbums.class); Map<AxArtifactKey, AxContextAlbum> albumsMap = new TreeMap<>(); - for (Entry<ToscaPolicyIdentifier, String[]> policyArgsEntry : policyArgsMap.entrySet()) { + for (Entry<ToscaConceptIdentifier, String[]> policyArgsEntry : policyArgsMap.entrySet()) { findAlbumsToHold(albumsMap, policyArgsEntry.getKey()); try { apexParametersMap.put(policyArgsEntry.getKey(), populateApexParameters(policyArgsEntry.getValue())); @@ -207,8 +207,8 @@ public class ApexMain { * @param albumsMap the albums which should be kept during model update * @param policyId the policy id of current policy */ - private void findAlbumsToHold(Map<AxArtifactKey, AxContextAlbum> albumsMap, ToscaPolicyIdentifier policyId) { - for (Entry<ToscaPolicyIdentifier, AxPolicyModel> policyModelsEntry : activator.getPolicyModelsMap() + private void findAlbumsToHold(Map<AxArtifactKey, AxContextAlbum> albumsMap, ToscaConceptIdentifier policyId) { + for (Entry<ToscaConceptIdentifier, AxPolicyModel> policyModelsEntry : activator.getPolicyModelsMap() .entrySet()) { // If a policy with the same major version is received in PDP_UPDATE, // context for that policy has to be retained. For this, take such policies' albums |