diff options
Diffstat (limited to 'UniversalVesAdapter/src/main/java/org/onap/universalvesadapter/configs')
4 files changed, 195 insertions, 0 deletions
diff --git a/UniversalVesAdapter/src/main/java/org/onap/universalvesadapter/configs/Configuration.java b/UniversalVesAdapter/src/main/java/org/onap/universalvesadapter/configs/Configuration.java new file mode 100644 index 0000000..e47af70 --- /dev/null +++ b/UniversalVesAdapter/src/main/java/org/onap/universalvesadapter/configs/Configuration.java @@ -0,0 +1,24 @@ +/* +* ============LICENSE_START======================================================= +* ONAP : DCAE +* ================================================================================ +* Copyright 2018 TechMahindra +*================================================================================= +* 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.universalvesadapter.configs; + +public abstract class Configuration { + +} diff --git a/UniversalVesAdapter/src/main/java/org/onap/universalvesadapter/configs/DMaapMrUrlConfiguration.java b/UniversalVesAdapter/src/main/java/org/onap/universalvesadapter/configs/DMaapMrUrlConfiguration.java new file mode 100644 index 0000000..2b9a820 --- /dev/null +++ b/UniversalVesAdapter/src/main/java/org/onap/universalvesadapter/configs/DMaapMrUrlConfiguration.java @@ -0,0 +1,56 @@ +/* +* ============LICENSE_START======================================================= +* ONAP : DCAE +* ================================================================================ +* Copyright 2018 TechMahindra +*================================================================================= +* 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.universalvesadapter.configs; + +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Component; + +/** + * Configuration for Dmaap MR Service + * + * @author kmalbari + * + */ +@Component +public class DMaapMrUrlConfiguration extends Configuration { + + @Value("${dmaap.url}") + private String url; + + @Value("${dmaap.consumer_props}") + private String consumerProperties; + + @Value("${dmaap.publisher_props}") + private String publisherProperties; + + public String getPublisherProperties() { + return publisherProperties; + } + + public String getConsumerProperties() { + return consumerProperties; + } + + public String getUrl() { + return url; + } + + +} diff --git a/UniversalVesAdapter/src/main/java/org/onap/universalvesadapter/configs/DiskRepoConfiguration.java b/UniversalVesAdapter/src/main/java/org/onap/universalvesadapter/configs/DiskRepoConfiguration.java new file mode 100644 index 0000000..b1daf0d --- /dev/null +++ b/UniversalVesAdapter/src/main/java/org/onap/universalvesadapter/configs/DiskRepoConfiguration.java @@ -0,0 +1,42 @@ +/* +* ============LICENSE_START======================================================= +* ONAP : DCAE +* ================================================================================ +* Copyright 2018 TechMahindra +*================================================================================= +* 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.universalvesadapter.configs; + +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Component; + +/** + * + * Configuration for disk repository service + * + * @author kmalbari + * + */ +@Component +public class DiskRepoConfiguration extends Configuration { + + @Value("${fileService.url}") + private String fileRepositoryUrl; + + public String getFileRepositoryUrl() { + return fileRepositoryUrl; + } + +} diff --git a/UniversalVesAdapter/src/main/java/org/onap/universalvesadapter/configs/UniversalEventConfiguration.java b/UniversalVesAdapter/src/main/java/org/onap/universalvesadapter/configs/UniversalEventConfiguration.java new file mode 100644 index 0000000..3edca56 --- /dev/null +++ b/UniversalVesAdapter/src/main/java/org/onap/universalvesadapter/configs/UniversalEventConfiguration.java @@ -0,0 +1,73 @@ +/* +* ============LICENSE_START======================================================= +* ONAP : DCAE +* ================================================================================ +* Copyright 2018 TechMahindra +*================================================================================= +* 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.universalvesadapter.configs; + +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Component; + +/** + * Configuration for universal adapter service + * + * @author kmalbari + * + */ +@Component +public class UniversalEventConfiguration extends Configuration { + + private final Logger LOGGER = LoggerFactory.getLogger(this.getClass()); + + @Value("${snmpTrap.configFile}") + private String configFile; + + @Value("${universal.configFiles}") + private String configFiles; + + private Map<String, String> eventToConfigFileMap = new ConcurrentHashMap<>(); + + + /** + * Returns config file for a particular event from the mapping. + * If mapping is empty, populates its + * + * @param eventType + * + * @return config file name + */ + public String getConfigForEvent(String eventType){ + LOGGER.debug("Getting config file name for event:" + eventType); + if(null != configFiles && eventToConfigFileMap.isEmpty()){ + for(String entry : configFiles.split(",")){ + eventToConfigFileMap.put(entry.split(":")[0], entry.split(":")[1]); + } + LOGGER.debug("Populated mappings for event type to config files"); + } + + return (null == eventToConfigFileMap.get(eventType)) ? "default" : eventToConfigFileMap.get(eventType) ; + + } + + + //think about adding mapping files on runtime as well + +} |