directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r159162 - in directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ber/grammar: ./ AbstractGrammar.java GrammarAction.java GrammarTransition.java IAction.java IGrammar.java StatesEnum.java
Date Sun, 27 Mar 2005 18:39:10 GMT
Author: elecharny
Date: Sun Mar 27 10:39:09 2005
New Revision: 159162

URL: http://svn.apache.org/viewcvs?view=rev&rev=159162
Log:
A first working version of the new ASN.1 LDAP decoder.

Added:
    directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ber/grammar/
    directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ber/grammar/AbstractGrammar.java
    directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ber/grammar/GrammarAction.java
    directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ber/grammar/GrammarTransition.java
    directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ber/grammar/IAction.java
    directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ber/grammar/IGrammar.java
    directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ber/grammar/StatesEnum.java

Added: directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ber/grammar/AbstractGrammar.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ber/grammar/AbstractGrammar.java?view=auto&rev=159162
==============================================================================
--- directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ber/grammar/AbstractGrammar.java
(added)
+++ directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ber/grammar/AbstractGrammar.java
Sun Mar 27 10:39:09 2005
@@ -0,0 +1,92 @@
+/*
+ *   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.asn1.ber.grammar;
+
+import org.apache.asn1.ber.containers.IAsn1Container;
+import org.apache.asn1.ber.tlv.Tag;
+import org.apache.asn1.ldap.codec.DecoderException;
+import org.apache.asn1.util.StringUtils;
+
+import org.apache.log4j.Logger;
+
+
+/**
+ * The abstract IGrammar which is the Mother of all the grammars. It
+ * contains the transitions table.
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class AbstractGrammar
+{
+    //~ Static fields/initializers -----------------------------------------------------------------
+
+    /** The logger */
+    private static final Logger log = Logger.getLogger( AbstractGrammar.class );
+
+    /** Logging speed up  */
+    private static final boolean DEBUG = log.isDebugEnabled();
+
+    //~ Instance fields ----------------------------------------------------------------------------
+
+    /** Table of transitions. It's a two dimension array, the first dimension
+     * indice the states, the second dimension indices the Tag value, so it is 256 wide.
*/
+    protected GrammarTransition[][] transitions;
+
+    //~ Methods ------------------------------------------------------------------------------------
+
+    /**
+     * The main function. This is where an action is executed. If the 
+     * action is null, nothing is done.
+     *
+     * @param container The Asn1Container 
+     *
+     * @throws DecoderException Thrown if anything went wrong
+     */
+    public void executeAction( IAsn1Container container ) throws DecoderException
+    {
+        int currentState = container.getTransition();
+
+        if ( currentState == -1 )
+        {
+            return;
+        }
+
+        Tag               tag        = container.getCurrentTLV().getTag();
+        byte              tagByte    = tag.getTagByte();
+
+        GrammarTransition transition = transitions[currentState][tagByte & 0x00FF];
+
+        if ( transition == null )
+        {
+            throw new DecoderException(
+                "Bad transition from state " + StatesEnum.getState( currentState ) + ", tag
" +
+                StringUtils.dumpByte( tag.getTagByte() ) );
+        }
+
+        if ( DEBUG )
+        {
+            log.debug( transition.toString() );
+        }
+
+        container.setTransition( transition.getNextState() );
+
+        if ( transition.hasAction() )
+        {
+            transition.getAction().action( container );
+        }
+    }
+}

Added: directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ber/grammar/GrammarAction.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ber/grammar/GrammarAction.java?view=auto&rev=159162
==============================================================================
--- directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ber/grammar/GrammarAction.java
(added)
+++ directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ber/grammar/GrammarAction.java
Sun Mar 27 10:39:09 2005
@@ -0,0 +1,56 @@
+/*
+ *   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.asn1.ber.grammar;
+
+/**
+ * A top level grammar class that store meta informations about the actions.
+ * 
+ * Those informations are not mandatory, but they can be usefull for debugging. 
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public abstract class GrammarAction implements IAction
+{
+    //~ Instance fields ----------------------------------------------------------------------------
+
+    /** The action's name */
+    protected String name;
+
+    //~ Constructors -------------------------------------------------------------------------------
+
+    /**
+     * Creates a new GrammarAction object.
+     *
+     * @param name The name of the create daction
+     */
+    public GrammarAction(  String name )
+    {
+        this.name = name;
+    }
+
+    //~ Methods ------------------------------------------------------------------------------------
+
+    /**
+     * Print the action's name
+     *
+     * @return The action's name
+     */
+    public String toString()
+    {
+        return name;
+    }
+}

Added: directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ber/grammar/GrammarTransition.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ber/grammar/GrammarTransition.java?view=auto&rev=159162
==============================================================================
--- directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ber/grammar/GrammarTransition.java
(added)
+++ directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ber/grammar/GrammarTransition.java
Sun Mar 27 10:39:09 2005
@@ -0,0 +1,107 @@
+/*
+ *   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.asn1.ber.grammar;
+
+/**
+ * Define a transition between two states of a grammar. It stores the 
+ * next state, and the action to execute while transiting.  
+ * 
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class GrammarTransition
+{
+    //~ Instance fields ----------------------------------------------------------------------------
+
+    /** The next state in the grammar */
+    private int           nextState;
+
+    /** The action associated to the transition */
+    private GrammarAction action;
+
+    /** A name is given to each transition, for debuging purpose */
+    private String        name;
+
+    //~ Constructors -------------------------------------------------------------------------------
+
+    /**
+     * Creates a new GrammarTransition object.
+     *
+     * @param name The transition's name
+     * @param nextState The target state
+     * @param action The action to execute. It could be null.
+     */
+    public GrammarTransition(  String name, int nextState, GrammarAction action )
+    {
+        this.name      = name;
+        this.nextState = nextState;
+        this.action    = action;
+    }
+
+    //~ Methods ------------------------------------------------------------------------------------
+
+    /**
+     * @return Returns the target state.
+     */
+    public int getNextState()
+    {
+        return nextState;
+    }
+
+    /**
+     * DOCUMENT ME!
+     *
+     * @param nextState DOCUMENT ME!
+     */
+    //public void setNextState( int nextState )
+    //{
+    //    this.nextState = nextState;
+    //}
+
+    /**
+     * Tells if the transition has an associated action.
+     *
+     * @return <code>true</code> if an action has been asociated to the transition
+     */
+    public boolean hasAction()
+    {
+        return action != null;
+    }
+
+    /**
+     * @return Returns the action associated with the transition
+     */
+    public GrammarAction getAction()
+    {
+        return action;
+    }
+
+    /**
+     * @return A representation of the transition as a string.
+     */
+    public String toString()
+    {
+
+        StringBuffer sb = new StringBuffer();
+
+        sb.append( "Transition <" ).append( name ).append( ", " )
+          .append( StatesEnum.getState( nextState ) ).append( ", " )
+          .append( ( ( action == null ) ? "no action" : action.toString() ) ).append( ">"
);
+
+        return sb.toString();
+    }
+}

Added: directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ber/grammar/IAction.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ber/grammar/IAction.java?view=auto&rev=159162
==============================================================================
--- directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ber/grammar/IAction.java
(added)
+++ directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ber/grammar/IAction.java
Sun Mar 27 10:39:09 2005
@@ -0,0 +1,41 @@
+/*
+ *   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.asn1.ber.grammar;
+
+import org.apache.asn1.ber.containers.IAsn1Container;
+import org.apache.asn1.ldap.codec.DecoderException;
+
+
+/**
+ * IAction interface just contains the method 'action' which must be implemented
+ * in all the implementong classes.
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public interface IAction
+{
+    //~ Methods ------------------------------------------------------------------------------------
+
+    /**
+     * The action to be executed.
+     *
+     * @param container The container which stores the current data
+     *
+     * @throws DecoderException Thrown if something went wrong.
+     */
+    public void action( IAsn1Container container ) throws DecoderException;
+}

Added: directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ber/grammar/IGrammar.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ber/grammar/IGrammar.java?view=auto&rev=159162
==============================================================================
--- directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ber/grammar/IGrammar.java
(added)
+++ directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ber/grammar/IGrammar.java
Sun Mar 27 10:39:09 2005
@@ -0,0 +1,41 @@
+/*
+ *   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.asn1.ber.grammar;
+
+import org.apache.asn1.ber.containers.IAsn1Container;
+import org.apache.asn1.ldap.codec.DecoderException;
+
+
+/**
+ * The interface which expose common behavior of a Gramar implementer.
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public interface IGrammar
+{
+    //~ Methods ------------------------------------------------------------------------------------
+
+    /**
+     * This method, when called, execute an action on the current data stored 
+     * in the container.
+     *
+     * @param asn1Container Store the data being processed.
+     *
+     * @throws DecoderException Thrown when an unrecoverable error occurs.
+     */
+    void executeAction( IAsn1Container asn1Container ) throws DecoderException;
+}

Added: directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ber/grammar/StatesEnum.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ber/grammar/StatesEnum.java?view=auto&rev=159162
==============================================================================
--- directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ber/grammar/StatesEnum.java
(added)
+++ directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ber/grammar/StatesEnum.java
Sun Mar 27 10:39:09 2005
@@ -0,0 +1,243 @@
+/*
+ *   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.asn1.ber.grammar;
+
+/**
+ * All the possible states of the LDAP decoder.
+ * 
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class StatesEnum
+{
+    //~ Static fields/initializers -----------------------------------------------------------------
+
+    /** Initiate the counter to 0 */
+    private static int INIT_STATE = 0;
+
+    // LdapMessage ------------------------------------------------------------
+    /** LDAPMessage Tag */
+    public static int LDAP_MESSAGE_TAG = INIT_STATE++;
+
+    /** LDAPMessage Length */
+    public static int LDAP_MESSAGE_LENGTH = INIT_STATE++;
+
+    /** LDAPMessage Value */
+    public static int LDAP_MESSAGE_VALUE = INIT_STATE++;
+
+    // Message ID -------------------------------------------------------------
+    /** MessageID Tag */
+    public static int LDAP_MESSAGE_ID_TAG = INIT_STATE++;
+
+    /** MessageID Length */
+    public static int LDAP_MESSAGE_ID_LENGTH = INIT_STATE++;
+
+    /** MessageID Value */
+    public static int LDAP_MESSAGE_ID_VALUE = INIT_STATE++;
+
+    // ProtocolOp -------------------------------------------------------------
+    /** protocolOp CHOICE Tag */
+    public static int PROTOCOL_OP_TAG = INIT_STATE++;
+
+    /** protocolOp CHOICE Length */
+    public static int PROTOCOL_OP_LENGTH = INIT_STATE++;
+
+    /** protocolOp CHOICE Value */
+    public static int PROTOCOL_OP_VALUE = INIT_STATE++;
+
+    // BindRequest ============================================================
+    // Version ----------------------------------------------------------------
+    /**  Version Tag */
+    public static int BIND_VERSION_TAG = INIT_STATE++;
+
+    /** Version Length */
+    public static int BIND_VERSION_LENGTH = INIT_STATE++;
+
+    /** Version Length */
+    public static int BIND_VERSION_VALUE = INIT_STATE++;
+
+    // Name -------------------------------------------------------------------
+    /** Name Tag */
+    public static int BIND_NAME_TAG = INIT_STATE++;
+
+    /** Name Length */
+    public static int BIND_NAME_LENGTH = INIT_STATE++;
+
+    /** Name Value */
+    public static int BIND_NAME_VALUE = INIT_STATE++;
+
+    // Authentication choice --------------------------------------------------
+    /** Authentication choice Tag */
+    public static int BIND_AUTHENTICATION_CHOICE_TAG = INIT_STATE++;
+
+    // Authentication simple --------------------------------------------------
+    /** Authentication Simple Tag */
+    //public static int BIND_AUTHENTICATION_SIMPLE_TAG = INIT_STATE++;
+
+    /** Authentication Simple Length */
+    public static int BIND_AUTHENTICATION_SIMPLE_LENGTH = INIT_STATE++;
+
+    /** Authentication Simple Value */
+    public static int BIND_AUTHENTICATION_SIMPLE_VALUE = INIT_STATE++;
+
+    // Authentication sasl ----------------------------------------------------
+    /** Authentication Sasl Tag */
+    //public static int BIND_AUTHENTICATION_SASL_TAG = INIT_STATE++;
+
+    /** Authentication Sasl Length */
+    public static int BIND_AUTHENTICATION_SASL_LENGTH = INIT_STATE++;
+
+    /** Authentication Sasl Value */
+    public static int BIND_AUTHENTICATION_SASL_VALUE = INIT_STATE++;
+
+    // Authentication sasl mechanism ------------------------------------------
+    /** Authentication Sasl mechanism Tag */
+    public static int BIND_AUTHENTICATION_MECHANISM_TAG = INIT_STATE++;
+
+    /** Authentication sasl mechanism Length */
+    public static int BIND_AUTHENTICATION_MECHANISM_LENGTH = INIT_STATE++;
+
+    /** Authentication sasl mechanism Value */
+    public static int BIND_AUTHENTICATION_MECHANISM_VALUE = INIT_STATE++;
+
+    // Authentication sasl mechanism ------------------------------------------
+    /** Authentication Sasl credentials Tag */
+    public static int BIND_AUTHENTICATION_CREDENTIALS_TAG = INIT_STATE++;
+
+    /** Authentication sasl credentials Length */
+    public static int BIND_AUTHENTICATION_CREDENTIALS_LENGTH = INIT_STATE++;
+
+    /** Authentication sasl credentials Value */
+    public static int BIND_AUTHENTICATION_CREDENTIALS_VALUE = INIT_STATE++;
+
+    // Controls ===============================================================
+    /** Controls Tag */
+    public static int CONTROLS_TAG = INIT_STATE++;
+
+    /** Controls Length */
+    public static int CONTROLS_LENGTH = INIT_STATE++;
+
+    /** Controls Value */
+    public static int CONTROLS_VALUE = INIT_STATE++;
+
+    // Control ----------------------------------------------------------------
+    /** Control Tag */
+    public static int CONTROL_TAG = INIT_STATE++;
+
+    /** Control Length */
+    public static int CONTROL_LENGTH = INIT_STATE++;
+
+    /** Control Value */
+    public static int CONTROL_VALUE = INIT_STATE++;
+
+    // Control controltype ----------------------------------------------------
+    /** Control type Tag */
+    public static int CONTROL_TYPE_TAG = INIT_STATE++;
+
+    /** Control type Length */
+    public static int CONTROL_TYPE_LENGTH = INIT_STATE++;
+
+    /** Control type Value */
+    public static int CONTROL_TYPE_VALUE = INIT_STATE++;
+
+    // Control criticality ----------------------------------------------------
+    /** Control criticality Tag */
+    public static int CONTROL_CRITICALITY_TAG = INIT_STATE++;
+
+    /** Control criticality Length */
+    public static int CONTROL_CRITICALITY_LENGTH = INIT_STATE++;
+
+    /** Control criticality Value */
+    public static int CONTROL_CRITICALITY_VALUE = INIT_STATE++;
+
+    // Control controlvalue ---------------------------------------------------
+    /** Control value Tag */
+    public static int CONTROL_VALUE_TAG = INIT_STATE++;
+
+    /** Control value Length */
+    public static int CONTROL_VALUE_LENGTH = INIT_STATE++;
+
+    /** Control value Value */
+    public static int       CONTROL_VALUE_VALUE = INIT_STATE++;
+
+    /** The last state */
+    public static int       LAST_STATE = INIT_STATE;
+
+    /** A string representation of all the states */
+    private static String[] StateTring =
+        new String[]
+        {
+            "LDAP_MESSAGE_TAG", 
+			"LDAP_MESSAGE_LENGTH", 
+			"LDAP_MESSAGE_VALUE", 
+			"LDAP_MESSAGE_ID_TAG",
+            "LDAP_MESSAGE_ID_LENGTH", 
+			"LDAP_MESSAGE_ID_VALUE", 
+			"PROTOCOL_OP_TAG",
+            "PROTOCOL_OP_LENGTH", 
+			"PROTOCOL_OP_VALUE", 
+			"BIND_VERSION_TAG", 
+			"BIND_VERSION_LENGTH",
+            "BIND_VERSION_VALUE", 
+			"BIND_NAME_TAG", 
+			"BIND_NAME_LENGTH", 
+			"BIND_NAME_VALUE",
+            "BIND_AUTHENTICATION_CHOICE_TAG",
+            //public static int BIND_AUTHENTICATION_SIMPLE_TAG] = "",
+            "BIND_AUTHENTICATION_SIMPLE_LENGTH", 
+			"BIND_AUTHENTICATION_SIMPLE_VALUE",
+            //public static int BIND_AUTHENTICATION_SASL_TAG] = "",
+            "BIND_AUTHENTICATION_SASL_LENGTH", 
+			"BIND_AUTHENTICATION_SASL_VALUE",
+            "BIND_AUTHENTICATION_MECHANISM_TAG", 
+			"BIND_AUTHENTICATION_MECHANISM_LENGTH",
+            "BIND_AUTHENTICATION_MECHANISM_VALUE", 
+			"BIND_AUTHENTICATION_CREDENTIALS_TAG",
+            "BIND_AUTHENTICATION_CREDENTIALS_LENGTH", 
+			"BIND_AUTHENTICATION_CREDENTIALS_VALUE",
+            "CONTROLS_TAG", 
+			"CONTROLS_LENGTH", 
+			"CONTROLS_VALUE", 
+			"CONTROL_TAG", 
+			"CONTROL_LENGTH",
+            "CONTROL_VALUE", 
+			"CONTROL_TYPE_TAG", 
+			"CONTROL_TYPE_LENGTH", 
+			"CONTROL_TYPE_VALUE",
+            "CONTROL_CRITICALITY_TAG", 
+			"CONTROL_CRITICALITY_LENGTH", 
+			"CONTROL_CRITICALITY_VALUE",
+            "CONTROL_VALUE_TAG", 
+			"CONTROL_VALUE_LENGTH", 
+			"CONTROL_VALUE_VALUE", 
+			"LAST_STATE"
+        };
+
+    //~ Methods ------------------------------------------------------------------------------------
+
+    /**
+     * Get the string representing the state
+     * 
+     * @param state The state number
+     * @return The String representing the state
+     */
+    public static String getState( int state )
+    {
+
+        return ( ( state == -1 ) ? "END_STATE" : StateTring[state] );
+    }
+}



Mime
View raw message