summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSmokowski, Kevin (ks6305) <kevin.smokowski@att.com>2019-10-30 14:07:38 +0000
committerKevin Smokowski <kevin.smokowski@att.com>2019-10-30 14:27:19 +0000
commit17bbf8be295cb8e2cfc4faf466ada9c899089c63 (patch)
treeca078bf10a8a16ab04d938e7423c44663d6ae651
parent88b50b19b726cc13ced419902eff162791ac456d (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
-rwxr-xr-xsli/common/pom.xml40
-rw-r--r--sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/MessageWriter.java21
-rw-r--r--sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicContext.java14
-rw-r--r--sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicDblibStore.java125
-rw-r--r--sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicExpressionFactory.java23
-rw-r--r--sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicStoreFactory.java4
-rw-r--r--sli/common/src/test/java/org/onap/ccsdk/sli/core/sli/ITCaseSvcLogicParser.java5
-rwxr-xr-xsli/provider/pom.xml9
-rw-r--r--sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/PrintYangToProp.java (renamed from sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/PrintYangToProp.java)2
-rwxr-xr-xsli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/SvcLogicServiceImpl.java15
-rw-r--r--sli/provider/src/test/java/org/onap/ccsdk/sli/core/sli/provider/PrintYangToPropTest.java (renamed from sli/common/src/test/java/org/onap/ccsdk/sli/core/sli/PrintYangToPropTest.java)3
-rwxr-xr-xsli/recording/pom.xml32
12 files changed, 27 insertions, 266 deletions
diff --git a/sli/common/pom.xml b/sli/common/pom.xml
index 7b4adb8b..2166760d 100755
--- a/sli/common/pom.xml
+++ b/sli/common/pom.xml
@@ -39,25 +39,9 @@
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-simple</artifactId>
- <scope>compile</scope>
- </dependency>
- <dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
- <dependency>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi.core</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.mariadb.jdbc</groupId>
- <artifactId>mariadb-java-client</artifactId>
- <type>jar</type>
- <scope>compile</scope>
- </dependency>
<dependency>
<groupId>org.onap.ccsdk.sli.core</groupId>
<artifactId>dblib-provider</artifactId>
@@ -70,32 +54,16 @@
<scope>test</scope>
</dependency>
<dependency>
- <groupId>org.opendaylight.mdsal.binding.model.ietf</groupId>
- <artifactId>rfc6991</artifactId>
- </dependency>
- <dependency>
- <groupId>org.onap.logging-analytics</groupId>
- <artifactId>logging-slf4j</artifactId>
- <version>1.5.0</version>
- </dependency>
-
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>sal-core-api</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>sal-binding-api</artifactId>
- </dependency>
-
+ <groupId>org.onap.logging-analytics</groupId>
+ <artifactId>logging-slf4j</artifactId>
+ <version>1.5.0</version>
+ </dependency>
<!-- Testing Dependencies -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
-
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
diff --git a/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/MessageWriter.java b/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/MessageWriter.java
index 0e39896e..5ededb9e 100644
--- a/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/MessageWriter.java
+++ b/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/MessageWriter.java
@@ -28,13 +28,8 @@ import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.Properties;
-
import javax.sql.rowset.CachedRowSet;
-
import org.onap.ccsdk.sli.core.dblib.DbLibService;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.FrameworkUtil;
-import org.osgi.framework.ServiceReference;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -96,22 +91,6 @@ public class MessageWriter {
LOG.info(INCOMING_PROPERTY_NAME + ": " + incomingEnabled);
LOG.info(OUTGOING_PROPERTY_NAME + ": " + outgoingEnabled);
-
- if (dbLibService != null)
- return;
-
- BundleContext bctx = FrameworkUtil.getBundle(MessageWriter.class).getBundleContext();
-
- ServiceReference sref = bctx.getServiceReference(DBLIB_SERVICE);
-
- if (sref == null) {
- LOG.warn("Could not find service reference for DBLIB service (" + DBLIB_SERVICE + ")");
- } else {
- dbLibService = (DbLibService) bctx.getService(sref);
- if (dbLibService == null) {
- LOG.warn("Could not find service reference for DBLIB service (" + DBLIB_SERVICE + ")");
- }
- }
}
public static void saveOutgoingRequest(
diff --git a/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicContext.java b/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicContext.java
index aca904d1..b592c15f 100644
--- a/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicContext.java
+++ b/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicContext.java
@@ -25,8 +25,6 @@ import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
import java.util.Set;
-
-import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.w3c.dom.Document;
@@ -42,8 +40,6 @@ public class SvcLogicContext {
private HashMap<String, String> attributes;
- private DOMDataBroker domDataBroker;
-
private String status = "success";
public SvcLogicContext()
@@ -68,16 +64,6 @@ public class SvcLogicContext {
}
}
-
-
- public DOMDataBroker getDomDataBroker() {
- return domDataBroker;
- }
-
- public void setDomDataBroker(DOMDataBroker domDataBroker) {
- this.domDataBroker = domDataBroker;
- }
-
public String getAttribute(String name)
{
if (attributes.containsKey(name))
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 {
diff --git a/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicExpressionFactory.java b/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicExpressionFactory.java
index 9e9bfe0d..727c84b1 100644
--- a/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicExpressionFactory.java
+++ b/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicExpressionFactory.java
@@ -24,7 +24,6 @@ package org.onap.ccsdk.sli.core.sli;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
-
import org.antlr.v4.runtime.ANTLRInputStream;
import org.antlr.v4.runtime.CharStream;
import org.antlr.v4.runtime.CommonTokenStream;
@@ -72,27 +71,5 @@ public class SvcLogicExpressionFactory {
return(listener.getParsedExpr());
}
-
- public static void main(String argv[]) {
-
- System.setProperty(org.slf4j.impl.SimpleLogger.DEFAULT_LOG_LEVEL_KEY, "debug");
-
- StringBuffer sbuff = new StringBuffer();
-
- for (int i = 0 ; i < argv.length ; i++)
- {
- if (sbuff.length() > 0)
- {
- sbuff.append(" ");
- }
- sbuff.append(argv[i]);
- }
-
- try {
- SvcLogicExpressionFactory.parse(sbuff.toString());
- } catch (IOException e) {
- LOG.error("Exception in SvcLogicExpressionFactory.parse",e);
- }
- }
}
diff --git a/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicStoreFactory.java b/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicStoreFactory.java
index 532ad31b..b73925dd 100644
--- a/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicStoreFactory.java
+++ b/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicStoreFactory.java
@@ -25,7 +25,7 @@ import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.util.Properties;
-
+import org.onap.ccsdk.sli.core.dblib.DBResourceManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -81,7 +81,7 @@ public class SvcLogicStoreFactory {
retval = new SvcLogicJdbcStore();
} else if ("dblib".equalsIgnoreCase(storeType)) {
- retval = new SvcLogicDblibStore();
+ retval = new SvcLogicDblibStore(new DBResourceManager(props));
} else {
throw new ConfigurationException("unsupported dbtype (" + storeType
+ ")");
diff --git a/sli/common/src/test/java/org/onap/ccsdk/sli/core/sli/ITCaseSvcLogicParser.java b/sli/common/src/test/java/org/onap/ccsdk/sli/core/sli/ITCaseSvcLogicParser.java
index 6f303a59..50eb917f 100644
--- a/sli/common/src/test/java/org/onap/ccsdk/sli/core/sli/ITCaseSvcLogicParser.java
+++ b/sli/common/src/test/java/org/onap/ccsdk/sli/core/sli/ITCaseSvcLogicParser.java
@@ -26,7 +26,6 @@ package org.onap.ccsdk.sli.core.sli;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.fail;
-
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
@@ -38,12 +37,12 @@ import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Properties;
-
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.onap.ccsdk.sli.core.dblib.DBResourceManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -155,7 +154,7 @@ public class ITCaseSvcLogicParser {
props.load(propStr);
- SvcLogicDblibStore dblibStore = new SvcLogicDblibStore(props);
+ SvcLogicDblibStore dblibStore = new SvcLogicDblibStore(new DBResourceManager(props));
Connection dbConn = dblibStore.getConnection();
diff --git a/sli/provider/pom.xml b/sli/provider/pom.xml
index 265831da..95099ed2 100755
--- a/sli/provider/pom.xml
+++ b/sli/provider/pom.xml
@@ -70,7 +70,14 @@
<groupId>org.opendaylight.controller</groupId>
<artifactId>sal-binding-api</artifactId>
</dependency>
-
+ <dependency>
+ <groupId>org.opendaylight.mdsal.binding.model.ietf</groupId>
+ <artifactId>rfc6991</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>sal-core-api</artifactId>
+ </dependency>
<!-- Testing Dependencies -->
<dependency>
<groupId>junit</groupId>
diff --git a/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/PrintYangToProp.java b/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/PrintYangToProp.java
index 5df136fd..a7f383f2 100644
--- a/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/PrintYangToProp.java
+++ b/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/PrintYangToProp.java
@@ -21,7 +21,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.ccsdk.sli.core.sli;
+package org.onap.ccsdk.sli.core.sli.provider;
import java.io.PrintStream;
import java.io.FileDescriptor;
diff --git a/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/SvcLogicServiceImpl.java b/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/SvcLogicServiceImpl.java
index 9e91b751..49d0a382 100755
--- a/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/SvcLogicServiceImpl.java
+++ b/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/SvcLogicServiceImpl.java
@@ -64,12 +64,6 @@ public class SvcLogicServiceImpl extends SvcLogicServiceImplBase implements SvcL
@Override
public Properties execute(String module, String rpc, String version, String mode, Properties props)
throws SvcLogicException {
- return (execute(module, rpc, version, mode, props, null));
- }
-
- @Override
- public Properties execute(String module, String rpc, String version, String mode, Properties props,
- DOMDataBroker domDataBroker) throws SvcLogicException {
SvcLogicGraph graph = store.fetch(module, rpc, version, mode);
if (graph == null) {
@@ -84,12 +78,19 @@ public class SvcLogicServiceImpl extends SvcLogicServiceImplBase implements SvcL
ctx.setAttribute(CURRENT_GRAPH, graph.toString());
// To support legacy code we should not stop populating X-ECOMP-RequestID
ctx.setAttribute("X-ECOMP-RequestID", MDC.get(ONAPLogConstants.MDCs.REQUEST_ID));
- ctx.setDomDataBroker(domDataBroker);
execute(graph, ctx);
return (ctx.toProperties());
}
@Override
+ @Deprecated
+ // DomDataBroker is not being used, this should be removed eventually
+ public Properties execute(String module, String rpc, String version, String mode, Properties props,
+ DOMDataBroker domDataBroker) throws SvcLogicException {
+ return (execute(module, rpc, version, mode, props));
+ }
+
+ @Override
public SvcLogicStore getStore() throws SvcLogicException {
// Create and initialize SvcLogicStore object - used to access
// saved service logic.
diff --git a/sli/common/src/test/java/org/onap/ccsdk/sli/core/sli/PrintYangToPropTest.java b/sli/provider/src/test/java/org/onap/ccsdk/sli/core/sli/provider/PrintYangToPropTest.java
index 14b4dcb7..50b7926a 100644
--- a/sli/common/src/test/java/org/onap/ccsdk/sli/core/sli/PrintYangToPropTest.java
+++ b/sli/provider/src/test/java/org/onap/ccsdk/sli/core/sli/provider/PrintYangToPropTest.java
@@ -20,7 +20,7 @@
20 * ===================================================================
21 *
22 */
-package org.onap.ccsdk.sli.core.sli;
+package org.onap.ccsdk.sli.core.sli.provider;
import java.util.Enumeration;
import java.util.LinkedList;
@@ -28,6 +28,7 @@ import java.util.List;
import java.util.Properties;
import org.junit.Test;
+import org.onap.ccsdk.sli.core.sli.provider.PrintYangToProp;
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ExecuteGraphInput.Mode;
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ExecuteGraphInputBuilder;
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.TestResultsBuilder;
diff --git a/sli/recording/pom.xml b/sli/recording/pom.xml
index 76862c49..f37f42ad 100755
--- a/sli/recording/pom.xml
+++ b/sli/recording/pom.xml
@@ -17,20 +17,6 @@
<name>ccsdk-sli-core :: sli :: ${project.artifactId}</name>
<description>SLI Recording is an OSGi bundle that implements recording service for the service logic record node.</description>
- <properties>
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- </properties>
-
- <dependencyManagement>
- <dependencies>
- <dependency>
- <groupId>org.onap.ccsdk.sli.core</groupId>
- <artifactId>dblib-provider</artifactId>
- <version>${project.version}</version>
- </dependency>
- </dependencies>
- </dependencyManagement>
-
<dependencies>
<dependency>
<groupId>org.onap.ccsdk.sli.core</groupId>
@@ -39,42 +25,24 @@
<scope>compile</scope>
</dependency>
<dependency>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi.core</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>jcl-over-slf4j</artifactId>
- </dependency>
-
- <dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<scope>compile</scope>
</dependency>
-
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>sal-binding-api</artifactId>
- </dependency>
-
<!-- Testing Dependencies -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
-
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>
-
</dependencies>
</project>