summaryrefslogtreecommitdiffstats
path: root/properties-node/provider/src
diff options
context:
space:
mode:
authorMarcus G K Williams <marcus.williams@intel.com>2017-08-23 11:47:08 -0700
committerMarcus Williams <marcus.williams@intel.com>2017-08-23 19:03:23 +0000
commit9042880234791fbe2e0ef033091ba93cb7f088f5 (patch)
tree3be335ecff8f5c8eae98c676fd93b902fb04dad7 /properties-node/provider/src
parent0c7f2223a42ae9f1a9ac8954e9b9194e929b72f6 (diff)
Conform ccsdk/sli/plugins to ONAP Style
Per ONAP Style Guide: 1. Convert tabs to 4 spaces. 2. Break lines to be less than 120 characters 3. Clean ecomp references 4. Remove extraneous spaces Issue-Id: CCSDK-1 Change-Id: I5638326170aa3ab26774b373ab573643840e97ab Signed-off-by: Marcus G K Williams <marcus.williams@intel.com>
Diffstat (limited to 'properties-node/provider/src')
-rw-r--r--properties-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/prop/PropertiesNode.java100
-rw-r--r--properties-node/provider/src/main/resources/META-INF/spring/properties-node-context.xml4
-rw-r--r--properties-node/provider/src/main/resources/META-INF/spring/properties-node-osgi-context.xml8
3 files changed, 56 insertions, 56 deletions
diff --git a/properties-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/prop/PropertiesNode.java b/properties-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/prop/PropertiesNode.java
index 165b706be..b4886d552 100644
--- a/properties-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/prop/PropertiesNode.java
+++ b/properties-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/prop/PropertiesNode.java
@@ -35,63 +35,63 @@ import org.slf4j.LoggerFactory;
public class PropertiesNode implements SvcLogicJavaPlugin {
- private static final Logger log = LoggerFactory.getLogger(PropertiesNode.class);
+ private static final Logger log = LoggerFactory.getLogger(PropertiesNode.class);
- public void readProperties(Map<String, String> paramMap, SvcLogicContext ctx) throws SvcLogicException {
- String fileName = parseParam(paramMap, "fileName", true, null);
- String contextPrefix = parseParam(paramMap, "contextPrefix", false, null);
+ public void readProperties(Map<String, String> paramMap, SvcLogicContext ctx) throws SvcLogicException {
+ String fileName = parseParam(paramMap, "fileName", true, null);
+ String contextPrefix = parseParam(paramMap, "contextPrefix", false, null);
- try {
- Properties pp = new Properties();
- InputStream in = new FileInputStream(fileName);
- pp.load(in);
- for (Object key : pp.keySet()) {
- String pfx = contextPrefix != null ? contextPrefix + '.' : "";
- String name = (String) key;
- String value = pp.getProperty(name);
- if (value != null && value.trim().length() > 0) {
- ctx.setAttribute(pfx + name, value.trim());
- log.info("+++ " + pfx + name + ": [" + value + "]");
- }
- }
- } catch (IOException e) {
- throw new SvcLogicException("Cannot read property file: " + fileName + ": " + e.getMessage(), e);
- }
- }
+ try {
+ Properties pp = new Properties();
+ InputStream in = new FileInputStream(fileName);
+ pp.load(in);
+ for (Object key : pp.keySet()) {
+ String pfx = contextPrefix != null ? contextPrefix + '.' : "";
+ String name = (String) key;
+ String value = pp.getProperty(name);
+ if (value != null && value.trim().length() > 0) {
+ ctx.setAttribute(pfx + name, value.trim());
+ log.info("+++ " + pfx + name + ": [" + value + "]");
+ }
+ }
+ } catch (IOException e) {
+ throw new SvcLogicException("Cannot read property file: " + fileName + ": " + e.getMessage(), e);
+ }
+ }
- private String parseParam(Map<String, String> paramMap, String name, boolean required, String def)
- throws SvcLogicException {
- String s = paramMap.get(name);
+ private String parseParam(Map<String, String> paramMap, String name, boolean required, String def)
+ throws SvcLogicException {
+ String s = paramMap.get(name);
- if (s == null || s.trim().length() == 0) {
- if (!required)
- return def;
- throw new SvcLogicException("Parameter " + name + " is required in PropertiesNode");
- }
+ if (s == null || s.trim().length() == 0) {
+ if (!required)
+ return def;
+ throw new SvcLogicException("Parameter " + name + " is required in PropertiesNode");
+ }
- s = s.trim();
- String value = "";
- int i = 0;
- int i1 = s.indexOf('%');
- while (i1 >= 0) {
- int i2 = s.indexOf('%', i1 + 1);
- if (i2 < 0)
- throw new SvcLogicException("Cannot parse parameter " + name + ": " + s + ": no matching %");
+ s = s.trim();
+ String value = "";
+ int i = 0;
+ int i1 = s.indexOf('%');
+ while (i1 >= 0) {
+ int i2 = s.indexOf('%', i1 + 1);
+ if (i2 < 0)
+ throw new SvcLogicException("Cannot parse parameter " + name + ": " + s + ": no matching %");
- String varName = s.substring(i1 + 1, i2);
- String varValue = System.getenv(varName);
- if (varValue == null)
- varValue = "";
+ String varName = s.substring(i1 + 1, i2);
+ String varValue = System.getenv(varName);
+ if (varValue == null)
+ varValue = "";
- value += s.substring(i, i1);
- value += varValue;
+ value += s.substring(i, i1);
+ value += varValue;
- i = i2 + 1;
- i1 = s.indexOf('%', i);
- }
- value += s.substring(i);
+ i = i2 + 1;
+ i1 = s.indexOf('%', i);
+ }
+ value += s.substring(i);
- log.info("Parameter " + name + ": " + value);
- return value;
- }
+ log.info("Parameter " + name + ": " + value);
+ return value;
+ }
}
diff --git a/properties-node/provider/src/main/resources/META-INF/spring/properties-node-context.xml b/properties-node/provider/src/main/resources/META-INF/spring/properties-node-context.xml
index fd7ace8a5..52d1cd96a 100644
--- a/properties-node/provider/src/main/resources/META-INF/spring/properties-node-context.xml
+++ b/properties-node/provider/src/main/resources/META-INF/spring/properties-node-context.xml
@@ -26,7 +26,7 @@
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd">
- <bean id="propertiesNode" class="org.onap.ccsdk.sli.plugins.prop.PropertiesNode">
- </bean>
+ <bean id="propertiesNode" class="org.onap.ccsdk.sli.plugins.prop.PropertiesNode">
+ </bean>
</beans>
diff --git a/properties-node/provider/src/main/resources/META-INF/spring/properties-node-osgi-context.xml b/properties-node/provider/src/main/resources/META-INF/spring/properties-node-osgi-context.xml
index 19275fc9d..a46e37c7b 100644
--- a/properties-node/provider/src/main/resources/META-INF/spring/properties-node-osgi-context.xml
+++ b/properties-node/provider/src/main/resources/META-INF/spring/properties-node-osgi-context.xml
@@ -21,12 +21,12 @@
-->
<beans:beans xmlns="http://www.springframework.org/schema/osgi"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:beans="http://www.springframework.org/schema/beans"
- xsi:schemaLocation="http://www.springframework.org/schema/osgi
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:beans="http://www.springframework.org/schema/beans"
+ xsi:schemaLocation="http://www.springframework.org/schema/osgi
http://www.springframework.org/schema/osgi/spring-osgi.xsd
- http://www.springframework.org/schema/beans
+ http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd">
- <service ref="propertiesNode" interface="org.onap.ccsdk.sli.plugins.prop.PropertiesNode" />
+ <service ref="propertiesNode" interface="org.onap.ccsdk.sli.plugins.prop.PropertiesNode" />
</beans:beans>