*** This class provides Binary Compatibility only, not Source Compatibility ***
Package com.sas.services.discovery
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:
-
Field Summary
Fields inherited from interface com.sas.services.ServiceConfigurationInterface
CONFIGURATION_METADATA_SOURCE, CONFIGURATION_SERVICE_DISCOVERY -
Constructor Summary
ConstructorsConstructorDescriptionConstructs a default instance.ServiceDiscoveryConfiguration(boolean isRegistrationEnabled, Class[] serviceTypes, ServiceAttributeInterface[] serviceAttributes, String repositoryId) Constructs an instance using the specified registration policy. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanaddRMIBinding(RMIBinding rmiBinding) Adds an RMI binding.final booleanaddServiceAttribute(ServiceAttributeInterface serviceAttribute) Adds a service lookup attribute.final voidaddServiceAttributes(ServiceAttributeInterface[] serviceAttributes) Adds attributes of a service that may be used to distinguish among several services that satisfy the same service types.final voidaddServiceAttributes(List<ServiceAttributeInterface> serviceAttributesList) Adds attributes of a service that may be used to distinguish among several services that satisfy the same service types.final voiddestroy()Destroys this configuration by removing any RMI bindings that are associated with an RMI registry.final StringGets an ID which may be used to locate a service usingFindServiceInterface.findServiceUsingId(String).final StringgetJVMId()Gets an identifier used to represent the JVM in which the service was deployed.final StringGets the repository ID.final ServiceAttributeInterface[]Gets attributes of a service that may be used to refine a service lookup based upon attributes.Get the ServiceComponent attribute.Get the SoftwareComponent attribute.final StringGets the service factory.final StringGets the service's group.final Class[]Gets the service types by which a service wants to be advertised to clients of the Discovery service.final booleanDetermines whether or not a service may be registered with discovery delegates.final booleanremoveServiceAttribute(ServiceAttributeInterface serviceAttribute) Removes a service lookup attribute.final voidsetDelegateRegistrationEnabled(boolean isRegistrationEnabled) Specifies whether or not the service should be registered with discovery delegates.final voidsetRepositoryId(String repositoryId) Sets the service's repository ID.final voidsetServiceAttributes(ServiceAttributeInterface[] serviceAttributes) Sets attributes of a service that may be used to distinguish among several services that satisfy the same service types.voidsetServiceComponentAttribute(ServiceComponentAttribute serviceComponentAttribute) Sets the ServiceComponent attribute.voidsetServiceDeploymentAttribute(ServiceDeploymentAttribute serviceDeploymentAttribute) Set the SoftwareComponent attribute.final voidsetServiceFactory(String serviceFactory) Sets the service factory.final voidsetServiceGroup(String serviceGroup) Set the ServiceGroup attribute.final voidsetServiceTypes(Class[] serviceTypes) Sets the service types a service is, extends, or implements.final StringtoString()Gets a string representation of this instance.final voidUnbinds all RMI name bindings from the RMI registry.Methods inherited from class com.sas.services.ServiceConfiguration
addServiceConfiguration, getEnvironment, getInitializationObject, getServiceConfiguration, getServiceConfigurations, removeServiceConfiguration, setEnvironment, setInitializationObjectMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Constructor Details
-
ServiceDiscoveryConfiguration
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 usingFindServiceInterface.findServiceUsingId(String).- Specified by:
getDiscoveryIdin interfaceServiceDiscoveryConfigurationInterface- Returns:
- Service's runtime ID or
nullif undefined.
-
getRepositoryId
public final String getRepositoryId()Gets the repository ID.- Specified by:
getRepositoryIdin interfaceServiceDiscoveryConfigurationInterface- 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:
isDelegateRegistrationEnabledin interfaceServiceDiscoveryConfigurationInterface- Returns:
trueif the service should be registered with discovery delegates orfalseif it isn't.
-
setDelegateRegistrationEnabled
public final void setDelegateRegistrationEnabled(boolean isRegistrationEnabled) Specifies whether or not the service should be registered with discovery delegates.- Specified by:
setDelegateRegistrationEnabledin interfaceServiceDiscoveryConfigurationInterface- Parameters:
isRegistrationEnabled-trueif delegate registration is to be enabled orfalseif 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:
getServiceTypesin interfaceServiceDiscoveryConfigurationInterface- Returns:
- Service types.
-
setServiceTypes
public final void setServiceTypes(Class[] serviceTypes) Sets the service types a service is, extends, or implements.- Specified by:
setServiceTypesin interfaceServiceDiscoveryConfigurationInterface- 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
Gets attributes of a service that may be used to refine a service lookup based upon attributes.- Specified by:
getServiceAttributesin interfaceServiceDiscoveryConfigurationInterface- Returns:
- Service attributes or
nullif no attributes are associated with this service.
-
setServiceAttributes
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:
setServiceAttributesin interfaceServiceDiscoveryConfigurationInterface- 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
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
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:
addServiceAttributesin interfaceServiceDiscoveryConfigurationInterface- 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
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:
addServiceAttributein interfaceServiceDiscoveryConfigurationInterface- Parameters:
serviceAttribute- Service lookup attribute.- Returns:
trueif the service lookup attribute was added orfalseif it wasn't.
-
removeServiceAttribute
Removes a service lookup attribute.- Specified by:
removeServiceAttributein interfaceServiceDiscoveryConfigurationInterface- Parameters:
serviceAttribute- Service lookup attribute to be removed.- Returns:
trueif the service lookup attribute was removed orfalseif it wasn't.
-
setServiceComponentAttribute
Sets the ServiceComponent attribute.- Specified by:
setServiceComponentAttributein interfaceServiceDiscoveryConfigurationInterface- Parameters:
serviceComponentAttribute- The ServiceComponent attribute.
-
getServiceComponentAttribute
Get the ServiceComponent attribute.- Specified by:
getServiceComponentAttributein interfaceServiceDiscoveryConfigurationInterface- Returns:
- The ServiceComponent attribute or
nullif no ServiceComponent attribute is associated with this service.
-
setServiceGroup
public final void setServiceGroup(String serviceGroup) Set the ServiceGroup attribute.- Specified by:
setServiceGroupin interfaceServiceDiscoveryConfigurationInterface- Parameters:
serviceGroup- The ServiceGroup attribute.
-
getServiceGroup
public final String getServiceGroup()Gets the service's group.- Specified by:
getServiceGroupin interfaceServiceDiscoveryConfigurationInterface- 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:
getJVMIdin interfaceServiceDiscoveryConfigurationInterface- Returns:
- Identifier used to represent the JVM in which the service was deployed.
This value will be
nullif serialized from a 9.1.3 code base sinceJVMAttributewas introduced at 9.2.
-
setServiceDeploymentAttribute
Set the SoftwareComponent attribute.- Specified by:
setServiceDeploymentAttributein interfaceServiceDiscoveryConfigurationInterface- Parameters:
serviceDeploymentAttribute- The SoftwareComponent attribute.
-
getServiceDeploymentAttribute
Get the SoftwareComponent attribute.- Specified by:
getServiceDeploymentAttributein interfaceServiceDiscoveryConfigurationInterface- Returns:
- The SoftwareComponent attribute or
nullif no SoftwareComponent attribute is associated with this service.
-
getServiceFactory
public final String getServiceFactory()Gets the service factory.- Specified by:
getServiceFactoryin interfaceServiceDiscoveryConfigurationInterface- Returns:
- Service factory.
-
setServiceFactory
Sets the service factory.- Specified by:
setServiceFactoryin interfaceServiceDiscoveryConfigurationInterface- Parameters:
serviceFactory- Service factory- Throws:
InitializationException- if an invalid factory is specified.
-
addRMIBinding
Adds an RMI binding.- Parameters:
rmiBinding- RMI binding- Returns:
trueif the set did not already contain this object.
-
unbindFromRMIRegistry
public final void unbindFromRMIRegistry()Unbinds all RMI name bindings from the RMI registry.- Specified by:
unbindFromRMIRegistryin interfaceServiceDiscoveryConfigurationInterface
-
destroy
public final void destroy()Destroys this configuration by removing any RMI bindings that are associated with an RMI registry.- Specified by:
destroyin interfaceServiceDiscoveryConfigurationInterface
-
toString
public final String toString()Gets a string representation of this instance. Intended for use in log messages.- Overrides:
toStringin classObject- Returns:
- String representation of this instance.
-