com.tivoli.twg.engine.slp
Class Attribute

java.lang.Object
  extended bycom.tivoli.twg.engine.slp.Attribute

public final class Attribute
extends java.lang.Object

SLPv2 Service Attribute

from RFC 2608 (Service Location Protocol, Version 2):

The allowable attributes which may be used are typically specified by a Service Template [13] for a particular service type. Services which are advertised according to a standard template MUST register all service attributes which the standard template requires. URLs with schemes other than "service:" MAY be registered with attributes.

Non-standard attribute names SHOULD begin with "x-", because no standard attribute name will ever have those initial characters.

An attribute list is a string encoding of the attributes of a service. The following ABNF [11] grammar defines attribute lists:

    attr-list = attribute / attribute `,' attr-list
    attribute = `(' attr-tag `=' attr-val-list `)' / attr-tag
    attr-val-list = attr-val / attr-val `,' attr-val-list
    attr-tag = 1*safe-tag
    attr-val = intval / strval / boolval / opaque
    intval = [-]1*DIGIT
    strval = 1*safe-val
    boolval = "true" / "false"
    opaque = "\FF" 1*escape-val
    safe-val = ; Any character except reserved.
    safe-tag = ; Any character except reserved, star and bad-tag.
    reserved = `(' / `)' / `,' / `\' / `!' / `<' / `=' / `>' / `~' / CTL
    escape-val = `\' HEXDIG HEXDIG
    bad-tag = CR / LF / HTAB / `_'
    star = `*'

The <attr-list>, if present, MUST be scanned prior to evaluation for all occurrences of the escape character `\'. Reserved characters MUST be escaped (other characters MUST NOT be escaped). All escaped characters must be restored to their value before attempting string matching. For Opaque values, escaped characters are not converted - they are interpreted as bytes.

Boolean
Strings which have the form "true" or "false" can only take one value and may only be compared with '='. Booleans are case insensitive when compared.
Integer
Strings which take the form [-] 1* and fall in the range "-2147483648" to "2147483647" are considered to be Integers. These are compared using integer comparison.
String
All other Strings are matched using strict lexical ordering (see Section 6.4).
Opaque
Opaque values are sequences of bytes. These are distinguished from Strings since they begin with the sequence "\FF". This, unescaped, is an illegal UTF-8 encoding, indicating that what follows is a sequence of bytes expressed in escape notation which constitute the binary value. For example, a '0' byte is encoded "\FF\00".

A string which contains escaped values other than from the reserved set of characters is illegal. If such a string is included in an <attr-list>, <tag-list> or search filter, the SA or DA which receives it MUST return a PARSE_ERROR to the message.

A keyword has only an <attr-tag>, and no values. Attributes can have one or multiple values. All values are expressed as strings.

When values have been advertised by a SA or are registered in a DA, they can take on implicit typing rules for matching incoming requests.

Stored values must be consistent, i.e., x=4,true,sue,\ff\00\00 is disallowed. A DA or SA receiving such an <attr-list> MUST return an INVALID_REGISTRATION error.


Method Summary
 java.lang.Object clone()
           
 boolean equals(java.lang.Object object)
          Indicates whether some other object is "equal to" this one.
static Attribute find(java.lang.String tag, java.util.List attributes)
           
 java.lang.String getTag()
          Returns attribute tag
 java.lang.Object getValue()
          Returns attribute value
 int hashCode()
          Returns a hash code value for the object.
static java.util.List parse(java.lang.String attributeList)
          Parses the string argument as a list of Attribute objects
 java.lang.String toString()
          Returns a string representation of the object.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

parse

public static java.util.List parse(java.lang.String attributeList)
                            throws AttributeFormatException,
                                   com.tivoli.twg.engine.slp.MessageFormatException
Parses the string argument as a list of Attribute objects

Returns:
List Attribute objects
Throws:
AttributeFormatException - if the string does not contain a parsable attribute list
MessageFormatException - if the string does not contain a parsable attribute list

find

public static Attribute find(java.lang.String tag,
                             java.util.List attributes)

equals

public boolean equals(java.lang.Object object)
Indicates whether some other object is "equal to" this one.

See Also:
Object.equals(java.lang.Object)

hashCode

public int hashCode()
Returns a hash code value for the object.

See Also:
Object.hashCode()

getTag

public java.lang.String getTag()
Returns attribute tag

Returns:
String attribute tag

getValue

public java.lang.Object getValue()
Returns attribute value

Returns:
Object attribute value

clone

public final java.lang.Object clone()
                             throws java.lang.CloneNotSupportedException
Throws:
java.lang.CloneNotSupportedException
See Also:
Object.clone()

toString

public java.lang.String toString()
Returns a string representation of the object.

See Also:
Object.toString()