*** This interface provides Binary Compatibility only, not Source Compatibility ***

Interface FindServiceInterface

All Superinterfaces:
com.sas.entities.EntityKeyInterface, Remote
All Known Subinterfaces:
DiscoveryServiceInterface, LocalDiscoveryServiceInterface, RemoteDiscoveryServiceInterface
All Known Implementing Classes:
AbstractDiscoveryService, ActivatableDiscoveryService, DiscoveryService, RegistryDiscoveryService, RemoteDiscoveryServiceProxy

@SASScope("ALL") @BinaryCompatibilityOnly public interface FindServiceInterface extends com.sas.entities.EntityKeyInterface, Remote
Interface describing how to find service(s) via the Discovery service.

A service may be found by submitting a service template to the discovery service that describes the desired service interfaces. This service template may optionally include additional criteria to further filter the discovery results. When querying services using the service template one may specify the maximum number of results to be returned.

Alternatively, one may re-acquire a service by looking it up via its service discovery ID. A service's discovery ID is part of its discovery service configuration which is obtained as follows:

 RemoteServiceInterface service;
 ...
 final ServiceConfigurationInterface serviceConfig = service.getServiceConfiguration();
 if (serviceConfig != null) {
    final ServiceDiscoveryConfigurationInterface serviceDiscoveryConfig =
       serviceConfig.getServiceConfiguration(
          ServiceConfigurationInterface.CONFIGURATION_SERVICE_DISCOVERY);
    if ((serviceDiscoveryConfig != null) &&
        (serviceDiscoveryConfig instanceof ServiceDiscoveryConfigurationInterface)) {
       final String serviceDiscoveryId = ((ServiceDiscoveryConfigurationInterface)
          serviceDiscoveryConfig).getDiscoveryId();
    }
 }
 
One first asks a service for its configuration and if one is available then you attempt to obtain the ancillary service discovery configuration from the service's configuration. If successful, you'll get a ServiceDiscoveryConfigurationInterface which provides method getDiscoveryId() to obtain the discovery ID associated with a service.
Since:
1.0
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    Constant used to indicate that all matches are desired.
    static final int
    Constant used to indicate that only one match is desired.
  • Method Summary

    Modifier and Type
    Method
    Description
    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 serviceId)
    Re-acquires a previously discovered service via its service discovery ID.

    Methods inherited from interface com.sas.entities.EntityKeyInterface

    getEntityKey, sameEntity, setEntityKey
  • Field Details

    • FIND_ONE_MATCH

      static final int FIND_ONE_MATCH
      Constant used to indicate that only one match is desired.
      See Also:
    • FIND_ALL_MATCHES

      static final int FIND_ALL_MATCHES
      Constant used to indicate that all matches are desired.
      See Also:
  • Method Details

    • findServiceUsingId

      RemoteServiceInterface findServiceUsingId(String serviceId) 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.
      Parameters:
      serviceId - Service's discovery ID.
      Returns:
      RemoteServiceInterface implementation that satisfies the discovery parameters. Note that RemoteServiceInterface is the base interface implemented by all services.
      Throws:
      ServiceException - if an unanticipated exception occurs while processing the discovery. Note that ServiceNotAvailableException extends ServiceException.
      RemoteException - if a network anomaly is encountered.
      ServiceNotAvailableException - if no service satisfies the requested service template.
    • findService

      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
      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:
      RemoteServiceInterface implementation that satisfies the requested service template. Note that RemoteServiceInterface is the base interface implemented by all services.
      Throws:
      ServiceException - if an unanticipated exception occurs while processing the discovery.
      RemoteException - if a network anomaly is encountered.
      ServiceNotAvailableException - if no service satisfies the requested service template. Note that ServiceNotAvailableException extends ServiceException.
      See Also:
    • findServices

      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
      The current implementation requires one to specify a service type. If you want to find any service use a service type of com.sas.services.RemoteServiceInterface which is implemented by all services.
      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 or null if 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 that ServiceNotAvailableException extends ServiceException.
      See Also: