Removing AD-SAL dependencies 97/21297/5
authorFlorin Coras <fcoras@cisco.com>
Mon, 18 May 2015 23:22:32 +0000 (16:22 -0700)
committerLorand Jakab <lojakab@cisco.com>
Fri, 29 May 2015 22:23:07 +0000 (01:23 +0300)
Change-Id: I8df9f0076d9ed2882f05669c53e6b0ec72b98894
Signed-off-by: Florin Coras <fcoras@cisco.com>
commons/parent/pom.xml
features/pom.xml
features/src/main/resources/features.xml
mappingservice/clusterdao/src/main/java/org/opendaylight/lispflowmapping/clusterdao/Activator.java
mappingservice/implementation/src/main/java/org/opendaylight/lispflowmapping/implementation/Activator.java

index 3cb364fbb4c5e51338fc2cdb45c2eea114f7090c..83442fdd6db70c0c41914caf528d15a096777ca9 100644 (file)
         <version>0.7.0-SNAPSHOT</version>
       </dependency>
       -->
-      <dependency>
-        <groupId>org.opendaylight.controller</groupId>
-        <artifactId>features-adsal</artifactId>
-        <version>${sal.version}</version>
-        <classifier>features</classifier>
-        <type>xml</type>
-      </dependency>
       <dependency>
         <groupId>org.opendaylight.controller</groupId>
         <artifactId>features-mdsal</artifactId>
index 9dfb14b5b22f2bc819429a806dec6916950cd719..33279f2ed94cbbea348bb8a199c5c8daf2c54abb 100644 (file)
@@ -20,6 +20,7 @@
     <maven>3.1.1</maven>
   </prerequisites>
   <properties>
+    <commons.opendaylight.version>1.6.0-SNAPSHOT</commons.opendaylight.version>
     <configfile.directory>etc/opendaylight/karaf</configfile.directory>
     <features.file>features.xml</features.file>
     <mdsal.version>1.3.0-SNAPSHOT</mdsal.version>
@@ -40,7 +41,8 @@
   <dependencies>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
-      <artifactId>features-adsal</artifactId>
+      <artifactId>features-base</artifactId>
+      <version>${commons.opendaylight.version}</version>
       <classifier>features</classifier>
       <type>xml</type>
     </dependency>
index 46d2e18906b260db48c459296f577c9593505c88..eef6465e0108028fb4a3d8a964db6fb9af515e39 100644 (file)
@@ -13,7 +13,9 @@
 
     <repository>mvn:org.opendaylight.controller/features-mdsal/${mdsal.version}/xml/features</repository>
     <repository>mvn:org.opendaylight.controller/features-restconf/${mdsal.version}/xml/features</repository>
-    <repository>mvn:org.opendaylight.controller/features-adsal/${sal.version}/xml/features</repository>
+    <!-- <repository>mvn:org.opendaylight.controller/features-adsal/${sal.version}/xml/features</repository> -->
+    <!-- TODO features-base should be removed when we get rid of Activators, hopefully soon -->
+    <repository>mvn:org.opendaylight.controller/features-base/${commons.opendaylight.version}/xml/features</repository>
     <repository>mvn:org.opendaylight.neutron/features-neutron/${neutron.version}/xml/features</repository>
     <repository>mvn:org.opendaylight.controller/features-nsf/${nsf.version}/xml/features</repository>
     <repository>mvn:org.opendaylight.controller/features-netconf-connector/${mdsal.version}/xml/features</repository>
     </feature>
 
     <feature name="odl-lispflowmapping-mappingservice" description="OpenDaylight :: LISP Flow Mapping :: Mapping Service" version='${lispflowmapping.version}'>
+        <!-- TODO felix-dm should be removed when we get rid of Activators, hopefully soon -->
+        <feature>odl-base-felix-dm</feature>
         <feature version="${mdsal.version}">odl-mdsal-broker</feature>
         <feature version="${mdsal.version}">odl-mdsal-apidocs</feature>
-        <feature version="${sal.version}">odl-adsal-core</feature>
+        <!-- <feature version="${sal.version}">odl-adsal-core</feature> -->
         <!-- <feature version="${clustering.services.version}">odl-adsal-clustering</feature> -->
         <feature version='${yangtools.version}'>odl-yangtools-binding</feature>
         <feature version='${yangtools.version}'>odl-yangtools-models</feature>
index 0e2ddd3fb45e3dce53068a9f604ce98108a1ca36..6336da7abf813f5deea1914a5cc452f4af060319 100644 (file)
@@ -11,10 +11,11 @@ package org.opendaylight.lispflowmapping.clusterdao;
 import java.util.Dictionary;
 import java.util.Hashtable;
 
-import org.apache.felix.dm.Component;
+import org.apache.felix.dm.DependencyActivatorBase;
+import org.apache.felix.dm.DependencyManager;
 import org.opendaylight.controller.clustering.services.IClusterContainerServices;
-import org.opendaylight.controller.sal.core.ComponentActivatorAbstractBase;
 import org.opendaylight.lispflowmapping.interfaces.dao.ILispDAO;
+import org.osgi.framework.BundleContext;
 
 /**
  * Main application activator class for registering the dependencies and
@@ -22,98 +23,22 @@ import org.opendaylight.lispflowmapping.interfaces.dao.ILispDAO;
  *
  */
 
-public class Activator extends ComponentActivatorAbstractBase {
+public class Activator extends DependencyActivatorBase {
 
-    /**
-     * Function called when the activator starts just after some initializations
-     * are done by the ComponentActivatorAbstractBase.
-     *
-     */
     @Override
-    public void init() {
-    }
-
-    /**
-     * Function called when the activator stops just before the cleanup done by
-     * ComponentActivatorAbstractBase
-     *
-     */
-    @Override
-    public void destroy() {
-    }
+    public void init(BundleContext context, DependencyManager manager) throws Exception {
+        Dictionary<String, String> props = new Hashtable<String, String>();
+        props.put("name", "clusterosgiservice");
+        manager.add(createComponent().setInterface(new String[] { ILispDAO.class.getName() }, props)
+                .setImplementation(ClusterDAOService.class)
+                .add(createServiceDependency().setService(IClusterContainerServices.class)
+                        .setCallbacks("setClusterContainerService", "unsetClusterContainerService").setRequired(true)));
 
-    /**
-     * Function that is used to communicate to dependency manager the list of
-     * known implementations for services inside a container
-     *
-     *
-     * @return An array containing all the CLASS objects that will be
-     *         instantiated in order to get an fully working implementation
-     *         Object
-     */
-    @Override
-    public Object[] getImplementations() {
-        Object[] res = { ClusterDAOService.class };
-        return res;
-    }
-
-    /**
-     * Function that is called when configuration of the dependencies is
-     * required.
-     *
-     * @param c
-     *            dependency manager Component object, used for configuring the
-     *            dependencies exported and imported
-     * @param imp
-     *            Implementation class that is being configured, needed as long
-     *            as the same routine can configure multiple implementations
-     * @param containerName
-     *            The containerName being configured, this allow also optional
-     *            per-container different behavior if needed, usually should not
-     *            be the case though.
-     */
-    @Override
-    public void configureInstance(Component c, Object imp, String containerName) {
-        if (imp.equals(ClusterDAOService.class)) {
-            // export the service
-            Dictionary<String, String> props = new Hashtable<String, String>();
-            props.put("name", "clusterosgiservice");
-            c.setInterface(new String[] { ILispDAO.class.getName() }, props);
-            c.add(createContainerServiceDependency(containerName).setService(IClusterContainerServices.class)
-                    .setCallbacks("setClusterContainerService", "unsetClusterContainerService").setRequired(true));
-        }
-    }
-
-    /**
-     * Method which tells how many Global implementations are supported by the
-     * bundle. This way we can tune the number of components created. This
-     * components will be created ONLY at the time of bundle startup and will be
-     * destroyed only at time of bundle destruction, this is the major
-     * difference with the implementation retrieved via getImplementations where
-     * all of them are assumed to be in a container !
-     *
-     *
-     * @return The list of implementations the bundle will support, in Global
-     *         version
-     */
-    @Override
-    protected Object[] getGlobalImplementations() {
-        return null;
     }
 
-    /**
-     * Configure the dependency for a given instance Global
-     *
-     * @param c
-     *            Component assigned for this instance, this will be what will
-     *            be used for configuration
-     * @param imp
-     *            implementation to be configured
-     * @param containerName
-     *            container on which the configuration happens
-     */
     @Override
-    protected void configureGlobalInstance(Component c, Object imp) {
+    public void destroy(BundleContext context, DependencyManager manager) throws Exception {
+        // TODO Auto-generated method stub
 
     }
 }
index ec64d94f51b3933a11a3c40f0c62b62f50fc280e..27889417c1581c906b6c8448f8a16020ec57cfb2 100644 (file)
@@ -11,12 +11,12 @@ package org.opendaylight.lispflowmapping.implementation;
 import java.util.Dictionary;
 import java.util.Hashtable;
 
-import org.apache.felix.dm.Component;
+import org.apache.felix.dm.DependencyActivatorBase;
+import org.apache.felix.dm.DependencyManager;
 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
-import org.opendaylight.controller.sal.core.ComponentActivatorAbstractBase;
-import org.opendaylight.lispflowmapping.interfaces.dao.ILispDAO;
 import org.opendaylight.lispflowmapping.interfaces.lisp.IFlowMapping;
 import org.opendaylight.lispflowmapping.interfaces.lisp.IFlowMappingShell;
+import org.osgi.framework.BundleContext;
 
 /**
  * Main application activator class for registering the dependencies and
@@ -24,96 +24,22 @@ import org.opendaylight.lispflowmapping.interfaces.lisp.IFlowMappingShell;
  *
  */
 
-public class Activator extends ComponentActivatorAbstractBase {
+public class Activator extends DependencyActivatorBase {
 
-    /**
-     * Function called when the activator starts just after some initializations
-     * are done by the ComponentActivatorAbstractBase.
-     *
-     */
     @Override
-    public void init() {
-    }
-
-    /**
-     * Function called when the activator stops just before the cleanup done by
-     * ComponentActivatorAbstractBase
-     *
-     */
-    @Override
-    public void destroy() {
-    }
+    public void init(BundleContext context, DependencyManager manager) throws Exception {
+        Dictionary<String, String> props = new Hashtable<String, String>();
+        props.put("name", "mappingservice");
+        manager.add(createComponent().setInterface(new String[] { IFlowMapping.class.getName(), IFlowMappingShell.class.getName() }, props)
+                .setImplementation(LispMappingService.class)
+                .add(createServiceDependency().setService(BindingAwareBroker.class).setRequired(true)
+                        .setCallbacks("setBindingAwareBroker", "unsetBindingAwareBroker")));
 
-    /**
-     * Function that is used to communicate to dependency manager the list of
-     * known implementations for services inside a container
-     *
-     *
-     * @return An array containing all the CLASS objects that will be
-     *         instantiated in order to get an fully working implementation
-     *         Object
-     */
-    @Override
-    public Object[] getImplementations() {
-        Object[] res = { LispMappingService.class };
-        return res;
-    }
-
-    /**
-     * Function that is called when configuration of the dependencies is
-     * required.
-     *
-     * @param c
-     *            dependency manager Component object, used for configuring the
-     *            dependencies exported and imported
-     * @param imp
-     *            Implementation class that is being configured, needed as long
-     *            as the same routine can configure multiple implementations
-     * @param containerName
-     *            The containerName being configured, this allow also optional
-     *            per-container different behavior if needed, usually should not
-     *            be the case though.
-     */
-    @Override
-    public void configureInstance(Component c, Object imp, String containerName) {
-        if (imp.equals(LispMappingService.class)) {
-            // export the service
-            Dictionary<String, String> props = new Hashtable<String, String>();
-            props.put("name", "mappingservice");
-            c.setInterface(new String[] { IFlowMapping.class.getName(), IFlowMappingShell.class.getName() }, props);
-            c.add(createServiceDependency().setService(BindingAwareBroker.class).setRequired(true)
-                    .setCallbacks("setBindingAwareBroker", "unsetBindingAwareBroker"));
-        }
-    }
-
-    /**
-     * Method which tells how many Global implementations are supported by the
-     * bundle. This way we can tune the number of components created. This
-     * components will be created ONLY at the time of bundle startup and will be
-     * destroyed only at time of bundle destruction, this is the major
-     * difference with the implementation retrieved via getImplementations where
-     * all of them are assumed to be in a container !
-     *
-     *
-     * @return The list of implementations the bundle will support, in Global
-     *         version
-     */
-    @Override
-    protected Object[] getGlobalImplementations() {
-        return null;
     }
 
-    /**
-     * Configure the dependency for a given instance Global
-     *
-     * @param c
-     *            Component assigned for this instance, this will be what will
-     *            be used for configuration
-     * @param imp
-     *            implementation to be configured
-     */
     @Override
-    protected void configureGlobalInstance(Component c, Object imp) {
+    public void destroy(BundleContext context, DependencyManager manager) throws Exception {
+        // TODO Auto-generated method stub
 
     }
 }