From commits-return-4888-apmail-directory-commits-archive=directory.apache.org@directory.apache.org Mon Jun 06 22:24:23 2005 Return-Path: Delivered-To: apmail-directory-commits-archive@www.apache.org Received: (qmail 171 invoked from network); 6 Jun 2005 22:24:22 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 6 Jun 2005 22:24:22 -0000 Received: (qmail 10000 invoked by uid 500); 6 Jun 2005 22:24:20 -0000 Delivered-To: apmail-directory-commits-archive@directory.apache.org Received: (qmail 9976 invoked by uid 500); 6 Jun 2005 22:24:20 -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 9957 invoked by uid 99); 6 Jun 2005 22:24:19 -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; Mon, 06 Jun 2005 15:24:14 -0700 Received: (qmail 108 invoked by uid 65534); 6 Jun 2005 22:24:04 -0000 Message-ID: <20050606222404.99991.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Subject: svn commit: r185064 - /directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/codec/grammars/ModifyDNResponseGrammar.java Date: Mon, 06 Jun 2005 22:24:04 -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: Mon Jun 6 15:24:04 2005 New Revision: 185064 URL: http://svn.apache.org/viewcvs?rev=3D185064&view=3Drev Log: Added the ModifyDNResponse grammar Added: directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/co= dec/grammars/ModifyDNResponseGrammar.java Added: directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap= /codec/grammars/ModifyDNResponseGrammar.java URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/asn1-new-codec/s= rc/java/org/apache/asn1/ldap/codec/grammars/ModifyDNResponseGrammar.java?re= v=3D185064&view=3Dauto =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/ModifyDNResponseGrammar.java (added) +++ directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/co= dec/grammars/ModifyDNResponseGrammar.java Mon Jun 6 15:24:04 2005 @@ -0,0 +1,132 @@ +/* + * Copyright 2005 The Apache Software Foundation + * + * Licensed 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 impli= ed. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +package org.apache.asn1.ldap.codec.grammars; + +import org.apache.asn1.DecoderException; +import org.apache.asn1.ber.containers.IAsn1Container; +import org.apache.asn1.ber.grammar.AbstractGrammar; +import org.apache.asn1.ber.grammar.GrammarAction; +import org.apache.asn1.ber.grammar.GrammarTransition; +import org.apache.asn1.ber.grammar.IGrammar; +import org.apache.asn1.ber.tlv.TLV; +import org.apache.asn1.ldap.codec.LdapMessageContainer; +import org.apache.asn1.ldap.pojo.LdapMessagePOJO; +import org.apache.asn1.ldap.pojo.ModifyDNResponsePOJO; + +import org.apache.log4j.Logger; + + +/** + * This class implements the ModifyDNResponse LDAP message. All the action= s are declared in this + * class. As it is a singleton, these declaration are only done once. + *=20 + * @author Apache Directory Pr= oject + */ +public class ModifyDNResponseGrammar extends AbstractGrammar implements IG= rammar +{ + //~ Static fields/initializers ---------------------------------------= -------------------------- + + /** The logger */ + private static final Logger log =3D Logger.getLogger( ModifyDNResponse= Grammar.class ); + + /** Logging speed up */ + private static final boolean DEBUG =3D log.isDebugEnabled(); + + /** The instance of grammar. ModifyDNResponseGrammar is a singleton */ + private static IGrammar instance =3D new ModifyDNResponseGrammar(); + + //~ Constructors -----------------------------------------------------= -------------------------- + + /** + * Creates a new ModifyDNResponseGrammar object. + */ + private ModifyDNResponseGrammar() + { + name =3D ModifyDNResponseGrammar.class.getName(); + statesEnum =3D LdapStatesEnum.getInstance(); + + // Intitialisation + super.transitions =3D new GrammarTransition[LdapStatesEnum.LAST_MO= DIFY_DN_RESPONSE_STATE][256]; + + //=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=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + // ModifyDNResponse Message + //=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=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + // LdapMessage ::=3D ... ModifyDNResponse ... + // ModifyDNResponse ::=3D [APPLICATION 13] LDAPResult (Tag) + // Nothing to do. + super.transitions[LdapStatesEnum.MODIFY_RESPONSE_TAG][0x6D] =3D ne= w GrammarTransition( + LdapStatesEnum.MODIFY_RESPONSE_TAG, LdapStatesEnum.MODIFY_= RESPONSE_LENGTH, null ); + + // We have to allocate a ModifyDNResponsePOJO + // LdapMessage ::=3D ... ModifyResponse ... + // ModifyDNResponse ::=3D [APPLICATION 13] LDAPResult (Length) + super.transitions[LdapStatesEnum.MODIFY_DN_RESPONSE_LENGTH][0x6D] = =3D new GrammarTransition( + LdapStatesEnum.MODIFY_DN_RESPONSE_LENGTH, LdapStatesEnum.M= ODIFY_DN_RESPONSE_VALUE, + new GrammarAction( "Init ModifyDNResponse" ) + { + public void action( IAsn1Container container ) throws = DecoderException + { + + LdapMessageContainer ldapMessageContainer =3D ( Ld= apMessageContainer ) + container; + LdapMessagePOJO ldapMessage =3D + ldapMessageContainer.getLdapMessage(); + + checkLength( ldapMessageContainer.getLdapMessage(), + ldapMessageContainer.getCurrentTLV() ); + + // Now, we can allocate the ModifyDNResponse POJO + ModifyDNResponsePOJO modifyDNResponse =3D new Modi= fyDNResponsePOJO(); + + // As this is a new Constructed object, we have to= init its length + TLV tlv =3D ldapMessageContainer.getCur= rentTLV(); + int expectedLength =3D tlv.getLength().getLength(); + modifyDNResponse.setExpectedLength( expectedLength= ); + modifyDNResponse.setCurrentLength( 0 ); + modifyDNResponse.setFather( ldapMessage ); + + // And we associate it to the ldapMessage POJO + ldapMessage.setProtocolOP( modifyDNResponse ); + } + } ); + + // LdapMessage ::=3D ... ModifyDNResponse ... + // ModifyDNResponse ::=3D [APPLICATION 13] LDAPResult (Value) + // The next Tag will be the LDAPResult Tag (0x0A). + // We will switch the grammar then. + super.transitions[LdapStatesEnum.MODIFY_DN_RESPONSE_VALUE][0x6D] = =3D new GrammarTransition( + LdapStatesEnum.MODIFY_DN_RESPONSE_VALUE, LdapStatesEnum.MO= DIFY_DN_RESPONSE_LDAP_RESULT, null ); + + // LdapMessage ::=3D ... ModifyDNResponse ... + // ModifyDNResponse ::=3D [APPLICATION 13] LDAPResult (Value) + // Ok, we have a LDAPResult Tag (0x0A). So we have to switch the g= rammar. + super.transitions[LdapStatesEnum.MODIFY_DN_RESPONSE_LDAP_RESULT][0= x0A] =3D new GrammarTransition( + LdapStatesEnum.MODIFY_DN_RESPONSE_LDAP_RESULT, LdapStatesE= num.LDAP_RESULT_GRAMMAR_SWITCH, null ); + } + + //~ Methods ----------------------------------------------------------= -------------------------- + + /** + * Get the instance of this grammar + * + * @return An instance on the LdapMessage Grammar + */ + public static IGrammar getInstance() + { + return instance; + } +}