You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2008/03/31 18:20:08 UTC
svn commit: r643046 [3/8] - in /directory:
apacheds/branches/bigbang/benchmarks/
apacheds/branches/bigbang/core-constants/src/main/java/org/apache/directory/server/constants/
apacheds/branches/bigbang/core-entry/src/main/java/org/apache/directory/serve...
Modified: directory/apacheds/branches/bigbang/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerEntry.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerEntry.java?rev=643046&r1=643045&r2=643046&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerEntry.java (original)
+++ directory/apacheds/branches/bigbang/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerEntry.java Mon Mar 31 09:19:45 2008
@@ -20,9 +20,9 @@
import org.apache.directory.shared.ldap.entry.Entry;
+import org.apache.directory.shared.ldap.entry.EntryAttribute;
import org.apache.directory.shared.ldap.entry.Value;
import org.apache.directory.shared.ldap.schema.AttributeType;
-import org.apache.directory.shared.ldap.schema.ObjectClass;
import javax.naming.NamingException;
@@ -36,28 +36,221 @@
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$, $Date$
*/
-public interface ServerEntry extends Entry<ServerAttribute>, Cloneable
+public interface ServerEntry extends Entry, Cloneable
{
+ /**
+ * <p>
+ * Add an attribute (represented by its AttributeType and some binary values) into an
+ * entry.
+ * </p>
+ * <p>
+ * If we already have an attribute with the same values, the duplicated values
+ * are not added (duplicated values are not allowed)
+ * </p>
+ * <p>
+ * If the value cannot be added, or if the AttributeType is null or invalid,
+ * a NamingException is thrown.
+ * </p>
+ *
+ * @param attributeType The attribute Type.
+ * @param values The list of binary values to inject. It can be empty.
+ * @throws NamingException If the attribute does not exist
+ */
+ void add( AttributeType attributeType, byte[]... values ) throws NamingException;
+
+
+ /**
+ * <p>
+ * Add an attribute (represented by its AttributeType and some String values) into an
+ * entry.
+ * </p>
+ * <p>
+ * If we already have an attribute with the same values, the duplicated values
+ * are not added (duplicated values are not allowed)
+ * </p>
+ * <p>
+ * If the value cannot be added, or if the AttributeType is null or invalid,
+ * a NamingException is thrown.
+ * </p>
+ *
+ * @param attributeType The attribute Type
+ * @param values The list of binary values to inject. It can be empty
+ * @throws NamingException If the attribute does not exist
+ */
+ void add( AttributeType attributeType, String... values ) throws NamingException;
+
+
+ /**
+ * <p>
+ * Add an attribute (represented by its AttributeType and some values) into an
+ * entry.
+ * </p>
+ * <p>
+ * If we already have an attribute with the same values, the duplicated values
+ * are not added (duplicated values are not allowed)
+ * </p>
+ * <p>
+ * If the value cannot be added, or if the AttributeType is null or invalid,
+ * a NamingException is thrown.
+ * </p>
+ *
+ * @param attributeType The attribute Type
+ * @param values The list of binary values to inject. It can be empty
+ * @throws NamingException If the attribute does not exist
+ */
+ void add( AttributeType attributeType, Value<?>... values ) throws NamingException;
+
+
+ /**
+ * <p>
+ * Add an attribute (represented by its AttributeType and some binary values) into an
+ * entry. Set the User Provider ID at the same time
+ * </p>
+ * <p>
+ * If we already have an attribute with the same values, the duplicated values
+ * are not added (duplicated values are not allowed)
+ * </p>
+ * <p>
+ * If the value cannot be added, or if the AttributeType is null or invalid,
+ * a NamingException is thrown.
+ * </p>
+ *
+ * @param upId The user provided ID for the added AttributeType
+ * @param attributeType The attribute Type.
+ * @param values The list of binary values to add. It can be empty.
+ * @throws NamingException If the attribute does not exist
+ */
+ void add( String upId, AttributeType attributeType, byte[]... values ) throws NamingException;
+
+
+ /**
+ * <p>
+ * Add an attribute (represented by its AttributeType and some String values) into an
+ * entry. Set the User Provider ID at the same time
+ * </p>
+ * <p>
+ * If we already have an attribute with the same values, the duplicated values
+ * are not added (duplicated values are not allowed)
+ * </p>
+ * <p>
+ * If the value cannot be added, or if the AttributeType is null or invalid,
+ * a NamingException is thrown.
+ * </p>
+ *
+ * @param upId The user provided ID for the added AttributeType
+ * @param attributeType The attribute Type.
+ * @param values The list of binary values to add. It can be empty.
+ * @throws NamingException If the attribute does not exist
+ */
+ void add( String upId, AttributeType attributeType, String... values ) throws NamingException;
+
+
+ /**
+ * <p>
+ * Add an attribute (represented by its AttributeType and some values) into an
+ * entry. Set the User Provider ID at the same time
+ * </p>
+ * <p>
+ * If we already have an attribute with the same values, nothing is done
+ * (duplicated values are not allowed)
+ * </p>
+ * <p>
+ * If the value cannot be added, or if the AttributeType is null or invalid,
+ * a NamingException is thrown.
+ * </p>
+ *
+ * @param upId The user provided ID for the added AttributeType
+ * @param attributeType The attribute Type.
+ * @param values The list of values to add. It can be empty.
+ * @throws NamingException If the attribute does not exist
+ */
+ void add( String upId, AttributeType attributeType, Value<?>... values ) throws NamingException;
+
+
// -----------------------------------------------------------------------
- // Schema Related Methods
+ // Container (get/put/remove) Methods
// -----------------------------------------------------------------------
/**
- * Checks to see if this entry is of the objectClass.
+ * Checks if an entry contains an attribute with some given binary values.
+ *
+ * @param attributeType The Attribute we are looking for.
+ * @param values The searched values.
+ * @return <code>true</code> if all the values are found within the attribute,
+ * <code>false</code> otherwise, or if the attributes does not exist.
+ * @throws NamingException If the attribute does not exists
+ */
+ boolean contains( AttributeType attributeType, byte[]... values );
+
+
+ /**
+ * Checks if an entry contains an attribute with some given String values.
+ *
+ * @param attributeType The Attribute we are looking for.
+ * @param values The searched values.
+ * @return <code>true</code> if all the values are found within the attribute,
+ * <code>false</code> otherwise, or if the attributes does not exist.
+ * @throws NamingException If the attribute does not exists
+ */
+ boolean contains( AttributeType attributeType, String... values );
+
+
+ /**
+ * Checks if an entry contains an attribute with some given binary values.
*
- * @param objectClass the objectClass to check for in this ServerEntry
- * @return true if this entry is of the objectClass, false otherwise
+ * @param attributeType The Attribute we are looking for.
+ * @param values The searched values.
+ * @return <code>true</code> if all the values are found within the attribute,
+ * <code>false</code> otherwise, or if the attributes does not exist.
+ * @throws NamingException If the attribute does not exists
*/
- boolean hasObjectClass( String objectClass );
+ boolean contains( AttributeType attributeType, Value<?>... values );
+
+
+ /**
+ * Checks if an entry contains a specific AttributeType.
+ *
+ * @param attributeType The AttributeType to look for.
+ * @return <code>true</code> if the attribute is found within the entry.
+ */
+ boolean containsAttribute( AttributeType attributeType );
/**
- * Gets all the attributes type (ObjectClasses, May and Must)
+ * <p>
+ * Returns the attribute with the specified AttributeType. The return value
+ * is <code>null</code> if no match is found.
+ * </p>
*
- * @return The combined set of all the attributes, including ObjectClass.
+ * @param attributeType The attributeType we are looking for.
+ * @return the attribute associated with the AttributeType.
+ */
+ /**
+ * Returns the attribute associated with an AttributeType
+ *
+ * @param the AttributeType we are looking for
+ * @return the associated attribute
+ */
+ EntryAttribute get( AttributeType attributeType );
+
+
+ /**
+ * Gets all the attributes type
+ *
+ * @return The combined set of all the attributes.
*/
Set<AttributeType> getAttributeTypes();
+
+ /**
+ * Tells if an entry has a specific ObjectClass Attribute
+ *
+ * @param objectClass The ObjectClass we want to check
+ * @return <code>true</code> if the ObjectClass value is present
+ * in the ObjectClass attribute
+ */
+ boolean hasObjectClass( EntryAttribute objectClass );
+
/**
* Fail fast check performed to determine entry consistency according to schema
* characteristics.
@@ -78,158 +271,237 @@
* @return true if the entry, it's attributes and their values are consistent
* with the objectClass
*/
- boolean isValid( ObjectClass objectClass );
-
-
- // -----------------------------------------------------------------------
- // Container (get/put/remove) Methods
- // -----------------------------------------------------------------------
-
+ boolean isValid( String objectClass );
+
/**
- * Returns the attribute with the specified attributeType. The return
- * value is <code>null</code> if no match is found.
+ * 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.
*
- * @param attributeType the type of the attribute
- * @return the attribute of the specified type
+ * @param objectClass the objectClass to use while checking for validity
+ * @return true if the entry, it's attributes and their values are consistent
+ * with the objectClass
*/
- ServerAttribute get( AttributeType attributeType );
+ boolean isValid( EntryAttribute objectClass );
/**
- * Returns the attribute with the specified ID. The return
- * value is <code>null</code> if no match is found.
+ * <p>
+ * Places a new attribute with the supplied AttributeType and binary values
+ * into the attribute collection.
+ * </p>
+ * <p>
+ * If there is already an attribute with the same AttributeType, the old
+ * one is removed from the collection and is returned by this method.
+ * </p>
+ * <p>
+ * This method provides a mechanism to put an attribute with a
+ * <code>null</code> value: the value may be <code>null</code>.
*
- * @param upId the ID of the attribute
- * @return the attribute of the specified ID
+ * @param attributeType the type of the new attribute to be put
+ * @param values the binary values of the new attribute to be put
+ * @return the old attribute with the same identifier, if exists; otherwise
+ * <code>null</code>
+ * @throws NamingException if there are failures
*/
- ServerAttribute get( String upId ) throws NamingException;
+ EntryAttribute put( AttributeType attributeType, byte[]... values ) throws NamingException;
/**
- * Places non-null attributes in the attribute collection. If there is
- * already an attribute with the same OID 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 OID the return value
- * is <code>null</code>.
+ * <p>
+ * Places a new attribute with the supplied AttributeType and String values
+ * into the attribute collection.
+ * </p>
+ * <p>
+ * If there is already an attribute with the same AttributeType, the old
+ * one is removed from the collection and is returned by this method.
+ * </p>
+ * <p>
+ * This method provides a mechanism to put an attribute with a
+ * <code>null</code> value: the value may be <code>null</code>.
*
- * @param attributes the attributes to be put
- * @return the old attributes with the same OID, if exist; otherwise
- * <code>null</code>
+ * @param attributeType the type of the new attribute to be put
+ * @param values the String values of the new attribute to be put
+ * @return the old attribute with the same identifier, if exists; otherwise
+ * <code>null</code>
+ * @throws NamingException if there are failures
*/
- List<ServerAttribute> put( ServerAttribute... attributes ) throws NamingException;
-
- ServerAttribute put( String upId, String... values ) throws NamingException;
-
- ServerAttribute put( String upId, byte[]... values ) throws NamingException;
-
- List<ServerAttribute> set( String... upIds ) throws NamingException;
+ EntryAttribute put( AttributeType attributeType, String... values ) throws NamingException;
- List<ServerAttribute> set( AttributeType... attributeTypes ) throws NamingException;
/**
- * Places a new attribute of the supplied type and value into the attribute
- * collection. The identifier used for the attribute is the first alias found
- * from the attributeType and if no aliases are available then the
- * attributeType's numric OID is used instead. If there is already an attribute
- * of the same type, the old attribute is removed from the collection and is
- * returned by this method. The user provided identifier of the existing
- * attribute will be used for the new one. If there was no attribute with the same
- * type the return value is <code>null</code>.
- *
- * This method provides a mechanism to put an attribute with a <code>null</code>
- * value: the value of <code>val</code> may be <code>null</code>.
+ * <p>
+ * Places a new attribute with the supplied AttributeType and some values
+ * into the attribute collection.
+ * </p>
+ * <p>
+ * If there is already an attribute with the same AttributeType, the old
+ * one is removed from the collection and is returned by this method.
+ * </p>
+ * <p>
+ * This method provides a mechanism to put an attribute with a
+ * <code>null</code> value: the value may be <code>null</code>.
*
* @param attributeType the type of the new attribute to be put
* @param values the values of the new attribute to be put
- * @return the old attribute of the same type, if exists; otherwise
- * <code>null</code>
- * @throws NamingException if there are resolution issues
+ * @return the old attribute with the same identifier, if exists; otherwise
+ * <code>null</code>
+ * @throws NamingException if there are failures
*/
- ServerAttribute put( AttributeType attributeType, Value<?>... values ) throws NamingException;
+ EntryAttribute put( AttributeType attributeType, Value<?>... values ) throws NamingException;
+
/**
- * Places a new attribute with the supplied attributeType and value into this
- * ServerEntry. If there already exists attribute of the same type, the existing
- * one is removed from this ServerEntry and is returned. If there was no existing
- * attribute the <code>null</code> is returned instead.
- *
- * This method provides a mechanism to put an attribute with a <code>null</code>
- * value: the value of <code>obj</code> may be <code>null</code>.
+ * <p>
+ * Places a new attribute with the supplied AttributeType and some binary values
+ * into the attribute collection.
+ * </p>
+ * <p>
+ * The given User provided ID will be used for this new AttributeEntry.
+ * </p>
+ * <p>
+ * If there is already an attribute with the same AttributeType, the old
+ * one is removed from the collection and is returned by this method.
+ * </p>
+ * <p>
+ * This method provides a mechanism to put an attribute with a
+ * <code>null</code> value: the value may be <code>null</code>.
*
- * @param upId the user provided identifier for the new attribute
- * @param values the value of the new attribute to be put
- * @return the old attribute of the same type, if exists; otherwise
- * <code>null</code>
- * @throws NamingException if there are failures
+ * @param upId The User Provided ID to be stored into the AttributeEntry
+ * @param values the binary values of the new attribute to be put
+ * @return the old attribute with the same identifier, if exists; otherwise
+ * <code>null</code>
+ * @throws NamingException if there are failures.
*/
- ServerAttribute put( String upId, Value<?>... values ) throws NamingException;
+ EntryAttribute put( String upId, AttributeType attributeType, byte[]... values ) throws NamingException;
/**
- * Places a new attribute with the supplied OID and value into the attribute
- * collection. If there is already an attribute with the same OID, the old
- * one is removed from the collection and is returned by this method. If
- * there was no attribute with the same OID the return value is
- * <code>null</code>.
- *
+ * <p>
+ * Places a new attribute with the supplied AttributeType and some String values
+ * into the attribute collection.
+ * </p>
+ * <p>
+ * The given User provided ID will be used for this new AttributeEntry.
+ * </p>
+ * <p>
+ * If there is already an attribute with the same AttributeType, the old
+ * one is removed from the collection and is returned by this method.
+ * </p>
+ * <p>
* This method provides a mechanism to put an attribute with a
- * <code>null</code> value: the value of <code>obj</code> may be
- * <code>null</code>.
+ * <code>null</code> value: the value may be <code>null</code>.
*
+ * @param upId The User Provided ID to be stored into the AttributeEntry
* @param attributeType the type of the new attribute to be put
- * @param values the values of the new attribute to be put
+ * @param values the String values of the new attribute to be put
* @return the old attribute with the same identifier, if exists; otherwise
- * <code>null</code>
- * @throws NamingException if there are failures
+ * <code>null</code>
+ * @throws NamingException if there are failures.
*/
- ServerAttribute put( AttributeType attributeType, String... values ) throws NamingException;
+ EntryAttribute put( String upId, AttributeType attributeType, String... values ) throws NamingException;
/**
- * Places a new attribute with the supplied OID and value into the attribute
- * collection. If there is already an attribute with the same OID, the old
- * one is removed from the collection and is returned by this method. If
- * there was no attribute with the same OID the return value is
- * <code>null</code>.
- *
+ * <p>
+ * Places a new attribute with the supplied AttributeType and some values
+ * into the attribute collection.
+ * </p>
+ * <p>
+ * The given User provided ID will be used for this new AttributeEntry.
+ * </p>
+ * <p>
+ * If there is already an attribute with the same AttributeType, the old
+ * one is removed from the collection and is returned by this method.
+ * </p>
+ * <p>
* This method provides a mechanism to put an attribute with a
- * <code>null</code> value: the value of <code>obj</code> may be
- * <code>null</code>.
+ * <code>null</code> value: the value may be <code>null</code>.
*
+ * @param upId The User Provided ID to be stored into the AttributeEntry
* @param attributeType the type of the new attribute to be put
* @param values the values of the new attribute to be put
* @return the old attribute with the same identifier, if exists; otherwise
- * <code>null</code>
- * @throws NamingException if there are failures
+ * <code>null</code>
+ * @throws NamingException if there are failures.
*/
- ServerAttribute put( AttributeType attributeType, byte[]... values ) throws NamingException;
+ EntryAttribute put( String upId, AttributeType attributeType, Value<?>... values ) throws NamingException;
/**
- * Removes the attribute with the specified alias. The removed attribute is
- * returned by this method. If there is no attribute with the specified OID,
- * the return value is <code>null</code>.
- *
- * @param attributeTypes the types of the attribute to be removed
- * @return the removed attribute, if exists; otherwise <code>null</code>
- * @throws NamingException if there are failures
+ * <p>
+ * Removes the specified binary values from an attribute.
+ * </p>
+ * <p>
+ * If at least one value is removed, this method returns <code>true</code>.
+ * </p>
+ * <p>
+ * If there is no more value after having removed the values, the attribute
+ * will be removed too.
+ * </p>
+ * <p>
+ * If the attribute does not exist, nothing is done and the method returns
+ * <code>false</code>
+ * </p>
+ *
+ * @param attributeType The attribute type
+ * @param values the values to be removed
+ * @return <code>true</code> if at least a value is removed, <code>false</code>
+ * if not all the values have been removed or if the attribute does not exist.
*/
- List<ServerAttribute> remove( AttributeType... attributeTypes ) throws NamingException;
-
+ boolean remove( AttributeType attributeType, byte[]... values ) throws NamingException;
+
/**
- * Removes the attribute with the specified alias. The removed attribute is
- * returned by this method. If there is no attribute with the specified OID,
- * the return value is <code>null</code>.
- *
- * @param ids the IDs of the attribute to be removed
- * @return the removed attribute, if exists; otherwise <code>null</code>
- * @throws NamingException if there are failures
+ * <p>
+ * Removes the specified String values from an attribute.
+ * </p>
+ * <p>
+ * If at least one value is removed, this method returns <code>true</code>.
+ * </p>
+ * <p>
+ * If there is no more value after having removed the values, the attribute
+ * will be removed too.
+ * </p>
+ * <p>
+ * If the attribute does not exist, nothing is done and the method returns
+ * <code>false</code>
+ * </p>
+ *
+ * @param attributeType The attribute type
+ * @param values the values to be removed
+ * @return <code>true</code> if at least a value is removed, <code>false</code>
+ * if not all the values have been removed or if the attribute does not exist.
*/
- List<ServerAttribute> remove( String... ids ) throws NamingException;
+ boolean remove( AttributeType attributeType, String... values ) throws NamingException;
+
+ /**
+ * <p>
+ * Removes the specified values from an attribute.
+ * </p>
+ * <p>
+ * If at least one value is removed, this method returns <code>true</code>.
+ * </p>
+ * <p>
+ * If there is no more value after having removed the values, the attribute
+ * will be removed too.
+ * </p>
+ * <p>
+ * If the attribute does not exist, nothing is done and the method returns
+ * <code>false</code>
+ * </p>
+ *
+ * @param attributeType The attribute type
+ * @param values the values to be removed
+ * @return <code>true</code> if at least a value is removed, <code>false</code>
+ * if not all the values have been removed or if the attribute does not exist.
+ */
+ boolean remove( AttributeType attributeType, Value<?>... values ) throws NamingException;
+
/**
* Removes the specified attributes. The removed attributes are
* returned by this method. If there were no attribute the return value
@@ -238,10 +510,45 @@
* @param attributes the attributes to be removed
* @return the removed attribute, if exists; otherwise <code>null</code>
*/
- List<ServerAttribute> remove( ServerAttribute... attributes ) throws NamingException;
+ List<EntryAttribute> remove( EntryAttribute... attributes ) throws NamingException;
+
+ /**
+ * <p>
+ * Removes the attribute with the specified AttributeTypes.
+ * </p>
+ * <p>
+ * The removed attribute are returned by this method.
+ * </p>
+ * <p>
+ * If there is no attribute with the specified AttributeTypes,
+ * the return value is <code>null</code>.
+ * </p>
+ *
+ * @param attributes the AttributeTypes to be removed
+ * @return the removed attributes, if any, as a list; otherwise <code>null</code>
+ */
+ List<EntryAttribute> removeAttributes( AttributeType... attributes );
+
+
+ /**
+ * <p>
+ * Put some new attributes using the attributeTypes.
+ * No value is inserted.
+ * </p>
+ * <p>
+ * If an existing Attribute is found, it will be replaced by an
+ * empty attribute, and returned to the caller.
+ * </p>
+ *
+ * @param attributeTypes The AttributeTypes to add.
+ * @return A list of replaced Attributes, of <code>null</code> if no attribute are removed.
+ */
+ List<EntryAttribute> set( AttributeType... attributeTypes );
+
+
/**
* A clone method to produce a clone of the current object
*/
- public Object clone();
+ public Entry clone();
}
Modified: directory/apacheds/branches/bigbang/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerEntrySerializer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerEntrySerializer.java?rev=643046&r1=643045&r2=643046&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerEntrySerializer.java (original)
+++ directory/apacheds/branches/bigbang/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerEntrySerializer.java Mon Mar 31 09:19:45 2008
@@ -26,6 +26,7 @@
import javax.naming.NamingException;
import org.apache.directory.server.schema.registries.Registries;
+import org.apache.directory.shared.ldap.entry.EntryAttribute;
import org.apache.directory.shared.ldap.entry.Value;
import org.apache.directory.shared.ldap.name.LdapDNSerializer;
import org.apache.directory.shared.ldap.name.LdapDN;
@@ -99,10 +100,10 @@
// here, to be able to restore it in the readExternal :
// we need access to the registries, which are not available
// in the ServerAttribute class.
- for ( ServerAttribute attribute:entry )
+ for ( EntryAttribute attribute:entry )
{
// We store the OID, as the AttributeType might have no name
- out.writeUTF( attribute.getAttributeType().getOid() );
+ out.writeUTF( ((ServerAttribute)attribute).getAttributeType().getOid() );
// And store the attribute.
// Store the UP id
Modified: directory/apacheds/branches/bigbang/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerEntryUtils.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerEntryUtils.java?rev=643046&r1=643045&r2=643046&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerEntryUtils.java (original)
+++ directory/apacheds/branches/bigbang/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerEntryUtils.java Mon Mar 31 09:19:45 2008
@@ -39,6 +39,7 @@
import org.apache.directory.server.schema.registries.AttributeTypeRegistry;
import org.apache.directory.server.schema.registries.Registries;
import org.apache.directory.shared.ldap.constants.SchemaConstants;
+import org.apache.directory.shared.ldap.entry.EntryAttribute;
import org.apache.directory.shared.ldap.entry.Modification;
import org.apache.directory.shared.ldap.entry.ModificationOperation;
import org.apache.directory.shared.ldap.entry.Value;
@@ -76,7 +77,7 @@
for ( AttributeType attributeType:entry.getAttributeTypes() )
{
- ServerAttribute attr = entry.get( attributeType );
+ EntryAttribute attr = entry.get( attributeType );
// Deal with a special case : an entry without any ObjectClass
if ( attributeType.getOid() == SchemaConstants.OBJECT_CLASS_AT_OID )
@@ -234,11 +235,10 @@
{
Attribute attribute = new BasicAttribute( attributeType.getName(), true );
- ServerAttribute attr = entry.get( attributeType );
+ EntryAttribute attr = entry.get( attributeType );
- for ( Iterator<Value<?>> iter = attr.iterator(); iter.hasNext();)
+ for ( Value<?> value:attr )
{
- Value<?> value = iter.next();
attribute.add( value );
}
@@ -272,7 +272,7 @@
*
* @return An instance of a BasicAttribute() object
*/
- public static Attribute toAttributeImpl( ServerAttribute attr )
+ public static Attribute toAttributeImpl( EntryAttribute attr )
{
Attribute attribute = new AttributeImpl( attr.getUpId() );
@@ -312,11 +312,11 @@
if ( toBeRemoved.size() == 0 )
{
- targetEntry.remove( id );
+ targetEntry.removeAttributes( id );
}
else
{
- ServerAttribute existing = targetEntry.get( id );
+ EntryAttribute existing = targetEntry.get( id );
if ( existing != null )
{
@@ -331,7 +331,7 @@
case ADD_ATTRIBUTE :
ServerAttribute combined = new DefaultServerAttribute( id, attributeType );
ServerAttribute toBeAdded = (ServerAttribute)mod.getAttribute();
- ServerAttribute existing = entry.get( id );
+ EntryAttribute existing = entry.get( id );
if ( existing != null )
{
Modified: directory/apacheds/branches/bigbang/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerModification.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerModification.java?rev=643046&r1=643045&r2=643046&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerModification.java (original)
+++ directory/apacheds/branches/bigbang/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerModification.java Mon Mar 31 09:19:45 2008
@@ -40,17 +40,17 @@
private ModificationOperation operation;
/** The attribute which contains the modification */
- private ServerAttribute attribute;
+ private EntryAttribute attribute;
- public ServerModification( ModificationOperation operation, ServerAttribute attribute )
+ public ServerModification( ModificationOperation operation, EntryAttribute attribute )
{
this.operation = operation;
this.attribute = attribute;
}
- public ServerModification( int operation, ServerAttribute attribute )
+ public ServerModification( int operation, EntryAttribute attribute )
{
setOperation( operation );
this.attribute = attribute;
Modified: directory/apacheds/branches/bigbang/core-entry/src/test/java/org/apache/directory/server/core/entry/DefaultServerAttributeTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core-entry/src/test/java/org/apache/directory/server/core/entry/DefaultServerAttributeTest.java?rev=643046&r1=643045&r2=643046&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core-entry/src/test/java/org/apache/directory/server/core/entry/DefaultServerAttributeTest.java (original)
+++ directory/apacheds/branches/bigbang/core-entry/src/test/java/org/apache/directory/server/core/entry/DefaultServerAttributeTest.java Mon Mar 31 09:19:45 2008
@@ -1473,7 +1473,7 @@
assertEquals( " CommonName: (null)\n", attr.toString() );
attr.add( (String)null );
- assertEquals( " CommonName: 'null'\n", attr.toString() );
+ assertEquals( " CommonName: ''\n", attr.toString() );
attr.put( "a", "b" );
assertEquals( " CommonName: 'a'\n CommonName: 'b'\n", attr.toString() );