Return-Path: Delivered-To: apmail-directory-commits-archive@www.apache.org Received: (qmail 30098 invoked from network); 9 Jun 2005 22:53:34 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 9 Jun 2005 22:53:34 -0000 Received: (qmail 83814 invoked by uid 500); 9 Jun 2005 22:53:34 -0000 Delivered-To: apmail-directory-commits-archive@directory.apache.org Received: (qmail 83774 invoked by uid 500); 9 Jun 2005 22:53:33 -0000 Mailing-List: contact commits-help@directory.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@directory.apache.org Delivered-To: mailing list commits@directory.apache.org Received: (qmail 83761 invoked by uid 99); 9 Jun 2005 22:53:33 -0000 X-ASF-Spam-Status: No, hits=-9.8 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from minotaur.apache.org (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.28) with SMTP; Thu, 09 Jun 2005 15:53:31 -0700 Received: (qmail 30072 invoked by uid 65534); 9 Jun 2005 22:53:25 -0000 Message-ID: <20050609225325.30071.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Subject: svn commit: r189845 - /directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/codec/grammars/SearchRequestGrammar.java Date: Thu, 09 Jun 2005 22:53:25 -0000 To: commits@directory.apache.org From: elecharny@apache.org X-Mailer: svnmailer-1.0.0-dev X-Virus-Checked: Checked X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: elecharny Date: Thu Jun 9 15:53:24 2005 New Revision: 189845 URL: http://svn.apache.org/viewcvs?rev=3D189845&view=3Drev Log: Added the last two grammar productions, the ones that we have after the Fil= ter in LDAP grammar Modified: directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/co= dec/grammars/SearchRequestGrammar.java Modified: directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/l= dap/codec/grammars/SearchRequestGrammar.java URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/asn1-new-codec/s= rc/java/org/apache/asn1/ldap/codec/grammars/SearchRequestGrammar.java?rev= =3D189845&r1=3D189844&r2=3D189845&view=3Ddiff =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/co= dec/grammars/SearchRequestGrammar.java (original) +++ directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/co= dec/grammars/SearchRequestGrammar.java Thu Jun 9 15:53:24 2005 @@ -16,6 +16,8 @@ */ package org.apache.asn1.ldap.codec.grammars; =20 +import java.util.ArrayList; + import org.apache.asn1.DecoderException; import org.apache.asn1.ber.containers.IAsn1Container; import org.apache.asn1.ber.grammar.AbstractGrammar; @@ -27,6 +29,7 @@ import org.apache.asn1.ldap.codec.LdapConstants; import org.apache.asn1.ldap.codec.LdapMessageContainer; import org.apache.asn1.ldap.codec.primitives.LdapDN; +import org.apache.asn1.ldap.codec.primitives.LdapString; import org.apache.asn1.ldap.codec.utils.IntegerDecoder; import org.apache.asn1.ldap.pojo.LdapMessage; import org.apache.asn1.ldap.pojo.SearchRequest; @@ -705,6 +708,126 @@ LdapStatesEnum.SEARCH_REQUEST_FILTER, LdapStatesEnum.FILTE= R_GRAMMAR_SWITCH, null ); =20 + + // ... + // attributes AttributeDescriptionList } + // AttributeDescriptionList ::=3D SEQUENCE OF AttributeDescription= (Tag) + // ... + // We have to check that the filter has been created. + super.transitions[LdapStatesEnum.SEARCH_REQUEST_FILTER][0x30] =3D = new GrammarTransition( + LdapStatesEnum.SEARCH_REQUEST_FILTER, LdapStatesEnum.SEARC= H_REQUEST_ATTRIBUTE_DESCRIPTION_LIST_LENGTH, + null); + =20 + // ... + // attributes AttributeDescriptionList } + // AttributeDescriptionList ::=3D SEQUENCE OF AttributeDescription= (Length) + // ... + // We have to check the length + super.transitions[LdapStatesEnum.SEARCH_REQUEST_ATTRIBUTE_DESCRIPT= ION_LIST_LENGTH][0x30] =3D + new GrammarTransition( LdapStatesEnum.SEARCH_REQUEST_ATTRIBUTE= _DESCRIPTION_LIST_LENGTH, + LdapStatesEnum.SEARCH_REQUEST_ATTRIBUTE_DESCRIPTION_LIST_V= ALUE, + new GrammarAction( "Check Attribute Description list lengt= h" ) + { + public void action( IAsn1Container container ) throws = DecoderException + { + + LdapMessageContainer ldapMessageContainer =3D ( Ld= apMessageContainer ) + container; + + SearchRequest searchRequest =3D + ldapMessageContainer.getLdapMessage().getSearc= hRequest(); + + TLV tlv =3D ldapMessageContainer.= getCurrentTLV(); + + checkLength( searchRequest, tlv ); + return; + } + } ); + =20 + // ... + // attributes AttributeDescriptionList } + // AttributeDescriptionList ::=3D SEQUENCE OF AttributeDescription= (Length) + // ... + // We have to create an array of elements to store the list of att= ributes + // to retrieve. We don't know yet how many attributes we will read. + super.transitions[LdapStatesEnum.SEARCH_REQUEST_ATTRIBUTE_DESCRIPT= ION_LIST_VALUE][0x30] =3D + new GrammarTransition( LdapStatesEnum.SEARCH_REQUEST_ATTRIBUTE= _DESCRIPTION_LIST_VALUE, + LdapStatesEnum.SEARCH_REQUEST_ATTRIBUTE_DESCRIPTION_TAG, + new GrammarAction( "store Attribute Description List value= " ) + { + public void action( IAsn1Container container ) throws = DecoderException + { + + LdapMessageContainer ldapMessageContainer =3D ( Ld= apMessageContainer ) + container; + + SearchRequest searchRequest =3D + ldapMessageContainer.getLdapMessage().getSearc= hRequest(); + + searchRequest.setAttributes( new ArrayList() ); + + return; + } + } ); + =20 + // AttributeDescription ::=3D LDAPString + // Nothing to do. + super.transitions[LdapStatesEnum.SEARCH_REQUEST_ATTRIBUTE_DESCRIPT= ION_TAG][0x04] =3D new GrammarTransition( + LdapStatesEnum.SEARCH_REQUEST_ATTRIBUTE_DESCRIPTION_TAG, L= dapStatesEnum.SEARCH_REQUEST_ATTRIBUTE_DESCRIPTION_LENGTH, + null); + =20 + // AttributeDescription ::=3D LDAPString + // We have to check the length + super.transitions[LdapStatesEnum.SEARCH_REQUEST_ATTRIBUTE_DESCRIPT= ION_LENGTH][0x04] =3D + new GrammarTransition( LdapStatesEnum.SEARCH_REQUEST_ATTRIBUTE= _DESCRIPTION_LENGTH, + LdapStatesEnum.SEARCH_REQUEST_ATTRIBUTE_DESCRIPTION_VALUE, + new GrammarAction( "Check Attribute Description length" ) + { + public void action( IAsn1Container container ) throws = DecoderException + { + + LdapMessageContainer ldapMessageContainer =3D ( Ld= apMessageContainer ) + container; + + SearchRequest searchRequest =3D + ldapMessageContainer.getLdapMessage().getSearc= hRequest(); + + TLV tlv =3D ldapMessageContainer.= getCurrentTLV(); + + // checkLength( searchRequest, tlv ); + // TODO : Fix the check, as we need to check lengt= h against the SEQ OF. + return; + } + } ); + =20 + // ... + // attributes AttributeDescriptionList } + // AttributeDescriptionList ::=3D SEQUENCE OF AttributeDescription= (Length) + // ... + // We have to create an array of elements to store the list of att= ributes + // to retrieve. We don't know yet how many attributes we will read. + super.transitions[LdapStatesEnum.SEARCH_REQUEST_ATTRIBUTE_DESCRIPT= ION_VALUE][0x04] =3D + new GrammarTransition( LdapStatesEnum.SEARCH_REQUEST_ATTRIBUTE= _DESCRIPTION_VALUE, + LdapStatesEnum.SEARCH_REQUEST_ATTRIBUTE_DESCRIPTION_TAG, + new GrammarAction( "store Attribute Description value" ) + { + public void action( IAsn1Container container ) throws = DecoderException + { + + LdapMessageContainer ldapMessageContainer =3D ( Ld= apMessageContainer ) + container; + + SearchRequest searchRequest =3D + ldapMessageContainer.getLdapMessage().getSearc= hRequest(); + + TLV tlv =3D ldapMessageContainer.= getCurrentTLV(); + =20 + searchRequest.addAttribute( LdapString.parse(tlv.g= etValue().getData())); + + return; + } + } ); + =20 } =20 //~ Methods ----------------------------------------------------------= --------------------------