|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.directory.shared.ldap.entry.client.DefaultClientAttribute
org.apache.directory.server.core.entry.DefaultServerAttribute
public final class DefaultServerAttribute
A server side entry attribute aware of schema.
Field Summary | |
---|---|
static long |
serialVersionUID
|
Fields inherited from class org.apache.directory.shared.ldap.entry.client.DefaultClientAttribute |
---|
id, isHR, upId, values |
Constructor Summary | |
---|---|
DefaultServerAttribute(org.apache.directory.shared.ldap.schema.AttributeType attributeType)
Create a new instance of a EntryAttribute, without ID nor value. |
|
DefaultServerAttribute(org.apache.directory.shared.ldap.schema.AttributeType attributeType,
byte[]... vals)
Create a new instance of a EntryAttribute, with some byte[] values. |
|
DefaultServerAttribute(org.apache.directory.shared.ldap.schema.AttributeType attributeType,
org.apache.directory.shared.ldap.entry.EntryAttribute attribute)
Creates a new instance of DefaultServerAttribute, by copying another attribute, which can be a ClientAttribute. |
|
DefaultServerAttribute(org.apache.directory.shared.ldap.schema.AttributeType attributeType,
java.lang.String... vals)
Create a new instance of a EntryAttribute, without ID but with some values. |
|
DefaultServerAttribute(org.apache.directory.shared.ldap.schema.AttributeType attributeType,
org.apache.directory.shared.ldap.entry.Value<?>... vals)
Doc me more! If the value does not correspond to the same attributeType, then it's wrapped value is copied into a new Value which uses the specified attributeType. |
|
DefaultServerAttribute(java.lang.String upId,
org.apache.directory.shared.ldap.schema.AttributeType attributeType)
Create a new instance of a EntryAttribute, without value. |
|
DefaultServerAttribute(java.lang.String upId,
org.apache.directory.shared.ldap.schema.AttributeType attributeType,
byte[]... vals)
Create a new instance of a EntryAttribute, with some byte[] values. |
|
DefaultServerAttribute(java.lang.String upId,
org.apache.directory.shared.ldap.schema.AttributeType attributeType,
java.lang.String... vals)
Create a new instance of a EntryAttribute. |
|
DefaultServerAttribute(java.lang.String upId,
org.apache.directory.shared.ldap.schema.AttributeType attributeType,
org.apache.directory.shared.ldap.entry.Value<?>... vals)
Doc me more! If the value does not correspond to the same attributeType, then it's wrapped value is copied into a new Value which uses the specified attributeType. |
Method Summary | |
---|---|
int |
add(byte[]... vals)
Adds some values to this attribute. |
int |
add(java.lang.String... vals)
Adds some values to this attribute. |
int |
add(org.apache.directory.shared.ldap.entry.Value<?>... vals)
|
void |
clear()
Remove all the values from this attribute type, including a null value. |
ServerAttribute |
clone()
Clone an attribute. |
boolean |
contains(byte[]... vals)
Indicates whether all the specified values are attribute's values. |
boolean |
contains(java.lang.String... vals)
Indicates whether all the specified values are attribute's values. |
boolean |
contains(org.apache.directory.shared.ldap.entry.Value<?>... vals)
Indicates whether the specified values are some of the attribute's values. |
void |
deserialize(java.io.ObjectInput in)
|
boolean |
equals(java.lang.Object obj)
|
org.apache.directory.shared.ldap.schema.AttributeType |
getAttributeType()
Get the attribute type associated with this ServerAttribute. |
int |
hashCode()
The hashCode is based on the id, the isHR flag and on the internal values. |
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 |
readExternal(java.io.ObjectInput in)
|
boolean |
remove(byte[]... vals)
|
boolean |
remove(java.lang.String... vals)
|
boolean |
remove(org.apache.directory.shared.ldap.entry.Value<?>... vals)
|
void |
serialize(java.io.ObjectOutput out)
|
void |
setAttributeType(org.apache.directory.shared.ldap.schema.AttributeType attributeType)
Set the attribute type associated with this ServerAttribute. |
void |
setHR(boolean isHR)
Overload the ClientAttribte isHR method : we can't change this flag for a ServerAttribute, as the HR is already set using the AttributeType. |
void |
setId(java.lang.String id)
Overload the DefaultClientAttribute.setId(String) method. |
void |
setUpId(java.lang.String upId)
Overload the DefaultClientAttribute.setUpId(String) method. |
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 |
java.lang.String |
toString()
|
void |
writeExternal(java.io.ObjectOutput out)
|
Methods inherited from class org.apache.directory.shared.ldap.entry.client.DefaultClientAttribute |
---|
contains, get, get, getAll, getBytes, getId, getString, getUpId, isHR, isValid, iterator, put, put, put, put, 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.client.ClientAttribute |
---|
isValid |
Methods inherited from interface org.apache.directory.shared.ldap.entry.EntryAttribute |
---|
get, get, getAll, getBytes, getId, getString, getUpId, isHR, put, put, put, put, size |
Methods inherited from interface java.lang.Iterable |
---|
iterator |
Field Detail |
---|
public static final long serialVersionUID
Constructor Detail |
---|
public DefaultServerAttribute(org.apache.directory.shared.ldap.schema.AttributeType attributeType, org.apache.directory.shared.ldap.entry.EntryAttribute attribute)
attributeType
- The attribute's typeattribute
- The attribute to be copiedpublic DefaultServerAttribute(org.apache.directory.shared.ldap.schema.AttributeType attributeType)
attributeType
- the attributeType for the empty attribute added into the entrypublic DefaultServerAttribute(java.lang.String upId, org.apache.directory.shared.ldap.schema.AttributeType attributeType)
upId
- the ID for the added attributeTypeattributeType
- the added AttributeTypepublic DefaultServerAttribute(org.apache.directory.shared.ldap.schema.AttributeType attributeType, org.apache.directory.shared.ldap.entry.Value<?>... vals)
attributeType
- the attribute type according to the schemavals
- an initial set of values for this attributepublic DefaultServerAttribute(java.lang.String upId, org.apache.directory.shared.ldap.schema.AttributeType attributeType, org.apache.directory.shared.ldap.entry.Value<?>... vals)
upId
- the ID of the added attributeattributeType
- the attribute type according to the schemavals
- an initial set of values for this attributepublic DefaultServerAttribute(org.apache.directory.shared.ldap.schema.AttributeType attributeType, java.lang.String... vals)
attributeType
- The attributeType added on creationvals
- The added value for this attributepublic DefaultServerAttribute(java.lang.String upId, org.apache.directory.shared.ldap.schema.AttributeType attributeType, java.lang.String... vals)
upId
- the ID for the added attributeattributeType
- The attributeType added on creationvals
- the added values for this attributepublic DefaultServerAttribute(org.apache.directory.shared.ldap.schema.AttributeType attributeType, byte[]... vals)
attributeType
- The attributeType added on creationvals
- The value for the added attributepublic DefaultServerAttribute(java.lang.String upId, org.apache.directory.shared.ldap.schema.AttributeType attributeType, byte[]... vals)
upId
- the ID for the added attributeattributeType
- the AttributeType to be addedvals
- the values for the added attributeMethod Detail |
---|
public int add(byte[]... vals)
Adds some values to this attribute. If the new values are already present in the attribute values, the method has no effect.
The new values are added at the end of list of values.
This method returns the number of values that were added.
If the value's type is different from the attribute's type, the value is not added.
It's the responsibility of the caller to check if the stored values are consistent with the attribute's type.
add
in interface org.apache.directory.shared.ldap.entry.EntryAttribute
add
in class org.apache.directory.shared.ldap.entry.client.DefaultClientAttribute
vals
- some new values to be added which may be null
public int add(java.lang.String... vals)
Adds some values to this attribute. If the new values are already present in the attribute values, the method has no effect.
The new values are added at the end of list of values.
This method returns the number of values that were added.
If the value's type is different from the attribute's type, the value is not added.
add
in interface org.apache.directory.shared.ldap.entry.EntryAttribute
add
in class org.apache.directory.shared.ldap.entry.client.DefaultClientAttribute
vals
- some new values to be added which may be null
public int add(org.apache.directory.shared.ldap.entry.Value<?>... vals)
add
in interface org.apache.directory.shared.ldap.entry.EntryAttribute
add
in class org.apache.directory.shared.ldap.entry.client.DefaultClientAttribute
EntryAttribute.add(org.apache.directory.shared.ldap.entry.Value...)
public void clear()
clear
in interface org.apache.directory.shared.ldap.entry.EntryAttribute
clear
in class org.apache.directory.shared.ldap.entry.client.DefaultClientAttribute
public boolean contains(byte[]... vals)
Indicates whether all the specified values are attribute's values. If
at least one value is not an attribute's value, this method will return
false
If the Attribute is HR, this method will returns false
contains
in interface org.apache.directory.shared.ldap.entry.EntryAttribute
contains
in class org.apache.directory.shared.ldap.entry.client.DefaultClientAttribute
vals
- the values
public boolean contains(java.lang.String... vals)
Indicates whether all the specified values are attribute's values. If
at least one value is not an attribute's value, this method will return
false
If the Attribute is not HR, this method will returns false
contains
in interface org.apache.directory.shared.ldap.entry.EntryAttribute
contains
in class org.apache.directory.shared.ldap.entry.client.DefaultClientAttribute
vals
- the values
public boolean contains(org.apache.directory.shared.ldap.entry.Value<?>... vals)
Indicates whether the specified values are some of the attribute's values.
If the Attribute is HR, te metho will only accept String Values. Otherwise, it will only accept Binary values.
contains
in interface org.apache.directory.shared.ldap.entry.EntryAttribute
contains
in class org.apache.directory.shared.ldap.entry.client.DefaultClientAttribute
vals
- the values
public org.apache.directory.shared.ldap.schema.AttributeType getAttributeType()
getAttributeType
in interface ServerAttribute
public 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".
instanceOf
in interface ServerAttribute
attributeId
- The AttributeType ID to check
javax.naming.directory.InvalidAttributeValueException
- If there is no AttributeTypepublic 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 :
isValid
in interface ServerAttribute
isValid
in class org.apache.directory.shared.ldap.entry.client.DefaultClientAttribute
javax.naming.NamingException
- if there is a failure to check syntaxes of valuespublic boolean remove(byte[]... vals)
remove
in interface org.apache.directory.shared.ldap.entry.EntryAttribute
remove
in class org.apache.directory.shared.ldap.entry.client.DefaultClientAttribute
true
if all the values shave been removed from this attributeEntryAttribute#remove(byte[]...)
public boolean remove(java.lang.String... vals)
remove
in interface org.apache.directory.shared.ldap.entry.EntryAttribute
remove
in class org.apache.directory.shared.ldap.entry.client.DefaultClientAttribute
true
if all the values shave been removed from this attributeEntryAttribute.remove(String...)
public boolean remove(org.apache.directory.shared.ldap.entry.Value<?>... vals)
remove
in interface org.apache.directory.shared.ldap.entry.EntryAttribute
remove
in class org.apache.directory.shared.ldap.entry.client.DefaultClientAttribute
true
if all the values shave been removed from this attributeEntryAttribute.remove(org.apache.directory.shared.ldap.entry.Value...)
public 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
setAttributeType
in interface ServerAttribute
attributeType
- the attributeType associated with this entry attributepublic void setHR(boolean isHR)
Overload the ClientAttribte isHR method : we can't change this flag for a ServerAttribute, as the HR is already set using the AttributeType. Set the attribute to Human Readable or to Binary.
setHR
in interface org.apache.directory.shared.ldap.entry.EntryAttribute
setHR
in class org.apache.directory.shared.ldap.entry.client.DefaultClientAttribute
isHR
- true
for a Human Readable attribute,
false
for a Binary attribute.public void setId(java.lang.String id)
Overload the DefaultClientAttribute.setId(String)
method.
As the attributeType has already been set, we have to be sure that the argument is compatible with the attributeType's name.
If the given ID is not compatible with the attributeType's possible names, the previously loaded ID will be kept.
setId
in interface org.apache.directory.shared.ldap.entry.EntryAttribute
setId
in class org.apache.directory.shared.ldap.entry.client.DefaultClientAttribute
id
- The attribute IDpublic void setUpId(java.lang.String upId)
Overload the DefaultClientAttribute.setUpId(String)
method.
As the attributeType has already been set, we have to be sure that the argument is compatible with the attributeType's name.
If the given ID is not compatible with the attributeType's possible names, the previously loaded ID will be kept.
setUpId
in interface org.apache.directory.shared.ldap.entry.EntryAttribute
setUpId
in class org.apache.directory.shared.ldap.entry.client.DefaultClientAttribute
upId
- The attribute IDpublic 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.
setUpId
in interface ServerAttribute
upId
- The attribute IDattributeType
- The associated attributeTypepublic org.apache.directory.shared.ldap.entry.EntryAttribute toClientAttribute()
toClientAttribute
in interface ServerAttribute
public void writeExternal(java.io.ObjectOutput out) throws java.io.IOException
writeExternal
in interface java.io.Externalizable
writeExternal
in class org.apache.directory.shared.ldap.entry.client.DefaultClientAttribute
java.io.IOException
We can't use this method for a ServerAttribute, as we have to feed the value
with an AttributeType object
public void serialize(java.io.ObjectOutput out) throws java.io.IOException
java.io.IOException
This is the place where we serialize attributes, and all theirs
elements.
The inner structure is the same as the client attribute, but we can't call
it as we won't be able to serialize the serverValues
public void readExternal(java.io.ObjectInput in) throws java.io.IOException, java.lang.ClassNotFoundException
readExternal
in interface java.io.Externalizable
readExternal
in class org.apache.directory.shared.ldap.entry.client.DefaultClientAttribute
java.io.IOException
java.lang.ClassNotFoundException
We can't use this method for a ServerAttribute, as we have to feed the value
with an AttributeType object
public void deserialize(java.io.ObjectInput in) throws java.io.IOException, java.lang.ClassNotFoundException
java.io.IOException
java.lang.ClassNotFoundException
Externalizable#readExternal(ObjectInput)
public ServerAttribute clone()
clone
in interface org.apache.directory.shared.ldap.entry.EntryAttribute
clone
in class org.apache.directory.shared.ldap.entry.client.DefaultClientAttribute
public boolean equals(java.lang.Object obj)
equals
in class org.apache.directory.shared.ldap.entry.client.DefaultClientAttribute
true
if the two objects are equalObject.equals(Object)
public int hashCode()
hashCode
in class org.apache.directory.shared.ldap.entry.client.DefaultClientAttribute
Object.hashCode()
public java.lang.String toString()
toString
in class org.apache.directory.shared.ldap.entry.client.DefaultClientAttribute
Object.toString()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |