X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-binding-broker%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fconfig%2Fyang%2Fmd%2Fsal%2Fbinding%2Fimpl%2FBindingBrokerImplModule.java;h=44a508c0a0bd2561c20517323f47735479688611;hb=589b6309f5356e92b10a66ccc0fc302b0289dbd0;hp=bce1f61cf5a20bfa936c0adac55f5c159533eed3;hpb=287dad5e6d7196591f25af5bddd8b28c7b067304;p=controller.git diff --git a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/binding/impl/BindingBrokerImplModule.java b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/binding/impl/BindingBrokerImplModule.java index bce1f61cf5..44a508c0a0 100644 --- a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/binding/impl/BindingBrokerImplModule.java +++ b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/binding/impl/BindingBrokerImplModule.java @@ -1,52 +1,95 @@ -/** -* Generated file - -* Generated from: yang module name: opendaylight-sal-binding-broker-impl yang module local name: binding-broker-impl -* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator -* Generated at: Wed Nov 20 17:33:01 CET 2013 -* -* Do not modify this file unless it is present under src/main directory -*/ -package org.opendaylight.controller.config.yang.md.sal.binding.impl; - -import org.opendaylight.controller.sal.binding.impl.BindingAwareBrokerImpl; -import org.osgi.framework.BundleContext; - -/** -* -*/ -public final class BindingBrokerImplModule extends org.opendaylight.controller.config.yang.md.sal.binding.impl.AbstractBindingBrokerImplModule { - - private BundleContext bundleContext; - - public BindingBrokerImplModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) { - super(identifier, dependencyResolver); - } - - public BindingBrokerImplModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, BindingBrokerImplModule oldModule, java.lang.AutoCloseable oldInstance) { - super(identifier, dependencyResolver, oldModule, oldInstance); - } - - @Override - public void validate(){ - super.validate(); - // Add custom validation for module attributes here. - } - - @Override - public java.lang.AutoCloseable createInstance() { - BindingAwareBrokerImpl broker = new BindingAwareBrokerImpl(getBundleContext()); - broker.setDataBroker(getDataBrokerDependency()); - broker.setNotifyBroker(getNotificationServiceDependency()); - broker.start(); - return broker; - } - - public BundleContext getBundleContext() { - return bundleContext; - } - - public void setBundleContext(BundleContext bundleContext) { - this.bundleContext = bundleContext; - } -} +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ +/** + * Generated file + + * Generated from: yang module name: opendaylight-sal-binding-broker-impl yang module local name: binding-broker-impl + * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator + * Generated at: Wed Nov 20 17:33:01 CET 2013 + * + * Do not modify this file unless it is present under src/main directory + */ +package org.opendaylight.controller.config.yang.md.sal.binding.impl; + +import org.opendaylight.controller.sal.binding.codegen.impl.SingletonHolder; +import org.opendaylight.controller.sal.binding.impl.RootBindingAwareBroker; +import org.opendaylight.controller.sal.binding.impl.RpcProviderRegistryImpl; +import org.opendaylight.controller.sal.binding.impl.forward.DomForwardedBindingBrokerImpl; +import org.opendaylight.controller.sal.binding.impl.forward.DomForwardingUtils; +import org.osgi.framework.BundleContext; + +/** +* +*/ +public final class BindingBrokerImplModule extends + org.opendaylight.controller.config.yang.md.sal.binding.impl.AbstractBindingBrokerImplModule { + + private BundleContext bundleContext; + + public BindingBrokerImplModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, + org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) { + super(identifier, dependencyResolver); + } + + public BindingBrokerImplModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, + org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, + BindingBrokerImplModule oldModule, java.lang.AutoCloseable oldInstance) { + super(identifier, dependencyResolver, oldModule, oldInstance); + } + + @Override + public void validate() { + super.validate(); + } + + @Override + public java.lang.AutoCloseable createInstance() { + + RootBindingAwareBroker broker; + if (DomForwardingUtils.isDomForwardedBroker(getDataBrokerDependency())) { + broker = createForwardedBroker(); + } else { + broker = createStandaloneBroker(); + } + broker.start(); + return broker; + } + + private RootBindingAwareBroker createStandaloneBroker() { + RootBindingAwareBroker broker = new RootBindingAwareBroker(getIdentifier().getInstanceName()); + + broker.setDataBroker(getDataBrokerDependency()); + broker.setNotificationBroker(getNotificationServiceDependency()); + broker.setRpcBroker(new RpcProviderRegistryImpl(broker.getIdentifier())); + return broker; + } + + private RootBindingAwareBroker createForwardedBroker() { + DomForwardedBindingBrokerImpl broker = new DomForwardedBindingBrokerImpl(getIdentifier().getInstanceName()); + + broker.setDataBroker(getDataBrokerDependency()); + broker.setNotificationBroker(getNotificationServiceDependency()); + broker.setRpcBroker(new RpcProviderRegistryImpl(broker.getIdentifier())); + + broker.getMountManager().setDataCommitExecutor(SingletonHolder.getDefaultCommitExecutor()); + broker.getMountManager().setNotificationExecutor(SingletonHolder.getDefaultNotificationExecutor()); + + + DomForwardingUtils.reuseForwardingFrom(broker, broker.getDataBroker()); + broker.startForwarding(); + return broker; + } + + public BundleContext getBundleContext() { + return bundleContext; + } + + public void setBundleContext(BundleContext bundleContext) { + this.bundleContext = bundleContext; + } +}