Closing an RPC registration is an atomic act, e.g. it should never be
allowed to throw exceptions.
Change-Id: Ie49c67691540db4d4a8a21814e01d3287c5f31cd
Signed-off-by: Robert Varga <rovarga@cisco.com>
/**
* Core component of the SAL layer responsible for wiring the SAL consumers.
/**
* Core component of the SAL layer responsible for wiring the SAL consumers.
* The responsibility of the broker is to maintain registration of SAL
* functionality {@link Consumer}s and {@link Provider}s, store provider and
* consumer specific context and functionality registration via
* {@link ConsumerSession} and provide access to infrastructure services, which
* removes direct dependencies between providers and consumers.
* The responsibility of the broker is to maintain registration of SAL
* functionality {@link Consumer}s and {@link Provider}s, store provider and
* consumer specific context and functionality registration via
* {@link ConsumerSession} and provide access to infrastructure services, which
* removes direct dependencies between providers and consumers.
* <h3>Infrastructure services</h3> Some examples of infrastructure services:
* <h3>Infrastructure services</h3> Some examples of infrastructure services:
* <ul>
* <li>RPC Invocation - see {@link ConsumerSession#rpc(QName, CompositeNode)},
* {@link ProviderSession#addRpcImplementation(QName, RpcImplementation)} and
* <ul>
* <li>RPC Invocation - see {@link ConsumerSession#rpc(QName, CompositeNode)},
* {@link ProviderSession#addRpcImplementation(QName, RpcImplementation)} and
* <li>Data Store access and modification - see {@link DataBrokerService} and
* {@link DataProviderService}
* </ul>
* <li>Data Store access and modification - see {@link DataBrokerService} and
* {@link DataProviderService}
* </ul>
* The services are exposed via session.
* The services are exposed via session.
* <h3>Session-based access</h3>
* <h3>Session-based access</h3>
* The providers and consumers needs to register in order to use the
* binding-independent SAL layer and to expose functionality via SAL layer.
* The providers and consumers needs to register in order to use the
* binding-independent SAL layer and to expose functionality via SAL layer.
* For more information about session-based access see {@link ConsumerSession}
* and {@link ProviderSession}
* For more information about session-based access see {@link ConsumerSession}
* and {@link ProviderSession}
*/
public interface Broker {
/**
* Registers the {@link Consumer}, which will use the SAL layer.
*/
public interface Broker {
/**
* Registers the {@link Consumer}, which will use the SAL layer.
* <p>
* During the registration, the broker obtains the initial functionality
* from consumer, using the {@link Consumer#getConsumerFunctionality()}, and
* register that functionality into system and concrete infrastructure
* services.
* <p>
* During the registration, the broker obtains the initial functionality
* from consumer, using the {@link Consumer#getConsumerFunctionality()}, and
* register that functionality into system and concrete infrastructure
* services.
* <p>
* Note that consumer could register additional functionality at later point
* by using service and functionality specific APIs.
* <p>
* Note that consumer could register additional functionality at later point
* by using service and functionality specific APIs.
* <p>
* The consumer is required to use returned session for all communication
* with broker or one of the broker services. The session is announced to
* the consumer by invoking
* {@link Consumer#onSessionInitiated(ConsumerSession)}.
* <p>
* The consumer is required to use returned session for all communication
* with broker or one of the broker services. The session is announced to
* the consumer by invoking
* {@link Consumer#onSessionInitiated(ConsumerSession)}.
* @param cons
* Consumer to be registered.
* @param context
* @param cons
* Consumer to be registered.
* @param context
/**
* Registers the {@link Provider}, which will use the SAL layer.
/**
* Registers the {@link Provider}, which will use the SAL layer.
* <p>
* During the registration, the broker obtains the initial functionality
* from consumer, using the {@link Provider#getProviderFunctionality()}, and
* register that functionality into system and concrete infrastructure
* services.
* <p>
* During the registration, the broker obtains the initial functionality
* from consumer, using the {@link Provider#getProviderFunctionality()}, and
* register that functionality into system and concrete infrastructure
* services.
* <p>
* Note that consumer could register additional functionality at later point
* by using service and functionality specific APIs (e.g.
* {@link ProviderSession#addRpcImplementation(QName, RpcImplementation)}
* <p>
* Note that consumer could register additional functionality at later point
* by using service and functionality specific APIs (e.g.
* {@link ProviderSession#addRpcImplementation(QName, RpcImplementation)}
* <p>
* The consumer is <b>required to use</b> returned session for all
* communication with broker or one of the broker services. The session is
* announced to the consumer by invoking
* {@link Provider#onSessionInitiated(ProviderSession)}.
* <p>
* The consumer is <b>required to use</b> returned session for all
* communication with broker or one of the broker services. The session is
* announced to the consumer by invoking
* {@link Provider#onSessionInitiated(ProviderSession)}.
* @param prov
* Provider to be registered.
* @param context
* @param prov
* Provider to be registered.
* @param context
/**
* {@link Consumer} specific access to the SAL functionality.
/**
* {@link Consumer} specific access to the SAL functionality.
* <p>
* ConsumerSession is {@link Consumer}-specific access to the SAL
* functionality and infrastructure services.
* <p>
* ConsumerSession is {@link Consumer}-specific access to the SAL
* functionality and infrastructure services.
* <p>
* The session serves to store SAL context (e.g. registration of
* functionality) for the consumer and provides access to the SAL
* infrastructure services and other functionality provided by
* {@link Provider}s.
* <p>
* The session serves to store SAL context (e.g. registration of
* functionality) for the consumer and provides access to the SAL
* infrastructure services and other functionality provided by
* {@link Provider}s.
*/
public interface ConsumerSession {
/**
* Sends an RPC to other components registered to the broker.
*/
public interface ConsumerSession {
/**
* Sends an RPC to other components registered to the broker.
* @see RpcImplementation
* @param rpc
* Name of RPC
* @see RpcImplementation
* @param rpc
* Name of RPC
/**
* Returns a session specific instance (implementation) of requested
* service
/**
* Returns a session specific instance (implementation) of requested
* service
* @param service
* Broker service
* @return Session specific implementation of service
* @param service
* Broker service
* @return Session specific implementation of service
/**
* Closes a session between consumer and broker.
/**
* Closes a session between consumer and broker.
* <p>
* The close operation unregisters a consumer and remove all registered
* functionality of the consumer from the system.
* <p>
* The close operation unregisters a consumer and remove all registered
* functionality of the consumer from the system.
*/
void close();
}
/**
* {@link Provider} specific access to the SAL functionality.
*/
void close();
}
/**
* {@link Provider} specific access to the SAL functionality.
* <p>
* ProviderSession is {@link Provider}-specific access to the SAL
* functionality and infrastructure services, which also allows for exposing
* the provider's functionality to the other {@link Consumer}s.
* <p>
* ProviderSession is {@link Provider}-specific access to the SAL
* functionality and infrastructure services, which also allows for exposing
* the provider's functionality to the other {@link Consumer}s.
* <p>
* The session serves to store SAL context (e.g. registration of
* functionality) for the providers and exposes access to the SAL
* infrastructure services, dynamic functionality registration and any other
* functionality provided by other {@link Provider}s.
* <p>
* The session serves to store SAL context (e.g. registration of
* functionality) for the providers and exposes access to the SAL
* infrastructure services, dynamic functionality registration and any other
* functionality provided by other {@link Provider}s.
*/
public interface ProviderSession extends ConsumerSession {
/**
* Registers an implementation of the rpc.
*/
public interface ProviderSession extends ConsumerSession {
/**
* Registers an implementation of the rpc.
* <p>
* The registered rpc functionality will be available to all other
* consumers and providers registered to the broker, which are aware of
* the {@link QName} assigned to the rpc.
* <p>
* The registered rpc functionality will be available to all other
* consumers and providers registered to the broker, which are aware of
* the {@link QName} assigned to the rpc.
* <p>
* There is no assumption that rpc type is in the set returned by
* invoking {@link RpcImplementation#getSupportedRpcs()}. This allows
* for dynamic rpc implementations.
* <p>
* There is no assumption that rpc type is in the set returned by
* invoking {@link RpcImplementation#getSupportedRpcs()}. This allows
* for dynamic rpc implementations.
* @param rpcType
* Name of Rpc
* @param implementation
* @param rpcType
* Name of Rpc
* @param implementation
/**
* Closes a session between provider and SAL.
/**
* Closes a session between provider and SAL.
* <p>
* The close operation unregisters a provider and remove all registered
* functionality of the provider from the system.
* <p>
* The close operation unregisters a provider and remove all registered
* functionality of the provider from the system.
boolean isClosed();
Set<QName> getSupportedRpcs();
boolean isClosed();
Set<QName> getSupportedRpcs();
ListenerRegistration<RpcRegistrationListener> addRpcRegistrationListener(RpcRegistrationListener listener);
}
public interface RpcRegistration extends Registration<RpcImplementation> {
QName getType();
ListenerRegistration<RpcRegistrationListener> addRpcRegistrationListener(RpcRegistrationListener listener);
}
public interface RpcRegistration extends Registration<RpcImplementation> {
QName getType();
+
+ @Override
+ void close();
}
public interface RoutedRpcRegistration extends RpcRegistration,
}
public interface RoutedRpcRegistration extends RpcRegistration,