directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r414015 [2/5] - in /directory/trunks/shared: ./ asn1/ asn1/src/main/java/org/apache/directory/shared/asn1/ber/ asn1/src/main/java/org/apache/directory/shared/asn1/ber/grammar/ ldap/ ldap/src/main/antlr/ ldap/src/main/java/org/apache/directo...
Date Wed, 14 Jun 2006 01:15:18 GMT
Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/SearchResultEntryGrammar.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/SearchResultEntryGrammar.java?rev=414015&r1=414014&r2=414015&view=diff
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/SearchResultEntryGrammar.java (original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/SearchResultEntryGrammar.java Tue Jun 13 18:15:12 2006
@@ -18,8 +18,6 @@
 
 
 import javax.naming.InvalidNameException;
-import javax.naming.Name;
-import javax.naming.NamingException;
 
 import org.apache.directory.shared.asn1.ber.IAsn1Container;
 import org.apache.directory.shared.asn1.ber.grammar.AbstractGrammar;
@@ -133,7 +131,7 @@
 
                     TLV tlv = ldapMessageContainer.getCurrentTLV();
 
-                    Name objectName = LdapDN.EMPTY_LDAPDN;
+                    LdapDN objectName = LdapDN.EMPTY_LDAPDN;
 
                     // Store the value.
                     if ( tlv.getLength().getLength() == 0 )
@@ -145,7 +143,6 @@
                         try
                         {
                             objectName = new LdapDN( tlv.getValue().getData() );
-                            objectName = LdapDN.normalize( objectName );
                         }
                         catch ( InvalidNameException ine )
                         {
@@ -154,13 +151,6 @@
                             log.error( "{} : {}", msg, ine.getMessage() );
                             throw new DecoderException( msg, ine );
                         }
-                        catch ( NamingException ne )
-                        {
-                            String msg = "The DN " + StringTools.dumpBytes( tlv.getValue().getData() )
-                                + "is invalid : " + ne.getMessage();
-                            log.error( "{} : {}", msg, ne.getMessage() );
-                            throw new DecoderException( msg, ne );
-                        }
 
                         searchResultEntry.setObjectName( objectName );
                     }
@@ -261,7 +251,7 @@
                     {
                         try
                         {
-                            type = LdapDN.normalizeAttribute( tlv.getValue().getData() );
+                            type = new LdapString( tlv.getValue().getData() );
                             searchResultEntry.addAttributeValues( type );
                         }
                         catch ( LdapStringEncodingException lsee )

Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/SubstringFilterGrammar.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/SubstringFilterGrammar.java?rev=414015&r1=414014&r2=414015&view=diff
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/SubstringFilterGrammar.java (original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/SubstringFilterGrammar.java Tue Jun 13 18:15:12 2006
@@ -31,7 +31,6 @@
 import org.apache.directory.shared.ldap.codec.LdapStatesEnum;
 import org.apache.directory.shared.ldap.codec.util.LdapString;
 import org.apache.directory.shared.ldap.codec.util.LdapStringEncodingException;
-import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.util.StringTools;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -174,7 +173,7 @@
                     {
                         try
                         {
-                            LdapString type = LdapDN.normalizeAttribute( tlv.getValue().getData() );
+                            LdapString type = new LdapString( tlv.getValue().getData() );
                             substringFilter.setType( type );
                         }
                         catch ( LdapStringEncodingException lsee )

Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/EntryChangeControl.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/EntryChangeControl.java?rev=414015&r1=414014&r2=414015&view=diff
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/EntryChangeControl.java (original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/EntryChangeControl.java Tue Jun 13 18:15:12 2006
@@ -24,9 +24,8 @@
 import org.apache.directory.shared.asn1.ber.tlv.UniversalTag;
 import org.apache.directory.shared.asn1.ber.tlv.Value;
 import org.apache.directory.shared.asn1.codec.EncoderException;
-import org.apache.directory.shared.asn1.util.Asn1StringUtils;
-import org.apache.directory.shared.ldap.codec.util.LdapString;
-import org.apache.directory.shared.ldap.codec.util.LdapStringEncodingException;
+import org.apache.directory.shared.ldap.name.LdapDN;
+import org.apache.directory.shared.ldap.util.StringTools;
 
 
 /**
@@ -85,7 +84,9 @@
 
     private int changeNumber = UNDEFINED_CHANGE_NUMBER;
 
-    private LdapString previousDn = null;
+    private LdapDN previousDn = null;
+    
+    private byte[] previousDnBytes = null;
 
     private transient int eccSeqLength;
 
@@ -104,7 +105,8 @@
 
         if ( previousDn != null )
         {
-            previousDnLength = 1 + Length.getNbBytes( previousDn.getNbBytes() ) + previousDn.getNbBytes();
+            previousDnBytes = StringTools.getBytesUtf8( previousDn.getUpName() );
+            previousDnLength = 1 + Length.getNbBytes( previousDnBytes.length ) + previousDnBytes.length;
         }
 
         if ( changeNumber != UNDEFINED_CHANGE_NUMBER )
@@ -140,7 +142,7 @@
 
         if ( previousDn != null )
         {
-            Value.encode( bb, previousDn.getBytes() );
+            Value.encode( bb, previousDnBytes );
         }
         if ( changeNumber != UNDEFINED_CHANGE_NUMBER )
         {
@@ -184,26 +186,13 @@
     }
 
 
-    public String getPreviousDn()
+    public LdapDN getPreviousDn()
     {
-        return previousDn == null ? "" : previousDn.getString();
+        return previousDn;
     }
 
 
-    public void setPreviousDn( String previousDn )
-    {
-        try
-        {
-            this.previousDn = new LdapString( Asn1StringUtils.getBytesUtf8( previousDn ) );
-        }
-        catch ( LdapStringEncodingException e )
-        {
-            e.printStackTrace();
-        }
-    }
-
-
-    public void setPreviousDn( LdapString previousDn )
+    public void setPreviousDn( LdapDN previousDn )
     {
         this.previousDn = previousDn;
     }

Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/EntryChangeControlDecoder.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/EntryChangeControlDecoder.java?rev=414015&r1=414014&r2=414015&view=diff
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/EntryChangeControlDecoder.java (original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/EntryChangeControlDecoder.java Tue Jun 13 18:15:12 2006
@@ -19,6 +19,8 @@
 
 import java.nio.ByteBuffer;
 
+import javax.naming.NamingException;
+
 import org.apache.directory.shared.asn1.Asn1Object;
 import org.apache.directory.shared.asn1.ber.Asn1Decoder;
 import org.apache.directory.shared.asn1.codec.DecoderException;
@@ -43,7 +45,7 @@
     }
 
 
-    public Asn1Object decode( byte[] controlBytes ) throws DecoderException
+    public Asn1Object decode( byte[] controlBytes ) throws DecoderException, NamingException
     {
         ByteBuffer bb = ByteBuffer.wrap( controlBytes );
         EntryChangeControlContainer container = new EntryChangeControlContainer();

Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/EntryChangeControlGrammar.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/EntryChangeControlGrammar.java?rev=414015&r1=414014&r2=414015&view=diff
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/EntryChangeControlGrammar.java (original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/EntryChangeControlGrammar.java Tue Jun 13 18:15:12 2006
@@ -200,12 +200,11 @@
                 else
                 {
                     Value value = entryChangeContainer.getCurrentTLV().getValue();
-                    String previousDn;
+                    LdapDN previousDn = null;
 
                     try
                     {
-                        previousDn = StringTools.utf8ToString( value.getData() );
-                        new LdapDN( previousDn );
+                        previousDn = new LdapDN( StringTools.utf8ToString( value.getData() ) );
                     }
                     catch ( InvalidNameException ine )
                     {

Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/PSearchControlDecoder.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/PSearchControlDecoder.java?rev=414015&r1=414014&r2=414015&view=diff
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/PSearchControlDecoder.java (original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/PSearchControlDecoder.java Tue Jun 13 18:15:12 2006
@@ -19,6 +19,8 @@
 
 import java.nio.ByteBuffer;
 
+import javax.naming.NamingException;
+
 import org.apache.directory.shared.asn1.Asn1Object;
 import org.apache.directory.shared.asn1.ber.Asn1Decoder;
 import org.apache.directory.shared.asn1.codec.DecoderException;
@@ -43,7 +45,7 @@
     }
 
 
-    public Asn1Object decode( byte[] controlBytes ) throws DecoderException
+    public Asn1Object decode( byte[] controlBytes ) throws DecoderException, NamingException
     {
         ByteBuffer bb = ByteBuffer.wrap( controlBytes );
         PSearchControlContainer container = new PSearchControlContainer();

Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/SubEntryControlDecoder.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/SubEntryControlDecoder.java?rev=414015&r1=414014&r2=414015&view=diff
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/SubEntryControlDecoder.java (original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/SubEntryControlDecoder.java Tue Jun 13 18:15:12 2006
@@ -19,6 +19,8 @@
 
 import java.nio.ByteBuffer;
 
+import javax.naming.NamingException;
+
 import org.apache.directory.shared.asn1.Asn1Object;
 import org.apache.directory.shared.asn1.ber.Asn1Decoder;
 import org.apache.directory.shared.asn1.codec.DecoderException;
@@ -43,7 +45,7 @@
     }
 
 
-    public Asn1Object decode( byte[] controlBytes ) throws DecoderException
+    public Asn1Object decode( byte[] controlBytes ) throws DecoderException, NamingException
     {
         ByteBuffer bb = ByteBuffer.wrap( controlBytes );
         SubEntryControlContainer container = new SubEntryControlContainer();

Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/filter/BranchNode.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/filter/BranchNode.java?rev=414015&r1=414014&r2=414015&view=diff
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/filter/BranchNode.java (original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/filter/BranchNode.java Tue Jun 13 18:15:12 2006
@@ -331,34 +331,35 @@
      * @see org.apache.directory.shared.ldap.filter.ExprNode#accept(
      *      org.apache.directory.shared.ldap.filter.FilterVisitor)
      */
-    public void accept( FilterVisitor a_visitor )
+    public void accept( FilterVisitor visitor )
     {
-        if ( a_visitor.isPrefix() )
+        if ( visitor.isPrefix() )
         {
-            ArrayList l_children = a_visitor.getOrder( this, m_children );
+            ArrayList children = visitor.getOrder( this, m_children );
 
-            if ( a_visitor.canVisit( this ) )
+            if ( visitor.canVisit( this ) )
             {
-                a_visitor.visit( this );
+                visitor.visit( this );
             }
 
-            for ( int ii = 0; ii < l_children.size(); ii++ )
+            for ( int ii = 0; ii < children.size(); ii++ )
             {
-                ( ( ExprNode ) l_children.get( ii ) ).accept( a_visitor );
+                ( ( ExprNode ) children.get( ii ) ).accept( visitor );
             }
         }
         else
         {
-            ArrayList l_children = a_visitor.getOrder( this, m_children );
+            ArrayList children = visitor.getOrder( this, m_children );
 
-            for ( int ii = 0; ii < l_children.size(); ii++ )
+            for ( int ii = 0; ii < children.size(); ii++ )
             {
-                ( ( ExprNode ) l_children.get( ii ) ).accept( a_visitor );
+                ExprNode child = ( ExprNode ) children.get( ii );
+                child.accept( visitor );
             }
 
-            if ( a_visitor.canVisit( this ) )
+            if ( visitor.canVisit( this ) )
             {
-                a_visitor.visit( this );
+                visitor.visit( this );
             }
         }
     }

Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/filter/LeafNode.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/filter/LeafNode.java?rev=414015&r1=414014&r2=414015&view=diff
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/filter/LeafNode.java (original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/filter/LeafNode.java Tue Jun 13 18:15:12 2006
@@ -26,22 +26,19 @@
 public abstract class LeafNode extends AbstractExprNode
 {
     /** attribute on which this leaf is based */
-    private final String m_attribute;
+    private String attribute;
 
 
     /**
      * Creates a leaf node.
      * 
-     * @param a_attribute
-     *            the attribute this node is based on
-     * @param a_type
-     *            the type of this leaf node
+     * @param attribute the attribute this node is based on
+     * @param type the type of this leaf node
      */
-    protected LeafNode(String a_attribute, int a_type)
+    protected LeafNode( String attribute, int type )
     {
-        super( a_type );
-
-        m_attribute = a_attribute;
+        super( type );
+        this.attribute = attribute;
     }
 
 
@@ -63,7 +60,18 @@
      */
     public final String getAttribute()
     {
-        return m_attribute;
+        return attribute;
+    }
+    
+    
+    /**
+     * Sets the attribute this leaf node is based on.
+     * 
+     * @param attribute the attribute that is asserted by this filter node
+     */
+    public void setAttribute( String attribute )
+    {
+        this.attribute = attribute;
     }
 
 
@@ -94,6 +102,6 @@
             return false;
         }
 
-        return m_attribute.equals( ( ( LeafNode ) other ).getAttribute() );
+        return attribute.equals( ( ( LeafNode ) other ).getAttribute() );
     }
 }

Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/filter/SimpleNode.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/filter/SimpleNode.java?rev=414015&r1=414014&r2=414015&view=diff
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/filter/SimpleNode.java (original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/filter/SimpleNode.java Tue Jun 13 18:15:12 2006
@@ -42,7 +42,7 @@
      * @param type
      *            the type of the assertion
      */
-    public SimpleNode(String attribute, byte[] value, int type)
+    public SimpleNode( String attribute, byte[] value, int type )
     {
         this( attribute, StringTools.utf8ToString( value ), type );
     }
@@ -58,7 +58,7 @@
      * @param type
      *            the type of the assertion
      */
-    public SimpleNode(String attribute, String value, int type)
+    public SimpleNode( String attribute, String value, int type )
     {
         super( attribute, type );
         this.value = value;

Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/AddRequest.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/AddRequest.java?rev=414015&r1=414014&r2=414015&view=diff
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/AddRequest.java (original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/AddRequest.java Tue Jun 13 18:15:12 2006
@@ -29,6 +29,8 @@
 
 import javax.naming.directory.Attributes;
 
+import org.apache.directory.shared.ldap.name.LdapDN;
+
 
 /**
  * Add protocol operation request used to add a new entry to the DIT.
@@ -51,7 +53,7 @@
      * 
      * @return the Dn of the added entry.
      */
-    String getEntry();
+    LdapDN getEntry();
 
 
     /**
@@ -60,7 +62,7 @@
      * @param entry
      *            the Dn of the added entry.
      */
-    void setEntry( String entry );
+    void setEntry( LdapDN entry );
 
 
     /**

Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/AddRequestImpl.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/AddRequestImpl.java?rev=414015&r1=414014&r2=414015&view=diff
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/AddRequestImpl.java (original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/AddRequestImpl.java Tue Jun 13 18:15:12 2006
@@ -19,6 +19,7 @@
 
 import javax.naming.directory.Attributes;
 
+import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.util.AttributeUtils;
 
 
@@ -33,7 +34,7 @@
     static final long serialVersionUID = 7534132448349520346L;
 
     /** Distinguished name of the new entry. */
-    private String entry;
+    private LdapDN entry;
 
     /** A MultiMap of the new entry's attributes and their values */
     private Attributes attributes;
@@ -66,7 +67,7 @@
      * 
      * @return the Dn of the added entry.
      */
-    public String getEntry()
+    public LdapDN getEntry()
     {
         return entry;
     }
@@ -78,7 +79,7 @@
      * @param entry
      *            the Dn of the added entry.
      */
-    public void setEntry( String entry )
+    public void setEntry( LdapDN entry )
     {
         this.entry = entry;
     }

Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/BindRequest.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/BindRequest.java?rev=414015&r1=414014&r2=414015&view=diff
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/BindRequest.java (original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/BindRequest.java Tue Jun 13 18:15:12 2006
@@ -16,6 +16,8 @@
  */
 package org.apache.directory.shared.ldap.message;
 
+import org.apache.directory.shared.ldap.name.LdapDN;
+
 
 /**
  * Bind protocol operation request which authenticates and begins a client
@@ -89,7 +91,7 @@
      * 
      * @return the DN of the authenticating user.
      */
-    String getName();
+    LdapDN getName();
 
 
     /**
@@ -103,7 +105,7 @@
      *            the DN of the authenticating user - leave null for annonymous
      *            user.
      */
-    void setName( String name );
+    void setName( LdapDN name );
 
 
     /**

Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/BindRequestImpl.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/BindRequestImpl.java?rev=414015&r1=414014&r2=414015&view=diff
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/BindRequestImpl.java (original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/BindRequestImpl.java Tue Jun 13 18:15:12 2006
@@ -17,6 +17,7 @@
 package org.apache.directory.shared.ldap.message;
 
 
+import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.util.ArrayUtils;
 import org.apache.directory.shared.ldap.util.StringTools;
 
@@ -36,7 +37,7 @@
      * Distinguished name identifying the name of the authenticating subject -
      * defaults to the empty string
      */
-    private String name = "";
+    private LdapDN name;
 
     /** The passwords, keys or tickets used to verify user identity */
     private byte[] credentials;
@@ -167,7 +168,7 @@
      * 
      * @return the DN of the authenticating user.
      */
-    public String getName()
+    public LdapDN getName()
     {
         return name;
     }
@@ -184,7 +185,7 @@
      *            the DN of the authenticating user - leave null for annonymous
      *            user.
      */
-    public void setName( String name )
+    public void setName( LdapDN name )
     {
         this.name = name;
     }
@@ -299,11 +300,29 @@
             return false;
         }
 
-        if ( !req.getName().equals( getName() ) )
+        LdapDN dn1 = req.getName();
+        LdapDN dn2 = getName();
+        
+        if ( dn1 == null )
         {
-            return false;
+            if ( dn2 != null )
+            {
+                return false;
+            }
         }
-
+        else
+        {
+            if ( dn2 == null )
+            {
+                return false;
+            }
+            else if ( !dn1.equals( dn2 ) )
+            {
+                return false;
+            }
+                
+        }
+        
         if ( !ArrayUtils.isEquals( req.getCredentials(), getCredentials() ) )
         {
             return false;

Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/CompareRequest.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/CompareRequest.java?rev=414015&r1=414014&r2=414015&view=diff
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/CompareRequest.java (original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/CompareRequest.java Tue Jun 13 18:15:12 2006
@@ -16,6 +16,8 @@
  */
 package org.apache.directory.shared.ldap.message;
 
+import org.apache.directory.shared.ldap.name.LdapDN;
+
 
 /**
  * Compare request protocol message that tests an entry to see if it abides by
@@ -39,7 +41,7 @@
      * 
      * @return the DN of the compared entry.
      */
-    String getName();
+    LdapDN getName();
 
 
     /**
@@ -49,7 +51,7 @@
      * @param a_name
      *            the DN of the compared entry.
      */
-    void setName( String a_name );
+    void setName( LdapDN name );
 
 
     /**

Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/CompareRequestImpl.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/CompareRequestImpl.java?rev=414015&r1=414014&r2=414015&view=diff
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/CompareRequestImpl.java (original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/CompareRequestImpl.java Tue Jun 13 18:15:12 2006
@@ -19,6 +19,7 @@
 
 import java.util.Arrays;
 
+import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.util.StringTools;
 
 
@@ -33,7 +34,7 @@
     static final long serialVersionUID = 1699731530016468977L;
 
     /** Distinguished name identifying the compared entry */
-    private String name;
+    private LdapDN name;
 
     /** The id of the attribute used in the comparison */
     private String attrId;
@@ -71,7 +72,7 @@
      * 
      * @return the DN of the compared entry.
      */
-    public String getName()
+    public LdapDN getName()
     {
         return name;
     }
@@ -84,7 +85,7 @@
      * @param name
      *            the DN of the compared entry.
      */
-    public void setName( String name )
+    public void setName( LdapDN name )
     {
         this.name = name;
     }

Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/DeleteRequest.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/DeleteRequest.java?rev=414015&r1=414014&r2=414015&view=diff
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/DeleteRequest.java (original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/DeleteRequest.java Tue Jun 13 18:15:12 2006
@@ -16,6 +16,8 @@
  */
 package org.apache.directory.shared.ldap.message;
 
+import org.apache.directory.shared.ldap.name.LdapDN;
+
 
 /**
  * Delete request protocol message used to remove an existing leaf entry from
@@ -39,7 +41,7 @@
      * 
      * @return the DN of the leaf entry to delete.
      */
-    String getName();
+    LdapDN getName();
 
 
     /**
@@ -49,5 +51,5 @@
      * @param a_name
      *            the DN of the leaf entry to delete.
      */
-    void setName( String a_name );
+    void setName( LdapDN name );
 }

Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/DeleteRequestImpl.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/DeleteRequestImpl.java?rev=414015&r1=414014&r2=414015&view=diff
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/DeleteRequestImpl.java (original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/DeleteRequestImpl.java Tue Jun 13 18:15:12 2006
@@ -16,6 +16,8 @@
  */
 package org.apache.directory.shared.ldap.message;
 
+import org.apache.directory.shared.ldap.name.LdapDN;
+
 
 /**
  * Delete request implementation.
@@ -28,7 +30,7 @@
     static final long serialVersionUID = 3187847454305567542L;
 
     /** The distinguished name of the entry to delete */
-    private String name;
+    private LdapDN name;
 
     private DeleteResponse response;
 
@@ -60,7 +62,7 @@
      * 
      * @return the DN of the leaf entry to delete.
      */
-    public String getName()
+    public LdapDN getName()
     {
         return name;
     }
@@ -73,7 +75,7 @@
      * @param name
      *            the DN of the leaf entry to delete.
      */
-    public void setName( String name )
+    public void setName( LdapDN name )
     {
         this.name = name;
     }

Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/EntryChangeControl.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/EntryChangeControl.java?rev=414015&r1=414014&r2=414015&view=diff
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/EntryChangeControl.java (original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/EntryChangeControl.java Tue Jun 13 18:15:12 2006
@@ -18,10 +18,8 @@
 
 
 import org.apache.directory.shared.asn1.codec.EncoderException;
-import org.apache.directory.shared.asn1.util.Asn1StringUtils;
 import org.apache.directory.shared.ldap.codec.search.controls.ChangeType;
-import org.apache.directory.shared.ldap.codec.util.LdapString;
-import org.apache.directory.shared.ldap.codec.util.LdapStringEncodingException;
+import org.apache.directory.shared.ldap.name.LdapDN;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -87,7 +85,7 @@
 
     private int changeNumber = UNDEFINED_CHANGE_NUMBER;
 
-    private LdapString previousDn = null;
+    private LdapDN previousDn = null;
 
 
     public EntryChangeControl()
@@ -109,26 +107,13 @@
     }
 
 
-    public String getPreviousDn()
+    public LdapDN getPreviousDn()
     {
-        return previousDn.getString();
+        return previousDn;
     }
 
 
-    public void setPreviousDn( String previousDn )
-    {
-        try
-        {
-            this.previousDn = new LdapString( Asn1StringUtils.getBytesUtf8( previousDn ) );
-        }
-        catch ( LdapStringEncodingException e )
-        {
-            e.printStackTrace();
-        }
-    }
-
-
-    public void setPreviousDn( LdapString previousDn )
+    public void setPreviousDn( LdapDN previousDn )
     {
         this.previousDn = previousDn;
     }

Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/LdapResult.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/LdapResult.java?rev=414015&r1=414014&r2=414015&view=diff
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/LdapResult.java (original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/LdapResult.java Tue Jun 13 18:15:12 2006
@@ -26,6 +26,8 @@
 
 package org.apache.directory.shared.ldap.message;
 
+import org.apache.directory.shared.ldap.name.LdapDN;
+
 
 /**
  * LDAPv3 result structure embedded into Responses. See section 4.1.10 in <a
@@ -79,7 +81,7 @@
      * 
      * @return the Dn of the lowest matched entry.
      */
-    String getMatchedDn();
+    LdapDN getMatchedDn();
 
 
     /**
@@ -89,7 +91,7 @@
      * @param dn
      *            the Dn of the lowest matched entry.
      */
-    void setMatchedDn( String dn );
+    void setMatchedDn( LdapDN dn );
 
 
     /**

Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/LdapResultImpl.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/LdapResultImpl.java?rev=414015&r1=414014&r2=414015&view=diff
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/LdapResultImpl.java (original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/LdapResultImpl.java Tue Jun 13 18:15:12 2006
@@ -26,6 +26,8 @@
 
 package org.apache.directory.shared.ldap.message;
 
+import org.apache.directory.shared.ldap.name.LdapDN;
+
 
 /**
  * LdapResult implementation.
@@ -38,7 +40,7 @@
     static final long serialVersionUID = -1446626887394613213L;
 
     /** Lowest matched entry Dn - defaults to empty string */
-    private String matchedDn;
+    private LdapDN matchedDn;
 
     /** Referral associated with this LdapResult if the errorCode is REFERRAL */
     private Referral referral;
@@ -92,7 +94,7 @@
      * 
      * @return the Dn of the lowest matched entry.
      */
-    public String getMatchedDn()
+    public LdapDN getMatchedDn()
     {
         return matchedDn;
     }
@@ -105,7 +107,7 @@
      * @param matchedDn
      *            the Dn of the lowest matched entry.
      */
-    public void setMatchedDn( String matchedDn )
+    public void setMatchedDn( LdapDN matchedDn )
     {
         this.matchedDn = matchedDn;
     }

Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/ModifyDnRequest.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/ModifyDnRequest.java?rev=414015&r1=414014&r2=414015&view=diff
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/ModifyDnRequest.java (original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/ModifyDnRequest.java Tue Jun 13 18:15:12 2006
@@ -16,6 +16,9 @@
  */
 package org.apache.directory.shared.ldap.message;
 
+import org.apache.directory.shared.ldap.name.LdapDN;
+import org.apache.directory.shared.ldap.name.Rdn;
+
 
 /**
  * Modify DN request protocol message used to rename or move an existing entry
@@ -74,7 +77,7 @@
      * 
      * @return the distinguished name of the entry.
      */
-    String getName();
+    LdapDN getName();
 
 
     /**
@@ -84,7 +87,7 @@
      * @param name
      *            the distinguished name of the entry.
      */
-    void setName( String name );
+    void setName( LdapDN name );
 
 
     /**
@@ -93,7 +96,7 @@
      * 
      * @return the relative dn with one component
      */
-    String getNewRdn();
+    Rdn getNewRdn();
 
 
     /**
@@ -103,7 +106,7 @@
      * @param newRdn
      *            the relative dn with one component
      */
-    void setNewRdn( String newRdn );
+    void setNewRdn( Rdn newRdn );
 
 
     /**
@@ -139,7 +142,7 @@
      * 
      * @return the dn of the superior entry the candidate entry is moved under.
      */
-    String getNewSuperior();
+    LdapDN getNewSuperior();
 
 
     /**
@@ -153,7 +156,7 @@
      *            the dn of the superior entry the candidate entry for DN
      *            modification is moved under.
      */
-    void setNewSuperior( String newSuperior );
+    void setNewSuperior( LdapDN newSuperior );
 
 
     /**

Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/ModifyDnRequestImpl.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/ModifyDnRequestImpl.java?rev=414015&r1=414014&r2=414015&view=diff
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/ModifyDnRequestImpl.java (original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/ModifyDnRequestImpl.java Tue Jun 13 18:15:12 2006
@@ -16,6 +16,9 @@
  */
 package org.apache.directory.shared.ldap.message;
 
+import org.apache.directory.shared.ldap.name.LdapDN;
+import org.apache.directory.shared.ldap.name.Rdn;
+
 
 /**
  * Lockable ModifyDNRequest implementation.
@@ -28,13 +31,13 @@
     static final long serialVersionUID = 1233507339633051696L;
 
     /** PDU's modify Dn candidate <b>entry</b> distinguished name property */
-    private String name;
+    private LdapDN name;
 
     /** PDU's <b>newrdn</b> relative distinguished name property */
-    private String newRdn;
+    private Rdn newRdn;
 
     /** PDU's <b>newSuperior</b> distinguished name property */
-    private String newSuperior;
+    private LdapDN newSuperior;
 
     /** PDU's <b>deleteOldRdn</b> flag */
     private boolean deleteOldRdn = false;
@@ -114,7 +117,7 @@
      * 
      * @return the distinguished name of the entry.
      */
-    public String getName()
+    public LdapDN getName()
     {
         return name;
     }
@@ -127,7 +130,7 @@
      * @param name
      *            the distinguished name of the entry.
      */
-    public void setName( String name )
+    public void setName( LdapDN name )
     {
         this.name = name;
     }
@@ -139,7 +142,7 @@
      * 
      * @return the relative dn with one component
      */
-    public String getNewRdn()
+    public Rdn getNewRdn()
     {
         return newRdn;
     }
@@ -152,7 +155,7 @@
      * @param newRdn
      *            the relative dn with one component
      */
-    public void setNewRdn( String newRdn )
+    public void setNewRdn( Rdn newRdn )
     {
         this.newRdn = newRdn;
     }
@@ -166,7 +169,7 @@
      * 
      * @return the dn of the superior entry the candidate entry is moved under.
      */
-    public String getNewSuperior()
+    public LdapDN getNewSuperior()
     {
         return newSuperior;
     }
@@ -183,7 +186,7 @@
      *            the dn of the superior entry the candidate entry for DN
      *            modification is moved under.
      */
-    public void setNewSuperior( String newSuperior )
+    public void setNewSuperior( LdapDN newSuperior )
     {
         this.newSuperior = newSuperior;
     }

Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/ModifyRequest.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/ModifyRequest.java?rev=414015&r1=414014&r2=414015&view=diff
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/ModifyRequest.java (original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/ModifyRequest.java Tue Jun 13 18:15:12 2006
@@ -21,6 +21,8 @@
 
 import javax.naming.directory.ModificationItem;
 
+import org.apache.directory.shared.ldap.name.LdapDN;
+
 
 /**
  * Modify request protocol message used to alter the attributes and values of an
@@ -106,7 +108,7 @@
      * 
      * @return the DN of the modified entry.
      */
-    String getName();
+    LdapDN getName();
 
 
     /**
@@ -116,7 +118,7 @@
      * @param name
      *            the DN of the modified entry.
      */
-    void setName( String name );
+    void setName( LdapDN name );
 
 
     /**

Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/ModifyRequestImpl.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/ModifyRequestImpl.java?rev=414015&r1=414014&r2=414015&view=diff
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/ModifyRequestImpl.java (original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/ModifyRequestImpl.java Tue Jun 13 18:15:12 2006
@@ -30,6 +30,7 @@
 import javax.naming.directory.DirContext;
 import javax.naming.directory.ModificationItem;
 
+import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.util.StringTools;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -49,7 +50,7 @@
     private static final transient Logger log = LoggerFactory.getLogger( ModifyRequestImpl.class );
 
     /** Dn of the entry to modify or PDU's <b>object</b> field */
-    private String name;
+    private LdapDN name;
 
     /** Sequence of modifications or PDU's <b>modification</b> seqence field */
     private ArrayList mods = new ArrayList();
@@ -97,7 +98,7 @@
      * 
      * @return the DN of the modified entry.
      */
-    public String getName()
+    public LdapDN getName()
     {
         return name;
     }
@@ -110,7 +111,7 @@
      * @param name
      *            the DN of the modified entry.
      */
-    public void setName( String name )
+    public void setName( LdapDN name )
     {
         this.name = name;
     }

Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/SearchRequest.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/SearchRequest.java?rev=414015&r1=414014&r2=414015&view=diff
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/SearchRequest.java (original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/SearchRequest.java Tue Jun 13 18:15:12 2006
@@ -20,6 +20,7 @@
 import java.util.Collection;
 
 import org.apache.directory.shared.ldap.filter.ExprNode;
+import org.apache.directory.shared.ldap.name.LdapDN;
 
 
 /**
@@ -60,7 +61,7 @@
      * 
      * @return the search base
      */
-    String getBase();
+    LdapDN getBase();
 
 
     /**
@@ -69,7 +70,7 @@
      * @param a_baseDn
      *            the search base
      */
-    void setBase( String a_baseDn );
+    void setBase( LdapDN baseDn );
 
 
     /**

Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/SearchRequestImpl.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/SearchRequestImpl.java?rev=414015&r1=414014&r2=414015&view=diff
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/SearchRequestImpl.java (original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/SearchRequestImpl.java Tue Jun 13 18:15:12 2006
@@ -25,6 +25,7 @@
 import org.apache.directory.shared.ldap.codec.LdapConstants;
 import org.apache.directory.shared.ldap.filter.BranchNormalizedVisitor;
 import org.apache.directory.shared.ldap.filter.ExprNode;
+import org.apache.directory.shared.ldap.name.LdapDN;
 
 
 /**
@@ -38,7 +39,7 @@
     static final long serialVersionUID = -5655881944020886218L;
 
     /** Search base distinguished name */
-    private String baseDn;
+    private LdapDN baseDn;
 
     /** Search filter expression tree's root node */
     private ExprNode filter;
@@ -119,7 +120,7 @@
      * 
      * @return the search base
      */
-    public String getBase()
+    public LdapDN getBase()
     {
         return baseDn;
     }
@@ -131,7 +132,7 @@
      * @param base
      *            the search base
      */
-    public void setBase( String base )
+    public void setBase( LdapDN base )
     {
         baseDn = base;
     }

Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/SearchResponseEntry.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/SearchResponseEntry.java?rev=414015&r1=414014&r2=414015&view=diff
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/SearchResponseEntry.java (original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/SearchResponseEntry.java Tue Jun 13 18:15:12 2006
@@ -29,6 +29,8 @@
 
 import javax.naming.directory.Attributes;
 
+import org.apache.directory.shared.ldap.name.LdapDN;
+
 
 /**
  * Search entry protocol response message used to return non referral entries to
@@ -49,7 +51,7 @@
      * 
      * @return the Dn of the entry returned.
      */
-    String getObjectName();
+    LdapDN getObjectName();
 
 
     /**
@@ -58,7 +60,7 @@
      * @param a_dn
      *            the Dn of the entry returned.
      */
-    void setObjectName( String a_dn );
+    void setObjectName( LdapDN dn );
 
 
     /**

Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/SearchResponseEntryImpl.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/SearchResponseEntryImpl.java?rev=414015&r1=414014&r2=414015&view=diff
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/SearchResponseEntryImpl.java (original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/SearchResponseEntryImpl.java Tue Jun 13 18:15:12 2006
@@ -19,6 +19,7 @@
 
 import javax.naming.directory.Attributes;
 
+import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.util.AttributeUtils;
 
 
@@ -33,7 +34,7 @@
     static final long serialVersionUID = -8357316233060886637L;
 
     /** Distinguished name of the search result entry returned */
-    private String objectName = "";
+    private LdapDN objectName;
 
     /** Partial set of attributes returned in response to search */
     private Attributes attributes;
@@ -88,7 +89,7 @@
      * 
      * @return the Dn of the entry returned.
      */
-    public String getObjectName()
+    public LdapDN getObjectName()
     {
         return objectName;
     }
@@ -100,7 +101,7 @@
      * @param dn
      *            the Dn of the entry returned.
      */
-    public void setObjectName( String objectName )
+    public void setObjectName( LdapDN objectName )
     {
         this.objectName = objectName;
     }

Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/extended/GracefulDisconnect.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/extended/GracefulDisconnect.java?rev=414015&r1=414014&r2=414015&view=diff
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/extended/GracefulDisconnect.java (original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/extended/GracefulDisconnect.java Tue Jun 13 18:15:12 2006
@@ -21,6 +21,8 @@
 import java.util.Iterator;
 import java.util.List;
 
+import javax.naming.NamingException;
+
 import org.apache.directory.shared.asn1.ber.Asn1Decoder;
 import org.apache.directory.shared.asn1.codec.DecoderException;
 import org.apache.directory.shared.asn1.codec.EncoderException;
@@ -65,7 +67,7 @@
     private Referral replicatedContexts = new ReferralImpl();
 
 
-    public GracefulDisconnect(byte[] value)
+    public GracefulDisconnect(byte[] value) throws NamingException
     {
         super( 0 );
         this.value = value;
@@ -85,14 +87,14 @@
         buf.append( " minutes in " ).append( delay ).append( " seconds." );
 
         super.getLdapResult().setErrorMessage( buf.toString() );
-        super.getLdapResult().setMatchedDn( "" );
+        super.getLdapResult().setMatchedDn( null );
         super.getLdapResult().setResultCode( ResultCodeEnum.UNAVAILABLE );
 
         encodeResponse();
     }
 
 
-    private void decodeValue()
+    private void decodeValue() throws NamingException
     {
         GracefulDisconnectDecoder decoder = new GracefulDisconnectDecoder();
         org.apache.directory.shared.ldap.codec.extended.operations.GracefulDisconnect codec = null;
@@ -189,6 +191,11 @@
         {
             log.error( "Failed while decoding response", e );
         }
+        catch ( NamingException e )
+        {
+            log.error( "Failed while decoding response", e );
+        }
+
         org.apache.directory.shared.ldap.codec.extended.operations.GracefulDisconnect codec = container
             .getGracefulDisconnect();
         this.delay = codec.getDelay();

Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/extended/GracefulShutdownRequest.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/extended/GracefulShutdownRequest.java?rev=414015&r1=414014&r2=414015&view=diff
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/extended/GracefulShutdownRequest.java (original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/extended/GracefulShutdownRequest.java Tue Jun 13 18:15:12 2006
@@ -101,6 +101,11 @@
             log.error( "failed to decode payload", e );
             throw new RuntimeException( e );
         }
+        catch ( NamingException e )
+        {
+            log.error( "failed to decode payload", e );
+            throw new RuntimeException( e );
+        }
     }
 
 

Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/extended/GracefulShutdownResponse.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/extended/GracefulShutdownResponse.java?rev=414015&r1=414014&r2=414015&view=diff
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/extended/GracefulShutdownResponse.java (original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/extended/GracefulShutdownResponse.java Tue Jun 13 18:15:12 2006
@@ -54,7 +54,7 @@
                 throw new IllegalArgumentException( "The result code can only be one of: " + ResultCodeEnum.SUCCESS
                     + ", " + ResultCodeEnum.OPERATIONSERROR + ", " + ResultCodeEnum.INSUFFICIENTACCESSRIGHTS );
         }
-        super.getLdapResult().setMatchedDn( "" );
+        super.getLdapResult().setMatchedDn( null );
         super.getLdapResult().setResultCode( rcode );
     }
 
@@ -62,7 +62,7 @@
     public GracefulShutdownResponse(int messageId)
     {
         super( messageId );
-        super.getLdapResult().setMatchedDn( "" );
+        super.getLdapResult().setMatchedDn( null );
         super.getLdapResult().setResultCode( ResultCodeEnum.SUCCESS );
     }
 

Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/extended/LaunchDiagnosticUiResponse.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/extended/LaunchDiagnosticUiResponse.java?rev=414015&r1=414014&r2=414015&view=diff
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/extended/LaunchDiagnosticUiResponse.java (original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/extended/LaunchDiagnosticUiResponse.java Tue Jun 13 18:15:12 2006
@@ -53,7 +53,7 @@
                 throw new IllegalArgumentException( "The result code can only be one of: " + ResultCodeEnum.SUCCESS
                     + ", " + ResultCodeEnum.OPERATIONSERROR + ", " + ResultCodeEnum.INSUFFICIENTACCESSRIGHTS );
         }
-        super.getLdapResult().setMatchedDn( "" );
+        super.getLdapResult().setMatchedDn( null );
         super.getLdapResult().setResultCode( rcode );
     }
 
@@ -61,7 +61,7 @@
     public LaunchDiagnosticUiResponse(int messageId)
     {
         super( messageId );
-        super.getLdapResult().setMatchedDn( "" );
+        super.getLdapResult().setMatchedDn( null);
         super.getLdapResult().setResultCode( ResultCodeEnum.SUCCESS );
     }
 

Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/extended/NoticeOfDisconnect.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/extended/NoticeOfDisconnect.java?rev=414015&r1=414014&r2=414015&view=diff
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/extended/NoticeOfDisconnect.java (original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/extended/NoticeOfDisconnect.java Tue Jun 13 18:15:12 2006
@@ -130,7 +130,7 @@
                     + ", " + ResultCodeEnum.PROTOCOLERROR + ", " + ResultCodeEnum.STRONGAUTHREQUIRED );
         }
         super.getLdapResult().setErrorMessage( "The server will disconnect!" );
-        super.getLdapResult().setMatchedDn( "" );
+        super.getLdapResult().setMatchedDn( null );
         super.getLdapResult().setResultCode( rcode );
     }
 

Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/name/AttributeTypeAndValue.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/name/AttributeTypeAndValue.java?rev=414015&r1=414014&r2=414015&view=diff
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/name/AttributeTypeAndValue.java (original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/name/AttributeTypeAndValue.java Tue Jun 13 18:15:12 2006
@@ -343,6 +343,20 @@
         return StringTools.lowerCase( StringTools.trim( type ) ) + '=' + StringTools.trim( value );
     }
 
+    /**
+     * Gets the hashcode of this object.
+     * 
+     * @see java.lang.Object#hashCode()
+     */
+    public int hashCode()
+    {
+        int result = 17;
+        
+        result = result * 37 + ( type != null ? type.hashCode() : 0 ); 
+        result = result * 37 + ( value != null ? type.hashCode() : 0 ); 
+            
+        return result;
+    }
 
     /**
      * A String representation of a AttributeTypeAndValue.

Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/name/LdapDN.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/name/LdapDN.java?rev=414015&r1=414014&r2=414015&view=diff
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/name/LdapDN.java (original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/name/LdapDN.java Tue Jun 13 18:15:12 2006
@@ -30,8 +30,6 @@
 import javax.naming.Name;
 import javax.naming.NamingException;
 
-import org.apache.directory.shared.ldap.codec.util.LdapString;
-import org.apache.directory.shared.ldap.codec.util.LdapStringEncodingException;
 import org.apache.directory.shared.ldap.name.Rdn;
 import org.apache.directory.shared.ldap.schema.OidNormalizer;
 import org.apache.directory.shared.ldap.util.StringTools;
@@ -40,11 +38,18 @@
 
 
 /**
- * The LdapDN class contains a DN (Distinguished Name). Its specification can be
- * found in RFC 2253, "UTF-8 String Representation of Distinguished Names". We
- * will store two representation of a DN : - a user Provider represeentation,
- * which is the parsed String given by a user - an internal representation. A DN
- * is formed of RDNs, in a specific order : RDN[n], RDN[n-1], ... RDN[1], RDN[0]
+ * The LdapDN class contains a DN (Distinguished Name).
+ * 
+ * Its specification can be found in RFC 2253, 
+ * "UTF-8 String Representation of Distinguished Names". 
+ * 
+ * We will store two representation of a DN : 
+ * - a user Provider represeentation, which is the parsed String given by a user 
+ * - an internal representation. 
+ * 
+ * A DN is formed of RDNs, in a specific order : 
+ *  RDN[n], RDN[n-1], ... RDN[1], RDN[0]
+ *  
  * It represents a tree, in which the root is the last RDN (RDN[0]) and the leaf
  * is the first RDN (RDN[n]).
  * 
@@ -86,6 +91,9 @@
 
     /** A null LdapDN */
     public static final LdapDN EMPTY_LDAPDN = new LdapDN();
+    
+    /** The OIDs map container */
+    private static Map OIDS_MAP;
 
 
     // ~ Methods
@@ -103,16 +111,31 @@
 
 
     /**
+     * Transduces, or copies a Name to an LdapDN.
+     *
+     * @param name composed of String name components.
+     */
+    public LdapDN( Name name ) throws InvalidNameException
+    {
+        if ( ( name != null ) && ( name.size() != 0 ) )
+        {
+            for ( int ii = 0; ii < name.size(); ii++ )
+            {
+                String nameComponent = ( String ) name.get( ii );
+                add( nameComponent );
+            }
+        }
+    }
+
+
+    /**
      * Creates an ldap name using a list of NameComponents. Each NameComponent
      * is a String
      * 
-     * @param a_list
-     *            of String name components.
+     * @param list of String name components.
      */
-    LdapDN(List list) throws InvalidNameException
+    LdapDN( List list ) throws InvalidNameException
     {
-        super();
-
         if ( ( list != null ) && ( list.size() != 0 ) )
         {
             Iterator nameComponents = list.iterator();
@@ -132,10 +155,8 @@
      * @param nameComponents
      *            List of String name components.
      */
-    LdapDN(Iterator nameComponents) throws InvalidNameException
+    LdapDN( Iterator nameComponents ) throws InvalidNameException
     {
-        super();
-
         if ( nameComponents != null )
         {
             while ( nameComponents.hasNext() )
@@ -162,7 +183,7 @@
      *                InvalidNameException is thrown if the buffer does not
      *                contains a valid DN.
      */
-    public LdapDN(String upName) throws InvalidNameException
+    public LdapDN( String upName ) throws InvalidNameException
     {
         if ( StringTools.isNotEmpty( upName ) )
         {
@@ -171,7 +192,8 @@
 
         // Stores the representations of a DN : internal (as a string and as a
         // byte[]) and external.
-        normalize( upName );
+        normalizeInternal();
+        this.upName = upName;
     }
 
 
@@ -212,10 +234,9 @@
      * 
      * @return a normalized form of the DN
      */
-    private void normalize( String upName )
+    private void normalizeInternal()
     {
         normName = toNormName();
-        this.upName = upName == null ? "" : upName;
     }
 
 
@@ -279,7 +300,7 @@
     {
         if ( ( rdns == null ) || ( rdns.size() == 0 ) )
         {
-            return "";
+            upName = "";
         }
         else
         {
@@ -300,17 +321,26 @@
                 sb.append( ( ( Rdn ) rdns.get( i ) ).getUpName() );
             }
 
-            return sb.toString();
+            upName = sb.toString();
         }
+
+        return upName;
     }
 
 
     /**
      * Return the User Provided prefix representation of the DN starting at the
-     * posn position. If posn = 0, return an empty string. for DN : sn=smith,
-     * dc=apache, dc=org getUpname(0) -> "" getUpName(1) -> "dc=org"
-     * getUpname(3) -> "sn=smith, dc=apache, dc=org" getUpName(4) ->
-     * ArrayOutOfBoundException Warning ! The returned String is not exactly the
+     * posn position. 
+     * 
+     * If posn = 0, return an empty string. 
+     * 
+     * for DN : sn=smith, dc=apache, dc=org 
+     * getUpname(0) -> "" 
+     * getUpName(1) -> "dc=org"
+     * getUpname(3) -> "sn=smith, dc=apache, dc=org" 
+     * getUpName(4) -> ArrayOutOfBoundException 
+     * 
+     * Warning ! The returned String is not exactly the
      * user provided DN, as spaces before and after each RDNs have been trimmed.
      * 
      * @param posn
@@ -355,14 +385,19 @@
 
     /**
      * Return the User Provided suffix representation of the DN starting at the
-     * posn position. If posn = 0, return an empty string. for DN : sn=smith,
-     * dc=apache, dc=org getUpname(0) -> "sn=smith, dc=apache, dc=org"
-     * getUpName(1) -> "sn=smith, dc=apache" getUpname(3) -> "sn=smith"
-     * getUpName(4) -> "" Warning ! The returned String is not exactly the user
+     * posn position. 
+     * If posn = 0, return an empty string. 
+     * 
+     * for DN : sn=smith, dc=apache, dc=org 
+     * getUpname(0) -> "sn=smith, dc=apache, dc=org"
+     * getUpName(1) -> "sn=smith, dc=apache" 
+     * getUpname(3) -> "sn=smith"
+     * getUpName(4) -> "" 
+     * 
+     * Warning ! The returned String is not exactly the user
      * provided DN, as spaces before and after each RDNs have been trimmed.
      * 
-     * @param posn
-     *            The starting position
+     * @param posn The starting position
      * @return The truncated DN
      */
     private String getUpNameSuffix( int posn )
@@ -395,13 +430,23 @@
 
 
     /**
-     * Gets the hashcode of the string representation of this name.
+     * Gets the hashcode of this name.
      * 
      * @see java.lang.Object#hashCode()
      */
     public int hashCode()
     {
-        return upName.hashCode();
+    	int result = 17;
+    	
+    	if ( ( rdns != null ) || ( rdns.size() == 0 ) )
+    	{
+    		for ( Iterator rdnsIter = rdns.iterator(); rdnsIter.hasNext(); ) 
+    		{
+    			result = result * 37 + rdnsIter.next().hashCode(); 
+    		}
+    	}
+    	
+        return result;
     }
 
 
@@ -410,7 +455,7 @@
      * 
      * @return The DN as a String
      */
-    public String getName()
+    public String getUpName()
     {
         return ( upName == null ? "" : upName );
     }
@@ -421,9 +466,10 @@
      * 
      * @return The DN as a String
      */
-    /*
-     * public String getNormName() { return ( normName == null ? "" : normName ); }
-     */
+     public String getNormName() 
+     { 
+         return ( normName == null ? "" : normName ); 
+     }
 
     /**
      * Get the number of NameComponent conatained in this LdapDN
@@ -453,17 +499,20 @@
      * 
      * @return A byte[] representation of the DN
      */
-    public static byte[] getBytes( Name dn )
+    public static byte[] getBytes( LdapDN dn )
     {
-        return ( ( LdapDN ) dn ).bytes;
+        return dn == null ? null : dn.bytes;
     }
 
 
     /**
      * Determines whether this name starts with a specified prefix. A name
      * <tt>name</tt> is a prefix if it is equal to
-     * <tt>getPrefix(name.size())</tt>. Be aware that for a specific DN like :
-     * cn=xxx, ou=yyy the startsWith method will retourn true with ou=yyy, and
+     * <tt>getPrefix(name.size())</tt>. 
+     * 
+     * Be aware that for a specific DN like :
+     * cn=xxx, ou=yyy 
+     * the startsWith method will return true with ou=yyy, and
      * false with cn=xxx
      * 
      * @param name
@@ -503,6 +552,44 @@
 
             return true;
         }
+        else if ( name instanceof Name )
+        {
+            if ( name.size() == 0 )
+            {
+                return true;
+            }
+
+            if ( name.size() > size() )
+            {
+                // The name is longer than the current LdapDN.
+                return false;
+            }
+
+            // Ok, iterate through all the RDN of the name,
+            // starting a the end of the current list.
+
+            for ( int i = name.size() - 1; i >= 0; i-- )
+            {
+                Rdn ldapRdn = ( Rdn ) rdns.get( rdns.size() - i - 1 );
+                Rdn nameRdn = null;
+                try
+                {
+                    nameRdn = new Rdn( ( String ) name.get( name.size() - i - 1 ) );
+                }
+                catch ( InvalidNameException e )
+                {
+                    e.printStackTrace();
+                    log.error( "Failed to parse RDN for name " + name.toString(), e );
+                }
+                
+                if ( nameRdn.compareTo( ldapRdn ) != 0 )
+                {
+                    return false;
+                }
+            }
+
+            return true;
+        }
         else
         {
             // We don't accept a Name which is not a LdapName
@@ -514,8 +601,10 @@
     /**
      * Determines whether this name ends with a specified suffix. A name
      * <tt>name</tt> is a suffix if it is equal to
-     * <tt>getSuffix(size()-name.size())</tt>. Be aware that for a specific
-     * DN like : cn=xxx, ou=yyy the endsWith method will retourn true with
+     * <tt>getSuffix(size()-name.size())</tt>. 
+     * 
+     * Be aware that for a specific
+     * DN like : cn=xxx, ou=yyy the endsWith method will return true with
      * cn=xxx, and false with ou=yyy
      * 
      * @param name
@@ -622,6 +711,25 @@
         }
     }
 
+    /**
+     * Retrieves the last component of this name.
+     * 
+     * @return the last component of this DN 
+     */
+    public Rdn getRdn()
+    {
+        if ( rdns.size() == 0 )
+        {
+            return null;
+        }
+        else
+        {
+            Rdn rdn = ( Rdn ) rdns.get( 0 );
+
+            return rdn;
+        }
+    }
+
 
     /**
      * Retrieves all the components of this name.
@@ -824,6 +932,8 @@
     public Name addAll( Name suffix ) throws InvalidNameException
     {
         addAll( rdns.size(), suffix );
+        normalizeInternal();
+        toUpName();
 
         return this;
     }
@@ -860,7 +970,8 @@
             rdns.addAll( size() - posn, ( ( LdapDN ) name ).rdns );
 
             // Regenerate the normalized name and the original string
-            normalize( toUpName() );
+            normalizeInternal();
+            toUpName();
 
             return this;
         }
@@ -888,11 +999,30 @@
         Rdn newRdn = new Rdn( comp );
 
         rdns.add( 0, newRdn );
-        normalize( toUpName() );
+        normalizeInternal();
+        toUpName();
 
         return this;
     }
 
+    /**
+     * Adds a single component to the end of this name.
+     * 
+     * @param comp
+     *            the component to add
+     * @return the updated name (not a new one)
+     * @throws InvalidNameException
+     *             if adding <tt>comp</tt> would violate the syntax rules of
+     *             this name
+     */
+    public Name add( Rdn newRdn ) throws InvalidNameException
+    {
+        rdns.add( rdns.size() - 1, newRdn );
+        normalizeInternal();
+        toUpName();
+
+        return this;
+    }
 
     /**
      * Adds a single component at a specified position within this name.
@@ -926,7 +1056,8 @@
         int realPos = size() - posn;
         rdns.add( realPos, newRdn );
 
-        normalize( toUpName() );
+        normalizeInternal();
+        toUpName();
 
         return this;
     }
@@ -964,7 +1095,8 @@
         int realPos = size() - posn - 1;
         Rdn rdn = ( Rdn ) rdns.remove( realPos );
 
-        normalize( toUpName() );
+        normalizeInternal();
+        toUpName();
 
         return rdn;
     }
@@ -1088,7 +1220,7 @@
     }
 
 
-    private static AttributeTypeAndValue atavOidToName( AttributeTypeAndValue atav, Map oids )
+    private static AttributeTypeAndValue atavOidToName( AttributeTypeAndValue atav )
         throws InvalidNameException, NamingException
     {
         String type = StringTools.trim( atav.getType() );
@@ -1100,18 +1232,25 @@
 
         if ( StringTools.isNotEmpty( StringTools.lowerCase( type ) ) )
         {
-            OidNormalizer oidNormalizer = ( OidNormalizer ) oids.get( type );
-
-            if ( oidNormalizer != null )
+            if ( OIDS_MAP == null )
             {
-                return new AttributeTypeAndValue( oidNormalizer.getName(), ( String ) oidNormalizer.getNormalizer()
-                    .normalize( atav.getValue() ) );
-
+                return atav;
             }
             else
             {
-                // We don't have a normalizer for this OID : just do nothing.
-                return atav;
+                OidNormalizer oidNormalizer = ( OidNormalizer ) OIDS_MAP.get( type );
+    
+                if ( oidNormalizer != null )
+                {
+                    return new AttributeTypeAndValue( oidNormalizer.getAttributeTypeOid(), ( String ) oidNormalizer.getNormalizer()
+                        .normalize( atav.getValue() ) );
+    
+                }
+                else
+                {
+                    // We don't have a normalizer for this OID : just do nothing.
+                    return atav;
+                }
             }
         }
         else
@@ -1136,7 +1275,7 @@
      *             If
      * @throws NamingException
      */
-    private static void rdnOidToName( Rdn rdn, Map oids ) throws InvalidNameException, NamingException
+    private static void rdnOidToName( Rdn rdn ) throws InvalidNameException, NamingException
     {
         if ( rdn.getNbAtavs() > 1 )
         {
@@ -1150,7 +1289,7 @@
             while ( atavs.hasNext() )
             {
                 Object val = atavs.next();
-                AttributeTypeAndValue newAtav = atavOidToName( ( AttributeTypeAndValue ) val, oids );
+                AttributeTypeAndValue newAtav = atavOidToName( ( AttributeTypeAndValue ) val );
                 rdn.addAttributeTypeAndValue( newAtav.getType(), newAtav.getValue() );
             }
 
@@ -1166,22 +1305,29 @@
 
             if ( StringTools.isNotEmpty( StringTools.lowerCase( type ) ) )
             {
-                OidNormalizer oidNormalizer = ( OidNormalizer ) oids.get( type );
-
-                if ( oidNormalizer != null )
+                if ( OIDS_MAP == null )
                 {
-                    Rdn rdnCopy = ( Rdn ) rdn.clone();
-                    rdn.clear();
-
-                    rdn.addAttributeTypeAndValue( oidNormalizer.getName(), ( String ) oidNormalizer.getNormalizer()
-                        .normalize( rdnCopy.getValue() ) );
-
+                    return;
                 }
                 else
                 {
-                    // We don't have a normalizer for this OID : just do
-                    // nothing.
-                    return;
+                    OidNormalizer oidNormalizer = ( OidNormalizer ) OIDS_MAP.get( type );
+    
+                    if ( oidNormalizer != null )
+                    {
+                        Rdn rdnCopy = ( Rdn ) rdn.clone();
+                        rdn.clear();
+                        
+                        rdn.addAttributeTypeAndValue( oidNormalizer.getAttributeTypeOid(), ( String ) oidNormalizer.getNormalizer()
+                            .normalize( rdnCopy.getValue() ) );
+    
+                    }
+                    else
+                    {
+                        // We don't have a normalizer for this OID : just do
+                        // nothing.
+                        return;
+                    }
                 }
             }
             else
@@ -1212,9 +1358,9 @@
      * @throws InvalidNameException
      *             If the DN is invalid
      */
-    public static Name normalize( Name dn, Map oids ) throws InvalidNameException, NamingException
+    public static LdapDN normalize( LdapDN dn ) throws InvalidNameException, NamingException
     {
-        if ( ( dn == null ) || ( dn.size() == 0 ) || ( oids == null ) || ( oids.size() == 0 ) )
+        if ( ( dn == null ) || ( dn.size() == 0 ) || ( OIDS_MAP == null ) || ( OIDS_MAP.size() == 0 ) )
         {
             return dn;
         }
@@ -1228,52 +1374,63 @@
         {
             Rdn rdn = ( Rdn ) rdns.nextElement();
             String upName = rdn.getUpName();
-            rdnOidToName( rdn, oids );
+            rdnOidToName( rdn );
             rdn.normalizeString();
             rdn.setUpName( upName );
         }
 
-        newDn.normalize( newDn.upName );
+        newDn.normalizeInternal();
 
         return newDn;
     }
-
-
-    public static Name normalize( Name dn ) throws InvalidNameException, NamingException
-    {
-        return normalize( dn, DnOidContainer.getOids() );
-    }
-
-
+    
     /**
-     * Substitute OIDs and aliases for the simplest alias
+     * Change the internal DN, using the first alias instead of oids or other
+     * aliases. As we still have the UP name of each RDN, we will be able to
+     * provide both representation of the DN. example : dn: 2.5.4.3=People,
+     * dc=example, domainComponent=com will be transformed to : cn=People,
+     * dc=example, dc=com because 2.5.4.3 is the OID for cn and dc is the first
+     * alias of the couple of aliases (dc, domaincomponent). This is really
+     * important do have such a representation, as 'cn' and 'commonname' share
+     * the same OID.
      * 
-     * @param tlv
-     *            The TLV which contains the data
-     * @return A simple attribute
-     * @throws LdapStringEncodingException
-     *             If the attribute is not valid
+     * @param dn
+     *            The DN to transform
+     * @param oids
+     *            The mapping between names and oids.
+     * @return A normalized form of the DN
+     * @throws InvalidNameException
+     *             If the DN is invalid
      */
-    public static LdapString normalizeAttribute( byte[] data ) throws LdapStringEncodingException
+    public void normalize() throws InvalidNameException, NamingException
     {
-        LdapString type = new LdapString( data );
+        if ( ( OIDS_MAP == null ) || ( OIDS_MAP.size() == 0 ) )
+        {
+            return;
+        }
 
-        OidNormalizer oidNormalizer = ( OidNormalizer ) DnOidContainer.getOids().get( type.getString() );
+        Enumeration rdns = getAllRdn();
 
-        if ( oidNormalizer != null )
+        // Loop on all RDNs
+        while ( rdns.hasMoreElements() )
         {
-            type = new LdapString( StringTools.getBytesUtf8( oidNormalizer.getName() ) );
+            Rdn rdn = ( Rdn ) rdns.nextElement();
+            String upName = rdn.getUpName();
+            rdnOidToName( rdn );
+            rdn.normalizeString();
+            rdn.setUpName( upName );
         }
 
-        return type;
+        normalizeInternal();
     }
-
-    /*
-     * public Name toLdapName() throws InvalidNameException { Name name = new
-     * LdapName(); Enumeration rdns = getAll(); while ( rdns.hasMoreElements() ) {
-     * name.add( (String)rdns.nextElement() ); } return name; } public LdapDN(
-     * LdapName name ) throws InvalidNameException { Name newName = new
-     * LdapDN(); Enumeration comps = name.getAll(); while (
-     * comps.hasMoreElements() ) { newName.add( (String)comps.nextElement() ); } }
+    
+    /**
+     * Set the static OIDs map with the values.
+     * 
+     * @param oidsMap The HashMap which contains <oid, normalizer> pairs
      */
+    public static synchronized void setOidsMap( Map oidsMap )
+    {
+        OIDS_MAP = oidsMap;
+    }
 }

Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/name/NameComponentNormalizer.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/name/NameComponentNormalizer.java?rev=414015&r1=414014&r2=414015&view=diff
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/name/NameComponentNormalizer.java (original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/name/NameComponentNormalizer.java Tue Jun 13 18:15:12 2006
@@ -48,6 +48,14 @@
      */
     boolean isDefined( String id );
 
+    /**
+     * Normalizes the attribute name/alias to use the OID for it instead.
+     * 
+     * @param attributeName the name or OID of the attributeType
+     * @return the OID of the attributeType if it is recognized
+     * @throws NamingException if the attributeName is not recognized as a valid alias
+     */
+    String normalizeName( String attributeName ) throws NamingException;
 
     /**
      * Normalizes an attribute's value given the name of the attribute - short

Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/name/Rdn.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/name/Rdn.java?rev=414015&r1=414014&r2=414015&view=diff
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/name/Rdn.java (original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/name/Rdn.java Tue Jun 13 18:15:12 2006
@@ -1158,4 +1158,37 @@
 
         return new String( newChars, 0, pos );
     }
+
+    /**
+     * Gets the hashcode of this rdn.
+     * 
+     * @see java.lang.Object#hashCode()
+     */
+    public int hashCode()
+    {
+    	int result = 17;
+    	
+        switch ( nbAtavs )
+        {
+            case 0:
+                // An empty RDN
+                break;
+
+            case 1:
+                // We have a single AttributeTypeAndValue
+                result = result * 37 + atav.hashCode();
+                break;
+
+            default:
+                // We have more than one AttributeTypeAndValue
+
+                for ( Iterator elems = atavs.iterator();elems.hasNext(); )
+                {
+                    AttributeTypeAndValue ata = ( AttributeTypeAndValue ) elems.next();
+                    result = result * 37 + ata.hashCode();
+                }
+        }
+    	
+    	return result;
+    }
 }

Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/name/SimpleNameComponentNormalizer.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/name/SimpleNameComponentNormalizer.java?rev=414015&r1=414014&r2=414015&view=diff
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/name/SimpleNameComponentNormalizer.java (original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/name/SimpleNameComponentNormalizer.java Tue Jun 13 18:15:12 2006
@@ -44,7 +44,7 @@
      * @param normalizer
      *            the Normalizer to use for all normalization requests
      */
-    public SimpleNameComponentNormalizer(Normalizer normalizer)
+    public SimpleNameComponentNormalizer( Normalizer normalizer )
     {
         this.normalizer = normalizer;
     }
@@ -77,5 +77,11 @@
     public boolean isDefined( String oid )
     {
         return true;
+    }
+
+
+    public String normalizeName( String attributeName ) throws NamingException
+    {
+        throw new UnsupportedOperationException( "This class is not aware of schema information and cannot normalize" );
     }
 }

Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/OidNormalizer.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/OidNormalizer.java?rev=414015&r1=414014&r2=414015&view=diff
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/OidNormalizer.java (original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/OidNormalizer.java Tue Jun 13 18:15:12 2006
@@ -19,14 +19,15 @@
 
 
 /**
- * The OidNomalizer class contains a couple : and OID with its Normalizer
+ * The OidNomalizer class contains a tuple: an OID with its Normalizer.  It itself
+ * is not a normalizer.
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
 public class OidNormalizer
 {
     /** The oid */
-    private String name;
+    private String attributeTypeOid;
 
     /** The normalizer to be used with this OID */
     private Normalizer normalizer;
@@ -35,14 +36,12 @@
     /**
      * A constructor which accept two parameters
      * 
-     * @param oid
-     *            The oid
-     * @param normalizer
-     *            The associated normalizer
+     * @param attributeTypeOid the oid of the attributeType mapped to the normalizer
+     * @param normalizer the associated equality match based normalizer
      */
-    public OidNormalizer(String name, Normalizer normalizer)
+    public OidNormalizer( String attributeTypeOid, Normalizer normalizer )
     {
-        this.name = name;
+        this.attributeTypeOid = attributeTypeOid;
         this.normalizer = normalizer;
     }
 
@@ -50,12 +49,11 @@
     /**
      * A copy constructor.
      * 
-     * @param oidNormalizer
-     *            The OidNormalizer to copy from
+     * @param oidNormalizer the OidNormalizer to copy from
      */
-    public OidNormalizer(OidNormalizer oidNormalizer)
+    public OidNormalizer( OidNormalizer oidNormalizer )
     {
-        name = oidNormalizer.name;
+        attributeTypeOid = oidNormalizer.attributeTypeOid;
         normalizer = oidNormalizer.normalizer;
     }
 
@@ -72,37 +70,13 @@
 
 
     /**
-     * Set the normalizer
-     * 
-     * @param The
-     *            normalizer to be associated to the current OID
-     */
-    public void setNormalizer( Normalizer normalizer )
-    {
-        this.normalizer = normalizer;
-    }
-
-
-    /**
      * Get the current name
      * 
      * @return The current name
      */
-    public String getName()
-    {
-        return name;
-    }
-
-
-    /**
-     * Set the current OID
-     * 
-     * @param The
-     *            current OID
-     */
-    public void setName( String name )
+    public String getAttributeTypeOid()
     {
-        this.name = name;
+        return attributeTypeOid;
     }
 
 
@@ -111,6 +85,6 @@
      */
     public String toString()
     {
-        return "OidNormalizer : { " + name + ", " + normalizer.toString() + "}";
+        return "OidNormalizer : { " + attributeTypeOid + ", " + normalizer.toString() + "}";
     }
 }

Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/subtree/BaseSubtreeSpecification.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/subtree/BaseSubtreeSpecification.java?rev=414015&r1=414014&r2=414015&view=diff
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/subtree/BaseSubtreeSpecification.java (original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/subtree/BaseSubtreeSpecification.java Tue Jun 13 18:15:12 2006
@@ -18,11 +18,10 @@
 
 
 import org.apache.directory.shared.ldap.filter.ExprNode;
-import org.apache.directory.shared.ldap.name.LdapName;
+import org.apache.directory.shared.ldap.name.LdapDN;
 
 import java.util.Set;
 import java.util.Collections;
-import javax.naming.Name;
 
 
 /**
@@ -35,7 +34,7 @@
 public class BaseSubtreeSpecification implements SubtreeSpecification
 {
     /** the subtree base relative to the administration point */
-    private final Name base;
+    private final LdapDN base;
 
     /** the set of subordinates entries and their subordinates to exclude */
     private final Set chopBefore;
@@ -67,7 +66,7 @@
      */
     public BaseSubtreeSpecification()
     {
-        this.base = new LdapName();
+        this.base = new LdapDN();
 
         this.minBaseDistance = 0;
 
@@ -92,7 +91,7 @@
      */
     public BaseSubtreeSpecification(ExprNode refinement)
     {
-        this.base = new LdapName();
+        this.base = new LdapDN();
 
         this.minBaseDistance = 0;
 
@@ -114,7 +113,7 @@
      * @param base
      *            the base of the subtree relative to the administrative point
      */
-    public BaseSubtreeSpecification(Name base)
+    public BaseSubtreeSpecification( LdapDN base )
     {
         this.base = base;
 
@@ -147,7 +146,7 @@
      *            the set of subordinates entries and their subordinates to
      *            exclude
      */
-    public BaseSubtreeSpecification(Name base, int minBaseDistance, int maxBaseDistance, Set chopAfter, Set chopBefore)
+    public BaseSubtreeSpecification( LdapDN base, int minBaseDistance, int maxBaseDistance, Set chopAfter, Set chopBefore )
     {
         this( base, minBaseDistance, maxBaseDistance, chopAfter, chopBefore, null );
     }
@@ -174,8 +173,8 @@
      *            the filter expression only composed of objectClass attribute
      *            value assertions
      */
-    public BaseSubtreeSpecification(Name base, int minBaseDistance, int maxBaseDistance, Set chopAfter, Set chopBefore,
-        ExprNode refinement)
+    public BaseSubtreeSpecification( LdapDN base, int minBaseDistance, int maxBaseDistance, Set chopAfter, Set chopBefore,
+        ExprNode refinement )
     {
         this.base = base;
 
@@ -202,7 +201,7 @@
     // A C C E S S O R S
     // -----------------------------------------------------------------------
 
-    public Name getBase()
+    public LdapDN getBase()
     {
         return this.base;
     }

Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/subtree/SubtreeSpecification.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/subtree/SubtreeSpecification.java?rev=414015&r1=414014&r2=414015&view=diff
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/subtree/SubtreeSpecification.java (original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/subtree/SubtreeSpecification.java Tue Jun 13 18:15:12 2006
@@ -18,9 +18,9 @@
 
 
 import org.apache.directory.shared.ldap.filter.ExprNode;
+import org.apache.directory.shared.ldap.name.LdapDN;
 
 import java.util.Set;
-import javax.naming.Name;
 
 
 /**
@@ -49,7 +49,7 @@
      *         if the base is the administrative point - note that this Name is
      *         not Normalized according to matchingRules.
      */
-    Name getBase();
+    LdapDN getBase();
 
 
     /**

Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/subtree/SubtreeSpecificationModifier.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/subtree/SubtreeSpecificationModifier.java?rev=414015&r1=414014&r2=414015&view=diff
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/subtree/SubtreeSpecificationModifier.java (original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/subtree/SubtreeSpecificationModifier.java Tue Jun 13 18:15:12 2006
@@ -18,11 +18,10 @@
 
 
 import org.apache.directory.shared.ldap.filter.ExprNode;
-import org.apache.directory.shared.ldap.name.LdapName;
+import org.apache.directory.shared.ldap.name.LdapDN;
 
 import java.util.Set;
 import java.util.Collections;
-import javax.naming.Name;
 
 
 /**
@@ -37,7 +36,7 @@
 public class SubtreeSpecificationModifier
 {
     /** the subtree base relative to the administration point */
-    private Name base = new LdapName();
+    private LdapDN base = new LdapDN();
 
     /** the set of subordinates entries and their subordinates to exclude */
     private Set chopBefore = Collections.EMPTY_SET;
@@ -86,7 +85,7 @@
      * @param base
      *            subtree base relative to the administration point
      */
-    public void setBase( Name base )
+    public void setBase( LdapDN base )
     {
         this.base = base;
     }



Mime
View raw message