Interface BindingAwareProvider
-
- All Known Implementing Classes:
AbstractBindingAwareProvider
@Deprecated(forRemoval=true) public interface BindingAwareProvider
Deprecated, for removal: This API element is subject to removal in a future version.A developer implemented component that gets registered with the Broker.Semantically, a provider may:
- Emit Notifications
- Provide the implementation of RPCs
- Write to the operational data tree
If a class is not doing at least one of those three, consider using a BindingAwareConsumer instead: see
BindingAwareConsumer
In addition, a BindingAwareProvider can in pursuit of its goals:
- Subscribe for Notifications
- Invoke RPCs
- Read from either the operational or config data tree
- Write to the config data tree
Examples:
To get a NotificationService:
public void onSessionInitiated(ProviderContext session) { NotificationProviderService notificationService = session.getSALService(NotificationProviderService.class); }
For more information on sending notifications via the NotificationProviderService seeNotificationProviderService
To register an RPC implementation:
public void onSessionInitiated(ProviderContext session) { RpcRegistration<MyService> registration = session.addRpcImplementation(MyService.class, myImplementationInstance); }
Where MyService.class is a Service interface generated from a yang model with RPCs modeled in it and myImplementationInstance is an instance of a class that implements MyService.
To register a Routed RPC Implementation:
public void onSessionInitiated(ProviderContext session) { RoutedRpcRegistration<SalFlowService> flowRegistration = session.addRoutedRpcImplementation(SalFlowService.class, salFlowServiceImplementationInstance); flowRegistration.registerPath(NodeContext.class, nodeInstanceId); }
Where SalFlowService.class is a Service interface generated from a yang model with RPCs modeled in it and salFlowServiceImplementationInstance is an instance of a class that implements SalFlowService.
The line:
flowRegistration.registerPath(NodeContext.class, nodeInstanceId);
Is indicating that the RPC implementation is registered to handle RPC invocations that have their NodeContext pointing to the node with instance id nodeInstanceId. This bears a bit of further explanation. RoutedRPCs can be 'routed' to an implementation based upon 'context'. 'context' is a pointer (instanceId) to some place in the data tree. In this example, the 'context' is a pointer to a Node. In this way, a provider can register its ability to provide a service for a particular Node, but not *all* Nodes. The Broker routes the RPC by 'context' to the correct implementation, without the caller having to do extra work. Because of this when a RoutedRPC is registered, it needs to also be able to indicate for which 'contexts' it is providing an implementation.An example of a Routed RPC would be an updateFlow(node, flow) that would be routed based on node to the provider which had registered to provide it *for that node*.
To get a DataBroker to allow access to the data tree:
public void onSessionInitiated(final ProviderContext session) { DataBroker databroker = session.getSALService(BindingDataBroker.class); }
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description void
onSessionInitiated(BindingAwareBroker.ProviderContext session)
Deprecated, for removal: This API element is subject to removal in a future version.Callback signaling initialization of the consumer session to the SAL.
-
-
-
Method Detail
-
onSessionInitiated
void onSessionInitiated(BindingAwareBroker.ProviderContext session)
Deprecated, for removal: This API element is subject to removal in a future version.Callback signaling initialization of the consumer session to the SAL.The consumer MUST use the session for all communication with SAL or retrieving SAL infrastructure services.
This method is invoked by
BindingAwareBroker.registerProvider(BindingAwareProvider)
- Parameters:
session
- Unique session between consumer and SAL.
-
-