summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xpom.xml2
-rw-r--r--sql-resource/provider/src/main/java/org/onap/ccsdk/sli/adaptors/resource/sql/SqlResource.java28
2 files changed, 28 insertions, 2 deletions
diff --git a/pom.xml b/pom.xml
index 341a801c..4df795a3 100755
--- a/pom.xml
+++ b/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.onap.ccsdk.parent</groupId>
<artifactId>odlparent-carbon-sr1</artifactId>
- <version>0.0.2-SNAPSHOT</version>
+ <version>0.1.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
diff --git a/sql-resource/provider/src/main/java/org/onap/ccsdk/sli/adaptors/resource/sql/SqlResource.java b/sql-resource/provider/src/main/java/org/onap/ccsdk/sli/adaptors/resource/sql/SqlResource.java
index 45e5ad2b..b2b77b57 100644
--- a/sql-resource/provider/src/main/java/org/onap/ccsdk/sli/adaptors/resource/sql/SqlResource.java
+++ b/sql-resource/provider/src/main/java/org/onap/ccsdk/sli/adaptors/resource/sql/SqlResource.java
@@ -21,6 +21,8 @@
package org.onap.ccsdk.sli.adaptors.resource.sql;
+import java.io.File;
+import java.io.FileInputStream;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
@@ -29,6 +31,7 @@ import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Map;
import java.util.Map.Entry;
+import java.util.Properties;
import javax.sql.rowset.CachedRowSet;
@@ -349,8 +352,31 @@ public class SqlResource implements SvcLogicResource, SvcLogicJavaPlugin {
// Must not be running in an OSGI container. See if you can load it
// as a
// a POJO then.
+
+ // If $SDNC_CONFIG_DIR/dblib.properties exists, that should
+ // be the properties passed to DBResourceManager constructor.
+ // If not, as default just use system properties.
+ Properties dblibProps = System.getProperties();
+ String cfgDir = System.getenv("SDNC_CONFIG_DIR");
+
+ if ((cfgDir == null) || (cfgDir.length() == 0)) {
+ cfgDir = "/opt/sdnc/data/properties";
+ }
+
+ File dblibPropFile = new File(cfgDir + "/dblib.properties");
+ if (dblibPropFile.exists()) {
+ try {
+ dblibProps = new Properties();
+ dblibProps.load(new FileInputStream(dblibPropFile));
+ } catch (Exception e) {
+ LOG.warn("Could not load properties file " + dblibPropFile.getAbsolutePath(), e);
+
+ dblibProps = System.getProperties();
+ }
+ }
+
try {
- dblibSvc = new DBResourceManager(System.getProperties());
+ dblibSvc = new DBResourceManager(dblibProps);
} catch (Exception e) {
LOG.error("Caught exception trying to create dblib service", e);
}