directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fel...@apache.org
Subject svn commit: r592023 [2/25] - in /directory/sandbox/felixk/studio-dsml-parser: ./ META-INF/ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/directory/ src/main/java/org/apache/directory/studio/ src/mai...
Date Mon, 05 Nov 2007 14:53:11 GMT

Propchange: directory/sandbox/felixk/studio-dsml-parser/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Mon Nov  5 06:52:22 2007
@@ -0,0 +1,2 @@
+.settings
+target

Added: directory/sandbox/felixk/studio-dsml-parser/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-dsml-parser/META-INF/MANIFEST.MF?rev=592023&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-dsml-parser/META-INF/MANIFEST.MF (added)
+++ directory/sandbox/felixk/studio-dsml-parser/META-INF/MANIFEST.MF Mon Nov  5 06:52:22 2007
@@ -0,0 +1,11 @@
+Manifest-Version: 1.0
+Package: org.apache.directory.studio.dsmlv2.*
+
+Name: org.apache.directory.studio.dsmlv2.*
+Specification-Title: studio-dsml-parser
+Specification-Version: 1.0
+Specification-Vendor: Apache Software Foundation
+Implementation-Title: org.apache.directory.studio.dsmlv2.*
+Implementation-Version: 1.0
+Implementation-Vendor: Apache Software Foundation
+Bundle-ClassPath: .
\ No newline at end of file

Propchange: directory/sandbox/felixk/studio-dsml-parser/META-INF/MANIFEST.MF
------------------------------------------------------------------------------
    svn:eol-style = native

Added: directory/sandbox/felixk/studio-dsml-parser/pom.xml
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-dsml-parser/pom.xml?rev=592023&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-dsml-parser/pom.xml (added)
+++ directory/sandbox/felixk/studio-dsml-parser/pom.xml Mon Nov  5 06:52:22 2007
@@ -0,0 +1,79 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You 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.
+-->
+<!--
+    @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+    @version $Id: pom.xml 353 2007-10-28 14:59:35Z felix $
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.directory.studio</groupId>
+        <artifactId>parent</artifactId>
+        <version>1.0.2-SNAPSHOT</version>
+    </parent>
+    <artifactId>${groupId}.dsml.parser</artifactId>
+    <name>Apache Directory Studio DSML Parser</name>
+    <packaging>jar</packaging>
+
+    <description></description>
+
+    <!-- Set path for local repository -->
+    <properties>
+        <local-repo>${project.basedir}/../local-repository</local-repo>
+    </properties>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-jar-plugin</artifactId>
+                <configuration>
+                    <archive>
+                        <manifestFile>META-INF/MANIFEST.MF</manifestFile>
+                        <addMavenDescriptor>false</addMavenDescriptor>
+                    </archive>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.directory.shared</groupId>
+            <artifactId>shared-ldap</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.directory.shared</groupId>
+            <artifactId>shared-asn1</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>dom4j</groupId>
+            <artifactId>dom4j</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>xpp3</groupId>
+            <artifactId>xpp3</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>nlog4j</artifactId>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+</project>

Propchange: directory/sandbox/felixk/studio-dsml-parser/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: directory/sandbox/felixk/studio-dsml-parser/src/main/java/org/apache/directory/studio/dsmlv2/AbstractGrammar.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-dsml-parser/src/main/java/org/apache/directory/studio/dsmlv2/AbstractGrammar.java?rev=592023&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-dsml-parser/src/main/java/org/apache/directory/studio/dsmlv2/AbstractGrammar.java (added)
+++ directory/sandbox/felixk/studio-dsml-parser/src/main/java/org/apache/directory/studio/dsmlv2/AbstractGrammar.java Mon Nov  5 06:52:22 2007
@@ -0,0 +1,182 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.studio.dsmlv2;
+
+
+import java.io.IOException;
+import java.util.HashMap;
+
+import org.xmlpull.v1.XmlPullParser;
+import org.xmlpull.v1.XmlPullParserException;
+
+
+/**
+ * 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>
+ * @version $Rev$, $Date$
+ */
+public abstract class AbstractGrammar implements IGrammar
+{
+
+    /**
+     * 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 HashMap<Tag, GrammarTransition>[] transitions;
+
+    /** The grammar name */
+    protected String name;
+
+    /** The grammar's states */
+    protected IStates statesEnum;
+
+
+    /**
+     * Return the grammar's name
+     * 
+     * @return The grammar name
+     */
+    public String getName()
+    {
+        return name;
+    }
+
+
+    /**
+     * Set the grammar's name
+     * 
+     * @param name
+     *      the name to set
+     */
+    public void setName( String name )
+    {
+        this.name = name;
+    }
+
+
+    /**
+     * Get the transition associated with the state and tag
+     * 
+     * @param state
+     *            The current state
+     * @param tag
+     *            The current tag
+     * @return A valid transition if any, or null.
+     */
+    public GrammarTransition getTransition( int state, Tag tag )
+    {
+        return transitions[state].get( tag );
+    }
+
+
+    /**
+     * Get the states of the current grammar
+     * 
+     * @return 
+     *      Returns the statesEnum.
+     */
+    public IStates getStatesEnum()
+    {
+        return statesEnum;
+    }
+
+
+    /**
+     * Set the states for this grammar
+     * 
+     * @param statesEnum
+     *      The statesEnum to set.
+     */
+    public void setStatesEnum( IStates statesEnum )
+    {
+        this.statesEnum = statesEnum;
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.studio.dsmlv2.IGrammar#executeAction(org.apache.directory.studio.dsmlv2.Dsmlv2Container)
+     */
+    public void executeAction( Dsmlv2Container container ) throws XmlPullParserException, IOException
+    {
+        XmlPullParser xpp = container.getParser();
+
+        int eventType = xpp.getEventType();
+        do
+        {
+            if ( eventType == XmlPullParser.START_DOCUMENT )
+            {
+                container.setState( Dsmlv2StatesEnum.INIT_GRAMMAR_STATE );
+            }
+            else if ( eventType == XmlPullParser.END_DOCUMENT )
+            {
+                container.setState( Dsmlv2StatesEnum.END_STATE );
+            }
+            else if ( eventType == XmlPullParser.START_TAG )
+            {
+                processTag( container, Tag.START );
+            }
+            else if ( eventType == XmlPullParser.END_TAG )
+            {
+                processTag( container, Tag.END );
+            }
+            eventType = xpp.next();
+        }
+        while ( eventType != XmlPullParser.END_DOCUMENT );
+    }
+
+
+    /**
+     * Processes the task required in the grammar to the given tag type
+     *
+     * @param container
+     *      the DSML container
+     * @param tagType
+     *      the tag type
+     * @throws XmlPullParserException 
+     *      when an error occurs during the parsing
+     */
+    private void processTag( Dsmlv2Container container, int tagType ) throws XmlPullParserException
+    {
+        XmlPullParser xpp = container.getParser();
+
+        String tagName = xpp.getName().toLowerCase();
+
+        GrammarTransition transition = getTransition( container.getState(), new Tag( tagName, tagType ) );
+
+        if ( transition != null )
+        {
+            container.setState( transition.getNextState() );
+
+            if ( transition.hasAction() )
+            {
+                transition.getAction().action( container );
+            }
+        }
+        else
+        {
+            throw new XmlPullParserException( "The tag " + new Tag( tagName, tagType )
+                + " can't be found at this position", xpp, null );
+        }
+    }
+}

Propchange: directory/sandbox/felixk/studio-dsml-parser/src/main/java/org/apache/directory/studio/dsmlv2/AbstractGrammar.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: directory/sandbox/felixk/studio-dsml-parser/src/main/java/org/apache/directory/studio/dsmlv2/Container.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-dsml-parser/src/main/java/org/apache/directory/studio/dsmlv2/Container.java?rev=592023&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-dsml-parser/src/main/java/org/apache/directory/studio/dsmlv2/Container.java (added)
+++ directory/sandbox/felixk/studio-dsml-parser/src/main/java/org/apache/directory/studio/dsmlv2/Container.java Mon Nov  5 06:52:22 2007
@@ -0,0 +1,71 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.studio.dsmlv2;
+
+
+/**
+ * This interface represents a container that can be used by the parser to store parsed information
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public interface Container
+{
+    /**
+     * Get the current grammar state
+     * 
+     * @return Returns the current grammar state
+     */
+    int getState();
+
+
+    /**
+     * Set the new current state
+     * 
+     * @param state
+     *            The new state
+     */
+    void setState( int state );
+
+
+    /**
+     * Get the transition
+     * 
+     * @return Returns the transition from the previous state to the new state
+     */
+    public int getTransition();
+
+
+    /**
+     * Update the transition from a state to another
+     * 
+     * @param transition
+     *            The transition to set
+     */
+    public void setTransition( int transition );
+
+
+    /**
+     * @return Returns the states.
+     */
+    public IStates getStates();
+
+}

Propchange: directory/sandbox/felixk/studio-dsml-parser/src/main/java/org/apache/directory/studio/dsmlv2/Container.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: directory/sandbox/felixk/studio-dsml-parser/src/main/java/org/apache/directory/studio/dsmlv2/DsmlDecorator.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-dsml-parser/src/main/java/org/apache/directory/studio/dsmlv2/DsmlDecorator.java?rev=592023&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-dsml-parser/src/main/java/org/apache/directory/studio/dsmlv2/DsmlDecorator.java (added)
+++ directory/sandbox/felixk/studio-dsml-parser/src/main/java/org/apache/directory/studio/dsmlv2/DsmlDecorator.java Mon Nov  5 06:52:22 2007
@@ -0,0 +1,44 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.studio.dsmlv2;
+
+
+import org.dom4j.Element;
+
+
+/**
+ * This interface defines the methods that must be implemented to define a DSML Decorator
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public interface DsmlDecorator
+{
+    /**
+     * Converts the request/reponse to its XML representation in the DSMLv2 format
+     * 
+     * @param root 
+     *      the root dom4j Element
+     * @return 
+     *      the dom4j Element corresponding to the entry.
+     */
+    public Element toDsml( Element root );
+}

Propchange: directory/sandbox/felixk/studio-dsml-parser/src/main/java/org/apache/directory/studio/dsmlv2/DsmlDecorator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: directory/sandbox/felixk/studio-dsml-parser/src/main/java/org/apache/directory/studio/dsmlv2/Dsmlv2Container.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-dsml-parser/src/main/java/org/apache/directory/studio/dsmlv2/Dsmlv2Container.java?rev=592023&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-dsml-parser/src/main/java/org/apache/directory/studio/dsmlv2/Dsmlv2Container.java (added)
+++ directory/sandbox/felixk/studio-dsml-parser/src/main/java/org/apache/directory/studio/dsmlv2/Dsmlv2Container.java Mon Nov  5 06:52:22 2007
@@ -0,0 +1,230 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.studio.dsmlv2;
+
+
+import org.apache.directory.studio.dsmlv2.reponse.BatchResponse;
+import org.apache.directory.studio.dsmlv2.request.BatchRequest;
+import org.xmlpull.v1.XmlPullParser;
+
+
+/**
+ * This class represents the DSML Container.
+ * It used by the DSML Parser to store information.
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class Dsmlv2Container implements Container
+{
+    /** The current state of the decoding */
+    private int state;
+
+    /** The current transition */
+    private int transition;
+
+    /** Store the different states for debug purpose */
+    private IStates states;
+
+    /** The pool parser */
+    private XmlPullParser parser;
+
+    /** The BatchRequest of the parsing */
+    private BatchRequest batchRequest;
+
+    /** The BatchResponse of the parsing */
+    private BatchResponse batchResponse;
+
+    /**  The associated grammar */
+    private AbstractGrammar grammar;
+
+
+    /**
+     * Gets the DSML Batch Request
+     * 
+     * @return
+     *      Returns the Batch Request
+     */
+    public BatchRequest getBatchRequest()
+    {
+        return batchRequest;
+    }
+
+
+    /**
+     * Sets the DSML Batch Request
+     * 
+     * @param batchRequest
+     *      the Batch Request to set
+     */
+    public void setBatchRequest( BatchRequest batchRequest )
+    {
+        this.batchRequest = batchRequest;
+    }
+
+
+    /**
+     * Gets the DSML Batch Response
+     * 
+     * @return
+     *      Returns the Batch Response
+     */
+    public BatchResponse getBatchResponse()
+    {
+        return batchResponse;
+    }
+
+
+    /**
+     * Sets the DSML Batch Request
+     * 
+     * @param batchRequest
+     *      the Batch Response to set
+     */
+    public void setBatchResponse( BatchResponse batchResponse )
+    {
+        this.batchResponse = batchResponse;
+    }
+
+
+    /**
+     * Gets the parser
+     * 
+     * @return
+     *      the parser
+     */
+    public XmlPullParser getParser()
+    {
+        return parser;
+    }
+
+
+    /**
+     * Sets the parser
+     * 
+     * @param parser
+     *      the parser to set
+     */
+    public void setParser( XmlPullParser parser )
+    {
+        this.parser = parser;
+    }
+
+
+    /**
+     * Get the current grammar state
+     * 
+     * @return
+     *      the current grammar state
+     */
+    public int getState()
+    {
+        return state;
+    }
+
+
+    /**
+     * Set the new current state
+     * 
+     * @param state
+     *      the new state
+     */
+    public void setState( int state )
+    {
+        this.state = state;
+    }
+
+
+    /**
+     * Get the transition
+     * 
+     * @return
+     *      the transition from the previous state to the new state
+     */
+    public int getTransition()
+    {
+        return transition;
+    }
+
+
+    /**
+     * Update the transition from a state to another
+     * 
+     * @param transition
+     *      the transition to set
+     */
+    public void setTransition( int transition )
+    {
+        this.transition = transition;
+    }
+
+
+    /**
+     * Get the states for this container's grammars
+     * 
+     * @return
+     *      the states.
+     */
+    public IStates getStates()
+    {
+        return states;
+    }
+
+
+    /**
+     * Gets the grammar
+     *
+     * @return
+     *      the grammar
+     */
+    public AbstractGrammar getGrammar()
+    {
+        return grammar;
+    }
+
+
+    /**
+     * Sets the Grammar
+     * 
+     * @param grammar
+     *      the grammar to set
+     */
+    public void setGrammar( AbstractGrammar grammar )
+    {
+        this.grammar = grammar;
+    }
+
+
+    /**
+     * Get the transition associated with the state and tag
+     * 
+     * @param state
+     *      the current state
+     * @param tag
+     *      the current tag
+     * @return
+     *      a valid transition if any, or null.
+     */
+    public GrammarTransition getTransition( int state, Tag tag )
+    {
+        return grammar.getTransition( state, tag );
+    }
+}

Propchange: directory/sandbox/felixk/studio-dsml-parser/src/main/java/org/apache/directory/studio/dsmlv2/Dsmlv2Container.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: directory/sandbox/felixk/studio-dsml-parser/src/main/java/org/apache/directory/studio/dsmlv2/Dsmlv2Parser.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-dsml-parser/src/main/java/org/apache/directory/studio/dsmlv2/Dsmlv2Parser.java?rev=592023&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-dsml-parser/src/main/java/org/apache/directory/studio/dsmlv2/Dsmlv2Parser.java (added)
+++ directory/sandbox/felixk/studio-dsml-parser/src/main/java/org/apache/directory/studio/dsmlv2/Dsmlv2Parser.java Mon Nov  5 06:52:22 2007
@@ -0,0 +1,303 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.studio.dsmlv2;
+
+
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.Reader;
+import java.io.StringReader;
+
+import org.apache.directory.shared.ldap.codec.LdapMessage;
+import org.apache.directory.studio.dsmlv2.request.BatchRequest;
+import org.apache.directory.studio.dsmlv2.request.Dsmlv2Grammar;
+import org.xmlpull.v1.XmlPullParser;
+import org.xmlpull.v1.XmlPullParserException;
+import org.xmlpull.v1.XmlPullParserFactory;
+
+
+/**
+ * This class represents the DSMLv2 Parser.
+ * It can be used to parse a DSMLv2 Request input.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class Dsmlv2Parser
+{
+    /** The associated DSMLv2 container */
+    private Dsmlv2Container container;
+
+
+    /**
+     * Creates a new instance of Dsmlv2Parser.
+     *
+     * @throws XmlPullParserException
+     *      if an error occurs while the initialization of the parser
+     */
+    public Dsmlv2Parser() throws XmlPullParserException
+    {
+        this.container = new Dsmlv2Container();
+
+        this.container.setGrammar( Dsmlv2Grammar.getInstance() );
+
+        XmlPullParserFactory factory = XmlPullParserFactory.newInstance();
+        factory.setNamespaceAware( true );
+        XmlPullParser xpp = factory.newPullParser();
+
+        container.setParser( xpp );
+    }
+
+
+    /**
+     * Sets the input file the parser is going to parse
+     *
+     * @param fileName
+     *      the name of the file
+     * @throws FileNotFoundException
+     *      if the file does not exist
+     * @throws XmlPullParserException
+     *      if an error occurs in the parser
+     */
+    public void setInputFile( String fileName ) throws FileNotFoundException, XmlPullParserException
+    {
+        Reader reader = new FileReader( fileName );
+        container.getParser().setInput( reader );
+    }
+
+
+    /**
+     * Sets the input stream the parser is going to process
+     *
+     * @param inputStream
+     *      contains a raw byte input stream of possibly unknown encoding (when inputEncoding is null)
+     * @param inputEncoding
+     *      if not null it MUST be used as encoding for inputStream
+     * @throws XmlPullParserException
+     *      if an error occurs in the parser
+     */
+    public void setInput( InputStream inputStream, String inputEncoding ) throws XmlPullParserException
+    {
+        container.getParser().setInput( inputStream, inputEncoding );
+    }
+
+
+    /**
+     * Sets the input string the parser is going to parse
+     *
+     * @param str
+     *      the string the parser is going to parse
+     * @throws XmlPullParserException
+     *      if an error occurs in the parser
+     */
+    public void setInput( String str ) throws XmlPullParserException
+    {
+        container.getParser().setInput( new StringReader( str ) );
+    }
+
+
+    /**
+     * Launches the parsing on the input
+     * 
+     * @throws XmlPullParserException 
+     *      when an unrecoverable error occurs
+     * @throws IOException
+     */
+    public void parse() throws XmlPullParserException, IOException
+    {
+        Dsmlv2Grammar grammar = Dsmlv2Grammar.getInstance();
+
+        grammar.executeAction( container );
+    }
+
+
+    /**
+     * Launches the parsing of the Batch Request only
+     *
+     * @throws XmlPullParserException
+     *      if an error occurs in the parser
+     */
+    public void parseBatchRequest() throws XmlPullParserException
+    {
+        XmlPullParser xpp = container.getParser();
+
+        int eventType = xpp.getEventType();
+        do
+        {
+            if ( eventType == XmlPullParser.START_DOCUMENT )
+            {
+                container.setState( Dsmlv2StatesEnum.INIT_GRAMMAR_STATE );
+            }
+            else if ( eventType == XmlPullParser.END_DOCUMENT )
+            {
+                container.setState( Dsmlv2StatesEnum.END_STATE );
+            }
+            else if ( eventType == XmlPullParser.START_TAG )
+            {
+                processTag( container, Tag.START );
+            }
+            else if ( eventType == XmlPullParser.END_TAG )
+            {
+                processTag( container, Tag.END );
+            }
+            try
+            {
+                eventType = xpp.next();
+            }
+            catch ( IOException e )
+            {
+                throw new XmlPullParserException( "An IOException ocurred during parsing : " + e.getMessage(), xpp,
+                    null );
+            }
+        }
+        while ( container.getState() != Dsmlv2StatesEnum.BATCHREQUEST_START_TAG );
+    }
+
+
+    /**
+     * Processes the task required in the grammar to the given tag type
+     *
+     * @param container
+     *      the DSML container
+     * @param tagType
+     *      the tag type
+     * @throws XmlPullParserException 
+     *      when an error occurs during the parsing
+     */
+    private void processTag( Dsmlv2Container container, int tagType ) throws XmlPullParserException
+    {
+        XmlPullParser xpp = container.getParser();
+
+        String tagName = xpp.getName().toLowerCase();
+
+        GrammarTransition transition = container.getTransition( container.getState(), new Tag( tagName, tagType ) );
+
+        if ( transition != null )
+        {
+            container.setState( transition.getNextState() );
+
+            if ( transition.hasAction() )
+            {
+                transition.getAction().action( container );
+            }
+        }
+        else
+        {
+            throw new XmlPullParserException( "The tag " + new Tag( tagName, tagType )
+                + " can't be found at this position", xpp, null );
+        }
+    }
+
+
+    /**
+     * Gets the Batch Request or null if the it has not been parsed yet
+     *
+     * @return 
+     *      the Batch Request or null if the it has not been parsed yet
+     */
+    public BatchRequest getBatchRequest()
+    {
+        return container.getBatchRequest();
+    }
+
+
+    /**
+     * Gets the next Request or null if there's no more request
+     * @return
+     *      the next Request or null if there's no more request
+     * @throws XmlPullParserException      
+     *      when an error occurs during the parsing
+     */
+    public LdapMessage getNextRequest() throws XmlPullParserException
+    {
+        if ( container.getBatchRequest() == null )
+        {
+            parseBatchRequest();
+        }
+
+        XmlPullParser xpp = container.getParser();
+
+        int eventType = xpp.getEventType();
+        do
+        {
+            while ( eventType == XmlPullParser.TEXT )
+            {
+                try
+                {
+                    xpp.next();
+                }
+                catch ( IOException e )
+                {
+                    throw new XmlPullParserException( "An IOException ocurred during parsing : " + e.getMessage(), xpp,
+                        null );
+                }
+                eventType = xpp.getEventType();
+            }
+
+            if ( eventType == XmlPullParser.START_DOCUMENT )
+            {
+                container.setState( Dsmlv2StatesEnum.INIT_GRAMMAR_STATE );
+            }
+            else if ( eventType == XmlPullParser.END_DOCUMENT )
+            {
+                container.setState( Dsmlv2StatesEnum.END_STATE );
+                return null;
+            }
+            else if ( eventType == XmlPullParser.START_TAG )
+            {
+                processTag( container, Tag.START );
+            }
+            else if ( eventType == XmlPullParser.END_TAG )
+            {
+                processTag( container, Tag.END );
+            }
+            try
+            {
+                eventType = xpp.next();
+            }
+            catch ( IOException e )
+            {
+                throw new XmlPullParserException( "An IOException ocurred during parsing : " + e.getMessage(), xpp,
+                    null );
+            }
+        }
+        while ( container.getState() != Dsmlv2StatesEnum.BATCHREQUEST_LOOP );
+
+        return container.getBatchRequest().getCurrentRequest();
+    }
+
+
+    /**
+     * Parses all the requests
+     *
+     * @throws XmlPullParserException
+     *      when an error occurs during the parsing
+     */
+    public void parseAllRequests() throws XmlPullParserException
+    {
+        while ( getNextRequest() != null )
+        {
+            continue;
+        }
+    }
+}

Propchange: directory/sandbox/felixk/studio-dsml-parser/src/main/java/org/apache/directory/studio/dsmlv2/Dsmlv2Parser.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: directory/sandbox/felixk/studio-dsml-parser/src/main/java/org/apache/directory/studio/dsmlv2/Dsmlv2ResponseParser.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-dsml-parser/src/main/java/org/apache/directory/studio/dsmlv2/Dsmlv2ResponseParser.java?rev=592023&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-dsml-parser/src/main/java/org/apache/directory/studio/dsmlv2/Dsmlv2ResponseParser.java (added)
+++ directory/sandbox/felixk/studio-dsml-parser/src/main/java/org/apache/directory/studio/dsmlv2/Dsmlv2ResponseParser.java Mon Nov  5 06:52:22 2007
@@ -0,0 +1,303 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.studio.dsmlv2;
+
+
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.Reader;
+import java.io.StringReader;
+
+import org.apache.directory.shared.ldap.codec.LdapResponse;
+import org.apache.directory.studio.dsmlv2.reponse.BatchResponse;
+import org.apache.directory.studio.dsmlv2.reponse.Dsmlv2ResponseGrammar;
+import org.xmlpull.v1.XmlPullParser;
+import org.xmlpull.v1.XmlPullParserException;
+import org.xmlpull.v1.XmlPullParserFactory;
+
+
+/**
+ * This class represents the DSMLv2 Parser.
+ * It can be used to parse a DSMLv2 Response input.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class Dsmlv2ResponseParser
+{
+    /** The associated DSMLv2 container */
+    private Dsmlv2Container container;
+
+
+    /**
+     * Creates a new instance of Dsmlv2ResponseParser.
+     *
+     * @throws XmlPullParserException
+     *      if an error occurs while the initialization of the parser
+     */
+    public Dsmlv2ResponseParser() throws XmlPullParserException
+    {
+        this.container = new Dsmlv2Container();
+
+        this.container.setGrammar( Dsmlv2ResponseGrammar.getInstance() );
+
+        XmlPullParserFactory factory = XmlPullParserFactory.newInstance();
+        factory.setNamespaceAware( true );
+        XmlPullParser xpp = factory.newPullParser();
+
+        container.setParser( xpp );
+    }
+
+
+    /**
+     * Sets the input string the parser is going to parse
+     *
+     * @param str
+     *      the string the parser is going to parse
+     * @throws XmlPullParserException
+     *      if an error occurs in the parser
+     */
+    public void setInput( String str ) throws FileNotFoundException, XmlPullParserException
+    {
+        container.getParser().setInput( new StringReader( str ) );
+    }
+
+
+    /**
+     * Sets the input file the parser is going to parse
+     *
+     * @param fileName
+     *      the name of the file
+     * @throws FileNotFoundException
+     *      if the file does not exist
+     * @throws XmlPullParserException
+     *      if an error occurs in the parser
+     */
+    public void setInputFile( String fileName ) throws FileNotFoundException, XmlPullParserException
+    {
+        Reader reader = new FileReader( fileName );
+        container.getParser().setInput( reader );
+    }
+
+
+    /**
+     * Sets the input stream the parser is going to process
+     *
+     * @param inputStream
+     *      contains a raw byte input stream of possibly unknown encoding (when inputEncoding is null)
+     * @param inputEncoding
+     *      if not null it MUST be used as encoding for inputStream
+     * @throws XmlPullParserException
+     *      if an error occurs in the parser
+     */
+    public void setInput( InputStream inputStream, String inputEncoding ) throws XmlPullParserException
+    {
+        container.getParser().setInput( inputStream, inputEncoding );
+    }
+
+
+    /**
+     * Launches the parsing on the input
+     * 
+     * @throws XmlPullParserException 
+     *      when an unrecoverable error occurs
+     * @throws IOException
+     */
+    public void parse() throws XmlPullParserException, IOException
+    {
+        Dsmlv2ResponseGrammar grammar = Dsmlv2ResponseGrammar.getInstance();
+
+        grammar.executeAction( container );
+    }
+
+
+    /**
+     * Launches the parsing of the Batch Response only
+     *
+     * @throws XmlPullParserException
+     *      if an error occurs in the parser
+     */
+    public void parseBatchResponse() throws XmlPullParserException
+    {
+        XmlPullParser xpp = container.getParser();
+
+        int eventType = xpp.getEventType();
+        do
+        {
+            if ( eventType == XmlPullParser.START_DOCUMENT )
+            {
+                container.setState( Dsmlv2StatesEnum.INIT_GRAMMAR_STATE );
+            }
+            else if ( eventType == XmlPullParser.END_DOCUMENT )
+            {
+                container.setState( Dsmlv2StatesEnum.END_STATE );
+            }
+            else if ( eventType == XmlPullParser.START_TAG )
+            {
+                processTag( container, Tag.START );
+            }
+            else if ( eventType == XmlPullParser.END_TAG )
+            {
+                processTag( container, Tag.END );
+            }
+            try
+            {
+                eventType = xpp.next();
+            }
+            catch ( IOException e )
+            {
+                throw new XmlPullParserException( "An IOException ocurred during parsing : " + e.getMessage(), xpp,
+                    null );
+            }
+        }
+        while ( container.getState() != Dsmlv2StatesEnum.BATCH_RESPONSE_LOOP );
+    }
+
+
+    /**
+     * Processes the task required in the grammar to the given tag type
+     *
+     * @param container
+     *      the DSML container
+     * @param tagType
+     *      the tag type
+     * @throws XmlPullParserException 
+     *      when an error occurs during the parsing
+     */
+    private void processTag( Dsmlv2Container container, int tagType ) throws XmlPullParserException
+    {
+        XmlPullParser xpp = container.getParser();
+
+        String tagName = xpp.getName().toLowerCase();
+
+        GrammarTransition transition = container.getTransition( container.getState(), new Tag( tagName, tagType ) );
+
+        if ( transition != null )
+        {
+            container.setState( transition.getNextState() );
+
+            if ( transition.hasAction() )
+            {
+                transition.getAction().action( container );
+            }
+        }
+        else
+        {
+            throw new XmlPullParserException( "The tag " + new Tag( tagName, tagType )
+                + " can't be found at this position", xpp, null );
+        }
+    }
+
+
+    /**
+     * Gets the Batch Response or null if the it has not been parsed yet
+     *
+     * @return 
+     *      the Batch Response or null if the it has not been parsed yet
+     */
+    public BatchResponse getBatchResponse()
+    {
+        return container.getBatchResponse();
+    }
+
+
+    /**
+     * Returns the next Request or null if there's no more request
+     * @return
+     *      the next Request or null if there's no more request
+     * @throws XmlPullParserException 
+     *      when an error occurs during the parsing
+     */
+    public LdapResponse getNextResponse() throws XmlPullParserException
+    {
+        if ( container.getBatchResponse() == null )
+        {
+            parseBatchResponse();
+        }
+
+        XmlPullParser xpp = container.getParser();
+
+        int eventType = xpp.getEventType();
+        do
+        {
+            while ( eventType == XmlPullParser.TEXT )
+            {
+                try
+                {
+                    xpp.next();
+                }
+                catch ( IOException e )
+                {
+                    throw new XmlPullParserException( "An IOException ocurred during parsing : " + e.getMessage(), xpp,
+                        null );
+                }
+                eventType = xpp.getEventType();
+            }
+
+            if ( eventType == XmlPullParser.START_DOCUMENT )
+            {
+                container.setState( Dsmlv2StatesEnum.INIT_GRAMMAR_STATE );
+            }
+            else if ( eventType == XmlPullParser.END_DOCUMENT )
+            {
+                container.setState( Dsmlv2StatesEnum.END_STATE );
+                return null;
+            }
+            else if ( eventType == XmlPullParser.START_TAG )
+            {
+                processTag( container, Tag.START );
+            }
+            else if ( eventType == XmlPullParser.END_TAG )
+            {
+                processTag( container, Tag.END );
+            }
+            try
+            {
+                eventType = xpp.next();
+            }
+            catch ( IOException e )
+            {
+                throw new XmlPullParserException( "An IOException ocurred during parsing : " + e.getMessage(), xpp,
+                    null );
+            }
+        }
+        while ( container.getState() != Dsmlv2StatesEnum.BATCH_RESPONSE_LOOP );
+
+        return container.getBatchResponse().getCurrentResponse();
+    }
+
+
+    /**
+     * Parses all the responses
+     *
+     * @throws XmlPullParserException
+     *      when an error occurs during the parsing
+     */
+    public void parseAllResponses() throws XmlPullParserException
+    {
+        while ( getNextResponse() != null )
+        {
+            continue;
+        }
+    }
+}

Propchange: directory/sandbox/felixk/studio-dsml-parser/src/main/java/org/apache/directory/studio/dsmlv2/Dsmlv2ResponseParser.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: directory/sandbox/felixk/studio-dsml-parser/src/main/java/org/apache/directory/studio/dsmlv2/Dsmlv2StatesEnum.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-dsml-parser/src/main/java/org/apache/directory/studio/dsmlv2/Dsmlv2StatesEnum.java?rev=592023&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-dsml-parser/src/main/java/org/apache/directory/studio/dsmlv2/Dsmlv2StatesEnum.java (added)
+++ directory/sandbox/felixk/studio-dsml-parser/src/main/java/org/apache/directory/studio/dsmlv2/Dsmlv2StatesEnum.java Mon Nov  5 06:52:22 2007
@@ -0,0 +1,807 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.studio.dsmlv2;
+
+
+/**
+ * This class store the Dsml grammar's constants. It is also used for debugging
+ * purpose
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class Dsmlv2StatesEnum implements IStates
+{
+    //====================================================
+    //  <batchRequest> ... </batchRequest>
+    //====================================================
+    /** The &lt;batchRequest&gt; tag */
+    public static final int BATCHREQUEST_START_TAG = 104;
+
+    public static final int BATCHREQUEST_LOOP = 105;
+
+    /** The &lt;/batchRequest&gt; tag */
+    public static final int BATCHREQUEST_END_TAG = 1;
+
+    //====================================================
+    //  <abandonRequest> ... </abandonRequest>
+    //====================================================
+    /** The &lt;abandonRequest&gt; tag */
+    public static final int ABANDON_REQUEST_START_TAG = 2;
+
+    /** The &lt;control&gt; tag */
+    public static final int ABANDON_REQUEST_CONTROL_START_TAG = 4;
+
+    /** The &lt;/control&gt; tag */
+    public static final int ABANDON_REQUEST_CONTROL_END_TAG = 5;
+
+    /** The &lt;controlValue&gt; tag */
+    public static final int ABANDON_REQUEST_CONTROLVALUE_START_TAG = 6;
+
+    /** The &lt;/controlValue&gt; tag */
+    public static final int ABANDON_REQUEST_CONTROLVALUE_END_TAG = 7;
+
+    //====================================================
+    //  <addRequest> ... </addRequest>
+    //====================================================
+    /** The &lt;addRequest&gt; tag */
+    public static final int ADD_REQUEST_START_TAG = 8;
+
+    /** The &lt;control&gt; tag */
+    public static final int ADD_REQUEST_CONTROL_START_TAG = 10;
+
+    /** The &lt;/control&gt; tag */
+    public static final int ADD_REQUEST_CONTROL_END_TAG = 11;
+
+    /** The &lt;controlValue&gt; tag */
+    public static final int ADD_REQUEST_CONTROLVALUE_START_TAG = 12;
+
+    /** The &lt;/controlValue&gt; tag */
+    public static final int ADD_REQUEST_CONTROLVALUE_END_TAG = 13;
+
+    /** The &lt;attr&gt; tag */
+    public static final int ADD_REQUEST_ATTR_START_TAG = 14;
+
+    /** The &lt;/attr&gt; tag */
+    public static final int ADD_REQUEST_ATTR_END_TAG = 15;
+
+    /** The &lt;value&gt; tag */
+    public static final int ADD_REQUEST_VALUE_START_TAG = 16;
+
+    /** The &lt;/value&gt; tag */
+    public static final int ADD_REQUEST_VALUE_END_TAG = 17;
+
+    //====================================================
+    //  <authRequest> ... </authRequest>
+    //====================================================
+    /** The &lt;authRequest&gt; tag */
+    public static final int AUTH_REQUEST_START_TAG = 18;
+
+    /** The &lt;control&gt; tag */
+    public static final int AUTH_REQUEST_CONTROL_START_TAG = 20;
+
+    /** The &lt;/control&gt; tag */
+    public static final int AUTH_REQUEST_CONTROL_END_TAG = 21;
+
+    /** The &lt;controlValue&gt; tag */
+    public static final int AUTH_REQUEST_CONTROLVALUE_START_TAG = 22;
+
+    /** The &lt;/controlValue&gt; tag */
+    public static final int AUTH_REQUEST_CONTROLVALUE_END_TAG = 23;
+
+    //====================================================
+    //  <compareRequest> ... </compareRequest>
+    //====================================================
+    /** The &lt;compareRequest&gt; tag */
+    public static final int COMPARE_REQUEST_START_TAG = 24;
+
+    /** The &lt;control&gt; tag */
+    public static final int COMPARE_REQUEST_CONTROL_START_TAG = 26;
+
+    /** The &lt;/control&gt; tag */
+    public static final int COMPARE_REQUEST_CONTROL_END_TAG = 27;
+
+    /** The &lt;controlValue&gt; tag */
+    public static final int COMPARE_REQUEST_CONTROLVALUE_START_TAG = 28;
+
+    /** The &lt;/controlValue&gt; tag */
+    public static final int COMPARE_REQUEST_CONTROLVALUE_END_TAG = 29;
+
+    /** The &lt;assertion&gt; tag */
+    public static final int COMPARE_REQUEST_ASSERTION_START_TAG = 30;
+
+    /** The &lt;/assertion&gt; tag */
+    public static final int COMPARE_REQUEST_ASSERTION_END_TAG = 31;
+
+    /** The &lt;value&gt; tag */
+    public static final int COMPARE_REQUEST_VALUE_START_TAG = 32;
+
+    /** The &lt;/value&gt; tag */
+    public static final int COMPARE_REQUEST_VALUE_END_TAG = 33;
+
+    //====================================================
+    //  <delRequest> ... </delRequest>
+    //====================================================
+    /** The &lt;delRequest&gt; tag */
+    public static final int DEL_REQUEST_START_TAG = 34;
+
+    /** The &lt;control&gt; tag */
+    public static final int DEL_REQUEST_CONTROL_START_TAG = 36;
+
+    /** The &lt;/control&gt; tag */
+    public static final int DEL_REQUEST_CONTROL_END_TAG = 37;
+
+    /** The &lt;controlValue&gt; tag */
+    public static final int DEL_REQUEST_CONTROLVALUE_START_TAG = 38;
+
+    /** The &lt;/controlValue&gt; tag */
+    public static final int DEL_REQUEST_CONTROLVALUE_END_TAG = 39;
+
+    //====================================================
+    //  <extendedRequest> ... </extendedRequest>
+    //====================================================
+    /** The &lt;extendedRequest&gt; tag */
+    public static final int EXTENDED_REQUEST_START_TAG = 40;
+
+    /** The &lt;control&gt; tag */
+    public static final int EXTENDED_REQUEST_CONTROL_START_TAG = 42;
+
+    /** The &lt;/control&gt; tag */
+    public static final int EXTENDED_REQUEST_CONTROL_END_TAG = 43;
+
+    /** The &lt;controlValue&gt; tag */
+    public static final int EXTENDED_REQUEST_CONTROLVALUE_START_TAG = 44;
+
+    /** The &lt;/controlValue&gt; tag */
+    public static final int EXTENDED_REQUEST_CONTROLVALUE_END_TAG = 45;
+
+    /** The &lt;requestName&gt; tag */
+    public static final int EXTENDED_REQUEST_REQUESTNAME_START_TAG = 46;
+
+    /** The &lt;/requestName&gt; tag */
+    public static final int EXTENDED_REQUEST_REQUESTNAME_END_TAG = 47;
+
+    /** The &lt;requestValue&gt; tag */
+    public static final int EXTENDED_REQUEST_REQUESTVALUE_START_TAG = 48;
+
+    /** The &lt;/requestValue&gt; tag */
+    public static final int EXTENDED_REQUEST_REQUESTVALUE_END_TAG = 49;
+
+    //====================================================
+    //  <modDNRequest> ... </modDNRequest>
+    //====================================================
+    /** The &lt;modDNRequest&gt; tag */
+    public static final int MODIFY_DN_REQUEST_START_TAG = 50;
+
+    /** The &lt;control&gt; tag */
+    public static final int MODIFY_DN_REQUEST_CONTROL_START_TAG = 52;
+
+    /** The &lt;/control&gt; tag */
+    public static final int MODIFY_DN_REQUEST_CONTROL_END_TAG = 53;
+
+    /** The &lt;controlValue&gt; tag */
+    public static final int MODIFY_DN_REQUEST_CONTROLVALUE_START_TAG = 54;
+
+    /** The &lt;/controlValue&gt; tag */
+    public static final int MODIFY_DN_REQUEST_CONTROLVALUE_END_TAG = 55;
+
+    //====================================================
+    //  <modifyRequest> ... </modifyRequest>
+    //====================================================
+    /** The &lt;modifyRequest&gt; tag */
+    public static final int MODIFY_REQUEST_START_TAG = 56;
+
+    /** The &lt;control&gt; tag */
+    public static final int MODIFY_REQUEST_CONTROL_START_TAG = 58;
+
+    /** The &lt;/control&gt; tag */
+    public static final int MODIFY_REQUEST_CONTROL_END_TAG = 59;
+
+    /** The &lt;controlValue&gt; tag */
+    public static final int MODIFY_REQUEST_CONTROLVALUE_START_TAG = 60;
+
+    /** The &lt;/controlValue&gt; tag */
+    public static final int MODIFY_REQUEST_CONTROLVALUE_END_TAG = 61;
+
+    /** The &lt;modification&gt; tag */
+    public static final int MODIFY_REQUEST_MODIFICATION_START_TAG = 62;
+
+    /** The &lt;/modification&gt; tag */
+    public static final int MODIFY_REQUEST_MODIFICATION_END_TAG = 63;
+
+    /** The &lt;value&gt; tag */
+    public static final int MODIFY_REQUEST_VALUE_START_TAG = 64;
+
+    /** The &lt;/value&gt; tag */
+    public static final int MODIFY_REQUEST_VALUE_END_TAG = 65;
+
+    //====================================================
+    //  <searchRequest> ... </searchRequest>
+    //====================================================
+    /** The &lt;searchRequest&gt; tag */
+    public static final int SEARCH_REQUEST_START_TAG = 66;
+
+    /** The &lt;control&gt; tag */
+    public static final int SEARCH_REQUEST_CONTROL_START_TAG = 68;
+
+    /** The &lt;/control&gt; tag */
+    public static final int SEARCH_REQUEST_CONTROL_END_TAG = 69;
+
+    /** The &lt;controlValue&gt; tag */
+    public static final int SEARCH_REQUEST_CONTROLVALUE_START_TAG = 70;
+
+    /** The &lt;/controlValue&gt; tag */
+    public static final int SEARCH_REQUEST_CONTROLVALUE_END_TAG = 71;
+
+    /** The &lt;filter&gt; tag */
+    public static final int SEARCH_REQUEST_FILTER_START_TAG = 72;
+
+    /** The &lt;/filter&gt; tag */
+    public static final int SEARCH_REQUEST_FILTER_END_TAG = 73;
+
+    /** The &lt;attributes&gt; tag */
+    public static final int SEARCH_REQUEST_ATTRIBUTES_START_TAG = 74;
+
+    /** The &lt;/attributes&gt; tag */
+    public static final int SEARCH_REQUEST_ATTRIBUTES_END_TAG = 75;
+
+    /** The &lt;attribute&gt; tag */
+    public static final int SEARCH_REQUEST_ATTRIBUTE_START_TAG = 76;
+
+    /** The &lt;/attribute&gt; tag */
+    public static final int SEARCH_REQUEST_ATTRIBUTE_END_TAG = 77;
+
+    /** The &lt;equalityMatch&gt; tag */
+    public static final int SEARCH_REQUEST_EQUALITYMATCH_START_TAG = 84;
+
+    /** The &lt;subStrings&gt; tag */
+    public static final int SEARCH_REQUEST_SUBSTRINGS_START_TAG = 86;
+
+    /** The &lt;/subStrings&gt; tag */
+    public static final int SEARCH_REQUEST_SUBSTRINGS_END_TAG = 87;
+
+    /** The &lt;greaterOrEqual&gt; tag */
+    public static final int SEARCH_REQUEST_GREATEROREQUAL_START_TAG = 88;
+
+    /** The &lt;lessOrEqual&gt; tag */
+    public static final int SEARCH_REQUEST_LESSOREQUAL_START_TAG = 90;
+
+    /** The &lt;present&gt; tag */
+    public static final int SEARCH_REQUEST_PRESENT_START_TAG = 92;
+
+    /** The &lt;approxMatch&gt; tag */
+    public static final int SEARCH_REQUEST_APPROXMATCH_START_TAG = 94;
+
+    /** The &lt;extensibleMatch&gt; tag */
+    public static final int SEARCH_REQUEST_EXTENSIBLEMATCH_START_TAG = 96;
+
+    /** The &lt;value&gt; tag */
+    public static final int SEARCH_REQUEST_EXTENSIBLEMATCH_VALUE_START_TAG = 109;
+
+    /** The &lt;/value&gt; tag */
+    public static final int SEARCH_REQUEST_EXTENSIBLEMATCH_VALUE_END_TAG = 110;
+
+    /** The &lt;initial&gt; tag */
+    public static final int SEARCH_REQUEST_INITIAL_START_TAG = 98;
+
+    /** The &lt;/initial&gt; tag */
+    public static final int SEARCH_REQUEST_INITIAL_END_TAG = 99;
+
+    /** The &lt;any&gt; tag */
+    public static final int SEARCH_REQUEST_ANY_START_TAG = 100;
+
+    /** The &lt;/any&gt; tag */
+    public static final int SEARCH_REQUEST_ANY_END_TAG = 101;
+
+    /** The &lt;final&gt; tag */
+    public static final int SEARCH_REQUEST_FINAL_START_TAG = 102;
+
+    /** The &lt;/final&gt; tag */
+    public static final int SEARCH_REQUEST_FINAL_END_TAG = 103;
+
+    /** The &lt;value&gt; tag */
+    public static final int SEARCH_REQUEST_VALUE_START_TAG = 107;
+
+    /** The &lt;/value&gt; tag */
+    public static final int SEARCH_REQUEST_VALUE_END_TAG = 108;
+
+    /** The Filter Loop state */
+    public static final int SEARCH_REQUEST_FILTER_LOOP = 106;
+
+    //****************
+    // DSML Response 
+    //****************
+
+    /** The Batch Response Loop state */
+    public static final int BATCH_RESPONSE_LOOP = 200;
+
+    /** The Error Response Loop state */
+    public static final int ERROR_RESPONSE = 201;
+
+    /** The Message Start state */
+    public static final int MESSAGE_START = 202;
+
+    /** The Message End state */
+    public static final int MESSAGE_END = 203;
+
+    /** The Detail Start state */
+    public static final int DETAIL_START = 204;
+
+    /** The Detail End state */
+    public static final int DETAIL_END = 205;
+
+    /** The Extended Response state */
+    public static final int EXTENDED_RESPONSE = 206;
+
+    /** The Extended Response Control Start state */
+    public static final int EXTENDED_RESPONSE_CONTROL_START = 207;
+
+    /** The Extended Response Control End state */
+    public static final int EXTENDED_RESPONSE_CONTROL_END = 208;
+
+    /** The Extended Response Control Value Start state */
+    public static final int EXTENDED_RESPONSE_CONTROL_VALUE_START = 245;
+
+    /** The Extended Response Control Value End state */
+    public static final int EXTENDED_RESPONSE_CONTROL_VALUE_END = 246;
+
+    /** The Extended Response Result Code Start state */
+    public static final int EXTENDED_RESPONSE_RESULT_CODE_START = 209;
+
+    /** The Extended Response Result Code End state */
+    public static final int EXTENDED_RESPONSE_RESULT_CODE_END = 210;
+
+    /** The Extended Response Error Message Start state */
+    public static final int EXTENDED_RESPONSE_ERROR_MESSAGE_START = 211;
+
+    /** The Extended Response Error Message End state */
+    public static final int EXTENDED_RESPONSE_ERROR_MESSAGE_END = 212;
+
+    /** The Extended Response Referral Start state */
+    public static final int EXTENDED_RESPONSE_REFERRAL_START = 213;
+
+    /** The Extended Response Referral End state */
+    public static final int EXTENDED_RESPONSE_REFERRAL_END = 214;
+
+    /** The Response Name Start state */
+    public static final int RESPONSE_NAME_START = 215;
+
+    /** The Response Name End state */
+    public static final int RESPONSE_NAME_END = 216;
+
+    /** The Response Start state */
+    public static final int RESPONSE_START = 217;
+
+    /** The Response End state */
+    public static final int RESPONSE_END = 218;
+
+    /** The LDAP Result state */
+    public static final int LDAP_RESULT = 219;
+
+    /** The LDAP Result Control Start state */
+    public static final int LDAP_RESULT_CONTROL_START = 220;
+
+    /** The LDAP Result Control End state */
+    public static final int LDAP_RESULT_CONTROL_END = 221;
+
+    /** The LDAP Result Control Value Start state */
+    public static final int LDAP_RESULT_CONTROL_VALUE_START = 247;
+
+    /** The LDAP Result Control Value End state */
+    public static final int LDAP_RESULT_CONTROL_VALUE_END = 248;
+
+    /** The LDAP Result Result Code Start state */
+    public static final int LDAP_RESULT_RESULT_CODE_START = 222;
+
+    /** The LDAP Result Result Code End state */
+    public static final int LDAP_RESULT_RESULT_CODE_END = 223;
+
+    /** The LDAP Result Error Message Start state */
+    public static final int LDAP_RESULT_ERROR_MESSAGE_START = 224;
+
+    /** The LDAP Result Error Message End state */
+    public static final int LDAP_RESULT_ERROR_MESSAGE_END = 225;
+
+    /** The LDAP Result Referral Start state */
+    public static final int LDAP_RESULT_REFERRAL_START = 226;
+
+    /** The LDAP Result Referral End state */
+    public static final int LDAP_RESULT_REFERRAL_END = 227;
+
+    /** The LDAP Result End state */
+    public static final int LDAP_RESULT_END = 228;
+
+    /** The Search Response state */
+    public static final int SEARCH_RESPONSE = 229;
+
+    /** The Search Result Entry state */
+    public static final int SEARCH_RESULT_ENTRY = 230;
+
+    /** The Search Result Entry Control Start state */
+    public static final int SEARCH_RESULT_ENTRY_CONTROL_START = 231;
+
+    /** The Search Result Entry Control End state */
+    public static final int SEARCH_RESULT_ENTRY_CONTROL_END = 232;
+
+    /** The Search Result Entry Control Value Start state */
+    public static final int SEARCH_RESULT_ENTRY_CONTROL_VALUE_START = 249;
+
+    /** The Search Result Entry Control Value End state */
+    public static final int SEARCH_RESULT_ENTRY_CONTROL_VALUE_END = 250;
+
+    /** The Search Result Entry Attr Start state */
+    public static final int SEARCH_RESULT_ENTRY_ATTR_START = 233;
+
+    /** The Search Result Entry Attr End state */
+    public static final int SEARCH_RESULT_ENTRY_ATTR_END = 234;
+
+    /** The Search Result Entry Value Start state */
+    public static final int SEARCH_RESULT_ENTRY_VALUE_START = 235;
+
+    /** The Search Result Entry Value End state */
+    public static final int SEARCH_RESULT_ENTRY_VALUE_END = 236;
+
+    /** The Search Result Entry Loop state */
+    public static final int SEARCH_RESULT_ENTRY_LOOP = 237;
+
+    /** The Search Result Reference state */
+    public static final int SEARCH_RESULT_REFERENCE = 238;
+
+    /** The Search Result Reference Control Start state */
+    public static final int SEARCH_RESULT_REFERENCE_CONTROL_START = 239;
+
+    /** The Search Result Reference Control End state */
+    public static final int SEARCH_RESULT_REFERENCE_CONTROL_END = 240;
+
+    /** The Search Result Reference Control Value Start state */
+    public static final int SEARCH_RESULT_REFERENCE_CONTROL_VALUE_START = 251;
+
+    /** The Search Result Reference Control Value End state */
+    public static final int SEARCH_RESULT_REFERENCE_CONTROL_VALUE_END = 252;
+
+    /** The Search Result Reference Ref Start state */
+    public static final int SEARCH_RESULT_REFERENCE_REF_START = 241;
+
+    /** The Search Result Reference Ref End state */
+    public static final int SEARCH_RESULT_REFERENCE_REF_END = 242;
+
+    /** The Search Result Reference Loop state */
+    public static final int SEARCH_RESULT_REFERENCE_LOOP = 243;
+
+    /** The Search Result Done End state */
+    public static final int SEARCH_RESULT_DONE_END = 244;
+
+    /** The instance */
+    private static Dsmlv2StatesEnum instance = new Dsmlv2StatesEnum();
+
+
+    private Dsmlv2StatesEnum()
+    {
+    }
+
+
+    /**
+     * Get an instance of this class
+     * 
+     * @return An instance on this class
+     */
+    public static Dsmlv2StatesEnum getInstance()
+    {
+        return instance;
+    }
+
+
+    /** Get the current state for a specified grammar */
+    public String getState( int state )
+    {
+        switch ( state )
+        {
+            case BATCHREQUEST_START_TAG:
+                return "BATCHREQUEST_START_TAG";
+            case BATCHREQUEST_LOOP:
+                return "BATCHREQUEST_LOOP";
+            case BATCHREQUEST_END_TAG:
+                return "BATCHREQUEST_END_TAG";
+            case ABANDON_REQUEST_START_TAG:
+                return "ABANDON_REQUEST_START_TAG";
+            case ABANDON_REQUEST_CONTROL_START_TAG:
+                return "ABANDON_REQUEST_CONTROL_START_TAG";
+            case ABANDON_REQUEST_CONTROL_END_TAG:
+                return "ABANDON_REQUEST_CONTROL_END_TAG";
+            case ABANDON_REQUEST_CONTROLVALUE_START_TAG:
+                return "ABANDON_REQUEST_CONTROLVALUE_START_TAG";
+            case ABANDON_REQUEST_CONTROLVALUE_END_TAG:
+                return "ABANDON_REQUEST_CONTROLVALUE_END_TAG";
+            case ADD_REQUEST_START_TAG:
+                return "ADD_REQUEST_START_TAG";
+            case ADD_REQUEST_CONTROL_START_TAG:
+                return "ADD_REQUEST_CONTROL_START_TAG";
+            case ADD_REQUEST_CONTROL_END_TAG:
+                return "ADD_REQUEST_CONTROL_END_TAG";
+            case ADD_REQUEST_CONTROLVALUE_START_TAG:
+                return "ADD_REQUEST_CONTROLVALUE_START_TAG";
+            case ADD_REQUEST_CONTROLVALUE_END_TAG:
+                return "ADD_REQUEST_CONTROLVALUE_END_TAG";
+            case ADD_REQUEST_ATTR_START_TAG:
+                return "ADD_REQUEST_ATTR_START_TAG";
+            case ADD_REQUEST_ATTR_END_TAG:
+                return "ADD_REQUEST_ATTR_END_TAG";
+            case ADD_REQUEST_VALUE_START_TAG:
+                return "ADD_REQUEST_VALUE_START_TAG";
+            case ADD_REQUEST_VALUE_END_TAG:
+                return "ADD_REQUEST_VALUE_END_TAG";
+            case AUTH_REQUEST_START_TAG:
+                return "AUTH_REQUEST_START_TAG";
+            case AUTH_REQUEST_CONTROL_START_TAG:
+                return "AUTH_REQUEST_CONTROL_START_TAG";
+            case AUTH_REQUEST_CONTROL_END_TAG:
+                return "AUTH_REQUEST_CONTROL_END_TAG";
+            case AUTH_REQUEST_CONTROLVALUE_START_TAG:
+                return "AUTH_REQUEST_CONTROLVALUE_START_TAG";
+            case AUTH_REQUEST_CONTROLVALUE_END_TAG:
+                return "AUTH_REQUEST_CONTROLVALUE_END_TAG";
+            case COMPARE_REQUEST_START_TAG:
+                return "COMPARE_REQUEST_START_TAG";
+            case COMPARE_REQUEST_CONTROL_START_TAG:
+                return "COMPARE_REQUEST_CONTROL_START_TAG";
+            case COMPARE_REQUEST_CONTROL_END_TAG:
+                return "COMPARE_REQUEST_CONTROL_END_TAG";
+            case COMPARE_REQUEST_CONTROLVALUE_START_TAG:
+                return "COMPARE_REQUEST_CONTROLVALUE_START_TAG";
+            case COMPARE_REQUEST_CONTROLVALUE_END_TAG:
+                return "COMPARE_REQUEST_CONTROLVALUE_END_TAG";
+            case COMPARE_REQUEST_ASSERTION_START_TAG:
+                return "COMPARE_REQUEST_ASSERTION_START_TAG";
+            case COMPARE_REQUEST_ASSERTION_END_TAG:
+                return "COMPARE_REQUEST_ASSERTION_END_TAG";
+            case COMPARE_REQUEST_VALUE_START_TAG:
+                return "COMPARE_REQUEST_VALUE_START_TAG";
+            case COMPARE_REQUEST_VALUE_END_TAG:
+                return "COMPARE_REQUEST_VALUE_END_TAG";
+            case DEL_REQUEST_START_TAG:
+                return "DEL_REQUEST_START_TAG";
+            case DEL_REQUEST_CONTROL_START_TAG:
+                return "DEL_REQUEST_CONTROL_START_TAG";
+            case DEL_REQUEST_CONTROL_END_TAG:
+                return "DEL_REQUEST_CONTROL_END_TAG";
+            case DEL_REQUEST_CONTROLVALUE_START_TAG:
+                return "DEL_REQUEST_CONTROLVALUE_START_TAG";
+            case DEL_REQUEST_CONTROLVALUE_END_TAG:
+                return "DEL_REQUEST_CONTROLVALUE_END_TAG";
+            case EXTENDED_REQUEST_START_TAG:
+                return "EXTENDED_REQUEST_START_TAG";
+            case EXTENDED_REQUEST_CONTROL_START_TAG:
+                return "EXTENDED_REQUEST_CONTROL_START_TAG";
+            case EXTENDED_REQUEST_CONTROL_END_TAG:
+                return "EXTENDED_REQUEST_CONTROL_END_TAG";
+            case EXTENDED_REQUEST_CONTROLVALUE_START_TAG:
+                return "EXTENDED_REQUEST_CONTROLVALUE_START_TAG";
+            case EXTENDED_REQUEST_CONTROLVALUE_END_TAG:
+                return "EXTENDED_REQUEST_CONTROLVALUE_END_TAG";
+            case EXTENDED_REQUEST_REQUESTNAME_START_TAG:
+                return "EXTENDED_REQUEST_REQUESTNAME_START_TAG";
+            case EXTENDED_REQUEST_REQUESTNAME_END_TAG:
+                return "EXTENDED_REQUEST_REQUESTNAME_END_TAG";
+            case EXTENDED_REQUEST_REQUESTVALUE_START_TAG:
+                return "EXTENDED_REQUEST_REQUESTVALUE_START_TAG";
+            case EXTENDED_REQUEST_REQUESTVALUE_END_TAG:
+                return "EXTENDED_REQUEST_REQUESTVALUE_END_TAG";
+            case MODIFY_DN_REQUEST_START_TAG:
+                return "MODIFY_DN_REQUEST_START_TAG";
+            case MODIFY_DN_REQUEST_CONTROL_START_TAG:
+                return "MODIFY_DN_REQUEST_CONTROL_START_TAG";
+            case MODIFY_DN_REQUEST_CONTROL_END_TAG:
+                return "MODIFY_DN_REQUEST_CONTROL_END_TAG";
+            case MODIFY_DN_REQUEST_CONTROLVALUE_START_TAG:
+                return "MODIFY_DN_REQUEST_CONTROLVALUE_START_TAG";
+            case MODIFY_DN_REQUEST_CONTROLVALUE_END_TAG:
+                return "MODIFY_DN_REQUEST_CONTROLVALUE_END_TAG";
+            case MODIFY_REQUEST_START_TAG:
+                return "MODIFY_REQUEST_START_TAG";
+            case MODIFY_REQUEST_CONTROL_START_TAG:
+                return "MODIFY_REQUEST_CONTROL_START_TAG";
+            case MODIFY_REQUEST_CONTROL_END_TAG:
+                return "MODIFY_REQUEST_CONTROL_END_TAG";
+            case MODIFY_REQUEST_CONTROLVALUE_START_TAG:
+                return "MODIFY_REQUEST_CONTROLVALUE_START_TAG";
+            case MODIFY_REQUEST_CONTROLVALUE_END_TAG:
+                return "MODIFY_REQUEST_CONTROLVALUE_END_TAG";
+            case MODIFY_REQUEST_MODIFICATION_START_TAG:
+                return "MODIFY_REQUEST_MODIFICATION_START_TAG";
+            case MODIFY_REQUEST_MODIFICATION_END_TAG:
+                return "MODIFY_REQUEST_MODIFICATION_END_TAG";
+            case MODIFY_REQUEST_VALUE_START_TAG:
+                return "MODIFY_REQUEST_VALUE_START_TAG";
+            case MODIFY_REQUEST_VALUE_END_TAG:
+                return "MODIFY_REQUEST_VALUE_END_TAG";
+            case SEARCH_REQUEST_START_TAG:
+                return "SEARCH_REQUEST_START_TAG";
+            case SEARCH_REQUEST_CONTROL_START_TAG:
+                return "SEARCH_REQUEST_CONTROL_START_TAG";
+            case SEARCH_REQUEST_CONTROL_END_TAG:
+                return "SEARCH_REQUEST_CONTROL_END_TAG";
+            case SEARCH_REQUEST_CONTROLVALUE_START_TAG:
+                return "SEARCH_REQUEST_CONTROLVALUE_START_TAG";
+            case SEARCH_REQUEST_CONTROLVALUE_END_TAG:
+                return "SEARCH_REQUEST_CONTROLVALUE_END_TAG";
+            case SEARCH_REQUEST_FILTER_START_TAG:
+                return "SEARCH_REQUEST_FILTER_START_TAG";
+            case SEARCH_REQUEST_FILTER_END_TAG:
+                return "SEARCH_REQUEST_FILTER_END_TAG";
+            case SEARCH_REQUEST_ATTRIBUTES_START_TAG:
+                return "SEARCH_REQUEST_ATTRIBUTES_START_TAG";
+            case SEARCH_REQUEST_ATTRIBUTES_END_TAG:
+                return "SEARCH_REQUEST_ATTRIBUTES_END_TAG";
+            case SEARCH_REQUEST_ATTRIBUTE_START_TAG:
+                return "SEARCH_REQUEST_ATTRIBUTE_START_TAG";
+            case SEARCH_REQUEST_ATTRIBUTE_END_TAG:
+                return "SEARCH_REQUEST_ATTRIBUTE_END_TAG";
+            case SEARCH_REQUEST_EQUALITYMATCH_START_TAG:
+                return "SEARCH_REQUEST_EQUALITYMATCH_START_TAG";
+            case SEARCH_REQUEST_SUBSTRINGS_START_TAG:
+                return "SEARCH_REQUEST_SUBSTRINGS_START_TAG";
+            case SEARCH_REQUEST_SUBSTRINGS_END_TAG:
+                return "SEARCH_REQUEST_SUBSTRINGS_END_TAG";
+            case SEARCH_REQUEST_GREATEROREQUAL_START_TAG:
+                return "SEARCH_REQUEST_GREATEROREQUAL_START_TAG";
+            case SEARCH_REQUEST_LESSOREQUAL_START_TAG:
+                return "SEARCH_REQUEST_LESSOREQUAL_START_TAG";
+            case SEARCH_REQUEST_PRESENT_START_TAG:
+                return "SEARCH_REQUEST_PRESENT_START_TAG";
+            case SEARCH_REQUEST_APPROXMATCH_START_TAG:
+                return "SEARCH_REQUEST_APPROXMATCH_START_TAG";
+            case SEARCH_REQUEST_EXTENSIBLEMATCH_START_TAG:
+                return "SEARCH_REQUEST_EXTENSIBLEMATCH_START_TAG";
+            case SEARCH_REQUEST_EXTENSIBLEMATCH_VALUE_START_TAG:
+                return "SEARCH_REQUEST_EXTENSIBLEMATCH_VALUE_START_TAG";
+            case SEARCH_REQUEST_EXTENSIBLEMATCH_VALUE_END_TAG:
+                return "SEARCH_REQUEST_EXTENSIBLEMATCH_VALUE_END_TAG";
+            case SEARCH_REQUEST_INITIAL_START_TAG:
+                return "SEARCH_REQUEST_INITIAL_START_TAG";
+            case SEARCH_REQUEST_INITIAL_END_TAG:
+                return "SEARCH_REQUEST_INITIAL_END_TAG";
+            case SEARCH_REQUEST_ANY_START_TAG:
+                return "SEARCH_REQUEST_ANY_START_TAG";
+            case SEARCH_REQUEST_ANY_END_TAG:
+                return "SEARCH_REQUEST_ANY_END_TAG";
+            case SEARCH_REQUEST_FINAL_START_TAG:
+                return "SEARCH_REQUEST_FINAL_START_TAG";
+            case SEARCH_REQUEST_FINAL_END_TAG:
+                return "SEARCH_REQUEST_FINAL_END_TAG";
+            case SEARCH_REQUEST_VALUE_START_TAG:
+                return "SEARCH_REQUEST_VALUE_START_TAG";
+            case SEARCH_REQUEST_VALUE_END_TAG:
+                return "SEARCH_REQUEST_VALUE_END_TAG";
+            case SEARCH_REQUEST_FILTER_LOOP:
+                return "SEARCH_REQUEST_FILTER_LOOP";
+
+            case BATCH_RESPONSE_LOOP:
+                return "BATCH_RESPONSE_LOOP";
+            case ERROR_RESPONSE:
+                return "ERROR_RESPONSE";
+            case MESSAGE_START:
+                return "MESSAGE_START";
+            case MESSAGE_END:
+                return "MESSAGE_END";
+            case DETAIL_START:
+                return "DETAIL_START";
+            case DETAIL_END:
+                return "DETAIL_END";
+            case EXTENDED_RESPONSE:
+                return "EXTENDED_RESPONSE";
+            case EXTENDED_RESPONSE_CONTROL_START:
+                return "EXTENDED_RESPONSE_CONTROL_START";
+            case EXTENDED_RESPONSE_CONTROL_END:
+                return "EXTENDED_RESPONSE_CONTROL_END";
+            case EXTENDED_RESPONSE_CONTROL_VALUE_START:
+                return "EXTENDED_RESPONSE_CONTROL_VALUE_START";
+            case EXTENDED_RESPONSE_CONTROL_VALUE_END:
+                return "EXTENDED_RESPONSE_CONTROL_VALUE_END";
+            case EXTENDED_RESPONSE_RESULT_CODE_START:
+                return "EXTENDED_RESPONSE_RESULT_CODE_START";
+            case EXTENDED_RESPONSE_RESULT_CODE_END:
+                return "EXTENDED_RESPONSE_RESULT_CODE_END";
+            case EXTENDED_RESPONSE_ERROR_MESSAGE_START:
+                return "EXTENDED_RESPONSE_ERROR_MESSAGE_START";
+            case EXTENDED_RESPONSE_ERROR_MESSAGE_END:
+                return "EXTENDED_RESPONSE_ERROR_MESSAGE_END";
+            case EXTENDED_RESPONSE_REFERRAL_START:
+                return "EXTENDED_RESPONSE_REFERRAL_START";
+            case EXTENDED_RESPONSE_REFERRAL_END:
+                return "EXTENDED_RESPONSE_REFERRAL_END";
+            case RESPONSE_NAME_START:
+                return "RESPONSE_NAME_START";
+            case RESPONSE_NAME_END:
+                return "RESPONSE_NAME_END";
+            case RESPONSE_START:
+                return "RESPONSE_START";
+            case RESPONSE_END:
+                return "RESPONSE_END";
+            case LDAP_RESULT:
+                return "LDAP_RESULT";
+            case LDAP_RESULT_CONTROL_START:
+                return "LDAP_RESULT_CONTROL_START";
+            case LDAP_RESULT_CONTROL_END:
+                return "LDAP_RESULT_CONTROL_END";
+            case LDAP_RESULT_CONTROL_VALUE_START:
+                return "LDAP_RESULT_CONTROL_VALUE_START";
+            case LDAP_RESULT_CONTROL_VALUE_END:
+                return "LDAP_RESULT_CONTROL_VALUE_END";
+            case LDAP_RESULT_RESULT_CODE_START:
+                return "LDAP_RESULT_RESULT_CODE_START";
+            case LDAP_RESULT_RESULT_CODE_END:
+                return "LDAP_RESULT_RESULT_CODE_END";
+            case LDAP_RESULT_ERROR_MESSAGE_START:
+                return "LDAP_RESULT_ERROR_MESSAGE_START";
+            case LDAP_RESULT_ERROR_MESSAGE_END:
+                return "LDAP_RESULT_ERROR_MESSAGE_END";
+            case LDAP_RESULT_REFERRAL_START:
+                return "LDAP_RESULT_REFERRAL_START";
+            case LDAP_RESULT_REFERRAL_END:
+                return "LDAP_RESULT_REFERRAL_END";
+            case LDAP_RESULT_END:
+                return "LDAP_RESULT_END";
+            case SEARCH_RESPONSE:
+                return "SEARCH_RESPONSE";
+            case SEARCH_RESULT_ENTRY:
+                return "SEARCH_RESULT_ENTRY";
+            case SEARCH_RESULT_ENTRY_CONTROL_START:
+                return "SEARCH_RESULT_ENTRY_CONTROL_START";
+            case SEARCH_RESULT_ENTRY_CONTROL_END:
+                return "SEARCH_RESULT_ENTRY_CONTROL_END";
+            case SEARCH_RESULT_ENTRY_CONTROL_VALUE_START:
+                return "SEARCH_RESULT_ENTRY_CONTROL_VALUE_START";
+            case SEARCH_RESULT_ENTRY_CONTROL_VALUE_END:
+                return "SEARCH_RESULT_ENTRY_CONTROL_VALUE_END";
+            case SEARCH_RESULT_ENTRY_ATTR_START:
+                return "SEARCH_RESULT_ENTRY_ATTR_START";
+            case SEARCH_RESULT_ENTRY_ATTR_END:
+                return "SEARCH_RESULT_ENTRY_ATTR_END";
+            case SEARCH_RESULT_ENTRY_VALUE_START:
+                return "SEARCH_RESULT_ENTRY_VALUE_START";
+            case SEARCH_RESULT_ENTRY_VALUE_END:
+                return "SEARCH_RESULT_ENTRY_VALUE_END";
+            case SEARCH_RESULT_ENTRY_LOOP:
+                return "SEARCH_RESULT_ENTRY_LOOP";
+            case SEARCH_RESULT_REFERENCE:
+                return "SEARCH_RESULT_REFERENCE";
+            case SEARCH_RESULT_REFERENCE_CONTROL_START:
+                return "SEARCH_RESULT_REFERENCE_CONTROL_START";
+            case SEARCH_RESULT_REFERENCE_CONTROL_END:
+                return "SEARCH_RESULT_REFERENCE_CONTROL_END";
+            case SEARCH_RESULT_REFERENCE_CONTROL_VALUE_START:
+                return "SEARCH_RESULT_REFERENCE_CONTROL_VALUE_START";
+            case SEARCH_RESULT_REFERENCE_CONTROL_VALUE_END:
+                return "SEARCH_RESULT_REFERENCE_CONTROL_VALUE_END";
+            case SEARCH_RESULT_REFERENCE_REF_START:
+                return "SEARCH_RESULT_REFERENCE_REF_START";
+            case SEARCH_RESULT_REFERENCE_REF_END:
+                return "SEARCH_RESULT_REFERENCE_REF_END";
+            case SEARCH_RESULT_REFERENCE_LOOP:
+                return "SEARCH_RESULT_REFERENCE_LOOP";
+            case SEARCH_RESULT_DONE_END:
+                return "SEARCH_RESULT_DONE_END";
+
+            default:
+                return "UNKNOWN";
+        }
+    }
+}

Propchange: directory/sandbox/felixk/studio-dsml-parser/src/main/java/org/apache/directory/studio/dsmlv2/Dsmlv2StatesEnum.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: directory/sandbox/felixk/studio-dsml-parser/src/main/java/org/apache/directory/studio/dsmlv2/GrammarAction.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-dsml-parser/src/main/java/org/apache/directory/studio/dsmlv2/GrammarAction.java?rev=592023&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-dsml-parser/src/main/java/org/apache/directory/studio/dsmlv2/GrammarAction.java (added)
+++ directory/sandbox/felixk/studio-dsml-parser/src/main/java/org/apache/directory/studio/dsmlv2/GrammarAction.java Mon Nov  5 06:52:22 2007
@@ -0,0 +1,59 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.studio.dsmlv2;
+
+
+/**
+ * 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>
+ * @version $Rev$, $Date$
+ */
+public abstract class GrammarAction implements IAction
+{
+    /** The action's name */
+    protected String name;
+
+
+    /**
+     * Creates a new GrammarAction object.
+     * 
+     * @param name
+     *      the name of the create daction
+     */
+    public GrammarAction( String name )
+    {
+        this.name = name;
+    }
+
+
+    /**
+     * Print the action's name
+     * 
+     * @return 
+     *      the action's name
+     */
+    public String toString()
+    {
+        return name;
+    }
+}
\ No newline at end of file

Propchange: directory/sandbox/felixk/studio-dsml-parser/src/main/java/org/apache/directory/studio/dsmlv2/GrammarAction.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: directory/sandbox/felixk/studio-dsml-parser/src/main/java/org/apache/directory/studio/dsmlv2/GrammarTransition.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-dsml-parser/src/main/java/org/apache/directory/studio/dsmlv2/GrammarTransition.java?rev=592023&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-dsml-parser/src/main/java/org/apache/directory/studio/dsmlv2/GrammarTransition.java (added)
+++ directory/sandbox/felixk/studio-dsml-parser/src/main/java/org/apache/directory/studio/dsmlv2/GrammarTransition.java Mon Nov  5 06:52:22 2007
@@ -0,0 +1,118 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.studio.dsmlv2;
+
+
+/**
+ * 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>
+ * @version $Rev$, $Date$
+ */
+public class GrammarTransition
+{
+    /** The next state in the grammar */
+    private int nextState;
+
+    /** The action associated to the transition */
+    private GrammarAction action;
+
+    /** The current state */
+    private int currentState;
+
+    
+    /**
+     * Creates a new GrammarTransition object.
+     * 
+     * @param currentState
+     *      The current transition
+     * @param nextState
+     *      The target state
+     * @param action
+     *      The action to execute. It could be null.
+     */
+    public GrammarTransition( int currentState, int nextState, GrammarAction action )
+    {
+        this.currentState = currentState;
+        this.nextState = nextState;
+        this.action = action;
+    }
+
+    /**
+     * Gets the target state
+     * 
+     * @return
+     *      the target state.
+     */
+    public int getNextState()
+    {
+        return 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;
+    }
+
+
+    /**
+     * Gets the action associated with the transition
+     * 
+     * @return
+     *      the action associated with the transition
+     */
+    public GrammarAction getAction()
+    {
+        return action;
+    }
+
+
+    /**
+     * Returns a representation of the transition as a string
+     * 
+     * @param grammar
+     *      the grammar which state we want a String from
+     * @param statesEnum
+     *      the states enum that contains the states' names
+     * @return 
+     *      a representation of the transition as a string.
+     */
+    public String toString( int grammar, IStates statesEnum )
+    {
+
+        StringBuffer sb = new StringBuffer();
+
+        sb.append( "Transition from <" ).append( statesEnum.getState( currentState ) ).append( "> to <" ).append(
+            statesEnum.getState( nextState ) ).append( ">, action : " ).append(
+            ( ( action == null ) ? "no action" : action.toString() ) ).append( ">" );
+
+        return sb.toString();
+    }
+}
\ No newline at end of file

Propchange: directory/sandbox/felixk/studio-dsml-parser/src/main/java/org/apache/directory/studio/dsmlv2/GrammarTransition.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: directory/sandbox/felixk/studio-dsml-parser/src/main/java/org/apache/directory/studio/dsmlv2/IAction.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-dsml-parser/src/main/java/org/apache/directory/studio/dsmlv2/IAction.java?rev=592023&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-dsml-parser/src/main/java/org/apache/directory/studio/dsmlv2/IAction.java (added)
+++ directory/sandbox/felixk/studio-dsml-parser/src/main/java/org/apache/directory/studio/dsmlv2/IAction.java Mon Nov  5 06:52:22 2007
@@ -0,0 +1,48 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.studio.dsmlv2;
+
+
+import org.xmlpull.v1.XmlPullParserException;
+
+
+/**
+ * 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>
+ * @version $Rev$, $Date$
+ */
+public interface IAction
+{
+    // ~ Methods
+    // ------------------------------------------------------------------------------------
+
+    /**
+     * The action to be executed.
+     * 
+     * @param container
+     *      the container which stores the current data
+     * @throws XmlPullParserException
+     *      thrown if something went wrong.
+     */
+    public void action( Dsmlv2Container container ) throws XmlPullParserException;
+}
\ No newline at end of file

Propchange: directory/sandbox/felixk/studio-dsml-parser/src/main/java/org/apache/directory/studio/dsmlv2/IAction.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message