From: Seshu Kumar M Date: Wed, 11 Apr 2018 09:21:04 +0000 (+0000) Subject: Merge "Implement read resource sequence" X-Git-Tag: v1.2.1~182 X-Git-Url: https://gerrit.onap.org/r/gitweb?a=commitdiff_plain;h=c5bbee35bf664d166a8244448fe8f3f3e82ff2a0;hp=5d9dbc633eac0d38915e02ff935aa3aebd255cf5;p=so.git Merge "Implement read resource sequence" --- 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 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