X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=sli%2Fcommon%2Fsrc%2Fmain%2Fjava%2Forg%2Fopenecomp%2Fsdnc%2Fsli%2FSvcLogicDblibStore.java;fp=sli%2Fcommon%2Fsrc%2Fmain%2Fjava%2Forg%2Fopenecomp%2Fsdnc%2Fsli%2FSvcLogicDblibStore.java;h=d494eaab272fe9ce7dbfc0b458c68a61a21801f6;hb=a5577ac18e488ed1870994b2d8f63ad01f38414d;hp=e3bd099908444c875dc03f9b312ea2fa515aeba6;hpb=18b2a034ab378b96cec231b76536018aa3d62968;p=sdnc%2Fcore.git diff --git a/sli/common/src/main/java/org/openecomp/sdnc/sli/SvcLogicDblibStore.java b/sli/common/src/main/java/org/openecomp/sdnc/sli/SvcLogicDblibStore.java old mode 100755 new mode 100644 index e3bd099..d494eaa --- a/sli/common/src/main/java/org/openecomp/sdnc/sli/SvcLogicDblibStore.java +++ b/sli/common/src/main/java/org/openecomp/sdnc/sli/SvcLogicDblibStore.java @@ -50,14 +50,14 @@ import org.slf4j.LoggerFactory; public class SvcLogicDblibStore implements SvcLogicStore { private static final String SDNC_CONFIG_DIR = "SDNC_CONFIG_DIR"; - + private static final Logger LOG = LoggerFactory .getLogger(SvcLogicDblibStore.class); private static final String DBLIB_SERVICE = // "org.openecomp.sdnc.sli.resource.dblib.DBLibService"; "org.openecomp.sdnc.sli.resource.dblib.DBResourceManager"; - + Properties props = null; public void init(Properties props) throws ConfigurationException { @@ -148,7 +148,7 @@ public class SvcLogicDblibStore implements SvcLogicStore { try { dbConn = ((DBResourceManager) dbSvc).getConnection(); PreparedStatement fetchGraphStmt; - + ArrayList args = new ArrayList(); args.add(module); args.add(rpc); @@ -159,7 +159,7 @@ public class SvcLogicDblibStore implements SvcLogicStore { } else { fetchGraphStmt = dbConn.prepareStatement(fetchVersionGraphSql); } - + fetchGraphStmt.setString(1, module); fetchGraphStmt.setString(2, rpc); fetchGraphStmt.setString(3, mode); @@ -168,7 +168,7 @@ public class SvcLogicDblibStore implements SvcLogicStore { } results = fetchGraphStmt.executeQuery(); - + if (results.next()) { Blob graphBlob = results.getBlob("graph"); @@ -442,12 +442,12 @@ public class SvcLogicDblibStore implements SvcLogicStore { DbLibService dblibSvc = null; ServiceReference sref = null; BundleContext bctx = null; - + Bundle bundle = FrameworkUtil.getBundle(SvcLogicDblibStore.class); - + if (bundle != null) { bctx = bundle.getBundleContext(); - + if (bctx != null) { sref = bctx.getServiceReference(DBLIB_SERVICE); } @@ -458,7 +458,7 @@ public class SvcLogicDblibStore implements SvcLogicStore { } else { dblibSvc = (DbLibService) bctx.getService(sref); if (dblibSvc == null) { - + LOG.warn("Could not find service reference for DBLIB service (" + DBLIB_SERVICE + ")"); } @@ -470,34 +470,34 @@ public class SvcLogicDblibStore implements SvcLogicStore { // Try to create a DbLibService object from dblib properties if(JavaSingleton.getInstance() == null){ Properties dblibProps = new Properties(); - + String propDir = System.getenv(SDNC_CONFIG_DIR); if (propDir == null) { - + propDir = "/opt/sdnc/data/properties"; } String propPath = propDir + "/dblib.properties"; - + File propFile = new File(propPath); - + if (!propFile.exists()) { - + LOG.warn( "Missing configuration properties file : " + propFile); return(null); } - + try { - + dblibProps.load(new FileInputStream(propFile)); } catch (Exception e) { LOG.warn( "Could not load properties file " + propPath, e); return(null); - + } - + try { dblibSvc = DBResourceManager.create(dblibProps); JavaSingleton.setInstance(dblibSvc); @@ -511,7 +511,7 @@ public class SvcLogicDblibStore implements SvcLogicStore { return (dblibSvc); } - + static class JavaSingleton { /* Private constructor */ private JavaSingleton() { @@ -525,7 +525,7 @@ public class SvcLogicDblibStore implements SvcLogicStore { public static DbLibService getInstance() { return INSTANCE; } - + public static void setInstance(DbLibService dbresource) { INSTANCE = dbresource; }