import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
-import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RpcRegistration;
-import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
+import org.opendaylight.mdsal.binding.api.RpcProviderService;
+import org.opendaylight.yangtools.concepts.ObjectRegistration;
import org.opendaylight.yangtools.yang.binding.RpcService;
import org.osgi.framework.Bundle;
import org.osgi.service.blueprint.container.ComponentDefinitionException;
private static final Logger LOG = LoggerFactory.getLogger(RpcImplementationBean.class);
static final String RPC_IMPLEMENTATION = "rpc-implementation";
- private RpcProviderRegistry rpcRegistry;
+ private RpcProviderService rpcProvider;
private Bundle bundle;
private String interfaceName;
private RpcService implementation;
- private final List<RpcRegistration<RpcService>> rpcRegistrations = new ArrayList<>();
+ private final List<ObjectRegistration<RpcService>> rpcRegistrations = new ArrayList<>();
- public void setRpcRegistry(RpcProviderRegistry rpcRegistry) {
- this.rpcRegistry = rpcRegistry;
+ public void setRpcProvider(final RpcProviderService rpcProvider) {
+ this.rpcProvider = rpcProvider;
}
- public void setBundle(Bundle bundle) {
+ public void setBundle(final Bundle bundle) {
this.bundle = bundle;
}
- public void setInterfaceName(String interfaceName) {
+ public void setInterfaceName(final String interfaceName) {
this.interfaceName = interfaceName;
}
- public void setImplementation(RpcService implementation) {
+ public void setImplementation(final RpcService implementation) {
this.implementation = implementation;
}
implementation, rpcInterfaces);
for (Class<RpcService> rpcInterface : rpcInterfaces) {
- rpcRegistrations.add(rpcRegistry.addRpcImplementation(rpcInterface, implementation));
+ rpcRegistrations.add(rpcProvider.registerRpcImplementation(rpcInterface, implementation));
}
- } catch (ComponentDefinitionException e) {
+ } catch (final ComponentDefinitionException e) {
throw e;
- } catch (Exception e) {
+ } catch (final Exception e) {
throw new ComponentDefinitionException(String.format(
"Error processing \"%s\" for %s", RPC_IMPLEMENTATION, implementation.getClass()), e);
}
}
public void destroy() {
- for (RpcRegistration<RpcService> reg: rpcRegistrations) {
+ for (ObjectRegistration<RpcService> reg: rpcRegistrations) {
reg.close();
}
}
@SuppressWarnings("unchecked")
- static List<Class<RpcService>> getImplementedRpcServiceInterfaces(String interfaceName,
- Class<?> implementationClass, Bundle bundle, String logName) throws ClassNotFoundException {
+ static List<Class<RpcService>> getImplementedRpcServiceInterfaces(final String interfaceName,
+ final Class<?> implementationClass, final Bundle bundle, final String logName)
+ throws ClassNotFoundException {
if (!Strings.isNullOrEmpty(interfaceName)) {
Class<?> rpcInterface = bundle.loadClass(interfaceName);