diff options
author | Smokowski, Kevin (ks6305) <kevin.smokowski@att.com> | 2019-10-30 14:07:38 +0000 |
---|---|---|
committer | Kevin Smokowski <kevin.smokowski@att.com> | 2019-10-30 14:27:19 +0000 |
commit | 17bbf8be295cb8e2cfc4faf466ada9c899089c63 (patch) | |
tree | ca078bf10a8a16ab04d938e7423c44663d6ae651 /sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicDblibStore.java | |
parent | 88b50b19b726cc13ced419902eff162791ac456d (diff) |
remove ODL/karaf from common
Don't let sli common use odl or karaf classes
Issue-ID: CCSDK-1723
Signed-off-by: Smokowski, Kevin (ks6305) <kevin.smokowski@att.com>
Change-Id: I740fa32b9c40a7efdf7ef9ce25b26cf43353c559
Diffstat (limited to 'sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicDblibStore.java')
-rw-r--r-- | sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicDblibStore.java | 125 |
1 files changed, 0 insertions, 125 deletions
diff --git a/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicDblibStore.java b/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicDblibStore.java index 94ffcd99..dc3a560e 100644 --- a/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicDblibStore.java +++ b/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicDblibStore.java @@ -23,8 +23,6 @@ package org.onap.ccsdk.sli.core.sli; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; -import java.io.File; -import java.io.FileInputStream; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.sql.Blob; @@ -35,52 +33,24 @@ import java.sql.SQLException; import java.util.ArrayList; import java.util.Properties; import javax.sql.rowset.CachedRowSet; -import org.onap.ccsdk.sli.core.dblib.DBResourceManager; import org.onap.ccsdk.sli.core.dblib.DbLibService; -import org.osgi.framework.Bundle; -import org.osgi.framework.BundleContext; -import org.osgi.framework.FrameworkUtil; -import org.osgi.framework.ServiceReference; import org.slf4j.Logger; 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.onap.ccsdk.sli.core.dblib.DbLibService"; - private DbLibService dbSvc; - public SvcLogicDblibStore() - { - // Does nothing, but needed so that argumentless constructor - // still works. - } - public SvcLogicDblibStore(DbLibService dbsvc) { this.dbSvc = dbsvc; } - public SvcLogicDblibStore(Properties props) { - try { - dbSvc = new DBResourceManager(props); - JavaSingleton.setInstance(dbSvc); - } catch (Exception e) { - LOG.warn("Caught exception trying to create DBResourceManager", e); - } - } - public Connection getConnection() throws SQLException { return(dbSvc.getConnection()); } @Override public void init(Properties props) throws ConfigurationException { - - dbSvc = getDbLibService(); if(dbSvc == null) { LOG.error("SvcLogic cannot acquire DBLIB_SERVICE"); return; @@ -334,101 +304,6 @@ public class SvcLogicDblibStore implements SvcLogicStore { } } - private DbLibService getDbLibService() { - - if (dbSvc != null) { - return dbSvc; - } - - // Get DbLibService interface object. - 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); - } - - if (sref == null) { - LOG.warn("Could not find service reference for DBLIB service ({})", DBLIB_SERVICE); - } else { - dbSvc = (DbLibService) bctx.getService(sref); - if (dbSvc == null) { - - LOG.warn("Could not find service reference for DBLIB service ({})", DBLIB_SERVICE); - } - } - } - - // initialize a stand-alone instance of dblib resource - else { - // 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 { - dbSvc = new DBResourceManager(dblibProps); - JavaSingleton.setInstance(dbSvc); - } catch (Exception e) { - LOG.warn("Caught exception trying to create DBResourceManager", e); - } - } else { - dbSvc = JavaSingleton.getInstance(); - } - } - return dbSvc; - } - - - static class JavaSingleton { - /* Private constructor */ - private JavaSingleton() { - /* the body of the constructor here */ - } - - /* instance of the singleton declaration */ - private static volatile DbLibService INSTANCE ; - - /* Access point to the unique instance of the singleton */ - public static DbLibService getInstance() { - return INSTANCE; - } - - public static void setInstance(DbLibService dbresource) { - INSTANCE = dbresource; - } - } - - @Override public void activate(String module, String rpc, String version, String mode) throws SvcLogicException { |