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

com.sas.services.discovery
Interface FindServiceInterface

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

public interface FindServiceInterface
extends com.sas.entities.EntityKeyInterface, java.rmi.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
static int FIND_ALL_MATCHES
          Constant used to indicate that all matches are desired.
static int FIND_ONE_MATCH
          Constant used to indicate that only one match is desired.
 
Method Summary
 RemoteServiceInterface findService(ServiceTemplate serviceTemplate)
          Finds a service using a discovery mechanism.
 Services findServices(ServiceTemplate serviceTemplate, int maxNumMatches, Services services)
          Finds a collection of services via a discovery mechanism.
 RemoteServiceInterface findServiceUsingId(java.lang.String serviceId)
          Re-acquires a previously discovered service via its service discovery ID.
 

Field Detail

FIND_ONE_MATCH

static final int FIND_ONE_MATCH
Constant used to indicate that only one match is desired.

See Also:
Constant Field Values

FIND_ALL_MATCHES

static final int FIND_ALL_MATCHES
Constant used to indicate that all matches are desired.

See Also:
Constant Field Values
Method Detail

findServiceUsingId

RemoteServiceInterface findServiceUsingId(java.lang.String serviceId)
                                          throws java.rmi.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.
java.rmi.RemoteException - if a network anomaly is encountered.
ServiceNotAvailableException - if no service satisfies the requested service template.

findService

RemoteServiceInterface findService(ServiceTemplate serviceTemplate)
                                   throws java.rmi.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:

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.
java.rmi.RemoteException - if a network anomaly is encountered.
ServiceNotAvailableException - if no service satisfies the requested service template. Note that ServiceNotAvailableException extends ServiceException.
See Also:
ServiceTemplate

findServices

Services findServices(ServiceTemplate serviceTemplate,
                      int maxNumMatches,
                      Services services)
                      throws java.rmi.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:

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:
java.rmi.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

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




Copyright © 2009 SAS Institute Inc. All Rights Reserved.