directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r411281 - in /directory/releases/shared/0.9.5.1/ldap/src: main/java/org/apache/directory/shared/ldap/codec/ main/java/org/apache/directory/shared/ldap/codec/add/ main/java/org/apache/directory/shared/ldap/codec/modify/ main/java/org/apache/...
Date Fri, 02 Jun 2006 19:57:16 GMT
Author: akarasulu
Date: Fri Jun  2 12:57:15 2006
New Revision: 411281

URL: http://svn.apache.org/viewvc?rev=411281&view=rev
Log:
changes ...

Ok we're reverting revision r409468 yet again.  Why?  Well we reverted it before
on commit r411263 and tried to merge changes for ldif stuff back into the 0.9.5
shared branch.  This failed miserably.

We then said ok we'll reinstate r409468 back on the release tag for ldif changes
and did that.  Then we deleted the branches/shared/0.9.5 branch and copied the 
releases/shared/0.9.5.1 modified release tag back to the 0.9.5 branch.


Added:
    directory/releases/shared/0.9.5.1/ldap/src/main/java/org/apache/directory/shared/ldap/ldif/LdifEntry.java
      - copied unchanged from r409467, directory/releases/shared/0.9.5.1/ldap/src/main/java/org/apache/directory/shared/ldap/ldif/LdifEntry.java
    directory/releases/shared/0.9.5.1/ldap/src/main/java/org/apache/directory/shared/ldap/ldif/LdifIterator.java
      - copied unchanged from r409467, directory/releases/shared/0.9.5.1/ldap/src/main/java/org/apache/directory/shared/ldap/ldif/LdifIterator.java
    directory/releases/shared/0.9.5.1/ldap/src/main/java/org/apache/directory/shared/ldap/ldif/LdifIteratorMonitor.java
      - copied unchanged from r409467, directory/releases/shared/0.9.5.1/ldap/src/main/java/org/apache/directory/shared/ldap/ldif/LdifIteratorMonitor.java
    directory/releases/shared/0.9.5.1/ldap/src/main/java/org/apache/directory/shared/ldap/ldif/LdifIteratorMonitorAdapter.java
      - copied unchanged from r409467, directory/releases/shared/0.9.5.1/ldap/src/main/java/org/apache/directory/shared/ldap/ldif/LdifIteratorMonitorAdapter.java
    directory/releases/shared/0.9.5.1/ldap/src/main/java/org/apache/directory/shared/ldap/ldif/LdifParser.java
      - copied unchanged from r409467, directory/releases/shared/0.9.5.1/ldap/src/main/java/org/apache/directory/shared/ldap/ldif/LdifParser.java
    directory/releases/shared/0.9.5.1/ldap/src/main/java/org/apache/directory/shared/ldap/ldif/LdifParserImpl.java
      - copied unchanged from r409467, directory/releases/shared/0.9.5.1/ldap/src/main/java/org/apache/directory/shared/ldap/ldif/LdifParserImpl.java
    directory/releases/shared/0.9.5.1/ldap/src/test/java/org/apache/directory/shared/ldap/ldif/LdifParserImplTest.java
      - copied unchanged from r409467, directory/releases/shared/0.9.5.1/ldap/src/test/java/org/apache/directory/shared/ldap/ldif/LdifParserImplTest.java
Removed:
    directory/releases/shared/0.9.5.1/ldap/src/main/java/org/apache/directory/shared/ldap/ldif/Entry.java
    directory/releases/shared/0.9.5.1/ldap/src/main/java/org/apache/directory/shared/ldap/ldif/LdifControl.java
    directory/releases/shared/0.9.5.1/ldap/src/main/java/org/apache/directory/shared/ldap/ldif/LdifReader.java
    directory/releases/shared/0.9.5.1/ldap/src/test/java/org/apache/directory/shared/ldap/ldif/LdifReaderTest.java
Modified:
    directory/releases/shared/0.9.5.1/ldap/src/main/java/org/apache/directory/shared/ldap/codec/TwixDecoder.java
    directory/releases/shared/0.9.5.1/ldap/src/main/java/org/apache/directory/shared/ldap/codec/add/AddRequest.java
    directory/releases/shared/0.9.5.1/ldap/src/main/java/org/apache/directory/shared/ldap/codec/modify/ModifyRequest.java
    directory/releases/shared/0.9.5.1/ldap/src/main/java/org/apache/directory/shared/ldap/ldif/LdifComposerImpl.java
    directory/releases/shared/0.9.5.1/ldap/src/main/java/org/apache/directory/shared/ldap/util/PropertiesUtils.java
    directory/releases/shared/0.9.5.1/ldap/src/main/java/org/apache/directory/shared/ldap/util/StringTools.java

Modified: directory/releases/shared/0.9.5.1/ldap/src/main/java/org/apache/directory/shared/ldap/codec/TwixDecoder.java
URL: http://svn.apache.org/viewvc/directory/releases/shared/0.9.5.1/ldap/src/main/java/org/apache/directory/shared/ldap/codec/TwixDecoder.java?rev=411281&r1=411280&r2=411281&view=diff
==============================================================================
--- directory/releases/shared/0.9.5.1/ldap/src/main/java/org/apache/directory/shared/ldap/codec/TwixDecoder.java
(original)
+++ directory/releases/shared/0.9.5.1/ldap/src/main/java/org/apache/directory/shared/ldap/codec/TwixDecoder.java
Fri Jun  2 12:57:15 2006
@@ -62,7 +62,6 @@
     public void decode( Object encoded ) throws DecoderException
     {
         ByteBuffer buf;
-        int position = 0;
 
         if ( encoded instanceof ByteBuffer )
         {
@@ -78,47 +77,42 @@
                 + encoded.getClass() );
         }
 
-        while ( buf.hasRemaining() )
+        if ( log.isDebugEnabled() )
         {
+            log.debug( "Decoding the PDU : " );
 
-            ldapDecoder.decode( buf, ldapMessageContainer );
-
-            if ( log.isDebugEnabled() )
+            if ( buf.hasArray() )
+            {
+                log.debug( StringTools.dumpBytes( buf.array() ) );
+            }
+            else
             {
-                log.debug( "Decoding the PDU : " );
+                byte[] array = new byte[buf.capacity()];
+                int i = 0;
 
-                int size = buf.position();
-                buf.flip();
-                
-            	byte[] array = new byte[ size - position ];
-            	
-            	for ( int i = position; i < size; i++ )
-            	{
-            		array[ i ] = buf.get();
-            	}
+                while ( buf.hasRemaining() )
+                {
+                    array[i++] = buf.get();
+                }
 
-                position = size;
-                
+                buf.flip();
                 log.debug( StringTools.dumpBytes( array ) );
             }
-            
+        }
+
+        while ( buf.hasRemaining() )
+        {
+            ldapDecoder.decode( buf, ldapMessageContainer );
+
             if ( ldapMessageContainer.getState() == TLVStateEnum.PDU_DECODED )
             {
                 if ( log.isDebugEnabled() )
                 {
                     log.debug( "Decoded LdapMessage : " + ldapMessageContainer.getLdapMessage()
);
-                    buf.mark();
                 }
 
                 decoderCallback.decodeOccurred( null, ldapMessageContainer.getLdapMessage()
);
                 ldapMessageContainer.clean();
-            }
-            else
-            {
-            	if ( log.isDebugEnabled() )
-            	{
-            		
-            	}
             }
         }
     }

Modified: directory/releases/shared/0.9.5.1/ldap/src/main/java/org/apache/directory/shared/ldap/codec/add/AddRequest.java
URL: http://svn.apache.org/viewvc/directory/releases/shared/0.9.5.1/ldap/src/main/java/org/apache/directory/shared/ldap/codec/add/AddRequest.java?rev=411281&r1=411280&r2=411281&view=diff
==============================================================================
--- directory/releases/shared/0.9.5.1/ldap/src/main/java/org/apache/directory/shared/ldap/codec/add/AddRequest.java
(original)
+++ directory/releases/shared/0.9.5.1/ldap/src/main/java/org/apache/directory/shared/ldap/codec/add/AddRequest.java
Fri Jun  2 12:57:15 2006
@@ -144,18 +144,6 @@
         attributes.put( currentAttribute );
     }
 
-    /**
-     * Create a new attributeValue
-     * 
-     * @param type
-     *            The attribute's name (called 'type' in the grammar)
-     */
-    public void addAttributeType( String type )
-    {
-        currentAttribute = new BasicAttribute( type.toLowerCase() );
-        attributes.put( currentAttribute );
-    }
-
 
     /**
      * Add a new value to the current attribute

Modified: directory/releases/shared/0.9.5.1/ldap/src/main/java/org/apache/directory/shared/ldap/codec/modify/ModifyRequest.java
URL: http://svn.apache.org/viewvc/directory/releases/shared/0.9.5.1/ldap/src/main/java/org/apache/directory/shared/ldap/codec/modify/ModifyRequest.java?rev=411281&r1=411280&r2=411281&view=diff
==============================================================================
--- directory/releases/shared/0.9.5.1/ldap/src/main/java/org/apache/directory/shared/ldap/codec/modify/ModifyRequest.java
(original)
+++ directory/releases/shared/0.9.5.1/ldap/src/main/java/org/apache/directory/shared/ldap/codec/modify/ModifyRequest.java
Fri Jun  2 12:57:15 2006
@@ -165,18 +165,7 @@
      */
     public void addAttributeTypeAndValues( LdapString type )
     {
-        addAttributeTypeAndValues( type.getString() );
-    }
-
-    /**
-     * Add a new attributeTypeAndValue
-     * 
-     * @param type
-     *            The attribute's name
-     */
-    public void addAttributeTypeAndValues( String type )
-    {
-        currentAttribute = new BasicAttribute( StringTools.lowerCase( type ) );
+        currentAttribute = new BasicAttribute( StringTools.lowerCase( type.getString() )
);
 
         int operation = 0;
 

Modified: directory/releases/shared/0.9.5.1/ldap/src/main/java/org/apache/directory/shared/ldap/ldif/LdifComposerImpl.java
URL: http://svn.apache.org/viewvc/directory/releases/shared/0.9.5.1/ldap/src/main/java/org/apache/directory/shared/ldap/ldif/LdifComposerImpl.java?rev=411281&r1=411280&r2=411281&view=diff
==============================================================================
--- directory/releases/shared/0.9.5.1/ldap/src/main/java/org/apache/directory/shared/ldap/ldif/LdifComposerImpl.java
(original)
+++ directory/releases/shared/0.9.5.1/ldap/src/main/java/org/apache/directory/shared/ldap/ldif/LdifComposerImpl.java
Fri Jun  2 12:57:15 2006
@@ -54,77 +54,77 @@
      *            the multi map of single and multivalued attributes.
      * @return the LDIF as a String.
      */
-    public String compose( MultiMap attrHash )
+    public String compose( MultiMap a_attrHash )
     {
-        Object val = null;
-        String key = null;
-        Iterator keys = attrHash.keySet().iterator();
-        Iterator values = null;
-        Collection valueCol = null;
-        StringWriter sw = new StringWriter();
-        PrintWriter out = new PrintWriter( sw );
+        Object l_val = null;
+        String l_key = null;
+        Iterator l_keys = a_attrHash.keySet().iterator();
+        Iterator l_values = null;
+        Collection l_valueCol = null;
+        StringWriter l_sw = new StringWriter();
+        PrintWriter l_out = new PrintWriter( l_sw );
 
-        while ( keys.hasNext() )
+        while ( l_keys.hasNext() )
         {
-            key = ( String ) keys.next();
-            valueCol = ( Collection ) attrHash.get( key );
-            values = valueCol.iterator();
+            l_key = ( String ) l_keys.next();
+            l_valueCol = ( Collection ) a_attrHash.get( l_key );
+            l_values = l_valueCol.iterator();
 
-            if ( valueCol.isEmpty() )
+            if ( l_valueCol.isEmpty() )
             {
                 continue;
             }
-            else if ( valueCol.size() == 1 )
+            else if ( l_valueCol.size() == 1 )
             {
-                out.print( key );
-                out.print( ':' );
-                val = values.next();
+                l_out.print( l_key );
+                l_out.print( ':' );
+                l_val = l_values.next();
 
-                if ( val.getClass().isArray() )
+                if ( l_val.getClass().isArray() )
                 {
-                    out.print( ": " );
-                    out.println( base64encode( ( byte[] ) val ) );
+                    l_out.print( ": " );
+                    l_out.println( base64encode( ( byte[] ) l_val ) );
                 }
                 else
                 {
-                    out.print( ' ' );
-                    out.println( val );
+                    l_out.print( ' ' );
+                    l_out.println( l_val );
                 }
                 continue;
             }
 
-            while ( values.hasNext() )
+            while ( l_values.hasNext() )
             {
-                out.print( key );
-                out.print( ':' );
-                val = values.next();
+                l_out.print( l_key );
+                l_out.print( ':' );
+                l_val = l_values.next();
 
-                if ( val.getClass().isArray() )
+                if ( l_val.getClass().isArray() )
                 {
-                    out.print( ": " );
-                    out.println( base64encode( ( byte[] ) val ) );
+                    l_out.print( ": " );
+                    l_out.println( base64encode( ( byte[] ) l_val ) );
                 }
                 else
                 {
-                    out.print( ' ' );
-                    out.println( val );
+                    l_out.print( ' ' );
+                    l_out.println( l_val );
                 }
             }
         }
 
-        return sw.getBuffer().toString();
+        return l_sw.getBuffer().toString();
     }
 
 
     /**
      * Encodes an binary data into a base64 String.
      * 
-     * @param byteArray
+     * @param a_byteArray
      *            the value of a binary attribute.
      * @return the encoded binary data as a char array.
      */
-    public char[] base64encode( byte[] byteArray )
+    public char[] base64encode( byte[] a_byteArray )
     {
-        return Base64.encode( byteArray );
+        return Base64.encode( a_byteArray );
     }
 }

Modified: directory/releases/shared/0.9.5.1/ldap/src/main/java/org/apache/directory/shared/ldap/util/PropertiesUtils.java
URL: http://svn.apache.org/viewvc/directory/releases/shared/0.9.5.1/ldap/src/main/java/org/apache/directory/shared/ldap/util/PropertiesUtils.java?rev=411281&r1=411280&r2=411281&view=diff
==============================================================================
--- directory/releases/shared/0.9.5.1/ldap/src/main/java/org/apache/directory/shared/ldap/util/PropertiesUtils.java
(original)
+++ directory/releases/shared/0.9.5.1/ldap/src/main/java/org/apache/directory/shared/ldap/util/PropertiesUtils.java
Fri Jun  2 12:57:15 2006
@@ -23,14 +23,12 @@
 import java.io.InputStream;
 import java.io.IOException;
 import java.io.FileInputStream;
-import java.io.StringReader;
 
 import javax.naming.directory.Attributes;
 import javax.naming.NamingException;
 
 import org.apache.directory.shared.ldap.NotImplementedException;
-import org.apache.directory.shared.ldap.ldif.Entry;
-import org.apache.directory.shared.ldap.ldif.LdifReader;
+import org.apache.directory.shared.ldap.ldif.LdifParserImpl;
 import org.apache.directory.shared.ldap.message.LockableAttributesImpl;
 
 
@@ -691,16 +689,13 @@
             return values;
         }
 
-        String ldif = props.getProperty( key ).trim().replace( '*', '\n' );
-        
-        LdifReader ldifReader = new LdifReader( new StringReader( ldif ) );
-        
-        Entry entry = (Entry)ldifReader.next();
-        
-        if ( entry != null )
+        if ( values == null )
         {
-        	values = entry.getAttributes();
+            values = new LockableAttributesImpl();
         }
+
+        String ldif = props.getProperty( key ).trim().replace( '*', '\n' );
+        ( new LdifParserImpl() ).parse( values, ldif );
         return values;
     }
 }

Modified: directory/releases/shared/0.9.5.1/ldap/src/main/java/org/apache/directory/shared/ldap/util/StringTools.java
URL: http://svn.apache.org/viewvc/directory/releases/shared/0.9.5.1/ldap/src/main/java/org/apache/directory/shared/ldap/util/StringTools.java?rev=411281&r1=411280&r2=411281&view=diff
==============================================================================
--- directory/releases/shared/0.9.5.1/ldap/src/main/java/org/apache/directory/shared/ldap/util/StringTools.java
(original)
+++ directory/releases/shared/0.9.5.1/ldap/src/main/java/org/apache/directory/shared/ldap/util/StringTools.java
Fri Jun  2 12:57:15 2006
@@ -17,15 +17,12 @@
 package org.apache.directory.shared.ldap.util;
 
 
-import java.io.ByteArrayOutputStream;
 import java.io.File;
-import java.io.OutputStreamWriter;
 import java.io.UnsupportedEncodingException;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.io.FileFilter;
-import java.nio.charset.Charset;
 import java.util.ArrayList;
 import java.util.regex.Pattern;
 import java.util.regex.PatternSyntaxException;
@@ -41,11 +38,6 @@
  */
 public class StringTools
 {
-    /** The default charset, because it's not provided by JDK 1.5 */
-    private static final String DEFAULT_CHARSET_JDK_1_4 = new OutputStreamWriter( new ByteArrayOutputStream()
).getEncoding();
-    private static final String DEFAULT_CHARSET_JDK_1_5 = Charset.defaultCharset().name();
-    private static final String JAVA_VERSION = System.getProperty( "java.version" );
-    
     /**
      * Trims several consecutive characters into one.
      * 
@@ -2269,20 +2261,5 @@
         }
 
         return sb.toString();
-    }
-
-    /**
-     * @return The default charset
-     */
-    public static String getDefaultCharsetName()
-    {
-        if ( JAVA_VERSION.startsWith( "1.4" ) )
-        {
-            return DEFAULT_CHARSET_JDK_1_4;
-        }
-        else
-        {
-            return DEFAULT_CHARSET_JDK_1_5;
-        }
     }
 }



Mime
View raw message