|
Foundation |
|
| |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
com.sas.services.discovery.NameValueAttribute
public class NameValueAttribute
A foundation service discovery attribute which may be used to find a service based upon a name/value.
When a service is deployed, a NameValueAttribute
will be added to its service discovery configuration for each
Keyword
that is associated to the service, its deployment group,
or its application service deployment.
Keyword
metadata objects
whose Name
and Description
attributes correspond to the
desired name/value.
Examples are provided to find a service using a user-defined name/value attribute:
The following example shows how to define a service template that can be used to discover an Authentication Service which is associated with a Name/Value of "sas.application.name"/"Solutions".
import com.sas.services.discovery.DiscoveryService; import com.sas.services.discovery.NameValueAttribute; import com.sas.services.discovery.ServiceTemplate; import com.sas.services.security.AuthenticationServiceInterface; ... // define a service template that can be used to // lookup an Authentication Service Class[] desiredServiceInterface = new Class[] { AuthenticationServiceInterface.class }; // look for a service with the desired name/value ServiceAttributeInterface serviceAttributes = new ServiceAttributeInterface[] { new NameValueAttribute( "sas.application.name", "Solutions") }; // create a service lookup template specifying the required // service interface(s) and a service attribute for a // service that is associated with the desired name/value ServiceTemplate serviceTemplate = new ServiceTemplate( desiredServiceInterface, 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 which is associated with the following Name/Value keywords "sas.application.name"/"Solutions" and "sas.application.name"/"Web Report Studio".
import com.sas.services.discovery.DiscoveryService; import com.sas.services.discovery.NameValueAttribute; import com.sas.services.discovery.ServiceTemplate; import com.sas.services.security.AuthenticationServiceInterface; ... // define a service template that can be used to // lookup an Authentication Service Class[] desiredServiceInterface = new Class[] { AuthenticationServiceInterface.class }; // look for a service with the desired name/value keywords ServiceAttributeInterface serviceAttributes = new ServiceAttributeInterface[] { new NameValueAttribute( "sas.application.name", "Solutions"), new NameValueAttribute( "sas.application.name", "Web Report Studio") }; // create a service lookup template specifying the required // service interface(s) and a service attribute for a // service that is associated with the desired name/value ServiceTemplate serviceTemplate = new ServiceTemplate( desiredServiceInterface, serviceAttributes); // discover a service satisfying the service template AuthenticationServiceInterface authenticationService = (AuthenticationServiceInterface) DiscoveryService.defaultInstance().findService(serviceTemplate);
Field Summary | |
---|---|
java.lang.String |
name
A name describing an arbitrary type of attribute. |
java.lang.String |
value
The value of the named attribute. |
Constructor Summary | |
---|---|
NameValueAttribute()
Constructs a default instance with a null name and
null value. |
|
NameValueAttribute(java.lang.String attributeName)
Constructs an instance initialized with the specified name that is associated with a null value. |
|
NameValueAttribute(java.lang.String attributeName,
java.lang.String attributeValue)
Constructs an instance initialized with the specified named attribute and its associated value. |
Method Summary | |
---|---|
java.util.Map |
getFieldNameToValueMap()
Gets a map keyed by the String names of the
following attributes to their values. |
Methods inherited from class com.sas.services.AbstractServiceAttribute |
---|
equals, hashCode, toString |
Field Detail |
---|
public java.lang.String name
public java.lang.String value
Constructor Detail |
---|
public NameValueAttribute()
null
name and
null
value.
public NameValueAttribute(java.lang.String attributeName)
null
value.
attributeName
- The name of the attribute.public NameValueAttribute(java.lang.String attributeName, java.lang.String attributeValue)
attributeName
- The name of the attribute.attributeValue
- The value associated with this named attribute.Method Detail |
---|
public java.util.Map getFieldNameToValueMap()
String
names of the
following attributes to their values.
getFieldNameToValueMap
in class AbstractServiceAttribute
String
names of a field to their values.
|
Foundation |
|
| |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |