|
Foundation |
|
| |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
com.sas.services.discovery.ServiceDeploymentAttribute
public final class ServiceDeploymentAttribute
A foundation service discovery attribute which represents an application's service deployment which may be used to discover a foundation service that belongs to a particular service deployment.
When a service is deployed, a ServiceDeploymentAttribute
will be added to its service discovery configuration representing the
deployment that owns the service.
An application's service deployment is represented by a metadata
SoftwareComponent
.
Attribute | Description |
---|---|
id | the fully-qualified metadata ID of the
SoftwareComponent that represents the application's service deployment
(i.e. SoftwareComponent.Id ) |
name | the name of the
SoftwareComponent that represents the application's service deployment
(i.e. SoftwareComponent.Name ) |
Any values that are not specified should be null
to
indicate a "don't care".
Examples are provided to find a service that belongs a particular application's service deployment using the deployment's:
The following example shows how to define a service template that can be used to discover an Authentication service that belongs to an application service deployment named "My Services".
import com.sas.services.discovery.DiscoveryService; import com.sas.services.discovery.ServiceAttributeInterface; import com.sas.services.discovery.ServiceDeploymentAttribute; import com.sas.services.discovery.ServiceTemplate; import com.sas.services.security.AuthenticationServiceInterface; ... // specify the desired service type(s) Class[] desiredServiceTypes = new Class[] { AuthenticationServiceInterface.class}; // the name of the application's service deployment String serviceDeploymentName = "My Services"; // specify the optional attributes to be used to qualify a discovery lookup // to include only those services which belong to an application service // deployment with the specified name. ServiceAttributeInterface[] serviceAttributes = new ServiceAttributeInterface[] { new ServiceDeploymentAttribute( serviceDeploymentName, null)};// don't care about the service deployment's metadata ID // create a service lookup template specifying the required // service interface(s) and a service attribute for a // service that belongs to a particular application service deployment ServiceTemplate serviceTemplate = new ServiceTemplate( desiredServiceTypes, serviceAttributes); // discover a service satisfying the service template AuthenticationServiceInterface authenticationService = (AuthenticationServiceInterface) DiscoveryService.defaultInstance().findService(serviceTemplate);
The following example shows how to define a service template that can be used to discover an Authentication service that belongs to an application service deployment whose metadata ID is "A0000001.ABABABAB".
import com.sas.services.discovery.DiscoveryService; import com.sas.services.discovery.ServiceAttributeInterface; import com.sas.services.discovery.ServiceDeploymentAttribute; import com.sas.services.discovery.ServiceTemplate; import com.sas.services.security.AuthenticationServiceInterface; ... // specify the desired service type(s) final Class[] desiredServiceTypes = new Class[] { AuthenticationServiceInterface.class}; // The SoftwareComponent.Id for the metadata software component // that represents the application's service deployment String serviceDeploymentId = "A0000001.ABABABAB"; // specify the optional attributes to be used to qualify a discovery lookup // to include only those services which belong to an application service // deployment with the specified metadata ID. ServiceAttributeInterface[] serviceAttributes = new ServiceAttributeInterface[] { new ServiceDeploymentAttribute( null,// don't care about the service deployment's name serviceDeploymentId)}; // create a service lookup template specifying the required // service interface(s) and a service attribute for a // service that belongs to a particular application service deployment ServiceTemplate serviceTemplate = new ServiceTemplate( desiredServiceTypes, serviceAttributes); // discover a service satisfying the service template AuthenticationServiceInterface authenticationService = (AuthenticationServiceInterface) DiscoveryService.defaultInstance().findService(serviceTemplate);
The following example shows how to define a service template that can be used to discover an Authentication service that belongs to an application service deployment whose name is "My Services" and whose metadata ID is "A0000001.ABABABAB".
import com.sas.metadata.SoftwareComponent; import com.sas.services.discovery.DiscoveryService; import com.sas.services.discovery.ServiceAttributeInterface; import com.sas.services.discovery.ServiceDeploymentAttribute; import com.sas.services.discovery.ServiceTemplate; import com.sas.services.security.AuthenticationServiceInterface; ... // specify the desired service type(s) final Class[] desiredServiceTypes = new Class[] { AuthenticationServiceInterface.class}; // given the metadata SoftwareComponent metadata object // representing a application's service deployment, determine // its name and metadata ID String serviceDeploymentName = softwareComponent.getName(); String serviceDeploymentID = softwareComponent.getFQID(); // specify the optional attributes to be used to qualify a discovery lookup // to include only those services which belong to an application service // deployment with the specified name and metadata ID. ServiceAttributeInterface[] serviceAttributes = new ServiceAttributeInterface[] { new ServiceDeploymentAttribute( serviceDeploymentName, serviceDeploymentID)}; // create a service lookup template specifying the required // service interface(s) and a service attribute for a // service that belongs to a particular application service deployment ServiceTemplate serviceTemplate = new ServiceTemplate( desiredServiceTypes, serviceAttributes); // discover a service satisfying the service template AuthenticationServiceInterface authenticationService = (AuthenticationServiceInterface) DiscoveryService.defaultInstance().findService(serviceTemplate);
Field Summary |
---|
Fields inherited from class com.sas.services.discovery.MetadataAttribute |
---|
classIdentifier, elementType, id, name |
Constructor Summary | |
---|---|
ServiceDeploymentAttribute()
Constructs a default instance with the application service deployment ID and name initialized to null . |
|
ServiceDeploymentAttribute(com.sas.metadata.SoftwareComponent serviceDeployment)
Constructs a service discovery attribute which may be used to lookup a service which belongs to the specified application service deployment using the ID and name for the specified a local JOMA SoftwareComponent . |
|
ServiceDeploymentAttribute(com.sas.metadata.remote.SoftwareComponent serviceDeployment)
Constructs a service discovery attribute which may be used to lookup a service which belongs to the specified application service deployment using the ID and name for the specified a remote JOMA SoftwareComponent . |
|
ServiceDeploymentAttribute(java.lang.String serviceDeploymentName,
java.lang.String serviceDeploymentId)
Constructs a service discovery attribute which may be used to lookup a service which belongs to the specified application service deployment. |
Method Summary |
---|
Methods inherited from class com.sas.services.discovery.MetadataAttribute |
---|
getFieldNameToValueMap |
Methods inherited from class com.sas.services.AbstractServiceAttribute |
---|
equals, hashCode, toString |
Constructor Detail |
---|
public ServiceDeploymentAttribute()
null
.
public ServiceDeploymentAttribute(java.lang.String serviceDeploymentName, java.lang.String serviceDeploymentId)
Use this constructor if you don't have a SoftwareComponent
that
represents an application's service deployment and you want to initialize
a service discovery attribute that can be used to lookup a service that
belongs to a particular service deployment using its ID and/or name.
serviceDeploymentName
- The metadata element's name or null
if unspecified.serviceDeploymentId
- The metadata element's id (i.e. "A5K2EL3N.B000000B") or
null
if unspecified.ServiceDeploymentAttribute(com.sas.metadata.SoftwareComponent)
,
ServiceDeploymentAttribute(com.sas.metadata.remote.SoftwareComponent)
public ServiceDeploymentAttribute(com.sas.metadata.SoftwareComponent serviceDeployment) throws java.lang.IllegalArgumentException
SoftwareComponent
.
Use this constructor if you have a SoftwareComponent
that
represents an application's service deployment and you want to initialize
a service discovery attribute that can be used to lookup a service that
belongs to a particular service deployment.
serviceDeployment
- A metadata element that represents an application's foundation
service deployment.
java.lang.IllegalArgumentException
- if a null
parameter is specified
or if the SoftwareComponent
does not represent an application's foundation
service deployment.ServiceDeploymentAttribute(String, String)
,
ServiceDeploymentAttribute(com.sas.metadata.remote.SoftwareComponent)
public ServiceDeploymentAttribute(com.sas.metadata.remote.SoftwareComponent serviceDeployment) throws java.lang.IllegalArgumentException
SoftwareComponent
.
Use this constructor if you have a
com.sas.metadata.remote.SoftwareComponent
that
represents an application's service deployment and you want to initialize
a service discovery attribute that can be used to lookup a service that
belongs to a particular service deployment.
serviceDeployment
- A remote JOMA metadata element that represents an application's foundation
service deployment.
java.lang.IllegalArgumentException
- if a null
parameter is specified
or if the SoftwareComponent
does not represent an application's foundation
service deployment.ServiceDeploymentAttribute(String, String)
,
ServiceDeploymentAttribute(com.sas.metadata.SoftwareComponent)
|
Foundation |
|
| |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |