Speed up SouthboundIT through multi-threading test cases
[netvirt.git] / plugin-mdsal-adapter / src / main / java / org / opendaylight / ovsdb / plugin / md / Activator.java
1 /*
2  * Copyright (c) 2013, 2015 Red Hat, Inc. and others. All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8
9 package org.opendaylight.ovsdb.plugin.md;
10
11 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
12 import org.opendaylight.controller.sal.core.ComponentActivatorAbstractBase;
13 import org.opendaylight.ovsdb.plugin.api.OvsdbConfigurationService;
14 import org.opendaylight.ovsdb.plugin.api.OvsdbInventoryListener;
15
16 import org.apache.felix.dm.Component;
17
18 /**
19  * OSGi Bundle Activator for the Neutron providers
20  */
21 public class Activator extends ComponentActivatorAbstractBase {
22     /**
23      * Function called when the activator starts just after some
24      * initializations are done by the
25      * ComponentActivatorAbstractBase.
26      */
27     @Override
28     public void init() {
29     }
30
31     /**
32      * Function called when the activator stops just before the
33      * cleanup done by ComponentActivatorAbstractBase.
34      *
35      */
36     @Override
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      * @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     @Override
49     public Object[] getImplementations() {
50         Object[] res = {OvsdbBindingAwareProviderImpl.class,
51                         OvsdbInventoryManager.class };
52         return res;
53     }
54
55     /**
56      * Function that is called when configuration of the dependencies
57      * is required.
58      *
59      * @param c dependency manager Component object, used for
60      * configuring the dependencies exported and imported
61      * @param imp Implementation class that is being configured,
62      * needed as long as the same routine can configure multiple
63      * implementations
64      * @param containerName The containerName being configured, this allow
65      * also optional per-container different behavior if needed, usually
66      * should not be the case though.
67      */
68     @Override
69     public void configureInstance(Component c, Object imp,
70                                   String containerName) {
71
72         if (imp.equals(OvsdbBindingAwareProviderImpl.class)) {
73             c.setInterface(OvsdbBindingAwareProvider.class.getName(), null);
74             c.add(createServiceDependency()
75                           .setService(BindingAwareBroker.class)
76                           .setRequired(true));
77         }
78
79         if (imp.equals(OvsdbInventoryManager.class)) {
80             c.setInterface(OvsdbInventoryListener.class.getName(), null);
81             c.add(createServiceDependency()
82                           .setService(OvsdbBindingAwareProvider.class)
83                           .setRequired(true));
84             c.add(createServiceDependency()
85                           .setService(OvsdbConfigurationService.class)
86                           .setRequired(true));
87         }
88     }
89 }