directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject svn commit: r400067 [4/7] - in /directory/trunks: apacheds/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/extended/ clients/ldap/ mina/core/src/main/java/org/apache/mina/filter/ mina/core/src/main/java/org/apache/mina/handler/mult...
Date Fri, 05 May 2006 12:52:54 GMT
Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/StoredProcedureDecoder.java
URL: http://svn.apache.org/viewcvs/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/StoredProcedureDecoder.java?rev=400067&r1=400066&r2=400067&view=diff
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/StoredProcedureDecoder.java (original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/StoredProcedureDecoder.java Fri May  5 05:52:49 2006
@@ -1,36 +1,36 @@
-/*
- *   Copyright 2006 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.directory.shared.ldap.codec.extended.operations;
-
-
-import org.apache.directory.shared.asn1.ber.Asn1Decoder;
-
-
-/**
- * StoredProcedure Decoder
- * 
- * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
- */
-public class StoredProcedureDecoder extends Asn1Decoder
-{
-
-    public StoredProcedureDecoder()
-    {
-    }
-
-}
+/*
+ *   Copyright 2006 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.directory.shared.ldap.codec.extended.operations;
+
+
+import org.apache.directory.shared.asn1.ber.Asn1Decoder;
+
+
+/**
+ * StoredProcedure Decoder
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class StoredProcedureDecoder extends Asn1Decoder
+{
+
+    public StoredProcedureDecoder()
+    {
+    }
+
+}

Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/StoredProcedureGrammar.java
URL: http://svn.apache.org/viewcvs/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/StoredProcedureGrammar.java?rev=400067&r1=400066&r2=400067&view=diff
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/StoredProcedureGrammar.java (original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/StoredProcedureGrammar.java Fri May  5 05:52:49 2006
@@ -1,324 +1,324 @@
-/*
- *   Copyright 2006 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.directory.shared.ldap.codec.extended.operations;
-
-
-import org.apache.directory.shared.asn1.ber.IAsn1Container;
-import org.apache.directory.shared.asn1.ber.grammar.AbstractGrammar;
-import org.apache.directory.shared.asn1.ber.grammar.GrammarAction;
-import org.apache.directory.shared.asn1.ber.grammar.GrammarTransition;
-import org.apache.directory.shared.asn1.ber.grammar.IGrammar;
-import org.apache.directory.shared.asn1.ber.tlv.TLV;
-import org.apache.directory.shared.asn1.ber.tlv.UniversalTag;
-import org.apache.directory.shared.asn1.codec.DecoderException;
-import org.apache.directory.shared.ldap.util.StringTools;
-import org.apache.log4j.Logger;
-import org.apache.directory.shared.ldap.codec.extended.operations.StoredProcedure.StoredProcedureParameter;
-
-
-/**
- * ASN.1 BER Grammar for Stored Procedure Extended Operation
- * 
- * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
- */
-public class StoredProcedureGrammar extends AbstractGrammar implements IGrammar
-{
-    //~ Static fields/initializers -----------------------------------------------------------------
-
-    /** The logger */
-    //private static final Logger log = LoggerFactory.getLogger( StoredProcedureGrammar.class );
-    private static final Logger log = Logger.getLogger( StoredProcedureGrammar.class );
-
-    /** The instance of grammar. StoredProcedureGrammar is a singleton. */
-    private static IGrammar instance = new StoredProcedureGrammar();
-
-
-    //~ Constructors -------------------------------------------------------------------------------
-
-    /**
-     * Creates a new StoredProcedureGrammar object.
-     */
-    private StoredProcedureGrammar()
-    {
-        name = StoredProcedureGrammar.class.getName();
-        statesEnum = StoredProcedureStatesEnum.getInstance();
-
-        // Create the transitions table
-        super.transitions = new GrammarTransition[StoredProcedureStatesEnum.LAST_STORED_PROCEDURE_STATE][256];
-
-        //============================================================================================
-        // StoredProcedure Message
-        //============================================================================================
-        // StoredProcedure ::= SEQUENCE { (Tag)
-        //   ...
-        // Nothing to do.
-        super.transitions[StoredProcedureStatesEnum.STORED_PROCEDURE_TAG][UniversalTag.SEQUENCE_TAG] = new GrammarTransition(
-            StoredProcedureStatesEnum.STORED_PROCEDURE_TAG, StoredProcedureStatesEnum.STORED_PROCEDURE_VALUE, null );
-
-        // StoredProcedure ::= SEQUENCE { (Value)
-        //   ...
-        // Nothing to do.
-        super.transitions[StoredProcedureStatesEnum.STORED_PROCEDURE_VALUE][UniversalTag.SEQUENCE_TAG] = new GrammarTransition(
-            StoredProcedureStatesEnum.STORED_PROCEDURE_VALUE, StoredProcedureStatesEnum.LANGUAGE_TAG, null );
-
-        //    language OCTETSTRING, (Tag)
-        //    ...
-        // Nothing to do
-        super.transitions[StoredProcedureStatesEnum.LANGUAGE_TAG][UniversalTag.OCTET_STRING_TAG] = new GrammarTransition(
-            StoredProcedureStatesEnum.LANGUAGE_TAG, StoredProcedureStatesEnum.LANGUAGE_VALUE, null );
-
-        //    language OCTETSTRING, (Value)
-        //    ...
-        // Store the language.
-        super.transitions[StoredProcedureStatesEnum.LANGUAGE_VALUE][UniversalTag.OCTET_STRING_TAG] = new GrammarTransition(
-            StoredProcedureStatesEnum.LANGUAGE_VALUE, StoredProcedureStatesEnum.PROCEDURE_TAG, new GrammarAction(
-                "Stores the language" )
-            {
-                public void action( IAsn1Container container ) throws DecoderException
-                {
-
-                    StoredProcedureContainer storedProcedureContainer = ( StoredProcedureContainer ) container;
-
-                    TLV tlv = storedProcedureContainer.getCurrentTLV();
-
-                    StoredProcedure storedProcedure = null;
-
-                    // Store the value.
-                    if ( tlv.getLength().getLength() == 0 )
-                    {
-                        // We can't have a void language !
-                        log.error( "The stored procedure language is null" );
-                        throw new DecoderException( "The stored procedure language cannot be null" );
-                    }
-                    else
-                    {
-                        // Only this field's type is String by default
-                        String language = StringTools.utf8ToString( tlv.getValue().getData() );
-
-                        if ( log.isDebugEnabled() )
-                        {
-                            log.debug( "SP language found: " + language );
-                        }
-
-                        storedProcedure = new StoredProcedure();
-                        storedProcedure.setLanguage( language );
-                        storedProcedureContainer.setStoredProcedure( storedProcedure );
-                    }
-                }
-            } );
-
-        //    procedure OCTETSTRING, (Tag)
-        //    ...
-        // Nothing to do
-        super.transitions[StoredProcedureStatesEnum.PROCEDURE_TAG][UniversalTag.OCTET_STRING_TAG] = new GrammarTransition(
-            StoredProcedureStatesEnum.PROCEDURE_TAG, StoredProcedureStatesEnum.PROCEDURE_VALUE, null );
-
-        //    procedure OCTETSTRING, (Value)
-        //    ...
-        // Store the procedure.
-        super.transitions[StoredProcedureStatesEnum.PROCEDURE_VALUE][UniversalTag.OCTET_STRING_TAG] = new GrammarTransition(
-            StoredProcedureStatesEnum.PROCEDURE_VALUE, StoredProcedureStatesEnum.PARAMETERS_TAG, new GrammarAction(
-                "Stores the procedure" )
-            {
-                public void action( IAsn1Container container ) throws DecoderException
-                {
-
-                    StoredProcedureContainer storedProcedureContainer = ( StoredProcedureContainer ) container;
-
-                    TLV tlv = storedProcedureContainer.getCurrentTLV();
-
-                    StoredProcedure storedProcedure = storedProcedureContainer.getStoredProcedure();
-
-                    // Store the value.
-                    if ( tlv.getLength().getLength() == 0 )
-                    {
-                        // We can't have a void procedure !
-                        log.error( "The procedure can't be null" );
-                        throw new DecoderException( "The procedure can't be null" );
-                    }
-                    else
-                    {
-                        byte[] procedure = tlv.getValue().getData();
-
-                        storedProcedure.setProcedure( procedure );
-                    }
-
-                    if ( log.isDebugEnabled() )
-                    {
-                        log.debug( "Procedure found : " + storedProcedure.getProcedure() );
-                    }
-                }
-            } );
-
-        // parameters SEQUENCE OF Parameter { (Tag)
-        //    ...
-        // Nothing to do
-        super.transitions[StoredProcedureStatesEnum.PARAMETERS_TAG][UniversalTag.SEQUENCE_TAG] = new GrammarTransition(
-            StoredProcedureStatesEnum.PARAMETERS_TAG, StoredProcedureStatesEnum.PARAMETERS_VALUE, null );
-
-        // parameters SEQUENCE OF Parameter { (Value)
-        //    ...
-        // Nothing to do. The list of parameters will be created with the first parameter.
-        super.transitions[StoredProcedureStatesEnum.PARAMETERS_VALUE][UniversalTag.SEQUENCE_TAG] = new GrammarTransition(
-            StoredProcedureStatesEnum.PARAMETERS_VALUE, StoredProcedureStatesEnum.PARAMETER_TAG, new GrammarAction(
-                "Stores the parameters" )
-            {
-                public void action( IAsn1Container container ) throws DecoderException
-                {
-                    StoredProcedureContainer storedProcedureContainer = ( StoredProcedureContainer ) container;
-                    storedProcedureContainer.grammarEndAllowed( true );
-                }
-            } );
-        
-        
-
-        // parameter SEQUENCE OF  { (Tag)
-        //    ...
-        // Nothing to do
-        super.transitions[StoredProcedureStatesEnum.PARAMETER_TAG][UniversalTag.SEQUENCE_TAG] = new GrammarTransition(
-            StoredProcedureStatesEnum.PARAMETER_TAG, StoredProcedureStatesEnum.PARAMETER_VALUE, null );
-
-        // parameter SEQUENCE OF { (Value)
-        //    ...
-        // Nothing to do. 
-        super.transitions[StoredProcedureStatesEnum.PARAMETER_VALUE][UniversalTag.SEQUENCE_TAG] = new GrammarTransition(
-            StoredProcedureStatesEnum.PARAMETER_VALUE, StoredProcedureStatesEnum.PARAMETER_TYPE_TAG, null );
-
-        // Parameter ::= {
-        //    type OCTETSTRING, (Tag)
-        //    ...
-        // Nothing to do
-        super.transitions[StoredProcedureStatesEnum.PARAMETER_TYPE_TAG][UniversalTag.OCTET_STRING_TAG] = new GrammarTransition(
-            StoredProcedureStatesEnum.PARAMETER_TYPE_TAG, StoredProcedureStatesEnum.PARAMETER_TYPE_VALUE, null );
-
-        // Parameter ::= {
-        //    type OCTETSTRING, (Value)
-        //    ...
-        // We can create a parameter, and store its type
-        super.transitions[StoredProcedureStatesEnum.PARAMETER_TYPE_VALUE][UniversalTag.OCTET_STRING_TAG] = new GrammarTransition(
-            StoredProcedureStatesEnum.PARAMETER_TYPE_VALUE, StoredProcedureStatesEnum.PARAMETER_VALUE_TAG, new GrammarAction(
-                "Store parameter type" )
-            {
-                public void action( IAsn1Container container ) throws DecoderException
-                {
-                    StoredProcedureContainer storedProcedureContainer = ( StoredProcedureContainer ) container;
-
-                    TLV tlv = storedProcedureContainer.getCurrentTLV();
-                    StoredProcedure storedProcedure = storedProcedureContainer.getStoredProcedure();
-
-                    // Store the value.
-                    if ( tlv.getLength().getLength() == 0 )
-                    {
-                        // We can't have a void parameter type !
-                        log.error( "The parameter type can't be null" );
-                        throw new DecoderException( "The parameter type can't be null" );
-                    }
-                    else
-                    {
-                        StoredProcedureParameter parameter = new StoredProcedureParameter();
-
-                        byte[] parameterType = tlv.getValue().getData();
-
-                        parameter.setType( parameterType );
-
-                        // We store the type in the current parameter.
-                        storedProcedure.setCurrentParameter( parameter );
-
-                        if ( log.isDebugEnabled() )
-                        {
-                            log.debug( "Parameter type found : " + StringTools.dumpBytes( parameterType ) );
-                        }
-
-                    }
-                }
-            } );
-
-        // Parameter ::= {
-        //    ...
-        //    value OCTETSTRING (Tag)
-        // }
-        // Nothing to do
-        super.transitions[StoredProcedureStatesEnum.PARAMETER_VALUE_TAG][UniversalTag.OCTET_STRING_TAG] = new GrammarTransition(
-            StoredProcedureStatesEnum.PARAMETER_VALUE_TAG, StoredProcedureStatesEnum.PARAMETER_VALUE_VALUE, null );
-
-        // Parameter ::= {
-        //    ...
-        //    value OCTETSTRING (Tag)
-        // }
-        // Store the parameter value
-        super.transitions[StoredProcedureStatesEnum.PARAMETER_VALUE_VALUE][UniversalTag.OCTET_STRING_TAG] = new GrammarTransition(
-            StoredProcedureStatesEnum.PARAMETER_VALUE_VALUE, StoredProcedureStatesEnum.PARAMETER_TAG, new GrammarAction(
-                "Store parameter value" )
-            {
-                public void action( IAsn1Container container ) throws DecoderException
-                {
-                    StoredProcedureContainer storedProcedureContainer = ( StoredProcedureContainer ) container;
-
-                    TLV tlv = storedProcedureContainer.getCurrentTLV();
-                    StoredProcedure storedProcedure = storedProcedureContainer.getStoredProcedure();
-
-                    // Store the value.
-                    if ( tlv.getLength().getLength() == 0 )
-                    {
-                        // We can't have a void parameter value !
-                        log.error( "The parameter value can't be null" );
-                        throw new DecoderException( "The parameter value can't be null" );
-                    }
-                    else
-                    {
-                        byte[] parameterValue = tlv.getValue().getData();
-
-                        if ( parameterValue.length != 0 )
-                        {
-                            StoredProcedureParameter parameter = storedProcedure.getCurrentParameter();
-                            parameter.setValue( parameterValue );
-
-                            // We can now add a new Parameter to the procedure
-                            storedProcedure.addParameter( parameter );
-
-                            if ( log.isDebugEnabled() )
-                            {
-                                log.debug( "Parameter value found : " + StringTools.dumpBytes( parameterValue ) );
-                            }
-                        }
-                        else
-                        {
-                            log.error( "The parameter value is empty. This is not allowed." );
-                            throw new DecoderException( "The parameter value is empty. This is not allowed." );
-                        }
-                    }
-
-                    // The only possible END state for the grammar is here
-                    container.grammarEndAllowed( true );
-                }
-            } );
-    }
-
-
-    //~ Methods ------------------------------------------------------------------------------------
-
-    /**
-     * Get the instance of this grammar
-     *
-     * @return An instance on the StoredProcedure Grammar
-     */
-    public static IGrammar getInstance()
-    {
-        return instance;
-    }
-}
+/*
+ *   Copyright 2006 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.directory.shared.ldap.codec.extended.operations;
+
+
+import org.apache.directory.shared.asn1.ber.IAsn1Container;
+import org.apache.directory.shared.asn1.ber.grammar.AbstractGrammar;
+import org.apache.directory.shared.asn1.ber.grammar.GrammarAction;
+import org.apache.directory.shared.asn1.ber.grammar.GrammarTransition;
+import org.apache.directory.shared.asn1.ber.grammar.IGrammar;
+import org.apache.directory.shared.asn1.ber.tlv.TLV;
+import org.apache.directory.shared.asn1.ber.tlv.UniversalTag;
+import org.apache.directory.shared.asn1.codec.DecoderException;
+import org.apache.directory.shared.ldap.util.StringTools;
+import org.apache.log4j.Logger;
+import org.apache.directory.shared.ldap.codec.extended.operations.StoredProcedure.StoredProcedureParameter;
+
+
+/**
+ * ASN.1 BER Grammar for Stored Procedure Extended Operation
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class StoredProcedureGrammar extends AbstractGrammar implements IGrammar
+{
+    //~ Static fields/initializers -----------------------------------------------------------------
+
+    /** The logger */
+    //private static final Logger log = LoggerFactory.getLogger( StoredProcedureGrammar.class );
+    private static final Logger log = Logger.getLogger( StoredProcedureGrammar.class );
+
+    /** The instance of grammar. StoredProcedureGrammar is a singleton. */
+    private static IGrammar instance = new StoredProcedureGrammar();
+
+
+    //~ Constructors -------------------------------------------------------------------------------
+
+    /**
+     * Creates a new StoredProcedureGrammar object.
+     */
+    private StoredProcedureGrammar()
+    {
+        name = StoredProcedureGrammar.class.getName();
+        statesEnum = StoredProcedureStatesEnum.getInstance();
+
+        // Create the transitions table
+        super.transitions = new GrammarTransition[StoredProcedureStatesEnum.LAST_STORED_PROCEDURE_STATE][256];
+
+        //============================================================================================
+        // StoredProcedure Message
+        //============================================================================================
+        // StoredProcedure ::= SEQUENCE { (Tag)
+        //   ...
+        // Nothing to do.
+        super.transitions[StoredProcedureStatesEnum.STORED_PROCEDURE_TAG][UniversalTag.SEQUENCE_TAG] = new GrammarTransition(
+            StoredProcedureStatesEnum.STORED_PROCEDURE_TAG, StoredProcedureStatesEnum.STORED_PROCEDURE_VALUE, null );
+
+        // StoredProcedure ::= SEQUENCE { (Value)
+        //   ...
+        // Nothing to do.
+        super.transitions[StoredProcedureStatesEnum.STORED_PROCEDURE_VALUE][UniversalTag.SEQUENCE_TAG] = new GrammarTransition(
+            StoredProcedureStatesEnum.STORED_PROCEDURE_VALUE, StoredProcedureStatesEnum.LANGUAGE_TAG, null );
+
+        //    language OCTETSTRING, (Tag)
+        //    ...
+        // Nothing to do
+        super.transitions[StoredProcedureStatesEnum.LANGUAGE_TAG][UniversalTag.OCTET_STRING_TAG] = new GrammarTransition(
+            StoredProcedureStatesEnum.LANGUAGE_TAG, StoredProcedureStatesEnum.LANGUAGE_VALUE, null );
+
+        //    language OCTETSTRING, (Value)
+        //    ...
+        // Store the language.
+        super.transitions[StoredProcedureStatesEnum.LANGUAGE_VALUE][UniversalTag.OCTET_STRING_TAG] = new GrammarTransition(
+            StoredProcedureStatesEnum.LANGUAGE_VALUE, StoredProcedureStatesEnum.PROCEDURE_TAG, new GrammarAction(
+                "Stores the language" )
+            {
+                public void action( IAsn1Container container ) throws DecoderException
+                {
+
+                    StoredProcedureContainer storedProcedureContainer = ( StoredProcedureContainer ) container;
+
+                    TLV tlv = storedProcedureContainer.getCurrentTLV();
+
+                    StoredProcedure storedProcedure = null;
+
+                    // Store the value.
+                    if ( tlv.getLength().getLength() == 0 )
+                    {
+                        // We can't have a void language !
+                        log.error( "The stored procedure language is null" );
+                        throw new DecoderException( "The stored procedure language cannot be null" );
+                    }
+                    else
+                    {
+                        // Only this field's type is String by default
+                        String language = StringTools.utf8ToString( tlv.getValue().getData() );
+
+                        if ( log.isDebugEnabled() )
+                        {
+                            log.debug( "SP language found: " + language );
+                        }
+
+                        storedProcedure = new StoredProcedure();
+                        storedProcedure.setLanguage( language );
+                        storedProcedureContainer.setStoredProcedure( storedProcedure );
+                    }
+                }
+            } );
+
+        //    procedure OCTETSTRING, (Tag)
+        //    ...
+        // Nothing to do
+        super.transitions[StoredProcedureStatesEnum.PROCEDURE_TAG][UniversalTag.OCTET_STRING_TAG] = new GrammarTransition(
+            StoredProcedureStatesEnum.PROCEDURE_TAG, StoredProcedureStatesEnum.PROCEDURE_VALUE, null );
+
+        //    procedure OCTETSTRING, (Value)
+        //    ...
+        // Store the procedure.
+        super.transitions[StoredProcedureStatesEnum.PROCEDURE_VALUE][UniversalTag.OCTET_STRING_TAG] = new GrammarTransition(
+            StoredProcedureStatesEnum.PROCEDURE_VALUE, StoredProcedureStatesEnum.PARAMETERS_TAG, new GrammarAction(
+                "Stores the procedure" )
+            {
+                public void action( IAsn1Container container ) throws DecoderException
+                {
+
+                    StoredProcedureContainer storedProcedureContainer = ( StoredProcedureContainer ) container;
+
+                    TLV tlv = storedProcedureContainer.getCurrentTLV();
+
+                    StoredProcedure storedProcedure = storedProcedureContainer.getStoredProcedure();
+
+                    // Store the value.
+                    if ( tlv.getLength().getLength() == 0 )
+                    {
+                        // We can't have a void procedure !
+                        log.error( "The procedure can't be null" );
+                        throw new DecoderException( "The procedure can't be null" );
+                    }
+                    else
+                    {
+                        byte[] procedure = tlv.getValue().getData();
+
+                        storedProcedure.setProcedure( procedure );
+                    }
+
+                    if ( log.isDebugEnabled() )
+                    {
+                        log.debug( "Procedure found : " + storedProcedure.getProcedure() );
+                    }
+                }
+            } );
+
+        // parameters SEQUENCE OF Parameter { (Tag)
+        //    ...
+        // Nothing to do
+        super.transitions[StoredProcedureStatesEnum.PARAMETERS_TAG][UniversalTag.SEQUENCE_TAG] = new GrammarTransition(
+            StoredProcedureStatesEnum.PARAMETERS_TAG, StoredProcedureStatesEnum.PARAMETERS_VALUE, null );
+
+        // parameters SEQUENCE OF Parameter { (Value)
+        //    ...
+        // Nothing to do. The list of parameters will be created with the first parameter.
+        super.transitions[StoredProcedureStatesEnum.PARAMETERS_VALUE][UniversalTag.SEQUENCE_TAG] = new GrammarTransition(
+            StoredProcedureStatesEnum.PARAMETERS_VALUE, StoredProcedureStatesEnum.PARAMETER_TAG, new GrammarAction(
+                "Stores the parameters" )
+            {
+                public void action( IAsn1Container container ) throws DecoderException
+                {
+                    StoredProcedureContainer storedProcedureContainer = ( StoredProcedureContainer ) container;
+                    storedProcedureContainer.grammarEndAllowed( true );
+                }
+            } );
+        
+        
+
+        // parameter SEQUENCE OF  { (Tag)
+        //    ...
+        // Nothing to do
+        super.transitions[StoredProcedureStatesEnum.PARAMETER_TAG][UniversalTag.SEQUENCE_TAG] = new GrammarTransition(
+            StoredProcedureStatesEnum.PARAMETER_TAG, StoredProcedureStatesEnum.PARAMETER_VALUE, null );
+
+        // parameter SEQUENCE OF { (Value)
+        //    ...
+        // Nothing to do. 
+        super.transitions[StoredProcedureStatesEnum.PARAMETER_VALUE][UniversalTag.SEQUENCE_TAG] = new GrammarTransition(
+            StoredProcedureStatesEnum.PARAMETER_VALUE, StoredProcedureStatesEnum.PARAMETER_TYPE_TAG, null );
+
+        // Parameter ::= {
+        //    type OCTETSTRING, (Tag)
+        //    ...
+        // Nothing to do
+        super.transitions[StoredProcedureStatesEnum.PARAMETER_TYPE_TAG][UniversalTag.OCTET_STRING_TAG] = new GrammarTransition(
+            StoredProcedureStatesEnum.PARAMETER_TYPE_TAG, StoredProcedureStatesEnum.PARAMETER_TYPE_VALUE, null );
+
+        // Parameter ::= {
+        //    type OCTETSTRING, (Value)
+        //    ...
+        // We can create a parameter, and store its type
+        super.transitions[StoredProcedureStatesEnum.PARAMETER_TYPE_VALUE][UniversalTag.OCTET_STRING_TAG] = new GrammarTransition(
+            StoredProcedureStatesEnum.PARAMETER_TYPE_VALUE, StoredProcedureStatesEnum.PARAMETER_VALUE_TAG, new GrammarAction(
+                "Store parameter type" )
+            {
+                public void action( IAsn1Container container ) throws DecoderException
+                {
+                    StoredProcedureContainer storedProcedureContainer = ( StoredProcedureContainer ) container;
+
+                    TLV tlv = storedProcedureContainer.getCurrentTLV();
+                    StoredProcedure storedProcedure = storedProcedureContainer.getStoredProcedure();
+
+                    // Store the value.
+                    if ( tlv.getLength().getLength() == 0 )
+                    {
+                        // We can't have a void parameter type !
+                        log.error( "The parameter type can't be null" );
+                        throw new DecoderException( "The parameter type can't be null" );
+                    }
+                    else
+                    {
+                        StoredProcedureParameter parameter = new StoredProcedureParameter();
+
+                        byte[] parameterType = tlv.getValue().getData();
+
+                        parameter.setType( parameterType );
+
+                        // We store the type in the current parameter.
+                        storedProcedure.setCurrentParameter( parameter );
+
+                        if ( log.isDebugEnabled() )
+                        {
+                            log.debug( "Parameter type found : " + StringTools.dumpBytes( parameterType ) );
+                        }
+
+                    }
+                }
+            } );
+
+        // Parameter ::= {
+        //    ...
+        //    value OCTETSTRING (Tag)
+        // }
+        // Nothing to do
+        super.transitions[StoredProcedureStatesEnum.PARAMETER_VALUE_TAG][UniversalTag.OCTET_STRING_TAG] = new GrammarTransition(
+            StoredProcedureStatesEnum.PARAMETER_VALUE_TAG, StoredProcedureStatesEnum.PARAMETER_VALUE_VALUE, null );
+
+        // Parameter ::= {
+        //    ...
+        //    value OCTETSTRING (Tag)
+        // }
+        // Store the parameter value
+        super.transitions[StoredProcedureStatesEnum.PARAMETER_VALUE_VALUE][UniversalTag.OCTET_STRING_TAG] = new GrammarTransition(
+            StoredProcedureStatesEnum.PARAMETER_VALUE_VALUE, StoredProcedureStatesEnum.PARAMETER_TAG, new GrammarAction(
+                "Store parameter value" )
+            {
+                public void action( IAsn1Container container ) throws DecoderException
+                {
+                    StoredProcedureContainer storedProcedureContainer = ( StoredProcedureContainer ) container;
+
+                    TLV tlv = storedProcedureContainer.getCurrentTLV();
+                    StoredProcedure storedProcedure = storedProcedureContainer.getStoredProcedure();
+
+                    // Store the value.
+                    if ( tlv.getLength().getLength() == 0 )
+                    {
+                        // We can't have a void parameter value !
+                        log.error( "The parameter value can't be null" );
+                        throw new DecoderException( "The parameter value can't be null" );
+                    }
+                    else
+                    {
+                        byte[] parameterValue = tlv.getValue().getData();
+
+                        if ( parameterValue.length != 0 )
+                        {
+                            StoredProcedureParameter parameter = storedProcedure.getCurrentParameter();
+                            parameter.setValue( parameterValue );
+
+                            // We can now add a new Parameter to the procedure
+                            storedProcedure.addParameter( parameter );
+
+                            if ( log.isDebugEnabled() )
+                            {
+                                log.debug( "Parameter value found : " + StringTools.dumpBytes( parameterValue ) );
+                            }
+                        }
+                        else
+                        {
+                            log.error( "The parameter value is empty. This is not allowed." );
+                            throw new DecoderException( "The parameter value is empty. This is not allowed." );
+                        }
+                    }
+
+                    // The only possible END state for the grammar is here
+                    container.grammarEndAllowed( true );
+                }
+            } );
+    }
+
+
+    //~ Methods ------------------------------------------------------------------------------------
+
+    /**
+     * Get the instance of this grammar
+     *
+     * @return An instance on the StoredProcedure Grammar
+     */
+    public static IGrammar getInstance()
+    {
+        return instance;
+    }
+}

Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/StoredProcedureStatesEnum.java
URL: http://svn.apache.org/viewcvs/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/StoredProcedureStatesEnum.java?rev=400067&r1=400066&r2=400067&view=diff
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/StoredProcedureStatesEnum.java (original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/StoredProcedureStatesEnum.java Fri May  5 05:52:49 2006
@@ -1,207 +1,207 @@
-/*
- *   Copyright 2006 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.directory.shared.ldap.codec.extended.operations;
-
-
-import org.apache.directory.shared.asn1.ber.grammar.IGrammar;
-import org.apache.directory.shared.asn1.ber.grammar.IStates;
-
-
-/**
- * Constants for StoredProcedureGrammar
- * 
- * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
- */
-public class StoredProcedureStatesEnum implements IStates
-{
-    //~ Static fields/initializers -----------------------------------------------------------------
-
-    //=========================================================================
-    // StoredProcedure
-    //=========================================================================
-    /** StoredProcedure Tag */
-    public static int STORED_PROCEDURE_TAG = 0;
-
-    /** StoredProcedure Value */
-    public static int STORED_PROCEDURE_VALUE = 1;
-
-    // Language ---------------------------------------------------------------
-    /** Language Tag */
-    public static int LANGUAGE_TAG = 2;
-
-    /** Language Value */
-    public static int LANGUAGE_VALUE = 3;
-
-    // Procedure --------------------------------------------------------------
-    /** Procedure Tag */
-    public static int PROCEDURE_TAG = 4;
-
-    /** Procedure Value */
-    public static int PROCEDURE_VALUE = 5;
-
-    // Parameters -------------------------------------------------------------
-    /** Parameters Tag */
-    public static int PARAMETERS_TAG = 6;
-
-    /** Parameters Value */
-    public static int PARAMETERS_VALUE = 7;
-
-    // Parameter --------------------------------------------------------------
-    /** Parameter Tag */
-    public static int PARAMETER_TAG = 8;
-
-    /** Parameter Value */
-    public static int PARAMETER_VALUE = 9;
-
-    // Parameter type ---------------------------------------------------------
-    /** Parameter type Tag */
-    public static int PARAMETER_TYPE_TAG = 10;
-
-    /** Parameter type Value */
-    public static int PARAMETER_TYPE_VALUE = 11;
-
-    // Parameters value -------------------------------------------------------
-    /** Parameter value Tag */
-    public static int PARAMETER_VALUE_TAG = 12;
-
-    /** Parameter value Value */
-    public static int PARAMETER_VALUE_VALUE = 13;
-
-    public static int LAST_STORED_PROCEDURE_STATE = 14;
-
-    //=========================================================================
-    // Grammars declaration.
-    //=========================================================================
-    /** Ldap Message Grammar */
-    public static final int STORED_PROCEDURE_GRAMMAR_SWITCH = 0x0100;
-
-    /** LdapMessage grammar number */
-    public static final int STORED_PROCEDURE_GRAMMAR = 0;
-
-    /** The total number of grammars used */
-    public static final int NB_GRAMMARS = 1;
-
-    //=========================================================================
-    // Grammar switches debug strings 
-    //=========================================================================
-    /** A string representation of grammars */
-    private static String[] GrammarSwitchString = new String[]
-        { "STORED_PROCEDURE_GRAMMAR_SWITCH", };
-
-    //=========================================================================
-    // States debug strings 
-    //=========================================================================
-    /** A string representation of all the states */
-    private static String[] StoredProcedureString = new String[]
-        { "STORED_PROCEDURE_TAG", "STORED_PROCEDURE_VALUE", "LANGUAGE_TAG", "LANGUAGE_VALUE", "PROCEDURE_TAG",
-            "PROCEDURE_VALUE", "PARAMETERS_TAG", "PARAMETERS_VALUE", "PARAMETER_TYPE_TAG", "PARAMETER_TYPE_VALUE",
-            "PARAMETER_VALUE_TAG", "PARAMETER_VALUE_VALUE" };
-
-    /** The instance */
-    private static StoredProcedureStatesEnum instance = new StoredProcedureStatesEnum();
-
-
-    //~ Constructors -------------------------------------------------------------------------------
-
-    /**
-     * This is a private constructor. This class is a singleton
-     *
-     */
-    private StoredProcedureStatesEnum()
-    {
-    }
-
-
-    //~ Methods ------------------------------------------------------------------------------------
-
-    /**
-     * Get an instance of this class
-     * @return An instance on this class
-     */
-    public static IStates getInstance()
-    {
-        return instance;
-    }
-
-
-    /**
-     * Get the grammar name
-     * @param The grammar code
-     * @return The grammar name
-     */
-    public String getGrammarName( int grammar )
-    {
-        switch ( grammar )
-        {
-            case STORED_PROCEDURE_GRAMMAR:
-                return "STORED_PROCEDURE_GRAMMAR";
-
-            default:
-                return "UNKNOWN";
-        }
-    }
-
-
-    /**
-     * Get the grammar name
-     * @param The grammar class
-     * @return The grammar name
-     */
-    public String getGrammarName( IGrammar grammar )
-    {
-        if ( grammar instanceof StoredProcedureGrammar )
-        {
-            return "STORED_PROCEDURE_GRAMMAR";
-        }
-        else
-        {
-            return "UNKNOWN GRAMMAR";
-        }
-    }
-
-
-    /**
-     * Get the string representing the state
-     * 
-     * @param grammar The current grammar being used
-     * @param state The state number
-     * @return The String representing the state
-     */
-    public String getState( int grammar, int state )
-    {
-
-        if ( ( state & GRAMMAR_SWITCH_MASK ) != 0 )
-        {
-            return ( state == END_STATE ) ? "END_STATE"
-                : GrammarSwitchString[( ( state & GRAMMAR_SWITCH_MASK ) >> 8 ) - 1];
-        }
-        else
-        {
-
-            switch ( grammar )
-            {
-
-                case STORED_PROCEDURE_GRAMMAR:
-                    return ( ( state == GRAMMAR_END ) ? "STORED_PROCEDURE_END_STATE" : StoredProcedureString[state] );
-
-                default:
-                    return "UNKNOWN";
-            }
-        }
-    }
-}
+/*
+ *   Copyright 2006 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.directory.shared.ldap.codec.extended.operations;
+
+
+import org.apache.directory.shared.asn1.ber.grammar.IGrammar;
+import org.apache.directory.shared.asn1.ber.grammar.IStates;
+
+
+/**
+ * Constants for StoredProcedureGrammar
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class StoredProcedureStatesEnum implements IStates
+{
+    //~ Static fields/initializers -----------------------------------------------------------------
+
+    //=========================================================================
+    // StoredProcedure
+    //=========================================================================
+    /** StoredProcedure Tag */
+    public static int STORED_PROCEDURE_TAG = 0;
+
+    /** StoredProcedure Value */
+    public static int STORED_PROCEDURE_VALUE = 1;
+
+    // Language ---------------------------------------------------------------
+    /** Language Tag */
+    public static int LANGUAGE_TAG = 2;
+
+    /** Language Value */
+    public static int LANGUAGE_VALUE = 3;
+
+    // Procedure --------------------------------------------------------------
+    /** Procedure Tag */
+    public static int PROCEDURE_TAG = 4;
+
+    /** Procedure Value */
+    public static int PROCEDURE_VALUE = 5;
+
+    // Parameters -------------------------------------------------------------
+    /** Parameters Tag */
+    public static int PARAMETERS_TAG = 6;
+
+    /** Parameters Value */
+    public static int PARAMETERS_VALUE = 7;
+
+    // Parameter --------------------------------------------------------------
+    /** Parameter Tag */
+    public static int PARAMETER_TAG = 8;
+
+    /** Parameter Value */
+    public static int PARAMETER_VALUE = 9;
+
+    // Parameter type ---------------------------------------------------------
+    /** Parameter type Tag */
+    public static int PARAMETER_TYPE_TAG = 10;
+
+    /** Parameter type Value */
+    public static int PARAMETER_TYPE_VALUE = 11;
+
+    // Parameters value -------------------------------------------------------
+    /** Parameter value Tag */
+    public static int PARAMETER_VALUE_TAG = 12;
+
+    /** Parameter value Value */
+    public static int PARAMETER_VALUE_VALUE = 13;
+
+    public static int LAST_STORED_PROCEDURE_STATE = 14;
+
+    //=========================================================================
+    // Grammars declaration.
+    //=========================================================================
+    /** Ldap Message Grammar */
+    public static final int STORED_PROCEDURE_GRAMMAR_SWITCH = 0x0100;
+
+    /** LdapMessage grammar number */
+    public static final int STORED_PROCEDURE_GRAMMAR = 0;
+
+    /** The total number of grammars used */
+    public static final int NB_GRAMMARS = 1;
+
+    //=========================================================================
+    // Grammar switches debug strings 
+    //=========================================================================
+    /** A string representation of grammars */
+    private static String[] GrammarSwitchString = new String[]
+        { "STORED_PROCEDURE_GRAMMAR_SWITCH", };
+
+    //=========================================================================
+    // States debug strings 
+    //=========================================================================
+    /** A string representation of all the states */
+    private static String[] StoredProcedureString = new String[]
+        { "STORED_PROCEDURE_TAG", "STORED_PROCEDURE_VALUE", "LANGUAGE_TAG", "LANGUAGE_VALUE", "PROCEDURE_TAG",
+            "PROCEDURE_VALUE", "PARAMETERS_TAG", "PARAMETERS_VALUE", "PARAMETER_TYPE_TAG", "PARAMETER_TYPE_VALUE",
+            "PARAMETER_VALUE_TAG", "PARAMETER_VALUE_VALUE" };
+
+    /** The instance */
+    private static StoredProcedureStatesEnum instance = new StoredProcedureStatesEnum();
+
+
+    //~ Constructors -------------------------------------------------------------------------------
+
+    /**
+     * This is a private constructor. This class is a singleton
+     *
+     */
+    private StoredProcedureStatesEnum()
+    {
+    }
+
+
+    //~ Methods ------------------------------------------------------------------------------------
+
+    /**
+     * Get an instance of this class
+     * @return An instance on this class
+     */
+    public static IStates getInstance()
+    {
+        return instance;
+    }
+
+
+    /**
+     * Get the grammar name
+     * @param The grammar code
+     * @return The grammar name
+     */
+    public String getGrammarName( int grammar )
+    {
+        switch ( grammar )
+        {
+            case STORED_PROCEDURE_GRAMMAR:
+                return "STORED_PROCEDURE_GRAMMAR";
+
+            default:
+                return "UNKNOWN";
+        }
+    }
+
+
+    /**
+     * Get the grammar name
+     * @param The grammar class
+     * @return The grammar name
+     */
+    public String getGrammarName( IGrammar grammar )
+    {
+        if ( grammar instanceof StoredProcedureGrammar )
+        {
+            return "STORED_PROCEDURE_GRAMMAR";
+        }
+        else
+        {
+            return "UNKNOWN GRAMMAR";
+        }
+    }
+
+
+    /**
+     * Get the string representing the state
+     * 
+     * @param grammar The current grammar being used
+     * @param state The state number
+     * @return The String representing the state
+     */
+    public String getState( int grammar, int state )
+    {
+
+        if ( ( state & GRAMMAR_SWITCH_MASK ) != 0 )
+        {
+            return ( state == END_STATE ) ? "END_STATE"
+                : GrammarSwitchString[( ( state & GRAMMAR_SWITCH_MASK ) >> 8 ) - 1];
+        }
+        else
+        {
+
+            switch ( grammar )
+            {
+
+                case STORED_PROCEDURE_GRAMMAR:
+                    return ( ( state == GRAMMAR_END ) ? "STORED_PROCEDURE_END_STATE" : StoredProcedureString[state] );
+
+                default:
+                    return "UNKNOWN";
+            }
+        }
+    }
+}

Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/ModifyDnRequest.java
URL: http://svn.apache.org/viewcvs/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/ModifyDnRequest.java?rev=400067&r1=400066&r2=400067&view=diff
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/ModifyDnRequest.java (original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/ModifyDnRequest.java Fri May  5 05:52:49 2006
@@ -1,168 +1,168 @@
-/*
- *   Copyright 2004 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.directory.shared.ldap.message;
-
-
-/**
- * Modify DN request protocol message used to rename or move an existing entry
- * in the directory. Here's what <a
- * href="http://www.faqs.org/rfcs/rfc2251.html">RFC 2251</a> has to say about
- * it:
- * 
- * <pre>
+/*
+ *   Copyright 2004 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.directory.shared.ldap.message;
+
+
+/**
+ * Modify DN request protocol message used to rename or move an existing entry
+ * in the directory. Here's what <a
+ * href="http://www.faqs.org/rfcs/rfc2251.html">RFC 2251</a> has to say about
+ * it:
+ * 
+ * <pre>
  *  4.9. Modify DN Operation
- * 
- *   The Modify DN Operation allows a client to change the leftmost (least
- *   significant) component of the name of an entry in the directory, or
- *   to move a subtree of entries to a new location in the directory.  The
- *   Modify DN Request is defined as follows:
- * 
- *        ModifyDNRequest ::= [APPLICATION 12] SEQUENCE {
- *                entry           LDAPDN,
- *                newrdn          RelativeLDAPDN,
- *                deleteoldrdn    BOOLEAN,
- *                newSuperior     [0] LDAPDN OPTIONAL }
- * 
- *   Parameters of the Modify DN Request are:
- * 
- *   - entry: the Distinguished Name of the entry to be changed.  This
- *     entry may or may not have subordinate entries.
- * 
- *   - newrdn: the RDN that will form the leftmost component of the new
- *     name of the entry.
- * 
- *   - deleteoldrdn: a boolean parameter that controls whether the old RDN
- *     attribute values are to be retained as attributes of the entry, or
- *     deleted from the entry.
- * 
- *   - newSuperior: if present, this is the Distinguished Name of the entry
- *     which becomes the immediate superior of the existing entry.
- * </pre>
- * 
- * Note that this operation can move an entry and change its Rdn at the same
- * time in fact it might have no choice to comply with name forms.
- * 
- * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
- * @version $Revision$
- */
-public interface ModifyDnRequest extends SingleReplyRequest, AbandonableRequest
-{
-    /** Modify DN request message type enumeration value */
-    MessageTypeEnum TYPE = MessageTypeEnum.MODDNREQUEST;
-
-    /** Modify DN response message type enumeration value */
-    MessageTypeEnum RESP_TYPE = ModifyDnResponse.TYPE;
-
-
-    /**
-     * Gets the entry's distinguished name representing the <b>entry</b> PDU
-     * field.
-     * 
-     * @return the distinguished name of the entry.
-     */
-    String getName();
-
-
-    /**
-     * Sets the entry's distinguished name representing the <b>entry</b> PDU
-     * field.
-     * 
-     * @param name
-     *            the distinguished name of the entry.
-     */
-    void setName( String name );
-
-
-    /**
-     * Gets the new relative distinguished name for the entry which represents
-     * the PDU's <b>newrdn</b> field.
-     * 
-     * @return the relative dn with one component
-     */
-    String getNewRdn();
-
-
-    /**
-     * Sets the new relative distinguished name for the entry which represents
-     * the PDU's <b>newrdn</b> field.
-     * 
-     * @param newRdn
-     *            the relative dn with one component
-     */
-    void setNewRdn( String newRdn );
-
-
-    /**
-     * Gets the flag which determines if the old Rdn attribute is to be removed
-     * from the entry when the new Rdn is used in its stead. This property
-     * corresponds to the <b>deleteoldrdn
-     * </p>
-     * PDU field.
-     * 
-     * @return true if the old rdn is to be deleted, false if it is not
-     */
-    boolean getDeleteOldRdn();
-
-
-    /**
-     * Sets the flag which determines if the old Rdn attribute is to be removed
-     * from the entry when the new Rdn is used in its stead. This property
-     * corresponds to the <b>deleteoldrdn
-     * </p>
-     * PDU field.
-     * 
-     * @param deleteOldRdn
-     *            true if the old rdn is to be deleted, false if it is not
-     */
-    void setDeleteOldRdn( boolean deleteOldRdn );
-
-
-    /**
-     * Gets the optional distinguished name of the new superior entry where the
-     * candidate entry is to be moved. This property corresponds to the PDU's
-     * <b>newSuperior</b> field. May be null representing a simple Rdn change
-     * rather than a move operation.
-     * 
-     * @return the dn of the superior entry the candidate entry is moved under.
-     */
-    String getNewSuperior();
-
-
-    /**
-     * Sets the optional distinguished name of the new superior entry where the
-     * candidate entry is to be moved. This property corresponds to the PDU's
-     * <b>newSuperior</b> field. May be null representing a simple Rdn change
-     * rather than a move operation. Setting this property to a non-null value
-     * toggles the move flag obtained via the <code>isMove</code> method.
-     * 
-     * @param newSuperior
-     *            the dn of the superior entry the candidate entry for DN
-     *            modification is moved under.
-     */
-    void setNewSuperior( String newSuperior );
-
-
-    /**
-     * Gets whether or not this request is a DN change resulting in a move
-     * operation. Setting the newSuperior property to a non-null name, toggles
-     * this flag.
-     * 
-     * @return true if the newSuperior property is <b>NOT</b> null, false
-     *         otherwise.
-     */
-    boolean isMove();
-}
+ * 
+ *   The Modify DN Operation allows a client to change the leftmost (least
+ *   significant) component of the name of an entry in the directory, or
+ *   to move a subtree of entries to a new location in the directory.  The
+ *   Modify DN Request is defined as follows:
+ * 
+ *        ModifyDNRequest ::= [APPLICATION 12] SEQUENCE {
+ *                entry           LDAPDN,
+ *                newrdn          RelativeLDAPDN,
+ *                deleteoldrdn    BOOLEAN,
+ *                newSuperior     [0] LDAPDN OPTIONAL }
+ * 
+ *   Parameters of the Modify DN Request are:
+ * 
+ *   - entry: the Distinguished Name of the entry to be changed.  This
+ *     entry may or may not have subordinate entries.
+ * 
+ *   - newrdn: the RDN that will form the leftmost component of the new
+ *     name of the entry.
+ * 
+ *   - deleteoldrdn: a boolean parameter that controls whether the old RDN
+ *     attribute values are to be retained as attributes of the entry, or
+ *     deleted from the entry.
+ * 
+ *   - newSuperior: if present, this is the Distinguished Name of the entry
+ *     which becomes the immediate superior of the existing entry.
+ * </pre>
+ * 
+ * Note that this operation can move an entry and change its Rdn at the same
+ * time in fact it might have no choice to comply with name forms.
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Revision$
+ */
+public interface ModifyDnRequest extends SingleReplyRequest, AbandonableRequest
+{
+    /** Modify DN request message type enumeration value */
+    MessageTypeEnum TYPE = MessageTypeEnum.MODDNREQUEST;
+
+    /** Modify DN response message type enumeration value */
+    MessageTypeEnum RESP_TYPE = ModifyDnResponse.TYPE;
+
+
+    /**
+     * Gets the entry's distinguished name representing the <b>entry</b> PDU
+     * field.
+     * 
+     * @return the distinguished name of the entry.
+     */
+    String getName();
+
+
+    /**
+     * Sets the entry's distinguished name representing the <b>entry</b> PDU
+     * field.
+     * 
+     * @param name
+     *            the distinguished name of the entry.
+     */
+    void setName( String name );
+
+
+    /**
+     * Gets the new relative distinguished name for the entry which represents
+     * the PDU's <b>newrdn</b> field.
+     * 
+     * @return the relative dn with one component
+     */
+    String getNewRdn();
+
+
+    /**
+     * Sets the new relative distinguished name for the entry which represents
+     * the PDU's <b>newrdn</b> field.
+     * 
+     * @param newRdn
+     *            the relative dn with one component
+     */
+    void setNewRdn( String newRdn );
+
+
+    /**
+     * Gets the flag which determines if the old Rdn attribute is to be removed
+     * from the entry when the new Rdn is used in its stead. This property
+     * corresponds to the <b>deleteoldrdn
+     * </p>
+     * PDU field.
+     * 
+     * @return true if the old rdn is to be deleted, false if it is not
+     */
+    boolean getDeleteOldRdn();
+
+
+    /**
+     * Sets the flag which determines if the old Rdn attribute is to be removed
+     * from the entry when the new Rdn is used in its stead. This property
+     * corresponds to the <b>deleteoldrdn
+     * </p>
+     * PDU field.
+     * 
+     * @param deleteOldRdn
+     *            true if the old rdn is to be deleted, false if it is not
+     */
+    void setDeleteOldRdn( boolean deleteOldRdn );
+
+
+    /**
+     * Gets the optional distinguished name of the new superior entry where the
+     * candidate entry is to be moved. This property corresponds to the PDU's
+     * <b>newSuperior</b> field. May be null representing a simple Rdn change
+     * rather than a move operation.
+     * 
+     * @return the dn of the superior entry the candidate entry is moved under.
+     */
+    String getNewSuperior();
+
+
+    /**
+     * Sets the optional distinguished name of the new superior entry where the
+     * candidate entry is to be moved. This property corresponds to the PDU's
+     * <b>newSuperior</b> field. May be null representing a simple Rdn change
+     * rather than a move operation. Setting this property to a non-null value
+     * toggles the move flag obtained via the <code>isMove</code> method.
+     * 
+     * @param newSuperior
+     *            the dn of the superior entry the candidate entry for DN
+     *            modification is moved under.
+     */
+    void setNewSuperior( String newSuperior );
+
+
+    /**
+     * Gets whether or not this request is a DN change resulting in a move
+     * operation. Setting the newSuperior property to a non-null name, toggles
+     * this flag.
+     * 
+     * @return true if the newSuperior property is <b>NOT</b> null, false
+     *         otherwise.
+     */
+    boolean isMove();
+}

Modified: directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/codec/extended/operations/StoredProcedureTest.java
URL: http://svn.apache.org/viewcvs/directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/codec/extended/operations/StoredProcedureTest.java?rev=400067&r1=400066&r2=400067&view=diff
==============================================================================
--- directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/codec/extended/operations/StoredProcedureTest.java (original)
+++ directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/codec/extended/operations/StoredProcedureTest.java Fri May  5 05:52:49 2006
@@ -1,241 +1,241 @@
-/*
- *   Copyright 2006 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.directory.shared.ldap.codec.extended.operations;
-
-
-import java.nio.ByteBuffer;
-
-import javax.naming.NamingException;
-
-import junit.framework.Assert;
-import junit.framework.TestCase;
-
-import org.apache.directory.shared.asn1.ber.Asn1Decoder;
-import org.apache.directory.shared.asn1.ber.IAsn1Container;
-import org.apache.directory.shared.asn1.codec.DecoderException;
-import org.apache.directory.shared.asn1.codec.EncoderException;
-import org.apache.directory.shared.ldap.codec.extended.operations.StoredProcedure.StoredProcedureParameter;
-import org.apache.directory.shared.ldap.util.StringTools;
-
-
-/*
- * TestCase for a Stored Procedure Extended Operation ASN.1 codec
- * 
- * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
- */
-public class StoredProcedureTest extends TestCase
-{
-    public void testDecodeStoredProcedureNParams() throws NamingException
-    {
-        Asn1Decoder storedProcedureDecoder = new StoredProcedureDecoder();
-
-        ByteBuffer stream = ByteBuffer.allocate( 0x44 );
-
-        stream.put( new byte[]
-            {
-                0x30, 0x42,
-                    0x04, 0x04, 'J', 'a', 'v', 'a',
-                    0x04, 0x07, 'e', 'x', 'e', 'c', 'u', 't', 'e',
-                    0x30, 0x31,
-                      0x30, 0x08,
-                        0x04, 0x03, 'i', 'n', 't', 
-                        0x04, 0x01, 0x01,
-                      0x30, 0x0F,
-                        0x04, 0x07, 'b', 'o', 'o', 'l', 'e', 'a', 'n', 
-                        0x04, 0x04, 't', 'r', 'u', 'e',
-                      0x30, 0x14,
-                        0x04, 0x06, 'S', 't', 'r', 'i', 'n', 'g', 
-                        0x04, 0x0A, 'p', 'a', 'r', 'a', 'm', 'e', 't', 'e', 'r', '3' 
-            } );
-
-        String decodedPdu = StringTools.dumpBytes( stream.array() );
-        stream.flip();
-
-        // Allocate a StoredProcedure Container
-        IAsn1Container storedProcedureContainer = new StoredProcedureContainer();
-
-        // Decode a StoredProcedure message
-        try
-        {
-            storedProcedureDecoder.decode( stream, storedProcedureContainer );
-        }
-        catch ( DecoderException de )
-        {
-            de.printStackTrace();
-            Assert.fail( de.getMessage() );
-        }
-
-        StoredProcedure storedProcedure = ( ( StoredProcedureContainer ) storedProcedureContainer ).getStoredProcedure();
-
-        Assert.assertEquals("Java", storedProcedure.getLanguage());
-        
-        Assert.assertEquals( "execute", StringTools.utf8ToString( storedProcedure.getProcedure() ) );
-
-        Assert.assertNotNull( storedProcedure.getParameters() );
-        Assert.assertEquals( 3, storedProcedure.getParameters().size() );
-
-        StoredProcedureParameter param = ( StoredProcedureParameter ) storedProcedure.getParameters().get( 0 );
-
-        Assert.assertEquals( "int", StringTools.utf8ToString( param.getType() ) );
-        Assert.assertEquals( 1, param.getValue()[0] );
-
-        param = ( StoredProcedureParameter ) storedProcedure.getParameters().get( 1 );
-
-        Assert.assertEquals( "boolean", StringTools.utf8ToString( param.getType() ) );
-        Assert.assertEquals( "true", StringTools.utf8ToString( param.getValue() ) );
-
-        param = ( StoredProcedureParameter ) storedProcedure.getParameters().get( 2 );
-
-        Assert.assertEquals( "String", StringTools.utf8ToString( param.getType() ) );
-        Assert.assertEquals( "parameter3", StringTools.utf8ToString( param.getValue() ) );
-
-        // Check the encoding
-        try
-        {
-            ByteBuffer bb = storedProcedure.encode( null );
-
-            String encodedPdu = StringTools.dumpBytes( bb.array() );
-
-            assertEquals( encodedPdu, decodedPdu );
-        }
-        catch ( EncoderException ee )
-        {
-            ee.printStackTrace();
-            fail( ee.getMessage() );
-        }
-    }
-
-    public void testDecodeStoredProcedureNoParam() throws NamingException
-    {
-        Asn1Decoder storedProcedureDecoder = new StoredProcedureDecoder();
-
-        ByteBuffer stream = ByteBuffer.allocate( 0x13 );
-
-        stream.put( new byte[]
-            {
-                0x30, 0x11,
-                    0x04, 0x04, 'J', 'a', 'v', 'a',
-                    0x04, 0x07, 'e', 'x', 'e', 'c', 'u', 't', 'e',
-                    0x30, 0x00
-            } );
-
-        String decodedPdu = StringTools.dumpBytes( stream.array() );
-        stream.flip();
-
-        // Allocate a StoredProcedure Container
-        IAsn1Container storedProcedureContainer = new StoredProcedureContainer();
-
-        // Decode a StoredProcedure message
-        try
-        {
-            storedProcedureDecoder.decode( stream, storedProcedureContainer );
-        }
-        catch ( DecoderException de )
-        {
-            de.printStackTrace();
-            Assert.fail( de.getMessage() );
-        }
-
-        StoredProcedure storedProcedure = ( ( StoredProcedureContainer ) storedProcedureContainer ).getStoredProcedure();
-
-        Assert.assertEquals("Java", storedProcedure.getLanguage());
-        
-        Assert.assertEquals( "execute", StringTools.utf8ToString( storedProcedure.getProcedure() ) );
-
-        Assert.assertNull( storedProcedure.getParameters() );
-        
-        // Check the encoding
-        try
-        {
-            ByteBuffer bb = storedProcedure.encode( null );
-
-            String encodedPdu = StringTools.dumpBytes( bb.array() );
-
-            assertEquals( encodedPdu, decodedPdu );
-        }
-        catch ( EncoderException ee )
-        {
-            ee.printStackTrace();
-            fail( ee.getMessage() );
-        }
-    }
-
-    public void testDecodeStoredProcedureOneParam() throws NamingException
-    {
-        Asn1Decoder storedProcedureDecoder = new StoredProcedureDecoder();
-
-        ByteBuffer stream = ByteBuffer.allocate( 0x1D );
-
-        stream.put( new byte[]
-            {
-                0x30, 0x1B,
-                  0x04, 0x04, 'J', 'a', 'v', 'a',
-                  0x04, 0x07, 'e', 'x', 'e', 'c', 'u', 't', 'e',
-                  0x30, 0x0A,
-                      0x30, 0x08,
-                        0x04, 0x03, 'i', 'n', 't', 
-                        0x04, 0x01, 0x01,
-            } );
-
-        String decodedPdu = StringTools.dumpBytes( stream.array() );
-        stream.flip();
-
-        // Allocate a StoredProcedure Container
-        IAsn1Container storedProcedureContainer = new StoredProcedureContainer();
-
-        // Decode a StoredProcedure message
-        try
-        {
-            storedProcedureDecoder.decode( stream, storedProcedureContainer );
-        }
-        catch ( DecoderException de )
-        {
-            de.printStackTrace();
-            Assert.fail( de.getMessage() );
-        }
-
-        StoredProcedure storedProcedure = ( ( StoredProcedureContainer ) storedProcedureContainer ).getStoredProcedure();
-
-        Assert.assertEquals("Java", storedProcedure.getLanguage());
-        
-        Assert.assertEquals( "execute", StringTools.utf8ToString( storedProcedure.getProcedure() ) );
-
-        Assert.assertNotNull( storedProcedure.getParameters() );
-        Assert.assertEquals( 1, storedProcedure.getParameters().size() );
-
-        StoredProcedureParameter param = ( StoredProcedureParameter ) storedProcedure.getParameters().get( 0 );
-
-        Assert.assertEquals( "int", StringTools.utf8ToString( param.getType() ) );
-        Assert.assertEquals( 1, param.getValue()[0] );
-
-        // Check the encoding
-        try
-        {
-            ByteBuffer bb = storedProcedure.encode( null );
-
-            String encodedPdu = StringTools.dumpBytes( bb.array() );
-
-            assertEquals( encodedPdu, decodedPdu );
-        }
-        catch ( EncoderException ee )
-        {
-            ee.printStackTrace();
-            fail( ee.getMessage() );
-        }
-    }
-}
+/*
+ *   Copyright 2006 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.directory.shared.ldap.codec.extended.operations;
+
+
+import java.nio.ByteBuffer;
+
+import javax.naming.NamingException;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+import org.apache.directory.shared.asn1.ber.Asn1Decoder;
+import org.apache.directory.shared.asn1.ber.IAsn1Container;
+import org.apache.directory.shared.asn1.codec.DecoderException;
+import org.apache.directory.shared.asn1.codec.EncoderException;
+import org.apache.directory.shared.ldap.codec.extended.operations.StoredProcedure.StoredProcedureParameter;
+import org.apache.directory.shared.ldap.util.StringTools;
+
+
+/*
+ * TestCase for a Stored Procedure Extended Operation ASN.1 codec
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class StoredProcedureTest extends TestCase
+{
+    public void testDecodeStoredProcedureNParams() throws NamingException
+    {
+        Asn1Decoder storedProcedureDecoder = new StoredProcedureDecoder();
+
+        ByteBuffer stream = ByteBuffer.allocate( 0x44 );
+
+        stream.put( new byte[]
+            {
+                0x30, 0x42,
+                    0x04, 0x04, 'J', 'a', 'v', 'a',
+                    0x04, 0x07, 'e', 'x', 'e', 'c', 'u', 't', 'e',
+                    0x30, 0x31,
+                      0x30, 0x08,
+                        0x04, 0x03, 'i', 'n', 't', 
+                        0x04, 0x01, 0x01,
+                      0x30, 0x0F,
+                        0x04, 0x07, 'b', 'o', 'o', 'l', 'e', 'a', 'n', 
+                        0x04, 0x04, 't', 'r', 'u', 'e',
+                      0x30, 0x14,
+                        0x04, 0x06, 'S', 't', 'r', 'i', 'n', 'g', 
+                        0x04, 0x0A, 'p', 'a', 'r', 'a', 'm', 'e', 't', 'e', 'r', '3' 
+            } );
+
+        String decodedPdu = StringTools.dumpBytes( stream.array() );
+        stream.flip();
+
+        // Allocate a StoredProcedure Container
+        IAsn1Container storedProcedureContainer = new StoredProcedureContainer();
+
+        // Decode a StoredProcedure message
+        try
+        {
+            storedProcedureDecoder.decode( stream, storedProcedureContainer );
+        }
+        catch ( DecoderException de )
+        {
+            de.printStackTrace();
+            Assert.fail( de.getMessage() );
+        }
+
+        StoredProcedure storedProcedure = ( ( StoredProcedureContainer ) storedProcedureContainer ).getStoredProcedure();
+
+        Assert.assertEquals("Java", storedProcedure.getLanguage());
+        
+        Assert.assertEquals( "execute", StringTools.utf8ToString( storedProcedure.getProcedure() ) );
+
+        Assert.assertNotNull( storedProcedure.getParameters() );
+        Assert.assertEquals( 3, storedProcedure.getParameters().size() );
+
+        StoredProcedureParameter param = ( StoredProcedureParameter ) storedProcedure.getParameters().get( 0 );
+
+        Assert.assertEquals( "int", StringTools.utf8ToString( param.getType() ) );
+        Assert.assertEquals( 1, param.getValue()[0] );
+
+        param = ( StoredProcedureParameter ) storedProcedure.getParameters().get( 1 );
+
+        Assert.assertEquals( "boolean", StringTools.utf8ToString( param.getType() ) );
+        Assert.assertEquals( "true", StringTools.utf8ToString( param.getValue() ) );
+
+        param = ( StoredProcedureParameter ) storedProcedure.getParameters().get( 2 );
+
+        Assert.assertEquals( "String", StringTools.utf8ToString( param.getType() ) );
+        Assert.assertEquals( "parameter3", StringTools.utf8ToString( param.getValue() ) );
+
+        // Check the encoding
+        try
+        {
+            ByteBuffer bb = storedProcedure.encode( null );
+
+            String encodedPdu = StringTools.dumpBytes( bb.array() );
+
+            assertEquals( encodedPdu, decodedPdu );
+        }
+        catch ( EncoderException ee )
+        {
+            ee.printStackTrace();
+            fail( ee.getMessage() );
+        }
+    }
+
+    public void testDecodeStoredProcedureNoParam() throws NamingException
+    {
+        Asn1Decoder storedProcedureDecoder = new StoredProcedureDecoder();
+
+        ByteBuffer stream = ByteBuffer.allocate( 0x13 );
+
+        stream.put( new byte[]
+            {
+                0x30, 0x11,
+                    0x04, 0x04, 'J', 'a', 'v', 'a',
+                    0x04, 0x07, 'e', 'x', 'e', 'c', 'u', 't', 'e',
+                    0x30, 0x00
+            } );
+
+        String decodedPdu = StringTools.dumpBytes( stream.array() );
+        stream.flip();
+
+        // Allocate a StoredProcedure Container
+        IAsn1Container storedProcedureContainer = new StoredProcedureContainer();
+
+        // Decode a StoredProcedure message
+        try
+        {
+            storedProcedureDecoder.decode( stream, storedProcedureContainer );
+        }
+        catch ( DecoderException de )
+        {
+            de.printStackTrace();
+            Assert.fail( de.getMessage() );
+        }
+
+        StoredProcedure storedProcedure = ( ( StoredProcedureContainer ) storedProcedureContainer ).getStoredProcedure();
+
+        Assert.assertEquals("Java", storedProcedure.getLanguage());
+        
+        Assert.assertEquals( "execute", StringTools.utf8ToString( storedProcedure.getProcedure() ) );
+
+        Assert.assertNull( storedProcedure.getParameters() );
+        
+        // Check the encoding
+        try
+        {
+            ByteBuffer bb = storedProcedure.encode( null );
+
+            String encodedPdu = StringTools.dumpBytes( bb.array() );
+
+            assertEquals( encodedPdu, decodedPdu );
+        }
+        catch ( EncoderException ee )
+        {
+            ee.printStackTrace();
+            fail( ee.getMessage() );
+        }
+    }
+
+    public void testDecodeStoredProcedureOneParam() throws NamingException
+    {
+        Asn1Decoder storedProcedureDecoder = new StoredProcedureDecoder();
+
+        ByteBuffer stream = ByteBuffer.allocate( 0x1D );
+
+        stream.put( new byte[]
+            {
+                0x30, 0x1B,
+                  0x04, 0x04, 'J', 'a', 'v', 'a',
+                  0x04, 0x07, 'e', 'x', 'e', 'c', 'u', 't', 'e',
+                  0x30, 0x0A,
+                      0x30, 0x08,
+                        0x04, 0x03, 'i', 'n', 't', 
+                        0x04, 0x01, 0x01,
+            } );
+
+        String decodedPdu = StringTools.dumpBytes( stream.array() );
+        stream.flip();
+
+        // Allocate a StoredProcedure Container
+        IAsn1Container storedProcedureContainer = new StoredProcedureContainer();
+
+        // Decode a StoredProcedure message
+        try
+        {
+            storedProcedureDecoder.decode( stream, storedProcedureContainer );
+        }
+        catch ( DecoderException de )
+        {
+            de.printStackTrace();
+            Assert.fail( de.getMessage() );
+        }
+
+        StoredProcedure storedProcedure = ( ( StoredProcedureContainer ) storedProcedureContainer ).getStoredProcedure();
+
+        Assert.assertEquals("Java", storedProcedure.getLanguage());
+        
+        Assert.assertEquals( "execute", StringTools.utf8ToString( storedProcedure.getProcedure() ) );
+
+        Assert.assertNotNull( storedProcedure.getParameters() );
+        Assert.assertEquals( 1, storedProcedure.getParameters().size() );
+
+        StoredProcedureParameter param = ( StoredProcedureParameter ) storedProcedure.getParameters().get( 0 );
+
+        Assert.assertEquals( "int", StringTools.utf8ToString( param.getType() ) );
+        Assert.assertEquals( 1, param.getValue()[0] );
+
+        // Check the encoding
+        try
+        {
+            ByteBuffer bb = storedProcedure.encode( null );
+
+            String encodedPdu = StringTools.dumpBytes( bb.array() );
+
+            assertEquals( encodedPdu, decodedPdu );
+        }
+        catch ( EncoderException ee )
+        {
+            ee.printStackTrace();
+            fail( ee.getMessage() );
+        }
+    }
+}

Modified: directory/trunks/testsuites/src/main/java/org/apache/ldap/testsuite/ldaptests/jndi/BaseProtocolTest.java
URL: http://svn.apache.org/viewcvs/directory/trunks/testsuites/src/main/java/org/apache/ldap/testsuite/ldaptests/jndi/BaseProtocolTest.java?rev=400067&r1=400066&r2=400067&view=diff
==============================================================================
--- directory/trunks/testsuites/src/main/java/org/apache/ldap/testsuite/ldaptests/jndi/BaseProtocolTest.java (original)
+++ directory/trunks/testsuites/src/main/java/org/apache/ldap/testsuite/ldaptests/jndi/BaseProtocolTest.java Fri May  5 05:52:49 2006
@@ -1,102 +1,102 @@
-/*
- *   Copyright 2004 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.ldap.testsuite.ldaptests.jndi;
-
-import javax.naming.Binding;
-import javax.naming.NameNotFoundException;
-import javax.naming.NamingEnumeration;
-import javax.naming.NamingException;
-import javax.naming.directory.Attributes;
-import javax.naming.directory.DirContext;
-import javax.naming.ldap.InitialLdapContext;
-import javax.naming.ldap.LdapContext;
-
-import junit.framework.TestCase;
-
-import org.apache.ldap.testsuite.ldaptests.jndi.util.AttributesFactory;
-
-/**
- * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
- * @version $Rev: $
- */
-public class BaseProtocolTest extends TestCase
-{
-
-    public void setUp() throws NamingException
-    {
-
-        // Check whether test container entry exists
-        // If yes: delete it
-        DirContext ctx = this.createContext();
-        try {
-            LdapContext entry = (LdapContext) ctx.lookup(getTestContainerRdn());
-            this.deleteSubtree(entry);
-        } catch (NameNotFoundException ignored) {
-        }
-
-        // Create an entry
-        Attributes attributes = AttributesFactory.createOrganizationalUnitAttributes("playground");
-
-        DirContext pg = ctx.createSubcontext(getTestContainerRdn(), attributes);
-        assertNotNull(pg);
-
-        pg = (DirContext) ctx.lookup(getTestContainerRdn());
-        assertNotNull(pg);
-
-        ctx.close();
-        ctx = null;
-    }
-
-    public void tearDown() throws NamingException
-    {
-        LdapContext ctx = this.createContext();
-
-        LdapContext pg = (LdapContext) ctx.lookup(getTestContainerRdn());
-        this.deleteSubtree(pg);
-
-        try {
-            ctx.lookup(getTestContainerRdn());
-            fail("test entry not deleted");
-        } catch (NameNotFoundException ignored) {
-        }
-
-        ctx.close();
-        ctx = null;
-    }
-
-    private void deleteSubtree(LdapContext entry) throws NamingException
-    {
-        NamingEnumeration enumeration = entry.listBindings("");
-        while (enumeration.hasMore()) {
-            Binding b = (Binding) enumeration.next();
-            if (b.getObject() instanceof LdapContext) {
-                deleteSubtree((LdapContext) b.getObject());
-            }
-        }
-        entry.unbind("");
-    }
-
-    protected LdapContext createContext() throws NamingException
-    {
-        return new InitialLdapContext();
-    }
-
-    protected String getTestContainerRdn()
-    {
-        return "ou=playground";
-    }
-}
\ No newline at end of file
+/*
+ *   Copyright 2004 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.ldap.testsuite.ldaptests.jndi;
+
+import javax.naming.Binding;
+import javax.naming.NameNotFoundException;
+import javax.naming.NamingEnumeration;
+import javax.naming.NamingException;
+import javax.naming.directory.Attributes;
+import javax.naming.directory.DirContext;
+import javax.naming.ldap.InitialLdapContext;
+import javax.naming.ldap.LdapContext;
+
+import junit.framework.TestCase;
+
+import org.apache.ldap.testsuite.ldaptests.jndi.util.AttributesFactory;
+
+/**
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev: $
+ */
+public class BaseProtocolTest extends TestCase
+{
+
+    public void setUp() throws NamingException
+    {
+
+        // Check whether test container entry exists
+        // If yes: delete it
+        DirContext ctx = this.createContext();
+        try {
+            LdapContext entry = (LdapContext) ctx.lookup(getTestContainerRdn());
+            this.deleteSubtree(entry);
+        } catch (NameNotFoundException ignored) {
+        }
+
+        // Create an entry
+        Attributes attributes = AttributesFactory.createOrganizationalUnitAttributes("playground");
+
+        DirContext pg = ctx.createSubcontext(getTestContainerRdn(), attributes);
+        assertNotNull(pg);
+
+        pg = (DirContext) ctx.lookup(getTestContainerRdn());
+        assertNotNull(pg);
+
+        ctx.close();
+        ctx = null;
+    }
+
+    public void tearDown() throws NamingException
+    {
+        LdapContext ctx = this.createContext();
+
+        LdapContext pg = (LdapContext) ctx.lookup(getTestContainerRdn());
+        this.deleteSubtree(pg);
+
+        try {
+            ctx.lookup(getTestContainerRdn());
+            fail("test entry not deleted");
+        } catch (NameNotFoundException ignored) {
+        }
+
+        ctx.close();
+        ctx = null;
+    }
+
+    private void deleteSubtree(LdapContext entry) throws NamingException
+    {
+        NamingEnumeration enumeration = entry.listBindings("");
+        while (enumeration.hasMore()) {
+            Binding b = (Binding) enumeration.next();
+            if (b.getObject() instanceof LdapContext) {
+                deleteSubtree((LdapContext) b.getObject());
+            }
+        }
+        entry.unbind("");
+    }
+
+    protected LdapContext createContext() throws NamingException
+    {
+        return new InitialLdapContext();
+    }
+
+    protected String getTestContainerRdn()
+    {
+        return "ou=playground";
+    }
+}



Mime
View raw message