directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r475805 [2/17] - in /directory/sandbox/pamarcelot/ldapstudio/ldapstudio-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/direct...
Date Thu, 16 Nov 2006 16:38:51 GMT
Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-dsml-parser/build.xml
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-dsml-parser/build.xml?view=auto&rev=475805
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-dsml-parser/build.xml (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-dsml-parser/build.xml Thu Nov 16 08:38:31
2006
@@ -0,0 +1,139 @@
+<!--
+  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.
+-->
+<project name="ldapstudio-dsml-parser" default="jar" xmlns:ivy="antlib:fr.jayasoft.ivy.ant">
+	<property name="project.name" value="ldapstudio-dsml-parser" />
+	<property name="project.version" value="0.1" />
+
+	<property name="project.output" value="${basedir}/target" />
+	<property name="project.build" value="${project.output}/build" />
+	<property name="project.src" value="${basedir}/src/main/java" />
+
+	<property name="lib.dir" value="lib" />
+
+	<property name="repository.dir" location="../dependencies/externals/"/>
+
+	<!-- Configuring Ivy (Needs to be AFTER the $repository.dir declaration) -->
+	<ivy:configure file="../tools/ivyconf.xml"/>
+
+	<!-- ================================== -->
+	<!--               RESOLVE              -->
+	<!-- ================================== -->
+	<target name="resolve" description="--> Retreive dependencies with ivy">
+		<ivy:retrieve/>
+	</target>
+
+	<!-- ================================== -->
+	<!--             CLASSPATH              -->
+	<!-- ================================== -->
+	<target name="build-classpath" description="Computes a classpath according to current
OS" >
+		<path id="classpath">
+			<fileset dir="${lib.dir}" />
+		</path>
+	</target>
+
+	<!-- ================================== -->
+	<!--             COMPILE                -->
+	<!-- ================================== -->
+	<target name="compile" depends="resolve,checkclasses,build-classpath" unless="classes-up2date"
description="Compiles the plugin">
+		<mkdir dir="${project.build}" />
+		<!--<mkdir dir="${project.build}/${lib.dir}" />
+		<copy todir="${project.build}/${lib.dir}">
+			<fileset dir="${basedir}/${lib.dir}">
+				<include name="*.jar" />
+			</fileset>
+		</copy>-->
+		<copy todir="${project.build}">
+			<fileset dir="${basedir}/src/main/resources">
+				<include name="**" />
+			</fileset>
+		</copy>
+		<mkdir dir="${project.build}/META-INF" />
+		<copy todir="${project.build}/META-INF">
+			<fileset dir="${basedir}/META-INF">
+				<include name="**" />
+			</fileset>
+		</copy>
+		<javac
+			source="1.5"
+			debug="yes"
+			srcdir="${project.src}"
+			excludes=""
+			destdir="${project.build}"
+			classpathref="classpath"
+			listfiles="yes" />
+
+		<tstamp>
+			<format pattern="yyyy-MMM-dd, HH:mm 'GMT'Z" property="timestamp" locale="en" />
+		</tstamp>
+		<echo message="${project.name}-${project.version} compiled ${timestamp} by ${user.name}"
file="${project.build}/compile.timestamp" />
+	</target>
+
+	<target name="checkclasses">
+		<uptodate property="classes-up2date" targetfile="${project.build}/compile.timestamp">
+			<srcfiles dir="${project.src}" />
+		</uptodate>
+	</target>
+
+
+	<!-- ================================== -->
+	<!--              JAR                   -->
+	<!-- ================================== -->
+	<target name="jar" description="Creates jar file" depends="compile">
+		<jar destfile="${project.output}/${project.name}_${project.version}.jar" manifest="${project.build}/META-INF/MANIFEST.MF">
+			<fileset dir="${project.build}" excludes="compile.timestamp" />
+		</jar>
+	</target>
+
+	<!-- ================================== -->
+	<!--              JAVADOC               -->
+	<!-- ================================== -->
+	<target name="javadoc" description="Generate javadoc files">
+		<mkdir dir="${basedir}/doc" />
+		<javadoc destdir="${basedir}/doc">
+			<fileset dir="src/main/java" defaultexcludes="yes">
+				<include name="org/apache/directory/ldapstudio/**"/>
+			</fileset>
+		</javadoc>
+	</target>
+	
+	<!-- ================================== -->
+	<!--               CLEAN                -->
+	<!-- ================================== -->
+	<target name="clean" description="Deletes any generated file (javadoc, classes, jars,
distribution)">
+		<delete includeemptydirs="true">
+			<fileset dir="${basedir}">
+				<exclude name=".project" />
+				<exclude name=".classpath" />
+				<exclude name="build.xml" />
+				<exclude name="ivy.xml" />
+				<exclude name="src/**" />
+				<exclude name="META-INF/**" />
+				<exclude name="CompleteBatchRequest.xml" />
+				<exclude name="BatchResponse.xml" />
+				<exclude name="document_dsml_test.xml" />
+				<exclude name="SimpleAddDSML.xml" />
+				<exclude name="SimpleAuthDSML.xml" />
+				<exclude name="SimpleDelDSML.xml" />
+				<exclude name="SimpleErrorResponseGeneratingDSML.xml" />
+				<exclude name="SimpleExtendedDSML.xml" />
+				<exclude name="SimpleSearchDSML.xml" />
+			</fileset>
+		</delete>
+	</target>
+</project>

Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-dsml-parser/ivy.xml
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-dsml-parser/ivy.xml?view=auto&rev=475805
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-dsml-parser/ivy.xml (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-dsml-parser/ivy.xml Thu Nov 16 08:38:31
2006
@@ -0,0 +1,29 @@
+<!--
+  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.
+-->
+<ivy-module version="1.0">
+	<info organisation="org.apache.directory.ldapstudio" module="ldapdstudio-dsml-parser"/>
+	<dependencies>
+		<dependency org="org.slf4j" name="nlog4j" rev="1.2.25"/>
+		<dependency org="org.apache.directory.shared" name="shared-ldap" rev="0.9.6-SNAPSHOT"/>
+		<dependency org="org.apache.directory.shared" name="shared-asn1" rev="0.9.6-SNAPSHOT"/>
+		<dependency org="commons-collections" name="commons-collections" rev="3.1"/>
+		<dependency org="org.dom4j" name="dom4j" rev="1.6.1"/>
+		<dependency org="org.xmlpull" name="xpp3" rev="1.1.3_8"/>
+    </dependencies>
+</ivy-module>
\ No newline at end of file

Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/AbstractGrammar.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/AbstractGrammar.java?view=auto&rev=475805
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/AbstractGrammar.java
(added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/AbstractGrammar.java
Thu Nov 16 08:38:31 2006
@@ -0,0 +1,170 @@
+/*
+ *  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.ldapstudio.dsmlv2;
+
+
+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.
+ */
+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;
+
+    public AbstractGrammar()
+    {
+        
+    }
+
+
+    // ~ Methods
+    // ------------------------------------------------------------------------------------
+
+    /**
+     * Return the grammar's name
+     * 
+     * @return The grammar name
+     */
+    public String getName()
+    {
+        return name;
+    }
+
+
+    /**
+     * Set the grammar's name
+     * 
+     * @param name
+     *            DOCUMENT ME!
+     */
+    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;
+    }
+    
+
+    public void executeAction( Dsmlv2Container container ) throws Exception
+    {        
+        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 );
+    }
+
+    
+    private void processTag( Dsmlv2Container container, int tagType ) throws Exception
+    {        
+        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 );   
+        }
+    }
+}

Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/BatchRequest.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/BatchRequest.java?view=auto&rev=475805
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/BatchRequest.java
(added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/BatchRequest.java
Thu Nov 16 08:38:31 2006
@@ -0,0 +1,121 @@
+/*
+ *  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.ldapstudio.dsmlv2;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.directory.shared.ldap.codec.LdapMessage;
+
+public class BatchRequest
+{
+    private List<LdapMessage> requests;
+    
+    private int requestID;
+    
+    public enum Processing { SEQUENTIAL, PARALLEL };
+    
+    private Processing processing;
+    
+    public enum OnError { RESUME, EXIT };
+    
+    private OnError onError;
+    
+    public enum ResponseOrder { SEQUENTIAL, UNORDERED };
+    
+    private ResponseOrder responseOrder;
+    
+    public BatchRequest()
+    {
+        requests = new ArrayList<LdapMessage>();
+    }
+    
+    public boolean addRequest(LdapMessage request)
+    {
+        return requests.add( request );
+    }
+    
+    public LdapMessage getCurrentRequest()
+    {
+        return requests.get( requests.size() - 1 );
+    }
+
+    public int getRequestID()
+    {
+        return requestID;
+    }
+
+    public void setRequestID( int requestID )
+    {
+        this.requestID = requestID;
+    }
+
+    public Processing getProcessing()
+    {
+        return processing;
+    }
+
+    public void setProcessing( Processing processing )
+    {
+        this.processing = processing;
+    }
+
+    public OnError getOnError()
+    {
+        return onError;
+    }
+
+    public void setOnError( OnError onError )
+    {
+        this.onError = onError;
+    }
+
+    public ResponseOrder getResponseOrder()
+    {
+        return responseOrder;
+    }
+
+    public void setResponseOrder( ResponseOrder responseOrder )
+    {
+        this.responseOrder = responseOrder;
+    }
+    
+	public List getRequests() {
+		return requests;
+	}
+
+    @Override
+    public String toString()
+    {
+        StringBuffer sb = new StringBuffer();
+        
+        sb.append( "[" );
+        sb.append( "processing: " + processing );
+        sb.append( " - " );
+        sb.append( "onError: " + onError );
+        sb.append( " - " );
+        sb.append( "responseOrder: " + responseOrder );
+        sb.append( "]" );
+
+        return sb.toString();
+    }
+
+}

Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/BatchResponse.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/BatchResponse.java?view=auto&rev=475805
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/BatchResponse.java
(added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/BatchResponse.java
Thu Nov 16 08:38:31 2006
@@ -0,0 +1,62 @@
+/*
+ *  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.ldapstudio.dsmlv2;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.directory.shared.ldap.codec.LdapResponse;
+
+public class BatchResponse {
+	
+    private List<LdapResponse> responses;
+    
+    private int requestID;
+    
+    public BatchResponse()
+    {
+    	responses = new ArrayList<LdapResponse>();
+    }
+    
+    public boolean addResponse(LdapResponse response)
+    {
+        return responses.add( response );
+    }
+    
+    public LdapResponse getCurrentResponse()
+    {
+        return responses.get( responses.size() - 1 );
+    }
+    
+    public int getRequestID()
+    {
+        return requestID;
+    }
+
+    public void setRequestID( int requestID )
+    {
+        this.requestID = requestID;
+    }
+
+	public List getResponses() {
+		return responses;
+	}
+}

Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/Container.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/Container.java?view=auto&rev=475805
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/Container.java
(added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/Container.java
Thu Nov 16 08:38:31 2006
@@ -0,0 +1,68 @@
+/*
+ *  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.ldapstudio.dsmlv2;
+
+public interface Container
+{
+    // ~ Methods
+    // ------------------------------------------------------------------------------------
+
+    // State accessors
+    /**
+     * 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();
+
+
+}

Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/Dsmlv2Container.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/Dsmlv2Container.java?view=auto&rev=475805
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/Dsmlv2Container.java
(added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/Dsmlv2Container.java
Thu Nov 16 08:38:31 2006
@@ -0,0 +1,192 @@
+/*
+ *  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.ldapstudio.dsmlv2;
+
+import org.xmlpull.v1.XmlPullParser;
+
+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;
+    
+    private AbstractGrammar grammar;
+    
+    public Dsmlv2Container()
+    {        
+        //grammar = Dsmlv2Grammar.getInstance();
+    }
+    
+    /**
+     * Get the DSML Batch Request
+     * 
+     * @return Returns the Batch Request
+     */
+    public BatchRequest getBatchRequest()
+    {
+        return batchRequest;
+    }
+    
+    /**
+     * Sets the DSML Batch Request
+     * @param batchRequest
+     */
+    public void setBatchRequest( BatchRequest batchRequest )
+    {
+        this.batchRequest = batchRequest;
+    }
+    
+    /**
+     * Get the DSML Batch Response
+     * 
+     * @return Returns the Batch Response
+     */
+    public BatchResponse getBatchResponse()
+    {
+        return batchResponse;
+    }
+    
+    /**
+     * Sets the DSML Batch Request
+     * @param batchRequest
+     */
+    public void setBatchResponse( BatchResponse batchResponse )
+    {
+        this.batchResponse = batchResponse;
+    }
+    
+    
+    /**
+     * Get the parser
+     * 
+     * @return Returns the parser
+     */
+    public XmlPullParser getParser()
+    {
+        return parser;
+    }
+    
+
+    /**
+     * Set the parser
+     * 
+     * @param state
+     *            The parser
+     */
+    public void setParser( XmlPullParser parser)
+    {
+        this.parser = parser;
+    }
+    
+    /**
+     * Get the current grammar state
+     * 
+     * @return Returns 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 Returns 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 Returns the states.
+     */
+    public IStates getStates()
+    {
+        return states;
+    }
+
+    public AbstractGrammar getGrammar()
+    {
+        return grammar;
+    }
+
+    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 );
+    }
+}



Mime
View raw message