Merge "Bug 6071: Compute authentication data for Map-Notify"
[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.controller.sal.binding.api.BindingAwareBroker;
18 import org.opendaylight.lispflowmapping.interfaces.lisp.IFlowMapping;
19 import org.opendaylight.neutron.spi.INeutronNetworkAware;
20 import org.opendaylight.neutron.spi.INeutronSubnetAware;
21 import org.opendaylight.neutron.spi.INeutronPortAware;
22 import org.osgi.framework.BundleContext;
23 import org.slf4j.Logger;
24 import org.slf4j.LoggerFactory;
25
26 /**
27  * Main application activator class for registering the dependencies and
28  * Initializing the Mapping Service application.
29  *
30  */
31
32 public class Activator extends DependencyActivatorBase {
33
34     protected static final Logger LOG = LoggerFactory.getLogger(Activator.class);
35
36     @Override
37     public void init(BundleContext context, DependencyManager manager) throws Exception {
38         Dictionary<String, String> props = new Hashtable<String, String>();
39         props.put("name", "LISPNeutronService");
40
41         manager.add(createComponent()
42                 .setInterface(new String[] { ILispNeutronService.class.getName()}, props)
43                 .setImplementation(LispNeutronService.class)
44                 .add(createServiceDependency().setService(IFlowMapping.class))
45                 .add(createServiceDependency().setService(BindingAwareBroker.class)
46                 .setCallbacks("setBindingAwareBroker", "unsetBindingAwareBroker")));
47
48         manager.add(createComponent()
49                 .setInterface(new String[] {  INeutronNetworkAware.class.getName()}, props)
50                 .setImplementation(LispNeutronNetworkHandler.class));
51
52         manager.add(createComponent()
53                 .setInterface(new String[] {  INeutronSubnetAware.class.getName()}, props)
54                 .setImplementation(LispNeutronSubnetHandler.class)
55                 .add(createServiceDependency().setService(ILispNeutronService.class)));
56
57         manager.add(createComponent()
58                 .setInterface(new String[] { INeutronPortAware.class.getName()}, props)
59                 .setImplementation(LispNeutronPortHandler.class)
60                 .add(createServiceDependency().setService(ILispNeutronService.class)));
61
62         LOG.debug("LISP Neutron Service is initialized!");
63
64     }
65
66     @Override
67     public void destroy(BundleContext context, DependencyManager manager) throws Exception {
68         LOG.debug("LISP Neutron Service is destroyed!");
69     }
70
71 }