Return-Path: Delivered-To: apmail-directory-commits-archive@www.apache.org Received: (qmail 95769 invoked from network); 25 Apr 2010 16:15:25 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 25 Apr 2010 16:15:25 -0000 Received: (qmail 18962 invoked by uid 500); 25 Apr 2010 16:15:25 -0000 Delivered-To: apmail-directory-commits-archive@directory.apache.org Received: (qmail 18935 invoked by uid 500); 25 Apr 2010 16:15:25 -0000 Mailing-List: contact commits-help@directory.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@directory.apache.org Delivered-To: mailing list commits@directory.apache.org Received: (qmail 18928 invoked by uid 99); 25 Apr 2010 16:15:25 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 25 Apr 2010 16:15:25 +0000 X-ASF-Spam-Status: No, hits=-1321.7 required=10.0 tests=ALL_TRUSTED,AWL X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 25 Apr 2010 16:15:24 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id C93AC23889F1; Sun, 25 Apr 2010 16:14:42 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r937815 - in /directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry: AbstractEntry.java client/DefaultClientEntry.java Date: Sun, 25 Apr 2010 16:14:42 -0000 To: commits@directory.apache.org From: elecharny@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20100425161442.C93AC23889F1@eris.apache.org> Author: elecharny Date: Sun Apr 25 16:14:42 2010 New Revision: 937815 URL: http://svn.apache.org/viewvc?rev=937815&view=rev Log: o Moved all the methods from AbstractEntry to DefaultClientEntry class o Removed the AbstractEntry class, Removed: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/AbstractEntry.java Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/client/DefaultClientEntry.java Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/client/DefaultClientEntry.java URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/client/DefaultClientEntry.java?rev=937815&r1=937814&r2=937815&view=diff ============================================================================== --- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/client/DefaultClientEntry.java (original) +++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/client/DefaultClientEntry.java Sun Apr 25 16:14:42 2010 @@ -23,7 +23,9 @@ import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; import java.util.ArrayList; +import java.util.Collections; import java.util.HashMap; +import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.SortedMap; @@ -32,13 +34,13 @@ import java.util.TreeMap; import org.apache.directory.shared.ldap.exception.LdapException; import org.apache.directory.shared.i18n.I18n; -import org.apache.directory.shared.ldap.entry.AbstractEntry; import org.apache.directory.shared.ldap.entry.DefaultEntryAttribute; 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.name.DN; import org.apache.directory.shared.ldap.schema.AttributeType; +import org.apache.directory.shared.ldap.schema.SchemaManager; import org.apache.directory.shared.ldap.util.StringTools; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -53,7 +55,7 @@ import org.slf4j.LoggerFactory; * @author Apache Directory Project * @version $Rev$, $Date$ */ -public class DefaultClientEntry extends AbstractEntry +public class DefaultClientEntry implements Entry { /** Used for serialization */ private static final long serialVersionUID = 2L; @@ -61,6 +63,19 @@ public class DefaultClientEntry extends /** The logger for this class */ private static final Logger LOG = LoggerFactory.getLogger( DefaultClientEntry.class ); + /** The DN for this entry */ + protected DN dn; + + /** A map containing all the attributes for this entry */ + protected Map attributes = new HashMap(); + + /** A speedup to get the ObjectClass attribute */ + protected static transient AttributeType OBJECT_CLASS_AT; + + /** The SchemaManager */ + protected SchemaManager schemaManager; + + //------------------------------------------------------------------------- // Constructors //------------------------------------------------------------------------- @@ -318,35 +333,42 @@ public class DefaultClientEntry extends */ public Entry clone() { - // First, clone the structure - DefaultClientEntry clone = (DefaultClientEntry)super.clone(); - - // Just in case ... Should *never* happen - if ( clone == null ) - { - return null; - } - - // An Entry has a DN and many attributes. - // First, clone the DN, if not null. - if ( dn != null ) + try { - clone.setDn( (DN)dn.clone() ); + // First, clone the structure + DefaultClientEntry clone = (DefaultClientEntry)super.clone(); + + // Just in case ... Should *never* happen + if ( clone == null ) + { + return null; + } + + // An Entry has a DN and many attributes. + // First, clone the DN, if not null. + if ( dn != null ) + { + clone.setDn( (DN)dn.clone() ); + } + + // then clone the ClientAttribute Map. + clone.attributes = (Map)(((HashMap)attributes).clone()); + + // now clone all the attributes + clone.attributes.clear(); + + for ( EntryAttribute attribute:attributes.values() ) + { + clone.attributes.put( attribute.getId(), attribute.clone() ); + } + + // We are done ! + return clone; } - - // then clone the ClientAttribute Map. - clone.attributes = (Map)(((HashMap)attributes).clone()); - - // now clone all the attributes - clone.attributes.clear(); - - for ( EntryAttribute attribute:attributes.values() ) + catch ( CloneNotSupportedException cnse ) { - clone.attributes.put( attribute.getId(), attribute.clone() ); + return null; } - - // We are done ! - return clone; } @@ -956,6 +978,61 @@ public class DefaultClientEntry extends /** + * Get this entry's DN. + * + * @return The entry's DN + */ + public DN getDn() + { + return dn; + } + + + /** + * Set this entry's DN. + * + * @param dn The DN associated with this entry + */ + public void setDn( DN dn ) + { + this.dn = dn; + } + + + /** + * Remove all the attributes for this entry. The DN is not reset + */ + public void clear() + { + attributes.clear(); + } + + + /** + * Returns an enumeration containing the zero or more attributes in the + * collection. The behavior of the enumeration is not specified if the + * attribute collection is changed. + * + * @return an enumeration of all contained attributes + */ + public Iterator iterator() + { + return Collections.unmodifiableMap( attributes ).values().iterator(); + } + + + /** + * Returns the number of attributes. + * + * @return the number of attributes + */ + public int size() + { + return attributes.size(); + } + + + /** * @see Externalizable#writeExternal(ObjectOutput)

* * This is the place where we serialize entries, and all theirs