### *** This class provides Binary Compatibility only, not Source Compatibility ***

Package com.sas.services.discovery

# Class AbstractDiscoveryService

java.lang.Object
com.sas.services.AbstractRemoteService
com.sas.services.AbstractService
com.sas.services.discovery.AbstractDiscoveryService

All Implemented Interfaces:
  `com.sas.entities.EntityKeyInterface`, `FindServiceInterface`, `ServiceNotificationBroadcasterInterface`, `RemoteServiceInterface`, `Remote`

Direct Known Subclasses:
  `DiscoveryService`

@SASScope("ALL") @BinaryCompatibilityOnly public abstract class AbstractDiscoveryService extends AbstractService implements FindServiceInterface
Abstract discovery service.

Since:
  1.0

- ## Field Summary

  ### Fields inherited from interface com.sas.services.discovery.FindServiceInterface

  `FIND_ALL_MATCHES, FIND_ONE_MATCH`

  ### Fields inherited from interface com.sas.services.RemoteServiceInterface

  `CLASS_IDENTIFIER, CLASS_IDENTIFIER_1_1, CLASS_IDENTIFIER_1_2, CLASS_IDENTIFIER_SERVICE_TYPE, CLASS_IDENTIFIER_SERVICE_TYPE_1_1, CLASS_IDENTIFIER_SERVICE_TYPE_1_2`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `AbstractDiscoveryService()`
  Constructs a default instance.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `RemoteServiceInterface`
  `findService(ServiceTemplate serviceTemplate)`
  Finds a service using a discovery mechanism.
  `abstract Services`
  `findServices(ServiceTemplate serviceTemplate, int maxNumMatches, Services discoveredServices)`
  Finds a collection of services via a discovery mechanism.
  `RemoteServiceInterface`
  `findServiceUsingId(String runtimeServiceId)`
  Re-acquires a previously discovered service via its service discovery ID.

  ### Methods inherited from class com.sas.services.AbstractService

  `configure, destroy, getEntityKey`

  ### Methods inherited from class com.sas.services.AbstractRemoteService

  `addServiceObserver, bindToDiscoveryService, getCreationTime, getDetails, getDiscoveryService, getEnvironment, getServiceConfiguration, getServiceConfiguration, getServiceProxy, getServiceState, handleJVMShutdown, isAccessibleToRemoteClients, isExported, isHandlingJVMShutdown, notifyServiceObservers, reconfigure, removeAllServiceObservers, removeServiceObserver, sameEntity, setDiscoveryService, setEntityKey, setRemoteableExporter, setServiceState, toString, unbindFromDiscoveryService`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

  ### Methods inherited from interface com.sas.entities.EntityKeyInterface

  `getEntityKey, sameEntity, setEntityKey`

- ## Constructor Details

  - ### AbstractDiscoveryService

    public AbstractDiscoveryService()
    Constructs a default instance.

- ## Method Details

  - ### 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:
      `findServiceUsingId` in interface `FindServiceInterface`
    Parameters:
      `runtimeServiceId` - Service's discovery ID.
    Returns:
      `RemoteServiceInterface` implementation that satisfies the discovery parameters. Note that `RemoteServiceInterface` is 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 that `ServiceNotAvailableException` extends `ServiceException`.
      `ServiceNotAvailableException` - if no service satisfies the requested service template.

  - ### 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:
      `findService` in interface `FindServiceInterface`
    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:
      `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:
      - `ServiceTemplate`

  - ### findServices

    public abstract Services findServices(ServiceTemplate serviceTemplate, int maxNumMatches, Services discoveredServices) 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.
    Specified by:
      `findServices` in interface `FindServiceInterface`
    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.
      `discoveredServices` - 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:
      - `ServiceTemplate`
      - `Services`