com.arjuna.ats.arjuna.gandiva
Class ObjectName

java.lang.Object
  extended bycom.arjuna.ats.arjuna.gandiva.ObjectName

public class ObjectName
extends java.lang.Object

Instances of this class can be used to convey arbitrary configuration information to classes. Simply by changing the data stored within an instance, the configuration of a class (or entire application) may be changed, without requiring it to be recompiled. Data is stored in a tuple-space . How data is stored and manipulated is also specified in a configurable manner via the NameService object. The name of an ObjectName is of the format: NS://[data], where [data] may be optionally encoded within the ObjectName string, or (more usual) stored elsewhere.

Since:
JTS 1.0.
Version:
$Id: ObjectName.java 2342 2006-03-30 13:06:17Z $
Author:
Mark Little (mark@arjuna.com)

Field Summary
static int CLASSNAME
           
static int OBJECTNAME
           
static int SIGNED_NUMBER
          All numbers are signed, but we leave this in for compatibility.
static int STRING
           
static int UID
           
static int UNSIGNED_NUMBER
           
 
Constructor Summary
ObjectName(NameService nameService, java.lang.String objectName)
          Create a new ObjectName using the specified NameService implementation, and using the specified name.
ObjectName(ObjectName objectName)
          Create a copy of an existing ObjectName.
ObjectName(java.lang.String objectName)
          Create a new ObjectName.
 
Method Summary
 int attributeType(java.lang.String attrName)
          Return the type of the specified attribute.
 void copy(ObjectName objectName)
          Copy the ObjectName provided into the current ObjectName.
 boolean equals(java.lang.Object o)
          Overrides Object.equals()
 boolean equals(ObjectName objectName)
          Are the two ObjectNames equal?
 void finalize()
           
 java.lang.String firstAttributeName()
          Return the first attribute.
 ClassName getClassNameAttribute(java.lang.String attrName)
          Return the ClassName value of the specified attribute.
 long getLongAttribute(java.lang.String attrName)
          Return the long value of the specified attribute.
 java.lang.String getMechanismName()
          Return the type of the NameService implementation used by this ObjectName instance.
 ObjectName getObjectNameAttribute(java.lang.String attrName)
          Return the ObjectName value of the specified attribute.
 java.lang.String getStringAttribute(java.lang.String attrName)
          Return the String value of the specified attribute.
 Uid getUidAttribute(java.lang.String attrName)
          Return the Uid value of the specified attribute.
static ObjectName invalid()
          Is the ObjectName valid?
 java.lang.String nextAttributeName(java.lang.String attrName)
          Return the next attribute after the specified attribute.
 boolean notEquals(ObjectName objectName)
          Are the two ObjectNames not equal?
static void print(int t)
          Print a human-readable for of the various attribute types.
 void print(java.io.PrintWriter strm)
           
 boolean removeAttribute(java.lang.String attrName)
          Remove the specified attribute.
 void setClassNameAttribute(java.lang.String attrName, ClassName value)
          Set the value of the specified attribute to be the provided ClassName value.
 void setLongAttribute(java.lang.String attrName, long value)
          Set the value of the specified attribute to be the provided long value.
 void setObjectNameAttribute(java.lang.String attrName, ObjectName value)
          Set the value of the specified attribute to be the provided ObjectName value.
 void setStringAttribute(java.lang.String attrName, java.lang.String value)
          Set the value of the specified attribute to be the provided String value.
 void setUidAttribute(java.lang.String attrName, Uid value)
          Set the value of the specified attribute to be the provided Uid value.
 java.lang.String stringForm()
          Provide a string form of the ObjectName.
 java.lang.String toString()
           
 java.lang.String uniqueAttributeName()
          Returns a new, unique attribute name.
static ObjectName uniqueObjectName(java.lang.String mech)
          Returns a new, unique ObjectName, using the NameService mechanism specified.
 
Methods inherited from class java.lang.Object
clone, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

SIGNED_NUMBER

public static final int SIGNED_NUMBER
All numbers are signed, but we leave this in for compatibility.

See Also:
Constant Field Values

UNSIGNED_NUMBER

public static final int UNSIGNED_NUMBER
See Also:
Constant Field Values

STRING

public static final int STRING
See Also:
Constant Field Values

OBJECTNAME

public static final int OBJECTNAME
See Also:
Constant Field Values

CLASSNAME

public static final int CLASSNAME
See Also:
Constant Field Values

UID

public static final int UID
See Also:
Constant Field Values
Constructor Detail

ObjectName

public ObjectName(java.lang.String objectName)
Create a new ObjectName.


ObjectName

public ObjectName(ObjectName objectName)
Create a copy of an existing ObjectName.


ObjectName

public ObjectName(NameService nameService,
                  java.lang.String objectName)
Create a new ObjectName using the specified NameService implementation, and using the specified name.

Method Detail

finalize

public void finalize()

attributeType

public int attributeType(java.lang.String attrName)
                  throws java.lang.NullPointerException,
                         java.io.IOException
Return the type of the specified attribute.

Throws:
java.lang.NullPointerException
java.io.IOException

firstAttributeName

public java.lang.String firstAttributeName()
                                    throws java.lang.NullPointerException,
                                           java.io.IOException
Return the first attribute.

Throws:
java.lang.NullPointerException
java.io.IOException

nextAttributeName

public java.lang.String nextAttributeName(java.lang.String attrName)
                                   throws java.lang.NullPointerException,
                                          java.io.IOException
Return the next attribute after the specified attribute.

Throws:
java.lang.NullPointerException
java.io.IOException

getLongAttribute

public long getLongAttribute(java.lang.String attrName)
                      throws java.lang.NullPointerException,
                             java.io.IOException
Return the long value of the specified attribute. If the specified attribute is of the wrong type, then an IOException will be thrown.

Throws:
java.lang.NullPointerException
java.io.IOException

getStringAttribute

public java.lang.String getStringAttribute(java.lang.String attrName)
                                    throws java.lang.NullPointerException,
                                           java.io.IOException
Return the String value of the specified attribute. If the specified attribute is of the wrong type, then an IOException will be thrown.

Throws:
java.lang.NullPointerException
java.io.IOException

getObjectNameAttribute

public ObjectName getObjectNameAttribute(java.lang.String attrName)
                                  throws java.lang.NullPointerException,
                                         java.io.IOException
Return the ObjectName value of the specified attribute. If the specified attribute is of the wrong type, then an IOException will be thrown.

Throws:
java.lang.NullPointerException
java.io.IOException

getClassNameAttribute

public ClassName getClassNameAttribute(java.lang.String attrName)
                                throws java.lang.NullPointerException,
                                       java.io.IOException
Return the ClassName value of the specified attribute. If the specified attribute is of the wrong type, then an IOException will be thrown.

Throws:
java.lang.NullPointerException
java.io.IOException

getUidAttribute

public Uid getUidAttribute(java.lang.String attrName)
                    throws java.lang.NullPointerException,
                           java.io.IOException
Return the Uid value of the specified attribute. If the specified attribute is of the wrong type, then an IOException will be thrown.

Throws:
java.lang.NullPointerException
java.io.IOException

setLongAttribute

public void setLongAttribute(java.lang.String attrName,
                             long value)
                      throws java.lang.NullPointerException,
                             java.io.IOException
Set the value of the specified attribute to be the provided long value.

Throws:
java.lang.NullPointerException
java.io.IOException

setStringAttribute

public void setStringAttribute(java.lang.String attrName,
                               java.lang.String value)
                        throws java.lang.NullPointerException,
                               java.io.IOException
Set the value of the specified attribute to be the provided String value.

Throws:
java.lang.NullPointerException
java.io.IOException

setObjectNameAttribute

public void setObjectNameAttribute(java.lang.String attrName,
                                   ObjectName value)
                            throws java.lang.NullPointerException,
                                   java.io.IOException
Set the value of the specified attribute to be the provided ObjectName value.

Throws:
java.lang.NullPointerException
java.io.IOException

setClassNameAttribute

public void setClassNameAttribute(java.lang.String attrName,
                                  ClassName value)
                           throws java.lang.NullPointerException,
                                  java.io.IOException
Set the value of the specified attribute to be the provided ClassName value.

Throws:
java.lang.NullPointerException
java.io.IOException

setUidAttribute

public void setUidAttribute(java.lang.String attrName,
                            Uid value)
                     throws java.lang.NullPointerException,
                            java.io.IOException
Set the value of the specified attribute to be the provided Uid value.

Throws:
java.lang.NullPointerException
java.io.IOException

removeAttribute

public boolean removeAttribute(java.lang.String attrName)
                        throws java.io.IOException
Remove the specified attribute. Returns true if the attribute was not null, false otherwise.

Throws:
java.io.IOException

uniqueAttributeName

public java.lang.String uniqueAttributeName()
                                     throws java.lang.NullPointerException,
                                            java.io.IOException
Returns a new, unique attribute name. This name is only guaranteed to be unique within the NameService implementation used by this ObjectName instance.

Throws:
java.lang.NullPointerException
java.io.IOException

uniqueObjectName

public static ObjectName uniqueObjectName(java.lang.String mech)
                                   throws java.lang.NullPointerException,
                                          java.io.IOException
Returns a new, unique ObjectName, using the NameService mechanism specified.

Throws:
java.lang.NullPointerException
java.io.IOException

copy

public void copy(ObjectName objectName)
Copy the ObjectName provided into the current ObjectName.


equals

public boolean equals(java.lang.Object o)
Overrides Object.equals()


equals

public boolean equals(ObjectName objectName)
Are the two ObjectNames equal?


notEquals

public boolean notEquals(ObjectName objectName)
Are the two ObjectNames not equal?


getMechanismName

public java.lang.String getMechanismName()
Return the type of the NameService implementation used by this ObjectName instance.


stringForm

public java.lang.String stringForm()
Provide a string form of the ObjectName.


invalid

public static ObjectName invalid()
Is the ObjectName valid?


print

public void print(java.io.PrintWriter strm)

toString

public java.lang.String toString()

print

public static void print(int t)
Print a human-readable for of the various attribute types.