bgpvpn: simplify bgpvpn related code
[neutron.git] / transcriber / src / main / java / org / opendaylight / neutron / transcriber / Activator.java
1 /*
2  * Copyright (c) 2015 IBM Corporation 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.neutron.transcriber;
10
11 import java.util.ArrayList;
12 import java.util.List;
13
14 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext;
15 import org.osgi.framework.BundleActivator;
16 import org.osgi.framework.BundleContext;
17 import org.osgi.framework.ServiceRegistration;
18
19 public class Activator implements BundleActivator {
20     private List<ServiceRegistration<?>> registrations = new ArrayList<ServiceRegistration<?>>();
21     private ProviderContext providerContext;
22
23     public Activator(ProviderContext providerContext) {
24         this.providerContext = providerContext;
25     }
26
27     @Override
28     public void start(BundleContext context) throws Exception {
29         NeutronRouterInterface.registerNewInterface(context, providerContext, registrations);
30         NeutronPortInterface.registerNewInterface(context, providerContext, registrations);
31         NeutronSubnetInterface.registerNewInterface(context, providerContext, registrations);
32         NeutronNetworkInterface.registerNewInterface(context, providerContext, registrations);
33         NeutronSecurityGroupInterface.registerNewInterface(context, providerContext, registrations);
34         NeutronSecurityRuleInterface.registerNewInterface(context, providerContext, registrations);
35         NeutronFirewallInterface.registerNewInterface(context, providerContext, registrations);
36         NeutronFirewallPolicyInterface.registerNewInterface(context, providerContext, registrations);
37         NeutronFirewallRuleInterface.registerNewInterface(context, providerContext, registrations);
38         NeutronLoadBalancerInterface.registerNewInterface(context, providerContext, registrations);
39         NeutronLoadBalancerPoolInterface.registerNewInterface(context, providerContext, registrations);
40         NeutronLoadBalancerListenerInterface.registerNewInterface(context, providerContext, registrations);
41         NeutronLoadBalancerHealthMonitorInterface.registerNewInterface(context, providerContext, registrations);
42         NeutronMeteringLabelInterface.registerNewInterface(context, providerContext, registrations);
43         NeutronMeteringLabelRuleInterface.registerNewInterface(context, providerContext, registrations);
44         NeutronVPNServiceInterface.registerNewInterface(context, providerContext, registrations);
45         NeutronVPNIKEPolicyInterface.registerNewInterface(context, providerContext, registrations);
46         NeutronVPNIPSECPolicyInterface.registerNewInterface(context, providerContext, registrations);
47         NeutronVPNIPSECSiteConnectionsInterface.registerNewInterface(context, providerContext, registrations);
48         NeutronFloatingIPInterface.registerNewInterface(context, providerContext, registrations);
49         NeutronBgpvpnInterface.registerNewInterface(context, providerContext, registrations);
50     }
51
52     @Override
53     public void stop(BundleContext context) throws Exception {
54         for (ServiceRegistration registration : registrations) {
55             if (registration != null) {
56                 registration.unregister();
57             }
58         }
59     }
60 }