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 javax.management.ObjectName;
14 import org.opendaylight.openflowplugin.openflow.md.core.sal.OpenflowPluginProvider;
16 import com.google.common.base.MoreObjects;
21 public final class ConfigurableOpenFlowProviderModule extends org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflow.common.config.impl.rev140326.AbstractConfigurableOpenFlowProviderModule {
23 private OpenflowPluginProvider pluginProvider;
27 * @param dependencyResolver
29 public ConfigurableOpenFlowProviderModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
30 super(identifier, dependencyResolver);
35 * @param dependencyResolver
39 public ConfigurableOpenFlowProviderModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver,
40 ConfigurableOpenFlowProviderModule oldModule, java.lang.AutoCloseable oldInstance) {
42 super(identifier, dependencyResolver, oldModule, oldInstance);
46 protected void customValidation() {
47 // Add custom validation for module attributes here.
51 public java.lang.AutoCloseable createInstance() {
52 pluginProvider = new OpenflowPluginProvider();
53 pluginProvider.setBroker(getBindingAwareBrokerDependency());
54 pluginProvider.setSwitchConnectionProviders(getOpenflowSwitchConnectionProviderDependency());
55 pluginProvider.setRole(getRole());
56 pluginProvider.initialization();
57 return pluginProvider;
61 public boolean canReuseInstance(
62 AbstractConfigurableOpenFlowProviderModule oldModule) {
63 // we can reuse if only the role field changed
64 boolean noChangeExceptRole = true;
65 noChangeExceptRole &= dependencyResolver.canReuseDependency(
66 getBindingAwareBroker(), bindingAwareBrokerJmxAttribute);
67 for (ObjectName ofSwitchProvider : getOpenflowSwitchConnectionProvider()) {
68 noChangeExceptRole &= dependencyResolver.canReuseDependency(
69 ofSwitchProvider, openflowSwitchConnectionProviderJmxAttribute);
71 return noChangeExceptRole;
75 public AutoCloseable reuseInstance(AutoCloseable oldInstance) {
76 OpenflowPluginProvider recycled = (OpenflowPluginProvider) super.reuseInstance(oldInstance);
77 // change role if different
78 recycled.fireRoleChange(MoreObjects.firstNonNull(getRole(), getRole()));