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
8 * Do not modify this file unless it is present under src/main directory
10 package org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflow.common.config.impl.rev140326;
12 import org.opendaylight.openflowplugin.openflow.md.core.sal.OpenflowPluginProvider;
14 import com.google.common.base.Objects;
19 public final class ConfigurableOpenFlowProviderModule extends org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflow.common.config.impl.rev140326.AbstractConfigurableOpenFlowProviderModule {
21 private OpenflowPluginProvider pluginProvider;
25 * @param dependencyResolver
27 public ConfigurableOpenFlowProviderModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
28 super(identifier, dependencyResolver);
33 * @param dependencyResolver
37 public ConfigurableOpenFlowProviderModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver,
38 ConfigurableOpenFlowProviderModule oldModule, java.lang.AutoCloseable oldInstance) {
40 super(identifier, dependencyResolver, oldModule, oldInstance);
44 protected void customValidation() {
45 // Add custom validation for module attributes here.
49 public java.lang.AutoCloseable createInstance() {
50 pluginProvider = new OpenflowPluginProvider();
51 pluginProvider.setBroker(getBindingAwareBrokerDependency());
52 pluginProvider.setSwitchConnectionProviders(getOpenflowSwitchConnectionProviderDependency());
53 pluginProvider.setRole(getRole());
54 pluginProvider.initialization();
55 return pluginProvider;
59 public boolean canReuseInstance(
60 AbstractConfigurableOpenFlowProviderModule oldModule) {
61 // we can reuse if only the role field changed
62 boolean noChangeExceptRole = true;
63 noChangeExceptRole &= getBindingAwareBrokerDependency().equals(oldModule.getBindingAwareBrokerDependency());
64 noChangeExceptRole &= getOpenflowSwitchConnectionProviderDependency().equals(oldModule.getOpenflowSwitchConnectionProviderDependency());
65 return noChangeExceptRole;
69 public AutoCloseable reuseInstance(AutoCloseable oldInstance) {
70 OpenflowPluginProvider recycled = (OpenflowPluginProvider) super.reuseInstance(oldInstance);
71 // change role if different
72 recycled.fireRoleChange(Objects.firstNonNull(getRole(), getRole()));