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

Package com.sas.services.discovery

# Class ServicesCache

java.lang.Object
com.sas.services.discovery.ServicesCache

All Implemented Interfaces:
  `Serializable`

@SASScope("ALL") @BinaryCompatibilityOnly public class ServicesCache extends Object implements Serializable
Cache used to store foundation services.

Since:
  1.0
See Also:
  - `ServiceTemplate`
  - `Services`
  - Serialized Form

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ServicesCache()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `final void`
  `add(Services services)`
  Adds a collection of services to the cache.
  `final void`
  `add(RemoteServiceInterface service)`
  Adds a service to the the cache.
  `final Iterator<RemoteServiceInterface>`
  `getLocalServices()`
  Gets an iterator of services that are available within the local JVM process.
  `final Iterator<RemoteServiceInterface>`
  `getRemoteServices()`
  Gets an iterator of remotely available services.
  `final Services`
  `getServices(ServiceTemplate serviceTemplate, int maxNumMatches, Services services, boolean isLocal)`
  Gets a collection of services that satisfy the specified service capabilities.
  `final void`
  `remove(RemoteServiceInterface service)`
  Removes the service from the cache.

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

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

- ## Constructor Details

  - ### ServicesCache

    public ServicesCache()

- ## Method Details

  - ### getServices

    public final Services getServices(ServiceTemplate serviceTemplate, int maxNumMatches, Services services, boolean isLocal)
    Gets a collection of services that satisfy the specified service capabilities. The cache of locally available services is searched first followed by the cache of remotely available services if necessary.
    Parameters:
      `serviceTemplate` - Desired service capabilities.
      `maxNumMatches` - Maximum number of services to find.
      `services` - Collection of discovered services.
      `isLocal` - Whether local `true` or remote `false` services are desired.
    Returns:
      Services satisfying the requested service template.

  - ### add

    public final void add(Services services)
    Adds a collection of services to the cache. Only services that are not presently in the cache may be added.
    Parameters:
      `services` - Collection of services.

  - ### add

    public final void add(RemoteServiceInterface service) throws ServiceException
    Adds a service to the the cache.

    If a proxy is defined for the service then the service's proxy will be cached instead of the service.

    A service will be cached as a remote service if it is a remote object or if the service's proxy is a remote object.

    Parameters:
      `service` - Service to be added to the cache.
    Throws:
      `ServiceException` - if unable to cache the service.

  - ### remove

    public final void remove(RemoteServiceInterface service)
    Removes the service from the cache.
    Parameters:
      `service` - The service to remove.

  - ### getLocalServices

    public final Iterator<RemoteServiceInterface> getLocalServices()
    Gets an iterator of services that are available within the local JVM process.
    Returns:
      Iterator for collection copy of locally available services implementing `RemoteServiceInterface`.

  - ### getRemoteServices

    public final Iterator<RemoteServiceInterface> getRemoteServices()
    Gets an iterator of remotely available services. These are services that are available from an external JVM process.
    Returns:
      Iterator for collection copy of remotely available services implementing `RemoteServiceInterface`.