All Libraries | This Library | Package | Class | Use | Tree | Deprecated | Index | Grand Index | Help
|  | Foundation |
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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

## com.sas.services.discovery
Class ServiceDeploymentAttribute

    com.sas.services.discovery.ServiceDeploymentAttribute

All Implemented Interfaces:
  ServiceAttributeInterface, java.io.Serializable

    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

Examples are provided to find a service that belongs a particular application's service deployment using the deployment's:

- name
- metadata ID
- name and metadata ID

## Example 1: Find a service using an application's service deployment's name

To find a service that belongs to an application's service deployment using the name of the service deployment, define a service template that specifies one or more interfaces that the desired service must implement and this attribute initialized to the desired service deployment name.

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);

## Example 2: Find a service using an application's service deployment's metadata ID

To find a service that belongs to an application's service deployment using the metadata ID of the service deployment, define a service template that specifies one or more interfaces that the desired service must implement and this attribute initialized to the desired service deployment's ID.

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);

## Example 3: Find a service using an application's service deployment's name and metadata ID

To find a service that belongs to an application's service deployment using the name and metadata ID of the service deployment, define a service template that specifies the desired service interface(s) and this attribute initialized to the desired service deployment's name and ID.

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.remote.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);

Since:
  9.2
See Also:
  Serialized Form

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.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

### ServiceDeploymentAttribute

    public ServiceDeploymentAttribute()

  Constructs a default instance with the application service deployment ID and name initialized to `null`.

### ServiceDeploymentAttribute

    public 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.

  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.

  Parameters:
    `serviceDeploymentName` - The metadata element's name or `null` if unspecified.
    `serviceDeploymentId` - The metadata element's id (i.e. "A5K2EL3N.B000000B") or `null` if unspecified.
  See Also:
    `ServiceDeploymentAttribute(SoftwareComponent)`

### ServiceDeploymentAttribute

    public ServiceDeploymentAttribute(com.sas.metadata.remote.SoftwareComponent serviceDeployment)
                               throws java.lang.IllegalArgumentException

  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`.

  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.

  Parameters:
    `serviceDeployment` - A remote JOMA metadata element that represents an application's foundation service deployment.
  Throws:
    `java.lang.IllegalArgumentException` - if a `null` parameter is specified or if the `SoftwareComponent` does not represent an application's foundation service deployment.
  See Also:
    `ServiceDeploymentAttribute(String, String)`

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

All Libraries | This Library | Package | Class | Use | Tree | Deprecated | Index | Grand Index | Help
|  | Foundation |
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2009 SAS Institute Inc. All Rights Reserved.