aboutsummaryrefslogtreecommitdiffstats
path: root/sql-resource/provider/src/main/java/org/openecomp/sdnc/sli/resource/sql/SqlResourceActivator.java
diff options
context:
space:
mode:
authorDan Timoney <dtimoney@att.com>2017-04-21 16:14:18 -0400
committerDan Timoney <dtimoney@att.com>2017-04-21 16:14:18 -0400
commit328d71305e529887d78bec5d028d54feaea737c1 (patch)
tree9c571511c9c7f402a84cac82cc41cee9f4e091cc /sql-resource/provider/src/main/java/org/openecomp/sdnc/sli/resource/sql/SqlResourceActivator.java
parentec0f99bdd24468c1f662d6fcf6e2ca29b678da73 (diff)
[SDNC-5] Rebase SDN-C adaptors
Apply latest bug fixes, enhancements and port to OpenDaylight Boron. Change-Id: Ia7d29986eb12f98edbf075dae3cc9343af6791b6 Signed-off-by: Dan Timoney <dtimoney@att.com>
Diffstat (limited to 'sql-resource/provider/src/main/java/org/openecomp/sdnc/sli/resource/sql/SqlResourceActivator.java')
-rw-r--r--sql-resource/provider/src/main/java/org/openecomp/sdnc/sli/resource/sql/SqlResourceActivator.java33
1 files changed, 31 insertions, 2 deletions
diff --git a/sql-resource/provider/src/main/java/org/openecomp/sdnc/sli/resource/sql/SqlResourceActivator.java b/sql-resource/provider/src/main/java/org/openecomp/sdnc/sli/resource/sql/SqlResourceActivator.java
index 31bca31..653e028 100644
--- a/sql-resource/provider/src/main/java/org/openecomp/sdnc/sli/resource/sql/SqlResourceActivator.java
+++ b/sql-resource/provider/src/main/java/org/openecomp/sdnc/sli/resource/sql/SqlResourceActivator.java
@@ -3,7 +3,7 @@
* openECOMP : SDN-C
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights
- * reserved.
+ * reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,6 +21,10 @@
package org.openecomp.sdnc.sli.resource.sql;
+import java.io.File;
+import java.io.FileInputStream;
+import java.util.Properties;
+
import org.openecomp.sdnc.sli.SvcLogicResource;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
@@ -30,7 +34,7 @@ import org.slf4j.LoggerFactory;
public class SqlResourceActivator implements BundleActivator {
- private static final String SVCLOGIC_PROP_PATH = "/svclogic.properties";
+ private static final String SQLRESOURCE_PROP_PATH = "/sql-resource.properties";
private ServiceRegistration registration = null;
@@ -40,7 +44,32 @@ public class SqlResourceActivator implements BundleActivator {
@Override
public void start(BundleContext ctx) throws Exception {
+ String cfgDir = System.getenv("SDNC_CONFIG_DIR");
+
+ if ((cfgDir == null) || (cfgDir.length() == 0)) {
+ cfgDir = "/opt/sdnc/data/properties";
+ LOG.warn("SDNC_CONFIG_DIR unset - defaulting to "+cfgDir);
+ }
+
+ String cryptKey = "";
+
+ File sqlResourcePropFile = new File(cfgDir+SQLRESOURCE_PROP_PATH);
+ Properties sqlResourceProps = new Properties();
+ if (sqlResourcePropFile.exists()) {
+ try {
+
+ sqlResourceProps.load(new FileInputStream(sqlResourcePropFile));
+
+ cryptKey = sqlResourceProps.getProperty("org.openecomp.sdnc.resource.sql.cryptkey");
+ } catch (Exception e) {
+ LOG.warn(
+ "Could not load properties file " + sqlResourcePropFile.getAbsolutePath(), e);
+ }
+ } else {
+ LOG.warn("Cannot read "+sqlResourcePropFile.getAbsolutePath()+" to find encryption key - using default");
+ }
+ SqlResource.setCryptKey(cryptKey);
// Advertise Sql resource adaptor
SvcLogicResource impl = new SqlResource();