diff options
author | 2018-04-11 05:53:09 +0000 | |
---|---|---|
committer | 2018-04-11 06:53:27 +0000 | |
commit | 8fa3be2ee8c65fe5ae6d97d21da93359ebcc96ef (patch) | |
tree | eeef9e014e073f69fcefbe86f5ab8b77a1703539 /bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso | |
parent | 62e75a057279e38401bb150a74dad572f3bcb2d6 (diff) |
Implement read resource sequence
Implement resource sequence by reading configuration.
Change-Id: I239a239e1fdcbab273d00dc99c1d856699b203a5
Issue-ID: SO-422
Signed-off-by: subhash kumar singh <subhash.kumar.singh@huawei.com>
Diffstat (limited to 'bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso')
2 files changed, 91 insertions, 0 deletions
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/properties/BPMNProperties.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/properties/BPMNProperties.java new file mode 100644 index 0000000000..70572dc94a --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/properties/BPMNProperties.java @@ -0,0 +1,61 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 Huawei 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.openecomp.mso.bpmn.infrastructure.properties; + +import org.openecomp.mso.logger.MessageEnum; +import org.openecomp.mso.logger.MsoLogger; +import org.openecomp.mso.properties.MsoPropertiesException; +import org.openecomp.mso.properties.MsoPropertiesFactory; + +import java.util.Arrays; +import java.util.List; + +public class BPMNProperties { + + public static String MSO_PROP_BPMN = "MSO_PROP_BPMN"; + + private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA); + + public static String getProperty(String key, String defaultValue) { + String value; + try { + value = new MsoPropertiesFactory().getMsoJavaProperties(MSO_PROP_BPMN).getProperty(key, defaultValue); + } catch (MsoPropertiesException e) { + msoLogger.error (MessageEnum.NO_PROPERTIES, "Unknown. Mso Properties ID not found in cache: " + + MSO_PROP_BPMN, "BPMN", "", MsoLogger.ErrorCode.DataError, + "Exception - Mso Properties ID not found in cache", e); + return null; + } + msoLogger.debug("Config read for " + MSO_PROP_BPMN + " - key:" + key + " value:" + value); + return value; + } + + public static List<String> getResourceSequenceProp() { + String resource_sequence = getProperty("resource_sequence", null); + if (resource_sequence != null) { + String[] resourceSequence = resource_sequence.split(","); + return Arrays.asList(resource_sequence); + } + return Arrays.asList(ResourceSequence.RESOURCE_EPC, + ResourceSequence.RESOURCE_IMS, + ResourceSequence.RESOUCE_OVERLAY, + ResourceSequence.RESOURCE_UNDERLAY); + } +} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/properties/ResourceSequence.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/properties/ResourceSequence.java new file mode 100644 index 0000000000..86e5d30b11 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/properties/ResourceSequence.java @@ -0,0 +1,30 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 Huawei 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.openecomp.mso.bpmn.infrastructure.properties; + +public final class ResourceSequence { + + public static final String RESOURCE_IMS = "ims"; + public static final String RESOURCE_EPC = "epc"; + public static final String RESOUCE_OVERLAY = "overlay"; + public static final String RESOURCE_UNDERLAY = "underlay"; + + private ResourceSequence() {} +}
\ No newline at end of file |