Implement NeutronMeteringLabelsNorthbound methods
[neutron.git] / transcriber / src / main / java / org / opendaylight / neutron / transcriber / Activator.java
1 /*
2  * Copyright IBM Corporation, 2013.  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.neutron.spi.INeutronFirewallCRUD;
15 import org.opendaylight.neutron.spi.INeutronFirewallPolicyCRUD;
16 import org.opendaylight.neutron.spi.INeutronFirewallRuleCRUD;
17 import org.opendaylight.neutron.spi.INeutronLoadBalancerCRUD;
18 import org.opendaylight.neutron.spi.INeutronLoadBalancerHealthMonitorCRUD;
19 import org.opendaylight.neutron.spi.INeutronLoadBalancerListenerCRUD;
20 import org.opendaylight.neutron.spi.INeutronLoadBalancerPoolCRUD;
21 import org.opendaylight.neutron.spi.INeutronLoadBalancerPoolMemberCRUD;
22 import org.opendaylight.neutron.spi.INeutronMeteringLabelCRUD;
23 import org.opendaylight.neutron.spi.INeutronNetworkCRUD;
24 import org.opendaylight.neutron.spi.INeutronPortCRUD;
25 import org.opendaylight.neutron.spi.INeutronRouterCRUD;
26 import org.opendaylight.neutron.spi.INeutronSecurityGroupCRUD;
27 import org.opendaylight.neutron.spi.INeutronSecurityRuleCRUD;
28 import org.opendaylight.neutron.spi.INeutronSubnetCRUD;
29 import org.osgi.framework.BundleActivator;
30 import org.osgi.framework.BundleContext;
31 import org.osgi.framework.ServiceRegistration;
32 import org.slf4j.Logger;
33 import org.slf4j.LoggerFactory;
34
35 public class Activator implements BundleActivator {
36     protected static final Logger logger = LoggerFactory
37     .getLogger(Activator.class);
38     private List<ServiceRegistration<?>> registrations = new ArrayList<ServiceRegistration<?>>();
39
40     @Override
41     public void start(BundleContext context) throws Exception {
42         NeutronRouterInterface neutronRouterInterface = new NeutronRouterInterface();
43         ServiceRegistration<INeutronRouterCRUD> neutronRouterInterfaceRegistration = context.registerService(INeutronRouterCRUD.class, neutronRouterInterface, null);
44         if(neutronRouterInterfaceRegistration != null) {
45             registrations.add(neutronRouterInterfaceRegistration);
46         }
47         NeutronPortInterface neutronPortInterface = new NeutronPortInterface();
48         ServiceRegistration<INeutronPortCRUD> neutronPortInterfaceRegistration = context.registerService(INeutronPortCRUD.class, neutronPortInterface, null);
49         if(neutronPortInterfaceRegistration != null) {
50             registrations.add(neutronPortInterfaceRegistration);
51         }
52
53         NeutronSubnetInterface neutronSubnetInterface = new NeutronSubnetInterface();
54         ServiceRegistration<INeutronSubnetCRUD> neutronSubnetInterfaceRegistration = context.registerService(INeutronSubnetCRUD.class, neutronSubnetInterface, null);
55         if(neutronSubnetInterfaceRegistration != null) {
56             registrations.add(neutronSubnetInterfaceRegistration);
57         }
58
59         NeutronNetworkInterface neutronNetworkInterface = new NeutronNetworkInterface();
60         ServiceRegistration<INeutronNetworkCRUD> neutronNetworkInterfaceRegistration = context.registerService(INeutronNetworkCRUD.class, neutronNetworkInterface, null);
61         if(neutronNetworkInterfaceRegistration != null) {
62             registrations.add(neutronNetworkInterfaceRegistration);
63         }
64
65         NeutronSecurityGroupInterface neutronSecurityGroupInterface = new NeutronSecurityGroupInterface();
66         ServiceRegistration<INeutronSecurityGroupCRUD> neutronSecurityGroupInterfaceRegistration = context.registerService(INeutronSecurityGroupCRUD.class, neutronSecurityGroupInterface, null);
67         if(neutronSecurityGroupInterfaceRegistration != null) {
68             registrations.add(neutronSecurityGroupInterfaceRegistration);
69         }
70
71         NeutronSecurityRuleInterface neutronSecurityRuleInterface = new NeutronSecurityRuleInterface();
72         ServiceRegistration<INeutronSecurityRuleCRUD> neutronSecurityRuleInterfaceRegistration = context.registerService(INeutronSecurityRuleCRUD.class, neutronSecurityRuleInterface, null);
73         if(neutronSecurityRuleInterfaceRegistration != null) {
74             registrations.add(neutronSecurityRuleInterfaceRegistration);
75         }
76
77         NeutronFirewallInterface neutronFirewallInterface = new NeutronFirewallInterface();
78         ServiceRegistration<INeutronFirewallCRUD> neutronFirewallInterfaceRegistration = context.registerService(INeutronFirewallCRUD.class, neutronFirewallInterface, null);
79         if(neutronFirewallInterfaceRegistration != null) {
80             registrations.add(neutronFirewallInterfaceRegistration);
81         }
82
83         NeutronFirewallPolicyInterface neutronFirewallPolicyInterface = new NeutronFirewallPolicyInterface();
84         ServiceRegistration<INeutronFirewallPolicyCRUD> neutronFirewallPolicyInterfaceRegistration = context.registerService(INeutronFirewallPolicyCRUD.class, neutronFirewallPolicyInterface, null);
85         if(neutronFirewallPolicyInterfaceRegistration != null) {
86             registrations.add(neutronFirewallPolicyInterfaceRegistration);
87         }
88
89         NeutronFirewallRuleInterface neutronFirewallRuleInterface = new NeutronFirewallRuleInterface();
90         ServiceRegistration<INeutronFirewallRuleCRUD> neutronFirewallRuleInterfaceRegistration = context.registerService(INeutronFirewallRuleCRUD.class, neutronFirewallRuleInterface, null);
91         if(neutronFirewallRuleInterfaceRegistration != null) {
92             registrations.add(neutronFirewallRuleInterfaceRegistration);
93         }
94
95         NeutronLoadBalancerInterface neutronLoadBalancerInterface = new NeutronLoadBalancerInterface();
96         ServiceRegistration<INeutronLoadBalancerCRUD> neutronLoadBalancerInterfaceRegistration = context.registerService(INeutronLoadBalancerCRUD.class, neutronLoadBalancerInterface, null);
97         if(neutronLoadBalancerInterfaceRegistration != null) {
98             registrations.add(neutronLoadBalancerInterfaceRegistration);
99         }
100
101         NeutronLoadBalancerPoolInterface neutronLoadBalancerPoolInterface = new NeutronLoadBalancerPoolInterface();
102         ServiceRegistration<INeutronLoadBalancerPoolCRUD> neutronLoadBalancerPoolInterfaceRegistration = context.registerService(INeutronLoadBalancerPoolCRUD.class, neutronLoadBalancerPoolInterface, null);
103         if(neutronLoadBalancerPoolInterfaceRegistration != null) {
104             registrations.add(neutronLoadBalancerPoolInterfaceRegistration);
105         }
106
107         NeutronLoadBalancerListenerInterface neutronLoadBalancerListenerInterface = new NeutronLoadBalancerListenerInterface();
108         ServiceRegistration<INeutronLoadBalancerListenerCRUD> neutronLoadBalancerListenerInterfaceRegistration = context.registerService(INeutronLoadBalancerListenerCRUD.class, neutronLoadBalancerListenerInterface, null);
109         if(neutronLoadBalancerListenerInterfaceRegistration != null) {
110             registrations.add(neutronLoadBalancerListenerInterfaceRegistration);
111         }
112
113         NeutronLoadBalancerHealthMonitorInterface neutronLoadBalancerHealthMonitorInterface = new NeutronLoadBalancerHealthMonitorInterface();
114         ServiceRegistration<INeutronLoadBalancerHealthMonitorCRUD> neutronLoadBalancerHealthMonitorInterfaceRegistration = context.registerService(INeutronLoadBalancerHealthMonitorCRUD.class, neutronLoadBalancerHealthMonitorInterface, null);
115         if(neutronLoadBalancerHealthMonitorInterfaceRegistration != null) {
116             registrations.add(neutronLoadBalancerHealthMonitorInterfaceRegistration);
117         }
118
119         NeutronLoadBalancerPoolMemberInterface neutronLoadBalancerPoolMemberInterface = new NeutronLoadBalancerPoolMemberInterface();
120         ServiceRegistration<INeutronLoadBalancerPoolMemberCRUD> neutronLoadBalancerPoolMemberInterfaceRegistration = context.registerService(INeutronLoadBalancerPoolMemberCRUD.class, neutronLoadBalancerPoolMemberInterface, null);
121         if(neutronLoadBalancerPoolMemberInterfaceRegistration != null) {
122             registrations.add(neutronLoadBalancerPoolMemberInterfaceRegistration);
123         }
124
125         NeutronMeteringLabelInterface neutronMeteringLabelInterface = new NeutronMeteringLabelInterface();
126         ServiceRegistration<INeutronMeteringLabelCRUD> neutronMeteringLabelInterfaceRegistration = context.registerService(INeutronMeteringLabelCRUD.class, neutronMeteringLabelInterface, null);
127         if(neutronMeteringLabelInterfaceRegistration != null) {
128             registrations.add(neutronMeteringLabelInterfaceRegistration);
129         }
130
131     }
132
133     @Override
134     public void stop(BundleContext context) throws Exception {
135        for(ServiceRegistration registration : registrations) {
136            if(registration != null) {
137                registration.unregister();
138            }
139        }
140
141     }
142 }