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%2Fsal%2Fbinding%2Fimpl%2FBindingAwareBrokerImpl.xtend;h=9381a5a070e67e7c82226c5b920b06f9a952cc67;hb=25344a336764b540d4cbd7ce28151058af69049b;hp=1762aac090a0eac4a29cdac122d986298d773ec1;hpb=a9e05354c351d3d88457892e28e2f01993d53142;p=controller.git diff --git a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/BindingAwareBrokerImpl.xtend b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/BindingAwareBrokerImpl.xtend index 1762aac090..9381a5a070 100644 --- a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/BindingAwareBrokerImpl.xtend +++ b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/BindingAwareBrokerImpl.xtend @@ -48,8 +48,9 @@ import java.util.concurrent.locks.ReentrantLock import java.util.concurrent.Callable import java.util.WeakHashMap import javax.annotation.concurrent.GuardedBy +import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry -class BindingAwareBrokerImpl implements BindingAwareBroker, AutoCloseable { +class BindingAwareBrokerImpl implements BindingAwareBroker, RpcProviderRegistry, AutoCloseable { private static val log = LoggerFactory.getLogger(BindingAwareBrokerImpl) private InstanceIdentifier root = InstanceIdentifier.builder().toInstance(); @@ -188,22 +189,30 @@ class BindingAwareBrokerImpl implements BindingAwareBroker, AutoCloseable { * Registers RPC Implementation * */ - def registerRpcImplementation(Class type, T service, OsgiProviderContext context, - Hashtable properties) { + override addRpcImplementation(Class type, T service) { + checkNotNull(type, "Service type should not be null") + checkNotNull(service, "Service type should not be null") + val proxy = getManagedDirectProxy(type) checkState(proxy.delegate === null, "The Service for type %s is already registered", type) - val osgiReg = context.bundleContext.registerService(type, service, properties); proxy.delegate = service; - return new RpcServiceRegistrationImpl(type, service, osgiReg, this); + return new RpcServiceRegistrationImpl(type, service, this); } - def RoutedRpcRegistration registerRoutedRpcImplementation(Class type, T service, - OsgiProviderContext context) { + override RoutedRpcRegistration addRoutedRpcImplementation(Class type, T service) { + checkNotNull(type, "Service type should not be null") + checkNotNull(service, "Service type should not be null") + val router = resolveRpcRouter(type); checkState(router !== null) return new RoutedRpcRegistrationImpl(service, router, this) } + + override getRpcService(Class service) { + checkNotNull(service, "Service should not be null"); + return getManagedDirectProxy(service) as T; + } private def RpcRouter resolveRpcRouter(Class type) { @@ -357,16 +366,14 @@ class RoutedRpcRegistrationImpl extends AbstractObjectRegi class RpcServiceRegistrationImpl extends AbstractObjectRegistration implements RpcRegistration { - val ServiceRegistration osgiRegistration; private var BindingAwareBrokerImpl broker; @Property val Class serviceType; - public new(Class type, T service, ServiceRegistration osgiReg, BindingAwareBrokerImpl broker) { + public new(Class type, T service, BindingAwareBrokerImpl broker) { super(service); this._serviceType = type; - this.osgiRegistration = osgiReg; this.broker = broker; }