Added protocol_plugins.stub that implements
[controller.git] / opendaylight / statisticsmanager / implementation / src / main / java / org / opendaylight / controller / statisticsmanager / internal / Activator.java
1
2 /*
3  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
4  *
5  * This program and the accompanying materials are made available under the
6  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
7  * and is available at http://www.eclipse.org/legal/epl-v10.html
8  */
9
10 package org.opendaylight.controller.statisticsmanager.internal;
11
12 import org.apache.felix.dm.Component;
13 import org.opendaylight.controller.sal.core.ComponentActivatorAbstractBase;
14 import org.opendaylight.controller.sal.reader.IReadService;
15 import org.opendaylight.controller.statisticsmanager.IStatisticsManager;
16 import org.slf4j.Logger;
17 import org.slf4j.LoggerFactory;
18
19 public class Activator extends ComponentActivatorAbstractBase {
20     protected static final Logger logger = LoggerFactory
21             .getLogger(Activator.class);
22
23     /**
24      * Function called when the activator starts just after some
25      * initializations are done by the
26      * ComponentActivatorAbstractBase.
27      *
28      */
29     public void init() {
30     }
31
32     /**
33      * Function called when the activator stops just before the
34      * cleanup done by ComponentActivatorAbstractBase
35      *
36      */
37     public void destroy() {
38     }
39
40     /**
41      * Function that is used to communicate to dependency manager the
42      * list of known implementations for services inside a container
43      *
44      *
45      * @return An array containing all the CLASS objects that will be
46      * instantiated in order to get an fully working implementation
47      * Object
48      */
49     public Object[] getImplementations() {
50         Object[] res = { StatisticsManager.class };
51         return res;
52     }
53
54     /**
55      * Function that is called when configuration of the dependencies
56      * is required.
57      *
58      * @param c dependency manager Component object, used for
59      * configuring the dependencies exported and imported
60      * @param imp Implementation class that is being configured,
61      * needed as long as the same routine can configure multiple
62      * implementations
63      * @param containerName The containerName being configured, this allow
64      * also optional per-container different behavior if needed, usually
65      * should not be the case though.
66      */
67     public void configureInstance(Component c, Object imp, String containerName) {
68         if (imp.equals(StatisticsManager.class)) {
69             // export the service
70             c.setInterface(new String[] { IStatisticsManager.class.getName() },
71                     null);
72
73             c.add(createContainerServiceDependency(containerName).setService(
74                     IReadService.class).setCallbacks("setReaderService",
75                     "unsetReaderService").setRequired(false));
76         }
77     }
78 }