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

Package com.sas.services.discovery

# Interface ServiceDiscoveryConfigurationInterface

All Superinterfaces:
  `Serializable`

All Known Implementing Classes:
  `ServiceDiscoveryConfiguration`

@SASScope("ALL") @BinaryCompatibilityOnly public interface ServiceDiscoveryConfigurationInterface extends Serializable
Interface describing a service discovery configuration consisting of

- an ID used to uniquely identify a service across JVMs and
- optional service attributes which may be used to qualify a discovery lookup to distinguish among multiple services that satisfy the same service types.

Each discoverable service will be associated with a unique ID. This ID may be used by a client to re-acquire a previously discovered service from the Discovery service.

While services are primarily looked up based upon the service types they implement, service attributes may optionally be associated to provide additional filtering criteria. Optional service attributes are specified as part of a service's `com.sas.services.discovery.ServiceDiscoveryConfiguration`. If a service has a service discovery configuration it will be accessible as follows:

     String serviceDiscoveryId = null;
     final ServiceConfigurationInterface serviceConfig =
        service.getServiceConfiguration();
     if (serviceConfig != null) {
        final ServiceDiscoveryConfigurationInterface serviceDiscoveryConfig =
        serviceConfig.getServiceConfiguration(
           ServiceConfigurationInterface.CONFIGURATION_SERVICE_DISCOVERY);
        if ((serviceDiscoveryConfig != null) &&
            (serviceDiscoveryConfig instanceof
             ServiceDiscoveryConfigurationInterface)) {
           serviceDiscoveryId = ((ServiceDiscoveryConfigurationInterface)
              serviceDiscoveryConfig).getDiscoveryId();
        }
    }

Since:
  1.0

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `addServiceAttribute(ServiceAttributeInterface serviceAttribute)`
  Adds a service lookup attribute.
  `void`
  `addServiceAttributes(List<ServiceAttributeInterface> serviceAttributes)`
  Adds service lookup attributes.
  `void`
  `destroy()`
  Destroys this configuration.
  `String`
  `getDiscoveryId()`
  Gets an ID associated with a service that's registered with the discovery service.
  `String`
  `getJVMId()`
  Gets an identifier used to represent the JVM in which the service was deployed.
  `String`
  `getRepositoryId()`
  Gets the ID associated with the repository instance of a metadata `ServiceComponent` element.
  `ServiceAttributeInterface[]`
  `getServiceAttributes()`
  Gets optional attributes that may be provided to specify additional lookup criteria about a service.
  `ServiceComponentAttribute`
  `getServiceComponentAttribute()`
  Get the ServiceComponent attribute.
  `ServiceDeploymentAttribute`
  `getServiceDeploymentAttribute()`
  Get the attribute that represents the service's deployment.
  `String`
  `getServiceFactory()`
  Gets the fully qualified name of the Java class that serves as the services factory.
  `String`
  `getServiceGroup()`
  Gets the name of the service's deployment group.
  `Class[]`
  `getServiceTypes()`
  Gets the service types supported by the service.
  `boolean`
  `isDelegateRegistrationEnabled()`
  Determines whether or not the service should be registered with discovery delegates.
  `boolean`
  `removeServiceAttribute(ServiceAttributeInterface serviceAttribute)`
  Removes a service lookup attribute.
  `void`
  `setDelegateRegistrationEnabled(boolean isDelegateRegistrationEnabled)`
  Sets the service discovery registration policy.
  `void`
  `setServiceAttributes(ServiceAttributeInterface[] serviceAttributes)`
  Sets optional attributes that may be provided to specify additional lookup criteria about a service.
  `void`
  `setServiceComponentAttribute(ServiceComponentAttribute serviceComponentAttribute)`
  Set the ServiceComponent attribute.
  `void`
  `setServiceDeploymentAttribute(ServiceDeploymentAttribute serviceDeploymentAttribute)`
  Sets the attribute that represents the service deployment that contains the service.
  `void`
  `setServiceFactory(String serviceFactory)`
  Sets the fully qualified name of the Java class that serves as the services factory.
  `void`
  `setServiceGroup(String serviceGroup)`
  Set the name of the service's deployment group.
  `void`
  `setServiceTypes(Class[] serviceTypes)`
  Sets service types that a service is, extends, or implements.
  `void`
  `unbindFromRMIRegistry()`
  Unbinds any RMI name bindings from the RMI registry.

- ## Method Details

  - ### getDiscoveryId

    String getDiscoveryId()
    Gets an ID associated with a service that's registered with the discovery service.
    Returns:
      ID that may be used to lookup a service.

  - ### getRepositoryId

    String getRepositoryId()
    Gets the ID associated with the repository instance of a metadata `ServiceComponent` element.
    Returns:
      ID used to represent a service as a deployable component in a repository.

  - ### isDelegateRegistrationEnabled

    boolean isDelegateRegistrationEnabled()
    Determines whether or not the service should be registered with discovery delegates.
    Returns:
      `true` if registration is enabled or `false` if it isn't.

  - ### setDelegateRegistrationEnabled

    void setDelegateRegistrationEnabled(boolean isDelegateRegistrationEnabled)
    Sets the service discovery registration policy.
    Parameters:
      `isDelegateRegistrationEnabled` - `true` if the service is to be registered with discovery delegates or `false` if it isn't.

  - ### getServiceTypes

    Class[] getServiceTypes()
    Gets the service types supported by the service. These represent the Java classes the service is, extends, or implements.
    Returns:
      Service types supported by the service.

  - ### setServiceTypes

    void setServiceTypes(Class[] serviceTypes) throws ServiceException
    Sets service types that a service is, extends, or implements. A service must specify 1..* service types.
    Parameters:
      `serviceTypes` - Service types supported by the service.
    Throws:
      `ServiceException` - if no service types are specified.

  - ### getServiceAttributes

    ServiceAttributeInterface[] getServiceAttributes()
    Gets optional attributes that may be provided to specify additional lookup criteria about a service. These provide the capability to provide some level of filtering among services which satisfy the same service types.
    Returns:
      Service attributes or `null` if no attributes are associated with this service.

  - ### setServiceAttributes

    void setServiceAttributes(ServiceAttributeInterface[] serviceAttributes)
    Sets optional attributes that may be provided to specify additional lookup criteria about a service. These provide the capability to provide some level of filtering among services which satisfy the same service types.
    Parameters:
      `serviceAttributes` - Service attributes or `null` if no attributes are associated with this service.

  - ### addServiceAttribute

    boolean addServiceAttribute(ServiceAttributeInterface serviceAttribute)
    Adds a service lookup attribute. A service may optionally designate attributes which can be used to distinguish itself from other services satisfying the same service interfaces. A client would then use the DiscoveryService to lookup a service satisfying particular service interface(s) and optionally designated service attributes.
    Parameters:
      `serviceAttribute` - Service lookup attribute.
    Returns:
      `true` if the service lookup attribute was added or `false` if it wasn't.

  - ### addServiceAttributes

    void addServiceAttributes(List<ServiceAttributeInterface> serviceAttributes)
    Adds service lookup attributes. A service may optionally designate attributes which can be used to distinguish itself from other services satisfying the same service interfaces. A client would then use the DiscoveryService to lookup a service satisfying particular service interface(s) and optionally designated service attributes.
    Parameters:
      `serviceAttributes` - List of `ServiceAttributeInterface`.

  - ### removeServiceAttribute

    boolean removeServiceAttribute(ServiceAttributeInterface serviceAttribute)
    Removes a service lookup attribute.
    Parameters:
      `serviceAttribute` - Service lookup attribute to be removed.
    Returns:
      `true` if the service lookup attribute was removed or `false` if it wasn't.

  - ### getServiceFactory

    String getServiceFactory()
    Gets the fully qualified name of the Java class that serves as the services factory. Note that this factory must implement `ServiceFactoryInterface`.
    Returns:
      Fully qualified Java name of a class that serves as a service's factory. This class must implement `ServiceFactoryInterface`.

  - ### setServiceFactory

    void setServiceFactory(String serviceFactory) throws InitializationException
    Sets the fully qualified name of the Java class that serves as the services factory. Note that this factory must implement `ServiceFactoryInterface`.
    Parameters:
      `serviceFactory` - Fully qualified Java name of a class that serves as a service's factory. This class must implement `ServiceFactoryInterface`.
    Throws:
      `InitializationException` - if an invalid service factory is specified.

  - ### setServiceComponentAttribute

    void setServiceComponentAttribute(ServiceComponentAttribute serviceComponentAttribute)
    Set the ServiceComponent attribute.
    Parameters:
      `serviceComponentAttribute` - The ServiceComponent attribute.

  - ### getServiceComponentAttribute

    ServiceComponentAttribute getServiceComponentAttribute()
    Get the ServiceComponent attribute.
    Returns:
      The ServiceComponent attribute or `null` if no ServiceComponent attribute is associated with this service.

  - ### setServiceGroup

    void setServiceGroup(String serviceGroup)
    Set the name of the service's deployment group.
    Parameters:
      `serviceGroup` - The service's deployment group. This corresponds to the name of the `Tree` that represents service's group.

  - ### getServiceGroup

    String getServiceGroup()
    Gets the name of the service's deployment group.
    Returns:
      The name of the service's deployment group which is represented in metadata as a `Tree`.

  - ### getJVMId

    String getJVMId()
    Gets an identifier used to represent the JVM in which the service was deployed.
    Returns:
      Identifier used to represent the JVM in which the service was deployed.

  - ### setServiceDeploymentAttribute

    void setServiceDeploymentAttribute(ServiceDeploymentAttribute serviceDeploymentAttribute)
    Sets the attribute that represents the service deployment that contains the service.
    Parameters:
      `serviceDeploymentAttribute` - The attribute that represents the service deployment, `SoftwareComponent`, that contains the service.

  - ### getServiceDeploymentAttribute

    ServiceDeploymentAttribute getServiceDeploymentAttribute()
    Get the attribute that represents the service's deployment. This corresponds to the metadata `SoftwareComponent`.
    Returns:
      The service deployment attribute or `null` if no service deployment attribute is associated with this service.

  - ### unbindFromRMIRegistry

    void unbindFromRMIRegistry()
    Unbinds any RMI name bindings from the RMI registry.

  - ### destroy

    void destroy()
    Destroys this configuration.