1 package org.opendaylight.controller.sal.dom.broker
3 import org.opendaylight.controller.sal.core.api.Broker.ProviderSession
4 import org.opendaylight.controller.sal.core.api.Provider
5 import org.opendaylight.yangtools.yang.common.QName
6 import org.opendaylight.controller.sal.core.api.RpcImplementation
7 import org.osgi.framework.BundleContext
8 import static java.util.Collections.*
9 import java.util.Collections
10 import java.util.HashMap
12 class ProviderContextImpl extends ConsumerContextImpl implements ProviderSession {
15 private val Provider provider;
17 private val rpcImpls = Collections.synchronizedMap(new HashMap<QName, RpcImplementation>());
19 new(Provider provider, BundleContext ctx) {
21 this._provider = provider;
24 override addRpcImplementation(QName rpcType, RpcImplementation implementation) throws IllegalArgumentException {
26 throw new IllegalArgumentException("rpcType must not be null");
28 if(implementation == null) {
29 throw new IllegalArgumentException("Implementation must not be null");
31 broker.addRpcImplementation(rpcType, implementation);
32 rpcImpls.put(rpcType, implementation);
33 //FIXME: Return registration
37 def removeRpcImplementation(QName rpcType, RpcImplementation implToRemove) throws IllegalArgumentException {
38 val localImpl = rpcImpls.get(rpcType);
39 if(localImpl != implToRemove) {
40 throw new IllegalStateException(
41 "Implementation was not registered in this session");
44 broker.removeRpcImplementation(rpcType, implToRemove);
45 rpcImpls.remove(rpcType);
48 override addMountedRpcImplementation(QName rpcType, RpcImplementation implementation) {
49 throw new UnsupportedOperationException("TODO: auto-generated method stub")
52 override addRoutedRpcImplementation(QName rpcType, RpcImplementation implementation) {
53 throw new UnsupportedOperationException("TODO: auto-generated method stub")