Move init and destroy empty impl from Activator classes. Have only one
[controller.git] / opendaylight / clustering / stub / src / main / java / org / opendaylight / controller / clustering / stub / 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.clustering.stub.internal;
11
12 import org.opendaylight.controller.sal.core.ComponentActivatorAbstractBase;
13
14 import org.opendaylight.controller.clustering.services.ICacheUpdateAware;
15 import org.opendaylight.controller.clustering.services.IClusterContainerServices;
16 import org.opendaylight.controller.clustering.services.IClusterGlobalServices;
17 import org.opendaylight.controller.clustering.services.IClusterServices;
18 import org.opendaylight.controller.clustering.services.ICoordinatorChangeAware;
19 import org.slf4j.Logger;
20 import org.slf4j.LoggerFactory;
21 import org.apache.felix.dm.Component;
22
23 public class Activator extends ComponentActivatorAbstractBase {
24     protected static final Logger logger = LoggerFactory
25             .getLogger(Activator.class);
26
27
28     /**
29      * Function that is used to communicate to dependency manager the
30      * list of known implementations for services inside a container
31      *
32      *
33      * @return An array containing all the CLASS objects that will be
34      * instantiated in order to get an fully working implementation
35      * Object
36      */
37     public Object[] getGlobalImplementations() {
38         Object[] res = { ClusterGlobalManager.class };
39         return res;
40     }
41
42     /**
43      * Function that is used to communicate to dependency manager the
44      * list of known implementations for services inside a container
45      *
46      *
47      * @return An array containing all the CLASS objects that will be
48      * instantiated in order to get an fully working implementation
49      * Object
50      */
51     public Object[] getImplementations() {
52         Object[] res = { ClusterContainerManager.class };
53         return res;
54     }
55
56     /**
57      * Function that is called when configuration of the dependencies
58      * is required.
59      *
60      * @param c dependency manager Component object, used for
61      * configuring the dependencies exported and imported
62      * @param imp Implementation class that is being configured,
63      * needed as long as the same routine can configure multiple
64      * implementations
65      * @param containerName The containerName being configured, this allow
66      * also optional per-container different behavior if needed, usually
67      * should not be the case though.
68      */
69     public void configureInstance(Component c, Object imp, String containerName) {
70         if (imp.equals(ClusterContainerManager.class)) {
71             c.setInterface(new String[] { IClusterContainerServices.class
72                     .getName() }, null);
73         }
74     }
75
76     /**
77      * Function that is called when configuration of the dependencies
78      * is required.
79      *
80      * @param c dependency manager Component object, used for
81      * configuring the dependencies exported and imported
82      * @param imp Implementation class that is being configured,
83      * needed as long as the same routine can configure multiple
84      * implementations
85      */
86     public void configureGlobalInstance(Component c, Object imp) {
87         if (imp.equals(ClusterGlobalManager.class)) {
88             c.setInterface(new String[] { IClusterGlobalServices.class
89                     .getName() }, null);
90         }
91     }
92 }