org.apache.directory.shared.ldap.message
Class LockableAttributeImpl

java.lang.Object
  extended byorg.apache.directory.shared.ldap.message.LockableAttributeImpl
All Implemented Interfaces:
javax.naming.directory.Attribute, java.lang.Cloneable, java.io.Serializable

public class LockableAttributeImpl
extends java.lang.Object
implements javax.naming.directory.Attribute

Permanently Lockable ordered JNDI Attribute implementation.

Version:
$Rev: 379008 $
Author:
Apache Directory Project
See Also:
Serialized Form

Constructor Summary
LockableAttributeImpl(java.lang.String id)
          Creates a permanently LockableAttribute on id whose locking behavoir is dicatated by parent.
LockableAttributeImpl(java.lang.String id, byte[] value)
          Creates a permanently LockableAttribute on id with a single value.
LockableAttributeImpl(java.lang.String id, java.lang.Object value)
          Creates a permanently LockableAttribute on id with a single value.
 
Method Summary
 void add(int index, java.lang.Object attrVal)
          Inserts attrVal into the list of this Attribute's values at the specified index in the list.
 boolean add(java.lang.Object attrVal)
          Adds attrVal into the list of this Attribute's values at the end of the list.
 void clear()
          Removes all the values of this Attribute from the list backing store.
 java.lang.Object clone()
          Not a deep clone.
 boolean contains(java.lang.Object attrVal)
          Checks to see if this Attribute contains attrVal in the list.
 boolean equals(java.lang.Object obj)
          Checks for equality between this Attribute instance and another.
 java.lang.Object get()
          Gets the first value of the list or null if no values exist.
 java.lang.Object get(int index)
          Gets the value at an index.
 javax.naming.NamingEnumeration getAll()
          Gets a NamingEnumberation wrapped around the iterator of the value list.
 javax.naming.directory.DirContext getAttributeDefinition()
          NOT SUPPORTED - throws OperationNotSupportedException
 javax.naming.directory.DirContext getAttributeSyntaxDefinition()
          NOT SUPPORTED - throws OperationNotSupportedException
 java.lang.String getID()
          Gets the id or name of this Attribute.
 boolean isOrdered()
          Always returns true since list is used to preserve value addition order.
 java.lang.Object remove(int index)
          Removes the value at an index.
 boolean remove(java.lang.Object attrVal)
          Removes attrVal from the list of this Attribute's values.
 java.lang.Object set(int index, java.lang.Object attrVal)
          Sets an attribute value in the ordered list of attribute values.
 int size()
          Gets the size of the value list.
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LockableAttributeImpl

public LockableAttributeImpl(java.lang.String id)
Creates a permanently LockableAttribute on id whose locking behavoir is dicatated by parent.

Parameters:
id - the id or name of this attribute.

LockableAttributeImpl

public LockableAttributeImpl(java.lang.String id,
                             java.lang.Object value)
Creates a permanently LockableAttribute on id with a single value.

Parameters:
id - the id or name of this attribute.
value - a value for the attribute

LockableAttributeImpl

public LockableAttributeImpl(java.lang.String id,
                             byte[] value)
Creates a permanently LockableAttribute on id with a single value.

Parameters:
id - the id or name of this attribute.
value - a value for the attribute
Method Detail

getAll

public javax.naming.NamingEnumeration getAll()
Gets a NamingEnumberation wrapped around the iterator of the value list.

Specified by:
getAll in interface javax.naming.directory.Attribute
Returns:
the Iterator wrapped as a NamingEnumberation.

get

public java.lang.Object get()
Gets the first value of the list or null if no values exist.

Specified by:
get in interface javax.naming.directory.Attribute
Returns:
the first value or null.

size

public int size()
Gets the size of the value list.

Specified by:
size in interface javax.naming.directory.Attribute
Returns:
size of the value list.

getID

public java.lang.String getID()
Gets the id or name of this Attribute.

Specified by:
getID in interface javax.naming.directory.Attribute
Returns:
the identifier for this Attribute.

contains

public boolean contains(java.lang.Object attrVal)
Checks to see if this Attribute contains attrVal in the list.

Specified by:
contains in interface javax.naming.directory.Attribute
Parameters:
attrVal - the value to test for
Returns:
true if attrVal is in the list backing store, false otherwise

add

public boolean add(java.lang.Object attrVal)
Adds attrVal into the list of this Attribute's values at the end of the list.

Specified by:
add in interface javax.naming.directory.Attribute
Parameters:
attrVal - the value to add to the end of the list.
Returns:
true if attrVal is added to the list backing store, false if it already existed there.

remove

public boolean remove(java.lang.Object attrVal)
Removes attrVal from the list of this Attribute's values.

Specified by:
remove in interface javax.naming.directory.Attribute
Parameters:
attrVal - the value to remove
Returns:
true if attrVal is remove from the list backing store, false if never existed there.

clear

public void clear()
Removes all the values of this Attribute from the list backing store.

Specified by:
clear in interface javax.naming.directory.Attribute

getAttributeSyntaxDefinition

public javax.naming.directory.DirContext getAttributeSyntaxDefinition()
                                                               throws javax.naming.NamingException
NOT SUPPORTED - throws OperationNotSupportedException

Specified by:
getAttributeSyntaxDefinition in interface javax.naming.directory.Attribute
Throws:
javax.naming.NamingException
See Also:
Attribute.getAttributeSyntaxDefinition()

getAttributeDefinition

public javax.naming.directory.DirContext getAttributeDefinition()
                                                         throws javax.naming.NamingException
NOT SUPPORTED - throws OperationNotSupportedException

Specified by:
getAttributeDefinition in interface javax.naming.directory.Attribute
Throws:
javax.naming.NamingException
See Also:
Attribute.getAttributeDefinition()

clone

public java.lang.Object clone()
Not a deep clone.

Specified by:
clone in interface javax.naming.directory.Attribute
Returns:
a copy of this attribute using the same parent lock and id containing references to all the values of the original.

isOrdered

public boolean isOrdered()
Always returns true since list is used to preserve value addition order.

Specified by:
isOrdered in interface javax.naming.directory.Attribute
Returns:
true.

get

public java.lang.Object get(int index)
Gets the value at an index.

Specified by:
get in interface javax.naming.directory.Attribute
Parameters:
index - the index of the value in the ordered list of attribute values. 0 <= ix < size().
Returns:
this Attribute's value at the index null if no values exist.

remove

public java.lang.Object remove(int index)
Removes the value at an index.

Specified by:
remove in interface javax.naming.directory.Attribute
Parameters:
index - the index of the value in the ordered list of attribute values. 0 <= ix < size().
Returns:
this Attribute's value removed at the index

add

public void add(int index,
                java.lang.Object attrVal)
Inserts attrVal into the list of this Attribute's values at the specified index in the list.

Specified by:
add in interface javax.naming.directory.Attribute
Parameters:
index - the index to add the value at.
attrVal - the value to add to the end of the list.

set

public java.lang.Object set(int index,
                            java.lang.Object attrVal)
Sets an attribute value in the ordered list of attribute values.

Specified by:
set in interface javax.naming.directory.Attribute
Parameters:
index - the index to set the value to.
attrVal - the value to set at the index.
Returns:
the old value at the specified index.

equals

public boolean equals(java.lang.Object obj)
Checks for equality between this Attribute instance and another. The lockable properties are not factored into the equality semantics and neither is the Attribute implementation. The Attribute ID's are compared with regard to case and value order is only considered if the Attribute arguement is ordered itself.

Parameters:
obj - the Attribute to test for equality
Returns:
true if the obj is an Attribute and equals this Attribute false otherwise


Copyright © 2003-2006 . All Rights Reserved.