<name>runtime-mapping-singleton</name>
</binding-mapping-service>
</module>
+ <module>
+ <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding:impl">prefix:binding-forwarded-data-broker</type>
+ <name>binding-async-data-broker</name>
+ <binding-forwarded-data-broker xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding:impl">
+ <dom-async-broker>
+ <type xmlns:dom="urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom">dom:dom-broker-osgi-registry</type>
+ <name>dom-broker</name>
+ </dom-async-broker>
+ <binding-mapping-service>
+ <type xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding:impl">binding:binding-dom-mapping-service</type>
+ <name>runtime-mapping-singleton</name>
+ </binding-mapping-service>
+ </binding-forwarded-data-broker>
+ </module>
</modules>
<services xmlns="urn:opendaylight:params:xml:ns:yang:controller:config">
<service>
</instance>
</service>
+ <service>
+ <type xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">binding:binding-async-data-broker</type>
+ <instance>
+ <name>binding-data-broker</name>
+ <provider>/modules/module[type='binding-forwarded-data-broker'][name='binding-async-data-broker']</provider>
+ </instance>
+ </service>
+
<service>
<type xmlns:dom="urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom">dom:dom-async-data-broker</type>
<instance>
import org.opendaylight.yangtools.yang.binding.DataObject;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-public interface BindingDataBroker extends AsyncDataBroker<InstanceIdentifier<?>, DataObject, BindingDataChangeListener>{
+public interface BindingDataBroker extends AsyncDataBroker<InstanceIdentifier<?>, DataObject, BindingDataChangeListener>, BindingService {
@Override
BindingDataReadTransaction newReadOnlyTransaction();
--- /dev/null
+/*
+ * 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
+ */
+package org.opendaylight.controller.md.sal.binding.api;
+
+import org.opendaylight.controller.sal.binding.api.BindingAwareService;
+
+/**
+ *
+ * Marker interface for MD-SAL services which are available for users of MD-SAL.
+ *
+ * BindingService is marker interface for infrastructure services provided by
+ * the SAL. These services may be session-specific, and wrapped by custom
+ * delegator patterns in order to introduce additional semantics / checks
+ * to the system.
+ *
+ * This interface extends {@link BindingAwareService}, order to be make
+ * new services available via
+ * {@link org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext}
+ * and via
+ * {@link org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ConsumerContext}
+ *
+ */
+public interface BindingService extends BindingAwareService {
+
+}
org.opendaylight.controller.md.sal.binding.impl,
<!--org.opendaylight.controller.sal.binding.dom.*,-->
org.opendaylight.controller.sal.binding.osgi.*,
- org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.binding.impl.rev131028
+ org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.binding.impl.rev131028.*
</Private-Package>
</instructions>
</configuration>
--- /dev/null
+package org.opendaylight.controller.config.yang.md.sal.binding.impl;
+
+import java.util.Collection;
+import java.util.Collections;
+
+import org.opendaylight.controller.md.sal.binding.impl.ForwardedBindingDataBroker;
+import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker;
+import org.opendaylight.controller.sal.core.api.Broker;
+import org.opendaylight.controller.sal.core.api.Broker.ProviderSession;
+import org.opendaylight.controller.sal.core.api.Provider;
+import org.opendaylight.controller.sal.core.api.model.SchemaService;
+import org.opendaylight.yangtools.yang.data.impl.codec.BindingIndependentMappingService;
+import org.osgi.framework.BundleContext;
+
+public class BindingAsyncDataBrokerImplModule extends
+ org.opendaylight.controller.config.yang.md.sal.binding.impl.AbstractBindingAsyncDataBrokerImplModule implements
+ Provider {
+ private BundleContext bundleContext;
+
+ public BindingAsyncDataBrokerImplModule(final org.opendaylight.controller.config.api.ModuleIdentifier identifier,
+ final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
+ super(identifier, dependencyResolver);
+ }
+
+ public BindingAsyncDataBrokerImplModule(
+ final org.opendaylight.controller.config.api.ModuleIdentifier identifier,
+ final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver,
+ final org.opendaylight.controller.config.yang.md.sal.binding.impl.BindingAsyncDataBrokerImplModule oldModule,
+ final java.lang.AutoCloseable oldInstance) {
+ super(identifier, dependencyResolver, oldModule, oldInstance);
+ }
+
+ @Override
+ public void customValidation() {
+ // add custom validation form module attributes here.
+ }
+
+ @Override
+ public java.lang.AutoCloseable createInstance() {
+ Broker domBroker = getDomAsyncBrokerDependency();
+ BindingIndependentMappingService mappingService = getBindingMappingServiceDependency();
+
+ // FIXME: Switch this to DOM Broker registration which would not require
+ // BundleContext when API are updated.
+ ProviderSession session = domBroker.registerProvider(this, getBundleContext());
+ DOMDataBroker domDataBroker = session.getService(DOMDataBroker.class);
+ SchemaService schemaService = session.getService(SchemaService.class);
+ return new ForwardedBindingDataBroker(domDataBroker, mappingService, schemaService);
+ }
+
+ // FIXME: Remove this when DOM Broker registration would not require
+ // BundleContext
+ @Deprecated
+ private BundleContext getBundleContext() {
+ return bundleContext;
+ }
+
+ // FIXME: Remove this when DOM Broker registration would not require
+ // BundleContext
+ @Deprecated
+ void setBundleContext(final BundleContext bundleContext) {
+ this.bundleContext = bundleContext;
+ }
+
+ @Override
+ public Collection<ProviderFunctionality> getProviderFunctionality() {
+ return Collections.emptySet();
+ }
+
+ @Override
+ public void onSessionInitiated(final ProviderSession arg0) {
+ // intentional NOOP
+ }
+
+}
--- /dev/null
+/*
+* Generated file
+*
+* Generated from: yang module name: opendaylight-sal-binding-broker-impl yang module local name: binding-forwarded-data-broker
+* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+* Generated at: Fri May 16 17:18:18 CEST 2014
+*
+* 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.config.api.DependencyResolver;
+import org.osgi.framework.BundleContext;
+
+public class BindingAsyncDataBrokerImplModuleFactory extends org.opendaylight.controller.config.yang.md.sal.binding.impl.AbstractBindingAsyncDataBrokerImplModuleFactory {
+
+
+
+
+ @Override
+ public BindingAsyncDataBrokerImplModule instantiateModule(final String instanceName,
+ final DependencyResolver dependencyResolver, final BindingAsyncDataBrokerImplModule oldModule,
+ final AutoCloseable oldInstance, final BundleContext bundleContext) {
+ BindingAsyncDataBrokerImplModule module = super.instantiateModule(instanceName, dependencyResolver, oldModule, oldInstance, bundleContext);
+ module.setBundleContext(bundleContext);
+ return module;
+ }
+
+ @Override
+ public BindingAsyncDataBrokerImplModule instantiateModule(final String instanceName,
+ final DependencyResolver dependencyResolver, final BundleContext bundleContext) {
+ // TODO Auto-generated method stub
+ BindingAsyncDataBrokerImplModule module = super.instantiateModule(instanceName, dependencyResolver, bundleContext);
+ module.setBundleContext(bundleContext);
+ return module;
+ }
+}
\r
private BundleContext bundleContext;\r
\r
- public BindingBrokerImplModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier,\r
- org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {\r
+ public BindingBrokerImplModule(final org.opendaylight.controller.config.api.ModuleIdentifier identifier,\r
+ final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {\r
super(identifier, dependencyResolver);\r
}\r
\r
- public BindingBrokerImplModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier,\r
- org.opendaylight.controller.config.api.DependencyResolver dependencyResolver,\r
- BindingBrokerImplModule oldModule, java.lang.AutoCloseable oldInstance) {\r
+ public BindingBrokerImplModule(final org.opendaylight.controller.config.api.ModuleIdentifier identifier,\r
+ final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver,\r
+ final BindingBrokerImplModule oldModule, final java.lang.AutoCloseable oldInstance) {\r
super(identifier, dependencyResolver, oldModule, oldInstance);\r
}\r
\r
private RootBindingAwareBroker createStandaloneBroker() {\r
RootBindingAwareBroker broker = new RootBindingAwareBroker(getIdentifier().getInstanceName());\r
\r
- broker.setDataBroker(getDataBrokerDependency());\r
+ broker.setLegacyDataBroker(getDataBrokerDependency());\r
broker.setNotificationBroker(getNotificationServiceDependency());\r
broker.setRpcBroker(new RpcProviderRegistryImpl(broker.getIdentifier()));\r
+ // FIXME: Also set Async Data Broker\r
return broker;\r
}\r
\r
private RootBindingAwareBroker createForwardedBroker() {\r
DomForwardedBindingBrokerImpl broker = new DomForwardedBindingBrokerImpl(getIdentifier().getInstanceName());\r
\r
- broker.setDataBroker(getDataBrokerDependency());\r
+ broker.setLegacyDataBroker(getDataBrokerDependency());\r
broker.setNotificationBroker(getNotificationServiceDependency());\r
broker.setRpcBroker(new RpcProviderRegistryImpl(broker.getIdentifier()));\r
\r
broker.getMountManager().setDataCommitExecutor(SingletonHolder.getDefaultCommitExecutor());\r
broker.getMountManager().setNotificationExecutor(SingletonHolder.getDefaultNotificationExecutor());\r
\r
-\r
+ // FIXME: Also set Async Data Broker\r
DomForwardingUtils.reuseForwardingFrom(broker, broker.getDataBroker());\r
broker.startForwarding();\r
return broker;\r
return bundleContext;\r
}\r
\r
- public void setBundleContext(BundleContext bundleContext) {\r
+ public void setBundleContext(final BundleContext bundleContext) {\r
this.bundleContext = bundleContext;\r
}\r
}\r
import org.opendaylight.yangtools.yang.binding.util.ClassLoaderUtils
import static extension org.opendaylight.controller.sal.binding.codegen.RuntimeCodeSpecification.*
+import org.opendaylight.yangtools.yang.binding.RpcService
class RuntimeCodeGenerator extends AbstractRuntimeCodeGenerator {
val proxyName = iface.directProxyName;
val potentialClass = ClassLoaderUtils.tryToLoadClassWithTCCL(proxyName)
if(potentialClass != null) {
- return potentialClass.newInstance;
+ return potentialClass.newInstance as RpcService;
}
val supertype = iface.asCtClass
val createdCls = createClass(iface.directProxyName, supertype) [
'''
]
]
- return createdCls.toClass(iface.classLoader).newInstance
+ return createdCls.toClass(iface.classLoader).newInstance as RpcService
]
}
val routerName = iface.routerName;
val potentialClass = ClassLoaderUtils.tryToLoadClassWithTCCL(routerName)
if(potentialClass != null) {
- return potentialClass.newInstance;
+ return potentialClass.newInstance as RpcService;
}
val targetCls = createClass(iface.routerName, supertype) [
'''
]
]
- return targetCls.toClass(iface.classLoader,iface.protectionDomain).newInstance
+ return targetCls.toClass(iface.classLoader,iface.protectionDomain).newInstance as RpcService
];
}
*/
package org.opendaylight.controller.sal.binding.impl;
-import com.google.common.collect.ImmutableClassToInstanceMap;
+import static com.google.common.base.Preconditions.checkState;
+
+import org.opendaylight.controller.md.sal.binding.api.BindingDataBroker;
import org.opendaylight.controller.md.sal.binding.util.AbstractBindingSalProviderInstance;
import org.opendaylight.controller.md.sal.binding.util.BindingContextUtils;
import org.opendaylight.controller.md.sal.common.api.routing.RouteChangeListener;
import org.osgi.framework.BundleContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import static com.google.common.base.Preconditions.checkState;
+
+import com.google.common.collect.ImmutableClassToInstanceMap;
public class RootBindingAwareBroker implements //
Mutable, //
Identifiable<String>, //
- BindingAwareBroker, AutoCloseable,
- RpcProviderRegistry {
+ BindingAwareBroker, AutoCloseable, RpcProviderRegistry {
private final static Logger LOG = LoggerFactory.getLogger(RootBindingAwareBroker.class);
private NotificationProviderService notificationBroker;
- private DataProviderService dataBroker;
+ private DataProviderService legacyDataBroker;
+
+ private BindingDataBroker dataBroker;
private MountPointManagerImpl mountManager;
return mountManager;
}
- public void setMountManager(MountPointManagerImpl mountManager) {
+ public void setMountManager(final MountPointManagerImpl mountManager) {
this.mountManager = mountManager;
}
private ImmutableClassToInstanceMap<BindingAwareService> supportedProviderServices;
- public RootBindingAwareBroker(String instanceName) {
+ public RootBindingAwareBroker(final String instanceName) {
this.identifier = instanceName;
mountManager = new MountPointManagerImpl();
}
+ @Override
public String getIdentifier() {
return identifier;
}
}
public DataProviderService getDataBroker() {
- return this.dataBroker;
+ return this.legacyDataBroker;
}
public NotificationProviderService getNotificationBroker() {
return rpcBroker;
}
- public void setRpcBroker(RpcProviderRegistry rpcBroker) {
+ public void setRpcBroker(final RpcProviderRegistry rpcBroker) {
this.rpcBroker = rpcBroker;
}
- public void setNotificationBroker(NotificationProviderService notificationBroker) {
+ public void setNotificationBroker(final NotificationProviderService notificationBroker) {
this.notificationBroker = notificationBroker;
}
- public void setDataBroker(DataProviderService dataBroker) {
- this.dataBroker = dataBroker;
+ public void setLegacyDataBroker(final DataProviderService dataBroker) {
+ this.legacyDataBroker = dataBroker;
}
public void start() {
controllerRoot = new RootSalInstance(getRpcProviderRegistry(), getNotificationBroker(), getDataBroker());
+ ImmutableClassToInstanceMap.Builder<BindingAwareService> consBuilder = ImmutableClassToInstanceMap.builder();
- supportedConsumerServices = ImmutableClassToInstanceMap.<BindingAwareService> builder()
- .put(NotificationService.class, getRoot()) //
- .put(DataBrokerService.class, getRoot()) //
- .put(RpcConsumerRegistry.class, getRoot()) //
- .put(MountService.class, mountManager).build();
-
+ consBuilder.put(NotificationService.class, getRoot());
+ consBuilder.put(DataBrokerService.class, getRoot());
+ consBuilder.put(RpcConsumerRegistry.class, getRoot());
+ if(dataBroker != null) {
+ consBuilder.put(BindingDataBroker.class, dataBroker);
+ }
+ consBuilder.put(MountService.class, mountManager).build();
+ supportedConsumerServices = consBuilder.build();
supportedProviderServices = ImmutableClassToInstanceMap.<BindingAwareService> builder()
- .putAll(supportedConsumerServices)
- .put(NotificationProviderService.class, getRoot()) //
- .put(DataProviderService.class, getRoot()) //
- .put(RpcProviderRegistry.class, getRoot()) //
+ .putAll(supportedConsumerServices).put(NotificationProviderService.class, getRoot())
+ .put(DataProviderService.class, getRoot()).put(RpcProviderRegistry.class, getRoot())
.put(MountProviderService.class, mountManager).build();
}
@Override
- public ConsumerContext registerConsumer(BindingAwareConsumer consumer, BundleContext ctx) {
+ public ConsumerContext registerConsumer(final BindingAwareConsumer consumer, final BundleContext ctx) {
checkState(supportedConsumerServices != null, "Broker is not initialized.");
return BindingContextUtils.createConsumerContextAndInitialize(consumer, supportedConsumerServices);
}
@Override
- public ProviderContext registerProvider(BindingAwareProvider provider, BundleContext ctx) {
+ public ProviderContext registerProvider(final BindingAwareProvider provider, final BundleContext ctx) {
checkState(supportedProviderServices != null, "Broker is not initialized.");
return BindingContextUtils.createProviderContextAndInitialize(provider, supportedProviderServices);
}
}
@Override
- public <T extends RpcService> RoutedRpcRegistration<T> addRoutedRpcImplementation(Class<T> type, T implementation)
- throws IllegalStateException {
+ public <T extends RpcService> RoutedRpcRegistration<T> addRoutedRpcImplementation(final Class<T> type,
+ final T implementation) throws IllegalStateException {
return getRoot().addRoutedRpcImplementation(type, implementation);
}
@Override
- public <T extends RpcService> RpcRegistration<T> addRpcImplementation(Class<T> type, T implementation)
+ public <T extends RpcService> RpcRegistration<T> addRpcImplementation(final Class<T> type, final T implementation)
throws IllegalStateException {
return getRoot().addRpcImplementation(type, implementation);
}
@Override
- public <T extends RpcService> T getRpcService(Class<T> module) {
+ public <T extends RpcService> T getRpcService(final Class<T> module) {
return getRoot().getRpcService(module);
}
+
@Override
public <L extends RouteChangeListener<RpcContextIdentifier, InstanceIdentifier<?>>> ListenerRegistration<L> registerRouteChangeListener(
- L arg0) {
+ final L arg0) {
return getRoot().registerRouteChangeListener(arg0);
}
-
public class RootSalInstance extends
AbstractBindingSalProviderInstance<DataProviderService, NotificationProviderService, RpcProviderRegistry> {
- public RootSalInstance(RpcProviderRegistry rpcRegistry, NotificationProviderService notificationBroker,
- DataProviderService dataBroker) {
+ public RootSalInstance(final RpcProviderRegistry rpcRegistry,
+ final NotificationProviderService notificationBroker, final DataProviderService dataBroker) {
super(rpcRegistry, notificationBroker, dataBroker);
}
}
+
+ public void setDataBroker(final BindingDataBroker asyncDataBroker) {
+ dataBroker = asyncDataBroker;
+ }
}
config:provided-service sal:binding-data-consumer-broker;
config:java-name-prefix ForwardedCompatibleDataBrokerImpl;
}
+
+ identity binding-forwarded-data-broker {
+ base config:module-type;
+ config:provided-service sal:binding-async-data-broker;
+ config:java-name-prefix BindingAsyncDataBrokerImpl;
+ }
identity binding-rpc-broker {
base config:module-type;
config:java-name-prefix RuntimeMapping;
}
+ grouping dom-forwarding-component {
+ container dom-async-broker {
+ uses config:service-ref {
+ refine type {
+ mandatory true;
+ config:required-identity dom:dom-broker-osgi-registry;
+ }
+ }
+ }
+
+ container binding-mapping-service {
+ uses config:service-ref {
+ refine type {
+ mandatory true;
+ config:required-identity binding-dom-mapping-service;
+ }
+ }
+ }
+ }
+
augment "/config:modules/config:module/config:configuration" {
case binding-broker-impl {
when "/config:modules/config:module/config:type = 'binding-broker-impl'";
case binding-data-compatible-broker {
when "/config:modules/config:module/config:type = 'binding-data-compatible-broker'";
- container dom-async-broker {
- uses config:service-ref {
- refine type {
- mandatory true;
- config:required-identity dom:dom-broker-osgi-registry;
- }
- }
- }
-
- container binding-mapping-service {
- uses config:service-ref {
- refine type {
- mandatory true;
- config:required-identity binding-dom-mapping-service;
- }
- }
+ uses dom-forwarding-component;
+ }
+ }
+
+ augment "/config:modules/config:module/config:configuration" {
+ case binding-forwarded-data-broker {
+ when "/config:modules/config:module/config:type = 'binding-forwarded-data-broker'";
+ container binding-forwarded-data-broker {
+ uses dom-forwarding-component;
}
}
}
baBrokerImpl.getMountManager().setDataCommitExecutor(executor);
baBrokerImpl.getMountManager().setNotificationExecutor(executor);
baBrokerImpl.setRpcBroker(new RpcProviderRegistryImpl("test"));
- baBrokerImpl.setDataBroker(baData);
+ baBrokerImpl.setLegacyDataBroker(baData);
baBrokerImpl.setNotificationBroker(baNotifyImpl);
baBrokerImpl.start();
}
base "config:service-type";
config:java-class "org.opendaylight.controller.sal.binding.api.data.DataProviderService";
}
+
+ identity binding-async-data-broker {
+ base "config:service-type";
+ config:java-class "org.opendaylight.controller.md.sal.binding.api.BindingDataBroker";
+ }
identity binding-data-consumer-broker {
base "config:service-type";