You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2005/08/21 18:54:00 UTC
svn commit: r234264 [2/11] - in
/directory/shared/ldap/branches/new-codec-integration/apache2-provider/src:
./ java/ java/main/ java/main/org/ java/main/org/apache/
java/main/org/apache/asn1new/ java/main/org/apache/asn1new/ldap/
java/main/org/apache/a...
Added: directory/shared/ldap/branches/new-codec-integration/apache2-provider/src/java/main/org/apache/asn1new/ldap/codec/grammar/CompareRequestGrammar.java
URL: http://svn.apache.org/viewcvs/directory/shared/ldap/branches/new-codec-integration/apache2-provider/src/java/main/org/apache/asn1new/ldap/codec/grammar/CompareRequestGrammar.java?rev=234264&view=auto
==============================================================================
--- directory/shared/ldap/branches/new-codec-integration/apache2-provider/src/java/main/org/apache/asn1new/ldap/codec/grammar/CompareRequestGrammar.java (added)
+++ directory/shared/ldap/branches/new-codec-integration/apache2-provider/src/java/main/org/apache/asn1new/ldap/codec/grammar/CompareRequestGrammar.java Sun Aug 21 09:53:27 2005
@@ -0,0 +1,256 @@
+/*
+ * 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 implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.asn1new.ldap.codec.grammar;
+
+import org.apache.asn1new.DecoderException;
+import org.apache.asn1new.ber.containers.IAsn1Container;
+import org.apache.asn1new.ber.grammar.AbstractGrammar;
+import org.apache.asn1new.ber.grammar.GrammarAction;
+import org.apache.asn1new.ber.grammar.GrammarTransition;
+import org.apache.asn1new.ber.grammar.IGrammar;
+import org.apache.asn1new.ber.tlv.TLV;
+import org.apache.asn1new.ber.tlv.UniversalTag;
+import org.apache.asn1new.primitives.OctetString;
+import org.apache.asn1new.ldap.codec.LdapConstants;
+import org.apache.asn1new.ldap.codec.LdapMessageContainer;
+import org.apache.asn1new.ldap.codec.primitives.LdapDN;
+import org.apache.asn1new.ldap.codec.primitives.LdapString;
+import org.apache.asn1new.ldap.pojo.CompareRequest;
+import org.apache.asn1new.ldap.pojo.LdapMessage;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * This class implements the CompareRequest LDAP message. All the actions are declared in this
+ * class. As it is a singleton, these declaration are only done once.
+ *
+ * If an action is to be added or modified, this is where the work is to be done !
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class CompareRequestGrammar extends AbstractGrammar implements IGrammar
+{
+ //~ Static fields/initializers -----------------------------------------------------------------
+
+ /** The logger */
+ private static final Logger log = LoggerFactory.getLogger( CompareRequestGrammar.class );
+
+ /** Logging speed up */
+ private static final boolean DEBUG = log.isDebugEnabled();
+
+ /** The instance of grammar. CompareRequest is a singleton */
+ private static IGrammar instance = new CompareRequestGrammar();
+
+ //~ Constructors -------------------------------------------------------------------------------
+
+ /**
+ * Creates a new CompareRequest object.
+ */
+ private CompareRequestGrammar()
+ {
+ name = CompareRequestGrammar.class.getName();
+ statesEnum = LdapStatesEnum.getInstance();
+
+ super.transitions = new GrammarTransition[LdapStatesEnum.LAST_COMPARE_REQUEST_STATE][256];
+
+ //============================================================================================
+ // CompareRequest
+ //============================================================================================
+ // CompareRequest ::= [APPLICATION 14] SEQUENCE { (Tag)
+ // Nothing to do
+ super.transitions[LdapStatesEnum.COMPARE_REQUEST_TAG][LdapConstants.COMPARE_REQUEST_TAG] = new GrammarTransition(
+ LdapStatesEnum.COMPARE_REQUEST_TAG,
+ LdapStatesEnum.COMPARE_REQUEST_VALUE, null );
+
+ // CompareRequest ::= [APPLICATION 14] SEQUENCE { (Value)
+ // Initialize the compare request pojo
+ super.transitions[LdapStatesEnum.COMPARE_REQUEST_VALUE][LdapConstants.COMPARE_REQUEST_TAG] = new GrammarTransition(
+ LdapStatesEnum.COMPARE_REQUEST_VALUE, LdapStatesEnum.COMPARE_REQUEST_ENTRY_TAG,
+ new GrammarAction( "Init Compare Request" )
+ {
+ public void action( IAsn1Container container ) throws DecoderException
+ {
+
+ LdapMessageContainer ldapMessageContainer = ( LdapMessageContainer )
+ container;
+ LdapMessage ldapMessage =
+ ldapMessageContainer.getLdapMessage();
+
+ // We can allocate the CompareRequest Object
+ ldapMessage.setProtocolOP( new CompareRequest() );
+ }
+ } );
+
+ // CompareRequest ::= [APPLICATION 14] SEQUENCE {
+ // entry LDAPDN, (Tag)
+ // ...
+ // Nothing to do
+ super.transitions[LdapStatesEnum.COMPARE_REQUEST_ENTRY_TAG][UniversalTag.OCTET_STRING_TAG] = new GrammarTransition(
+ LdapStatesEnum.COMPARE_REQUEST_ENTRY_TAG,
+ LdapStatesEnum.COMPARE_REQUEST_ENTRY_VALUE, null );
+
+ // CompareRequest ::= [APPLICATION 14] SEQUENCE {
+ // entry LDAPDN, (Tag)
+ // ...
+ // Store the DN to be compared
+ super.transitions[LdapStatesEnum.COMPARE_REQUEST_ENTRY_VALUE][UniversalTag.OCTET_STRING_TAG] = new GrammarTransition(
+ LdapStatesEnum.COMPARE_REQUEST_ENTRY_VALUE, LdapStatesEnum.COMPARE_REQUEST_AVA_TAG,
+ new GrammarAction( "Store entry" )
+ {
+ public void action( IAsn1Container container ) throws DecoderException
+ {
+
+ LdapMessageContainer ldapMessageContainer = ( LdapMessageContainer )
+ container;
+ LdapMessage ldapMessage =
+ ldapMessageContainer.getLdapMessage();
+
+ // We can allocate the CompareRequest Object
+ CompareRequest compareRequest = ldapMessage.getCompareRequest();
+
+ // Get the Value and store it in the CompareRequest
+ TLV tlv = ldapMessageContainer.getCurrentTLV();
+
+ // We have to handle the special case of a 0 length matched DN
+ if ( tlv.getLength().getLength() == 0 )
+ {
+ throw new DecoderException( "The entry must not be null" );
+ }
+ else
+ {
+ compareRequest.setEntry( new LdapDN( tlv.getValue().getData() ) );
+ }
+ }
+ } );
+
+ // CompareRequest ::= [APPLICATION 14] SEQUENCE {
+ // ...
+ // ava AttributeValueAssertion }
+ // AttributeValueAssertion ::= SEQUENCE { (Tag)
+ // Nothing to do
+ super.transitions[LdapStatesEnum.COMPARE_REQUEST_AVA_TAG][UniversalTag.SEQUENCE_TAG] = new GrammarTransition(
+ LdapStatesEnum.COMPARE_REQUEST_AVA_TAG,
+ LdapStatesEnum.COMPARE_REQUEST_AVA_VALUE, null );
+
+ // CompareRequest ::= [APPLICATION 14] SEQUENCE {
+ // ...
+ // ava AttributeValueAssertion }
+ // AttributeValueAssertion ::= SEQUENCE { (Value)
+ // Nothing to do
+ super.transitions[LdapStatesEnum.COMPARE_REQUEST_AVA_VALUE][UniversalTag.SEQUENCE_TAG] = new GrammarTransition(
+ LdapStatesEnum.COMPARE_REQUEST_AVA_VALUE, LdapStatesEnum.COMPARE_REQUEST_ATTRIBUTE_DESC_TAG, null);
+
+ // AttributeValueAssertion ::= SEQUENCE {
+ // attributeDesc AttributeDescription, (Tag)
+ // ...
+ // Nothing to do
+ super.transitions[LdapStatesEnum.COMPARE_REQUEST_ATTRIBUTE_DESC_TAG][UniversalTag.OCTET_STRING_TAG] = new GrammarTransition(
+ LdapStatesEnum.COMPARE_REQUEST_ATTRIBUTE_DESC_TAG,
+ LdapStatesEnum.COMPARE_REQUEST_ATTRIBUTE_DESC_VALUE, null );
+
+ // AttributeValueAssertion ::= SEQUENCE {
+ // attributeDesc AttributeDescription, (Value)
+ // ...
+ // Nothing to do
+ super.transitions[LdapStatesEnum.COMPARE_REQUEST_ATTRIBUTE_DESC_VALUE][UniversalTag.OCTET_STRING_TAG] = new GrammarTransition(
+ LdapStatesEnum.COMPARE_REQUEST_ATTRIBUTE_DESC_VALUE,
+ LdapStatesEnum.COMPARE_REQUEST_ASSERTION_VALUE_TAG,
+ new GrammarAction( "Store attribute desc" )
+ {
+ public void action( IAsn1Container container ) throws DecoderException
+ {
+
+ LdapMessageContainer ldapMessageContainer = ( LdapMessageContainer )
+ container;
+ LdapMessage ldapMessage =
+ ldapMessageContainer.getLdapMessage();
+
+ // Get the CompareRequest Object
+ CompareRequest compareRequest = ldapMessage.getCompareRequest();
+
+ // Get the Value and store it in the CompareRequest
+ TLV tlv = ldapMessageContainer.getCurrentTLV();
+
+ // We have to handle the special case of a 0 length matched DN
+ if ( tlv.getLength().getLength() == 0 )
+ {
+ throw new DecoderException( "The attribute description must not be null" );
+ }
+ else
+ {
+ compareRequest.setAttributeDesc( new LdapString( tlv.getValue().getData() ) );
+ }
+ }
+ } );
+
+ // AttributeValueAssertion ::= SEQUENCE {
+ // ...
+ // assertionValue AssertionValue } (Tag)
+ // Nothing to do
+ super.transitions[LdapStatesEnum.COMPARE_REQUEST_ASSERTION_VALUE_TAG][UniversalTag.OCTET_STRING_TAG] = new GrammarTransition(
+ LdapStatesEnum.COMPARE_REQUEST_ASSERTION_VALUE_TAG,
+ LdapStatesEnum.COMPARE_REQUEST_ASSERTION_VALUE_VALUE, null );
+
+ // AttributeValueAssertion ::= SEQUENCE {
+ // ...
+ // assertionValue AssertionValue } (Value)
+ // Nothing to do
+ super.transitions[LdapStatesEnum.COMPARE_REQUEST_ASSERTION_VALUE_VALUE][UniversalTag.OCTET_STRING_TAG] = new GrammarTransition(
+ LdapStatesEnum.COMPARE_REQUEST_ASSERTION_VALUE_VALUE,
+ LdapStatesEnum.END_STATE,
+ new GrammarAction( "Store assertion value" )
+ {
+ public void action( IAsn1Container container ) throws DecoderException
+ {
+
+ LdapMessageContainer ldapMessageContainer = ( LdapMessageContainer )
+ container;
+ LdapMessage ldapMessage =
+ ldapMessageContainer.getLdapMessage();
+
+ // Get the CompareRequest Object
+ CompareRequest compareRequest = ldapMessage.getCompareRequest();
+
+ // Get the Value and store it in the CompareRequest
+ TLV tlv = ldapMessageContainer.getCurrentTLV();
+
+ // We have to handle the special case of a 0 length matched DN
+ if ( tlv.getLength().getLength() == 0 )
+ {
+ compareRequest.setAssertionValue( OctetString.EMPTY_STRING );
+ }
+ else
+ {
+ compareRequest.setAssertionValue( new OctetString( tlv.getValue().getData() ) );
+ }
+ }
+ } );
+ }
+
+ //~ Methods ------------------------------------------------------------------------------------
+
+ /**
+ * This class is a singleton.
+ *
+ * @return An instance on this grammar
+ */
+ public static IGrammar getInstance()
+ {
+ return instance;
+ }
+}
Added: directory/shared/ldap/branches/new-codec-integration/apache2-provider/src/java/main/org/apache/asn1new/ldap/codec/grammar/CompareResponseGrammar.java
URL: http://svn.apache.org/viewcvs/directory/shared/ldap/branches/new-codec-integration/apache2-provider/src/java/main/org/apache/asn1new/ldap/codec/grammar/CompareResponseGrammar.java?rev=234264&view=auto
==============================================================================
--- directory/shared/ldap/branches/new-codec-integration/apache2-provider/src/java/main/org/apache/asn1new/ldap/codec/grammar/CompareResponseGrammar.java (added)
+++ directory/shared/ldap/branches/new-codec-integration/apache2-provider/src/java/main/org/apache/asn1new/ldap/codec/grammar/CompareResponseGrammar.java Sun Aug 21 09:53:27 2005
@@ -0,0 +1,115 @@
+/*
+ * 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 implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.asn1new.ldap.codec.grammar;
+
+import org.apache.asn1new.DecoderException;
+import org.apache.asn1new.ber.containers.IAsn1Container;
+import org.apache.asn1new.ber.grammar.AbstractGrammar;
+import org.apache.asn1new.ber.grammar.GrammarAction;
+import org.apache.asn1new.ber.grammar.GrammarTransition;
+import org.apache.asn1new.ber.grammar.IGrammar;
+import org.apache.asn1new.ber.tlv.UniversalTag;
+import org.apache.asn1new.ldap.codec.LdapConstants;
+import org.apache.asn1new.ldap.codec.LdapMessageContainer;
+import org.apache.asn1new.ldap.pojo.CompareResponse;
+import org.apache.asn1new.ldap.pojo.LdapMessage;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * This class implements the CompareResponse LDAP message. All the actions are declared in this
+ * class. As it is a singleton, these declaration are only done once.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class CompareResponseGrammar extends AbstractGrammar implements IGrammar
+{
+ //~ Static fields/initializers -----------------------------------------------------------------
+
+ /** The logger */
+ private static final Logger log = LoggerFactory.getLogger( CompareResponseGrammar.class );
+
+ /** Logging speed up */
+ private static final boolean DEBUG = log.isDebugEnabled();
+
+ /** The instance of grammar. CompareResponseGrammar is a singleton */
+ private static IGrammar instance = new CompareResponseGrammar();
+
+ //~ Constructors -------------------------------------------------------------------------------
+
+ /**
+ * Creates a new CompareResponseGrammar object.
+ */
+ private CompareResponseGrammar()
+ {
+ name = CompareResponseGrammar.class.getName();
+ statesEnum = LdapStatesEnum.getInstance();
+
+ // Intitialisation
+ super.transitions = new GrammarTransition[LdapStatesEnum.LAST_COMPARE_RESPONSE_STATE][256];
+
+ //============================================================================================
+ // CompareResponse Message
+ //============================================================================================
+ // LdapMessage ::= ... CompareResponse ...
+ // CompareResponse ::= [APPLICATION 15] LDAPResult (Tag)
+ // Nothing to do.
+ super.transitions[LdapStatesEnum.COMPARE_RESPONSE_TAG][LdapConstants.COMPARE_RESPONSE_TAG] = new GrammarTransition(
+ LdapStatesEnum.COMPARE_RESPONSE_TAG, LdapStatesEnum.COMPARE_RESPONSE_VALUE, null );
+
+ // LdapMessage ::= ... CompareResponse ...
+ // CompareResponse ::= [APPLICATION 15] LDAPResult (Value)
+ // The next Tag will be the LDAPResult Tag (0x0A).
+ // We will switch the grammar then.
+ super.transitions[LdapStatesEnum.COMPARE_RESPONSE_VALUE][LdapConstants.COMPARE_RESPONSE_TAG] = new GrammarTransition(
+ LdapStatesEnum.COMPARE_RESPONSE_VALUE, LdapStatesEnum.COMPARE_RESPONSE_LDAP_RESULT,
+ new GrammarAction( "Init CompareResponse" )
+ {
+ public void action( IAsn1Container container ) throws DecoderException
+ {
+
+ LdapMessageContainer ldapMessageContainer = ( LdapMessageContainer )
+ container;
+ LdapMessage ldapMessage =
+ ldapMessageContainer.getLdapMessage();
+
+ // Now, we can allocate the CompareResponse Object
+ // And we associate it to the ldapMessage Object
+ ldapMessage.setProtocolOP( new CompareResponse() );
+ }
+ } );
+
+ // LdapMessage ::= ... CompareResponse ...
+ // CompareResponse ::= [APPLICATION 15] LDAPResult (Value)
+ // Ok, we have a LDAPResult Tag (0x0A). So we have to switch the grammar.
+ super.transitions[LdapStatesEnum.COMPARE_RESPONSE_LDAP_RESULT][UniversalTag.ENUMERATED_TAG] = new GrammarTransition(
+ LdapStatesEnum.COMPARE_RESPONSE_LDAP_RESULT, LdapStatesEnum.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;
+ }
+}
Added: directory/shared/ldap/branches/new-codec-integration/apache2-provider/src/java/main/org/apache/asn1new/ldap/codec/grammar/DelRequestGrammar.java
URL: http://svn.apache.org/viewcvs/directory/shared/ldap/branches/new-codec-integration/apache2-provider/src/java/main/org/apache/asn1new/ldap/codec/grammar/DelRequestGrammar.java?rev=234264&view=auto
==============================================================================
--- directory/shared/ldap/branches/new-codec-integration/apache2-provider/src/java/main/org/apache/asn1new/ldap/codec/grammar/DelRequestGrammar.java (added)
+++ directory/shared/ldap/branches/new-codec-integration/apache2-provider/src/java/main/org/apache/asn1new/ldap/codec/grammar/DelRequestGrammar.java Sun Aug 21 09:53:27 2005
@@ -0,0 +1,126 @@
+/*
+ * 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 implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.asn1new.ldap.codec.grammar;
+
+import org.apache.asn1new.DecoderException;
+import org.apache.asn1new.ber.containers.IAsn1Container;
+import org.apache.asn1new.ber.grammar.AbstractGrammar;
+import org.apache.asn1new.ber.grammar.GrammarAction;
+import org.apache.asn1new.ber.grammar.GrammarTransition;
+import org.apache.asn1new.ber.grammar.IGrammar;
+import org.apache.asn1new.ber.tlv.TLV;
+import org.apache.asn1new.ldap.codec.LdapConstants;
+import org.apache.asn1new.ldap.codec.LdapMessageContainer;
+import org.apache.asn1new.ldap.codec.primitives.LdapDN;
+import org.apache.asn1new.ldap.pojo.DelRequest;
+import org.apache.asn1new.ldap.pojo.LdapMessage;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * This class implements the DelRequest LDAP message. All the actions are declared in this
+ * class. As it is a singleton, these declaration are only done once.
+ *
+ * If an action is to be added or modified, this is where the work is to be done !
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class DelRequestGrammar extends AbstractGrammar implements IGrammar
+{
+ //~ Static fields/initializers -----------------------------------------------------------------
+
+ /** The logger */
+ private static final Logger log = LoggerFactory.getLogger( DelRequestGrammar.class );
+
+ /** Logging speed up */
+ private static final boolean DEBUG = log.isDebugEnabled();
+
+ /** The instance of grammar. DelRequestGrammar is a singleton */
+ private static IGrammar instance = new DelRequestGrammar();
+
+ //~ Constructors -------------------------------------------------------------------------------
+
+ /**
+ * Creates a new DelRequestGrammar object.
+ */
+ private DelRequestGrammar()
+ {
+ name = DelRequestGrammar.class.getName();
+ statesEnum = LdapStatesEnum.getInstance();
+
+ super.transitions = new GrammarTransition[LdapStatesEnum.LAST_DEL_REQUEST_STATE][256];
+
+ //============================================================================================
+ // DelRequest
+ //============================================================================================
+ // DelRequestGrammar ::= [APPLICATION 10] LDAPDN { (Tag)
+ // Nothing to do
+ super.transitions[LdapStatesEnum.DEL_REQUEST_TAG][LdapConstants.DEL_REQUEST_TAG] = new GrammarTransition(
+ LdapStatesEnum.DEL_REQUEST_TAG,
+ LdapStatesEnum.DEL_REQUEST_VALUE, null );
+
+ // DelRequestGrammar ::= [APPLICATION 10] LDAPDN { (Value)
+ // Initialise the del request pojo and store the DN to be deleted
+ super.transitions[LdapStatesEnum.DEL_REQUEST_VALUE][LdapConstants.DEL_REQUEST_TAG] = new GrammarTransition(
+ LdapStatesEnum.DEL_REQUEST_VALUE, LdapStatesEnum.END_STATE,
+ new GrammarAction( "Init del Request" )
+ {
+ public void action( IAsn1Container container ) throws DecoderException
+ {
+
+ LdapMessageContainer ldapMessageContainer = ( LdapMessageContainer )
+ container;
+ LdapMessage ldapMessage =
+ ldapMessageContainer.getLdapMessage();
+
+ // We can allocate the DelRequest Object
+ DelRequest delRequest = new DelRequest();
+
+ // And store the DN into it
+ // Get the Value and store it in the DelRequest
+ TLV tlv = ldapMessageContainer.getCurrentTLV();
+
+ // We have to handle the special case of a 0 length matched DN
+ if ( tlv.getLength().getLength() == 0 )
+ {
+ throw new DecoderException( "The entry must not be null" );
+ }
+ else
+ {
+ delRequest.setEntry( new LdapDN( tlv.getValue().getData() ) );
+ }
+
+ // then we associate it to the ldapMessage Object
+ ldapMessage.setProtocolOP( delRequest );
+ }
+ } );
+
+ }
+
+ //~ Methods ------------------------------------------------------------------------------------
+
+ /**
+ * This class is a singleton.
+ *
+ * @return An instance on this grammar
+ */
+ public static IGrammar getInstance()
+ {
+ return instance;
+ }
+}
Added: directory/shared/ldap/branches/new-codec-integration/apache2-provider/src/java/main/org/apache/asn1new/ldap/codec/grammar/DelResponseGrammar.java
URL: http://svn.apache.org/viewcvs/directory/shared/ldap/branches/new-codec-integration/apache2-provider/src/java/main/org/apache/asn1new/ldap/codec/grammar/DelResponseGrammar.java?rev=234264&view=auto
==============================================================================
--- directory/shared/ldap/branches/new-codec-integration/apache2-provider/src/java/main/org/apache/asn1new/ldap/codec/grammar/DelResponseGrammar.java (added)
+++ directory/shared/ldap/branches/new-codec-integration/apache2-provider/src/java/main/org/apache/asn1new/ldap/codec/grammar/DelResponseGrammar.java Sun Aug 21 09:53:27 2005
@@ -0,0 +1,116 @@
+/*
+ * 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 implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.asn1new.ldap.codec.grammar;
+
+import org.apache.asn1new.DecoderException;
+import org.apache.asn1new.ber.containers.IAsn1Container;
+import org.apache.asn1new.ber.grammar.AbstractGrammar;
+import org.apache.asn1new.ber.grammar.GrammarAction;
+import org.apache.asn1new.ber.grammar.GrammarTransition;
+import org.apache.asn1new.ber.grammar.IGrammar;
+import org.apache.asn1new.ber.tlv.UniversalTag;
+import org.apache.asn1new.ldap.codec.LdapConstants;
+import org.apache.asn1new.ldap.codec.LdapMessageContainer;
+import org.apache.asn1new.ldap.pojo.DelResponse;
+import org.apache.asn1new.ldap.pojo.LdapMessage;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * This class implements the DelResponse LDAP message. All the actions are declared in this
+ * class. As it is a singleton, these declaration are only done once.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class DelResponseGrammar extends AbstractGrammar implements IGrammar
+{
+ //~ Static fields/initializers -----------------------------------------------------------------
+
+ /** The logger */
+ private static final Logger log = LoggerFactory.getLogger( DelResponseGrammar.class );
+
+ /** Logging speed up */
+ private static final boolean DEBUG = log.isDebugEnabled();
+
+ /** The instance of grammar. DelResponseGrammar is a singleton */
+ private static IGrammar instance = new DelResponseGrammar();
+
+ //~ Constructors -------------------------------------------------------------------------------
+
+ /**
+ * Creates a new DelResponseGrammar object.
+ */
+ private DelResponseGrammar()
+ {
+ name = DelResponseGrammar.class.getName();
+ statesEnum = LdapStatesEnum.getInstance();
+
+ // Intitialisation
+ super.transitions = new GrammarTransition[LdapStatesEnum.LAST_DEL_RESPONSE_STATE][256];
+
+ //============================================================================================
+ // DelResponse Message
+ //============================================================================================
+ // LdapMessage ::= ... DelResponse ...
+ // DelResponse ::= [APPLICATION 11] LDAPResult (Tag)
+ // Nothing to do.
+ super.transitions[LdapStatesEnum.DEL_RESPONSE_TAG][LdapConstants.DEL_RESPONSE_TAG] = new GrammarTransition(
+ LdapStatesEnum.DEL_RESPONSE_TAG, LdapStatesEnum.DEL_RESPONSE_VALUE, null );
+
+ // LdapMessage ::= ... DelResponse ...
+ // DelResponse ::= [APPLICATION 11] LDAPResult (Value)
+ // The next Tag will be the LDAPResult Tag (0x0A).
+ // We will switch the grammar then.
+ super.transitions[LdapStatesEnum.DEL_RESPONSE_VALUE][LdapConstants.DEL_RESPONSE_TAG] = new GrammarTransition(
+ LdapStatesEnum.DEL_RESPONSE_VALUE, LdapStatesEnum.DEL_RESPONSE_LDAP_RESULT,
+ new GrammarAction( "Init DelResponse" )
+ {
+ public void action( IAsn1Container container ) throws DecoderException
+ {
+
+ LdapMessageContainer ldapMessageContainer = ( LdapMessageContainer )
+ container;
+ LdapMessage ldapMessage =
+ ldapMessageContainer.getLdapMessage();
+
+ // Now, we can allocate the DelResponse Object
+
+ // And we associate it to the ldapMessage Object
+ ldapMessage.setProtocolOP( new DelResponse() );
+ }
+ } );
+
+ // LdapMessage ::= ... DelResponse ...
+ // DelResponse ::= [APPLICATION 11] LDAPResult (Value)
+ // Ok, we have a LDAPResult Tag (0x0A). So we have to switch the grammar.
+ super.transitions[LdapStatesEnum.DEL_RESPONSE_LDAP_RESULT][UniversalTag.ENUMERATED_TAG] = new GrammarTransition(
+ LdapStatesEnum.DEL_RESPONSE_LDAP_RESULT, LdapStatesEnum.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;
+ }
+}
Added: directory/shared/ldap/branches/new-codec-integration/apache2-provider/src/java/main/org/apache/asn1new/ldap/codec/grammar/ExtendedRequestGrammar.java
URL: http://svn.apache.org/viewcvs/directory/shared/ldap/branches/new-codec-integration/apache2-provider/src/java/main/org/apache/asn1new/ldap/codec/grammar/ExtendedRequestGrammar.java?rev=234264&view=auto
==============================================================================
--- directory/shared/ldap/branches/new-codec-integration/apache2-provider/src/java/main/org/apache/asn1new/ldap/codec/grammar/ExtendedRequestGrammar.java (added)
+++ directory/shared/ldap/branches/new-codec-integration/apache2-provider/src/java/main/org/apache/asn1new/ldap/codec/grammar/ExtendedRequestGrammar.java Sun Aug 21 09:53:27 2005
@@ -0,0 +1,195 @@
+/*
+ * 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 implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.asn1new.ldap.codec.grammar;
+
+import org.apache.asn1new.DecoderException;
+import org.apache.asn1new.ber.containers.IAsn1Container;
+import org.apache.asn1new.ber.grammar.AbstractGrammar;
+import org.apache.asn1new.ber.grammar.GrammarAction;
+import org.apache.asn1new.ber.grammar.GrammarTransition;
+import org.apache.asn1new.ber.grammar.IGrammar;
+import org.apache.asn1new.ber.tlv.TLV;
+import org.apache.asn1new.primitives.OID;
+import org.apache.asn1new.primitives.OctetString;
+import org.apache.asn1new.ldap.codec.LdapConstants;
+import org.apache.asn1new.ldap.codec.LdapMessageContainer;
+import org.apache.asn1new.ldap.pojo.ExtendedRequest;
+import org.apache.asn1new.ldap.pojo.LdapMessage;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+
+/**
+ * This class implements the ExtendedRequest LDAP message. All the actions are declared in this
+ * class. As it is a singleton, these declaration are only done once.
+ *
+ * If an action is to be added or modified, this is where the work is to be done !
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class ExtendedRequestGrammar extends AbstractGrammar implements IGrammar
+{
+ //~ Static fields/initializers -----------------------------------------------------------------
+
+ /** The logger */
+ private static final Logger log = LoggerFactory.getLogger( ExtendedRequestGrammar.class );
+
+ /** Logging speed up */
+ private static final boolean DEBUG = log.isDebugEnabled();
+
+ /** The instance of grammar. ExtendedRequest is a singleton */
+ private static IGrammar instance = new ExtendedRequestGrammar();
+
+ //~ Constructors -------------------------------------------------------------------------------
+
+ /**
+ * Creates a new ExtendedRequest object.
+ */
+ private ExtendedRequestGrammar()
+ {
+ name = ExtendedRequestGrammar.class.getName();
+ statesEnum = LdapStatesEnum.getInstance();
+
+ super.transitions = new GrammarTransition[LdapStatesEnum.LAST_EXTENDED_REQUEST_STATE][256];
+
+ //============================================================================================
+ // ExtendedRequest
+ //============================================================================================
+ // ExtendedRequest ::= [APPLICATION 23] SEQUENCE { (Tag)
+ // Nothing to do
+ super.transitions[LdapStatesEnum.EXTENDED_REQUEST_TAG][LdapConstants.EXTENDED_REQUEST_TAG] = new GrammarTransition(
+ LdapStatesEnum.EXTENDED_REQUEST_TAG,
+ LdapStatesEnum.EXTENDED_REQUEST_VALUE, null );
+
+ // ExtendedRequest ::= [APPLICATION 23] SEQUENCE { (Value)
+ // Initialize the compare request pojo
+ super.transitions[LdapStatesEnum.EXTENDED_REQUEST_VALUE][LdapConstants.EXTENDED_REQUEST_TAG] = new GrammarTransition(
+ LdapStatesEnum.EXTENDED_REQUEST_VALUE, LdapStatesEnum.EXTENDED_REQUEST_NAME_TAG,
+ new GrammarAction( "Init Extended Request" )
+ {
+ public void action( IAsn1Container container ) throws DecoderException
+ {
+
+ LdapMessageContainer ldapMessageContainer = ( LdapMessageContainer )
+ container;
+ LdapMessage ldapMessage =
+ ldapMessageContainer.getLdapMessage();
+
+ // We can allocate the ExtendedRequest Object
+ ldapMessage.setProtocolOP( new ExtendedRequest() );
+ }
+ } );
+
+ // ExtendedRequest ::= [APPLICATION 23] SEQUENCE {
+ // requestName [0] LDAPOID, (Tag)
+ // ...
+ // Nothing to do
+ super.transitions[LdapStatesEnum.EXTENDED_REQUEST_NAME_TAG][LdapConstants.EXTENDED_REQUEST_NAME_TAG] = new GrammarTransition(
+ LdapStatesEnum.EXTENDED_REQUEST_NAME_TAG,
+ LdapStatesEnum.EXTENDED_REQUEST_NAME_VALUE, null );
+
+ // ExtendedRequest ::= [APPLICATION 23] SEQUENCE {
+ // requestName [0] LDAPOID, (Value)
+ // ...
+ // Store the DN to be compared
+ super.transitions[LdapStatesEnum.EXTENDED_REQUEST_NAME_VALUE][LdapConstants.EXTENDED_REQUEST_NAME_TAG] = new GrammarTransition(
+ LdapStatesEnum.EXTENDED_REQUEST_NAME_VALUE, LdapStatesEnum.EXTENDED_REQUEST_VALUE_TAG,
+ new GrammarAction( "Store name" )
+ {
+ public void action( IAsn1Container container ) throws DecoderException
+ {
+
+ LdapMessageContainer ldapMessageContainer = ( LdapMessageContainer )
+ container;
+ LdapMessage ldapMessage =
+ ldapMessageContainer.getLdapMessage();
+
+ // We can allocate the ExtendedRequest Object
+ ExtendedRequest extendedRequest = ldapMessage.getExtendedRequest();
+
+ // Get the Value and store it in the ExtendedRequest
+ TLV tlv = ldapMessageContainer.getCurrentTLV();
+
+ // We have to handle the special case of a 0 length matched OID
+ if ( tlv.getLength().getLength() == 0 )
+ {
+ throw new DecoderException( "The name must not be null" );
+ }
+ else
+ {
+ extendedRequest.setRequestName( new OID( tlv.getValue().getData() ) );
+ }
+ }
+ } );
+
+ // ExtendedRequest ::= [APPLICATION 23] SEQUENCE {
+ // ...
+ // requestValue [1] OCTET STRING OPTIONAL } (Tag)
+ // Nothing to do
+ super.transitions[LdapStatesEnum.EXTENDED_REQUEST_VALUE_TAG][LdapConstants.EXTENDED_REQUEST_VALUE_TAG] = new GrammarTransition(
+ LdapStatesEnum.EXTENDED_REQUEST_VALUE_TAG,
+ LdapStatesEnum.EXTENDED_REQUEST_VALUE_VALUE, null );
+
+ // ExtendedRequest ::= [APPLICATION 23] SEQUENCE {
+ // ...
+ // requestValue [1] OCTET STRING OPTIONAL } (Value)
+ // Store the DN to be compared
+ super.transitions[LdapStatesEnum.EXTENDED_REQUEST_VALUE_VALUE][LdapConstants.EXTENDED_REQUEST_VALUE_TAG] = new GrammarTransition(
+ LdapStatesEnum.EXTENDED_REQUEST_VALUE_VALUE, LdapStatesEnum.END_STATE,
+ new GrammarAction( "Store value" )
+ {
+ public void action( IAsn1Container container ) throws DecoderException
+ {
+
+ LdapMessageContainer ldapMessageContainer = ( LdapMessageContainer )
+ container;
+ LdapMessage ldapMessage =
+ ldapMessageContainer.getLdapMessage();
+
+ // We can allocate the ExtendedRequest Object
+ ExtendedRequest extendedRequest = ldapMessage.getExtendedRequest();
+
+ // Get the Value and store it in the ExtendedRequest
+ TLV tlv = ldapMessageContainer.getCurrentTLV();
+
+ // We have to handle the special case of a 0 length matched OID
+ if ( tlv.getLength().getLength() == 0 )
+ {
+ extendedRequest.setRequestValue( OctetString.EMPTY_STRING );
+ }
+ else
+ {
+ extendedRequest.setRequestValue( new OctetString( tlv.getValue().getData() ) );
+ }
+ }
+ } );
+
+ }
+
+ //~ Methods ------------------------------------------------------------------------------------
+
+ /**
+ * This class is a singleton.
+ *
+ * @return An instance on this grammar
+ */
+ public static IGrammar getInstance()
+ {
+ return instance;
+ }
+}
Added: directory/shared/ldap/branches/new-codec-integration/apache2-provider/src/java/main/org/apache/asn1new/ldap/codec/grammar/ExtendedResponseGrammar.java
URL: http://svn.apache.org/viewcvs/directory/shared/ldap/branches/new-codec-integration/apache2-provider/src/java/main/org/apache/asn1new/ldap/codec/grammar/ExtendedResponseGrammar.java?rev=234264&view=auto
==============================================================================
--- directory/shared/ldap/branches/new-codec-integration/apache2-provider/src/java/main/org/apache/asn1new/ldap/codec/grammar/ExtendedResponseGrammar.java (added)
+++ directory/shared/ldap/branches/new-codec-integration/apache2-provider/src/java/main/org/apache/asn1new/ldap/codec/grammar/ExtendedResponseGrammar.java Sun Aug 21 09:53:27 2005
@@ -0,0 +1,206 @@
+/*
+ * 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 implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.asn1new.ldap.codec.grammar;
+
+import org.apache.asn1new.DecoderException;
+import org.apache.asn1new.ber.containers.IAsn1Container;
+import org.apache.asn1new.ber.grammar.AbstractGrammar;
+import org.apache.asn1new.ber.grammar.GrammarAction;
+import org.apache.asn1new.ber.grammar.GrammarTransition;
+import org.apache.asn1new.ber.grammar.IGrammar;
+import org.apache.asn1new.ber.tlv.TLV;
+import org.apache.asn1new.ber.tlv.UniversalTag;
+import org.apache.asn1new.primitives.OID;
+import org.apache.asn1new.primitives.OctetString;
+import org.apache.asn1new.ldap.codec.LdapConstants;
+import org.apache.asn1new.ldap.codec.LdapMessageContainer;
+import org.apache.asn1new.ldap.pojo.ExtendedResponse;
+import org.apache.asn1new.ldap.pojo.LdapMessage;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * This class implements the ExtendedResponse LDAP message. All the actions are declared in this
+ * class. As it is a singleton, these declaration are only done once.
+ *
+ * If an action is to be added or modified, this is where the work is to be done !
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class ExtendedResponseGrammar extends AbstractGrammar implements IGrammar
+{
+ //~ Static fields/initializers -----------------------------------------------------------------
+
+ /** The logger */
+ private static final Logger log = LoggerFactory.getLogger( ExtendedResponseGrammar.class );
+
+ /** Logging speed up */
+ private static final boolean DEBUG = log.isDebugEnabled();
+
+ /** The instance of grammar. ExtendedResponseGrammar is a singleton */
+ private static IGrammar instance = new ExtendedResponseGrammar();
+
+ //~ Constructors -------------------------------------------------------------------------------
+
+ /**
+ * Creates a new ExtendedResponseGrammar object.
+ */
+ private ExtendedResponseGrammar()
+ {
+ name = ExtendedResponseGrammar.class.getName();
+ statesEnum = LdapStatesEnum.getInstance();
+
+ super.transitions = new GrammarTransition[LdapStatesEnum.LAST_EXTENDED_RESPONSE_STATE][256];
+
+ //============================================================================================
+ // ExtendedResponse
+ //============================================================================================
+ // ExtendedResponse ::= [APPLICATION 24] SEQUENCE { (Tag)
+ // Nothing to do
+ super.transitions[LdapStatesEnum.EXTENDED_RESPONSE_TAG][LdapConstants.EXTENDED_RESPONSE_TAG] = new GrammarTransition(
+ LdapStatesEnum.EXTENDED_RESPONSE_TAG,
+ LdapStatesEnum.EXTENDED_RESPONSE_VALUE, null );
+
+ // ExtendedResponse ::= [APPLICATION 24] SEQUENCE { (Value)
+ // Initialize the compare request pojo
+ super.transitions[LdapStatesEnum.EXTENDED_RESPONSE_VALUE][LdapConstants.EXTENDED_RESPONSE_TAG] = new GrammarTransition(
+ LdapStatesEnum.EXTENDED_RESPONSE_VALUE, LdapStatesEnum.EXTENDED_RESPONSE_LDAP_RESULT,
+ new GrammarAction( "Init Extended Reponse" )
+ {
+ public void action( IAsn1Container container ) throws DecoderException
+ {
+
+ LdapMessageContainer ldapMessageContainer = ( LdapMessageContainer )
+ container;
+ LdapMessage ldapMessage =
+ ldapMessageContainer.getLdapMessage();
+
+ // We can allocate the ExtendedResponse Object
+ ldapMessage.setProtocolOP( new ExtendedResponse() );
+ }
+ } );
+
+ // ExtendedResponse ::= [APPLICATION 24] SEQUENCE {
+ // COMPONENTS OF LDAPResult, (Tag)
+ // ...
+ // The Tag will be the LDAPResult Tag (0x0A). So we have to switch the grammar.
+ // The current state will be stored.
+ super.transitions[LdapStatesEnum.EXTENDED_RESPONSE_LDAP_RESULT][UniversalTag.ENUMERATED_TAG] = new GrammarTransition(
+ LdapStatesEnum.EXTENDED_RESPONSE_LDAP_RESULT,
+ LdapStatesEnum.LDAP_RESULT_GRAMMAR_SWITCH, null );
+
+ // ExtendedResponse ::= [APPLICATION 24] SEQUENCE {
+ // ...
+ // responseName [10] LDAPOID OPTIONAL, (Tag)
+ // ...
+ // Nothing to do.
+ super.transitions[LdapStatesEnum.EXTENDED_RESPONSE_LDAP_RESULT][LdapConstants.EXTENDED_RESPONSE_RESPONSE_NAME_TAG] = new GrammarTransition(
+ LdapStatesEnum.EXTENDED_RESPONSE_LDAP_RESULT, LdapStatesEnum.EXTENDED_RESPONSE_NAME_VALUE, null
+ );
+
+ // ExtendedResponse ::= [APPLICATION 24] SEQUENCE {
+ // ...
+ // responseName [10] LDAPOID OPTIONAL, (Value)
+ // ...
+ // Store the response name.
+ super.transitions[LdapStatesEnum.EXTENDED_RESPONSE_NAME_VALUE][LdapConstants.EXTENDED_RESPONSE_RESPONSE_NAME_TAG] = new GrammarTransition(
+ LdapStatesEnum.EXTENDED_RESPONSE_NAME_VALUE, LdapStatesEnum.EXTENDED_RESPONSE_RESPONSE_TAG,
+ new GrammarAction( "Store name" )
+ {
+ public void action( IAsn1Container container ) throws DecoderException
+ {
+
+ LdapMessageContainer ldapMessageContainer = ( LdapMessageContainer )
+ container;
+ LdapMessage ldapMessage =
+ ldapMessageContainer.getLdapMessage();
+
+ // We can allocate the ExtendedResponse Object
+ ExtendedResponse extendedResponse = ldapMessage.getExtendedResponse();
+
+ // Get the Value and store it in the ExtendedResponse
+ TLV tlv = ldapMessageContainer.getCurrentTLV();
+
+ // We have to handle the special case of a 0 length matched OID
+ if ( tlv.getLength().getLength() == 0 )
+ {
+ throw new DecoderException( "The name must not be null" );
+ }
+ else
+ {
+ extendedResponse.setResponseName( new OID( tlv.getValue().getData() ) );
+ }
+ }
+ } );
+
+ // ExtendedResponse ::= [APPLICATION 24] SEQUENCE {
+ // ...
+ // response [11] OCTET STRING OPTIONAL } (Tag)
+ // Nothing to do
+ super.transitions[LdapStatesEnum.EXTENDED_RESPONSE_RESPONSE_TAG][LdapConstants.EXTENDED_RESPONSE_RESPONSE_TAG] = new GrammarTransition(
+ LdapStatesEnum.EXTENDED_RESPONSE_RESPONSE_TAG,
+ LdapStatesEnum.EXTENDED_RESPONSE_RESPONSE_VALUE, null );
+
+ // ExtendedResponse ::= [APPLICATION 24] SEQUENCE {
+ // ...
+ // response [11] OCTET STRING OPTIONAL } (Value)
+ // Store the response
+ super.transitions[LdapStatesEnum.EXTENDED_RESPONSE_RESPONSE_VALUE][LdapConstants.EXTENDED_RESPONSE_RESPONSE_TAG] = new GrammarTransition(
+ LdapStatesEnum.EXTENDED_RESPONSE_RESPONSE_VALUE, LdapStatesEnum.END_STATE,
+ new GrammarAction( "Store response" )
+ {
+ public void action( IAsn1Container container ) throws DecoderException
+ {
+
+ LdapMessageContainer ldapMessageContainer = ( LdapMessageContainer )
+ container;
+ LdapMessage ldapMessage =
+ ldapMessageContainer.getLdapMessage();
+
+ // We can allocate the ExtendedResponse Object
+ ExtendedResponse extendedResponse = ldapMessage.getExtendedResponse();
+
+ // Get the Value and store it in the ExtendedResponse
+ TLV tlv = ldapMessageContainer.getCurrentTLV();
+
+ // We have to handle the special case of a 0 length matched OID
+ if ( tlv.getLength().getLength() == 0 )
+ {
+ extendedResponse.setResponse( OctetString.EMPTY_STRING );
+ }
+ else
+ {
+ extendedResponse.setResponse( new OctetString( tlv.getValue().getData() ) );
+ }
+ }
+ } );
+
+ }
+
+ //~ Methods ------------------------------------------------------------------------------------
+
+ /**
+ * This class is a singleton.
+ *
+ * @return An instance on this grammar
+ */
+ public static IGrammar getInstance()
+ {
+ return instance;
+ }
+}