1 /*******************************************************************************
2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 * ============LICENSE_END=========================================================
19 * ECOMP is a trademark and service mark of AT&T Intellectual Property.
21 *******************************************************************************/
22 package com.att.nsa.cambria.utils;
25 import java.net.MalformedURLException;
27 import java.util.HashMap;
30 import com.att.eelf.configuration.EELFLogger;
31 import com.att.eelf.configuration.EELFManager;
33 import com.att.nsa.cambria.constants.CambriaConstants;
34 import com.att.nsa.drumlin.till.nv.impl.nvPropertiesFile;
35 import com.att.nsa.drumlin.till.nv.impl.nvReadableStack;
36 import com.att.nsa.drumlin.till.nv.impl.nvReadableTable;
44 public class PropertyReader extends nvReadableStack {
50 //private static final Logger LOGGER = Logger.getLogger(PropertyReader.class);
51 private static final EELFLogger log = EELFManager.getInstance().getLogger(PropertyReader.class);
52 // private static final String MSGRTR_PROPERTIES_FILE = "msgRtrApi.properties";
55 * constructor initialization
57 * @throws loadException
60 public PropertyReader() throws loadException {
61 /* Map<String, String> argMap = new HashMap<String, String>();
62 final String config = getSetting(argMap, CambriaConstants.kConfig, MSGRTR_PROPERTIES_FILE);
63 final URL settingStream = findStream(config, ConfigurationReader.class);
64 push(new nvPropertiesFile(settingStream));
65 push(new nvReadableTable(argMap));*/
77 @SuppressWarnings("unused")
78 private static String getSetting(Map<String, String> argMap, final String key, final String defaultValue) {
79 String val = (String) argMap.get(key);
91 * @exception MalformedURLException
94 /*public static URL findStream(final String resourceName, Class<?> clazz) {
96 File file = new File(resourceName);
98 if (file.isAbsolute()) {
99 return file.toURI().toURL();
102 String filesRoot = System.getProperty("RRWT_FILES", null);
104 if (null != filesRoot) {
106 String fullPath = filesRoot + "/" + resourceName;
108 LOGGER.debug("Looking for [" + fullPath + "].");
110 file = new File(fullPath);
112 return file.toURI().toURL();
116 URL res = clazz.getClassLoader().getResource(resourceName);
122 res = ClassLoader.getSystemResource(resourceName);
127 } catch (MalformedURLException e) {
128 LOGGER.error("Unexpected failure to convert a local filename into a URL: " + e.getMessage(), e);