71f5cfd0e6452d9e4d7fde0bcd07aad607a25b85
[controller.git] / opendaylight / northboundtest / unit_test_suite / src / main / java / org / opendaylight / controller / northboundtest / unittestsuite / 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.northboundtest.unittestsuite.internal;
11
12 import org.opendaylight.controller.sal.core.ComponentActivatorAbstractBase;
13
14 import org.apache.felix.dm.Component;
15
16 public class Activator extends ComponentActivatorAbstractBase {
17
18     /**
19      * Function called when the activator starts just after some
20      * initializations are done by the
21      * ComponentActivatorAbstractBase.
22      *
23      */
24     public void init() {
25     }
26
27     /**
28      * Function called when the activator stops just before the
29      * cleanup done by ComponentActivatorAbstractBase
30      *
31      */
32     public void destroy() {
33     }
34
35     /**
36      * Function that is used to communicate to dependency manager the
37      * list of known implementations for services inside a container
38      *
39      *
40      * @return An array containing all the CLASS objects that will be
41      * instantiated in order to get an fully working implementation
42      * Object
43      */
44     public Object[] getImplementations() {
45         return null;
46     }
47
48     /**
49      * Function that is called when configuration of the dependencies
50      * is required.
51      *
52      * @param c dependency manager Component object, used for
53      * configuring the dependencies exported and imported
54      * @param imp Implementation class that is being configured,
55      * needed as long as the same routine can configure multiple
56      * implementations
57      * @param containerName The containerName being configured, this allow
58      * also optional per-container different behavior if needed, usually
59      * should not be the case though.
60      */
61     public void configureInstance(Component c, Object imp, String containerName) {
62     }
63
64     /**
65      * Method which tells how many Global implementations are
66      * supported by the bundle. This way we can tune the number of
67      * components created. This components will be created ONLY at the
68      * time of bundle startup and will be destroyed only at time of
69      * bundle destruction, this is the major difference with the
70      * implementation retrieved via getImplementations where all of
71      * them are assumed to be in a Container!
72      *
73      *
74      * @return The list of implementations the bundle will support,
75      * in Global version
76      */
77     protected Object[] getGlobalImplementations() {
78         Object[] res = { API3UnitTest.class };
79         return res;
80     }
81
82     /**
83      * Configure the dependency for a given instance Global
84      *
85      * @param c Component assigned for this instance, this will be
86      * what will be used for configuration
87      * @param imp implementation to be configured
88      * @param containerName container on which the configuration happens
89      */
90     protected void configureGlobalInstance(Component c, Object imp) {
91         if (imp.equals(API3UnitTest.class)) {
92             // Nothing to initialize
93         }
94     }
95 }