Introduced Activator in the Library module to make it OSGi friendly.
[ovsdb.git] / library / src / main / java / org / opendaylight / ovsdb / lib / Activator.java
1 /*
2  * Copyright (C) 2013 Red Hat, Inc.
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  * Authors : Madhu Venugopal, Brent Salisbury
9  */
10 package org.opendaylight.ovsdb.lib;
11
12 import org.apache.felix.dm.DependencyActivatorBase;
13 import org.apache.felix.dm.DependencyManager;
14 import org.opendaylight.ovsdb.lib.impl.OvsdbConnectionService;
15 import org.osgi.framework.BundleContext;
16 import org.slf4j.Logger;
17 import org.slf4j.LoggerFactory;
18
19 /**
20  * OVSDB Library OSGi Activator
21  */
22 public class Activator extends DependencyActivatorBase {
23     protected static final Logger logger = LoggerFactory
24             .getLogger(Activator.class);
25
26     @Override
27     public void init(BundleContext context, DependencyManager manager) throws Exception {
28         manager.add(createComponent()
29             .setInterface(OvsdbConnection.class.getName(), null)
30             .setImplementation(OvsdbConnectionService.class)
31         );
32         manager.createServiceDependency()
33                .setService(OvsdbConnectionListener.class)
34                .setCallbacks("registerForPassiveConnection", "unregisterFromPassiveConnection")
35                .setRequired(false);
36     }
37
38     @Override
39     public void destroy(BundleContext context, DependencyManager manager) throws Exception {}
40 }