Merge "Mavenified generation of ANTLR YANG parser"
[controller.git] / opendaylight / protocol_plugins / stub / src / main / java / org / opendaylight / controller / protocol_plugins / stub / internal / Activator.java
1 package org.opendaylight.controller.protocol_plugins.stub.internal;
2
3 import java.util.Dictionary;
4 import java.util.Hashtable;
5
6 import org.apache.felix.dm.Component;
7
8 import org.opendaylight.controller.sal.core.ComponentActivatorAbstractBase;
9 import org.opendaylight.controller.sal.core.IContainerListener;
10 import org.opendaylight.controller.sal.core.Node;
11 import org.opendaylight.controller.sal.discovery.IDiscoveryService;
12 import org.opendaylight.controller.sal.flowprogrammer.IPluginInFlowProgrammerService;
13 import org.opendaylight.controller.sal.inventory.IPluginInInventoryService;
14 import org.opendaylight.controller.sal.inventory.IPluginOutInventoryService;
15 import org.opendaylight.controller.sal.packet.IPluginInDataPacketService;
16 import org.opendaylight.controller.sal.packet.IPluginOutDataPacketService;
17 import org.opendaylight.controller.sal.reader.IPluginInReadService;
18 import org.opendaylight.controller.sal.reader.IReadService;
19 import org.opendaylight.controller.sal.topology.IPluginInTopologyService;
20 import org.opendaylight.controller.sal.topology.IPluginOutTopologyService;
21 import org.opendaylight.controller.sal.utils.GlobalConstants;
22
23 import org.slf4j.Logger;
24 import org.slf4j.LoggerFactory;
25
26 /**
27  * stub protocol plugin Activator
28  * 
29  * 
30  */
31 public class Activator extends ComponentActivatorAbstractBase {
32     protected static final Logger logger = LoggerFactory
33             .getLogger(Activator.class);
34
35     /**
36      * Function called when the activator starts just after some initializations
37      * are done by the ComponentActivatorAbstractBase.
38      * 
39      */
40     public void init() {
41     }
42
43     /**
44      * Function called when the activator stops just before the cleanup done by
45      * ComponentActivatorAbstractBase
46      * 
47      */
48     public void destroy() {
49     }
50
51     /**
52      * Function that is used to communicate to dependency manager the list of
53      * known implementations for services inside a container
54      * 
55      * 
56      * @return An array containing all the CLASS objects that will be
57      *         instantiated in order to get an fully working implementation
58      *         Object
59      */
60     public Object[] getImplementations() {
61         Object[] res = { ReadService.class };
62         return res;
63     }
64
65     /**
66      * Function that is called when configuration of the dependencies is
67      * required.
68      * 
69      * @param c
70      *            dependency manager Component object, used for configuring the
71      *            dependencies exported and imported
72      * @param imp
73      *            Implementation class that is being configured, needed as long
74      *            as the same routine can configure multiple implementations
75      * @param containerName
76      *            The containerName being configured, this allow also optional
77      *            per-container different behavior if needed, usually should not
78      *            be the case though.
79      */
80     public void configureInstance(Component c, Object imp, String containerName) {
81         if (imp.equals(ReadService.class)) {
82             // export the service to be used by SAL
83             Dictionary<String, Object> props = new Hashtable<String, Object>();
84             // Set the protocolPluginType property which will be used
85             // by SAL
86             props.put("protocolPluginType", Node.NodeIDType.OPENFLOW);
87             c.setInterface(IPluginInReadService.class.getName(), props);
88         }
89     }
90
91 }