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