Merge "Remove AD-SAL dependencies from Neutron service"
[lispflowmapping.git] / mappingservice / neutron / src / main / java / org / opendaylight / lispflowmapping / neutron / Activator.java
1 /*
2  * Copyright (c) 2014, 2015 Cisco Systems, 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.lispflowmapping.neutron;
10
11
12 import java.util.Dictionary;
13 import java.util.Hashtable;
14
15 import org.apache.felix.dm.DependencyActivatorBase;
16 import org.apache.felix.dm.DependencyManager;
17 import org.opendaylight.lispflowmapping.interfaces.lisp.IFlowMapping;
18 import org.opendaylight.controller.networkconfig.neutron.INeutronNetworkAware;
19 import org.opendaylight.controller.networkconfig.neutron.INeutronSubnetAware;
20 import org.opendaylight.controller.networkconfig.neutron.INeutronPortAware;
21 import org.osgi.framework.BundleContext;
22 import org.slf4j.Logger;
23 import org.slf4j.LoggerFactory;
24
25 /**
26  * Main application activator class for registering the dependencies and
27  * Initializing the Mapping Service application.
28  *
29  */
30
31 public class Activator extends DependencyActivatorBase {
32
33     protected static final Logger logger = LoggerFactory.getLogger(Activator.class);
34
35     @Override
36     public void init(BundleContext context, DependencyManager manager) throws Exception {
37         Dictionary<String, String> props = new Hashtable<String, String>();
38         props.put("name", "mappingservice");
39
40         manager.add(createComponent()
41                 .setInterface(ILispNeutronService.class.getName(), null)
42                 .setImplementation(LispNeutronService.class)
43                 .add(createServiceDependency().setService(IFlowMapping.class)));
44
45         manager.add(createComponent()
46                 .setInterface(new String[] { ILispNeutronService.class.getName(), INeutronNetworkAware.class.getName()}, props)
47                 .setImplementation(LispNeutronNetworkHandler.class));
48
49         manager.add(createComponent()
50                 .setInterface(new String[] { ILispNeutronService.class.getName(), INeutronSubnetAware.class.getName()}, props)
51                 .setImplementation(LispNeutronSubnetHandler.class)
52                 .add(createServiceDependency().setService(ILispNeutronService.class)));
53
54         manager.add(createComponent()
55                 .setInterface(new String[] { ILispNeutronService.class.getName(), INeutronPortAware.class.getName()}, props)
56                 .setImplementation(LispNeutronPortHandler.class));
57
58         logger.debug("LISP Neutron Service is initialized!");
59
60     }
61
62     @Override
63     public void destroy(BundleContext context, DependencyManager manager) throws Exception {
64         logger.debug("LISP Neutron Service is destroyed!");
65     }
66
67 }