aboutsummaryrefslogtreecommitdiffstats
path: root/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/SvcLogicAdaptorFactory.java
diff options
context:
space:
mode:
Diffstat (limited to 'sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/SvcLogicAdaptorFactory.java')
-rw-r--r--sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/SvcLogicAdaptorFactory.java46
1 files changed, 14 insertions, 32 deletions
diff --git a/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/SvcLogicAdaptorFactory.java b/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/SvcLogicAdaptorFactory.java
index 7316db57..ecfe6b69 100644
--- a/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/SvcLogicAdaptorFactory.java
+++ b/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/SvcLogicAdaptorFactory.java
@@ -8,9 +8,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -35,7 +35,7 @@ public class SvcLogicAdaptorFactory {
private static final Logger LOG = LoggerFactory
.getLogger(SvcLogicAdaptorFactory.class);
- private static HashMap<String, SvcLogicAdaptor> adaptorMap = new HashMap<String, SvcLogicAdaptor>();
+ private static HashMap<String, SvcLogicAdaptor> adaptorMap = new HashMap<>();
public static void registerAdaptor(SvcLogicAdaptor adaptor) {
String name = adaptor.getClass().getName();
@@ -51,36 +51,18 @@ public class SvcLogicAdaptorFactory {
}
}
- public static SvcLogicAdaptor getInstance(String name) {
- if (adaptorMap.containsKey(name)) {
- return (adaptorMap.get(name));
- } else {
- BundleContext bctx = null;
- try
- {
- bctx = FrameworkUtil.getBundle(SvcLogicAdaptorFactory.class)
- .getBundleContext();
- }
- catch (Exception e)
- {
- LOG.debug("Caught exception trying to locate device adaptor "+name, e);
- return(null);
- }
-
- ServiceReference sref = bctx.getServiceReference(name);
+ public static SvcLogicAdaptor getInstance(String name) {
+ if (adaptorMap.containsKey(name)) {
+ return adaptorMap.get(name);
+ } else {
- if (sref != null) {
- SvcLogicAdaptor adaptor = (SvcLogicAdaptor) bctx
- .getService(sref);
+ SvcLogicAdaptor adaptor = (SvcLogicAdaptor) SvcLogicClassResolver.resolve(name);
- if (adaptor != null) {
- registerAdaptor(adaptor);
+ if (adaptor != null) {
+ registerAdaptor(adaptor);
+ }
- return (adaptor);
- }
- return (null);
- }
- }
- return(null);
- }
+ return adaptor;
+ }
+ }
}