com.novell.service.file.nw
Class Trustee

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

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

Provides variables, constructors, and methods for the support of a Trustee. Trustees can be associated with a given directory entry (file or directory). The given directory entry can have multiple trustees, which can be enumerated using the TrusteeEnumerator interface.

A Trustee is composed of a name identifying the trustee, the rights associated with the named trustee, and a compare string. The compare string uses the RFC1960 (LDAP) search string format and is used to allow individual compares on names and rights.

Warning: This class results in a mutable object. For versatility, code block synchronization has been implemented in the various jndi search and modify methods of this class's 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 methods 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:
TrusteeEnumerator

Field Summary
static java.lang.String ATTRIBUTE_ID
          Attribute ID of Trustee.
static java.lang.String COMPARE_SYNTAX_STRING
          Schema Syntax of Trustee.
static java.lang.String NAME_FIELD
          Compare field for names.
static java.lang.String RIGHTS_FIELD
          Compare field for rights.
static java.lang.String SCHEMA_BINDING_NAME
          Schema Name of Trustee.
static int TA_CREATE
          Create rights.
static int TA_DELETE
          Delete rights.
static int TA_MODIFY
          Modify rights.
static int TA_OWNERSHIP
          Ownership rights.
static int TA_READ
          Read rights.
static int TA_SEARCH
          Search rights.
static int TA_SUPERVISOR
          Supervisor rights.
static int TA_WRITE
          Write rights.
 
Constructor Summary
Trustee()
          Creates the default constructor with all data members set to NULL or zero.
Trustee(int objectRights)
          Creates a constructor with the rights known and all other data members set to NULL or zero.
Trustee(java.lang.String name)
          Creates a constructor with the name known and all other data members set to NULL or zero.
Trustee(java.lang.String name, int objectRights)
          Creates a constructor with all data members based on the input parameters.
 
Method Summary
 java.lang.Object clone()
          Instantiates a new object of this type.
 boolean equals(java.lang.Object obj)
          Compares the input object against this object for equality.
 java.lang.String getCompareString()
          Returns the current value of compareString.
 boolean getCreateRights()
          Returns a boolean value reflecting the state of the Create bit of the object rights mask.
 boolean getDeleteRights()
          Returns the state of the Delete bit of the object rights mask as a boolean value.
 boolean getModifyRights()
          Returns a boolean value reflecting the state of the Modify bit of the object rights mask.
 java.lang.String getName()
          Returns this object's name field.
 boolean getOwnershipRights()
          Returns a boolean value reflecting the state of the Ownership bit of the object rights mask.
 boolean getReadRights()
          Returns a boolean value reflecting the state of the object rights mask Read bit.
 int getRights()
          Returns the value of the objectRights data member.
 boolean getSearchRights()
          Returns a boolean value reflecting the state of the Search bit of the object rights mask.
 com.novell.service.rfc1960.Rfc1960Parser getSearchStringParser()
          Returns the RFC1960 search string parser for the compare string.
 boolean getSupervisorRights()
          Returns a boolean value reflecting the state of the Supervisor bit of the object rights mask.
 boolean getWriteRights()
          Returns a boolean value reflecting the state of the Write bit of the object rights mask.
 void setCompareString(java.lang.String compareString)
          Sets the compare string value to allow individual compares on the name and rights fields.
 void setCreateRights(boolean value)
          Sets the Create bit of the object rights mask based on the boolean input value.
 void setDeleteRights(boolean value)
          Sets the Delete bit of the object rights mask based on the boolean input value.
 void setModifyRights(boolean value)
          Sets the Modify bit of the object rights mask based on the boolean input value.
 void setName(java.lang.String name)
          Sets the name field of the attribute.
 void setOwnershipRights(boolean value)
          Sets the Ownership bit of the object rights mask based on the boolean input value.
 void setReadRights(boolean value)
          Sets the Read bit of the objectRights mask based on the boolean input value.
 void setRights(int value)
          Sets the objectRights data member of this object to the specified value.
 void setSearchRights(boolean value)
          Sets the Search bit of the object rights mask based on the boolean input value.
 void setSupervisorRights(boolean value)
          Sets the Supervisor bit of the object rights mask based on the boolean input value.
 void setWriteRights(boolean value)
          Sets the Write bit of the object rights mask based on the boolean input value.
 java.lang.String toString()
          Returns a String representation of this object.
 
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 Trustee.

(ATTRIBUTE_ID = "Trustee")


SCHEMA_BINDING_NAME

public static final java.lang.String SCHEMA_BINDING_NAME
Schema Name of Trustee.

(SCHEMA_BINDING_NAME = ATTRIBUTE_ID + " Definition")


COMPARE_SYNTAX_STRING

public static final java.lang.String COMPARE_SYNTAX_STRING
Schema Syntax of Trustee.

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


NAME_FIELD

public static final java.lang.String NAME_FIELD
Compare field for names.

(NAME_FIELD = "Name")

See Also:
equals(Object)

RIGHTS_FIELD

public static final java.lang.String RIGHTS_FIELD
Compare field for rights.

(RIGHTS_FIELD = "Rights")

See Also:
equals(Object)

TA_READ

public static final int TA_READ
Read rights.

(TA_READ = 0x1)

See Also:
getReadRights(), setReadRights(boolean)

TA_WRITE

public static final int TA_WRITE
Write rights.

(TA_WRITE = 0x2)

See Also:
getWriteRights(), setWriteRights(boolean)

TA_CREATE

public static final int TA_CREATE
Create rights.

(TA_CREATE = 0x8)

See Also:
getCreateRights(), setCreateRights(boolean)

TA_DELETE

public static final int TA_DELETE
Delete rights.

(TA_DELETE = 0x10)

See Also:
getDeleteRights(), setDeleteRights(boolean)

TA_OWNERSHIP

public static final int TA_OWNERSHIP
Ownership rights.

(TA_OWNERSHIP = 0x20)

See Also:
getOwnershipRights(), setOwnershipRights(boolean)

TA_SEARCH

public static final int TA_SEARCH
Search rights.

(TA_SEARCH = 0x40)

See Also:
getSearchRights(), setSearchRights(boolean)

TA_MODIFY

public static final int TA_MODIFY
Modify rights.

(TA_MODIFY = 0x80)

See Also:
getModifyRights(), setModifyRights(boolean)

TA_SUPERVISOR

public static final int TA_SUPERVISOR
Supervisor rights.

(TA_SUPERVISOR = 0x0100)

Constructor Detail

Trustee

public Trustee()
Creates the default constructor with all data members set to NULL or zero.

Trustee

public Trustee(java.lang.String name)
Creates a constructor with the name known and all other data members set to NULL or zero.
Parameters:
name - The trustee name.

Trustee

public Trustee(int objectRights)
Creates a constructor with the rights known and all other data members set to NULL or zero.
Parameters:
rights - The trustee rights.

Trustee

public Trustee(java.lang.String name,
               int objectRights)
Creates a constructor with all data members based on the input parameters.
Parameters:
name - The value of the name data member.
objectRights - The value of the objectRights data member.
Throws:
java.lang.IllegalArgumentException - if an illegal arguement is passed in.
Method Detail

getName

public java.lang.String getName()
Returns this object's name field.
Returns:
The current name.

setName

public void setName(java.lang.String name)
Sets the name field of the attribute.
Parameters:
name - The name to be assigned the attribute.

getRights

public int getRights()
Returns the value of the objectRights data member.
Returns:
The current objectRights mask value.

setRights

public void setRights(int value)
Sets the objectRights data member of this object to the specified value.
Parameters:
value - The value to be set in the ojbectRights mask.

setCompareString

public void setCompareString(java.lang.String compareString)
Sets the compare string value to allow individual compares on the name and rights fields. The compare string uses the RFC1960 (LDAP) search string format.

The names of these fields takes 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 will return TRUE if the Name contains the substring printer, the ObjectId is not 2, and Rights is >= 128. 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 TA_WRITE bits are set, regardless of what other bits might be set.

If the string passed in is not a valid RFC1960 formatted string, an IllegalArgumentException will be thrown. 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 - if the string passed in is not a valid RFC1960 formatted string.
See Also:
equals(java.lang.Object), NAME_FIELD, RIGHTS_FIELD

getCompareString

public java.lang.String getCompareString()
Returns the current value of compareString.
Returns:
The current value of compareString.
See Also:
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 for the current search String. Returns NULL if the search string has not been set.

setReadRights

public void setReadRights(boolean value)
Sets the Read bit of the objectRights mask based on the boolean input value.
Parameters:
value - A boolean set to TRUE if the Read bit is to be set; otherwise set to FALSE if the bit is to be cleared.
See Also:
getRights(), setRights(int)

getReadRights

public boolean getReadRights()
Returns a boolean value reflecting the state of the object rights mask Read bit.

Returns the state of the corresponding bit in the rights mask. TRUE is returned if the corresponding bit is set, otherwise FALSE is returned.

Returns:
A boolean set to TRUE if the rights mask bit is set; otherwise FALSE is returned.
See Also:
getRights(), setRights(int)

setWriteRights

public void setWriteRights(boolean value)
Sets the Write bit of the object rights mask based on the boolean input value.
Parameters:
value - A boolean set to TRUE if bit is to be set, otherwise set to FALSE if the bit is to be cleared.
See Also:
getRights(), setRights(int)

getWriteRights

public boolean getWriteRights()
Returns a boolean value reflecting the state of the Write bit of the object rights mask.
Returns:
A boolean set to TRUE if the rights mask bit is set; otherwise FALSE is returned.
See Also:
getRights(), setRights(int)

setCreateRights

public void setCreateRights(boolean value)
Sets the Create bit of the object rights mask based on the boolean input value.
Parameters:
value - A boolean set to TRUE if bit is to be set; otherwise set to FALSE if the bit is to be cleared.
See Also:
getRights(), setRights(int)

getCreateRights

public boolean getCreateRights()
Returns a boolean value reflecting the state of the Create bit of the object rights mask.
Returns:
A boolean set to TRUE if the corresponding rights mask bit is set; otherwise FALSE is returned.
See Also:
getRights(), setRights(int)

setDeleteRights

public void setDeleteRights(boolean value)
Sets the Delete bit of the object rights mask based on the boolean input value.
Parameters:
value - A boolean set to TRUE if bit is to be set; otherwise FALSE is returned if the bit is to be cleared.
See Also:
getRights(), setRights(int)

getDeleteRights

public boolean getDeleteRights()
Returns the state of the Delete bit of the object rights mask as a boolean value.
Returns:
A boolean value set to TRUE if the rights mask bit is set; otherwise FALSE is returned.
See Also:
getRights(), setRights(int)

setOwnershipRights

public void setOwnershipRights(boolean value)
Sets the Ownership bit of the object rights mask based on the boolean input value.
Parameters:
value - A boolean value set to TRUE if bit is to be set; otherwise set to FALSE if the bit is to be cleared.
See Also:
getRights(), setRights(int)

getOwnershipRights

public boolean getOwnershipRights()
Returns a boolean value reflecting the state of the Ownership bit of the object rights mask.
Returns:
A boolean set to TRUE if the ownership rights mask bit is set; otherwise FALSE is returned.
See Also:
getRights(), setRights(int)

setSearchRights

public void setSearchRights(boolean value)
Sets the Search bit of the object rights mask based on the boolean input value.
Parameters:
value - A boolean value set to TRUE if bit is to be set; otherwise set to FALSE if the bit is to be cleared.
See Also:
getRights(), setRights(int)

getSearchRights

public boolean getSearchRights()
Returns a boolean value reflecting the state of the Search bit of the object rights mask.
Returns:
A boolean set to TRUE if the rights mask bit is set; otherwise FALSE is returned.
See Also:
getRights(), setRights(int)

setModifyRights

public void setModifyRights(boolean value)
Sets the Modify bit of the object rights mask based on the boolean input value.
Parameters:
value - A boolean set to TRUE if bit is to be set; otherwise set to FALSE if the bit is to be cleared.
See Also:
getRights(), setRights(int)

getModifyRights

public boolean getModifyRights()
Returns a boolean value reflecting the state of the Modify bit of the object rights mask.
Returns:
A boolean set to TRUE if the rights mask bit is set; otherwise FALSE is returned.
See Also:
getRights(), setRights(int)

setSupervisorRights

public void setSupervisorRights(boolean value)
Sets the Supervisor bit of the object rights mask based on the boolean input value.
Parameters:
value - A boolean set to TRUE if bit is to be set; otherwise set to FALSE if the bit is to be cleared.
See Also:
getRights(), setRights(int)

getSupervisorRights

public boolean getSupervisorRights()
Returns a boolean value reflecting the state of the Supervisor bit of the object rights mask.
Returns:
A boolean set to TRUE if the rights mask bit is set; otherwise FALSE is returned.
See Also:
getRights(), setRights(int)

equals

public boolean equals(java.lang.Object obj)
Compares the input object against this object for equality.

If the input object has a RFC1960 compare string, the comparision will be 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 is returned.
Throws:
java.lang.IllegalArgumentException - If 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, RIGHTS_FIELD

toString

public java.lang.String toString()
Returns a String representation of this object. The string is returned in the following format: "name: n, objectRights: r, compareString: s".

Returns:
A String representation of this object.
Overrides:
toString in class java.lang.Object

clone

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