directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: rev 37036 - incubator/directory/snickers/branches/encoder-redesign/ldap-ber-provider/src/java/org/apache/snickers/ldap/encoder
Date Wed, 25 Aug 2004 18:18:16 GMT
Author: akarasulu
Date: Wed Aug 25 11:18:15 2004
New Revision: 37036

Modified:
   incubator/directory/snickers/branches/encoder-redesign/ldap-ber-provider/src/java/org/apache/snickers/ldap/encoder/SnickersLdapEncoder.java
Log:
various encoders hooked in

Modified: incubator/directory/snickers/branches/encoder-redesign/ldap-ber-provider/src/java/org/apache/snickers/ldap/encoder/SnickersLdapEncoder.java
==============================================================================
--- incubator/directory/snickers/branches/encoder-redesign/ldap-ber-provider/src/java/org/apache/snickers/ldap/encoder/SnickersLdapEncoder.java
(original)
+++ incubator/directory/snickers/branches/encoder-redesign/ldap-ber-provider/src/java/org/apache/snickers/ldap/encoder/SnickersLdapEncoder.java
Wed Aug 25 11:18:15 2004
@@ -22,7 +22,14 @@
 import org.apache.commons.codec.stateful.EncoderCallback;
 import org.apache.commons.codec.stateful.EncoderMonitor;
 import org.apache.ldap.common.message.*;
-import org.apache.snickers.ber.BEREncoder;
+import org.apache.snickers.ber.TupleNode;
+import org.apache.snickers.ber.TupleEncodingVisitor;
+import org.apache.snickers.ldap.encoder.bind.BindRequestEncoder;
+import org.apache.snickers.ldap.encoder.bind.BindResponseEncoder;
+import org.apache.snickers.ldap.encoder.search.SearchRequestEncoder;
+import org.apache.snickers.ldap.encoder.search.SearchResponseDoneEncoder;
+import org.apache.snickers.ldap.encoder.search.SearchResponseEntryEncoder;
+import org.apache.snickers.ldap.encoder.unbind.UnbindRequestEncoder;
 
 
 
@@ -36,13 +43,13 @@
 public class SnickersLdapEncoder implements StatefulEncoder
 {
     EncoderMonitor monitor;
-    BEREncoder encoder = new BEREncoder();
+    TupleEncodingVisitor encoder = new TupleEncodingVisitor();
 
 
     public void encode( Object obj ) throws EncoderException
     {
         Message msg = ( Message ) obj;
-
+        TupleNode root = null;
 
         switch( msg.getType().getValue() )
         {
@@ -50,18 +57,33 @@
                 break;
 
             case( MessageTypeEnum.BINDREQUEST_VAL ):
+                root = BindRequestEncoder.INSTANCE
+                        .encode( ( BindRequest ) msg );
                 break;
 
             case( MessageTypeEnum.BINDRESPONSE_VAL ):
+                root = BindResponseEncoder.INSTANCE
+                        .encode( ( BindResponse ) msg );
                 break;
 
             case( MessageTypeEnum.SEARCHREQUEST_VAL ):
+                root = SearchRequestEncoder.INSTANCE
+                        .encode( ( SearchRequest ) msg );
                 break;
 
             case( MessageTypeEnum.SEARCHRESDONE_VAL ):
+                root = SearchResponseDoneEncoder.INSTANCE
+                        .encode( ( SearchResponseDone ) msg );
                 break;
 
             case( MessageTypeEnum.SEARCHRESENTRY_VAL ):
+                root = SearchResponseEntryEncoder.INSTANCE
+                        .encode( ( SearchResponseEntry ) msg );
+                break;
+
+            case( MessageTypeEnum.UNBINDREQUEST_VAL ):
+                root = UnbindRequestEncoder.INSTANCE
+                        .encode( ( UnbindRequest ) msg );
                 break;
 
             default:
@@ -74,6 +96,8 @@
                 
                 throw e;
         }
+
+        root.accept( encoder );
     }
 
 
@@ -87,7 +111,6 @@
             return;
         }
     }
-
 
 
     public void setEncoderMonitor( EncoderMonitor monitor )

Mime
View raw message