BUG 2302 : odl-clustering-test-app should not be part of the odl-restconf-all feature set
[controller.git] / opendaylight / clustering / test / src / main / java / org / opendaylight / controller / clustering / test / 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.test.internal;
11
12 import org.opendaylight.controller.sal.core.ComponentActivatorAbstractBase;
13 import org.opendaylight.controller.clustering.services.IClusterServices;
14 import org.slf4j.Logger;
15 import org.slf4j.LoggerFactory;
16 import org.apache.felix.dm.Component;
17
18 public class Activator extends ComponentActivatorAbstractBase {
19     protected static final Logger logger = LoggerFactory
20             .getLogger(Activator.class);
21
22
23     /**
24      * Function that is used to communicate to dependency manager the
25      * list of known implementations for services inside a container
26      *
27      *
28      * @return An array containing all the CLASS objects that will be
29      * instantiated in order to get an fully working implementation
30      * Object
31      */
32     public Object[] getGlobalImplementations() {
33         Object[] res = { SimpleClient.class };
34         return res;
35     }
36
37     /**
38      * Function that is called when configuration of the dependencies
39      * is required.
40      *
41      * @param c dependency manager Component object, used for
42      * configuring the dependencies exported and imported
43      * @param imp Implementation class that is being configured,
44      * needed as long as the same routine can configure multiple
45      * implementations
46      */
47     public void configureGlobalInstance(Component c, Object imp) {
48         if (imp.equals(SimpleClient.class)) {
49             // export the service for Apps and Plugins
50             c.setInterface(new String[] { org.eclipse.osgi.framework.console.CommandProvider.class.getName() },
51                            null);
52             c.add(createServiceDependency().setService(IClusterServices.class)
53                   .setCallbacks("setIClusterServices", "unsetIClusterServices")
54                   .setRequired(true));
55         }
56     }
57 }