aboutsummaryrefslogtreecommitdiffstats
path: root/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/SvcLogicServiceImpl.java
diff options
context:
space:
mode:
authorSamuel Kontris <samuel.kontris@pantheon.tech>2019-09-04 15:31:48 +0200
committerDan Timoney <dtimoney@att.com>2019-10-15 18:19:47 +0000
commit574363f5a29ac9237a377c4c0923b414a38fddec (patch)
tree7f74f7e8acfc05055bd3ff281e57d6b0c37cb982 /sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/SvcLogicServiceImpl.java
parent4999c933f01789a4f71eb34cc32c7377c62ee2dd (diff)
Refactor class/instance loading and resolving in the SLI module
Code from the static class SvcLogicAdaptorFactory is moved to the SvcLogicClassResolver class. Class SvcLogicClassResolver is created as a bean in the blueprint xml file, not as singleton directly in the code. Then is injected via blueprint into the SvcLogicServiceImpl. Methods registerExecutor and unregisterExecutor from the SvcLogicServiceImpl class are removed - are not used anywhere. This change causes compilation error in the northbound repository. Fix for this error is here: https://gerrit.onap.org/r/#/c/ccsdk/sli/northbound/+/95053/ Issue-ID: CCSDK-1688 Change-Id: I26ce01b761ab5d17f1cc19e39af581b1963658a5 Signed-off-by: Samuel Kontris <samuel.kontris@pantheon.tech>
Diffstat (limited to 'sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/SvcLogicServiceImpl.java')
-rwxr-xr-xsli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/SvcLogicServiceImpl.java38
1 files changed, 7 insertions, 31 deletions
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 0d49366f..9e91b751 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
@@ -32,13 +32,11 @@ import org.onap.ccsdk.sli.core.sli.SvcLogicException;
import org.onap.ccsdk.sli.core.sli.SvcLogicGraph;
import org.onap.ccsdk.sli.core.sli.SvcLogicStore;
import org.onap.ccsdk.sli.core.sli.SvcLogicStoreFactory;
-import org.onap.ccsdk.sli.core.sli.provider.base.AbstractSvcLogicNodeExecutor;
import org.onap.ccsdk.sli.core.sli.provider.base.SvcLogicPropertiesProvider;
+import org.onap.ccsdk.sli.core.sli.provider.base.SvcLogicResolver;
import org.onap.ccsdk.sli.core.sli.provider.base.SvcLogicServiceImplBase;
import org.onap.logging.ref.slf4j.ONAPLogConstants;
import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceReference;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.MDC;
@@ -46,45 +44,23 @@ import org.slf4j.MDC;
public class SvcLogicServiceImpl extends SvcLogicServiceImplBase implements SvcLogicService {
private static final Logger LOG = LoggerFactory.getLogger(SvcLogicServiceImpl.class);
- protected BundleContext bctx = null;
- public SvcLogicServiceImpl(SvcLogicPropertiesProvider resourceProvider) throws SvcLogicException {
+ public SvcLogicServiceImpl(SvcLogicPropertiesProvider resourceProvider, SvcLogicResolver resolver)
+ throws SvcLogicException {
super(null);
- this.resolver = SvcLogicClassResolver.getInstance();
+ this.resolver = resolver;
properties = resourceProvider.getProperties();
this.store = getStore();
}
- public SvcLogicServiceImpl(SvcLogicPropertiesProvider resourceProvider, DbLibService dbSvc)
- throws SvcLogicException {
+ public SvcLogicServiceImpl(SvcLogicPropertiesProvider resourceProvider, DbLibService dbSvc,
+ SvcLogicResolver resolver) throws SvcLogicException {
super(null);
- this.resolver = SvcLogicClassResolver.getInstance();
+ this.resolver = resolver;
properties = resourceProvider.getProperties();
this.store = new SvcLogicDblibStore(dbSvc);
}
- public void registerExecutor(ServiceReference sr) {
- String nodeName = (String) sr.getProperty("nodeType");
- if (nodeName != null) {
- AbstractSvcLogicNodeExecutor executor;
- try {
- executor = (AbstractSvcLogicNodeExecutor) bctx.getService(sr);
- } catch (Exception e) {
- LOG.error("Cannot get service executor for {}", nodeName, e);
- return;
- }
- registerExecutor(nodeName, executor);
- }
- }
-
- public void unregisterExecutor(ServiceReference sr) {
- String nodeName = (String) sr.getProperty("nodeType");
-
- if (nodeName != null) {
- unregisterExecutor(nodeName);
- }
- }
-
@Override
public Properties execute(String module, String rpc, String version, String mode, Properties props)
throws SvcLogicException {