Adding plugin stub:
[controller.git] / opendaylight / protocol_plugins / stub / src / main / java / org / opendaylight / controller / protocol_plugins / stub / internal / Activator.java
index cf93fb0a37fb1381716934da2220d6df7eba456c..ff44fd44670d70a876d664ee89f096c90c3cca74 100644 (file)
@@ -8,6 +8,7 @@ import org.apache.felix.dm.Component;
 import org.opendaylight.controller.sal.core.ComponentActivatorAbstractBase;
 import org.opendaylight.controller.sal.core.IContainerListener;
 import org.opendaylight.controller.sal.core.Node;
+import org.opendaylight.controller.sal.core.NodeConnector;
 import org.opendaylight.controller.sal.discovery.IDiscoveryService;
 import org.opendaylight.controller.sal.flowprogrammer.IPluginInFlowProgrammerService;
 import org.opendaylight.controller.sal.inventory.IPluginInInventoryService;
@@ -38,6 +39,8 @@ public class Activator extends ComponentActivatorAbstractBase {
      * 
      */
     public void init() {
+        Node.NodeIDType.registerIDType("STUB", Integer.class);
+        NodeConnector.NodeConnectorIDType.registerIDType("STUB", Integer.class, "STUB");
     }
 
     /**
@@ -46,6 +49,8 @@ public class Activator extends ComponentActivatorAbstractBase {
      * 
      */
     public void destroy() {
+        Node.NodeIDType.unRegisterIDType("STUB");
+        NodeConnector.NodeConnectorIDType.unRegisterIDType("STUB");
     }
 
     /**
@@ -83,7 +88,7 @@ public class Activator extends ComponentActivatorAbstractBase {
             Dictionary<String, Object> props = new Hashtable<String, Object>();
             // Set the protocolPluginType property which will be used
             // by SAL
-            props.put("protocolPluginType", Node.NodeIDType.OPENFLOW);
+            props.put("protocolPluginType", "STUB");
             c.setInterface(IPluginInReadService.class.getName(), props);
         }
 
@@ -92,8 +97,24 @@ public class Activator extends ComponentActivatorAbstractBase {
             Dictionary<String, Object> props = new Hashtable<String, Object>();
             // Set the protocolPluginType property which will be used
             // by SAL
-            props.put("protocolPluginType", Node.NodeIDType.OPENFLOW);
+            props.put("protocolPluginType", "STUB");
             c.setInterface(IPluginInInventoryService.class.getName(), props);
         }
     }
+    
+    public Object[] getGlobalImplementations() {
+        Object[] res = { FlowProgrammerService.class };
+        return res;
+    }
+    
+    public void configureGlobalInstance(Component c, Object imp){
+        if (imp.equals(FlowProgrammerService.class)) {
+            // export the service to be used by SAL
+            Dictionary<String, Object> props = new Hashtable<String, Object>();
+            // Set the protocolPluginType property which will be used
+            // by SAL
+            props.put("protocolPluginType", "STUB");
+            c.setInterface(IPluginInFlowProgrammerService.class.getName(), props);
+        }
+    }
 }