org.apache.directory.server.core.entry
Interface ServerAttribute

All Superinterfaces:
org.apache.directory.shared.ldap.entry.client.ClientAttribute, java.lang.Cloneable, org.apache.directory.shared.ldap.entry.EntryAttribute, java.io.Externalizable, java.lang.Iterable<org.apache.directory.shared.ldap.entry.Value<?>>, java.io.Serializable
All Known Implementing Classes:
DefaultServerAttribute

public interface ServerAttribute
extends org.apache.directory.shared.ldap.entry.client.ClientAttribute

The server specific interface extending the EntryAttribute interface. It adds three more methods which are Server side.

Version:
$Rev$, $Date$
Author:
Apache Directory Project

Method Summary
 org.apache.directory.shared.ldap.schema.AttributeType getAttributeType()
          Get the attribute type associated with this ServerAttribute.
 boolean instanceOf(java.lang.String attributeId)
           Check if the current attribute type is of the expected attributeType
 boolean isValid()
           Checks to see if this attribute is valid along with the values it contains.
 void setAttributeType(org.apache.directory.shared.ldap.schema.AttributeType attributeType)
           Set the attribute type associated with this ServerAttribute.
 void setUpId(java.lang.String upId, org.apache.directory.shared.ldap.schema.AttributeType attributeType)
           Set the user provided ID.
 org.apache.directory.shared.ldap.entry.EntryAttribute toClientAttribute()
          Convert the ServerAttribute to a ClientAttribute
 
Methods inherited from interface org.apache.directory.shared.ldap.entry.client.ClientAttribute
isValid
 
Methods inherited from interface org.apache.directory.shared.ldap.entry.EntryAttribute
add, add, add, clear, clone, contains, contains, contains, get, get, getAll, getBytes, getId, getString, getUpId, isHR, put, put, put, put, remove, remove, remove, setHR, setId, setUpId, size
 
Methods inherited from interface java.lang.Iterable
iterator
 
Methods inherited from interface java.io.Externalizable
readExternal, writeExternal
 

Method Detail

getAttributeType

org.apache.directory.shared.ldap.schema.AttributeType getAttributeType()
Get the attribute type associated with this ServerAttribute.

Returns:
the attributeType associated with this entry attribute

setAttributeType

void setAttributeType(org.apache.directory.shared.ldap.schema.AttributeType attributeType)

Set the attribute type associated with this ServerAttribute.

The current attributeType will be replaced. It is the responsibility of the caller to insure that the existing values are compatible with the new AttributeType

Parameters:
attributeType - the attributeType associated with this entry attribute

instanceOf

boolean instanceOf(java.lang.String attributeId)
                   throws javax.naming.directory.InvalidAttributeValueException

Check if the current attribute type is of the expected attributeType

This method won't tell if the current attribute is a descendant of the attributeType. For instance, the "CN" serverAttribute will return false if we ask if it's an instance of "Name".

Parameters:
attributeId - The AttributeType ID to check
Returns:
True if the current attribute is of the expected attributeType
Throws:
javax.naming.directory.InvalidAttributeValueException - If there is no AttributeType

setUpId

void setUpId(java.lang.String upId,
             org.apache.directory.shared.ldap.schema.AttributeType attributeType)

Set the user provided ID. If we have none, the upId is assigned the attributetype's name. If it does not have any name, we will use the OID.

If we have an upId and an AttributeType, they must be compatible. : - if the upId is an OID, it must be the AttributeType's OID - otherwise, its normalized form must be equals to ones of the attributeType's names.

In any case, the ATtributeType will be changed. The caller is responsible for the present values to be compatoble with the new AttributeType.

Parameters:
upId - The attribute ID
attributeType - The associated attributeType

isValid

boolean isValid()
                throws javax.naming.NamingException

Checks to see if this attribute is valid along with the values it contains.

An attribute is valid if :

  • All of its values are valid with respect to the attributeType's syntax checker
  • If the attributeType is SINGLE-VALUE, then no more than a value should be present
  • Returns:
    true if the attribute and it's values are valid, false otherwise
    Throws:
    javax.naming.NamingException - if there is a failure to check syntaxes of values

    toClientAttribute

    org.apache.directory.shared.ldap.entry.EntryAttribute toClientAttribute()
    Convert the ServerAttribute to a ClientAttribute

    Returns:
    An instance of ClientAttribute


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