directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r157659 - in directory: asn1/branches/rewrite/ber/src/java/org/apache/asn1/ asn1/branches/rewrite/ber/src/java/org/apache/asn1/tag/ protocol-providers/ protocols/
Date Wed, 16 Mar 2005 04:20:53 GMT
Author: akarasulu
Date: Tue Mar 15 20:20:50 2005
New Revision: 157659

URL: http://svn.apache.org/viewcvs?view=rev&rev=157659
Log:
renaming protocols to protocol-providers to better express the serverside nature of these
components

Added:
    directory/protocol-providers/
      - copied from r157658, directory/protocols/
Removed:
    directory/asn1/branches/rewrite/ber/src/java/org/apache/asn1/TupleEventConsumer.java
    directory/protocols/
Modified:
    directory/asn1/branches/rewrite/ber/src/java/org/apache/asn1/BufferConsumer.java
    directory/asn1/branches/rewrite/ber/src/java/org/apache/asn1/TupleConsumer.java
    directory/asn1/branches/rewrite/ber/src/java/org/apache/asn1/tag/TagOctetCollector.java
    directory/asn1/branches/rewrite/ber/src/java/org/apache/asn1/tag/TagUtils.java

Modified: directory/asn1/branches/rewrite/ber/src/java/org/apache/asn1/BufferConsumer.java
URL: http://svn.apache.org/viewcvs/directory/asn1/branches/rewrite/ber/src/java/org/apache/asn1/BufferConsumer.java?view=diff&r1=157658&r2=157659
==============================================================================
--- directory/asn1/branches/rewrite/ber/src/java/org/apache/asn1/BufferConsumer.java (original)
+++ directory/asn1/branches/rewrite/ber/src/java/org/apache/asn1/BufferConsumer.java Tue Mar
15 20:20:50 2005
@@ -20,8 +20,6 @@
 import java.nio.ByteBuffer;
 import java.util.List;
 
-import org.apache.asn1.codec.DecoderException;
-
 
 /**
  * A ByteBuffer consumer.

Modified: directory/asn1/branches/rewrite/ber/src/java/org/apache/asn1/TupleConsumer.java
URL: http://svn.apache.org/viewcvs/directory/asn1/branches/rewrite/ber/src/java/org/apache/asn1/TupleConsumer.java?view=diff&r1=157658&r2=157659
==============================================================================
--- directory/asn1/branches/rewrite/ber/src/java/org/apache/asn1/TupleConsumer.java (original)
+++ directory/asn1/branches/rewrite/ber/src/java/org/apache/asn1/TupleConsumer.java Tue Mar
15 20:20:50 2005
@@ -17,16 +17,47 @@
 package org.apache.asn1;
 
 
-import org.apache.asn1.tuples.Tuple;
+import org.apache.asn1.ber.TagEnum;
+
+import java.nio.ByteBuffer;
+import java.net.URL;
 
 
 /**
- * A Tuple consumer.
+ * A consumer of tuple events rather than tuples themselves.  This way tuple objects
+ * need not be created.  This is an experiment.
  *
  * @author <a href="mailto:directory-dev@incubator.apache.org">Apache Directory Project</a>
  * @version $Rev$
  */
 public interface TupleConsumer
 {
-    void consume( Tuple tuple );
+    /**
+     * Consumer callback invoked by the production of a primitive tuple
+     * whose value is kept in memory.
+     *
+     * @param tag the tag enum type of the TLV tuple
+     * @param value the buffered value of the TLV tuple
+     */
+    void consume( TagEnum tag, ByteBuffer value );
+
+    /**
+     * Consumer callback invoked by the production of a primitive tuple
+     * whose value is kept on disk to be accessed later.
+     *
+     * The length in bytes of the data is encoded into a header in the
+     * stream - this helps because we can build and stream out determinate
+     * length tuples when encoding and chunking value out the door
+     *
+     * @param tag the tag enum type of the TLV tuple
+     * @param url the url to use for streamed access to this large tuple value
+     */
+    void consume( TagEnum tag, int length, URL url );
+
+    /**
+     * Consumer callback invoked by the production of a constructed tuple.
+     *
+     * @param tag the tag enum type of the TLV tuple
+     */
+    void consume( TagEnum tag );
 }

Modified: directory/asn1/branches/rewrite/ber/src/java/org/apache/asn1/tag/TagOctetCollector.java
URL: http://svn.apache.org/viewcvs/directory/asn1/branches/rewrite/ber/src/java/org/apache/asn1/tag/TagOctetCollector.java?view=diff&r1=157658&r2=157659
==============================================================================
--- directory/asn1/branches/rewrite/ber/src/java/org/apache/asn1/tag/TagOctetCollector.java
(original)
+++ directory/asn1/branches/rewrite/ber/src/java/org/apache/asn1/tag/TagOctetCollector.java
Tue Mar 15 20:20:50 2005
@@ -99,7 +99,7 @@
     /**
      * Gets the number of octets stored by this TagOctetCollector
      * 
-     * @return
+     * @return the size of this collector in tag bytes
      */
     public int size()
     {
@@ -121,7 +121,7 @@
     /**
      * Gets the 4 octets for the tag.
      * 
-     * @return
+     * @return a byte array at most 4 in size representing the tag bytes
      */
     public byte[] toArray()
     {
@@ -173,7 +173,7 @@
 
             default:
 
-                throw new IllegalArgumentException( "Cannot support more than 4 octets" )
;
+                throw new IllegalStateException( "Cannot support more than 4 octets" ) ;
         }
         
         return octets ;
@@ -183,50 +183,45 @@
     /**
      * Gets the byte at a specific index.
      * 
-     * @param index
+     * @param index into the tag bytes
      * @return
      * @throws IndexOutOfBoundsException
      */
     public byte get( int index )
     {
-        byte octet ;
+        byte octet;
         
-        if ( index >= size )
-        {
-            throw new IndexOutOfBoundsException( "accesing index " + index + " with a size
of " + size ) ;
-        }
-
         switch( index )
         {
             case(0):
 
-                octet = ( byte ) ( ( intValue & 0xff000000 ) >> 24 ) ;
+                octet = ( byte ) ( ( intValue & 0xff000000 ) >> 24 );
 
-                break ;
+                break;
 
             case(1):
 
-                octet = ( byte ) ( ( intValue & 0x00ff0000 ) >> 16 ) ;
+                octet = ( byte ) ( ( intValue & 0x00ff0000 ) >> 16 );
 
-                break ;
+                break;
 
             case(2):
 
-                octet = ( byte ) ( ( intValue & 0x0000ff00 ) >>  8 ) ;
+                octet = ( byte ) ( ( intValue & 0x0000ff00 ) >>  8 );
 
-                break ;
+                break;
 
             case(3):
 
-                octet = ( byte )   ( intValue & 0x000000ff ) ;
+                octet = ( byte )   ( intValue & 0x000000ff );
 
-                break ;
+                break;
 
             default:
 
-                throw new IllegalArgumentException( "Cannot support more than 4 octets" )
;
+                throw new IndexOutOfBoundsException( "Cannot support more than 4 octets or
less than 0: " + index );
         }
         
-        return octet ;
+        return octet;
     }
 }

Modified: directory/asn1/branches/rewrite/ber/src/java/org/apache/asn1/tag/TagUtils.java
URL: http://svn.apache.org/viewcvs/directory/asn1/branches/rewrite/ber/src/java/org/apache/asn1/tag/TagUtils.java?view=diff&r1=157658&r2=157659
==============================================================================
--- directory/asn1/branches/rewrite/ber/src/java/org/apache/asn1/tag/TagUtils.java (original)
+++ directory/asn1/branches/rewrite/ber/src/java/org/apache/asn1/tag/TagUtils.java Tue Mar
15 20:20:50 2005
@@ -310,11 +310,6 @@
      */
     public static boolean isRawTagConstructed( int rawTag )
     {
-        if ( ( rawTag & 0x20000000 ) > 0 )
-        {
-            return true;
-        }
-
-        return false;
+        return ( rawTag & 0x20000000 ) > 0;
     }
 }



Mime
View raw message