Controller to listen to expired flow removal message
[controller.git] / opendaylight / sal / implementation / src / main / java / org / opendaylight / controller / sal / implementation / internal / Activator.java
index 1d7732af4424f48368bd8870c1d59b82d494b043..99690802e3cdd5e9539c8e0a5c33a18ccec7b3d6 100644 (file)
@@ -1,4 +1,3 @@
-
 /*
  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
  *
@@ -10,8 +9,10 @@
 package org.opendaylight.controller.sal.implementation.internal;
 
 import org.opendaylight.controller.sal.core.ComponentActivatorAbstractBase;
+import org.opendaylight.controller.sal.flowprogrammer.IFlowProgrammerListener;
 import org.opendaylight.controller.sal.flowprogrammer.IFlowProgrammerService;
 import org.opendaylight.controller.sal.flowprogrammer.IPluginInFlowProgrammerService;
+import org.opendaylight.controller.sal.flowprogrammer.IPluginOutFlowProgrammerService;
 import org.opendaylight.controller.sal.inventory.IInventoryService;
 import org.opendaylight.controller.sal.inventory.IListenInventoryUpdates;
 import org.opendaylight.controller.sal.inventory.IPluginInInventoryService;
@@ -35,32 +36,31 @@ public class Activator extends ComponentActivatorAbstractBase {
             .getLogger(Activator.class);
 
     /**
-     * Function called when the activator starts just after some
-     * initializations are done by the
-     * ComponentActivatorAbstractBase.
-     *
+     * Function called when the activator starts just after some initializations
+     * are done by the ComponentActivatorAbstractBase.
+     * 
      */
     public void init() {
 
     }
 
     /**
-     * Function called when the activator stops just before the
-     * cleanup done by ComponentActivatorAbstractBase
-     *
+     * Function called when the activator stops just before the cleanup done by
+     * ComponentActivatorAbstractBase
+     * 
      */
     public void destroy() {
 
     }
 
     /**
-     * Function that is used to communicate to dependency manager the
-     * list of known implementations for services inside a container
-     *
-     *
+     * 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
+     *         instantiated in order to get an fully working implementation
+     *         Object
      */
     public Object[] getImplementations() {
         Object[] res = { Topology.class, Inventory.class,
@@ -70,97 +70,107 @@ public class Activator extends ComponentActivatorAbstractBase {
     }
 
     /**
-     * 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.
+     * 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.
      */
     public void configureInstance(Component c, Object imp, String containerName) {
         if (imp.equals(Topology.class)) {
             // export the service for Apps and Plugins
-            c.setInterface(new String[] {
-                    IPluginOutTopologyService.class.getName(),
-                    ITopologyService.class.getName() }, null);
+            c.setInterface(
+                    new String[] { IPluginOutTopologyService.class.getName(),
+                            ITopologyService.class.getName() }, null);
 
             // There can be multiple Topology listeners or there could
             // be none, hence the dependency is optional
-            c.add(createContainerServiceDependency(containerName).setService(
-                    IListenTopoUpdates.class).setCallbacks("setUpdateService",
-                    "unsetUpdateService").setRequired(false));
+            c.add(createContainerServiceDependency(containerName)
+                    .setService(IListenTopoUpdates.class)
+                    .setCallbacks("setUpdateService", "unsetUpdateService")
+                    .setRequired(false));
 
             // There can be multiple southbound plugins or there could
             // be none, the dependency is optional
-            c.add(createContainerServiceDependency(containerName).setService(
-                    IPluginInTopologyService.class).setCallbacks(
-                    "setPluginService", "unsetPluginService")
+            c.add(createContainerServiceDependency(containerName)
+                    .setService(IPluginInTopologyService.class)
+                    .setCallbacks("setPluginService", "unsetPluginService")
                     .setRequired(false));
         }
 
         if (imp.equals(Inventory.class)) {
             // export the service
-            c.setInterface(new String[] {
-                    IPluginOutInventoryService.class.getName(),
-                    IInventoryService.class.getName() }, null);
+            c.setInterface(
+                    new String[] { IPluginOutInventoryService.class.getName(),
+                            IInventoryService.class.getName() }, null);
 
             // Now lets add a service dependency to make sure the
             // provider of service exists
-            c.add(createContainerServiceDependency(containerName).setService(
-                    IListenInventoryUpdates.class).setCallbacks(
-                    "setUpdateService", "unsetUpdateService")
+            c.add(createContainerServiceDependency(containerName)
+                    .setService(IListenInventoryUpdates.class)
+                    .setCallbacks("setUpdateService", "unsetUpdateService")
                     .setRequired(false));
-            c
-                    .add(createContainerServiceDependency(containerName)
-                            .setService(IPluginInInventoryService.class)
-                            .setCallbacks("setPluginService",
-                                    "unsetPluginService").setRequired(true));
+            c.add(createContainerServiceDependency(containerName)
+                    .setService(IPluginInInventoryService.class)
+                    .setCallbacks("setPluginService", "unsetPluginService")
+                    .setRequired(true));
         }
 
         if (imp.equals(FlowProgrammerService.class)) {
-            // It is the provider of IFlowProgrammerService
-            c.setInterface(IFlowProgrammerService.class.getName(), null);
-            //It is also the consumer of IPluginInFlowProgrammerService
-            c.add(createServiceDependency().setService(
-                    IPluginInFlowProgrammerService.class).setCallbacks(
-                    "setService", "unsetService").setRequired(true));
+            c.setInterface(
+                    new String[] { IFlowProgrammerService.class.getName(),
+                            IPluginOutFlowProgrammerService.class.getName() },
+                    null);
+
+            c.add(createServiceDependency()
+                    .setService(IPluginInFlowProgrammerService.class)
+                    .setCallbacks("setService", "unsetService")
+                    .setRequired(false));
+            c.add(createServiceDependency()
+                    .setService(IFlowProgrammerListener.class)
+                    .setCallbacks("setListener", "unsetListener")
+                    .setRequired(false));
         }
 
         if (imp.equals(ReadService.class)) {
             // It is the provider of IReadService
             c.setInterface(IReadService.class.getName(), null);
 
-            //It is also the consumer of IPluginInReadService
-            c.add(createContainerServiceDependency(containerName).setService(
-                    IPluginInReadService.class).setCallbacks("setService",
-                    "unsetService").setRequired(true));
+            // It is also the consumer of IPluginInReadService
+            c.add(createContainerServiceDependency(containerName)
+                    .setService(IPluginInReadService.class)
+                    .setCallbacks("setService", "unsetService")
+                    .setRequired(true));
         }
 
         /************************/
         /* DATA PACKET SERVICES */
         /************************/
         if (imp.equals(DataPacketService.class)) {
-            c.setInterface(new String[] {
-                    IPluginOutDataPacketService.class.getName(),
-                    IDataPacketService.class.getName() }, null);
+            c.setInterface(
+                    new String[] { IPluginOutDataPacketService.class.getName(),
+                            IDataPacketService.class.getName() }, null);
 
             // Optionally use PluginInDataService if any southbound
             // protocol plugin exists
-            c.add(createContainerServiceDependency(containerName).setService(
-                    IPluginInDataPacketService.class).setCallbacks(
-                    "setPluginInDataService", "unsetPluginInDataService")
-                    .setRequired(false));
+            c.add(createContainerServiceDependency(containerName)
+                    .setService(IPluginInDataPacketService.class)
+                    .setCallbacks("setPluginInDataService",
+                            "unsetPluginInDataService").setRequired(false));
 
             // Optionally listed to IListenDataPacket services
-            c.add(createContainerServiceDependency(containerName).setService(
-                    IListenDataPacket.class).setCallbacks(
-                    "setListenDataPacket", "unsetListenDataPacket")
-                    .setRequired(false));
+            c.add(createContainerServiceDependency(containerName)
+                    .setService(IListenDataPacket.class)
+                    .setCallbacks("setListenDataPacket",
+                            "unsetListenDataPacket").setRequired(false));
         }
     }
 }