com.novell.service.file.nw
Class ExtendedAttribute

java.lang.Object
  |
  +--com.novell.service.file.nw.ExtendedAttribute

public class ExtendedAttribute
extends java.lang.Object
implements java.lang.Cloneable

Provides constructors and methods for the support of an extended attribute. An extended attribute is composed of a name and a corresponding byte array of data.

WARNING: This class results in a mutable object. For versitility code block synchronization has been implemented in the various jndi search and modify methods of this classes implementation to provide for thread safe operation.

If you have a multi-threaded application and a code segment of that application uses get methods of this class, and there is a potential of another thread randomly using corresponding set methods of this class, you should enclose the calls to the get method of this class in a synchronized code block.

If you have a multi-threaded application and a code segment of that application uses set methods of this class, and there is a potential of another thread randomly using corresponding get methods of this class, you should enclose the calls to the set methods of this class in a synchronized code block.

See Also:
EAEnumerator

Field Summary
static java.lang.String ATTRIBUTE_ID
          Attribute ID of ExtendedAttribute
static java.lang.String COMPARE_SYNTAX_STRING
          Schema syntax of ExtendedAttribute
static java.lang.String NAME_FIELD
          Compare Fields
static java.lang.String SCHEMA_BINDING_NAME
          Schema name of ExtendedAttribute
 
Constructor Summary
ExtendedAttribute()
          Constructs an ExtendedAttribute object with name and data set to NULL.
ExtendedAttribute(byte[] data)
          Constructs an ExtendedAttribute object with the data set to the passed in parameter.
ExtendedAttribute(java.lang.String name)
          Constructs an ExtendedAttribute object with the name set to the passed in parameter.
ExtendedAttribute(java.lang.String name, byte[] data)
          Constructs an ExtendedAttribute object with the name and data set to the passed in parameters.
 
Method Summary
 java.lang.Object clone()
          Instantiates a new object of this type with all new references, but with the same values within those references.
 boolean equals(java.lang.Object obj)
          Compares the input object against this object.
 java.lang.String getCompareString()
          Returns the current value of compareString.
 byte[] getData()
          Returns the Data associated with this extended attribute.
 java.lang.String getName()
          Returns the name associated with this extended attribute.
 com.novell.service.rfc1960.Rfc1960Parser getSearchStringParser()
          Returns the RFC1960 search string parser for the compare string.
 void setCompareString(java.lang.String compareString)
          Sets the compare string value used to allow individual compares on the eaName field.
 void setData(byte[] data)
          Sets the Data to be associated with this extended attribute.
 void setName(java.lang.String name)
          Sets the name to be associated with this extended attribute.
 java.lang.String toString()
          Converts the object to a String.
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ATTRIBUTE_ID

public static final java.lang.String ATTRIBUTE_ID
Attribute ID of ExtendedAttribute

(ATTRIBUTE_ID = "Extended Attribute")


SCHEMA_BINDING_NAME

public static final java.lang.String SCHEMA_BINDING_NAME
Schema name of ExtendedAttribute

(SCHEMA_BINDING_NAME = ATTRIBUTE_ID + " Definition")


COMPARE_SYNTAX_STRING

public static final java.lang.String COMPARE_SYNTAX_STRING
Schema syntax of ExtendedAttribute

(COMPARE_SYNTAX_STRING = "(" + SearchStringComponent.EQUALS_STRING + "," + SearchStringComponent.PRESENT_STRING + "," + SearchStringComponent.SUBSTRING_STRING + ")")


NAME_FIELD

public static final java.lang.String NAME_FIELD
Compare Fields

(NAME_FIELD = "Name")

See Also:
setCompareString(java.lang.String), equals(java.lang.Object)
Constructor Detail

ExtendedAttribute

public ExtendedAttribute()
Constructs an ExtendedAttribute object with name and data set to NULL.
See Also:
setName(java.lang.String), setData(byte[])

ExtendedAttribute

public ExtendedAttribute(java.lang.String name)
Constructs an ExtendedAttribute object with the name set to the passed in parameter.
Parameters:
name - The extended attribute's name
See Also:
setData(byte[])

ExtendedAttribute

public ExtendedAttribute(byte[] data)
Constructs an ExtendedAttribute object with the data set to the passed in parameter.
Parameters:
data - The extended attribute's data.
See Also:
setName(java.lang.String)

ExtendedAttribute

public ExtendedAttribute(java.lang.String name,
                         byte[] data)
Constructs an ExtendedAttribute object with the name and data set to the passed in parameters.
Parameters:
name - The extended attribute's name.
data - The extended attribute's data.
Method Detail

getName

public java.lang.String getName()
Returns the name associated with this extended attribute.
Returns:
The current name assigned to this object.

setName

public void setName(java.lang.String name)
Sets the name to be associated with this extended attribute.
Parameters:
name - The extended attribute's name.

getData

public byte[] getData()
Returns the Data associated with this extended attribute.
Returns:
The current object data in a byte array.

setData

public void setData(byte[] data)
Sets the Data to be associated with this extended attribute.
Parameters:
data - The extended attributes data.

setCompareString

public void setCompareString(java.lang.String compareString)
Sets the compare string value used to allow individual compares on the eaName field. The compare string uses the RFC1960 (LDAP) search string format.

See the various SearchStringComponent compare methods referenced below for detailed information on the operation types allowed for String and integer data members.

These fields have taken the names of their corresponding methods minus the get or set prefix. Given the following string: "(&(Name=*printer*)(ObjectId>=2)(Rights>=128))". The equals method returns TRUE if the name contains the substring "printer" and the objectId is not 2, and the rights are set to modify (TA_MODIFY). If the approximate operator type is used on the Rights field the various bits of the operand value are checked, and if any of them are set, equals will return TRUE. For example: (Rights~=3) returns TRUE if either the TA_READ or the TA_WRITE bits are set, regardless of what other bits are set.

If the string passed in is not a valid RFC1960 formatted string, this method will throw an IllegalArgumentException. If the compareString value is NULL, RFC1960 formatted compares will be disabled.

Parameters:
compareString - The RFC1960 formatted search string. NULL disables this compare functionality.
Throws:
java.lang.IllegalArgumentException - When the string passed in is not a valid RFC1960 formatted string.
See Also:
equals(java.lang.Object), NAME_FIELD

getCompareString

public java.lang.String getCompareString()
Returns the current value of compareString.
Returns:
The current value of compareString.
See Also:
Trustee.setCompareString(java.lang.String)

getSearchStringParser

public com.novell.service.rfc1960.Rfc1960Parser getSearchStringParser()
Returns the RFC1960 search string parser for the compare string.

Returns a Rfc1960Parser object that was instantiated with the compareString last set by the setCompareString() method.

Returns:
The Rfc1960Parser object for the current compare String. NULL is returned if the compare string has not been set.

equals

public boolean equals(java.lang.Object obj)
Compares the input object against this object. If the input object is a byte array, the compare string is ignored and the eaData is compared. If the input object is an ExtendedAttribute and has a RFC1960 compare string, this method will do the comparision based on the commands in the compare string. If the operationType is illegal for the data type being compared, an IllegalArmumentException will be thrown.

Parameters:
obj - The object to compare.
Returns:
A boolean set to TRUE if equals, otherwise FALSE.
Throws:
java.lang.IllegalArgumentException - When the operationType is illegal for the data type being compared.
Overrides:
equals in class java.lang.Object
See Also:
setCompareString(java.lang.String), NAME_FIELD

toString

public java.lang.String toString()
Converts the object to a String.

A String is created that contains the name of the attribute, the size of the data and a comma separated list of its first 128 data elements in the following format: "eaName: s, compareString: s, eaData length: n, eaData: 1, 2, 3, ..."

This method overrides the Object.toString method.

Returns:
The object information converted to a String.
Overrides:
toString in class java.lang.Object

clone

public java.lang.Object clone()
Instantiates a new object of this type with all new references, but with the same values within those references.
Returns:
A new Trustee object with the same values.