directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r451836 [5/11] - in /directory/branches/shared/0.9.5/ldap/src: main/java/org/apache/directory/shared/ldap/codec/ main/java/org/apache/directory/shared/ldap/codec/abandon/ main/java/org/apache/directory/shared/ldap/codec/actions/ main/java/o...
Date Sun, 01 Oct 2006 23:07:49 GMT
Modified: directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/TwixTransformer.java
URL: http://svn.apache.org/viewvc/directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/TwixTransformer.java?view=diff&rev=451836&r1=451835&r2=451836
==============================================================================
--- directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/TwixTransformer.java (original)
+++ directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/TwixTransformer.java Sun Oct  1 16:07:44 2006
@@ -66,8 +66,6 @@
 import org.apache.directory.shared.ldap.codec.search.SubstringFilter;
 import org.apache.directory.shared.ldap.codec.search.controls.PSearchControl;
 import org.apache.directory.shared.ldap.codec.search.controls.SubEntryControl;
-import org.apache.directory.shared.ldap.codec.util.LdapString;
-import org.apache.directory.shared.ldap.codec.util.LdapStringEncodingException;
 import org.apache.directory.shared.ldap.codec.util.LdapURL;
 import org.apache.directory.shared.ldap.codec.util.LdapURLEncodingException;
 import org.apache.directory.shared.ldap.filter.AbstractExprNode;
@@ -136,8 +134,7 @@
     /**
      * Creates a passthrough transformer that really does nothing at all.
      * 
-     * @param provider
-     *            the povider for this transformer
+     * @param provider the provider for this transformer
      */
     public TwixTransformer(Provider provider)
     {
@@ -160,10 +157,8 @@
      * Transform an AbandonRequest message from a TwixMessage to a
      * SnickersMessage
      * 
-     * @param twixMessage
-     *            The message to transform
-     * @param messageId
-     *            The message Id
+     * @param twixMessage The message to transform
+     * @param messageId The message Id
      * @return A Snickers AbandonRequestImpl
      */
     private Message transformAbandonRequest( LdapMessage twixMessage, int messageId )
@@ -181,10 +176,8 @@
     /**
      * Transform an AddRequest message from a TwixMessage to a SnickersMessage
      * 
-     * @param twixMessage
-     *            The message to transform
-     * @param messageId
-     *            The message Id
+     * @param twixMessage The message to transform
+     * @param messageId The message Id
      * @return A Snickers AddRequestImpl
      */
     private Message transformAddRequest( LdapMessage twixMessage, int messageId )
@@ -205,10 +198,8 @@
     /**
      * Transform a BindRequest message from a TwixMessage to a SnickersMessage
      * 
-     * @param twixMessage
-     *            The message to transform
-     * @param messageId
-     *            The message Id
+     * @param twixMessage The message to transform
+     * @param messageId The message Id
      * @return A Snickers BindRequestImpl
      */
     private Message transformBindRequest( LdapMessage twixMessage, int messageId )
@@ -248,10 +239,8 @@
      * Transform a CompareRequest message from a TwixMessage to a
      * SnickersMessage
      * 
-     * @param twixMessage
-     *            The message to transform
-     * @param messageId
-     *            The message Id
+     * @param twixMessage The message to transform
+     * @param messageId The message Id
      * @return A Snickers CompareRequestImpl
      */
     private Message transformCompareRequest( LdapMessage twixMessage, int messageId )
@@ -282,10 +271,8 @@
     /**
      * Transform a DelRequest message from a TwixMessage to a SnickersMessage
      * 
-     * @param twixMessage
-     *            The message to transform
-     * @param messageId
-     *            The message Id
+     * @param twixMessage The message to transform
+     * @param messageId The message Id
      * @return A Snickers DeleteRequestImpl
      */
     private Message transformDelRequest( LdapMessage twixMessage, int messageId )
@@ -304,10 +291,8 @@
      * Transform an ExtendedRequest message from a TwixMessage to a
      * SnickersMessage
      * 
-     * @param twixMessage
-     *            The message to transform
-     * @param messageId
-     *            The message Id
+     * @param twixMessage The message to transform
+     * @param messageId The message Id
      * @return A Snickers ExtendedRequestImpl
      */
     private Message transformExtendedRequest( LdapMessage twixMessage, int messageId )
@@ -338,10 +323,8 @@
      * Transform a ModifyDNRequest message from a TwixMessage to a
      * SnickersMessage
      * 
-     * @param twixMessage
-     *            The message to transform
-     * @param messageId
-     *            The message Id
+     * @param twixMessage The message to transform
+     * @param messageId The message Id
      * @return A Snickers ModifyDNRequestImpl
      */
     private Message transformModifyDNRequest( LdapMessage twixMessage, int messageId )
@@ -368,10 +351,8 @@
     /**
      * Transform a ModifyRequest message from a TwixMessage to a SnickersMessage
      * 
-     * @param twixMessage
-     *            The message to transform
-     * @param messageId
-     *            The message Id
+     * @param twixMessage The message to transform
+     * @param messageId The message Id
      * @return A Snickers ModifyRequestImpl
      */
     private Message transformModifyRequest( LdapMessage twixMessage, int messageId )
@@ -401,8 +382,7 @@
     /**
      * Transform the Filter part of a SearchRequest to en ExprNode
      * 
-     * @param twixFilter
-     *            The filter to be transformed
+     * @param twixFilter The filter to be transformed
      * @return An ExprNode
      */
     private ExprNode transformFilter( Filter twixFilter )
@@ -605,10 +585,8 @@
     /**
      * Transform a SearchRequest message from a TwixMessage to a SnickersMessage
      * 
-     * @param twixMessage
-     *            The message to transform
-     * @param messageId
-     *            The message Id
+     * @param twixMessage The message to transform
+     * @param messageId The message Id
      * @return A Snickers SearchRequestImpl
      */
     private Message transformSearchRequest( LdapMessage twixMessage, int messageId )
@@ -696,10 +674,8 @@
      * Transform an UnBindRequest message from a TwixMessage to a
      * SnickersMessage
      * 
-     * @param twixMessage
-     *            The message to transform
-     * @param messageId
-     *            The message Id
+     * @param twixMessage The message to transform
+     * @param messageId The message Id
      * @return A Snickers UnBindRequestImpl
      */
     private Message transformUnBindRequest( LdapMessage twixMessage, int messageId )
@@ -711,8 +687,7 @@
     /**
      * Transform the Twix message to a codec neutral message.
      * 
-     * @param obj
-     *            the object to transform
+     * @param obj the object to transform
      * @return the object transformed
      */
     public Message transform( Object obj )
@@ -885,8 +860,7 @@
     /**
      * Transform a Ldapresult part of a Snickers Response to a Twix LdapResult
      * 
-     * @param snickersLdapResult
-     *            The Snickers LdapResult to transform
+     * @param snickersLdapResult The Snickers LdapResult to transform
      * @return A Twix LdapResult
      */
     private LdapResult transformLdapResult( LdapResultImpl snickersLdapResult )
@@ -897,24 +871,15 @@
         twixLdapResult.setResultCode( snickersLdapResult.getResultCode().getValue() );
 
         // Snickers : String errorMessage -> Twix : LdapString errorMessage
-        try
-        {
-            String errorMessage = snickersLdapResult.getErrorMessage();
+        String errorMessage = snickersLdapResult.getErrorMessage();
 
-            if ( ( errorMessage == null ) || ( errorMessage.length() == 0 ) )
-            {
-                twixLdapResult.setErrorMessage( LdapString.EMPTY_STRING );
-            }
-            else
-            {
-                twixLdapResult.setErrorMessage( new LdapString( snickersLdapResult.getErrorMessage().getBytes() ) );
-            }
+        if ( ( errorMessage == null ) || ( errorMessage.length() == 0 ) )
+        {
+            twixLdapResult.setErrorMessage( "" );
         }
-        catch ( LdapStringEncodingException lsee )
+        else
         {
-            log.warn( "The error message " + snickersLdapResult.getErrorMessage() + " is invalid : "
-                + lsee.getMessage() );
-            twixLdapResult.setErrorMessage( LdapString.EMPTY_STRING );
+            twixLdapResult.setErrorMessage( new String( snickersLdapResult.getErrorMessage().getBytes() ) );
         }
 
         // Snickers : String matchedDn -> Twix : LdapDN matchedDN
@@ -926,6 +891,7 @@
         if ( snisckersReferrals != null )
         {
             Iterator referrals = snisckersReferrals.getLdapUrls().iterator();
+            twixLdapResult.initReferrals();
 
             while ( referrals.hasNext() )
             {
@@ -951,10 +917,8 @@
     /**
      * Transform a Snickers AddResponse to a Twix AddResponse
      * 
-     * @param twixMessage
-     *            The Twix AddResponse to produce
-     * @param snickersMessage
-     *            The incoming Snickers AddResponse
+     * @param twixMessage The Twix AddResponse to produce
+     * @param snickersMessage The incoming Snickers AddResponse
      */
     private void transformAddResponse( LdapMessage twixMessage, Message snickersMessage )
     {
@@ -973,10 +937,8 @@
     /**
      * Transform a Snickers BindResponse to a Twix BindResponse
      * 
-     * @param twixMessage
-     *            The Twix BindResponse to produce
-     * @param snickersMessage
-     *            The incoming Snickers BindResponse
+     * @param twixMessage The Twix BindResponse to produce
+     * @param snickersMessage The incoming Snickers BindResponse
      */
     private void transformBindResponse( LdapMessage twixMessage, Message snickersMessage )
     {
@@ -1004,10 +966,8 @@
     /**
      * Transform a Snickers CompareResponse to a Twix CompareResponse
      * 
-     * @param twixMessage
-     *            The Twix CompareResponse to produce
-     * @param snickersMessage
-     *            The incoming Snickers CompareResponse
+     * @param twixMessage The Twix CompareResponse to produce
+     * @param snickersMessage The incoming Snickers CompareResponse
      */
     private void transformCompareResponse( LdapMessage twixMessage, Message snickersMessage )
     {
@@ -1027,10 +987,8 @@
     /**
      * Transform a Snickers DelResponse to a Twix DelResponse
      * 
-     * @param twixMessage
-     *            The Twix DelResponse to produce
-     * @param snickersMessage
-     *            The incoming Snickers DelResponse
+     * @param twixMessage The Twix DelResponse to produce
+     * @param snickersMessage The incoming Snickers DelResponse
      */
     private void transformDelResponse( LdapMessage twixMessage, Message snickersMessage )
     {
@@ -1049,10 +1007,8 @@
     /**
      * Transform a Snickers ExtendedResponse to a Twix ExtendedResponse
      * 
-     * @param twixMessage
-     *            The Twix ExtendedResponse to produce
-     * @param snickersMessage
-     *            The incoming Snickers ExtendedResponse
+     * @param twixMessage The Twix ExtendedResponse to produce
+     * @param snickersMessage The incoming Snickers ExtendedResponse
      */
     private void transformExtendedResponse( LdapMessage twixMessage, Message snickersMessage )
     {
@@ -1085,10 +1041,8 @@
     /**
      * Transform a Snickers ModifyResponse to a Twix ModifyResponse
      * 
-     * @param twixMessage
-     *            The Twix ModifyResponse to produce
-     * @param snickersMessage
-     *            The incoming Snickers ModifyResponse
+     * @param twixMessage The Twix ModifyResponse to produce
+     * @param snickersMessage The incoming Snickers ModifyResponse
      */
     private void transformModifyResponse( LdapMessage twixMessage, Message snickersMessage )
     {
@@ -1107,10 +1061,8 @@
     /**
      * Transform a Snickers ModifyDNResponse to a Twix ModifyDNResponse
      * 
-     * @param twixMessage
-     *            The Twix ModifyDNResponse to produce
-     * @param snickersMessage
-     *            The incoming Snickers ModifyDNResponse
+     * @param twixMessage The Twix ModifyDNResponse to produce
+     * @param snickersMessage The incoming Snickers ModifyDNResponse
      */
     private void transformModifyDNResponse( LdapMessage twixMessage, Message snickersMessage )
     {
@@ -1130,10 +1082,8 @@
     /**
      * Transform a Snickers SearchResponseDone to a Twix SearchResultDone
      * 
-     * @param twixMessage
-     *            The Twix SearchResultDone to produce
-     * @param snickersMessage
-     *            The incoming Snickers SearchResponseDone
+     * @param twixMessage The Twix SearchResultDone to produce
+     * @param snickersMessage The incoming Snickers SearchResponseDone
      */
     private void transformSearchResultDone( LdapMessage twixMessage, Message snickersMessage )
     {
@@ -1152,10 +1102,8 @@
     /**
      * Transform a Snickers SearchResponseEntry to a Twix SearchResultEntry
      * 
-     * @param twixMessage
-     *            The Twix SearchResultEntry to produce
-     * @param snickersMessage
-     *            The incoming Snickers SearchResponseEntry
+     * @param twixMessage The Twix SearchResultEntry to produce
+     * @param snickersMessage The incoming Snickers SearchResponseEntry
      */
     private void transformSearchResultEntry( LdapMessage twixMessage, Message snickersMessage )
     {
@@ -1178,10 +1126,8 @@
      * Transform a Snickers SearchResponseReference to a Twix
      * SearchResultReference
      * 
-     * @param twixMessage
-     *            The Twix SearchResultReference to produce
-     * @param snickersMessage
-     *            The incoming Snickers SearchResponseReference
+     * @param twixMessage The Twix SearchResultReference to produce
+     * @param snickersMessage The incoming Snickers SearchResponseReference
      */
     private void transformSearchResultReference( LdapMessage twixMessage, Message snickersMessage )
     {
@@ -1225,8 +1171,7 @@
     /**
      * Transform the Snickers message to a Twix message.
      * 
-     * @param msg
-     *            the message to transform
+     * @param msg the message to transform
      * @return the msg transformed
      */
     public Object transform( Message msg )
@@ -1295,8 +1240,12 @@
         return twixMessage;
     }
 
-
-    private void transformControls( org.apache.directory.shared.ldap.codec.LdapMessage twixMessage, Message msg )
+    /**
+     * Transforms the controls
+     * @param twixMessage The Twix SearchResultReference to produce
+     * @param msg The incoming Snickers SearchResponseReference
+     */
+    private void transformControls( LdapMessage twixMessage, Message msg )
     {
         Iterator list = msg.getControls().values().iterator();
         while ( list.hasNext() )
@@ -1307,14 +1256,7 @@
             twixControl.setCriticality( control.isCritical() );
             twixControl.setControlValue( control.getEncodedValue() );
             twixControl.setEncodedValue( control.getEncodedValue() );
-            try
-            {
-                twixControl.setControlType( new LdapString( Asn1StringUtils.getBytesUtf8( control.getID() ) ) );
-            }
-            catch ( LdapStringEncodingException e )
-            {
-                log.error( "failed to encode string for control id", e );
-            }
+            twixControl.setControlType( new String( Asn1StringUtils.getBytesUtf8( control.getID() ) ) );
             twixControl.setParent( twixMessage );
         }
     }

Modified: directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/abandon/AbandonRequest.java
URL: http://svn.apache.org/viewvc/directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/abandon/AbandonRequest.java?view=diff&rev=451836&r1=451835&r2=451836
==============================================================================
--- directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/abandon/AbandonRequest.java (original)
+++ directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/abandon/AbandonRequest.java Sun Oct  1 16:07:44 2006
@@ -32,9 +32,14 @@
 
 
 /**
- * A AbandonRequest Message. Its syntax is : AbandonRequest ::= [APPLICATION 16]
- * MessageID MessageID ::= INTEGER (0 .. maxInt) maxInt INTEGER ::= 2147483647 --
- * (2^^31 - 1) --
+ * A AbandonRequest Message. 
+ * 
+ * Its syntax is : 
+ * AbandonRequest ::= [APPLICATION 16] MessageID 
+ * 
+ * MessageID ::= INTEGER (0 .. maxInt) 
+ * 
+ * maxInt INTEGER ::= 2147483647 -- (2^^31 - 1) --
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
@@ -93,8 +98,7 @@
     /**
      * Set the abandoned message ID
      * 
-     * @param abandonedMessageId
-     *            The abandoned messageID to set.
+     * @param abandonedMessageId The abandoned messageID to set.
      */
     public void setAbandonedMessageId( int abandonedMessageId )
     {
@@ -103,9 +107,12 @@
 
 
     /**
-     * Compute the AbandonRequest length AbandonRequest : 0x50 0x0(1..4)
-     * abandoned MessageId Length(AbandonRequest) = Length(0x50) + 1 +
-     * Length(abandoned MessageId)
+     * Compute the AbandonRequest length 
+     * 
+     * AbandonRequest : 
+     * 0x50 0x0(1..4) abandoned MessageId 
+     * 
+     * Length(AbandonRequest) = Length(0x50) + 1 + Length(abandoned MessageId)
      */
     public int computeLength()
     {
@@ -123,8 +130,7 @@
     /**
      * Encode the AbandonRequest message to a PDU.
      * 
-     * @param buffer
-     *            The buffer where to put the PDU
+     * @param buffer The buffer where to put the PDU
      * @return The PDU.
      */
     public ByteBuffer encode( ByteBuffer buffer ) throws EncoderException

Added: directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/AttributeDescAction.java
URL: http://svn.apache.org/viewvc/directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/AttributeDescAction.java?view=auto&rev=451836
==============================================================================
--- directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/AttributeDescAction.java (added)
+++ directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/AttributeDescAction.java Sun Oct  1 16:07:44 2006
@@ -0,0 +1,89 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.shared.ldap.codec.actions;
+
+
+import org.apache.directory.shared.asn1.ber.IAsn1Container;
+import org.apache.directory.shared.asn1.ber.grammar.GrammarAction;
+import org.apache.directory.shared.asn1.ber.tlv.TLV;
+import org.apache.directory.shared.asn1.codec.DecoderException;
+import org.apache.directory.shared.ldap.codec.LdapMessageContainer;
+import org.apache.directory.shared.ldap.codec.search.SearchRequest;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * The action used to store the attribute description
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class AttributeDescAction extends GrammarAction
+{
+    /** The logger */
+    private static final Logger log = LoggerFactory.getLogger( AttributeDescAction.class );
+
+    /** Speedup for logs */
+    private static final boolean IS_DEBUG = log.isDebugEnabled();
+
+    public AttributeDescAction()
+    {
+        super( "Store attribute description" );
+    }
+
+    /**
+     * The initialization action
+     */
+    public void action( IAsn1Container container ) throws DecoderException
+    {
+        LdapMessageContainer ldapMessageContainer = ( LdapMessageContainer ) container;
+
+        SearchRequest searchRequest = ldapMessageContainer.getLdapMessage().getSearchRequest();
+
+        TLV tlv = ldapMessageContainer.getCurrentTLV();
+        String attributeDescription = null;
+
+        byte[] value = null;
+
+        if ( tlv.getLength() == 0 )
+        {
+            value = new byte[]
+                { '*' };
+        }
+        else
+        {
+            value = tlv.getValue().getData();
+        }
+
+        attributeDescription = new String( value );
+        searchRequest.addAttribute( attributeDescription );
+
+        // We can have an END transition
+        ldapMessageContainer.grammarEndAllowed( true );
+
+        if ( IS_DEBUG )
+        {
+            log.debug( "Decoded Attribute Description : {}", attributeDescription );
+        }
+
+        return;
+    }
+}

Added: directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/ControlValueAction.java
URL: http://svn.apache.org/viewvc/directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/ControlValueAction.java?view=auto&rev=451836
==============================================================================
--- directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/ControlValueAction.java (added)
+++ directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/ControlValueAction.java Sun Oct  1 16:07:44 2006
@@ -0,0 +1,134 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.shared.ldap.codec.actions;
+
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.naming.NamingException;
+
+import org.apache.directory.shared.asn1.ber.IAsn1Container;
+import org.apache.directory.shared.asn1.ber.grammar.GrammarAction;
+import org.apache.directory.shared.asn1.ber.tlv.TLV;
+import org.apache.directory.shared.asn1.ber.tlv.Value;
+import org.apache.directory.shared.asn1.codec.DecoderException;
+import org.apache.directory.shared.ldap.codec.Control;
+import org.apache.directory.shared.ldap.codec.ControlDecoder;
+import org.apache.directory.shared.ldap.codec.LdapMessage;
+import org.apache.directory.shared.ldap.codec.LdapMessageContainer;
+import org.apache.directory.shared.ldap.codec.ManageDsaITControlDecoder;
+import org.apache.directory.shared.ldap.codec.search.controls.PSearchControlDecoder;
+import org.apache.directory.shared.ldap.codec.search.controls.SubEntryControlDecoder;
+import org.apache.directory.shared.ldap.util.StringTools;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * The action used to set the value of a control. This is an extension point
+ * where different controls can be plugged in (at least eventually). For now we
+ * hard code controls.
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class ControlValueAction extends GrammarAction
+{
+    /** The logger */
+    private static final Logger log = LoggerFactory.getLogger( ControlValueAction.class );
+
+    /** Speedup for logs */
+    private static final boolean IS_DEBUG = log.isDebugEnabled();
+
+    private static Map controlDecoders = new HashMap();
+
+
+    public ControlValueAction()
+    {
+        super( "Sets the control value" );
+
+        ControlDecoder decoder;
+        decoder = new PSearchControlDecoder();
+        controlDecoders.put( decoder.getControlType(), decoder );
+
+        decoder = new ManageDsaITControlDecoder();
+        controlDecoders.put( decoder.getControlType(), decoder );
+
+        decoder = new SubEntryControlDecoder();
+        controlDecoders.put( decoder.getControlType(), decoder );
+    }
+
+
+    public void action( IAsn1Container container ) throws DecoderException, NamingException
+    {
+        LdapMessageContainer ldapMessageContainer = ( LdapMessageContainer ) container;
+        TLV tlv = ldapMessageContainer.getCurrentTLV();
+        LdapMessage message = ldapMessageContainer.getLdapMessage();
+
+        // Get the current control
+        Control control = message.getCurrentControl();
+        Value value = tlv.getValue();
+
+        ControlDecoder decoder = ( ControlDecoder ) controlDecoders.get( control.getControlType() );
+
+        // Store the value - have to handle the special case of a 0 length value
+        if ( tlv.getLength() == 0 )
+        {
+            control.setControlValue( new byte[]
+                {} );
+        }
+        else
+        {
+            Object decoded;
+
+            if ( decoder != null )
+            {
+                decoded = decoder.decode( value.getData() );
+            }
+            else
+            {
+                decoded = value.getData();
+            }
+
+            control.setEncodedValue( value.getData() );
+            control.setControlValue( decoded );
+        }
+
+        // We can have an END transition
+        ldapMessageContainer.grammarEndAllowed( true );
+
+        if ( IS_DEBUG )
+        {
+            if ( control.getControlValue() instanceof byte[] )
+            {
+                log.debug( "Control value : " + StringTools.dumpBytes( ( byte[] ) control.getControlValue() ) );
+            }
+            else if ( control.getControlValue() instanceof String )
+            {
+                log.debug( "Control value : " + ( String ) control.getControlValue() );
+            }
+            else
+            {
+                log.debug( "Control value : " + control.getControlValue() );
+            }
+        }
+    }
+}

Added: directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/ControlsInitAction.java
URL: http://svn.apache.org/viewvc/directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/ControlsInitAction.java?view=auto&rev=451836
==============================================================================
--- directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/ControlsInitAction.java (added)
+++ directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/ControlsInitAction.java Sun Oct  1 16:07:44 2006
@@ -0,0 +1,81 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.shared.ldap.codec.actions;
+
+
+import org.apache.directory.shared.asn1.ber.IAsn1Container;
+import org.apache.directory.shared.asn1.ber.grammar.GrammarAction;
+import org.apache.directory.shared.asn1.ber.tlv.TLV;
+import org.apache.directory.shared.asn1.codec.DecoderException;
+import org.apache.directory.shared.ldap.codec.LdapMessage;
+import org.apache.directory.shared.ldap.codec.LdapMessageContainer;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * The action used to initialize a control.
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class ControlsInitAction extends GrammarAction
+{
+    /** The logger */
+    private static final Logger log = LoggerFactory.getLogger( ControlsInitAction.class );
+
+    /** Speedup for logs */
+    private static final boolean IS_DEBUG = log.isDebugEnabled();
+
+    public ControlsInitAction()
+    {
+        super( "Initialize a control" );
+    }
+
+    /**
+     * The initialization action
+     */
+    public void action( IAsn1Container container ) throws DecoderException
+    {
+
+        LdapMessageContainer ldapMessageContainer = ( LdapMessageContainer ) container;
+        LdapMessage message = ldapMessageContainer.getLdapMessage();
+
+        TLV tlv = ldapMessageContainer.getCurrentTLV();
+        int expectedLength = tlv.getLength();
+
+        // The Length should be null
+        if ( expectedLength == 0 )
+        {
+            log.error( "The length of controls must not be null" );
+            
+            // This will generate a PROTOCOL_ERROR
+            throw new DecoderException( "The length of controls must not be null" );
+        }
+        
+        if ( IS_DEBUG )
+        {
+            log.debug( "A new list of controls has been initialized" );
+        }
+        
+        // We can initialize the controls array
+        message.initControls();
+    }
+}

Added: directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/ErrorMessageAction.java
URL: http://svn.apache.org/viewvc/directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/ErrorMessageAction.java?view=auto&rev=451836
==============================================================================
--- directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/ErrorMessageAction.java (added)
+++ directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/ErrorMessageAction.java Sun Oct  1 16:07:44 2006
@@ -0,0 +1,89 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.shared.ldap.codec.actions;
+
+
+import org.apache.directory.shared.asn1.ber.IAsn1Container;
+import org.apache.directory.shared.asn1.ber.grammar.GrammarAction;
+import org.apache.directory.shared.asn1.ber.tlv.TLV;
+import org.apache.directory.shared.asn1.codec.DecoderException;
+import org.apache.directory.shared.ldap.codec.LdapMessage;
+import org.apache.directory.shared.ldap.codec.LdapMessageContainer;
+import org.apache.directory.shared.ldap.codec.LdapResponse;
+import org.apache.directory.shared.ldap.codec.LdapResult;
+import org.apache.directory.shared.ldap.util.StringTools;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * The action used to set the LdapResult error message.
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class ErrorMessageAction extends GrammarAction
+{
+    /** The logger */
+    private static final Logger log = LoggerFactory.getLogger( ErrorMessageAction.class );
+
+    /** Speedup for logs */
+    private static final boolean IS_DEBUG = log.isDebugEnabled();
+
+    public ErrorMessageAction()
+    {
+        super( "Store error message" );
+    }
+
+    /**
+     * The initialization action
+     */
+    public void action( IAsn1Container container ) throws DecoderException
+    {
+        LdapMessageContainer ldapMessageContainer = ( LdapMessageContainer ) container;
+        LdapMessage ldapMessage = ldapMessageContainer.getLdapMessage();
+        LdapResponse response = ldapMessage.getLdapResponse();
+        LdapResult ldapResult = response.getLdapResult();
+
+        // Get the Value and store it in the BindResponse
+        TLV tlv = ldapMessageContainer.getCurrentTLV();
+
+        // We have to handle the special case of a 0 length error
+        // message
+        if ( tlv.getLength() == 0 )
+        {
+            ldapResult.setErrorMessage( "" );
+        }
+        else
+        {
+            ldapResult.setErrorMessage( StringTools.utf8ToString( tlv.getValue().getData() ) );
+        }
+
+        // We can have an END transition
+        ldapMessageContainer.grammarEndAllowed( true );
+
+        if ( IS_DEBUG )
+        {
+            log.debug( "The error message is : " + ldapResult.getErrorMessage() );
+        }
+
+        return;
+    }
+}

Added: directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitAndFilterAction.java
URL: http://svn.apache.org/viewvc/directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitAndFilterAction.java?view=auto&rev=451836
==============================================================================
--- directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitAndFilterAction.java (added)
+++ directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitAndFilterAction.java Sun Oct  1 16:07:44 2006
@@ -0,0 +1,84 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.shared.ldap.codec.actions;
+
+
+import org.apache.directory.shared.asn1.ber.IAsn1Container;
+import org.apache.directory.shared.asn1.ber.grammar.GrammarAction;
+import org.apache.directory.shared.asn1.ber.tlv.TLV;
+import org.apache.directory.shared.asn1.codec.DecoderException;
+import org.apache.directory.shared.ldap.codec.LdapMessage;
+import org.apache.directory.shared.ldap.codec.LdapMessageContainer;
+import org.apache.directory.shared.ldap.codec.search.AndFilter;
+import org.apache.directory.shared.ldap.codec.search.Filter;
+import org.apache.directory.shared.ldap.codec.search.SearchRequest;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * The action used to initialize the AND filter
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class InitAndFilterAction extends GrammarAction
+{
+    /** The logger */
+    private static final Logger log = LoggerFactory.getLogger( InitAndFilterAction.class );
+
+    /** Speedup for logs */
+    private static final boolean IS_DEBUG = log.isDebugEnabled();
+
+    public InitAndFilterAction()
+    {
+        super( "Initialize AND filter" );
+    }
+
+    /**
+     * The initialization action
+     */
+    public void action( IAsn1Container container ) throws DecoderException
+    {
+        LdapMessageContainer ldapMessageContainer = ( LdapMessageContainer ) container;
+        LdapMessage ldapMessage = ldapMessageContainer.getLdapMessage();
+
+        TLV tlv = ldapMessageContainer.getCurrentTLV();
+
+        if ( tlv.getLength() == 0 )
+        {
+            log.error( "The And filter PDU must not be empty" );
+            throw new DecoderException( "The And filter PDU must not be empty" );
+        }
+
+        SearchRequest searchRequest = ldapMessage.getSearchRequest();
+
+        // We can allocate the SearchRequest
+        Filter andFilter = new AndFilter();
+
+        // Set the filter
+        searchRequest.addCurrentFilter( andFilter );
+        
+        if ( IS_DEBUG )
+        {
+            log.debug( "Initialize AND filter" );
+        }
+    }
+}

Added: directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitApproxMatchFilterAction.java
URL: http://svn.apache.org/viewvc/directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitApproxMatchFilterAction.java?view=auto&rev=451836
==============================================================================
--- directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitApproxMatchFilterAction.java (added)
+++ directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitApproxMatchFilterAction.java Sun Oct  1 16:07:44 2006
@@ -0,0 +1,75 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.shared.ldap.codec.actions;
+
+
+import org.apache.directory.shared.asn1.ber.IAsn1Container;
+import org.apache.directory.shared.asn1.ber.grammar.GrammarAction;
+import org.apache.directory.shared.asn1.codec.DecoderException;
+import org.apache.directory.shared.ldap.codec.LdapConstants;
+import org.apache.directory.shared.ldap.codec.LdapMessage;
+import org.apache.directory.shared.ldap.codec.LdapMessageContainer;
+import org.apache.directory.shared.ldap.codec.search.AttributeValueAssertionFilter;
+import org.apache.directory.shared.ldap.codec.search.Filter;
+import org.apache.directory.shared.ldap.codec.search.SearchRequest;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * The action used to initialize the Approx Match filter
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class InitApproxMatchFilterAction extends GrammarAction
+{
+    /** The logger */
+    private static final Logger log = LoggerFactory.getLogger( InitApproxMatchFilterAction.class );
+
+    /** Speedup for logs */
+    private static final boolean IS_DEBUG = log.isDebugEnabled();
+
+    public InitApproxMatchFilterAction()
+    {
+        super( "Init Approx Match filter Value" );
+    }
+
+    public void action( IAsn1Container container ) throws DecoderException
+    {
+        LdapMessageContainer ldapMessageContainer = ( LdapMessageContainer ) container;
+        LdapMessage ldapMessage = ldapMessageContainer.getLdapMessage();
+        SearchRequest searchRequest = ldapMessage.getSearchRequest();
+
+        // We can allocate the Attribute Value Assertion
+        Filter filter = new AttributeValueAssertionFilter( LdapConstants.APPROX_MATCH_FILTER );
+
+        searchRequest.addCurrentFilter( filter );
+        
+        // Store the filter structure that still has to be
+        // fullfiled
+        searchRequest.setTerminalFilter( filter );
+        
+        if ( IS_DEBUG )
+        {
+            log.debug( "Initialize Approx Match filter" );
+        }
+    }
+}

Added: directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitAssertionValueFilterAction.java
URL: http://svn.apache.org/viewvc/directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitAssertionValueFilterAction.java?view=auto&rev=451836
==============================================================================
--- directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitAssertionValueFilterAction.java (added)
+++ directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitAssertionValueFilterAction.java Sun Oct  1 16:07:44 2006
@@ -0,0 +1,97 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.shared.ldap.codec.actions;
+
+
+import org.apache.directory.shared.asn1.ber.IAsn1Container;
+import org.apache.directory.shared.asn1.ber.grammar.GrammarAction;
+import org.apache.directory.shared.asn1.ber.tlv.TLV;
+import org.apache.directory.shared.asn1.codec.DecoderException;
+import org.apache.directory.shared.ldap.codec.AttributeValueAssertion;
+import org.apache.directory.shared.ldap.codec.LdapMessage;
+import org.apache.directory.shared.ldap.codec.LdapMessageContainer;
+import org.apache.directory.shared.ldap.codec.search.AttributeValueAssertionFilter;
+import org.apache.directory.shared.ldap.codec.search.SearchRequest;
+import org.apache.directory.shared.ldap.util.StringTools;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * The action used to initialize the Assertion Value filter
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class InitAssertionValueFilterAction extends GrammarAction
+{
+    /** The logger */
+    private static final Logger log = LoggerFactory.getLogger( InitAssertionValueFilterAction.class );
+
+    /** Speedup for logs */
+    private static final boolean IS_DEBUG = log.isDebugEnabled();
+
+    public InitAssertionValueFilterAction()
+    {
+        super( "Initialize Assertion Value filter" );
+    }
+
+    /**
+     * The initialization action
+     */
+    public void action( IAsn1Container container ) throws DecoderException
+    {
+        LdapMessageContainer ldapMessageContainer = ( LdapMessageContainer ) container;
+        LdapMessage ldapMessage = ldapMessageContainer.getLdapMessage();
+        SearchRequest searchRequest = ldapMessage.getSearchRequest();
+
+        TLV tlv = ldapMessageContainer.getCurrentTLV();
+
+        // The value can be null.
+        Object assertionValue = StringTools.EMPTY_BYTES;
+
+        if ( tlv.getLength() != 0 )
+        {
+            assertionValue = tlv.getValue().getData();
+        }
+
+        AttributeValueAssertionFilter terminalFilter = ( AttributeValueAssertionFilter ) searchRequest
+            .getTerminalFilter();
+        AttributeValueAssertion assertion = terminalFilter.getAssertion();
+
+        if ( ldapMessageContainer.isBinary( assertion.getAttributeDesc() ) )
+        {
+            assertion.setAssertionValue( assertionValue );
+        }
+        else
+        {
+            assertion.setAssertionValue( StringTools.utf8ToString( ( byte[] ) assertionValue ) );
+        }
+
+        // We now have to get back to the nearest filter which is
+        // not terminal.
+        searchRequest.unstackFilters( container );
+
+        if ( IS_DEBUG )
+        {
+            log.debug( "Initialize Assertion Value filter" );
+        }
+    }
+}

Added: directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitAttributeDescFilterAction.java
URL: http://svn.apache.org/viewvc/directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitAttributeDescFilterAction.java?view=auto&rev=451836
==============================================================================
--- directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitAttributeDescFilterAction.java (added)
+++ directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitAttributeDescFilterAction.java Sun Oct  1 16:07:44 2006
@@ -0,0 +1,88 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.shared.ldap.codec.actions;
+
+
+import org.apache.directory.shared.asn1.ber.IAsn1Container;
+import org.apache.directory.shared.asn1.ber.grammar.GrammarAction;
+import org.apache.directory.shared.asn1.ber.tlv.TLV;
+import org.apache.directory.shared.asn1.codec.DecoderException;
+import org.apache.directory.shared.ldap.codec.AttributeValueAssertion;
+import org.apache.directory.shared.ldap.codec.LdapMessage;
+import org.apache.directory.shared.ldap.codec.LdapMessageContainer;
+import org.apache.directory.shared.ldap.codec.search.AttributeValueAssertionFilter;
+import org.apache.directory.shared.ldap.codec.search.SearchRequest;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * The action used to initialize the AttributeDesc filter
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class InitAttributeDescFilterAction extends GrammarAction
+{
+    /** The logger */
+    private static final Logger log = LoggerFactory.getLogger( InitAttributeDescFilterAction.class );
+
+    /** Speedup for logs */
+    private static final boolean IS_DEBUG = log.isDebugEnabled();
+
+    public InitAttributeDescFilterAction()
+    {
+        super( "Initialize AttributeDesc filter" );
+    }
+
+    /**
+     * The initialization action
+     */
+    public void action( IAsn1Container container ) throws DecoderException
+    {
+        LdapMessageContainer ldapMessageContainer = ( LdapMessageContainer ) container;
+        LdapMessage ldapMessage = ldapMessageContainer.getLdapMessage();
+        SearchRequest searchRequest = ldapMessage.getSearchRequest();
+
+        TLV tlv = ldapMessageContainer.getCurrentTLV();
+
+        AttributeValueAssertion assertion = new AttributeValueAssertion();
+
+        if ( tlv.getLength() == 0 )
+        {
+            log.error( "The attribute description is empty " );
+            throw new DecoderException( "The type can't be null" );
+        }
+        else
+        {
+            String type = new String( tlv.getValue().getData() );
+            assertion.setAttributeDesc( type );
+
+            AttributeValueAssertionFilter terminalFilter = ( AttributeValueAssertionFilter ) searchRequest
+                .getTerminalFilter();
+            terminalFilter.setAssertion( assertion );
+        }
+        
+        if ( IS_DEBUG )
+        {
+            log.debug( "Initialize AttributeDesc filter" );
+        }
+    }
+}

Added: directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitAttributeDescListAction.java
URL: http://svn.apache.org/viewvc/directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitAttributeDescListAction.java?view=auto&rev=451836
==============================================================================
--- directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitAttributeDescListAction.java (added)
+++ directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitAttributeDescListAction.java Sun Oct  1 16:07:44 2006
@@ -0,0 +1,65 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.shared.ldap.codec.actions;
+
+
+import org.apache.directory.shared.asn1.ber.IAsn1Container;
+import org.apache.directory.shared.asn1.ber.grammar.GrammarAction;
+import org.apache.directory.shared.asn1.codec.DecoderException;
+import org.apache.directory.shared.ldap.codec.LdapMessageContainer;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * The action used to initialize the AttributeDesc list
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class InitAttributeDescListAction extends GrammarAction
+{
+    /** The logger */
+    private static final Logger log = LoggerFactory.getLogger( InitAttributeDescListAction.class );
+
+    /** Speedup for logs */
+    private static final boolean IS_DEBUG = log.isDebugEnabled();
+
+    public InitAttributeDescListAction()
+    {
+        super( "Initialize AttributeDesc list" );
+    }
+
+    /**
+     * The initialization action
+     */
+    public void action( IAsn1Container container ) throws DecoderException
+    {
+        LdapMessageContainer ldapMessageContainer = ( LdapMessageContainer ) container;
+        
+        // We can have an END transition
+        ldapMessageContainer.grammarEndAllowed( true );
+
+        if ( IS_DEBUG )
+        {
+            log.debug( "Initialize AttributeDesc list" );
+        }
+    }
+}

Added: directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitEqualityMatchFilterAction.java
URL: http://svn.apache.org/viewvc/directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitEqualityMatchFilterAction.java?view=auto&rev=451836
==============================================================================
--- directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitEqualityMatchFilterAction.java (added)
+++ directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitEqualityMatchFilterAction.java Sun Oct  1 16:07:44 2006
@@ -0,0 +1,78 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.shared.ldap.codec.actions;
+
+
+import org.apache.directory.shared.asn1.ber.IAsn1Container;
+import org.apache.directory.shared.asn1.ber.grammar.GrammarAction;
+import org.apache.directory.shared.asn1.codec.DecoderException;
+import org.apache.directory.shared.ldap.codec.LdapConstants;
+import org.apache.directory.shared.ldap.codec.LdapMessage;
+import org.apache.directory.shared.ldap.codec.LdapMessageContainer;
+import org.apache.directory.shared.ldap.codec.search.AttributeValueAssertionFilter;
+import org.apache.directory.shared.ldap.codec.search.Filter;
+import org.apache.directory.shared.ldap.codec.search.SearchRequest;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * The action used to initialize the Equality Match filter
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class InitEqualityMatchFilterAction extends GrammarAction
+{
+    /** The logger */
+    private static final Logger log = LoggerFactory.getLogger( InitEqualityMatchFilterAction.class );
+
+    /** Speedup for logs */
+    private static final boolean IS_DEBUG = log.isDebugEnabled();
+
+    public InitEqualityMatchFilterAction()
+    {
+        super( "Initialize Equality Match filter" );
+    }
+
+    /**
+     * The initialization action
+     */
+    public void action( IAsn1Container container ) throws DecoderException
+    {
+        LdapMessageContainer ldapMessageContainer = ( LdapMessageContainer ) container;
+        LdapMessage ldapMessage = ldapMessageContainer.getLdapMessage();
+        SearchRequest searchRequest = ldapMessage.getSearchRequest();
+
+        // We can allocate the Attribute Value Assertion
+        Filter filter = new AttributeValueAssertionFilter( LdapConstants.EQUALITY_MATCH_FILTER );
+
+        searchRequest.addCurrentFilter( filter );
+        
+        // Store the filter structure that still has to be
+        // fullfiled
+        searchRequest.setTerminalFilter( filter );
+        
+        if ( IS_DEBUG )
+        {
+            log.debug( "Initialize Equality Match filter" );
+        }
+    }
+}

Added: directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitExtensibleMatchFilterAction.java
URL: http://svn.apache.org/viewvc/directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitExtensibleMatchFilterAction.java?view=auto&rev=451836
==============================================================================
--- directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitExtensibleMatchFilterAction.java (added)
+++ directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitExtensibleMatchFilterAction.java Sun Oct  1 16:07:44 2006
@@ -0,0 +1,71 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.shared.ldap.codec.actions;
+
+
+import org.apache.directory.shared.asn1.ber.IAsn1Container;
+import org.apache.directory.shared.asn1.ber.grammar.GrammarAction;
+import org.apache.directory.shared.asn1.codec.DecoderException;
+import org.apache.directory.shared.ldap.codec.LdapMessage;
+import org.apache.directory.shared.ldap.codec.LdapMessageContainer;
+import org.apache.directory.shared.ldap.codec.search.ExtensibleMatchFilter;
+import org.apache.directory.shared.ldap.codec.search.Filter;
+import org.apache.directory.shared.ldap.codec.search.SearchRequest;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * The action used to initialize the Extensible Match filter
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class InitExtensibleMatchFilterAction extends GrammarAction
+{
+    /** The logger */
+    private static final Logger log = LoggerFactory.getLogger( InitExtensibleMatchFilterAction.class );
+
+    /** Speedup for logs */
+    private static final boolean IS_DEBUG = log.isDebugEnabled();
+
+    public InitExtensibleMatchFilterAction()
+    {
+        super( "Init Extensible Match filter Value" );
+    }
+
+    public void action( IAsn1Container container ) throws DecoderException
+    {
+        LdapMessageContainer ldapMessageContainer = ( LdapMessageContainer ) container;
+        LdapMessage ldapMessage = ldapMessageContainer.getLdapMessage();
+        SearchRequest searchRequest = ldapMessage.getSearchRequest();
+
+        // We can allocate the ExtensibleMatch Filter
+        Filter extensibleMatchFilter = new ExtensibleMatchFilter();
+
+        searchRequest.addCurrentFilter( extensibleMatchFilter );
+        searchRequest.setTerminalFilter( extensibleMatchFilter );
+        
+        if ( IS_DEBUG )
+        {
+            log.debug( "Initialize Extensible Match filter" );
+        }
+    }
+}

Added: directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitGreaterOrEqualFilterAction.java
URL: http://svn.apache.org/viewvc/directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitGreaterOrEqualFilterAction.java?view=auto&rev=451836
==============================================================================
--- directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitGreaterOrEqualFilterAction.java (added)
+++ directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitGreaterOrEqualFilterAction.java Sun Oct  1 16:07:44 2006
@@ -0,0 +1,78 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.shared.ldap.codec.actions;
+
+
+import org.apache.directory.shared.asn1.ber.IAsn1Container;
+import org.apache.directory.shared.asn1.ber.grammar.GrammarAction;
+import org.apache.directory.shared.asn1.codec.DecoderException;
+import org.apache.directory.shared.ldap.codec.LdapConstants;
+import org.apache.directory.shared.ldap.codec.LdapMessage;
+import org.apache.directory.shared.ldap.codec.LdapMessageContainer;
+import org.apache.directory.shared.ldap.codec.search.AttributeValueAssertionFilter;
+import org.apache.directory.shared.ldap.codec.search.Filter;
+import org.apache.directory.shared.ldap.codec.search.SearchRequest;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * The action used to initialize the Greater Or Equal filter
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class InitGreaterOrEqualFilterAction extends GrammarAction
+{
+    /** The logger */
+    private static final Logger log = LoggerFactory.getLogger( InitGreaterOrEqualFilterAction.class );
+
+    /** Speedup for logs */
+    private static final boolean IS_DEBUG = log.isDebugEnabled();
+
+    public InitGreaterOrEqualFilterAction()
+    {
+        super( "Initialize Greater Or Equal filter" );
+    }
+
+    /**
+     * The initialization action
+     */
+    public void action( IAsn1Container container ) throws DecoderException
+    {
+        LdapMessageContainer ldapMessageContainer = ( LdapMessageContainer ) container;
+        LdapMessage ldapMessage = ldapMessageContainer.getLdapMessage();
+        SearchRequest searchRequest = ldapMessage.getSearchRequest();
+
+        // We can allocate the Attribute Value Assertion
+        Filter filter = new AttributeValueAssertionFilter( LdapConstants.GREATER_OR_EQUAL_FILTER );
+
+        searchRequest.addCurrentFilter( filter );
+        
+        // Store the filter structure that still has to be
+        // fullfiled
+        searchRequest.setTerminalFilter( filter );
+        
+        if ( IS_DEBUG )
+        {
+            log.debug( "Initialize Greater Or Equal filter" );
+        }
+    }
+}

Added: directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitLessOrEqualFilterAction.java
URL: http://svn.apache.org/viewvc/directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitLessOrEqualFilterAction.java?view=auto&rev=451836
==============================================================================
--- directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitLessOrEqualFilterAction.java (added)
+++ directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitLessOrEqualFilterAction.java Sun Oct  1 16:07:44 2006
@@ -0,0 +1,78 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.shared.ldap.codec.actions;
+
+
+import org.apache.directory.shared.asn1.ber.IAsn1Container;
+import org.apache.directory.shared.asn1.ber.grammar.GrammarAction;
+import org.apache.directory.shared.asn1.codec.DecoderException;
+import org.apache.directory.shared.ldap.codec.LdapConstants;
+import org.apache.directory.shared.ldap.codec.LdapMessage;
+import org.apache.directory.shared.ldap.codec.LdapMessageContainer;
+import org.apache.directory.shared.ldap.codec.search.AttributeValueAssertionFilter;
+import org.apache.directory.shared.ldap.codec.search.Filter;
+import org.apache.directory.shared.ldap.codec.search.SearchRequest;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * The action used to initialize the Less Or Equal filter
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class InitLessOrEqualFilterAction extends GrammarAction
+{
+    /** The logger */
+    private static final Logger log = LoggerFactory.getLogger( InitLessOrEqualFilterAction.class );
+
+    /** Speedup for logs */
+    private static final boolean IS_DEBUG = log.isDebugEnabled();
+
+    public InitLessOrEqualFilterAction()
+    {
+        super( "Initialize Less Or Equal filter" );
+    }
+
+    /**
+     * The initialization action
+     */
+    public void action( IAsn1Container container ) throws DecoderException
+    {
+        LdapMessageContainer ldapMessageContainer = ( LdapMessageContainer ) container;
+        LdapMessage ldapMessage = ldapMessageContainer.getLdapMessage();
+        SearchRequest searchRequest = ldapMessage.getSearchRequest();
+
+        // We can allocate the Attribute Value Assertion
+        Filter filter = new AttributeValueAssertionFilter( LdapConstants.LESS_OR_EQUAL_FILTER );
+
+        searchRequest.addCurrentFilter( filter );
+        
+        // Store the filter structure that still has to be
+        // fullfiled
+        searchRequest.setTerminalFilter( filter );
+        
+        if ( IS_DEBUG )
+        {
+            log.debug( "Initialize Less Or Equal filter" );
+        }
+    }
+}

Added: directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitNotFilterAction.java
URL: http://svn.apache.org/viewvc/directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitNotFilterAction.java?view=auto&rev=451836
==============================================================================
--- directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitNotFilterAction.java (added)
+++ directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitNotFilterAction.java Sun Oct  1 16:07:44 2006
@@ -0,0 +1,84 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.shared.ldap.codec.actions;
+
+
+import org.apache.directory.shared.asn1.ber.IAsn1Container;
+import org.apache.directory.shared.asn1.ber.grammar.GrammarAction;
+import org.apache.directory.shared.asn1.ber.tlv.TLV;
+import org.apache.directory.shared.asn1.codec.DecoderException;
+import org.apache.directory.shared.ldap.codec.LdapMessage;
+import org.apache.directory.shared.ldap.codec.LdapMessageContainer;
+import org.apache.directory.shared.ldap.codec.search.Filter;
+import org.apache.directory.shared.ldap.codec.search.NotFilter;
+import org.apache.directory.shared.ldap.codec.search.SearchRequest;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * The action used to initialize the NOT filter
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class InitNotFilterAction extends GrammarAction
+{
+    /** The logger */
+    private static final Logger log = LoggerFactory.getLogger( InitNotFilterAction.class );
+
+    /** Speedup for logs */
+    private static final boolean IS_DEBUG = log.isDebugEnabled();
+
+    public InitNotFilterAction()
+    {
+        super( "Initialize NOT filter" );
+    }
+
+    /**
+     * The initialization action
+     */
+    public void action( IAsn1Container container ) throws DecoderException
+    {
+        LdapMessageContainer ldapMessageContainer = ( LdapMessageContainer ) container;
+        LdapMessage ldapMessage = ldapMessageContainer.getLdapMessage();
+
+        TLV tlv = ldapMessageContainer.getCurrentTLV();
+
+        if ( tlv.getLength() == 0 )
+        {
+            log.error( "The Not filter PDU must not be empty" );
+            throw new DecoderException( "The Not filter PDU must not be empty" );
+        }
+
+        SearchRequest searchRequest = ldapMessage.getSearchRequest();
+
+        // We can allocate the SearchRequest
+        Filter notFilter = new NotFilter();
+
+        // Set the filter
+        searchRequest.addCurrentFilter( notFilter );
+        
+        if ( IS_DEBUG )
+        {
+            log.debug( "Initialize NOT filter" );
+        }
+    }
+}

Added: directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitOrFilterAction.java
URL: http://svn.apache.org/viewvc/directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitOrFilterAction.java?view=auto&rev=451836
==============================================================================
--- directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitOrFilterAction.java (added)
+++ directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitOrFilterAction.java Sun Oct  1 16:07:44 2006
@@ -0,0 +1,84 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.shared.ldap.codec.actions;
+
+
+import org.apache.directory.shared.asn1.ber.IAsn1Container;
+import org.apache.directory.shared.asn1.ber.grammar.GrammarAction;
+import org.apache.directory.shared.asn1.ber.tlv.TLV;
+import org.apache.directory.shared.asn1.codec.DecoderException;
+import org.apache.directory.shared.ldap.codec.LdapMessage;
+import org.apache.directory.shared.ldap.codec.LdapMessageContainer;
+import org.apache.directory.shared.ldap.codec.search.Filter;
+import org.apache.directory.shared.ldap.codec.search.OrFilter;
+import org.apache.directory.shared.ldap.codec.search.SearchRequest;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * The action used to initialize the OR filter
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class InitOrFilterAction extends GrammarAction
+{
+    /** The logger */
+    private static final Logger log = LoggerFactory.getLogger( InitOrFilterAction.class );
+
+    /** Speedup for logs */
+    private static final boolean IS_DEBUG = log.isDebugEnabled();
+
+    public InitOrFilterAction()
+    {
+        super( "Initialize OR filter" );
+    }
+
+    /**
+     * The initialization action
+     */
+    public void action( IAsn1Container container ) throws DecoderException
+    {
+        LdapMessageContainer ldapMessageContainer = ( LdapMessageContainer ) container;
+        LdapMessage ldapMessage = ldapMessageContainer.getLdapMessage();
+
+        TLV tlv = ldapMessageContainer.getCurrentTLV();
+
+        if ( tlv.getLength() == 0 )
+        {
+            log.error( "The Or filter PDU must not be empty" );
+            throw new DecoderException( "The Or filter PDU must not be empty" );
+        }
+
+        SearchRequest searchRequest = ldapMessage.getSearchRequest();
+
+        // We can allocate the SearchRequest
+        Filter orFilter = new OrFilter();
+
+        // Set the filter
+        searchRequest.addCurrentFilter( orFilter );
+        
+        if ( IS_DEBUG )
+        {
+            log.debug( "Initialize OR filter" );
+        }
+    }
+}

Added: directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitPresentFilterAction.java
URL: http://svn.apache.org/viewvc/directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitPresentFilterAction.java?view=auto&rev=451836
==============================================================================
--- directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitPresentFilterAction.java (added)
+++ directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitPresentFilterAction.java Sun Oct  1 16:07:44 2006
@@ -0,0 +1,92 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.shared.ldap.codec.actions;
+
+
+import org.apache.directory.shared.asn1.ber.IAsn1Container;
+import org.apache.directory.shared.asn1.ber.grammar.GrammarAction;
+import org.apache.directory.shared.asn1.ber.tlv.TLV;
+import org.apache.directory.shared.asn1.codec.DecoderException;
+import org.apache.directory.shared.ldap.codec.LdapMessage;
+import org.apache.directory.shared.ldap.codec.LdapMessageContainer;
+import org.apache.directory.shared.ldap.codec.search.PresentFilter;
+import org.apache.directory.shared.ldap.codec.search.SearchRequest;
+import org.apache.directory.shared.ldap.util.StringTools;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * The action used to initialize the Present filter
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class InitPresentFilterAction extends GrammarAction
+{
+    /** The logger */
+    private static final Logger log = LoggerFactory.getLogger( InitPresentFilterAction.class );
+
+    /** Speedup for logs */
+    private static final boolean IS_DEBUG = log.isDebugEnabled();
+
+    public InitPresentFilterAction()
+    {
+        super( "Init present filter Value" );
+    }
+
+    public void action( IAsn1Container container ) throws DecoderException
+    {
+        LdapMessageContainer ldapMessageContainer = ( LdapMessageContainer ) container;
+        LdapMessage ldapMessage = ldapMessageContainer.getLdapMessage();
+        SearchRequest searchRequest = ldapMessage.getSearchRequest();
+
+        TLV tlv = ldapMessageContainer.getCurrentTLV();
+
+        // We can allocate the Attribute Value Assertion
+        PresentFilter presentFilter = new PresentFilter();
+
+        // add the filter to the request filter
+        searchRequest.addCurrentFilter( presentFilter );
+        searchRequest.setTerminalFilter( presentFilter );
+
+        String value = StringTools.utf8ToString( tlv.getValue().getData() );
+
+        if ( StringTools.isEmpty( value ) )
+        {
+            presentFilter.setAttributeDescription( "" );
+        }
+        else
+        {
+            // Store the value.
+            String type = StringTools.utf8ToString( tlv.getValue().getData() );
+            presentFilter.setAttributeDescription( type );
+        }
+
+        // We now have to get back to the nearest filter which is
+        // not terminal.
+        searchRequest.unstackFilters( container );
+        
+        if ( IS_DEBUG )
+        {
+            log.debug( "Initialize Present filter" );
+        }
+    }
+}

Added: directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitReferralsAction.java
URL: http://svn.apache.org/viewvc/directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitReferralsAction.java?view=auto&rev=451836
==============================================================================
--- directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitReferralsAction.java (added)
+++ directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitReferralsAction.java Sun Oct  1 16:07:44 2006
@@ -0,0 +1,84 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.shared.ldap.codec.actions;
+
+
+import org.apache.directory.shared.asn1.ber.IAsn1Container;
+import org.apache.directory.shared.asn1.ber.grammar.GrammarAction;
+import org.apache.directory.shared.asn1.ber.tlv.TLV;
+import org.apache.directory.shared.asn1.codec.DecoderException;
+import org.apache.directory.shared.ldap.codec.LdapMessage;
+import org.apache.directory.shared.ldap.codec.LdapMessageContainer;
+import org.apache.directory.shared.ldap.codec.LdapResponse;
+import org.apache.directory.shared.ldap.codec.LdapResult;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * The action used to init referrals to a LdapTresult
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class InitReferralsAction extends GrammarAction
+{
+    /** The logger */
+    private static final Logger log = LoggerFactory.getLogger( InitReferralsAction.class );
+
+    /** Speedup for logs */
+    private static final boolean IS_DEBUG = log.isDebugEnabled();
+
+    public InitReferralsAction()
+    {
+        super( "Init the referrals list" );
+    }
+
+    /**
+     * The initialization action
+     */
+    public void action( IAsn1Container container ) throws DecoderException
+    {
+        LdapMessageContainer ldapMessageContainer = ( LdapMessageContainer ) container;
+        LdapMessage ldapMessage = ldapMessageContainer.getLdapMessage();
+        LdapResponse response = ldapMessage.getLdapResponse();
+        LdapResult ldapResult = response.getLdapResult();
+        
+        TLV tlv = ldapMessageContainer.getCurrentTLV();
+
+        // If we hae a Referrals sequence, then it should not be empty
+        // sasl credentials
+        if ( tlv.getLength() == 0 )
+        {
+            String msg = "The Referrals must not be null";
+            log.error( msg );
+         
+            // This will generate a PROTOCOL_ERROR
+            throw new DecoderException( msg );
+        }
+
+        if ( IS_DEBUG)
+        {
+            log.debug( "Initialising a referrals list" );
+        }
+        
+        ldapResult.initReferrals();
+    }
+}

Added: directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitSubstringsFilterAction.java
URL: http://svn.apache.org/viewvc/directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitSubstringsFilterAction.java?view=auto&rev=451836
==============================================================================
--- directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitSubstringsFilterAction.java (added)
+++ directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitSubstringsFilterAction.java Sun Oct  1 16:07:44 2006
@@ -0,0 +1,91 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.shared.ldap.codec.actions;
+
+
+import org.apache.directory.shared.asn1.ber.IAsn1Container;
+import org.apache.directory.shared.asn1.ber.grammar.GrammarAction;
+import org.apache.directory.shared.asn1.ber.tlv.TLV;
+import org.apache.directory.shared.asn1.codec.DecoderException;
+import org.apache.directory.shared.ldap.codec.LdapMessage;
+import org.apache.directory.shared.ldap.codec.LdapMessageContainer;
+import org.apache.directory.shared.ldap.codec.search.Filter;
+import org.apache.directory.shared.ldap.codec.search.SearchRequest;
+import org.apache.directory.shared.ldap.codec.search.SubstringFilter;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * The action used to initialize the Substrings filter
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class InitSubstringsFilterAction extends GrammarAction
+{
+    /** The logger */
+    private static final Logger log = LoggerFactory.getLogger( InitSubstringsFilterAction.class );
+
+    /** Speedup for logs */
+    private static final boolean IS_DEBUG = log.isDebugEnabled();
+
+    public InitSubstringsFilterAction()
+    {
+        super( "Initialize Substrings filter" );
+    }
+
+    /**
+     * The initialization action
+     */
+    public void action( IAsn1Container container ) throws DecoderException
+    {
+        LdapMessageContainer ldapMessageContainer = ( LdapMessageContainer ) container;
+        LdapMessage ldapMessage = ldapMessageContainer.getLdapMessage();
+        SearchRequest searchRequest = ldapMessage.getSearchRequest();
+
+        TLV tlv = ldapMessageContainer.getCurrentTLV();
+
+        int expectedLength = tlv.getLength();
+
+        if ( expectedLength == 0 )
+        {
+            log.error( "The Substring filter PDU must not be empty" );
+            throw new DecoderException( "The Substring filter PDU must not be empty" );
+        }
+
+        // We can allocate the SearchRequest
+        Filter substringFilter = new SubstringFilter();
+
+        searchRequest.addCurrentFilter( substringFilter );
+        searchRequest.setTerminalFilter( substringFilter );
+
+        // As this is a new Constructed object, we have to init its
+        // length
+
+        substringFilter.setExpectedLength( expectedLength );
+        substringFilter.setCurrentLength( 0 );
+        
+        if ( IS_DEBUG )
+        {
+            log.debug( "Initialize Substrings filter" );
+        }
+    }
+}



Mime
View raw message