jkesselm 01/05/10 08:13:11
Modified: java/src/org/apache/xml/dtm Tag: DTM_EXP
CoroutineParser.java CoroutineSAXParser.java
CoroutineSAXParser_Xerces.java
Log:
Stubs for coroutine API encapsulation; need to be fleshed out.
Revision Changes Path
No revision
No revision
1.1.2.5 +33 -0
xml-xalan/java/src/org/apache/xml/dtm/Attic/CoroutineParser.java
Index: CoroutineParser.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xml/dtm/Attic/CoroutineParser.java,v
retrieving revision 1.1.2.4
retrieving revision 1.1.2.5
diff -u -r1.1.2.4 -r1.1.2.5
--- CoroutineParser.java 2001/04/22 22:08:27 1.1.2.4
+++ CoroutineParser.java 2001/05/10 15:13:00 1.1.2.5
@@ -129,4 +129,37 @@
*/
public void run();
+ //================================================================
+ /** doCommand() is a simple API which tells the coroutine parser
+ * that we need more nodes. This is intended to be called from one
+ * of our partner coroutines, and serves both to encapsulate the
+ * communication protocol and to avoid having to explicitly use the
+ * CoroutineParser's coroutine ID number.
+ *
+ * @param parsemore If true, tells the incremental parser to generate
+ * another chunk of output. If false, tells the parser that we're
+ * satisfied and it can terminate parsing of this document.
+ * @param appCoroutine The coroutine ID number of the coroutine invoking
+ * this method, so it can be resumed after the parser has responded to the
+ * request.
+ * @return True if the CoroutineParser believes more data may be available
+ * for further parsing. False means either parsemore=false or end of
document
+ * caused parsing to stop.
+ * */
+ public boolean doMore(boolean parsemore, int appCoroutine);
+
+ /** doTerminate() is a simple API which tells the coroutine
+ * parser to terminate itself. This is intended to be called from
+ * one of our partner coroutines, and serves both to encapsulate the
+ * communication protocol and to avoid having to explicitly use the
+ * CoroutineParser's coroutine ID number.
+ *
+ * Returns only after the CoroutineParser has acknowledged the request.
+ *
+ * @param appCoroutine The coroutine ID number of the coroutine invoking
+ * this method, so it can be resumed after the parser has responded to the
+ * request.
+ * */
+ public void doTerminate(int appCoroutine);
+
} // class CoroutineParser
1.1.2.5 +54 -10
xml-xalan/java/src/org/apache/xml/dtm/Attic/CoroutineSAXParser.java
Index: CoroutineSAXParser.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xml/dtm/Attic/CoroutineSAXParser.java,v
retrieving revision 1.1.2.4
retrieving revision 1.1.2.5
diff -u -r1.1.2.4 -r1.1.2.5
--- CoroutineSAXParser.java 2001/05/06 02:09:39 1.1.2.4
+++ CoroutineSAXParser.java 2001/05/10 15:13:02 1.1.2.5
@@ -543,9 +543,60 @@
{
}
- UserRequestedStopException stopException=new UserRequestedStopException();
-
- UserRequestedShutdownException shutdownException = new
UserRequestedShutdownException();
+ /** %REVIEW% Should be static, but can't be because internal class */
+ final UserRequestedStopException stopException=new
UserRequestedStopException();
+
+ /** Used so co_yield can return control to run for coroutine thread
+ * termination. */
+ class UserRequestedShutdownException extends RuntimeException
+ {
+ }
+
+ /** %REVIEW% Should be static, but can't be because internal class */
+ final UserRequestedShutdownException shutdownException = new
UserRequestedShutdownException();
+
+ //================================================================
+ /** doMore() is a simple API which tells the coroutine parser
+ * that we need more nodes. This is intended to be called from one
+ * of our partner coroutines, and serves both to encapsulate the
+ * communication protocol and to avoid having to explicitly use the
+ * CoroutineParser's coroutine ID number.
+ *
+ * %TBD% doParse(uri)?
+ *
+ * @param parsemore If true, tells the incremental parser to generate
+ * another chunk of output. If false, tells the parser that we're
+ * satisfied and it can terminate parsing of this document.
+ * @param appCoroutine The coroutine ID number of the coroutine invoking
+ * this method, so it can be resumed after the parser has responded to the
+ * request.
+ * @return True if the CoroutineParser believes more data may be available
+ * for further parsing. False means either parsemore=false or end of
document
+ * caused parsing to stop.
+ * */
+ public boolean doMore(boolean parsemore, int appCoroutine)
+ {
+ return false; //%TBD%
+ }
+
+
+ /** doTerminate() is a simple API which tells the coroutine
+ * parser to terminate itself. This is intended to be called from
+ * one of our partner coroutines, and serves both to encapsulate the
+ * communication protocol and to avoid having to explicitly use the
+ * CoroutineParser's coroutine ID number.
+ *
+ * Returns only after the CoroutineParser has acknowledged the request.
+ *
+ * @param appCoroutine The coroutine ID number of the coroutine invoking
+ * this method, so it can be resumed after the parser has responded to the
+ * request.
+ * */
+ public void doTerminate(int appCoroutine)
+ {
+ //%TBD%
+ }
+
//================================================================
/** Simple unit test. Attempt coroutine parsing of document indicated
@@ -631,12 +682,5 @@
e.printStackTrace();
}
}
-
- /** Used so co_yield can return control to run for coroutine thread
- * termination. */
- class UserRequestedShutdownException extends RuntimeException
- {
- }
-
} // class CoroutineSAXParser
1.1.2.3 +42 -0
xml-xalan/java/src/org/apache/xml/dtm/Attic/CoroutineSAXParser_Xerces.java
Index: CoroutineSAXParser_Xerces.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xml/dtm/Attic/CoroutineSAXParser_Xerces.java,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -u -r1.1.2.2 -r1.1.2.3
--- CoroutineSAXParser_Xerces.java 2001/04/22 22:08:27 1.1.2.2
+++ CoroutineSAXParser_Xerces.java 2001/05/10 15:13:04 1.1.2.3
@@ -225,6 +225,48 @@
//================================================================
+ /** doMore() is a simple API which tells the coroutine parser
+ * that we need more nodes. This is intended to be called from one
+ * of our partner coroutines, and serves both to encapsulate the
+ * communication protocol and to avoid having to explicitly use the
+ * CoroutineParser's coroutine ID number.
+ *
+ * %TBD% doParse(uri)?
+ *
+ * @param parsemore If true, tells the incremental parser to generate
+ * another chunk of output. If false, tells the parser that we're
+ * satisfied and it can terminate parsing of this document.
+ * @param appCoroutine The coroutine ID number of the coroutine invoking
+ * this method, so it can be resumed after the parser has responded to the
+ * request.
+ * @return True if the CoroutineParser believes more data may be available
+ * for further parsing. False means either parsemore=false or end of
document
+ * caused parsing to stop.
+ * */
+ public boolean doMore(boolean parsemore, int appCoroutine)
+ {
+ return false; //%TBD%
+ }
+
+
+ /** doTerminate() is a simple API which tells the coroutine
+ * parser to terminate itself. This is intended to be called from
+ * one of our partner coroutines, and serves both to encapsulate the
+ * communication protocol and to avoid having to explicitly use the
+ * CoroutineParser's coroutine ID number.
+ *
+ * Returns only after the CoroutineParser has acknowledged the request.
+ *
+ * @param appCoroutine The coroutine ID number of the coroutine invoking
+ * this method, so it can be resumed after the parser has responded to the
+ * request.
+ * */
+ public void doTerminate(int appCoroutine)
+ {
+ //%TBD%
+ }
+
+ //================================================================
/** Simple unit test. Attempt coroutine parsing of document indicated
* by first argument (as a URI), report progress.
*/
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]