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

Class ServiceDiscoveryConfiguration

java.lang.Object
com.sas.services.ServiceConfiguration
com.sas.services.discovery.ServiceDiscoveryConfiguration
All Implemented Interfaces:
ServiceDiscoveryConfigurationInterface, ServiceConfigurationInterface, Serializable

@SASScope("ALL") @BinaryCompatibilityOnly public class ServiceDiscoveryConfiguration extends ServiceConfiguration implements ServiceDiscoveryConfigurationInterface
Service discovery configuration. This configuration is used to specify information related to how a service is described in the context of the Discovery service. Each service that can be discovered is assigned a unique ID which allows another service to re-acquire a previously discovered service. Additionally, a service may specify attributes that are used to distinguish it from other services satisfying the same service types.

Refer to ServiceDiscoveryConfigurationInterface for details on the interface this class implements including an example that illustrates how to access a service's service discovery configuration.

Note that a service will only have a service discovery configuration if it was deployed in the context of a Discovery service. Some services may be used outside of the context of a discovery service, in which case they will not have a service discovery configuration.

Since:
1.0
See Also:
  • Constructor Details

    • ServiceDiscoveryConfiguration

      public ServiceDiscoveryConfiguration() throws ServiceException
      Constructs a default instance.
      Throws:
      ServiceException - if unable to initialize.
    • ServiceDiscoveryConfiguration

      public ServiceDiscoveryConfiguration(boolean isRegistrationEnabled, Class[] serviceTypes, ServiceAttributeInterface[] serviceAttributes, String repositoryId) throws ServiceException
      Constructs an instance using the specified registration policy.
      Parameters:
      isRegistrationEnabled - Whether to expose service to other clients outside of this JVM.
      serviceTypes - Types of services supported.
      serviceAttributes - Optional attributes that describe the service.
      repositoryId - Repository ID for the service.
      Throws:
      ServiceException - if unable to initialize.
  • Method Details

    • getDiscoveryId

      public final String getDiscoveryId()
      Gets an ID which may be used to locate a service using FindServiceInterface.findServiceUsingId(String).
      Specified by:
      getDiscoveryId in interface ServiceDiscoveryConfigurationInterface
      Returns:
      Service's runtime ID or null if undefined.
    • getRepositoryId

      public final String getRepositoryId()
      Gets the repository ID.
      Specified by:
      getRepositoryId in interface ServiceDiscoveryConfigurationInterface
      Returns:
      Service's repository ID.
    • setRepositoryId

      public final void setRepositoryId(String repositoryId)
      Sets the service's repository ID.
      Parameters:
      repositoryId - Repository ID.
    • isDelegateRegistrationEnabled

      public final boolean isDelegateRegistrationEnabled()
      Determines whether or not a service may be registered with discovery delegates.
      Specified by:
      isDelegateRegistrationEnabled in interface ServiceDiscoveryConfigurationInterface
      Returns:
      true if the service should be registered with discovery delegates or false if it isn't.
    • setDelegateRegistrationEnabled

      public final void setDelegateRegistrationEnabled(boolean isRegistrationEnabled)
      Specifies whether or not the service should be registered with discovery delegates.
      Specified by:
      setDelegateRegistrationEnabled in interface ServiceDiscoveryConfigurationInterface
      Parameters:
      isRegistrationEnabled - true if delegate registration is to be enabled or false if it is to be disabled.
    • getServiceTypes

      public final Class[] getServiceTypes()
      Gets the service types by which a service wants to be advertised to clients of the Discovery service.
      Specified by:
      getServiceTypes in interface ServiceDiscoveryConfigurationInterface
      Returns:
      Service types.
    • setServiceTypes

      public final void setServiceTypes(Class[] serviceTypes)
      Sets the service types a service is, extends, or implements.
      Specified by:
      setServiceTypes in interface ServiceDiscoveryConfigurationInterface
      Parameters:
      serviceTypes - The service types that define a service. Typically this is expressed in terms of the Java interface(s) that the service implements, but may also include classes that the service is or extends.
    • getServiceAttributes

      public final ServiceAttributeInterface[] getServiceAttributes()
      Gets attributes of a service that may be used to refine a service lookup based upon attributes.
      Specified by:
      getServiceAttributes in interface ServiceDiscoveryConfigurationInterface
      Returns:
      Service attributes or null if no attributes are associated with this service.
    • setServiceAttributes

      public final void setServiceAttributes(ServiceAttributeInterface[] serviceAttributes)
      Sets attributes of a service that may be used to distinguish among several services that satisfy the same service types. These optional attributes permit one to augment a service's lookup signature to enable filtering.
      Specified by:
      setServiceAttributes in interface ServiceDiscoveryConfigurationInterface
      Parameters:
      serviceAttributes - Attributes that may be used to describe characteristics of a service in order to distinguish it from other services that satisfy the same service types.
    • addServiceAttributes

      public final void addServiceAttributes(ServiceAttributeInterface[] serviceAttributes)
      Adds attributes of a service that may be used to distinguish among several services that satisfy the same service types. These optional attributes permit one to augment a service's lookup signature to enable filtering.
      Parameters:
      serviceAttributes - Attributes that may be used to describe characteristics of a service in order to distinguish it from other services that satisfy the same service types.
    • addServiceAttributes

      public final void addServiceAttributes(List<ServiceAttributeInterface> serviceAttributesList)
      Adds attributes of a service that may be used to distinguish among several services that satisfy the same service types. These optional attributes permit one to augment a service's lookup signature to enable filtering.
      Specified by:
      addServiceAttributes in interface ServiceDiscoveryConfigurationInterface
      Parameters:
      serviceAttributesList - Attributes that may be used to describe characteristics of a service in order to distinguish it from other services that satisfy the same service types.
    • addServiceAttribute

      public final 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.
      Specified by:
      addServiceAttribute in interface ServiceDiscoveryConfigurationInterface
      Parameters:
      serviceAttribute - Service lookup attribute.
      Returns:
      true if the service lookup attribute was added or false if it wasn't.
    • removeServiceAttribute

      public final boolean removeServiceAttribute(ServiceAttributeInterface serviceAttribute)
      Removes a service lookup attribute.
      Specified by:
      removeServiceAttribute in interface ServiceDiscoveryConfigurationInterface
      Parameters:
      serviceAttribute - Service lookup attribute to be removed.
      Returns:
      true if the service lookup attribute was removed or false if it wasn't.
    • setServiceComponentAttribute

      public void setServiceComponentAttribute(ServiceComponentAttribute serviceComponentAttribute)
      Sets the ServiceComponent attribute.
      Specified by:
      setServiceComponentAttribute in interface ServiceDiscoveryConfigurationInterface
      Parameters:
      serviceComponentAttribute - The ServiceComponent attribute.
    • getServiceComponentAttribute

      public final ServiceComponentAttribute getServiceComponentAttribute()
      Get the ServiceComponent attribute.
      Specified by:
      getServiceComponentAttribute in interface ServiceDiscoveryConfigurationInterface
      Returns:
      The ServiceComponent attribute or null if no ServiceComponent attribute is associated with this service.
    • setServiceGroup

      public final void setServiceGroup(String serviceGroup)
      Set the ServiceGroup attribute.
      Specified by:
      setServiceGroup in interface ServiceDiscoveryConfigurationInterface
      Parameters:
      serviceGroup - The ServiceGroup attribute.
    • getServiceGroup

      public final String getServiceGroup()
      Gets the service's group.
      Specified by:
      getServiceGroup in interface ServiceDiscoveryConfigurationInterface
      Returns:
      The service's group.
    • getJVMId

      public final String getJVMId()
      Gets an identifier used to represent the JVM in which the service was deployed.
      Specified by:
      getJVMId in interface ServiceDiscoveryConfigurationInterface
      Returns:
      Identifier used to represent the JVM in which the service was deployed. This value will be null if serialized from a 9.1.3 code base since JVMAttribute was introduced at 9.2.
    • setServiceDeploymentAttribute

      public void setServiceDeploymentAttribute(ServiceDeploymentAttribute serviceDeploymentAttribute)
      Set the SoftwareComponent attribute.
      Specified by:
      setServiceDeploymentAttribute in interface ServiceDiscoveryConfigurationInterface
      Parameters:
      serviceDeploymentAttribute - The SoftwareComponent attribute.
    • getServiceDeploymentAttribute

      public final ServiceDeploymentAttribute getServiceDeploymentAttribute()
      Get the SoftwareComponent attribute.
      Specified by:
      getServiceDeploymentAttribute in interface ServiceDiscoveryConfigurationInterface
      Returns:
      The SoftwareComponent attribute or null if no SoftwareComponent attribute is associated with this service.
    • getServiceFactory

      public final String getServiceFactory()
      Gets the service factory.
      Specified by:
      getServiceFactory in interface ServiceDiscoveryConfigurationInterface
      Returns:
      Service factory.
    • setServiceFactory

      public final void setServiceFactory(String serviceFactory) throws InitializationException
      Sets the service factory.
      Specified by:
      setServiceFactory in interface ServiceDiscoveryConfigurationInterface
      Parameters:
      serviceFactory - Service factory
      Throws:
      InitializationException - if an invalid factory is specified.
    • addRMIBinding

      public final boolean addRMIBinding(RMIBinding rmiBinding)
      Adds an RMI binding.
      Parameters:
      rmiBinding - RMI binding
      Returns:
      true if the set did not already contain this object.
    • unbindFromRMIRegistry

      public final void unbindFromRMIRegistry()
      Unbinds all RMI name bindings from the RMI registry.
      Specified by:
      unbindFromRMIRegistry in interface ServiceDiscoveryConfigurationInterface
    • destroy

      public final void destroy()
      Destroys this configuration by removing any RMI bindings that are associated with an RMI registry.
      Specified by:
      destroy in interface ServiceDiscoveryConfigurationInterface
    • toString

      public final String toString()
      Gets a string representation of this instance. Intended for use in log messages.
      Overrides:
      toString in class Object
      Returns:
      String representation of this instance.