*** This class provides Binary Compatibility only, not Source Compatibility ***
Package com.sas.services.discovery
Class RegistryDiscoveryService
java.lang.Object
com.sas.services.discovery.RegistryDiscoveryService
- All Implemented Interfaces:
com.sas.entities.EntityKeyInterface,FindServiceInterface,Remote
@SASScope("ALL")
@BinaryCompatibilityOnly
public final class RegistryDiscoveryService
extends Object
implements FindServiceInterface
A discovery service which can be used to locate foundation services which
have been bound to an RMI registry.
This discovery service is a stateless service which lists all of the
objects which have been bound to the RMI registry and may be used to
return a collection of services which satisfy a requested
service template which describes the interfaces
and optionally attributes which the desired service must implement.
- Since:
- 9.2
-
Field Summary
Fields inherited from interface com.sas.services.discovery.FindServiceInterface
FIND_ALL_MATCHES, FIND_ONE_MATCH -
Constructor Summary
ConstructorsConstructorDescriptionConstructs a discovery service which may be used to locate foundation services which have been bound to the RMI registry.RegistryDiscoveryService(Registry registry) Constructs a discovery service which may be used to locate foundation services which have been bound to the RMI registry. -
Method Summary
Modifier and TypeMethodDescriptionvoiddestroy()Destroys this discovery service.findService(ServiceTemplate serviceTemplate) Finds a service using a discovery mechanism.findServices(ServiceTemplate serviceTemplate, int maxNumMatches, Services services) Finds a collection of services via a discovery mechanism.findServiceUsingId(String runtimeServiceId) Re-acquires a previously discovered service via its service discovery ID.StringbooleansameEntity(com.sas.entities.EntityKeyInterface entity) voidsetEntityKey(String key) voidsetRegistry(Registry registry) Sets the RMI registry from which foundation services may be looked up.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
RegistryDiscoveryService
public RegistryDiscoveryService()Constructs a discovery service which may be used to locate foundation services which have been bound to the RMI registry.Use this constructor if you want to specify the registry by calling
setRegistry(Registry). -
RegistryDiscoveryService
public RegistryDiscoveryService(Registry registry) Constructs a discovery service which may be used to locate foundation services which have been bound to the RMI registry.- Parameters:
registry- RMI registry. A non-nullregistry must be specified.
-
-
Method Details
-
setRegistry
public void setRegistry(Registry registry) Sets the RMI registry from which foundation services may be looked up.- Parameters:
registry- RMI registry. Anullmay be specified to clear the registry.
-
destroy
public void destroy()Destroys this discovery service. -
findService
public RemoteServiceInterface findService(ServiceTemplate serviceTemplate) throws RemoteException, ServiceException, ServiceNotAvailableException Finds a service using a discovery mechanism.To be considered a successful match, the service must satisfy the requested service template which may be used to specify:
- class(es) the service is, extends, or implements
- additional filtering criteria expressed in terms of
ServiceAttributeInterface
- Specified by:
findServicein interfaceFindServiceInterface- Parameters:
serviceTemplate- Service capability template that specifies the desired class(es) that define a service. The template may also specify criteria to provide additional filtering.- Returns:
RemoteServiceInterfaceimplementation that satisfies the requested service template. Note thatRemoteServiceInterfaceis the base interface implemented by all services.- Throws:
RemoteException- if a network anomaly is encountered.ServiceException- if an unanticipated exception occurs while processing the discovery.ServiceNotAvailableException- if no service satisfies the requested service template. Note thatServiceNotAvailableExceptionextendsServiceException.- See Also:
-
findServiceUsingId
public RemoteServiceInterface findServiceUsingId(String runtimeServiceId) throws RemoteException, ServiceException, ServiceNotAvailableException Re-acquires a previously discovered service via its service discovery ID. The service discovery ID is runtime ID that is unique across JVMs and only used in the context of discovering a service.- Specified by:
findServiceUsingIdin interfaceFindServiceInterface- Parameters:
runtimeServiceId- Service's discovery ID.- Returns:
RemoteServiceInterfaceimplementation that satisfies the discovery parameters. Note thatRemoteServiceInterfaceis the base interface implemented by all services.- Throws:
RemoteException- if a network anomaly is encountered.ServiceException- if an unanticipated exception occurs while processing the discovery. Note thatServiceNotAvailableExceptionextendsServiceException.ServiceNotAvailableException- if no service satisfies the requested service template.
-
findServices
public Services findServices(ServiceTemplate serviceTemplate, int maxNumMatches, Services services) throws RemoteException, ServiceException, ServiceNotAvailableException Finds a collection of services via a discovery mechanism. This overloaded method enables one to specify a collection that may contain services that have already been discovered and to which additional matches should be added.To be considered a successful match, the service must satisfy the requested service template which may be used to specify:
- service types: class(es) the service is, extends, or implements
- additional filtering criteria
com.sas.services.RemoteServiceInterfacewhich is implemented by all services.- Specified by:
findServicesin interfaceFindServiceInterface- Parameters:
serviceTemplate- Service capability template that specifies either the desired class(es) that define a services. The service template may also specify additional criteria to provide additional filtering.maxNumMatches- The maximum number of services that are desired. Value should be greater than or equal to one.services- Collection of services satisfying the specified service capabilities ornullif there are no previously discovered services.- Returns:
- A collection containing search results. Each collection element will either be, implement, or extend the requested class(es).
- Throws:
RemoteException- if a network anomaly is encountered.ServiceException- if an unanticipated exception occurs while processing the discovery.ServiceNotAvailableException- if no service satisfies the requested service template. Note thatServiceNotAvailableExceptionextendsServiceException.- See Also:
-
getEntityKey
public String getEntityKey() throws RemoteException- Specified by:
getEntityKeyin interfacecom.sas.entities.EntityKeyInterface- Throws:
RemoteException
-
sameEntity
public boolean sameEntity(com.sas.entities.EntityKeyInterface entity) throws RemoteException - Specified by:
sameEntityin interfacecom.sas.entities.EntityKeyInterface- Throws:
RemoteException
-
setEntityKey
public void setEntityKey(String key) throws RemoteException, IllegalStateException - Specified by:
setEntityKeyin interfacecom.sas.entities.EntityKeyInterface- Throws:
RemoteExceptionIllegalStateException
-