org.apache.directory.server.core.entry
Class DefaultServerEntry

java.lang.Object
  extended by org.apache.directory.shared.ldap.entry.AbstractEntry<org.apache.directory.shared.ldap.schema.AttributeType>
      extended by org.apache.directory.server.core.entry.DefaultServerEntry
All Implemented Interfaces:
java.io.Externalizable, java.io.Serializable, java.lang.Cloneable, java.lang.Iterable<org.apache.directory.shared.ldap.entry.EntryAttribute>, ServerEntry, org.apache.directory.shared.ldap.entry.Entry

public final class DefaultServerEntry
extends org.apache.directory.shared.ldap.entry.AbstractEntry<org.apache.directory.shared.ldap.schema.AttributeType>
implements ServerEntry

A default implementation of a ServerEntry which should suite most use cases. This class is final, it should not be extended.

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

Field Summary
 
Fields inherited from class org.apache.directory.shared.ldap.entry.AbstractEntry
attributes, dn
 
Constructor Summary
DefaultServerEntry(Registries registries)
           Creates a new instance of DefaultServerEntry, with registries.
DefaultServerEntry(Registries registries, org.apache.directory.shared.ldap.entry.Entry entry)
           Creates a new instance of DefaultServerEntry, copying another entry, which can be a ClientEntry.
DefaultServerEntry(Registries registries, org.apache.directory.shared.ldap.name.LdapDN dn)
           Creates a new instance of DefaultServerEntry, with a DN and registries.
DefaultServerEntry(Registries registries, org.apache.directory.shared.ldap.name.LdapDN dn, org.apache.directory.shared.ldap.schema.AttributeType... attributeTypes)
           Creates a new instance of DefaultServerEntry, with a DN, registries and a list of attributeTypes.
DefaultServerEntry(Registries registries, org.apache.directory.shared.ldap.name.LdapDN dn, org.apache.directory.shared.ldap.schema.AttributeType attributeType, java.lang.String upId)
           Creates a new instance of DefaultServerEntry, with a DN, registries and an attributeType with the user provided ID.
DefaultServerEntry(Registries registries, org.apache.directory.shared.ldap.name.LdapDN dn, ServerAttribute... attributes)
          Creates a new instance of DefaultServerEntry, with a DN, registries and a list of ServerAttributes.
DefaultServerEntry(Registries registries, org.apache.directory.shared.ldap.name.LdapDN dn, java.lang.String... upIds)
          Creates a new instance of DefaultServerEntry, with a DN, registries and a list of IDs.
 
Method Summary
 void add(org.apache.directory.shared.ldap.schema.AttributeType attributeType, byte[]... values)
           Add an attribute (represented by its AttributeType and some binary values) into an entry.
 void add(org.apache.directory.shared.ldap.schema.AttributeType attributeType, java.lang.String... values)
           Add an attribute (represented by its AttributeType and some String values) into an entry.
 void add(org.apache.directory.shared.ldap.schema.AttributeType attributeType, org.apache.directory.shared.ldap.entry.Value<?>... values)
           Add an attribute (represented by its AttributeType and some values) into an entry.
 void add(org.apache.directory.shared.ldap.entry.EntryAttribute... attributes)
          Add some EntryAttributes to the current Entry.
 void add(java.lang.String upId, org.apache.directory.shared.ldap.schema.AttributeType attributeType, byte[]... values)
           Add an attribute (represented by its AttributeType and some binary values) into an entry.
 void add(java.lang.String upId, org.apache.directory.shared.ldap.schema.AttributeType attributeType, java.lang.String... values)
          Adds a new attribute with some String values into an entry, setting the User Provided ID in the same time.
 void add(java.lang.String upId, org.apache.directory.shared.ldap.schema.AttributeType attributeType, org.apache.directory.shared.ldap.entry.Value<?>... values)
           Add an attribute (represented by its AttributeType and some values) into an entry.
 void add(java.lang.String upId, byte[]... values)
          Add an attribute (represented by its ID and binary values) into an entry.
 void add(java.lang.String upId, java.lang.String... values)
          Add an attribute (represented by its ID and string values) into an entry.
 void add(java.lang.String upId, org.apache.directory.shared.ldap.entry.Value<?>... values)
          Add an attribute (represented by its ID and Value values) into an entry.
 org.apache.directory.shared.ldap.entry.Entry clone()
          Clone an entry.
 boolean contains(org.apache.directory.shared.ldap.schema.AttributeType attributeType, byte[]... values)
          Checks if an entry contains an attribute with some given binary values.
 boolean contains(org.apache.directory.shared.ldap.schema.AttributeType attributeType, java.lang.String... values)
          Checks if an entry contains an attribute with some given String values.
 boolean contains(org.apache.directory.shared.ldap.schema.AttributeType attributeType, org.apache.directory.shared.ldap.entry.Value<?>... values)
          Checks if an entry contains an attribute with some given binary values.
 boolean contains(org.apache.directory.shared.ldap.entry.EntryAttribute... attributes)
           Checks if an entry contains a list of attributes.
 boolean contains(java.lang.String id, byte[]... values)
          Checks if an entry contains an attribute with some binary values.
 boolean contains(java.lang.String id, java.lang.String... values)
          Checks if an entry contains an attribute with some String values.
 boolean contains(java.lang.String id, org.apache.directory.shared.ldap.entry.Value<?>... values)
          Checks if an entry contains an attribute with some values.
 boolean containsAttribute(org.apache.directory.shared.ldap.schema.AttributeType attributeType)
          Checks if an entry contains a specific AttributeType.
 boolean containsAttribute(java.lang.String... attributes)
          Checks if an entry contains some specific attributes.
 void deserialize(java.io.ObjectInput in)
          Deserialize a server entry.
 boolean equals(java.lang.Object o)
           
 org.apache.directory.shared.ldap.entry.EntryAttribute get(org.apache.directory.shared.ldap.schema.AttributeType attributeType)
          Returns the attribute associated with an AttributeType
 org.apache.directory.shared.ldap.entry.EntryAttribute get(java.lang.String alias)
           Returns the attribute with the specified alias.
 java.util.Set<org.apache.directory.shared.ldap.schema.AttributeType> getAttributeTypes()
          Gets all the attributes type
static java.lang.String getUpId(java.lang.String upId, org.apache.directory.shared.ldap.schema.AttributeType attributeType)
          Get the UpId if it was null.
 int hashCode()
          Gets the hashCode of this ServerEntry.
 boolean hasObjectClass(org.apache.directory.shared.ldap.entry.EntryAttribute objectClass)
          Tells if an entry has a specific ObjectClass Attribute
 boolean hasObjectClass(java.lang.String objectClass)
          Tells if an entry has a specific ObjectClass value
 boolean isValid()
          Fail fast check performed to determine entry consistency according to schema characteristics.
 boolean isValid(org.apache.directory.shared.ldap.entry.EntryAttribute objectClass)
          Check performed to determine entry consistency according to the schema requirements of a particular objectClass.
 boolean isValid(java.lang.String objectClass)
          Check performed to determine entry consistency according to the schema requirements of a particular objectClass.
 org.apache.directory.shared.ldap.entry.EntryAttribute put(org.apache.directory.shared.ldap.schema.AttributeType attributeType, byte[]... values)
           Places a new attribute with the supplied AttributeType and binary values into the attribute collection.
 org.apache.directory.shared.ldap.entry.EntryAttribute put(org.apache.directory.shared.ldap.schema.AttributeType attributeType, java.lang.String... values)
           Places a new attribute with the supplied AttributeType and String values into the attribute collection.
 org.apache.directory.shared.ldap.entry.EntryAttribute put(org.apache.directory.shared.ldap.schema.AttributeType attributeType, org.apache.directory.shared.ldap.entry.Value<?>... values)
           Places a new attribute with the supplied AttributeType and some values into the attribute collection.
 java.util.List<org.apache.directory.shared.ldap.entry.EntryAttribute> put(org.apache.directory.shared.ldap.entry.EntryAttribute... attributes)
           Places attributes in the attribute collection.
 org.apache.directory.shared.ldap.entry.EntryAttribute put(java.lang.String upId, org.apache.directory.shared.ldap.schema.AttributeType attributeType, byte[]... values)
           Places a new attribute with the supplied AttributeType and some binary values into the attribute collection.
 org.apache.directory.shared.ldap.entry.EntryAttribute put(java.lang.String upId, org.apache.directory.shared.ldap.schema.AttributeType attributeType, java.lang.String... values)
           Places a new attribute with the supplied AttributeType and some String values into the attribute collection.
 org.apache.directory.shared.ldap.entry.EntryAttribute put(java.lang.String upId, org.apache.directory.shared.ldap.schema.AttributeType attributeType, org.apache.directory.shared.ldap.entry.Value<?>... values)
           Places a new attribute with the supplied AttributeType and some values into the attribute collection.
 org.apache.directory.shared.ldap.entry.EntryAttribute put(java.lang.String upId, byte[]... values)
           Put an attribute (represented by its ID and some binary values) into an entry.
 org.apache.directory.shared.ldap.entry.EntryAttribute put(java.lang.String upId, java.lang.String... values)
           Put an attribute (represented by its ID and some String values) into an entry.
 org.apache.directory.shared.ldap.entry.EntryAttribute put(java.lang.String upId, org.apache.directory.shared.ldap.entry.Value<?>... values)
           Put an attribute (represented by its ID and some values) into an entry.
 void readExternal(java.io.ObjectInput in)
           
 boolean remove(org.apache.directory.shared.ldap.schema.AttributeType attributeType, byte[]... values)
           Removes the specified binary values from an attribute.
 boolean remove(org.apache.directory.shared.ldap.schema.AttributeType attributeType, java.lang.String... values)
           Removes the specified String values from an attribute.
 boolean remove(org.apache.directory.shared.ldap.schema.AttributeType attributeType, org.apache.directory.shared.ldap.entry.Value<?>... values)
           Removes the specified values from an attribute.
 java.util.List<org.apache.directory.shared.ldap.entry.EntryAttribute> remove(org.apache.directory.shared.ldap.entry.EntryAttribute... attributes)
          Removes the specified attributes.
 boolean remove(java.lang.String upId, byte[]... values)
           Removes the specified binary values from an attribute.
 boolean remove(java.lang.String upId, java.lang.String... values)
           Removes the specified String values from an attribute.
 boolean remove(java.lang.String upId, org.apache.directory.shared.ldap.entry.Value<?>... values)
           Removes the specified Value values from an attribute.
 java.util.List<org.apache.directory.shared.ldap.entry.EntryAttribute> removeAttributes(org.apache.directory.shared.ldap.schema.AttributeType... attributes)
           Removes the attribute with the specified AttributeTypes.
 java.util.List<org.apache.directory.shared.ldap.entry.EntryAttribute> removeAttributes(java.lang.String... attributes)
           Removes the attribute with the specified alias.
 void serialize(java.io.ObjectOutput out)
          Serialize a server entry.
 java.util.List<org.apache.directory.shared.ldap.entry.EntryAttribute> set(org.apache.directory.shared.ldap.schema.AttributeType... attributeTypes)
           Put some new attributes using the attributeTypes.
 java.util.List<org.apache.directory.shared.ldap.entry.EntryAttribute> set(java.lang.String... upIds)
           Put some new EntryAttribute using the User Provided ID.
 org.apache.directory.shared.ldap.entry.Entry toClientEntry()
          Convert the ServerEntry to a ClientEntry
 java.lang.String toString()
           
 void writeExternal(java.io.ObjectOutput out)
           
 
Methods inherited from class org.apache.directory.shared.ldap.entry.AbstractEntry
clear, getDn, iterator, setDn, size
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.apache.directory.shared.ldap.entry.Entry
clear, getDn, iterator, setDn, size
 

Constructor Detail

DefaultServerEntry

public DefaultServerEntry(Registries registries)

Creates a new instance of DefaultServerEntry, with registries.

No attributes will be created.

Parameters:
registries - The reference to the global registries

DefaultServerEntry

public DefaultServerEntry(Registries registries,
                          org.apache.directory.shared.ldap.entry.Entry entry)

Creates a new instance of DefaultServerEntry, copying another entry, which can be a ClientEntry.

No attributes will be created.

Parameters:
registries - The reference to the global registries
entry - the entry to copy

DefaultServerEntry

public DefaultServerEntry(Registries registries,
                          org.apache.directory.shared.ldap.name.LdapDN dn)

Creates a new instance of DefaultServerEntry, with a DN and registries.

No attributes will be created.

Parameters:
registries - The reference to the global registries
dn - The DN for this serverEntry. Can be null.

DefaultServerEntry

public DefaultServerEntry(Registries registries,
                          org.apache.directory.shared.ldap.name.LdapDN dn,
                          org.apache.directory.shared.ldap.schema.AttributeType... attributeTypes)

Creates a new instance of DefaultServerEntry, with a DN, registries and a list of attributeTypes.

The newly created entry is fed with the list of attributeTypes. No values are associated with those attributeTypes.

If any of the AttributeType does not exist, they it's simply discarded.

Parameters:
registries - The reference to the global registries
dn - The DN for this serverEntry. Can be null.
attributeTypes - The list of attributes to create, without value.

DefaultServerEntry

public DefaultServerEntry(Registries registries,
                          org.apache.directory.shared.ldap.name.LdapDN dn,
                          org.apache.directory.shared.ldap.schema.AttributeType attributeType,
                          java.lang.String upId)

Creates a new instance of DefaultServerEntry, with a DN, registries and an attributeType with the user provided ID.

The newly created entry is fed with the given attributeType. No values are associated with this attributeType.

If the AttributeType does not exist, they it's simply discarded.

We also check that the normalized upID equals the AttributeType ID

Parameters:
registries - The reference to the global registries
dn - The DN for this serverEntry. Can be null.
attributeType - The attribute to create, without value.
upId - The User Provided ID fro this AttributeType

DefaultServerEntry

public DefaultServerEntry(Registries registries,
                          org.apache.directory.shared.ldap.name.LdapDN dn,
                          java.lang.String... upIds)
Creates a new instance of DefaultServerEntry, with a DN, registries and a list of IDs.

No attributes will be created except the ObjectClass attribute, which will contains "top".

If any of the AttributeType does not exist, they are simply discarded.

Parameters:
registries - The reference to the global registries
dn - The DN for this serverEntry. Can be null.
upIds - The list of attributes to create.

DefaultServerEntry

public DefaultServerEntry(Registries registries,
                          org.apache.directory.shared.ldap.name.LdapDN dn,
                          ServerAttribute... attributes)
Creates a new instance of DefaultServerEntry, with a DN, registries and a list of ServerAttributes.

No attributes will be created except the ObjectClass attribute, which will contains "top".

If any of the AttributeType does not exist, they are simply discarded.

Parameters:
registries - The reference to the global registries
dn - The DN for this serverEntry. Can be null
attributes - The list of attributes to create
Method Detail

getUpId

public static java.lang.String getUpId(java.lang.String upId,
                                       org.apache.directory.shared.ldap.schema.AttributeType attributeType)
Get the UpId if it was null.


add

public void add(org.apache.directory.shared.ldap.schema.AttributeType attributeType,
                byte[]... values)
         throws javax.naming.NamingException

Add an attribute (represented by its AttributeType and some binary values) into an entry.

If we already have an attribute with the same values, nothing is done (duplicated values are not allowed)

If the value cannot be added, or if the AttributeType is null or invalid, a NamingException is thrown.

Specified by:
add in interface ServerEntry
Parameters:
attributeType - The attribute Type.
values - The list of binary values to inject. It can be empty.
Throws:
javax.naming.NamingException - If the attribute does not exist

add

public void add(org.apache.directory.shared.ldap.schema.AttributeType attributeType,
                java.lang.String... values)
         throws javax.naming.NamingException

Add an attribute (represented by its AttributeType and some String values) into an entry.

If we already have an attribute with public the same value, nothing is done (duplicated values are not allowed)

public If the value cannot be added, or if the AttributeType is null or invalid, a NamingException is thrown.

public

Specified by:
add in interface ServerEntry
Parameters:
attributeType - The attribute Type
values - The list of binary values to inject. It can be empty
Throws:
javax.naming.NamingException - If the attribute does not exist

add

public void add(org.apache.directory.shared.ldap.schema.AttributeType attributeType,
                org.apache.directory.shared.ldap.entry.Value<?>... values)
         throws javax.naming.NamingException

Add an attribute (represented by its AttributeType and some values) into an entry.

If we already have an attribute with the same value, nothing is done. (duplicated values are not allowed)

If the value cannot be added, or if the AttributeType is null or invalid, a NamingException is thrown.

Specified by:
add in interface ServerEntry
Parameters:
attributeType - The attribute Type
values - The list of binary values to inject. It can be empty
Throws:
javax.naming.NamingException - If the attribute does not exist

add

public void add(org.apache.directory.shared.ldap.entry.EntryAttribute... attributes)
         throws javax.naming.NamingException
Add some EntryAttributes to the current Entry.

Specified by:
add in interface org.apache.directory.shared.ldap.entry.Entry
Parameters:
attributes - The attributes to add
Throws:
javax.naming.NamingException - If we can't add any of the attributes

add

public void add(java.lang.String upId,
                org.apache.directory.shared.ldap.schema.AttributeType attributeType,
                byte[]... values)
         throws javax.naming.NamingException

Add an attribute (represented by its AttributeType and some binary values) into an entry. Set the User Provider ID at the same time

If we already have an attribute with the same values, nothing is done (duplicated values are not allowed)

If the value cannot be added, or if the AttributeType is null or invalid, a NamingException is thrown.

Specified by:
add in interface ServerEntry
Parameters:
upId - The user provided ID for the added AttributeType
attributeType - The attribute Type.
values - The list of binary values to add. It can be empty.
Throws:
javax.naming.NamingException - If the attribute does not exist

add

public void add(java.lang.String upId,
                org.apache.directory.shared.ldap.schema.AttributeType attributeType,
                org.apache.directory.shared.ldap.entry.Value<?>... values)
         throws javax.naming.NamingException

Add an attribute (represented by its AttributeType and some values) into an entry. Set the User Provider ID at the same time

If we already have an attribute with the same values, nothing is done (duplicated values are not allowed)

If the value cannot be added, or if the AttributeType is null or invalid, a NamingException is thrown.

Specified by:
add in interface ServerEntry
Parameters:
upId - The user provided ID for the added AttributeType
attributeType - The attribute Type.
values - The list of values to add. It can be empty.
Throws:
javax.naming.NamingException - If the attribute does not exist

add

public void add(java.lang.String upId,
                org.apache.directory.shared.ldap.schema.AttributeType attributeType,
                java.lang.String... values)
         throws javax.naming.NamingException
Adds a new attribute with some String values into an entry, setting the User Provided ID in the same time.

Specified by:
add in interface ServerEntry
Parameters:
upId - The User provided ID
attributeType - The associated AttributeType
values - The String values to store into the new Attribute
Throws:
javax.naming.NamingException

add

public void add(java.lang.String upId,
                byte[]... values)
         throws javax.naming.NamingException
Add an attribute (represented by its ID and binary values) into an entry.

Specified by:
add in interface org.apache.directory.shared.ldap.entry.Entry
Parameters:
upId - The attribute ID
values - The list of binary values to inject. It can be empty
Throws:
javax.naming.NamingException - If the attribute does not exist

add

public void add(java.lang.String upId,
                java.lang.String... values)
         throws javax.naming.NamingException
Add an attribute (represented by its ID and string values) into an entry.

Specified by:
add in interface org.apache.directory.shared.ldap.entry.Entry
Parameters:
upId - The attribute ID
values - The list of string values to inject. It can be empty
Throws:
javax.naming.NamingException - If the attribute does not exist

add

public void add(java.lang.String upId,
                org.apache.directory.shared.ldap.entry.Value<?>... values)
         throws javax.naming.NamingException
Add an attribute (represented by its ID and Value values) into an entry.

Specified by:
add in interface org.apache.directory.shared.ldap.entry.Entry
Parameters:
upId - The attribute ID
values - The list of Value values to inject. It can be empty
Throws:
javax.naming.NamingException - If the attribute does not exist

contains

public boolean contains(org.apache.directory.shared.ldap.schema.AttributeType attributeType,
                        byte[]... values)
Checks if an entry contains an attribute with some given binary values.

Specified by:
contains in interface ServerEntry
Parameters:
attributeType - The Attribute we are looking for.
values - The searched values.
Returns:
true if all the values are found within the attribute, false otherwise, or if the attributes does not exist.

contains

public boolean contains(org.apache.directory.shared.ldap.schema.AttributeType attributeType,
                        java.lang.String... values)
Checks if an entry contains an attribute with some given String values.

Specified by:
contains in interface ServerEntry
Parameters:
attributeType - The Attribute we are looking for.
values - The searched values.
Returns:
true if all the values are found within the attribute, false otherwise, or if the attributes does not exist.

contains

public boolean contains(org.apache.directory.shared.ldap.schema.AttributeType attributeType,
                        org.apache.directory.shared.ldap.entry.Value<?>... values)
Checks if an entry contains an attribute with some given binary values.

Specified by:
contains in interface ServerEntry
Parameters:
attributeType - The Attribute we are looking for.
values - The searched values.
Returns:
true if all the values are found within the attribute, false otherwise, or if the attributes does not exist.

contains

public boolean contains(org.apache.directory.shared.ldap.entry.EntryAttribute... attributes)
                 throws javax.naming.NamingException

Checks if an entry contains a list of attributes.

If the list is null or empty, this method will return true if the entry has no attribute, false otherwise.

Specified by:
contains in interface org.apache.directory.shared.ldap.entry.Entry
Parameters:
attributes - The Attributes to look for
Returns:
true if all the attributes are found within the entry, false if at least one of them is not present.
Throws:
javax.naming.NamingException - If the attribute does not exist

contains

public boolean contains(java.lang.String id,
                        byte[]... values)
Checks if an entry contains an attribute with some binary values.

Specified by:
contains in interface org.apache.directory.shared.ldap.entry.Entry
Parameters:
id - The Attribute we are looking for.
values - The searched values.
Returns:
true if all the values are found within the attribute, false if at least one value is not present or if the ID is not valid.

contains

public boolean contains(java.lang.String id,
                        java.lang.String... values)
Checks if an entry contains an attribute with some String values.

Specified by:
contains in interface org.apache.directory.shared.ldap.entry.Entry
Parameters:
id - The Attribute we are looking for.
values - The searched values.
Returns:
true if all the values are found within the attribute, false if at least one value is not present or if the ID is not valid.

contains

public boolean contains(java.lang.String id,
                        org.apache.directory.shared.ldap.entry.Value<?>... values)
Checks if an entry contains an attribute with some values.

Specified by:
contains in interface org.apache.directory.shared.ldap.entry.Entry
Parameters:
id - The Attribute we are looking for.
values - The searched values.
Returns:
true if all the values are found within the attribute, false if at least one value is not present or if the ID is not valid.

containsAttribute

public boolean containsAttribute(org.apache.directory.shared.ldap.schema.AttributeType attributeType)
Checks if an entry contains a specific AttributeType.

Specified by:
containsAttribute in interface ServerEntry
Parameters:
attributeType - The AttributeType to look for.
Returns:
true if the attribute is found within the entry.

containsAttribute

public boolean containsAttribute(java.lang.String... attributes)
Checks if an entry contains some specific attributes.

Specified by:
containsAttribute in interface org.apache.directory.shared.ldap.entry.Entry
Parameters:
attributes - The Attributes to look for.
Returns:
true if the attributes are all found within the entry.

get

public org.apache.directory.shared.ldap.entry.EntryAttribute get(org.apache.directory.shared.ldap.schema.AttributeType attributeType)
Returns the attribute associated with an AttributeType

Specified by:
get in interface ServerEntry
Parameters:
attributeType - the AttributeType we are looking for
Returns:
the associated attribute

get

public org.apache.directory.shared.ldap.entry.EntryAttribute get(java.lang.String alias)

Returns the attribute with the specified alias. The return value is null if no match is found.

An Attribute with an id different from the supplied alias may be returned: for example a call with 'cn' may in some implementations return an Attribute whose getId() field returns 'commonName'.

If the attributeType is not found, returns null.

Specified by:
get in interface org.apache.directory.shared.ldap.entry.Entry
Parameters:
alias - an aliased name of the attribute identifier
Returns:
the attribute associated with the alias

getAttributeTypes

public java.util.Set<org.apache.directory.shared.ldap.schema.AttributeType> getAttributeTypes()
Gets all the attributes type

Specified by:
getAttributeTypes in interface ServerEntry
Returns:
The combined set of all the attributes, including ObjectClass.

hasObjectClass

public boolean hasObjectClass(java.lang.String objectClass)
Tells if an entry has a specific ObjectClass value

Specified by:
hasObjectClass in interface org.apache.directory.shared.ldap.entry.Entry
Parameters:
objectClass - The ObjectClass ID we want to check
Returns:
true if the ObjectClass value is present in the ObjectClass attribute

hasObjectClass

public boolean hasObjectClass(org.apache.directory.shared.ldap.entry.EntryAttribute objectClass)
Tells if an entry has a specific ObjectClass Attribute

Specified by:
hasObjectClass in interface ServerEntry
Parameters:
objectClass - The ObjectClass we want to check
Returns:
true if the ObjectClass value is present in the ObjectClass attribute

isValid

public boolean isValid()
Fail fast check performed to determine entry consistency according to schema characteristics.

Specified by:
isValid in interface ServerEntry
Returns:
true if the entry, it's attributes and their values are consistent with the schema

isValid

public boolean isValid(org.apache.directory.shared.ldap.entry.EntryAttribute objectClass)
Check performed to determine entry consistency according to the schema requirements of a particular objectClass. The entry must be of that objectClass to return true: meaning if the entry's objectClass attribute does not contain the objectClass argument, then false should be returned.

Specified by:
isValid in interface ServerEntry
Parameters:
objectClass - the objectClass to use while checking for validity
Returns:
true if the entry, it's attributes and their values are consistent with the objectClass

isValid

public boolean isValid(java.lang.String objectClass)
Check performed to determine entry consistency according to the schema requirements of a particular objectClass. The entry must be of that objectClass to return true: meaning if the entry's objectClass attribute does not contain the objectClass argument, then false should be returned.

Specified by:
isValid in interface ServerEntry
Parameters:
objectClass - the objectClass to use while checking for validity
Returns:
true if the entry, it's attributes and their values are consistent with the objectClass

put

public org.apache.directory.shared.ldap.entry.EntryAttribute put(org.apache.directory.shared.ldap.schema.AttributeType attributeType,
                                                                 byte[]... values)
                                                          throws javax.naming.NamingException

Places a new attribute with the supplied AttributeType and binary values into the attribute collection.

If there is already an attribute with the same AttributeType, the old one is removed from the collection and is returned by this method.

This method provides a mechanism to put an attribute with a null value: the value may be null.

Specified by:
put in interface ServerEntry
Parameters:
attributeType - the type of the new attribute to be put
values - the binary values of the new attribute to be put
Returns:
the old attribute with the same identifier, if exists; otherwise null
Throws:
javax.naming.NamingException - if there are failures

put

public org.apache.directory.shared.ldap.entry.EntryAttribute put(org.apache.directory.shared.ldap.schema.AttributeType attributeType,
                                                                 java.lang.String... values)
                                                          throws javax.naming.NamingException

Places a new attribute with the supplied AttributeType and String values into the attribute collection.

If there is already an attribute with the same AttributeType, the old one is removed from the collection and is returned by this method.

This method provides a mechanism to put an attribute with a null value: the value may be null.

Specified by:
put in interface ServerEntry
Parameters:
attributeType - the type of the new attribute to be put
values - the String values of the new attribute to be put
Returns:
the old attribute with the same identifier, if exists; otherwise null
Throws:
javax.naming.NamingException - if there are failures

put

public org.apache.directory.shared.ldap.entry.EntryAttribute put(org.apache.directory.shared.ldap.schema.AttributeType attributeType,
                                                                 org.apache.directory.shared.ldap.entry.Value<?>... values)
                                                          throws javax.naming.NamingException

Places a new attribute with the supplied AttributeType and some values into the attribute collection.

If there is already an attribute with the same AttributeType, the old one is removed from the collection and is returned by this method.

This method provides a mechanism to put an attribute with a null value: the value may be null.

Specified by:
put in interface ServerEntry
Parameters:
attributeType - the type of the new attribute to be put
values - the values of the new attribute to be put
Returns:
the old attribute with the same identifier, if exists; otherwise null
Throws:
javax.naming.NamingException - if there are failures

put

public java.util.List<org.apache.directory.shared.ldap.entry.EntryAttribute> put(org.apache.directory.shared.ldap.entry.EntryAttribute... attributes)
                                                                          throws javax.naming.NamingException

Places attributes in the attribute collection.

If there is already an attribute with the same ID as any of the new attributes, the old ones are removed from the collection and are returned by this method. If there was no attribute with the same ID the return value is null.

Specified by:
put in interface org.apache.directory.shared.ldap.entry.Entry
Parameters:
attributes - the attributes to be put
Returns:
the old attributes with the same OID, if exist; otherwise null
Throws:
javax.naming.NamingException - if the operation fails

put

public org.apache.directory.shared.ldap.entry.EntryAttribute put(java.lang.String upId,
                                                                 org.apache.directory.shared.ldap.schema.AttributeType attributeType,
                                                                 byte[]... values)
                                                          throws javax.naming.NamingException

Places a new attribute with the supplied AttributeType and some binary values into the attribute collection.

The given User provided ID will be used for this new AttributeEntry.

If there is already an attribute with the same AttributeType, the old one is removed from the collection and is returned by this method.

This method provides a mechanism to put an attribute with a null value: the value may be null.

Specified by:
put in interface ServerEntry
Parameters:
upId - The User Provided ID to be stored into the AttributeEntry
attributeType - the type of the new attribute to be put
values - the binary values of the new attribute to be put
Returns:
the old attribute with the same identifier, if exists; otherwise null
Throws:
javax.naming.NamingException - if there are failures.

put

public org.apache.directory.shared.ldap.entry.EntryAttribute put(java.lang.String upId,
                                                                 org.apache.directory.shared.ldap.schema.AttributeType attributeType,
                                                                 java.lang.String... values)
                                                          throws javax.naming.NamingException

Places a new attribute with the supplied AttributeType and some String values into the attribute collection.

The given User provided ID will be used for this new AttributeEntry.

If there is already an attribute with the same AttributeType, the old one is removed from the collection and is returned by this method.

This method provides a mechanism to put an attribute with a null value: the value may be null.

Specified by:
put in interface ServerEntry
Parameters:
upId - The User Provided ID to be stored into the AttributeEntry
attributeType - the type of the new attribute to be put
values - the String values of the new attribute to be put
Returns:
the old attribute with the same identifier, if exists; otherwise null
Throws:
javax.naming.NamingException - if there are failures.

put

public org.apache.directory.shared.ldap.entry.EntryAttribute put(java.lang.String upId,
                                                                 org.apache.directory.shared.ldap.schema.AttributeType attributeType,
                                                                 org.apache.directory.shared.ldap.entry.Value<?>... values)
                                                          throws javax.naming.NamingException

Places a new attribute with the supplied AttributeType and some values into the attribute collection.

The given User provided ID will be used for this new AttributeEntry.

If there is already an attribute with the same AttributeType, the old one is removed from the collection and is returned by this method.

This method provides a mechanism to put an attribute with a null value: the value may be null.

Specified by:
put in interface ServerEntry
Parameters:
upId - The User Provided ID to be stored into the AttributeEntry
attributeType - the type of the new attribute to be put
values - the values of the new attribute to be put
Returns:
the old attribute with the same identifier, if exists; otherwise null
Throws:
javax.naming.NamingException - if there are failures.

put

public org.apache.directory.shared.ldap.entry.EntryAttribute put(java.lang.String upId,
                                                                 byte[]... values)

Put an attribute (represented by its ID and some binary values) into an entry.

If the attribute already exists, the previous attribute will be replaced and returned.

If the upId is not the ID of an existing AttributeType, an IllegalArgumentException is thrown.

Specified by:
put in interface org.apache.directory.shared.ldap.entry.Entry
Parameters:
upId - The attribute ID
values - The list of binary values to put. It can be empty.
Returns:
The replaced attribute

put

public org.apache.directory.shared.ldap.entry.EntryAttribute put(java.lang.String upId,
                                                                 java.lang.String... values)

Put an attribute (represented by its ID and some String values) into an entry.

If the attribute already exists, the previous attribute will be replaced and returned.

If the upId is not the ID of an existing AttributeType, an IllegalArgumentException is thrown.

Specified by:
put in interface org.apache.directory.shared.ldap.entry.Entry
Parameters:
upId - The attribute ID
values - The list of String values to put. It can be empty.
Returns:
The replaced attribute

put

public org.apache.directory.shared.ldap.entry.EntryAttribute put(java.lang.String upId,
                                                                 org.apache.directory.shared.ldap.entry.Value<?>... values)

Put an attribute (represented by its ID and some values) into an entry.

If the attribute already exists, the previous attribute will be replaced and returned.

If the upId is not the ID of an existing AttributeType, an IllegalArgumentException is thrown.

Specified by:
put in interface org.apache.directory.shared.ldap.entry.Entry
Parameters:
upId - The attribute ID
values - The list of values to put. It can be empty.
Returns:
The replaced attribute

remove

public boolean remove(org.apache.directory.shared.ldap.schema.AttributeType attributeType,
                      byte[]... values)
               throws javax.naming.NamingException

Removes the specified binary values from an attribute.

If at least one value is removed, this method returns true.

If there is no more value after having removed the values, the attribute will be removed too.

If the attribute does not exist, nothing is done and the method returns false

Specified by:
remove in interface ServerEntry
Parameters:
attributeType - The attribute type
values - the values to be removed
Returns:
true if at least a value is removed, false if not all the values have been removed or if the attribute does not exist.
Throws:
javax.naming.NamingException

remove

public boolean remove(org.apache.directory.shared.ldap.schema.AttributeType attributeType,
                      java.lang.String... values)
               throws javax.naming.NamingException

Removes the specified String values from an attribute.

If at least one value is removed, this method returns true.

If there is no more value after having removed the values, the attribute will be removed too.

If the attribute does not exist, nothing is done and the method returns false

Specified by:
remove in interface ServerEntry
Parameters:
attributeType - The attribute type
values - the values to be removed
Returns:
true if at least a value is removed, false if not all the values have been removed or if the attribute does not exist.
Throws:
javax.naming.NamingException

remove

public boolean remove(org.apache.directory.shared.ldap.schema.AttributeType attributeType,
                      org.apache.directory.shared.ldap.entry.Value<?>... values)
               throws javax.naming.NamingException

Removes the specified values from an attribute.

If at least one value is removed, this method returns true.

If there is no more value after having removed the values, the attribute will be removed too.

If the attribute does not exist, nothing is done and the method returns false

Specified by:
remove in interface ServerEntry
Parameters:
attributeType - The attribute type
values - the values to be removed
Returns:
true if at least a value is removed, false if not all the values have been removed or if the attribute does not exist.
Throws:
javax.naming.NamingException

remove

public java.util.List<org.apache.directory.shared.ldap.entry.EntryAttribute> remove(org.apache.directory.shared.ldap.entry.EntryAttribute... attributes)
                                                                             throws javax.naming.NamingException
Description copied from interface: ServerEntry
Removes the specified attributes. The removed attributes are returned by this method. If there were no attribute the return value is null.

Specified by:
remove in interface ServerEntry
Specified by:
remove in interface org.apache.directory.shared.ldap.entry.Entry
Parameters:
attributes - the attributes to be removed
Returns:
the removed attribute, if exists; otherwise null
Throws:
javax.naming.NamingException

remove

public boolean remove(java.lang.String upId,
                      byte[]... values)
               throws javax.naming.NamingException

Removes the specified binary values from an attribute.

If at least one value is removed, this method returns true.

If there is no more value after having removed the values, the attribute will be removed too.

If the attribute does not exist, nothing is done and the method returns false

Specified by:
remove in interface org.apache.directory.shared.ldap.entry.Entry
Parameters:
upId - The attribute ID
values - the values to be removed
Returns:
true if at least a value is removed, false if not all the values have been removed or if the attribute does not exist.
Throws:
javax.naming.NamingException

remove

public boolean remove(java.lang.String upId,
                      java.lang.String... values)
               throws javax.naming.NamingException

Removes the specified String values from an attribute.

If at least one value is removed, this method returns true.

If there is no more value after having removed the values, the attribute will be removed too.

If the attribute does not exist, nothing is done and the method returns false

Specified by:
remove in interface org.apache.directory.shared.ldap.entry.Entry
Parameters:
upId - The attribute ID
values - the values to be removed
Returns:
true if at least a value is removed, false if not all the values have been removed or if the attribute does not exist.
Throws:
javax.naming.NamingException

remove

public boolean remove(java.lang.String upId,
                      org.apache.directory.shared.ldap.entry.Value<?>... values)
               throws javax.naming.NamingException

Removes the specified Value values from an attribute.

If at least one value is removed, this method returns true.

If there is no more value after having removed the values, the attribute will be removed too.

If the attribute does not exist, nothing is done and the method returns false

Specified by:
remove in interface org.apache.directory.shared.ldap.entry.Entry
Parameters:
upId - The attribute ID
values - the values to be removed
Returns:
true if at least a value is removed, false if not all the values have been removed or if the attribute does not exist.
Throws:
javax.naming.NamingException

removeAttributes

public java.util.List<org.apache.directory.shared.ldap.entry.EntryAttribute> removeAttributes(org.apache.directory.shared.ldap.schema.AttributeType... attributes)

Removes the attribute with the specified AttributeTypes.

The removed attribute are returned by this method.

If there is no attribute with the specified AttributeTypes, the return value is null.

Specified by:
removeAttributes in interface ServerEntry
Parameters:
attributes - the AttributeTypes to be removed
Returns:
the removed attributes, if any, as a list; otherwise null

removeAttributes

public java.util.List<org.apache.directory.shared.ldap.entry.EntryAttribute> removeAttributes(java.lang.String... attributes)

Removes the attribute with the specified alias.

The removed attribute are returned by this method.

If there is no attribute with the specified alias, the return value is null.

Specified by:
removeAttributes in interface org.apache.directory.shared.ldap.entry.Entry
Parameters:
attributes - an aliased name of the attribute to be removed
Returns:
the removed attributes, if any, as a list; otherwise null

set

public java.util.List<org.apache.directory.shared.ldap.entry.EntryAttribute> set(org.apache.directory.shared.ldap.schema.AttributeType... attributeTypes)

Put some new attributes using the attributeTypes. No value is inserted.

If an existing Attribute is found, it will be replaced by an empty attribute, and returned to the caller.

Specified by:
set in interface ServerEntry
Parameters:
attributeTypes - The AttributeTypes to add.
Returns:
A list of replaced Attributes, of null if no attribute are removed.

set

public java.util.List<org.apache.directory.shared.ldap.entry.EntryAttribute> set(java.lang.String... upIds)

Put some new EntryAttribute using the User Provided ID. No value is inserted.

If an existing Attribute is found, it will be replaced by an empty attribute, and returned to the caller.

Specified by:
set in interface org.apache.directory.shared.ldap.entry.Entry
Parameters:
upIds - The user provided IDs of the AttributeTypes to add.
Returns:
A list of replaced Attributes.

toClientEntry

public org.apache.directory.shared.ldap.entry.Entry toClientEntry()
                                                           throws javax.naming.NamingException
Convert the ServerEntry to a ClientEntry

Specified by:
toClientEntry in interface ServerEntry
Returns:
An instance of ClientEntry
Throws:
javax.naming.NamingException

clone

public org.apache.directory.shared.ldap.entry.Entry clone()
Clone an entry. All the element are duplicated, so a modification on the original object won't affect the cloned object, as a modification on the cloned object has no impact on the original object

Specified by:
clone in interface ServerEntry
Specified by:
clone in interface org.apache.directory.shared.ldap.entry.Entry
Overrides:
clone in class org.apache.directory.shared.ldap.entry.AbstractEntry<org.apache.directory.shared.ldap.schema.AttributeType>

writeExternal

public void writeExternal(java.io.ObjectOutput out)
                   throws java.io.IOException
Specified by:
writeExternal in interface java.io.Externalizable
Throws:
java.io.IOException
See Also:
We can't use this method for a ServerEntry, as we have to feed the entry with an registries reference

serialize

public void serialize(java.io.ObjectOutput out)
               throws java.io.IOException
Serialize a server entry. The structure is the following : [DN] : The entry DN. can be empty [numberAttr] : the bumber of attributes. Can be 0 [attribute's oid]* : The attribute's OID to get back the attributeType on deserialization [Attribute]* The attribute

Parameters:
out - the buffer in which the data will be serialized
Throws:
java.io.IOException - if the serialization failed

readExternal

public void readExternal(java.io.ObjectInput in)
                  throws java.io.IOException,
                         java.lang.ClassNotFoundException
Specified by:
readExternal in interface java.io.Externalizable
Throws:
java.io.IOException
java.lang.ClassNotFoundException
See Also:
We can't use this method for a ServerEntry, as we have to feed the entry with an registries reference

deserialize

public void deserialize(java.io.ObjectInput in)
                 throws java.io.IOException,
                        java.lang.ClassNotFoundException
Deserialize a server entry.

Parameters:
in - The buffer containing the serialized serverEntry
Throws:
java.io.IOException - if there was a problem when deserializing
java.lang.ClassNotFoundException - if we can't deserialize an expected object

hashCode

public int hashCode()
Gets the hashCode of this ServerEntry.

Overrides:
hashCode in class java.lang.Object
Returns:
the instance's hash code
See Also:
Object.hashCode()

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object
See Also:
Object.equals(Object)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
See Also:
Object.toString()


Copyright © 2003-2009 Apache Software Foundation. All Rights Reserved.