Search in sources :

Example 1 with RpcProviderRegistry

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);
    }
}
Also used : ComponentDefinitionException(org.osgi.service.blueprint.container.ComponentDefinitionException) RpcService(org.opendaylight.yangtools.yang.binding.RpcService) RpcProviderRegistry(org.opendaylight.controller.sal.binding.api.RpcProviderRegistry) ComponentDefinitionException(org.osgi.service.blueprint.container.ComponentDefinitionException)

Example 2 with RpcProviderRegistry

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");
}
Also used : OdlMappingserviceService(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.OdlMappingserviceService) DataBroker(org.opendaylight.controller.md.sal.binding.api.DataBroker) RpcProviderRegistry(org.opendaylight.controller.sal.binding.api.RpcProviderRegistry)

Example 3 with RpcProviderRegistry

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;
}
Also used : RootBindingAwareBroker(org.opendaylight.controller.sal.binding.impl.RootBindingAwareBroker) Broker(org.opendaylight.controller.sal.core.api.Broker) BindingDOMRpcServiceAdapter(org.opendaylight.controller.md.sal.binding.impl.BindingDOMRpcServiceAdapter) BindingToNormalizedNodeCodec(org.opendaylight.controller.md.sal.binding.impl.BindingToNormalizedNodeCodec) ProviderSession(org.opendaylight.controller.sal.core.api.Broker.ProviderSession) HeliumRpcProviderRegistry(org.opendaylight.controller.md.sal.binding.compat.HeliumRpcProviderRegistry) BindingDOMRpcProviderServiceAdapter(org.opendaylight.controller.md.sal.binding.impl.BindingDOMRpcProviderServiceAdapter) MountPointService(org.opendaylight.controller.md.sal.binding.api.MountPointService) DOMMountPointService(org.opendaylight.controller.md.sal.dom.api.DOMMountPointService) RootBindingAwareBroker(org.opendaylight.controller.sal.binding.impl.RootBindingAwareBroker) RpcProviderRegistry(org.opendaylight.controller.sal.binding.api.RpcProviderRegistry) HeliumRpcProviderRegistry(org.opendaylight.controller.md.sal.binding.compat.HeliumRpcProviderRegistry)

Example 4 with RpcProviderRegistry

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();
}
Also used : ChannelFuture(io.netty.channel.ChannelFuture) RpcProviderRegistry(org.opendaylight.controller.sal.binding.api.RpcProviderRegistry)

Aggregations

RpcProviderRegistry (org.opendaylight.controller.sal.binding.api.RpcProviderRegistry)4 ChannelFuture (io.netty.channel.ChannelFuture)1 DataBroker (org.opendaylight.controller.md.sal.binding.api.DataBroker)1 MountPointService (org.opendaylight.controller.md.sal.binding.api.MountPointService)1 HeliumRpcProviderRegistry (org.opendaylight.controller.md.sal.binding.compat.HeliumRpcProviderRegistry)1 BindingDOMRpcProviderServiceAdapter (org.opendaylight.controller.md.sal.binding.impl.BindingDOMRpcProviderServiceAdapter)1 BindingDOMRpcServiceAdapter (org.opendaylight.controller.md.sal.binding.impl.BindingDOMRpcServiceAdapter)1 BindingToNormalizedNodeCodec (org.opendaylight.controller.md.sal.binding.impl.BindingToNormalizedNodeCodec)1 DOMMountPointService (org.opendaylight.controller.md.sal.dom.api.DOMMountPointService)1 RootBindingAwareBroker (org.opendaylight.controller.sal.binding.impl.RootBindingAwareBroker)1 Broker (org.opendaylight.controller.sal.core.api.Broker)1 ProviderSession (org.opendaylight.controller.sal.core.api.Broker.ProviderSession)1 OdlMappingserviceService (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.OdlMappingserviceService)1 RpcService (org.opendaylight.yangtools.yang.binding.RpcService)1 ComponentDefinitionException (org.osgi.service.blueprint.container.ComponentDefinitionException)1