use of org.opendaylight.controller.sal.binding.api.RpcProviderRegistry in project controller by opendaylight.
the class RoutedRpcMetadata method create.
@SuppressWarnings("checkstyle:IllegalCatch")
@Override
public Object create() throws ComponentDefinitionException {
RpcProviderRegistry rpcRegistry = (RpcProviderRegistry) container.getComponentInstance(OpendaylightNamespaceHandler.RPC_REGISTRY_NAME);
Object implementation = container.getComponentInstance(implementationRefId);
try {
if (!RpcService.class.isAssignableFrom(implementation.getClass())) {
throw new ComponentDefinitionException(String.format("Implementation \"ref\" instance %s for \"%s\" is not an RpcService", implementation.getClass(), ROUTED_RPC_IMPLEMENTATION));
}
List<Class<RpcService>> rpcInterfaces = RpcImplementationBean.getImplementedRpcServiceInterfaces(interfaceName, implementation.getClass(), container.getBundleContext().getBundle(), ROUTED_RPC_IMPLEMENTATION);
if (rpcInterfaces.size() > 1) {
throw new ComponentDefinitionException(String.format("Implementation \"ref\" instance %s for \"%s\" implements more than one RpcService " + "interface (%s). Please specify the exact \"interface\"", implementation.getClass(), ROUTED_RPC_IMPLEMENTATION, rpcInterfaces));
}
Class<RpcService> rpcInterface = rpcInterfaces.iterator().next();
LOG.debug("{}: create - adding routed implementation {} for RpcService {}", logName(), implementation, rpcInterface);
return rpcRegistry.addRoutedRpcImplementation(rpcInterface, (RpcService) implementation);
} catch (final ComponentDefinitionException e) {
throw e;
} catch (final Exception e) {
throw new ComponentDefinitionException(String.format("Error processing \"%s\" for %s", ROUTED_RPC_IMPLEMENTATION, implementation.getClass()), e);
}
}
use of org.opendaylight.controller.sal.binding.api.RpcProviderRegistry in project lispflowmapping by opendaylight.
the class LispNeutronService method onSessionInitiated.
@Override
public void onSessionInitiated(ProviderContext session) {
LOG.info("LFMDBSERVICE IS BEING FILLED! SESSION INITIATED");
RpcProviderRegistry rpcRegistry = session.getSALService(RpcProviderRegistry.class);
lfmDbService = rpcRegistry.getRpcService(OdlMappingserviceService.class);
broker = session.getSALService(DataBroker.class);
HostInformationManager.getInstance().setOdlMappingserviceService(lfmDbService);
DelegatingDataTreeListener.initiateListener(Network.class, this, broker);
DelegatingDataTreeListener.initiateListener(Subnet.class, this, broker);
DelegatingDataTreeListener.initiateListener(Port.class, this, broker);
LOG.debug("LFMDBSERVICE was FILLED! SESSION INITIATED");
}
use of org.opendaylight.controller.sal.binding.api.RpcProviderRegistry in project controller by opendaylight.
the class BindingBrokerImplModule method createInstance.
@Override
public RootBindingAwareBroker createInstance() {
final Broker domBroker = getDomAsyncBrokerDependency();
final BindingToNormalizedNodeCodec codec = getBindingMappingServiceDependency();
final ProviderSession session = domBroker.registerProvider(new DummyDOMProvider());
final MountPointService mount = createMountPointAdapter(codec, session);
final BindingDOMRpcServiceAdapter rpcConsumer = createRpcConsumer(codec, session);
final BindingDOMRpcProviderServiceAdapter rpcProvider = createRpcProvider(codec, session);
final RootBindingAwareBroker broker = new RootBindingAwareBroker(getIdentifier().getInstanceName());
final RpcProviderRegistry heliumRpcBroker = new HeliumRpcProviderRegistry(rpcConsumer, rpcProvider);
broker.setNotificationBroker(getNotificationServiceDependency());
if (getNotificationPublishServiceDependency() != null) {
broker.setNotificationPublishService(getNotificationPublishServiceDependency());
}
broker.setRpcBroker(heliumRpcBroker);
broker.setDataBroker(getRootDataBrokerDependency());
broker.setMountService(mount);
broker.start();
return broker;
}
use of org.opendaylight.controller.sal.binding.api.RpcProviderRegistry in project bgpcep by opendaylight.
the class PCEPTopologyProvider method instantiateServiceInstance.
public void instantiateServiceInstance() throws ExecutionException, InterruptedException {
final RpcProviderRegistry rpcRegistry = this.dependenciesProvider.getRpcProviderRegistry();
this.element = requireNonNull(rpcRegistry.addRoutedRpcImplementation(NetworkTopologyPcepService.class, new TopologyRPCs(this.manager)));
this.element.registerPath(NetworkTopologyContext.class, this.configDependencies.getTopology());
this.network = requireNonNull(rpcRegistry.addRoutedRpcImplementation(NetworkTopologyPcepProgrammingService.class, new TopologyProgramming(this.scheduler, this.manager)));
this.network.registerPath(NetworkTopologyContext.class, this.configDependencies.getTopology());
this.manager.instantiateServiceInstance();
final ChannelFuture channelFuture = this.dependenciesProvider.getPCEPDispatcher().createServer(this.manager.getPCEPDispatcherDependencies());
channelFuture.get();
this.channel = channelFuture.channel();
}
Aggregations