From commits-return-5289-apmail-directory-commits-archive=directory.apache.org@directory.apache.org Mon Jul 04 21:41:23 2005 Return-Path: Delivered-To: apmail-directory-commits-archive@www.apache.org Received: (qmail 67207 invoked from network); 4 Jul 2005 21:41:23 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 4 Jul 2005 21:41:23 -0000 Received: (qmail 2404 invoked by uid 500); 4 Jul 2005 21:41:22 -0000 Delivered-To: apmail-directory-commits-archive@directory.apache.org Received: (qmail 2356 invoked by uid 500); 4 Jul 2005 21:41:22 -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 2342 invoked by uid 99); 4 Jul 2005 21:41:22 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 04 Jul 2005 14:41:22 -0700 X-ASF-Spam-Status: No, hits=0.2 required=10.0 tests=NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.29) with SMTP; Mon, 04 Jul 2005 14:41:23 -0700 Received: (qmail 67198 invoked by uid 65534); 4 Jul 2005 21:41:19 -0000 Message-ID: <20050704214119.67197.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r209128 - /directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/pojo/AddRequest.java Date: Mon, 04 Jul 2005 21:41:18 -0000 To: commits@directory.apache.org From: elecharny@apache.org X-Mailer: svnmailer-1.0.2 X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: elecharny Date: Mon Jul 4 14:41:16 2005 New Revision: 209128 URL: http://svn.apache.org/viewcvs?rev=209128&view=rev Log: - added a toString() method - polished the Javadoc - added transient to every members that won't be serialized Modified: directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/pojo/AddRequest.java Modified: directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/pojo/AddRequest.java URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/pojo/AddRequest.java?rev=209128&r1=209127&r2=209128&view=diff ============================================================================== --- directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/pojo/AddRequest.java (original) +++ directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/pojo/AddRequest.java Mon Jul 4 14:41:16 2005 @@ -21,8 +21,11 @@ import org.apache.asn1.ldap.codec.primitives.LdapString; import org.apache.asn1.primitives.OctetString; +import org.apache.log4j.Logger; + import java.util.ArrayList; +import javax.naming.NamingException; import javax.naming.directory.Attribute; import javax.naming.directory.BasicAttribute; @@ -43,16 +46,24 @@ */ public class AddRequest extends Asn1Object { + //~ Static fields/initializers ----------------------------------------------------------------- + + /** The logger */ + private transient static final Logger log = Logger.getLogger( AddRequest.class ); + + /** Logging speed up */ + private transient static final boolean DEBUG = log.isDebugEnabled(); + //~ Instance fields ---------------------------------------------------------------------------- - /** The DN to be modified. */ + /** The DN to be added. */ private LdapDN entry; /** The attributes list. */ private ArrayList attributes; /** The current attribute being decoded */ - private Attribute currentAttribute; + private transient Attribute currentAttribute; //~ Constructors ------------------------------------------------------------------------------- @@ -86,7 +97,8 @@ /** * Create a new attributeValue - * @param type The attribute's name + * + * @param type The attribute's name (called 'type' in the grammar) */ public void addAttributeType( LdapString type ) { @@ -96,7 +108,8 @@ /** * Add a new value to the current attribute - * @param value + * + * @param value The value to be added */ public void addAttributeValue( OctetString value ) { @@ -105,6 +118,7 @@ /** * Get the added DN + * * @return Returns the entry. */ public String getEntry() @@ -114,10 +128,59 @@ /** * Set the added DN. + * * @param entry The entry to set. */ public void setEntry( LdapDN entry ) { this.entry = entry; + } + + /** + * Return a String representing an AddRequest + * + * @return A String representing the AddRequest + */ + public String toString() + { + + StringBuffer sb = new StringBuffer(); + + sb.append( " Add Request :\n" ); + sb.append( " Entry : '" ).append( entry.toString() ).append( "'\n" ); + + if ( attributes != null ) + { + sb.append( " Attributes : \n" ); + + for ( int i = 0; i < attributes.size(); i++ ) + { + + Attribute attribute = ( Attribute ) attributes.get( i ); + + sb.append( " Type[" ).append( i ).append( "] : '" ) + .append( attribute.getID() ).append( "'\n" ); + + for ( int j = 0; j < attribute.size(); j++ ) + { + + try + { + + OctetString attributeValue = ( OctetString ) attribute.get( j ); + sb.append( " Val[" ).append( j ).append( "] : " ) + .append( attributeValue.toString() ).append( " \n" ); + } + catch ( NamingException ne ) + { + log.error( "Naming exception will printing the '" + attribute.getID() + + "'" ); + } + + } + } + } + + return sb.toString(); } }