Bump to odlparent 2.0.0
[openflowplugin.git] / openflowplugin / src / main / java / org / opendaylight / yang / gen / v1 / urn / opendaylight / params / xml / ns / yang / openflow / common / config / impl / rev140326 / ConfigurableOpenFlowProviderModule.java
1 /**
2 * Generated file
3
4 * Generated from: yang module name: openflow-provider-impl  yang module local name: openflow-provider-impl
5 * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
6 * Generated at: Wed Apr 02 16:59:36 PDT 2014
7 *
8 * Do not modify this file unless it is present under src/main directory
9 */
10 package org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflow.common.config.impl.rev140326;
11
12 import java.util.Collection;
13 import org.opendaylight.controller.config.api.osgi.WaitingServiceTracker;
14 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
15 import org.opendaylight.controller.md.sal.common.api.clustering.EntityOwnershipService;
16 import org.opendaylight.controller.sal.binding.api.NotificationProviderService;
17 import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
18 import org.opendaylight.openflowjava.protocol.spi.connection.SwitchConnectionProvider;
19 import org.opendaylight.openflowplugin.api.openflow.statistics.MessageCountDumper;
20 import org.opendaylight.openflowplugin.extension.api.ExtensionConverterRegistrator;
21 import org.opendaylight.openflowplugin.openflow.md.core.sal.OpenflowPluginProvider;
22 import org.osgi.framework.BundleContext;
23
24 import org.slf4j.Logger;
25 import org.slf4j.LoggerFactory;
26
27 /**
28  * @deprecated Replaced by blueprint wiring
29  */
30 @Deprecated
31 public final class ConfigurableOpenFlowProviderModule extends org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflow.common.config.impl.rev140326.AbstractConfigurableOpenFlowProviderModule {
32
33     private static final Logger LOG = LoggerFactory.getLogger(ConfigurableOpenFlowProviderModule.class);
34
35     private BundleContext bundleContext;
36
37     /**
38      * @param identifier module identifier
39      * @param dependencyResolver dependency resolver
40      */
41     public ConfigurableOpenFlowProviderModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
42         super(identifier, dependencyResolver);
43     }
44
45     /**
46      * @param identifier module identifier
47      * @param dependencyResolver dependency resolver
48      * @param oldModule old module
49      * @param oldInstance old instance
50      */
51     public ConfigurableOpenFlowProviderModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver,
52             ConfigurableOpenFlowProviderModule oldModule, java.lang.AutoCloseable oldInstance) {
53
54         super(identifier, dependencyResolver, oldModule, oldInstance);
55     }
56
57     @Override
58     protected void customValidation() {
59         // Add custom validation for module attributes here.
60     }
61
62     @Override
63     public AutoCloseable createInstance() {
64         // The service is provided via blueprint so wait for and return it here for backwards compatibility.
65         String typeFilter = String.format("(type=%s)", getIdentifier().getInstanceName());
66         final WaitingServiceTracker<OpenflowPluginProvider> tracker = WaitingServiceTracker.create(
67                 OpenflowPluginProvider.class, bundleContext, typeFilter);
68         final OpenflowPluginProvider actualService = tracker.waitForService(WaitingServiceTracker.FIVE_MINUTES);
69
70         return new OpenflowPluginProvider() {
71             @Override
72             public void close() {
73                 // Don't close the actual service as its life cycle is controlled by blueprint.
74                 tracker.close();
75             }
76
77             @Override
78             public void initialization() {
79                 actualService.initialization();
80             }
81
82             @Override
83             public void setSwitchConnectionProviders(Collection<SwitchConnectionProvider> switchConnectionProvider) {
84                 actualService.setSwitchConnectionProviders(switchConnectionProvider);
85             }
86
87             @Override
88             public MessageCountDumper getMessageCountDumper() {
89                 return actualService.getMessageCountDumper();
90             }
91
92             @Override
93             public ExtensionConverterRegistrator getExtensionConverterRegistrator() {
94                 return actualService.getExtensionConverterRegistrator();
95             }
96
97             @Override
98             public void setRole(OfpRole role) {
99                 actualService.setRole(role);
100             }
101
102             @Override
103             public void setSkipTableFeatures(Boolean skipTableFeatures) {
104                 actualService.setSkipTableFeatures(skipTableFeatures);
105             }
106
107             @Override
108             public void fireRoleChange(OfpRole newRole) {
109                 actualService.fireRoleChange(newRole);
110             }
111
112             @Override
113             public void setDataBroker(DataBroker dataBroker) {
114                 actualService.setDataBroker(dataBroker);
115             }
116
117             @Override
118             public void setNotificationService(NotificationProviderService notificationService) {
119                 actualService.setNotificationService(notificationService);
120             }
121
122             @Override
123             public void setRpcRegistry(RpcProviderRegistry rpcRegistry) {
124                 actualService.setRpcRegistry(rpcRegistry);
125             }
126
127             @Override
128             public void setEntityOwnershipService(EntityOwnershipService entityOwnershipService) {
129                 actualService.setEntityOwnershipService(entityOwnershipService);
130             }
131         };
132     }
133
134     public void setBundleContext(BundleContext bundleContext) {
135         this.bundleContext = bundleContext;
136     }
137
138     @Override
139     public boolean canReuseInstance(AbstractConfigurableOpenFlowProviderModule oldModule) {
140         return true;
141     }
142
143 }