You can subscribe to this list here.
| 2002 |
Jan
(11) |
Feb
(32) |
Mar
(18) |
Apr
(17) |
May
(52) |
Jun
(1) |
Jul
|
Aug
(9) |
Sep
|
Oct
|
Nov
|
Dec
|
|---|
|
From: G?nther B. <br...@us...> - 2002-02-28 06:37:36
|
Update of /cvsroot/xpg-xml/edu/iicm/xpg/transitions/simple
In directory usw-pr-cvs1:/tmp/cvs-serv31689
Modified Files:
WriteDocContentTransition.java
WriteGeneralFooterTransition.java
WriteGeneralHeaderTransition.java WriteHeaderTransition.java
Log Message:
DataObject modified
Index: WriteDocContentTransition.java
===================================================================
RCS file: /cvsroot/xpg-xml/edu/iicm/xpg/transitions/simple/WriteDocContentTransition.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** WriteDocContentTransition.java 7 Feb 2002 09:42:18 -0000 1.1
--- WriteDocContentTransition.java 28 Feb 2002 06:37:30 -0000 1.2
***************
*** 30,33 ****
--- 30,34 ----
import edu.iicm.xpg.statemachine.XMLInput;
import edu.iicm.xpg.statemachine.DataObject;
+ import edu.iicm.xpg.statemachine.Const;
import java.util.Vector;
***************
*** 82,86 ****
throws Exception
{
! StringBuffer html_form = data.getResult();
String content = (String)data.getObject("content");
--- 83,87 ----
throws Exception
{
! StringBuffer html_form = (StringBuffer)data.getObject(Const.RESULT_BUFFER);
String content = (String)data.getObject("content");
Index: WriteGeneralFooterTransition.java
===================================================================
RCS file: /cvsroot/xpg-xml/edu/iicm/xpg/transitions/simple/WriteGeneralFooterTransition.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** WriteGeneralFooterTransition.java 7 Feb 2002 09:42:18 -0000 1.1
--- WriteGeneralFooterTransition.java 28 Feb 2002 06:37:30 -0000 1.2
***************
*** 30,33 ****
--- 30,34 ----
import edu.iicm.xpg.statemachine.XMLInput;
import edu.iicm.xpg.statemachine.DataObject;
+ import edu.iicm.xpg.statemachine.Const;
//----------------------------------------------------------------------
***************
*** 55,59 ****
throws Exception
{
! StringBuffer html_form = data.getResult();
html_form.append("\n<p><hr></p><input type=\"submit\" value=\"abschicken\">\n</form>" +
"\n</body>\n</html>");
--- 56,60 ----
throws Exception
{
! StringBuffer html_form = (StringBuffer)data.getObject(Const.RESULT_BUFFER);
html_form.append("\n<p><hr></p><input type=\"submit\" value=\"abschicken\">\n</form>" +
"\n</body>\n</html>");
Index: WriteGeneralHeaderTransition.java
===================================================================
RCS file: /cvsroot/xpg-xml/edu/iicm/xpg/transitions/simple/WriteGeneralHeaderTransition.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** WriteGeneralHeaderTransition.java 7 Feb 2002 09:42:18 -0000 1.1
--- WriteGeneralHeaderTransition.java 28 Feb 2002 06:37:30 -0000 1.2
***************
*** 30,33 ****
--- 30,34 ----
import edu.iicm.xpg.statemachine.XMLInput;
import edu.iicm.xpg.statemachine.DataObject;
+ import edu.iicm.xpg.statemachine.Const;
//----------------------------------------------------------------------
***************
*** 54,59 ****
throws Exception
{
! StringBuffer html_form = data.getResult();
html_form.append("<html>\n<head>\n");
return(null);
}
--- 55,61 ----
throws Exception
{
! StringBuffer html_form = new StringBuffer();
html_form.append("<html>\n<head>\n");
+ data.putObject(Const.RESULT_BUFFER, html_form);
return(null);
}
Index: WriteHeaderTransition.java
===================================================================
RCS file: /cvsroot/xpg-xml/edu/iicm/xpg/transitions/simple/WriteHeaderTransition.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** WriteHeaderTransition.java 7 Feb 2002 09:42:18 -0000 1.1
--- WriteHeaderTransition.java 28 Feb 2002 06:37:30 -0000 1.2
***************
*** 29,32 ****
--- 29,33 ----
import edu.iicm.xpg.statemachine.StateMachine;
import edu.iicm.xpg.statemachine.DataObject;
+ import edu.iicm.xpg.statemachine.Const;
//----------------------------------------------------------------------
***************
*** 55,59 ****
throws Exception
{
! StringBuffer html_form = data.getResult();
String doc_title = (String)data.getObject("doc_title");
String doc_author = (String)data.getObject("doc_author");
--- 56,60 ----
throws Exception
{
! StringBuffer html_form = (StringBuffer)data.getObject(Const.RESULT_BUFFER);
String doc_title = (String)data.getObject("doc_title");
String doc_author = (String)data.getObject("doc_author");
|
|
From: G?nther B. <br...@us...> - 2002-02-24 21:06:13
|
Update of /cvsroot/xpg-xml/edu/iicm/xpg In directory usw-pr-cvs1:/tmp/cvs-serv21298 Modified Files: statemachine.xml test0.xml Log Message: DocumentGenerator, Generator and Parser modified Index: statemachine.xml =================================================================== RCS file: /cvsroot/xpg-xml/edu/iicm/xpg/statemachine.xml,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** statemachine.xml 7 Feb 2002 09:25:01 -0000 1.5 --- statemachine.xml 24 Feb 2002 21:06:09 -0000 1.6 *************** *** 1,4 **** <?xml version="1.0" standalone="no"?> ! <!DOCTYPE statemachine SYSTEM "statemachine.dtd"> <statemachine > --- 1,4 ---- <?xml version="1.0" standalone="no"?> ! <!-- DOCTYPE statemachine SYSTEM "statemachine.dtd" --> <statemachine > Index: test0.xml =================================================================== RCS file: /cvsroot/xpg-xml/edu/iicm/xpg/test0.xml,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** test0.xml 30 Jan 2002 14:04:27 -0000 1.3 --- test0.xml 24 Feb 2002 21:06:09 -0000 1.4 *************** *** 1,4 **** <?xml version="1.0" standalone="no"?> ! <!DOCTYPE document SYSTEM "test0.dtd"> <document> --- 1,4 ---- <?xml version="1.0" standalone="no"?> ! <!-- DOCTYPE document SYSTEM "test0.dtd" --> <document> |
|
From: Stefan T. <th...@us...> - 2002-02-22 13:15:28
|
Update of /cvsroot/xpg-xml/edu/iicm/xpg/transitions
In directory usw-pr-cvs1:/tmp/cvs-serv12543
Modified Files:
StopMachineTransition.java
Log Message:
import InitStatemachine removed
Index: StopMachineTransition.java
===================================================================
RCS file: /cvsroot/xpg-xml/edu/iicm/xpg/transitions/StopMachineTransition.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** StopMachineTransition.java 7 Feb 2002 09:51:58 -0000 1.2
--- StopMachineTransition.java 22 Feb 2002 13:15:26 -0000 1.3
***************
*** 24,28 ****
package edu.iicm.xpg.transitions;
- import edu.iicm.xpg.statemachine.InitStateMachine;
import edu.iicm.xpg.statemachine.Input;
import edu.iicm.xpg.statemachine.State;
--- 24,27 ----
***************
*** 56,60 ****
throws Exception
{
! data.setFinished(true);
machine.stopMachine();
--- 55,59 ----
throws Exception
{
! // data.setFinished(true);
machine.stopMachine();
|
|
From: Stefan T. <th...@us...> - 2002-02-22 13:14:37
|
Update of /cvsroot/xpg-xml/edu/iicm/xpg/statemachine
In directory usw-pr-cvs1:/tmp/cvs-serv11997
Modified Files:
InitInitializeStateMachine.java InitParser.java
Initializer.java Parser.java
Log Message:
function initialize update
Index: InitInitializeStateMachine.java
===================================================================
RCS file: /cvsroot/xpg-xml/edu/iicm/xpg/statemachine/InitInitializeStateMachine.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** InitInitializeStateMachine.java 14 Feb 2002 17:53:48 -0000 1.1
--- InitInitializeStateMachine.java 22 Feb 2002 13:14:34 -0000 1.2
***************
*** 94,110 ****
}
-
- //----------------------------------------------------------------------
- /**
- * @param filename a file
- * @return
- * @deprecated this function uses the wrong param list
- */
-
- public void initialize(String filename)
- {
- System.err.println("void initialize(String filename) is DEPRICATED!");
- }
-
//----------------------------------------------------------------------
/**
--- 94,97 ----
Index: InitParser.java
===================================================================
RCS file: /cvsroot/xpg-xml/edu/iicm/xpg/statemachine/InitParser.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** InitParser.java 14 Feb 2002 17:53:48 -0000 1.1
--- InitParser.java 22 Feb 2002 13:14:34 -0000 1.2
***************
*** 40,43 ****
--- 40,46 ----
protected Initializer initializer_;
+ protected final static String[] DEFAULT_SEARCH_PATH={"edu.iicm.xpg.transitions"};
+
+
//----------------------------------------------------------------------
/**
***************
*** 48,51 ****
--- 51,56 ----
{
super();
+ DFactory transition_factory = new DFactory(DEFAULT_SEARCH_PATH);
+ data_.putObject(TRANSITION_FATORY, transition_factory);
config_file_= config_file;
initializer_ = new InitInitializeStateMachine();
***************
*** 83,102 ****
{
return (PrimitiveStateMachine) data_.getObject(STATE_MACHINE);
- }
-
-
- //----------------------------------------------------------------------
- /**
- * The following state machine is built here:
- *
- * @return
- * @deprecated
- * @exception Exception whatever can happen during initialization
- */
-
- public void initialize(String filename)
- // throws Exception
- {
- System.err.println("void initialize(String filename) is DEPRICATED!");
}
}
--- 88,91 ----
Index: Initializer.java
===================================================================
RCS file: /cvsroot/xpg-xml/edu/iicm/xpg/statemachine/Initializer.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** Initializer.java 14 Feb 2002 17:57:20 -0000 1.2
--- Initializer.java 22 Feb 2002 13:14:34 -0000 1.3
***************
*** 42,55 ****
public void initialize(PrimitiveStateMachine statemachine);
-
- //----------------------------------------------------------------------
- /**
- * @param configfile the configfile
- * @deprecated By the new funktion intialize white the statemachine as
- * parameter
- * @return
- */
- public void initialize(String configfile);
-
//----------------------------------------------------------------------
/**
--- 42,45 ----
Index: Parser.java
===================================================================
RCS file: /cvsroot/xpg-xml/edu/iicm/xpg/statemachine/Parser.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** Parser.java 14 Feb 2002 22:27:15 -0000 1.2
--- Parser.java 22 Feb 2002 13:14:34 -0000 1.3
***************
*** 54,58 ****
protected final static String STATE_MACHINE="doc_state_machine";
protected final static String TRANSITION_FATORY="transition_factory";
- protected final static String[] DEFAULT_SEARCH_PATH={"edu.iicm.xpg.transitions.simple"};
//----------------------------------------------------------------------
--- 54,57 ----
***************
*** 63,68 ****
{
data_ = new DataObject();
- DFactory transition_factory = new DFactory(DEFAULT_SEARCH_PATH);
- data_.putObject(TRANSITION_FATORY, transition_factory);
try
{
--- 62,65 ----
|
|
From: Stefan T. <th...@us...> - 2002-02-22 13:12:48
|
Update of /cvsroot/xpg-xml/edu/iicm/xpg/generator In directory usw-pr-cvs1:/tmp/cvs-serv11615/generator Removed Files: DocumentGenerator.java Generator.java Log Message: this classes are obsolete --- DocumentGenerator.java DELETED --- --- Generator.java DELETED --- |
|
From: Stefan T. <th...@us...> - 2002-02-22 13:12:48
|
Update of /cvsroot/xpg-xml/edu/iicm/xpg/statemachine In directory usw-pr-cvs1:/tmp/cvs-serv11615/statemachine Removed Files: InitStateMachine.java Log Message: this classes are obsolete --- InitStateMachine.java DELETED --- |
|
From: Stefan T. <th...@us...> - 2002-02-22 12:48:57
|
Update of /cvsroot/xpg-xml/edu/iicm/xpg/statemachine
In directory usw-pr-cvs1:/tmp/cvs-serv3328
Modified Files:
DataObject.java XMLHandler.java
Log Message:
new DataObject
Index: DataObject.java
===================================================================
RCS file: /cvsroot/xpg-xml/edu/iicm/xpg/statemachine/DataObject.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** DataObject.java 7 Feb 2002 09:38:12 -0000 1.2
--- DataObject.java 22 Feb 2002 12:48:54 -0000 1.3
***************
*** 27,30 ****
--- 27,33 ----
import java.util.Stack;
+ import java.util.EmptyStackException;
+
+
//----------------------------------------------------------------------
/**
***************
*** 35,73 ****
public class DataObject
{
! protected boolean finished_ = false;
!
! protected Stack element_stack_ = new Stack();
! protected Stack attribute_stack_ = new Stack();
!
! protected StringBuffer result_ = new StringBuffer();
!
! protected HashMap data_map_ = new HashMap();
! //----------------------------------------------------------------------
! /**
! * @param finished
! */
! public void setFinished(boolean finished)
! {
! finished_ = finished;
! }
! //----------------------------------------------------------------------
! /**
! * @return
! */
! public boolean isFinished()
! {
! return finished_;
! }
- //----------------------------------------------------------------------
- /**
- * @return
- */
- public StringBuffer getResult()
- {
- return result_;
- }
//----------------------------------------------------------------------
--- 38,56 ----
public class DataObject
{
! private String element_value_;
! private Stack attribute_stack_;
! private StringBuffer result_;
! private HashMap data_map_;
!
! public DataObject()
! {
! element_value_= null;
! attribute_stack_ = new Stack();
! result_ = new StringBuffer();
! data_map_= new HashMap();
! }
//----------------------------------------------------------------------
***************
*** 75,91 ****
* @param element the element that should be pushed on the stack
*/
! public void pushElement(String element)
! {
! element_stack_.push(element);
! }
!
! //----------------------------------------------------------------------
! /**
! * @return the top element
! */
! public String topElement()
! {
! return (String)element_stack_.peek();
! }
//----------------------------------------------------------------------
--- 58,65 ----
* @param element the element that should be pushed on the stack
*/
! protected void setElementValue(String elementvalue)
! {
! element_value_ = elementvalue;
! }
//----------------------------------------------------------------------
***************
*** 93,100 ****
* @return the top element and removes it
*/
! public String popElement()
! {
! return (String)element_stack_.pop();
! }
//----------------------------------------------------------------------
--- 67,74 ----
* @return the top element and removes it
*/
! public String getElementValue()
! {
! return element_value_;
! }
//----------------------------------------------------------------------
***************
*** 102,109 ****
* @param attributes the attributes that should be pushed on the stack
*/
! public void pushAttributes(Attributes attributes)
! {
! attribute_stack_.push(attributes);
! }
//----------------------------------------------------------------------
--- 76,83 ----
* @param attributes the attributes that should be pushed on the stack
*/
! protected void pushAttributes(Attributes attributes)
! {
! attribute_stack_.push(attributes);
! }
//----------------------------------------------------------------------
***************
*** 111,118 ****
* @return the top attributes
*/
! public Attributes topAttributes()
{
! return (Attributes)attribute_stack_.peek();
}
//----------------------------------------------------------------------
--- 85,101 ----
* @return the top attributes
*/
! public Attributes topAttributes()
! {
! try
{
! return (Attributes)attribute_stack_.peek();
! }
! catch (EmptyStackException exc)
! {
! System.err.println(exc);
! exc.printStackTrace();
}
+ return null;
+ }
//----------------------------------------------------------------------
***************
*** 120,127 ****
* @return the top attributes and removes it
*/
! public Attributes popAttributes()
{
! return (Attributes)attribute_stack_.pop();
}
//----------------------------------------------------------------------
--- 103,119 ----
* @return the top attributes and removes it
*/
! protected Attributes popAttributes()
! {
! try
! {
! return (Attributes)attribute_stack_.pop();
! }
! catch (EmptyStackException exc)
{
! System.err.println(exc);
! exc.printStackTrace();
}
+ return null;
+ }
//----------------------------------------------------------------------
***************
*** 130,142 ****
* @param value the dataobject that should be stored
*/
! public void putObject(String key, Object value)
{
! if ( data_map_.containsKey(key) )
! {
! System.err.println("\"" + key + "\" allready exists inDataObject");
! return;
! }
! data_map_.put(key, value);
}
//----------------------------------------------------------------------
--- 122,134 ----
* @param value the dataobject that should be stored
*/
! public void putObject(String key, Object value)
! {
! if ( data_map_.containsKey(key) )
{
! System.err.println("\"" + key + "\" allready exists inDataObject");
! return;
}
+ data_map_.put(key, value);
+ }
//----------------------------------------------------------------------
***************
*** 145,152 ****
* @return the dataobject
*/
! public Object getObject(String key)
! {
! return data_map_.get(key);
! }
//----------------------------------------------------------------------
--- 137,144 ----
* @return the dataobject
*/
! public Object getObject(String key)
! {
! return data_map_.get(key);
! }
//----------------------------------------------------------------------
***************
*** 155,164 ****
* @return the dataobject
*/
! public Object takeObject(String key)
! {
! return data_map_.remove(key);
! }
!
}
--- 147,174 ----
* @return the dataobject
*/
! public Object takeObject(String key)
! {
! return data_map_.remove(key);
! }
!
! public StringBuffer getResult()
! {
! return result_;
! }
!
}
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: XMLHandler.java
===================================================================
RCS file: /cvsroot/xpg-xml/edu/iicm/xpg/statemachine/XMLHandler.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** XMLHandler.java 14 Feb 2002 17:53:48 -0000 1.1
--- XMLHandler.java 22 Feb 2002 12:48:54 -0000 1.2
***************
*** 104,112 ****
try
{
! // FIXXME (Stefan Thalauer, Feb11 2002 17:32) -> why pop element and than push the characters on the element_stack ???
! // data_.popElement();
! // data_.pushElement(new String(chars));
! // END FIXXME (Stefan Thalauer, Feb11 2002 17:35)
!
state_machine_.input(new XMLInput(Const.XML_CHARS,chars,start,length));
}
--- 104,108 ----
try
{
! data_.setElementValue(new String(chars));
state_machine_.input(new XMLInput(Const.XML_CHARS,chars,start,length));
}
***************
*** 132,136 ****
try
{
- data_.pushElement(name);
data_.pushAttributes(attributes);
state_machine_.input(new XMLInput(Const.XML_START_TAG,name));
--- 128,131 ----
***************
*** 156,161 ****
{
state_machine_.input(new XMLInput(Const.XML_END_TAG,name));
! data_.popAttributes();
! data_.popElement();
}
catch(Exception exc)
--- 151,156 ----
{
state_machine_.input(new XMLInput(Const.XML_END_TAG,name));
! data_.setElementValue(null);
! data_.popAttributes();
}
catch(Exception exc)
***************
*** 223,237 ****
System.err.println(" " + exc.getMessage());
exc.printStackTrace();
- }
-
-
- //----------------------------------------------------------------------
- /**
- * @return the object that has been generated
- */
-
- public synchronized Object getResult()
- {
- return(data_.getResult().toString());
}
}
--- 218,221 ----
|
|
From: Stefan T. <th...@us...> - 2002-02-22 11:59:27
|
Update of /cvsroot/xpg-xml/edu/iicm/xpg/statemachine In directory usw-pr-cvs1:/tmp/cvs-serv21728 Removed Files: InitUserData.java Log Message: this class is now obsolete --- InitUserData.java DELETED --- |
|
From: Stefan T. <th...@us...> - 2002-02-14 22:29:06
|
Update of /cvsroot/xpg-xml/org/dinopolis/util
In directory usw-pr-cvs1:/tmp/cvs-serv16716
Modified Files:
DFactory.java
Log Message:
two new methodes:
boolean existsSearchPath(String path)
void appendSearchPath(String path)
Index: DFactory.java
===================================================================
RCS file: /cvsroot/xpg-xml/org/dinopolis/util/DFactory.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** DFactory.java 7 Feb 2002 14:02:51 -0000 1.2
--- DFactory.java 14 Feb 2002 22:29:02 -0000 1.3
***************
*** 40,43 ****
--- 40,44 ----
*
* @author Peter Grundner
+ * @author Stefan Thalauer
* @version $Revision$
*/
***************
*** 215,218 ****
--- 216,286 ----
cache_.clear();
}
+
+ // FIXXME (Stefan Thalauer, Feb14 2002 22:30) -> two new methodes:
+ // boolean existsSearchPath(String path)
+ // void appendSearchPath(String path)
+
+ //----------------------------------------------------------------------
+ /**
+ * This method checks if a path is in the current Search path
+ *
+ * @param path
+ * @return returns true if the new path allready exists in the search
+ * path
+ * @exception IllegalStateException thrown if no path has been
+ * set before
+ */
+ public boolean existSearchPath(String path)
+ throws IllegalStateException
+ {
+ if (path_==null)
+ {
+ throw new IllegalStateException();
+ }
+ for(int count=0; count < path_.length ; count++)
+ {
+ if ( path_[count].equals(path) )
+ return true;
+ }
+ return false;
+ }
+
+
+ //----------------------------------------------------------------------
+ /**
+ * This method appends a path to the current path.
+ *
+ * @exception IllegalStateException thrown if no path has been
+ * set before
+ */
+
+ public void appendSearchPath(String path)
+ throws IllegalStateException
+ {
+ if (path == null)
+ throw(new IllegalArgumentException("new path must not be <null>"));
+ if (existSearchPath(path))
+ System.err.println("Path: \"" + path +"\" allready registered in search path");
+ else
+ {
+ String[] new_path = new String [path_.length + 1];
+ for (int count = 0; count< path_.length;count++)
+ {
+ new_path[count]=path_[count];
+ }
+ new_path[path_.length] = path;
+ path_ = new_path;
+ }
+ }
+
+ // END FIXXME (Stefan Thalauer, Feb14 2002 22:32)
}
+
+
+
+
+
+
+
+
|
|
From: Stefan T. <th...@us...> - 2002-02-14 22:27:19
|
Update of /cvsroot/xpg-xml/edu/iicm/xpg/statemachine
In directory usw-pr-cvs1:/tmp/cvs-serv16170/statemachine
Modified Files:
Parser.java InitStateMachine.java
Log Message:
new default search path and function appendSearchPath
Index: Parser.java
===================================================================
RCS file: /cvsroot/xpg-xml/edu/iicm/xpg/statemachine/Parser.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** Parser.java 14 Feb 2002 17:53:48 -0000 1.1
--- Parser.java 14 Feb 2002 22:27:15 -0000 1.2
***************
*** 54,58 ****
protected final static String STATE_MACHINE="doc_state_machine";
protected final static String TRANSITION_FATORY="transition_factory";
!
//----------------------------------------------------------------------
--- 54,58 ----
protected final static String STATE_MACHINE="doc_state_machine";
protected final static String TRANSITION_FATORY="transition_factory";
! protected final static String[] DEFAULT_SEARCH_PATH={"edu.iicm.xpg.transitions.simple"};
//----------------------------------------------------------------------
***************
*** 63,67 ****
{
data_ = new DataObject();
! DFactory transition_factory = new DFactory();
data_.putObject(TRANSITION_FATORY, transition_factory);
try
--- 63,67 ----
{
data_ = new DataObject();
! DFactory transition_factory = new DFactory(DEFAULT_SEARCH_PATH);
data_.putObject(TRANSITION_FATORY, transition_factory);
try
Index: InitStateMachine.java
===================================================================
RCS file: /cvsroot/xpg-xml/edu/iicm/xpg/statemachine/InitStateMachine.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** InitStateMachine.java 14 Feb 2002 17:57:20 -0000 1.5
--- InitStateMachine.java 14 Feb 2002 22:27:15 -0000 1.6
***************
*** 68,71 ****
--- 68,72 ----
protected final static String XML_READER = "org.apache.xerces.parsers.SAXParser";
protected final static String PARSE_VALIDATING ="http://xml.org/sax/features/validation";
+ protected final static String[] DEFAULT_SEARCH_PATH={"edu.iicm.xpg.transitions.simple"};
protected PrimitiveStateMachine dtd_state_machine_;
protected PrimitiveStateMachine doc_state_machine_;
***************
*** 112,116 ****
data_.putObject("doc_state_machine", doc_state_machine_);
! DFactory transition_factory = new DFactory();
data_.putObject("transition_factory", transition_factory);
--- 113,117 ----
data_.putObject("doc_state_machine", doc_state_machine_);
! DFactory transition_factory = new DFactory(DEFAULT_SEARCH_PATH);
data_.putObject("transition_factory", transition_factory);
|
|
From: Stefan T. <th...@us...> - 2002-02-14 22:27:19
|
Update of /cvsroot/xpg-xml/edu/iicm/xpg/transitions
In directory usw-pr-cvs1:/tmp/cvs-serv16170/transitions
Modified Files:
SetSearchPathTransition.java
Log Message:
new default search path and function appendSearchPath
Index: SetSearchPathTransition.java
===================================================================
RCS file: /cvsroot/xpg-xml/edu/iicm/xpg/transitions/SetSearchPathTransition.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** SetSearchPathTransition.java 7 Feb 2002 09:51:58 -0000 1.2
--- SetSearchPathTransition.java 14 Feb 2002 22:27:15 -0000 1.3
***************
*** 35,38 ****
--- 35,39 ----
/**
* @author Günther Brand
+ * @author Stefan Thalauer
* @version $Revision$
*/
***************
*** 55,69 ****
public String transitionTriggered(Input input,State from_state,State to_state,
StateMachine machine,DataObject data)
! throws Exception
{
! String path = ((XMLInput)input).getValue();
!
! DFactory transition_factory =
! (DFactory)data.getObject("transition_factory");
! transition_factory.setSearchPath(new String[]{ "edu.iicm.xpg.transitions",
! path });
! return(null);
}
--- 56,73 ----
public String transitionTriggered(Input input,State from_state,State to_state,
StateMachine machine,DataObject data)
! throws Exception
{
! String path = ((XMLInput)input).getValue();
!
! DFactory transition_factory =
! (DFactory)data.getObject("transition_factory");
! // FIXXME (Stefan Thalauer, Feb14 2002 22:37) -> new append path
! transition_factory.appendSearchPath(path);
! // transition_factory.setSearchPath(new String[]{ "edu.iicm.xpg.transitions.simple",
! // path });
! // END FIXXME (Stefan Thalauer, Feb14 2002 22:38)
! return(null);
}
|
|
From: Stefan T. <th...@us...> - 2002-02-14 18:12:07
|
Update of /cvsroot/xpg-xml/edu/iicm/xpg/generator
In directory usw-pr-cvs1:/tmp/cvs-serv7069
Modified Files:
Generator.java
Log Message:
new funktion: public void initialize(PrimitiveStateMachine statemachine)
Index: Generator.java
===================================================================
RCS file: /cvsroot/xpg-xml/edu/iicm/xpg/generator/Generator.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** Generator.java 7 Feb 2002 09:29:07 -0000 1.4
--- Generator.java 14 Feb 2002 18:12:02 -0000 1.5
***************
*** 42,45 ****
--- 42,51 ----
//----------------------------------------------------------------------
/**
+ * @deprecated This class is replaced by the classes
+ * of the package edu.iicm.xpg.statemachine:
+ * - XMLHandler
+ * - Parser
+ *
+ *
* @author Klaus Schmaranz
* @author Heimo Haub
***************
*** 87,91 ****
}
FileReader file_reader = new FileReader(input_file);
! // System.out.println("\n ---> start parsing document!\n");
reader.parse(new InputSource(file_reader));
}
--- 93,97 ----
}
FileReader file_reader = new FileReader(input_file);
! System.out.println("\n ---> start parsing document!\n");
reader.parse(new InputSource(file_reader));
}
|
|
From: Stefan T. <th...@us...> - 2002-02-14 18:10:35
|
Update of /cvsroot/xpg-xml/edu/iicm/xpg/generator
In directory usw-pr-cvs1:/tmp/cvs-serv6716
Added Files:
TestGenerator.java
Log Message:
new test file
--- NEW FILE: TestGenerator.java ---
/***********************************************************************
* @(#)$RCSfile: TestGenerator.java,v $ $Revision: 1.1 $ $Date: 2002/02/14 18:10:29 $
*
* Copyright (c) 2002 stefan thalauer
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License (LGPL)
* as published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
***********************************************************************/
package edu.iicm.xpg.generator;
import edu.iicm.xpg.statemachine.PrimitiveStateMachine;
import edu.iicm.xpg.statemachine.Initializer;
import edu.iicm.xpg.statemachine.InitParser;
import edu.iicm.xpg.statemachine.Parser;
import edu.iicm.xpg.statemachine.DataObject;
import java.io.FileWriter;
import java.io.File;
import java.io.IOException;
//----------------------------------------------------------------------
/**
* @author Stefan Thalauer
* @version $Revision: 1.1 $
*/
public class TestGenerator
{
public static void main(String[] args)
{
if (args.length <= 1)
{
System.err.println("usage: DocumentGenerator <config_file> "
+ "<xml_filename> <result_file>");
System.exit(-1);
}
PrimitiveStateMachine state_machine = new PrimitiveStateMachine();
// DataObject data = new DataObject();
Initializer initializer = new InitParser(args[0]);
System.out.println("Setting up State Machine");
initializer.initialize(state_machine);
state_machine=initializer.getStateMachine();
// state_machine.setUserDefinedDataObject(data);
System.out.println("Begin Parsing");
Parser generator = new Parser(state_machine);
generator.setFeatures();
generator.setHandlers();
generator.parseFile(args[1]);
System.out.println("Finished Parsing");
String result = ( String ) generator.getResult();
try
{
String result_filename;
if ( args.length > 2 )
result_filename = args[2];
else
{
int dot_index = args[1].lastIndexOf('.');
if (dot_index != -1)
result_filename = args[1].substring(0, dot_index) + ".html";
else result_filename = args[1] + ".html";
}
File result_file = new File ( result_filename );
if ( result_file.exists() )
result_file.delete();
result_file.createNewFile();
FileWriter file_writer = new FileWriter ( result_file );
file_writer.write ( result, 0, result.length() );
file_writer.flush();
file_writer.close();
}
catch ( IOException exc )
{
System.err.println ( exc );
}
System.exit(0);
}
}
|
|
From: Stefan T. <th...@us...> - 2002-02-14 17:57:23
|
Update of /cvsroot/xpg-xml/edu/iicm/xpg/statemachine
In directory usw-pr-cvs1:/tmp/cvs-serv2802
Modified Files:
Initializer.java InitStateMachine.java
Log Message:
new function: public void initialize(PrimitiveStateMachine statemachine)
Index: Initializer.java
===================================================================
RCS file: /cvsroot/xpg-xml/edu/iicm/xpg/statemachine/Initializer.java,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** Initializer.java 29 Jan 2002 10:43:13 -0000 1.1.1.1
--- Initializer.java 14 Feb 2002 17:57:20 -0000 1.2
***************
*** 1,34 ****
! //----------------------------------------------------------------------
! /**
! * @author Stefan Thalauer
! * @version $Revision$
! */
!
! package edu.iicm.xpg.statemachine;
!
! public interface Initializer
! {
! //----------------------------------------------------------------------
! /**
! * @param configfile the configfile
! * @return
! */
! public void initialize(String configfile);
!
! //----------------------------------------------------------------------
! /**
! * @return the initialized Statemachine
! */
! public PrimitiveStateMachine getStateMachine();
!
! }
!
!
!
!
!
!
!
!
!
!
--- 1,72 ----
! /***********************************************************************
! * @(#)$RCSfile$ $Revision$ $Date$
! *
! * Copyright (c) 2002 stefan thalauer
! *
! * This program is free software; you can redistribute it and/or modify
! * it under the terms of the GNU Lesser General Public License (LGPL)
! * as published by the Free Software Foundation; either version 2.1 of
! * the License, or (at your option) any later version.
! *
! * This program is distributed in the hope that it will be useful,
! * but WITHOUT ANY WARRANTY; without even the implied warranty of
! * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! * GNU Lesser General Public License for more details.
! *
! * You should have received a copy of the GNU Lesser General Public
! * License along with this program; if not, write to the
! * Free Software Foundation, Inc.,
! * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
! ***********************************************************************/
!
! package edu.iicm.xpg.statemachine;
!
! //----------------------------------------------------------------------
! /**
! * Interface for initializing of a statemachine
! *
! * @author Stefan Thalauer
! * @version $Revision$
! */
!
! public interface Initializer
! {
!
!
! //----------------------------------------------------------------------
! /**
! * @param statemachine the statemachine
! * @return
! */
!
! public void initialize(PrimitiveStateMachine statemachine);
!
!
! //----------------------------------------------------------------------
! /**
! * @param configfile the configfile
! * @deprecated By the new funktion intialize white the statemachine as
! * parameter
! * @return
! */
! public void initialize(String configfile);
!
! //----------------------------------------------------------------------
! /**
! * @return the initialized Statemachine
! */
! public PrimitiveStateMachine getStateMachine();
!
! }
!
!
!
!
!
!
!
!
!
!
!
!
Index: InitStateMachine.java
===================================================================
RCS file: /cvsroot/xpg-xml/edu/iicm/xpg/statemachine/InitStateMachine.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** InitStateMachine.java 7 Feb 2002 09:38:12 -0000 1.4
--- InitStateMachine.java 14 Feb 2002 17:57:20 -0000 1.5
***************
*** 50,53 ****
--- 50,59 ----
//----------------------------------------------------------------------
/**
+ * @deprecated This class is replaced by the classes
+ * of the package edu.iicm.xpg.statemachine:
+ * - XMLHandler
+ * - Parser
+ * - InitInitializeStateMachine
+ *
* @author Stefan Thalauer
* @author Günther Brand
***************
*** 276,279 ****
--- 282,295 ----
exc.printStackTrace();
}
+
+ //----------------------------------------------------------------------
+ /**
+ * @return the initialized Statemachine
+ */
+ public void initialize(PrimitiveStateMachine statemachine)
+ {
+ System.err.println("NOT implemented jet");
+ }
+
//----------------------------------------------------------------------
|
|
From: Stefan T. <th...@us...> - 2002-02-14 17:53:58
|
Update of /cvsroot/xpg-xml/edu/iicm/xpg/statemachine
In directory usw-pr-cvs1:/tmp/cvs-serv2060
Added Files:
XMLHandler.java InitInitializeStateMachine.java Parser.java
InitParser.java
Log Message:
new files for parsing
--- NEW FILE: XMLHandler.java ---
/***********************************************************************
* @(#)$RCSfile: XMLHandler.java,v $ $Revision: 1.1 $ $Date: 2002/02/14 17:53:48 $
*
* Copyright (c) 2002 stefan thalauer
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License (LGPL)
* as published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
***********************************************************************/
package edu.iicm.xpg.statemachine;
import org.xml.sax.Attributes;
import org.xml.sax.SAXParseException;
import org.xml.sax.helpers.DefaultHandler;
import org.dinopolis.util.DFactory;
//----------------------------------------------------------------------
/**
* <p>
* This class extends the DefaultHandler of the SAX2.0 API.
* It sends the XMLInputs to the statemachine.
* This class replaces the callback functionality of
* the depricated classes:
* - InitStatemachine
* - Generator (Package: .xpg.generator)
*
* @author Stefan Thalauer
* @version $revision$
*/
public class XMLHandler extends DefaultHandler
{
protected PrimitiveStateMachine state_machine_;
protected DataObject data_;
//----------------------------------------------------------------------
/**
* @param configfile the filename of the configfile
* @param filename the filename of the inputfile
*/
public XMLHandler(PrimitiveStateMachine state_machine,DataObject data)
{
super();
state_machine_=state_machine;
data_=data;
}
//----------------------------------------------------------------------
/**
* @return
*/
public void startDocument()
{
state_machine_.initializeMachine();
}
//----------------------------------------------------------------------
/**
* @return
*/
public void endDocument()
{
try
{
state_machine_.input(new XMLInput(Const.XML_END_DOCUMENT,null));
}
catch(Exception exc)
{
exc.printStackTrace();
}
}
//----------------------------------------------------------------------
/**
* @param chars the character array
* @param start start index of the char array to work with
* @param length number of chars in the char array to work with
* @return
*/
public void characters(char[] chars,int start,int length)
{
try
{
// FIXXME (Stefan Thalauer, Feb11 2002 17:32) -> why pop element and than push the characters on the element_stack ???
// data_.popElement();
// data_.pushElement(new String(chars));
// END FIXXME (Stefan Thalauer, Feb11 2002 17:35)
state_machine_.input(new XMLInput(Const.XML_CHARS,chars,start,length));
}
catch(Exception exc)
{
exc.printStackTrace();
System.exit(1);
}
}
//----------------------------------------------------------------------
/**
* @param uri element uri
* @param name element name
* @param qname ???
* @param attributes element attributes
* @return
*/
public void startElement(String uri,String name,String qname,Attributes attributes)
{
try
{
data_.pushElement(name);
data_.pushAttributes(attributes);
state_machine_.input(new XMLInput(Const.XML_START_TAG,name));
}
catch(Exception exc)
{
exc.printStackTrace();
}
}
//----------------------------------------------------------------------
/**
* @param uri element uri
* @param name element name
* @param qname ???
* @return
*/
public void endElement(String uri,String name,String qname)
{
try
{
state_machine_.input(new XMLInput(Const.XML_END_TAG,name));
data_.popAttributes();
data_.popElement();
}
catch(Exception exc)
{
exc.printStackTrace();
}
}
//----------------------------------------------------------------------
/**
* @param ch The whitespace characters.
* @param start The start position in the character array.
* @param length The number of characters tcharacter array.
*/
public void ignorableWhitespace(char[] ch,int start,int length)
{
}
//----------------------------------------------------------------------
/**
* @param exc the error that occured
* @return
*/
public void error(SAXParseException exc)
{
System.err.println("SAX Error: "
+ ", line " + exc.getLineNumber()
+ "\n, uri " + exc.getSystemId());
System.err.println(" " + exc.getMessage());
}
//----------------------------------------------------------------------
/**
* @param exc the error that occured
* @return
*/
public void fatalError(SAXParseException exc)
{
System.err.println("SAX Fatal Error: "
+ ", line " + exc.getLineNumber()
+ "\n, uri " + exc.getSystemId());
System.err.println(" " + exc.getMessage());
exc.printStackTrace();
System.exit(-2);
}
//----------------------------------------------------------------------
/**
* @param exc the warning that occured
* @return
*/
public void warning(SAXParseException exc)
{
System.err.println("SAX Warning: "
+ ", line " + exc.getLineNumber()
+ "\n, uri " + exc.getSystemId());
System.err.println(" " + exc.getMessage());
exc.printStackTrace();
}
//----------------------------------------------------------------------
/**
* @return the object that has been generated
*/
public synchronized Object getResult()
{
return(data_.getResult().toString());
}
}
--- NEW FILE: InitInitializeStateMachine.java ---
/***********************************************************************
* @(#)$RCSfile: InitInitializeStateMachine.java,v $ $Revision: 1.1 $ $Date: 2002/02/14 17:53:48 $
*
* Copyright (c) 2002 stefan thalauer
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License (LGPL)
* as published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
***********************************************************************/
package edu.iicm.xpg.statemachine;
import edu.iicm.xpg.transitions.PrimitiveTransition;
import edu.iicm.xpg.transitions.StopMachineTransition;
import edu.iicm.xpg.transitions.IgnoreCharsTransition;
import edu.iicm.xpg.transitions.RegisterStartStateTransition;
import edu.iicm.xpg.transitions.RegisterStateTransition;
import edu.iicm.xpg.transitions.StoreDataTransition;
import edu.iicm.xpg.transitions.RegisterTransitionTransition;
import edu.iicm.xpg.transitions.SetSearchPathTransition;
//----------------------------------------------------------------------
/**
* This class implements the Initializer Interface.
* It register the States and Transitions for the
* Statemachine which is used to initialize the
* Document Statemachine.
* The States and Transisitions are hardcoded in this class.
* The Initialized Statemachine is able to process a
* statemachine config file and initialize the
* Document Statemachine.
*
* @author Stefan Thalauer
* @version $Revision: 1.1 $
*/
public class InitInitializeStateMachine implements Initializer
{
protected PrimitiveStateMachine state_machine_;
// elements
public final static String XML_STM_CONFIG = "statemachine";
public final static String XML_PATH_DEF = "path";
public final static String XML_STATE_LIST = "states";
public final static String XML_START_STATE_DEF = "startstate";
public final static String XML_STATE_DEF = "state";
public final static String XML_TRANSITION_LIST = "transitions";
public final static String XML_TRANSITION_DEF = "transition";
public final static String XML_BEGINSTATE = "beginstate";
public final static String XML_NEXTSTATE = "nextstate";
public final static String XML_ELEMENT = "element";
public final static String XML_CLASSNAME = "classname";
// machine states
public final static String STATE_TOP_LEVEL_FILE = "file top";
public final static String STATE_TOP_LEVEL_DOC_TYPE = "doctype top";
public final static String STATE_PATH_DEF = "path def";
public final static String STATE_STATE_LIST = "state list";
public final static String STATE_START_STATE_DEF = "start state def";
public final static String STATE_STATE_DEF = "state def";
public final static String STATE_TRANSITION_LIST = "transition list";
public final static String STATE_TRANSITION_DEF = "transition def";
public final static String STATE_BEGINSTATE = "beginstate";
public final static String STATE_NEXTSTATE = "nextstate";
public final static String STATE_ELEMENT = "element";
public final static String STATE_CLASSNAME = "classname";
public final static String STATE_FINISHED = "finished";
public InitInitializeStateMachine()
{
state_machine_=null;
}
//----------------------------------------------------------------------
/**
* @return the initialized Statemachine
*/
public PrimitiveStateMachine getStateMachine()
{
return state_machine_;
}
//----------------------------------------------------------------------
/**
* @param filename a file
* @return
* @deprecated this function uses the wrong param list
*/
public void initialize(String filename)
{
System.err.println("void initialize(String filename) is DEPRICATED!");
}
//----------------------------------------------------------------------
/**
* The following state machine is built here: Init a Statemachine
*
* @param state_machine the statemachine
* @return
*/
public void initialize(PrimitiveStateMachine state_machine)
{
state_machine_ = state_machine;
// state_machine_.setUserDefinedDataObject(data_);
state_machine_.registerState(new PrimitiveState(),STATE_TOP_LEVEL_FILE);
state_machine_.registerState(new PrimitiveState(),STATE_TOP_LEVEL_DOC_TYPE);
state_machine_.registerState(new PrimitiveState(),STATE_PATH_DEF);
state_machine_.registerState(new PrimitiveState(),STATE_STATE_LIST);
state_machine_.registerState(new PrimitiveState(),STATE_START_STATE_DEF);
state_machine_.registerState(new PrimitiveState(),STATE_STATE_DEF);
state_machine_.registerState(new PrimitiveState(),STATE_TRANSITION_LIST);
state_machine_.registerState(new PrimitiveState(),STATE_TRANSITION_DEF);
state_machine_.registerState(new PrimitiveState(),STATE_BEGINSTATE);
state_machine_.registerState(new PrimitiveState(),STATE_NEXTSTATE);
state_machine_.registerState(new PrimitiveState(),STATE_ELEMENT);
state_machine_.registerState(new PrimitiveState(),STATE_CLASSNAME);
state_machine_.registerState(new PrimitiveState(),STATE_FINISHED);
state_machine_.setStartState(STATE_TOP_LEVEL_FILE);
try
{
// STATE_TOP_LEVEL_FILE
state_machine_.registerTransition(new XMLInput(Const.XML_START_TAG,XML_STM_CONFIG),
new PrimitiveTransition(),
STATE_TOP_LEVEL_FILE,
STATE_TOP_LEVEL_DOC_TYPE);
state_machine_.registerTransition(new XMLInput(Const.XML_END_DOCUMENT,null),
new StopMachineTransition(),
STATE_TOP_LEVEL_FILE,
STATE_FINISHED);
state_machine_.registerDefaultTransition(new IgnoreCharsTransition(),
STATE_TOP_LEVEL_FILE,
STATE_TOP_LEVEL_FILE);
// STATE_TOP_LEVEL_DOC_TYPE
state_machine_.registerTransition(new XMLInput(Const.XML_END_TAG,XML_STM_CONFIG),
new PrimitiveTransition(),
STATE_TOP_LEVEL_DOC_TYPE,
STATE_TOP_LEVEL_FILE);
state_machine_.registerTransition(new XMLInput(Const.XML_START_TAG,XML_PATH_DEF),
new PrimitiveTransition(),
STATE_TOP_LEVEL_DOC_TYPE,
STATE_PATH_DEF);
state_machine_.registerTransition(new XMLInput(Const.XML_START_TAG,XML_STATE_LIST),
new PrimitiveTransition(),
STATE_TOP_LEVEL_DOC_TYPE,
STATE_STATE_LIST);
state_machine_.registerTransition(new XMLInput(Const.XML_START_TAG,XML_TRANSITION_LIST),
new PrimitiveTransition(),
STATE_TOP_LEVEL_DOC_TYPE,
STATE_TRANSITION_LIST);
state_machine_.registerDefaultTransition(new IgnoreCharsTransition(),
STATE_TOP_LEVEL_DOC_TYPE,
STATE_TOP_LEVEL_DOC_TYPE);
// STATE_PATH_DEF
state_machine_.registerTransition(new XMLInput(Const.XML_END_TAG,XML_PATH_DEF),
new PrimitiveTransition(),
STATE_PATH_DEF,
STATE_TOP_LEVEL_DOC_TYPE);
state_machine_.registerDefaultTransition(new SetSearchPathTransition(),
STATE_PATH_DEF,
STATE_PATH_DEF);
// STATE_STATE_LIST
state_machine_.registerTransition(new XMLInput(Const.XML_END_TAG,XML_STATE_LIST),
new PrimitiveTransition(),
STATE_STATE_LIST,
STATE_TOP_LEVEL_DOC_TYPE);
state_machine_.registerTransition(new XMLInput(Const.XML_START_TAG,XML_START_STATE_DEF),
new PrimitiveTransition(),
STATE_STATE_LIST,
STATE_START_STATE_DEF);
state_machine_.registerTransition(new XMLInput(Const.XML_START_TAG,XML_STATE_DEF),
new PrimitiveTransition(),
STATE_STATE_LIST,
STATE_STATE_DEF);
state_machine_.registerDefaultTransition(new IgnoreCharsTransition(),
STATE_STATE_LIST,
STATE_STATE_LIST);
// STATE_START_STATE_DEF
state_machine_.registerTransition(new XMLInput(Const.XML_END_TAG,XML_START_STATE_DEF),
new PrimitiveTransition(),
STATE_START_STATE_DEF,
STATE_STATE_LIST);
state_machine_.registerDefaultTransition(new RegisterStartStateTransition(),
STATE_START_STATE_DEF,
STATE_START_STATE_DEF);
// STATE_STATE_DEF
state_machine_.registerTransition(new XMLInput(Const.XML_END_TAG,XML_STATE_DEF),
new PrimitiveTransition(),
STATE_STATE_DEF,
STATE_STATE_LIST);
state_machine_.registerDefaultTransition(new RegisterStateTransition(),
STATE_STATE_DEF,
STATE_STATE_DEF);
// STATE_TRANSITION_LIST
state_machine_.registerTransition(new XMLInput(Const.XML_END_TAG,XML_TRANSITION_LIST),
new PrimitiveTransition(),
STATE_TRANSITION_LIST,
STATE_TOP_LEVEL_DOC_TYPE);
state_machine_.registerTransition(new XMLInput(Const.XML_START_TAG,XML_TRANSITION_DEF),
new PrimitiveTransition(),
STATE_TRANSITION_LIST,
STATE_TRANSITION_DEF);
state_machine_.registerDefaultTransition(new IgnoreCharsTransition(),
STATE_TRANSITION_LIST,
STATE_TRANSITION_LIST);
// STATE_TRANSITION_DEF
state_machine_.registerTransition(new XMLInput(Const.XML_END_TAG,XML_TRANSITION_DEF),
new RegisterTransitionTransition(),
STATE_TRANSITION_DEF,
STATE_TRANSITION_LIST);
state_machine_.registerTransition(new XMLInput(Const.XML_START_TAG,XML_BEGINSTATE),
new PrimitiveTransition(),
STATE_TRANSITION_DEF,
STATE_BEGINSTATE);
state_machine_.registerTransition(new XMLInput(Const.XML_START_TAG,XML_NEXTSTATE),
new PrimitiveTransition(),
STATE_TRANSITION_DEF,
STATE_NEXTSTATE);
state_machine_.registerTransition(new XMLInput(Const.XML_START_TAG,XML_ELEMENT),
new PrimitiveTransition(),
STATE_TRANSITION_DEF,
STATE_ELEMENT);
state_machine_.registerTransition(new XMLInput(Const.XML_START_TAG,XML_CLASSNAME),
new PrimitiveTransition(),
STATE_TRANSITION_DEF,
STATE_CLASSNAME);
state_machine_.registerDefaultTransition(new IgnoreCharsTransition(),
STATE_TRANSITION_DEF,
STATE_TRANSITION_DEF);
// STATE_BEGINSTATE
state_machine_.registerTransition(new XMLInput(Const.XML_END_TAG,XML_BEGINSTATE),
new PrimitiveTransition(),
STATE_BEGINSTATE,
STATE_TRANSITION_DEF);
state_machine_.registerDefaultTransition(new StoreDataTransition(StoreDataTransition.BEGINSTATE),
STATE_BEGINSTATE,
STATE_BEGINSTATE);
// STATE_NEXTSTATE
state_machine_.registerTransition(new XMLInput(Const.XML_END_TAG,XML_NEXTSTATE),
new PrimitiveTransition(),
STATE_NEXTSTATE,
STATE_TRANSITION_DEF);
state_machine_.registerDefaultTransition(new StoreDataTransition(StoreDataTransition.NEXTSTATE),
STATE_NEXTSTATE,
STATE_NEXTSTATE);
// STATE_ELEMENT
state_machine_.registerTransition(new XMLInput(Const.XML_END_TAG,XML_ELEMENT),
new PrimitiveTransition(),
STATE_ELEMENT,
STATE_TRANSITION_DEF);
state_machine_.registerDefaultTransition(new StoreDataTransition(StoreDataTransition.ELEMENT),
STATE_ELEMENT,
STATE_ELEMENT);
// STATE_CLASSNAME
state_machine_.registerTransition(new XMLInput(Const.XML_END_TAG,XML_CLASSNAME),
new PrimitiveTransition(),
STATE_CLASSNAME,
STATE_TRANSITION_DEF);
state_machine_.registerDefaultTransition(new StoreDataTransition(StoreDataTransition.CLASSNAME),
STATE_CLASSNAME,
STATE_CLASSNAME);
}
catch (Exception exc)
{
exc.printStackTrace();
}
}
}
--- NEW FILE: Parser.java ---
/***********************************************************************
* @(#)$RCSfile: Parser.java,v $ $Revision: 1.1 $ $Date: 2002/02/14 17:53:48 $
*
* Copyright (c) 2002 stefan thalauer
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License (LGPL)
* as published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
***********************************************************************/
package edu.iicm.xpg.statemachine;
import java.io.FileReader;
import java.io.File;
import org.xml.sax.XMLReader;
import org.xml.sax.InputSource;
import org.xml.sax.helpers.XMLReaderFactory;
import org.xml.sax.SAXException;
import org.dinopolis.util.DFactory;
//----------------------------------------------------------------------
/**
* @author Stefan Thalauer
* @version $revision$
*/
public class Parser
{
protected DataObject data_;
protected XMLReader reader_;
protected XMLHandler handler_;
protected PrimitiveStateMachine state_machine_;
protected final static String XML_READER = "org.apache.xerces.parsers.SAXParser";
protected final static String PARSER_FEATURE_SCHEMA = "http://xml.org/sax/features/validation";
protected final static String PARSER_FEATURE_VALIDATING = "http://apache.org/xml/features/validation/schema";
protected final static String PARSER_FEATURE_VALIDATING_DYNAMIC ="http://apache.org/xml/features/validation/dynamic";
protected final static String STATE_MACHINE="doc_state_machine";
protected final static String TRANSITION_FATORY="transition_factory";
//----------------------------------------------------------------------
/**
*/
public Parser()
{
data_ = new DataObject();
DFactory transition_factory = new DFactory();
data_.putObject(TRANSITION_FATORY, transition_factory);
try
{
reader_ = XMLReaderFactory.createXMLReader(XML_READER);
}
catch (SAXException exc)
{
exc.printStackTrace();
}
}
//----------------------------------------------------------------------
/**
* @param state_machine
*/
public Parser(PrimitiveStateMachine state_machine)
{
this();
state_machine_=state_machine;
state_machine_.setUserDefinedDataObject(data_);
handler_ = new XMLHandler(state_machine_,data_);
}
//----------------------------------------------------------------------
/**
* Parse a file , calls the XMLHandler
* @param file the xml file to parse
* @return public
*/
public void parseFile(String filename)
{
File input_file = new File(filename);
if (!input_file.exists())
{
System.err.println("Parser: File " + filename + " not existing");
System.exit(-1);
}
try
{
FileReader file_reader = new FileReader(input_file);
reader_.parse(new InputSource(file_reader));
}
catch (Exception exc)
{
System.err.println(exc);
exc.printStackTrace();
System.exit(1);
}
}
//----------------------------------------------------------------------
/**
* @return the object that has been generated
*/
public synchronized Object getResult()
{
return(data_.getResult().toString());
}
//----------------------------------------------------------------------
/**
* This was just a test function
* @return the object that has been generated
*/
// public synchronized PrimitiveStateMachine getStateMachine()
// {
// return (PrimitiveStateMachine) data_.getObject(STATE_MACHINE);
// }
//----------------------------------------------------------------------
/**
* @return
*/
public void setHandlers(XMLHandler handler)
{
reader_.setContentHandler(handler);
reader_.setErrorHandler(handler);
reader_.setDTDHandler(handler);
}
//----------------------------------------------------------------------
/**
* @return
*/
public void setHandlers()
{
reader_.setContentHandler(handler_);
reader_.setErrorHandler(handler_);
reader_.setDTDHandler(handler_);
}
//----------------------------------------------------------------------
/**
* @param
* @return
*/
public void setFeatures()
{
try
{
reader_.setFeature(PARSER_FEATURE_VALIDATING, true);
}
catch (SAXException e)
{
System.err.println("Cannot activate validation.");
}
try
{
reader_.setFeature(PARSER_FEATURE_VALIDATING_DYNAMIC, true);
}
catch (SAXException e)
{
System.err.println("Cannot activate Dynamic validation.");
}
try
{
reader_.setFeature(PARSER_FEATURE_SCHEMA, true);
}
catch (SAXException e)
{
System.err.println("Cannot activate SCHEMA validation.");
}
}
}
--- NEW FILE: InitParser.java ---
/***********************************************************************
* @(#)$RCSfile: InitParser.java,v $ $Revision: 1.1 $ $Date: 2002/02/14 17:53:48 $
*
* Copyright (c) 2002 stefan thalauer
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License (LGPL)
* as published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
***********************************************************************/
package edu.iicm.xpg.statemachine;
import org.xml.sax.helpers.XMLReaderFactory;
import org.xml.sax.SAXException;
import org.dinopolis.util.DFactory;
//----------------------------------------------------------------------
/**
* @author Stefan Thalauer
* @version $revision$
*/
public class InitParser extends Parser
implements Initializer
{
protected String config_file_;
protected Initializer initializer_;
//----------------------------------------------------------------------
/**
* @param config_file
*/
public InitParser(String config_file)
{
super();
config_file_= config_file;
initializer_ = new InitInitializeStateMachine();
state_machine_ = new PrimitiveStateMachine();
handler_ = new XMLHandler(state_machine_,data_);
}
//----------------------------------------------------------------------
/**
* The following state machine is built here: *
* @return
* @exception Exception whatever can happen during initialization
*/
public void initialize(PrimitiveStateMachine new_state_machine)
{
setFeatures();
setHandlers();
initializer_.initialize(state_machine_);
state_machine_=initializer_.getStateMachine();
data_.putObject(STATE_MACHINE,new_state_machine);
state_machine_.setUserDefinedDataObject(data_);
parseFile(config_file_);
}
//----------------------------------------------------------------------
/**
* @return the initialized Statemachine
*/
public PrimitiveStateMachine getStateMachine()
{
return (PrimitiveStateMachine) data_.getObject(STATE_MACHINE);
}
//----------------------------------------------------------------------
/**
* The following state machine is built here:
*
* @return
* @deprecated
* @exception Exception whatever can happen during initialization
*/
public void initialize(String filename)
// throws Exception
{
System.err.println("void initialize(String filename) is DEPRICATED!");
}
}
|
|
From: Robert L. <la...@us...> - 2002-02-07 14:02:53
|
Update of /cvsroot/xpg-xml/org/dinopolis/util
In directory usw-pr-cvs1:/tmp/cvs-serv17183
Modified Files:
DFactory.java
Log Message:
changed System.out to System.err, prettyfied messages
Index: DFactory.java
===================================================================
RCS file: /cvsroot/xpg-xml/org/dinopolis/util/DFactory.java,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** DFactory.java 1 Feb 2002 14:39:43 -0000 1.1.1.1
--- DFactory.java 7 Feb 2002 14:02:51 -0000 1.2
***************
*** 152,156 ****
Class ret_class = (Class)(cache_.get(partly_qualified_classname));
! System.out.println("IN DFACTORY; ret_class = "+ret_class);
try
--- 152,156 ----
Class ret_class = (Class)(cache_.get(partly_qualified_classname));
! System.err.println(this.getClass().getName() + ":>> return class = "+ret_class);
try
***************
*** 164,168 ****
{
StringBuffer buf = new StringBuffer();
! System.out.println("IN DFACTORY; path_ = "+path_[count]);
buf.append(path_[count]);
buf.append('.');
--- 164,168 ----
{
StringBuffer buf = new StringBuffer();
! System.err.println(this.getClass().getName() + ":>> path__ = "+path_[count]);
buf.append(path_[count]);
buf.append('.');
***************
*** 170,184 ****
String full_class_name = buf.toString();
! System.out.println("IN DFACTORY; full_class_name = "+full_class_name);
try
{
ret_class = Class.forName(full_class_name);
! System.out.println("IN DFACTORY; ret_class = "+ret_class);
cache_.put(partly_qualified_classname, ret_class);
Object obj = ret_class.newInstance();
if (obj == null)
! System.out.println("NULLLLLLLLL!!!!!");
else
! System.out.println("object = "+obj);
return(ret_class.newInstance());
}
--- 170,184 ----
String full_class_name = buf.toString();
! System.err.println(this.getClass().getName() + ":>> full_class_name = "+full_class_name);
try
{
ret_class = Class.forName(full_class_name);
! System.err.println(this.getClass().getName() + ":>> ret_class = "+ret_class);
cache_.put(partly_qualified_classname, ret_class);
Object obj = ret_class.newInstance();
if (obj == null)
! System.err.println(this.getClass().getName() + ":>> WARNING: Object is null!");
else
! System.err.println(this.getClass().getName() + ":>> object = "+obj);
return(ret_class.newInstance());
}
***************
*** 191,195 ****
catch (InstantiationException e)
{
! // this is not pritty good :((
// an InstantiationException should be declared in the
// signature of this method
--- 191,195 ----
catch (InstantiationException e)
{
! // FIXXME
// an InstantiationException should be declared in the
// signature of this method
***************
*** 198,202 ****
catch (IllegalAccessException e)
{
! // this is not pritty good :((
// an IllegalAccessException should be declared in the
// signature of this method
--- 198,202 ----
catch (IllegalAccessException e)
{
! // FIXXME
// an IllegalAccessException should be declared in the
// signature of this method
***************
*** 216,230 ****
}
}
-
-
-
-
-
-
-
-
-
-
-
-
--- 216,218 ----
|
Update of /cvsroot/xpg-xml/edu/iicm/xpg/transitions
In directory usw-pr-cvs1:/tmp/cvs-serv12430
Modified Files:
ClassLoaderTransition.java IgnoreCharsTransition.java
PrimitiveTransition.java RegisterStartStateTransition.java
RegisterStateTransition.java RegisterTransitionTransition.java
SetSearchPathTransition.java StopMachineTransition.java
StoreDataTransition.java
Removed Files:
StoreDocAuthorTransition.java StoreDocContentTransition.java
StoreDocTitleTransition.java WriteDocContentTransition.java
WriteGeneralFooterTransition.java
WriteGeneralHeaderTransition.java WriteHeaderTransition.java
Log Message:
DataObject included; some files moved to simple
Index: ClassLoaderTransition.java
===================================================================
RCS file: /cvsroot/xpg-xml/edu/iicm/xpg/transitions/ClassLoaderTransition.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** ClassLoaderTransition.java 31 Jan 2002 07:25:56 -0000 1.2
--- ClassLoaderTransition.java 7 Feb 2002 09:51:58 -0000 1.3
***************
*** 30,33 ****
--- 30,34 ----
import edu.iicm.xpg.statemachine.Input;
import edu.iicm.xpg.statemachine.State;
+ import edu.iicm.xpg.statemachine.DataObject;
//----------------------------------------------------------------------
***************
*** 61,65 ****
public String transitionTriggered(Input input,State from_state,State to_state,
! StateMachine machine,Object data)
throws Exception
{
--- 62,66 ----
public String transitionTriggered(Input input,State from_state,State to_state,
! StateMachine machine,DataObject data)
throws Exception
{
Index: IgnoreCharsTransition.java
===================================================================
RCS file: /cvsroot/xpg-xml/edu/iicm/xpg/transitions/IgnoreCharsTransition.java,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** IgnoreCharsTransition.java 29 Jan 2002 10:43:16 -0000 1.1.1.1
--- IgnoreCharsTransition.java 7 Feb 2002 09:51:58 -0000 1.2
***************
*** 1,65 ****
! /***********************************************************************
! * @(#)$RCSfile$ $Revision$ $Date$
! *
! * Copyright (c) 2001 IICM, Graz University of Technology
! * Schiesstattgasse 4a, A-8010 Graz, Austria.
! *
! * This program is free software; you can redistribute it and/or modify
! * it under the terms of the GNU Lesser General Public License (LGPL)
! * as published by the Free Software Foundation; either version 2.1 of
! * the License, or (at your option) any later version.
! *
! * This program is distributed in the hope that it will be useful,
! * but WITHOUT ANY WARRANTY; without even the implied warranty of
! * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! * GNU Lesser General Public License for more details.
! *
! * You should have received a copy of the GNU Lesser General Public
! * License along with this program; if not, write to the
! * Free Software Foundation, Inc.,
! * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
! ***********************************************************************/
!
!
! package edu.iicm.xpg.transitions;
!
! import edu.iicm.xpg.statemachine.Const;
! import edu.iicm.xpg.statemachine.Input;
! import edu.iicm.xpg.statemachine.XMLInput;
! import edu.iicm.xpg.statemachine.State;
! import edu.iicm.xpg.statemachine.StateMachine;
! import edu.iicm.xpg.statemachine.Transition;
! import edu.iicm.xpg.statemachine.IllegalInputException;
!
! //----------------------------------------------------------------------
! /**
! * @author Klaus Schmaranz
! * @version $Revision$
! */
!
! public class IgnoreCharsTransition implements Transition
! {
! //----------------------------------------------------------------------
! /**
! * @param input the input that triggered this transition
! * @param from_state the start state for this transition
! * @param to_state the destination state for this transition
! * @param machine the state machine that this transition belongs to
! * @param data user defined data
! * @return
! * @exception Exception whatever an implementation can throw
! */
!
! public String transitionTriggered(Input input,State from_state,State to_state,
! StateMachine machine,Object data)
! throws Exception
! {
! System.out.println("--->IgnoreCharsTrans: " + (XMLInput)input + " type of " + ((XMLInput)input).getType());
! if (!((XMLInput)input).getType().equals(Const.XML_CHARS))
! throw(new IllegalInputException("input is not of type XML_CHARS"));
! return(null);
! }
!
! }
!
!
--- 1,65 ----
! /***********************************************************************
! * @(#)$RCSfile$ $Revision$ $Date$
! *
! * Copyright (c) 2001 IICM, Graz University of Technology
! * Schiesstattgasse 4a, A-8010 Graz, Austria.
! *
! * This program is free software; you can redistribute it and/or modify
! * it under the terms of the GNU Lesser General Public License (LGPL)
! * as published by the Free Software Foundation; either version 2.1 of
! * the License, or (at your option) any later version.
! *
! * This program is distributed in the hope that it will be useful,
! * but WITHOUT ANY WARRANTY; without even the implied warranty of
! * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! * GNU Lesser General Public License for more details.
! *
! * You should have received a copy of the GNU Lesser General Public
! * License along with this program; if not, write to the
! * Free Software Foundation, Inc.,
! * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
! ***********************************************************************/
!
!
! package edu.iicm.xpg.transitions;
!
! import edu.iicm.xpg.statemachine.Const;
! import edu.iicm.xpg.statemachine.Input;
! import edu.iicm.xpg.statemachine.XMLInput;
! import edu.iicm.xpg.statemachine.State;
! import edu.iicm.xpg.statemachine.StateMachine;
! import edu.iicm.xpg.statemachine.Transition;
! import edu.iicm.xpg.statemachine.IllegalInputException;
! import edu.iicm.xpg.statemachine.DataObject;
!
! //----------------------------------------------------------------------
! /**
! * @author Klaus Schmaranz
! * @version $Revision$
! */
!
! public class IgnoreCharsTransition implements Transition
! {
! //----------------------------------------------------------------------
! /**
! * @param input the input that triggered this transition
! * @param from_state the start state for this transition
! * @param to_state the destination state for this transition
! * @param machine the state machine that this transition belongs to
! * @param data user defined data
! * @return
! * @exception Exception whatever an implementation can throw
! */
!
! public String transitionTriggered(Input input,State from_state,State to_state,
! StateMachine machine,DataObject data)
! throws Exception
! {
! if (!((XMLInput)input).getType().equals(Const.XML_CHARS))
! throw(new IllegalInputException("input is not of type XML_CHARS"));
! return(null);
! }
!
! }
!
!
Index: PrimitiveTransition.java
===================================================================
RCS file: /cvsroot/xpg-xml/edu/iicm/xpg/transitions/PrimitiveTransition.java,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** PrimitiveTransition.java 29 Jan 2002 10:43:16 -0000 1.1.1.1
--- PrimitiveTransition.java 7 Feb 2002 09:51:58 -0000 1.2
***************
*** 1,59 ****
! /***********************************************************************
! * @(#)$RCSfile$ $Revision$ $Date$
! *
! * Copyright (c) 2001 IICM, Graz University of Technology
! * Schiesstattgasse 4a, A-8010 Graz, Austria.
! *
! * This program is free software; you can redistribute it and/or modify
! * it under the terms of the GNU Lesser General Public License (LGPL)
! * as published by the Free Software Foundation; either version 2.1 of
! * the License, or (at your option) any later version.
! *
! * This program is distributed in the hope that it will be useful,
! * but WITHOUT ANY WARRANTY; without even the implied warranty of
! * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! * GNU Lesser General Public License for more details.
! *
! * You should have received a copy of the GNU Lesser General Public
! * License along with this program; if not, write to the
! * Free Software Foundation, Inc.,
! * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
! ***********************************************************************/
!
!
! package edu.iicm.xpg.transitions;
!
! import edu.iicm.xpg.statemachine.Input;
! import edu.iicm.xpg.statemachine.State;
! import edu.iicm.xpg.statemachine.StateMachine;
! import edu.iicm.xpg.statemachine.Transition;
!
! //----------------------------------------------------------------------
! /**
! * @author Klaus Schmaranz
! * @version $Revision$
! */
!
! public class PrimitiveTransition implements Transition
! {
! //----------------------------------------------------------------------
! /**
! * @param input the input that triggered this transition
! * @param from_state the start state for this transition
! * @param to_state the destination state for this transition
! * @param machine the state machine that this transition belongs to
! * @param data user defined data
! * @return
! * @exception Exception whatever an implementation can throw
! */
!
! public String transitionTriggered(Input input,State from_state,State to_state,
! StateMachine machine,Object data)
! throws Exception
! {
! return(null);
! }
!
! }
!
!
--- 1,60 ----
! /***********************************************************************
! * @(#)$RCSfile$ $Revision$ $Date$
! *
! * Copyright (c) 2001 IICM, Graz University of Technology
! * Schiesstattgasse 4a, A-8010 Graz, Austria.
! *
! * This program is free software; you can redistribute it and/or modify
! * it under the terms of the GNU Lesser General Public License (LGPL)
! * as published by the Free Software Foundation; either version 2.1 of
! * the License, or (at your option) any later version.
! *
! * This program is distributed in the hope that it will be useful,
! * but WITHOUT ANY WARRANTY; without even the implied warranty of
! * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! * GNU Lesser General Public License for more details.
! *
! * You should have received a copy of the GNU Lesser General Public
! * License along with this program; if not, write to the
! * Free Software Foundation, Inc.,
! * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
! ***********************************************************************/
!
!
! package edu.iicm.xpg.transitions;
!
! import edu.iicm.xpg.statemachine.Input;
! import edu.iicm.xpg.statemachine.State;
! import edu.iicm.xpg.statemachine.StateMachine;
! import edu.iicm.xpg.statemachine.Transition;
! import edu.iicm.xpg.statemachine.DataObject;
!
! //----------------------------------------------------------------------
! /**
! * @author Klaus Schmaranz
! * @version $Revision$
! */
!
! public class PrimitiveTransition implements Transition
! {
! //----------------------------------------------------------------------
! /**
! * @param input the input that triggered this transition
! * @param from_state the start state for this transition
! * @param to_state the destination state for this transition
! * @param machine the state machine that this transition belongs to
! * @param data user defined data
! * @return
! * @exception Exception whatever an implementation can throw
! */
!
! public String transitionTriggered(Input input,State from_state,State to_state,
! StateMachine machine,DataObject data)
! throws Exception
! {
! return(null);
! }
!
! }
!
!
Index: RegisterStartStateTransition.java
===================================================================
RCS file: /cvsroot/xpg-xml/edu/iicm/xpg/transitions/RegisterStartStateTransition.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** RegisterStartStateTransition.java 31 Jan 2002 07:28:04 -0000 1.2
--- RegisterStartStateTransition.java 7 Feb 2002 09:51:58 -0000 1.3
***************
*** 55,59 ****
public String transitionTriggered(Input input,State from_state,State to_state,
! StateMachine machine,Object data)
throws Exception
{
--- 55,59 ----
public String transitionTriggered(Input input,State from_state,State to_state,
! StateMachine machine,DataObject data)
throws Exception
{
***************
*** 61,69 ****
PrimitiveStateMachine doc_state_machine =
! (PrimitiveStateMachine)((DataObject)data).getObject("doc_state_machine");
! doc_state_machine.registerState(new PrimitiveState(),state);
doc_state_machine.setStartState(state);
! return(null);
}
--- 61,69 ----
PrimitiveStateMachine doc_state_machine =
! (PrimitiveStateMachine)data.getObject("doc_state_machine");
! doc_state_machine.registerState(new PrimitiveState(),state);
doc_state_machine.setStartState(state);
! return(null);
}
Index: RegisterStateTransition.java
===================================================================
RCS file: /cvsroot/xpg-xml/edu/iicm/xpg/transitions/RegisterStateTransition.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** RegisterStateTransition.java 31 Jan 2002 07:28:48 -0000 1.2
--- RegisterStateTransition.java 7 Feb 2002 09:51:58 -0000 1.3
***************
*** 54,66 ****
public String transitionTriggered(Input input,State from_state,State to_state,
! StateMachine machine,Object data)
throws Exception
{
String state = ((XMLInput)input).getValue();
PrimitiveStateMachine doc_state_machine =
! (PrimitiveStateMachine)((DataObject)data).getObject("doc_state_machine");
! doc_state_machine.registerState(new PrimitiveState(),state);
! return(null);
}
--- 54,66 ----
public String transitionTriggered(Input input,State from_state,State to_state,
! StateMachine machine,DataObject data)
throws Exception
{
String state = ((XMLInput)input).getValue();
PrimitiveStateMachine doc_state_machine =
! (PrimitiveStateMachine)data.getObject("doc_state_machine");
! doc_state_machine.registerState(new PrimitiveState(),state);
! return(null);
}
Index: RegisterTransitionTransition.java
===================================================================
RCS file: /cvsroot/xpg-xml/edu/iicm/xpg/transitions/RegisterTransitionTransition.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** RegisterTransitionTransition.java 31 Jan 2002 07:30:31 -0000 1.3
--- RegisterTransitionTransition.java 7 Feb 2002 09:51:58 -0000 1.4
***************
*** 38,43 ****
import edu.iicm.xpg.statemachine.DataObject;
- import edu.iicm.xpg.transitions.ClassLoaderTransition;
-
//----------------------------------------------------------------------
/**
--- 38,41 ----
***************
*** 61,77 ****
public String transitionTriggered(Input input,State from_state,State to_state,
! StateMachine machine,Object data)
throws Exception
{
! String beginstate = (String)((DataObject)data).takeObject("beginstate");
! String nextstate = (String)((DataObject)data).takeObject("nextstate");
! String classname = (String)((DataObject)data).takeObject("classname");
! String element = (String)((DataObject)data).takeObject("element");
PrimitiveStateMachine doc_state_machine_ =
! (PrimitiveStateMachine)((DataObject)data).getObject("doc_state_machine");
DFactory transition_factory =
! (DFactory)((DataObject)data).getObject("transition_factory");
Transition transition =
--- 59,75 ----
public String transitionTriggered(Input input,State from_state,State to_state,
! StateMachine machine,DataObject data)
throws Exception
{
! String beginstate = (String)data.takeObject("beginstate");
! String nextstate = (String)data.takeObject("nextstate");
! String classname = (String)data.takeObject("classname");
! String element = (String)data.takeObject("element");
PrimitiveStateMachine doc_state_machine_ =
! (PrimitiveStateMachine)data.getObject("doc_state_machine");
DFactory transition_factory =
! (DFactory)data.getObject("transition_factory");
Transition transition =
Index: SetSearchPathTransition.java
===================================================================
RCS file: /cvsroot/xpg-xml/edu/iicm/xpg/transitions/SetSearchPathTransition.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** SetSearchPathTransition.java 3 Feb 2002 22:05:17 -0000 1.1
--- SetSearchPathTransition.java 7 Feb 2002 09:51:58 -0000 1.2
***************
*** 54,58 ****
public String transitionTriggered(Input input,State from_state,State to_state,
! StateMachine machine,Object data)
throws Exception
{
--- 54,58 ----
public String transitionTriggered(Input input,State from_state,State to_state,
! StateMachine machine,DataObject data)
throws Exception
{
***************
*** 60,66 ****
DFactory transition_factory =
! (DFactory)((DataObject)data).getObject("transition_factory");
! transition_factory.setSearchPath(new String[]{path});
return(null);
--- 60,67 ----
DFactory transition_factory =
! (DFactory)data.getObject("transition_factory");
! transition_factory.setSearchPath(new String[]{ "edu.iicm.xpg.transitions",
! path });
return(null);
Index: StopMachineTransition.java
===================================================================
RCS file: /cvsroot/xpg-xml/edu/iicm/xpg/transitions/StopMachineTransition.java,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** StopMachineTransition.java 29 Jan 2002 10:43:16 -0000 1.1.1.1
--- StopMachineTransition.java 7 Feb 2002 09:51:58 -0000 1.2
***************
*** 1,73 ****
! /***********************************************************************
! * @(#)$RCSfile$ $Revision$ $Date$
! *
! * Copyright (c) 2001 IICM, Graz University of Technology
! * Schiesstattgasse 4a, A-8010 Graz, Austria.
! *
! * This program is free software; you can redistribute it and/or modify
! * it under the terms of the GNU Lesser General Public License (LGPL)
! * as published by the Free Software Foundation; either version 2.1 of
! * the License, or (at your option) any later version.
! *
! * This program is distributed in the hope that it will be useful,
! * but WITHOUT ANY WARRANTY; without even the implied warranty of
! * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! * GNU Lesser General Public License for more details.
! *
! * You should have received a copy of the GNU Lesser General Public
! * License along with this program; if not, write to the
! * Free Software Foundation, Inc.,
! * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
! ***********************************************************************/
!
!
! package edu.iicm.xpg.transitions;
!
! import edu.iicm.xpg.statemachine.InitStateMachine;
! import edu.iicm.xpg.statemachine.Input;
! import edu.iicm.xpg.statemachine.State;
! import edu.iicm.xpg.statemachine.StateMachine;
! import edu.iicm.xpg.statemachine.Transition;
! import edu.iicm.xpg.statemachine.InitUserData;
! import edu.iicm.xpg.generator.Generator;
!
! //----------------------------------------------------------------------
! /**
! * @author Klaus Schmaranz
! * @author Heimo Haub
! * @author Günther Brand
! * @version $Revision$
! */
!
! public class StopMachineTransition implements Transition
! {
! //----------------------------------------------------------------------
! /**
! * @param input the input that triggered this transition
! * @param from_state the start state for this transition
! * @param to_state the destination state for this transition
! * @param machine the state machine that this transition belongs to
! * @param data user defined data
! * @return
! * @exception Exception whatever an implementation can throw
! */
!
! public String transitionTriggered(Input input,State from_state,State to_state,
! StateMachine machine,Object data)
! throws Exception
! {
! // this transition only works for InitStateMachine
! try
! {
! ((InitUserData)data).finished = true;
! ((Generator)data).setFinished(true);
! }
! catch (Exception exc) {}
!
! machine.stopMachine();
! return(null);
! }
!
! }
!
!
--- 1,66 ----
! /***********************************************************************
! * @(#)$RCSfile$ $Revision$ $Date$
! *
! * Copyright (c) 2001 IICM, Graz University of Technology
! * Schiesstattgasse 4a, A-8010 Graz, Austria.
! *
! * This program is free software; you can redistribute it and/or modify
! * it under the terms of the GNU Lesser General Public License (LGPL)
! * as published by the Free Software Foundation; either version 2.1 of
! * the License, or (at your option) any later version.
! *
! * This program is distributed in the hope that it will be useful,
! * but WITHOUT ANY WARRANTY; without even the implied warranty of
! * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! * GNU Lesser General Public License for more details.
! *
! * You should have received a copy of the GNU Lesser General Public
! * License along with this program; if not, write to the
! * Free Software Foundation, Inc.,
! * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
! ***********************************************************************/
!
!
! package edu.iicm.xpg.transitions;
!
! import edu.iicm.xpg.statemachine.InitStateMachine;
! import edu.iicm.xpg.statemachine.Input;
! import edu.iicm.xpg.statemachine.State;
! import edu.iicm.xpg.statemachine.StateMachine;
! import edu.iicm.xpg.statemachine.Transition;
! import edu.iicm.xpg.statemachine.DataObject;
!
! //----------------------------------------------------------------------
! /**
! * @author Klaus Schmaranz
! * @author Heimo Haub
! * @author Günther Brand
! * @version $Revision$
! */
!
! public class StopMachineTransition implements Transition
! {
! //----------------------------------------------------------------------
! /**
! * @param input the input that triggered this transition
! * @param from_state the start state for this transition
! * @param to_state the destination state for this transition
! * @param machine the state machine that this transition belongs to
! * @param data user defined data
! * @return
! * @exception Exception whatever an implementation can throw
! */
!
! public String transitionTriggered(Input input,State from_state,State to_state,
! StateMachine machine,DataObject data)
! throws Exception
! {
! data.setFinished(true);
!
! machine.stopMachine();
! return(null);
! }
!
! }
!
!
Index: StoreDataTransition.java
===================================================================
RCS file: /cvsroot/xpg-xml/edu/iicm/xpg/transitions/StoreDataTransition.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** StoreDataTransition.java 31 Jan 2002 07:31:43 -0000 1.2
--- StoreDataTransition.java 7 Feb 2002 09:51:58 -0000 1.3
***************
*** 64,68 ****
public String transitionTriggered(Input input,State from_state,State to_state,
! StateMachine machine,Object data)
throws Exception
{
--- 64,68 ----
public String transitionTriggered(Input input,State from_state,State to_state,
! StateMachine machine,DataObject data)
throws Exception
{
***************
*** 76,93 ****
{
case BEGINSTATE:
! ((DataObject)data).putObject("beginstate",
! ((XMLInput)input).getValue());
break;
case NEXTSTATE:
! ((DataObject)data).putObject("nextstate",
! ((XMLInput)input).getValue());
break;
case ELEMENT:
! ((DataObject)data).putObject("element",
! ((XMLInput)input).getValue());
break;
case CLASSNAME:
! ((DataObject)data).putObject("classname",
! ((XMLInput)input).getValue());
break;
default: System.err.println("StoreDataTransition: illegal datatype!");
--- 76,90 ----
{
case BEGINSTATE:
! data.putObject("beginstate", ((XMLInput)input).getValue());
break;
case NEXTSTATE:
! data.putObject("nextstate", ((XMLInput)input).getValue());
break;
case ELEMENT:
! data.putObject("element", ((XMLInput)input).getValue());
! data.putObject("type", data.topAttributes().getValue("type"));
break;
case CLASSNAME:
! data.putObject("classname", ((XMLInput)input).getValue());
break;
default: System.err.println("StoreDataTransition: illegal datatype!");
--- StoreDocAuthorTransition.java DELETED ---
--- StoreDocContentTransition.java DELETED ---
--- StoreDocTitleTransition.java DELETED ---
--- WriteDocContentTransition.java DELETED ---
--- WriteGeneralFooterTransition.java DELETED ---
--- WriteGeneralHeaderTransition.java DELETED ---
--- WriteHeaderTransition.java DELETED ---
|
|
From: G?nther B. <br...@us...> - 2002-02-07 09:42:21
|
Update of /cvsroot/xpg-xml/edu/iicm/xpg/transitions/simple
In directory usw-pr-cvs1:/tmp/cvs-serv8789
Added Files:
StoreDocAuthorTransition.java StoreDocContentTransition.java
StoreDocTitleTransition.java WriteDocContentTransition.java
WriteGeneralFooterTransition.java
WriteGeneralHeaderTransition.java WriteHeaderTransition.java
Log Message:
files moved
--- NEW FILE: StoreDocAuthorTransition.java ---
/***********************************************************************
* @(#)$RCSfile: StoreDocAuthorTransition.java,v $ $Revision: 1.1 $ $Date: 2002/02/07 09:42:18 $
*
* Copyright (c) 2001 IICM, Graz University of Technology
* Schiesstattgasse 4a, A-8010 Graz, Austria.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License (LGPL)
* as published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
***********************************************************************/
package edu.iicm.xpg.transitions.simple;
import edu.iicm.xpg.statemachine.Transition;
import edu.iicm.xpg.statemachine.State;
import edu.iicm.xpg.statemachine.StateMachine;
import edu.iicm.xpg.statemachine.Input;
import edu.iicm.xpg.statemachine.XMLInput;
import edu.iicm.xpg.statemachine.DataObject;
//----------------------------------------------------------------------
/**
* @author Klaus Schmaranz
* @author Günther Brand
* @version $Revision: 1.1 $
*/
public class StoreDocAuthorTransition implements Transition
{
//----------------------------------------------------------------------
/**
* @param input the input that triggered this transition
* @param from_state the start state for this transition
* @param to_state the destination state for this transition
* @param machine the state machine that this transition belongs to
* @param data user defined data
* @return
* @exception Exception whatever an implementation can throw
*/
public String transitionTriggered(Input input,State from_state,State to_state,
StateMachine machine,DataObject data)
throws Exception
{
String doc_author = (String)data.getObject("doc_author");
if (doc_author == null)
data.putObject("doc_author", ((XMLInput)input).getValue());
else
doc_author = doc_author + ((XMLInput)input).getValue();
// FIXXME: should be obsolete
// ((Generator)data).doc_author_ = doc_author;
return(null);
}
}
--- NEW FILE: StoreDocContentTransition.java ---
/***********************************************************************
* @(#)$RCSfile: StoreDocContentTransition.java,v $ $Revision: 1.1 $ $Date: 2002/02/07 09:42:18 $
*
* Copyright (c) 2001 IICM, Graz University of Technology
* Schiesstattgasse 4a, A-8010 Graz, Austria.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License (LGPL)
* as published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
***********************************************************************/
package edu.iicm.xpg.transitions.simple;
import edu.iicm.xpg.statemachine.Transition;
import edu.iicm.xpg.statemachine.State;
import edu.iicm.xpg.statemachine.StateMachine;
import edu.iicm.xpg.statemachine.Input;
import edu.iicm.xpg.statemachine.XMLInput;
import edu.iicm.xpg.statemachine.DataObject;
//----------------------------------------------------------------------
/**
* @author Günther Brand
* @version $Revision: 1.1 $
*/
public class StoreDocContentTransition implements Transition
{
//----------------------------------------------------------------------
/**
* @param input the input that triggered this transition
* @param from_state the start state for this transition
* @param to_state the destination state for this transition
* @param machine the state machine that this transition belongs to
* @param data user defined data
* @return
* @exception Exception whatever an implementation can throw
*/
public String transitionTriggered(Input input,State from_state,State to_state,
StateMachine machine,DataObject data)
throws Exception
{
String content = (String)data.getObject("content");
if (content == null)
data.putObject("content", ((XMLInput)input).getValue());
else
content += ((XMLInput)input).getValue();
return(null);
}
}
--- NEW FILE: StoreDocTitleTransition.java ---
/***********************************************************************
* @(#)$RCSfile: StoreDocTitleTransition.java,v $ $Revision: 1.1 $ $Date: 2002/02/07 09:42:18 $
*
* Copyright (c) 2001 IICM, Graz University of Technology
* Schiesstattgasse 4a, A-8010 Graz, Austria.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License (LGPL)
* as published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
***********************************************************************/
package edu.iicm.xpg.transitions.simple;
import edu.iicm.xpg.statemachine.Transition;
import edu.iicm.xpg.statemachine.State;
import edu.iicm.xpg.statemachine.StateMachine;
import edu.iicm.xpg.statemachine.Input;
import edu.iicm.xpg.statemachine.XMLInput;
import edu.iicm.xpg.statemachine.DataObject;
//----------------------------------------------------------------------
/**
* @author Klaus Schmaranz
* @version $Revision: 1.1 $
*/
public class StoreDocTitleTransition implements Transition
{
//----------------------------------------------------------------------
/**
* @param input the input that triggered this transition
* @param from_state the start state for this transition
* @param to_state the destination state for this transition
* @param machine the state machine that this transition belongs to
* @param data user defined data
* @return
* @exception Exception whatever an implementation can throw
*/
public String transitionTriggered(Input input,State from_state,State to_state,
StateMachine machine,DataObject data)
throws Exception
{
String doc_title = (String)data.getObject("doc_title");
if (doc_title == null)
data.putObject("doc_title", ((XMLInput)input).getValue());
else
doc_title = doc_title + ((XMLInput)input).getValue();
// ((Generator)data).doc_title_ = doc_title;
return(null);
}
}
--- NEW FILE: WriteDocContentTransition.java ---
/***********************************************************************
* @(#)$RCSfile: WriteDocContentTransition.java,v $ $Revision: 1.1 $ $Date: 2002/02/07 09:42:18 $
*
* Copyright (c) 2001 IICM, Graz University of Technology
* Schiesstattgasse 4a, A-8010 Graz, Austria.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License (LGPL)
* as published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
***********************************************************************/
package edu.iicm.xpg.transitions.simple;
import edu.iicm.xpg.statemachine.Transition;
import edu.iicm.xpg.statemachine.State;
import edu.iicm.xpg.statemachine.StateMachine;
import edu.iicm.xpg.statemachine.Input;
import edu.iicm.xpg.statemachine.XMLInput;
import edu.iicm.xpg.statemachine.DataObject;
import java.util.Vector;
import java.util.Enumeration;
//----------------------------------------------------------------------
/**
* @author Günther Brand
* @version $Revision: 1.1 $
*/
public class WriteDocContentTransition implements Transition
{
protected int field_counter_;
protected static int coll_counter_;
// don't use underlines in the labels, only at the end!
protected final static String COLL_LABEL = "collection_";
protected final static String COURSE_LABEL = "course_";
protected final static String TITLE_NEW_LABEL = "newTitle_";
protected final static String TITLE_OLD_LABEL = "oldTitle_";
protected final static String TITLE_ANY_LABEL = "anyTitle_";
protected final static String TYPE_NEW_LABEL = "newType_";
protected final static String TYPE_OLD_LABEL = "oldType_";
protected final static String TYPE_ANY_LABEL = "anyType_";
protected final static String HOURS_NEW_LABEL = "newHours_";
protected final static String HOURS_OLD_LABEL = "oldHours_";
protected final static String HOURS_ANY_LABEL = "anyHours_";
protected final static String MARK_NEW_LABEL = "newMark_";
protected final static String MARK_OLD_LABEL = "oldMark_";
protected final static String MARK_ANY_LABEL = "anyMark_";
protected final static String REMARK_NEW_LABEL = "newRemark_";
protected final static String REMARK_OLD_LABEL = "oldRemark_";
protected final static String REMARK_ANY_LABEL = "anyRemark_";
protected final static String DATE_NEW_LABEL = "newDate_";
protected final static String DATE_OLD_LABEL = "oldDate_";
protected final static String DATE_ANY_LABEL = "anyDate_";
//----------------------------------------------------------------------
/**
* @param input the input that triggered this transition
* @param from_state the start state for this transition
* @param to_state the destination state for this transition
* @param machine the state machine that this transition belongs to
* @param data user defined data
* @return
* @exception Exception whatever an implementation can throw
*/
public String transitionTriggered(Input input,State from_state,State to_state,
StateMachine machine,DataObject data)
throws Exception
{
StringBuffer html_form = data.getResult();
String content = (String)data.getObject("content");
if (content != null)
html_form.append(content);
else
System.err.println("Error (printing to form): document has no content");
// writeCourseList(html_form,collection.getCourses());
return(null);
}
//----------------------------------------------------------------------
/**
* @param html_form the form to write to
* @param course_list the list of courses
* @return
*/
/* protected synchronized void writeCourseList(StringBuffer html_form,Vector course_list)
{
if (course_list == null)
{
System.err.println("Error (printing to form): collection has no courses");
return;
}
html_form.append("<table border=\"1\" cellspacing=\"2\">\n");
field_counter_ = 0;
Enumeration courses = course_list.elements();
while(courses.hasMoreElements())
{
CourseEquivalence course = (CourseEquivalence)courses.nextElement();
writeCourse(html_form,course);
}
html_form.append("</table>\n");
} */
//----------------------------------------------------------------------
/**
* @param html_form the form to write to
* @param course the course to write
* @return
*/
/* protected void writeCourse(StringBuffer html_form,CourseEquivalence course)
{
field_counter_++;
int alternative_counter = 0;
boolean groupwise = false;
Vector entries = course.getAllNew();
// ------------------------------ "any" Course
if (entries.isEmpty())
{
html_form.append("<tr>\n");
html_form.append(" <td><input type=\"hidden\" name=\"" + COURSE_LABEL + coll_counter_ +
"_" + field_counter_ + "_1" +
"\">\n<input type=\"text\" size=\"20\" maxlength=\"60\" name=\"" + TITLE_ANY_LABEL +
coll_counter_ + "_" + field_counter_ + "_1" + "\"></td>\n");
html_form.append("<td>Typ: <input type=\"text\" size=\"4\" maxlength=\"4\" name=\"" +
TYPE_ANY_LABEL + coll_counter_ + "_" + field_counter_ + "_1" + "\"></td>\n");
html_form.append("<td>Std: <input type=\"text\" size=\"4\" maxlength=\"4\" name=\"" +
HOURS_ANY_LABEL + coll_counter_ + "_" + field_counter_ + "_1" + "\"></td>\n");
html_form.append("<td>Dat: <input type=\"text\" size=\"10\" maxlength=\"10\" name=\"" +
DATE_ANY_LABEL + coll_counter_ + "_" + field_counter_ + "_1" + "\"></td>\n");
html_form.append("<td>Note: <input type=\"text\" size=\"2\" maxlength=\"1\" name=\"" +
MARK_ANY_LABEL + coll_counter_ + "_" + field_counter_ + "_1" + "\"></td>\n");
html_form.append("<td>Bem.: <input type=\"text\" size=\"13\" maxlength=\"200\" name=\"" +
REMARK_ANY_LABEL + coll_counter_ + "_" + field_counter_ + "_1" + "\"></td>\n");
html_form.append("</tr>\n");
return;
}
// ------------------------------ new course
Enumeration entry_enum = entries.elements();
if (entries.size() > 1) // multiple alternatives
{
groupwise = true;
html_form.append("<tr><td colspan=\"6\" align=\"center\"><strong><i>" +
"Folgende Veranstaltungen werden gruppenweise angerechnet</i></strong></td></tr>");
}
while(entry_enum.hasMoreElements())
{
CourseEntry entry = (CourseEntry)entry_enum.nextElement();
alternative_counter++;
html_form.append("<tr>\n");
html_form.append(" <td><input type=\"hidden\" name=\"" + COURSE_LABEL + coll_counter_ +
"_" + field_counter_ + "_" + alternative_counter + "\">\n<strong>");
html_form.append(entry.getTitle());
html_form.append("<input type=\"hidden\" name=\"" + TITLE_NEW_LABEL + coll_counter_ +
"_" + field_counter_ + "_" + alternative_counter + "\" value=\"" +
entry.getTitle() + "\">\n");
html_form.append("</strong></td><td>");
html_form.append("Typ: ");
html_form.append(entry.getType());
html_form.append("<input type=\"hidden\" name=\"" + TYPE_NEW_LABEL + coll_counter_ +
"_" + field_counter_ + "_" + alternative_counter + "\" value=\"" +
entry.getType() + "\">\n");
html_form.append("</td><td>");
html_form.append("Std: ");
html_form.append(entry.getHours());
html_form.append("<input type=\"hidden\" name=\"" + HOURS_NEW_LABEL + coll_counter_ +
"_" + field_counter_ + "_" + alternative_counter + "\" value=\"" +
entry.getHours() + "\">\n");
html_form.append("</td>");
html_form.append("<td>Dat: <input type=\"text\" size=\"10\" maxlength=\"10\" name=\"" +
DATE_NEW_LABEL + coll_counter_ + "_" + field_counter_ + "_" +
alternative_counter + "\"></td>\n");
html_form.append("<td>Note: <input type=\"text\" size=\"2\" maxlength=\"1\" name=\"" +
MARK_NEW_LABEL + coll_counter_ + "_" + field_counter_ + "_" +
alternative_counter + "\"></td>\n");
html_form.append("<td>Bem.: <input type=\"text\" size=\"13\" maxlength=\"200\" name=\"" +
REMARK_NEW_LABEL + coll_counter_ + "_" + field_counter_ + "_" +
alternative_counter + "\"></td>\n");
html_form.append("</tr>\n");
}
// ------------------------------ old course
alternative_counter = 0;
entries = course.getAllOld();
if (entries.isEmpty())
return;
entry_enum = entries.elements();
while(entry_enum.hasMoreElements())
{
CourseEntry entry = (CourseEntry)entry_enum.nextElement();
alternative_counter++;
html_form.append("<tr>\n");
html_form.append(" <td> <i>");
html_form.append(entry.getTitle());
html_form.append("<input type=\"hidden\" name=\"" + TITLE_OLD_LABEL + coll_counter_ +
"_" + field_counter_ + "_" + alternative_counter + "\" value=\"" +
entry.getTitle() + "\">\n");
html_form.append("</i></td><td>");
html_form.append("Typ: ");
html_form.append(entry.getType());
html_form.append("<input type=\"hidden\" name=\"" + TYPE_OLD_LABEL + coll_counter_ +
"_" + field_counter_ + "_" + alternative_counter + "\" value=\"" +
entry.getType() + "\">\n");
html_form.append("</td><td>");
html_form.append("Std: ");
html_form.append(entry.getHours());
html_form.append("<input type=\"hidden\" name=\"" + HOURS_OLD_LABEL + coll_counter_ +
"_" + field_counter_ + "_" + alternative_counter + "\" value=\"" +
entry.getHours() + "\">\n");
html_form.append("</td>");
html_form.append("<td>Dat: <input type=\"text\" size=\"10\" maxlength=\"10\" name=\"" +
DATE_OLD_LABEL + coll_counter_ + "_" + field_counter_ + "_" +
alternative_counter + "\"></td>\n");
html_form.append("<td>Note: <input type=\"text\" size=\"2\" maxlength=\"1\" name=\"" +
MARK_OLD_LABEL + coll_counter_ + "_" + field_counter_ + "_" +
alternative_counter + "\"></td>\n");
html_form.append("<td>Bem.: <input type=\"text\" size=\"13\" maxlength=\"200\" name=\"" +
REMARK_OLD_LABEL + coll_counter_ + "_" + field_counter_ + "_" +
alternative_counter + "\"></td>\n");
html_form.append("</tr>\n");
}
if (groupwise) // multiple alternatives
{
html_form.append("<tr><td colspan=\"6\" align=\"center\"><strong><i>" +
"Ende der Anrechnungsgruppe</i></strong></td></tr>");
}
} */
}
--- NEW FILE: WriteGeneralFooterTransition.java ---
/***********************************************************************
* @(#)$RCSfile: WriteGeneralFooterTransition.java,v $ $Revision: 1.1 $ $Date: 2002/02/07 09:42:18 $
*
* Copyright (c) 2001 IICM, Graz University of Technology
* Schiesstattgasse 4a, A-8010 Graz, Austria.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License (LGPL)
* as published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
***********************************************************************/
package edu.iicm.xpg.transitions.simple;
import edu.iicm.xpg.statemachine.Transition;
import edu.iicm.xpg.statemachine.State;
import edu.iicm.xpg.statemachine.StateMachine;
import edu.iicm.xpg.statemachine.Input;
import edu.iicm.xpg.statemachine.XMLInput;
import edu.iicm.xpg.statemachine.DataObject;
//----------------------------------------------------------------------
/**
* @author Klaus Schmaranz
* @author Günther Brand
* @version $Revision: 1.1 $
*/
public class WriteGeneralFooterTransition implements Transition
{
//----------------------------------------------------------------------
/**
* @param input the input that triggered this transition
* @param from_state the start state for this transition
* @param to_state the destination state for this transition
* @param machine the state machine that this transition belongs to
* @param data user defined data
* @return
* @exception Exception whatever an implementation can throw
*/
public String transitionTriggered(Input input,State from_state,State to_state,
StateMachine machine,DataObject data)
throws Exception
{
StringBuffer html_form = data.getResult();
html_form.append("\n<p><hr></p><input type=\"submit\" value=\"abschicken\">\n</form>" +
"\n</body>\n</html>");
// html_form.append("\n</body>\n</html>");
return(null);
}
}
--- NEW FILE: WriteGeneralHeaderTransition.java ---
/***********************************************************************
* @(#)$RCSfile: WriteGeneralHeaderTransition.java,v $ $Revision: 1.1 $ $Date: 2002/02/07 09:42:18 $
*
* Copyright (c) 2001 IICM, Graz University of Technology
* Schiesstattgasse 4a, A-8010 Graz, Austria.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License (LGPL)
* as published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
***********************************************************************/
package edu.iicm.xpg.transitions.simple;
import edu.iicm.xpg.statemachine.Transition;
import edu.iicm.xpg.statemachine.State;
import edu.iicm.xpg.statemachine.StateMachine;
import edu.iicm.xpg.statemachine.Input;
import edu.iicm.xpg.statemachine.XMLInput;
import edu.iicm.xpg.statemachine.DataObject;
//----------------------------------------------------------------------
/**
* @author Klaus Schmaranz
* @version $Revision: 1.1 $
*/
public class WriteGeneralHeaderTransition implements Transition
{
//----------------------------------------------------------------------
/**
* @param input the input that triggered this transition
* @param from_state the start state for this transition
* @param to_state the destination state for this transition
* @param machine the state machine that this transition belongs to
* @param data user defined data
* @return
* @exception Exception whatever an implementation can throw
*/
public String transitionTriggered(Input input,State from_state,State to_state,
StateMachine machine,DataObject data)
throws Exception
{
StringBuffer html_form = data.getResult();
html_form.append("<html>\n<head>\n");
return(null);
}
}
--- NEW FILE: WriteHeaderTransition.java ---
/***********************************************************************
* @(#)$RCSfile: WriteHeaderTransition.java,v $ $Revision: 1.1 $ $Date: 2002/02/07 09:42:18 $
*
* Copyright (c) 2001 IICM, Graz University of Technology
* Schiesstattgasse 4a, A-8010 Graz, Austria.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License (LGPL)
* as published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
***********************************************************************/
package edu.iicm.xpg.transitions.simple;
import edu.iicm.xpg.statemachine.Transition;
import edu.iicm.xpg.statemachine.Input;
import edu.iicm.xpg.statemachine.State;
import edu.iicm.xpg.statemachine.StateMachine;
import edu.iicm.xpg.statemachine.DataObject;
//----------------------------------------------------------------------
/**
* @author Klaus Schmaranz
* @author Günther Brand
* @version $Revision: 1.1 $
*/
public class WriteHeaderTransition implements Transition
{
//----------------------------------------------------------------------
/**
* @param input the input that triggered this transition
* @param from_state the start state for this transition
* @param to_state the destination state for this transition
* @param machine the state machine that this transition belongs to
* @param data user defined data
* @return
* @exception Exception whatever an implementation can throw
*/
public String transitionTriggered(Input input,State from_state,State to_state,
StateMachine machine,DataObject data)
throws Exception
{
StringBuffer html_form = data.getResult();
String doc_title = (String)data.getObject("doc_title");
String doc_author = (String)data.getObject("doc_author");
if (doc_title == null)
System.err.println("Error (printing to form): document has no title");
html_form.append("<title>" + doc_title + "</title>\n");
if (doc_author != null)
html_form.append("<meta name=\"author\" content=\"" + doc_author + "\">\n");
html_form.append("</head>\n<body>\n<h1>" + doc_title + "</h1>\n");
return(null);
}
}
|
|
From: G?nther B. <br...@us...> - 2002-02-07 09:40:03
|
Update of /cvsroot/xpg-xml/edu/iicm/xpg/transitions/simple In directory usw-pr-cvs1:/tmp/cvs-serv8047/simple Log Message: Directory /cvsroot/xpg-xml/edu/iicm/xpg/transitions/simple added to the repository |
|
From: G?nther B. <br...@us...> - 2002-02-07 09:38:15
|
Update of /cvsroot/xpg-xml/edu/iicm/xpg/statemachine
In directory usw-pr-cvs1:/tmp/cvs-serv7440
Modified Files:
DataObject.java InitStateMachine.java
PrimitiveStateMachine.java StateMachine.java Transition.java
Log Message:
DataObject and Stacks included
Index: DataObject.java
===================================================================
RCS file: /cvsroot/xpg-xml/edu/iicm/xpg/statemachine/DataObject.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** DataObject.java 31 Jan 2002 07:33:37 -0000 1.1
--- DataObject.java 7 Feb 2002 09:38:12 -0000 1.2
***************
*** 23,27 ****
--- 23,29 ----
package edu.iicm.xpg.statemachine;
+ import org.xml.sax.Attributes;
import java.util.HashMap;
+ import java.util.Stack;
//----------------------------------------------------------------------
***************
*** 35,42 ****
--- 37,58 ----
protected boolean finished_ = false;
+ protected Stack element_stack_ = new Stack();
+ protected Stack attribute_stack_ = new Stack();
+
+ protected StringBuffer result_ = new StringBuffer();
+
protected HashMap data_map_ = new HashMap();
//----------------------------------------------------------------------
/**
+ * @param finished
+ */
+ public void setFinished(boolean finished)
+ {
+ finished_ = finished;
+ }
+
+ //----------------------------------------------------------------------
+ /**
* @return
*/
***************
*** 44,47 ****
--- 60,126 ----
{
return finished_;
+ }
+
+ //----------------------------------------------------------------------
+ /**
+ * @return
+ */
+ public StringBuffer getResult()
+ {
+ return result_;
+ }
+
+ //----------------------------------------------------------------------
+ /**
+ * @param element the element that should be pushed on the stack
+ */
+ public void pushElement(String element)
+ {
+ element_stack_.push(element);
+ }
+
+ //----------------------------------------------------------------------
+ /**
+ * @return the top element
+ */
+ public String topElement()
+ {
+ return (String)element_stack_.peek();
+ }
+
+ //----------------------------------------------------------------------
+ /**
+ * @return the top element and removes it
+ */
+ public String popElement()
+ {
+ return (String)element_stack_.pop();
+ }
+
+ //----------------------------------------------------------------------
+ /**
+ * @param attributes the attributes that should be pushed on the stack
+ */
+ public void pushAttributes(Attributes attributes)
+ {
+ attribute_stack_.push(attributes);
+ }
+
+ //----------------------------------------------------------------------
+ /**
+ * @return the top attributes
+ */
+ public Attributes topAttributes()
+ {
+ return (Attributes)attribute_stack_.peek();
+ }
+
+ //----------------------------------------------------------------------
+ /**
+ * @return the top attributes and removes it
+ */
+ public Attributes popAttributes()
+ {
+ return (Attributes)attribute_stack_.pop();
}
Index: InitStateMachine.java
===================================================================
RCS file: /cvsroot/xpg-xml/edu/iicm/xpg/statemachine/InitStateMachine.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** InitStateMachine.java 3 Feb 2002 22:10:57 -0000 1.3
--- InitStateMachine.java 7 Feb 2002 09:38:12 -0000 1.4
***************
*** 102,110 ****
{
data_ = new DataObject();
doc_state_machine_ = new PrimitiveStateMachine();
data_.putObject("doc_state_machine", doc_state_machine_);
DFactory transition_factory = new DFactory();
- // FIXXME: searchpath should be read from configfile
- // transition_factory.setSearchPath(new String[]{"edu.iicm.xpg.transitions"});
data_.putObject("transition_factory", transition_factory);
--- 102,110 ----
{
data_ = new DataObject();
+
doc_state_machine_ = new PrimitiveStateMachine();
data_.putObject("doc_state_machine", doc_state_machine_);
+
DFactory transition_factory = new DFactory();
data_.putObject("transition_factory", transition_factory);
***************
*** 160,164 ****
try
{
! dtd_state_machine_.input(new XMLInput(Const.XML_CHARS,chars,start,length));
}
catch(Exception exc)
--- 160,166 ----
try
{
! data_.popElement();
! data_.pushElement(new String(chars));
! dtd_state_machine_.input(new XMLInput(Const.XML_CHARS,chars,start,length));
}
catch(Exception exc)
***************
*** 181,199 ****
try
{
! // FIXXME: attribute-handling in statemachine!
! //System.out.println("startElement: " + name);
! if ( attributes.getLength() > 0 )
! {
! // whole attribtes should be copied into dataObject
! // putting attributes into dataObject doesn't work
! // because parser is modifying them afterwards
! // System.out.println("storing Attributes: " + attributes);
! // System.out.println(" " + name + "attributes: type = " + attributes.getValue("type"));
!
! // data_.putObject(name + "attributes", attributes);
!
! data_.putObject("type", attributes.getValue("type"));
! }
!
dtd_state_machine_.input(new XMLInput(Const.XML_START_TAG,name));
}
--- 183,188 ----
try
{
! data_.pushElement(name);
! data_.pushAttributes(attributes);
dtd_state_machine_.input(new XMLInput(Const.XML_START_TAG,name));
}
***************
*** 217,220 ****
--- 206,211 ----
{
dtd_state_machine_.input(new XMLInput(Const.XML_END_TAG,name));
+ data_.popAttributes();
+ data_.popElement();
}
catch(Exception exc)
Index: PrimitiveStateMachine.java
===================================================================
RCS file: /cvsroot/xpg-xml/edu/iicm/xpg/statemachine/PrimitiveStateMachine.java,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** PrimitiveStateMachine.java 29 Jan 2002 10:43:14 -0000 1.1.1.1
--- PrimitiveStateMachine.java 7 Feb 2002 09:38:12 -0000 1.2
***************
*** 38,42 ****
protected State start_state_;
protected State current_state_;
! protected Object user_data_;
protected int status_;
--- 38,42 ----
protected State start_state_;
protected State current_state_;
! protected DataObject user_data_;
protected int status_;
***************
*** 219,223 ****
*/
! public void setUserDefinedDataObject(Object data)
{
user_data_ = data;
--- 219,223 ----
*/
! public void setUserDefinedDataObject(DataObject data)
{
user_data_ = data;
Index: StateMachine.java
===================================================================
RCS file: /cvsroot/xpg-xml/edu/iicm/xpg/statemachine/StateMachine.java,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** StateMachine.java 29 Jan 2002 10:43:14 -0000 1.1.1.1
--- StateMachine.java 7 Feb 2002 09:38:12 -0000 1.2
***************
*** 144,148 ****
*/
! public void setUserDefinedDataObject(Object data);
//----------------------------------------------------------------------
--- 144,148 ----
*/
! public void setUserDefinedDataObject(DataObject data);
//----------------------------------------------------------------------
Index: Transition.java
===================================================================
RCS file: /cvsroot/xpg-xml/edu/iicm/xpg/statemachine/Transition.java,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** Transition.java 29 Jan 2002 10:43:12 -0000 1.1.1.1
--- Transition.java 7 Feb 2002 09:38:12 -0000 1.2
***************
*** 44,48 ****
public String transitionTriggered(Input input,State from_state,State to_state,
! StateMachine machine,Object data)
throws Exception;
}
--- 44,48 ----
public String transitionTriggered(Input input,State from_state,State to_state,
! StateMachine machine,DataObject data)
throws Exception;
}
|
|
From: G?nther B. <br...@us...> - 2002-02-07 09:29:10
|
Update of /cvsroot/xpg-xml/edu/iicm/xpg/generator
In directory usw-pr-cvs1:/tmp/cvs-serv4126
Modified Files:
Generator.java
Log Message:
DataObject included; Stacks included
Index: Generator.java
===================================================================
RCS file: /cvsroot/xpg-xml/edu/iicm/xpg/generator/Generator.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** Generator.java 30 Jan 2002 16:24:00 -0000 1.3
--- Generator.java 7 Feb 2002 09:29:07 -0000 1.4
***************
*** 29,43 ****
import edu.iicm.xpg.statemachine.XMLInput;
import edu.iicm.xpg.statemachine.Const;
!
! import edu.iicm.xpg.transitions.PrimitiveTransition;
! import edu.iicm.xpg.transitions.StoreDocContentTransition;
! import edu.iicm.xpg.transitions.WriteDocContentTransition;
! import edu.iicm.xpg.transitions.StoreDocAuthorTransition;
! import edu.iicm.xpg.transitions.StoreDocTitleTransition;
! import edu.iicm.xpg.transitions.WriteHeaderTransition;
! import edu.iicm.xpg.transitions.IgnoreCharsTransition;
! import edu.iicm.xpg.transitions.WriteGeneralFooterTransition;
! import edu.iicm.xpg.transitions.StopMachineTransition;
! import edu.iicm.xpg.transitions.WriteGeneralHeaderTransition;
import java.io.FileReader;
--- 29,33 ----
import edu.iicm.xpg.statemachine.XMLInput;
import edu.iicm.xpg.statemachine.Const;
! import edu.iicm.xpg.statemachine.DataObject;
import java.io.FileReader;
***************
*** 61,70 ****
public class Generator extends DefaultHandler
{
- public StringBuffer result_;
- public String doc_title_;
- public String doc_author_;
- public String content_;
- protected boolean finished_;
-
protected final static String XML_READER = "org.apache.xerces.parsers.SAXParser";
--- 51,54 ----
***************
*** 74,90 ****
protected PrimitiveStateMachine doc_state_machine_;
! // machine states
! protected final static String STATE_TOP_LEVEL_FILE = "file top";
! protected final static String STATE_TOP_LEVEL_DOCUMENT = "doc top";
! protected final static String STATE_DOC_INFO_DEF = "doc info def";
! protected final static String STATE_DOC_TITLE_DEF = "doc title def";
! protected final static String STATE_INFO_TITLE_DEF = "info title def";
! protected final static String STATE_DOC_AUTHOR = "doc author def";
! protected final static String STATE_DOC_CONTENT = "doc content";
! protected final static String STATE_FINISHED = "finished";
//----------------------------------------------------------------------
/**
! * @param filename the filename of the form
*/
--- 58,67 ----
protected PrimitiveStateMachine doc_state_machine_;
! protected DataObject data_;
//----------------------------------------------------------------------
/**
! * @param configfile the filename of the configfile
! * @param filename the filename of the inputfile
*/
***************
*** 94,103 ****
{
// set up the statemachine
- // two alternatives: seperate statemachine or hardcoded parser
initializer_ = new InitStateMachine();
- //initializer_ = new InitParser();
initializer_.initialize(configfile);
doc_state_machine_ = initializer_.getStateMachine();
! doc_state_machine_.setUserDefinedDataObject(this);
XMLReader reader = XMLReaderFactory.createXMLReader(XML_READER);
--- 71,79 ----
{
// set up the statemachine
initializer_ = new InitStateMachine();
initializer_.initialize(configfile);
+ data_ = new DataObject();
doc_state_machine_ = initializer_.getStateMachine();
! doc_state_machine_.setUserDefinedDataObject(data_);
XMLReader reader = XMLReaderFactory.createXMLReader(XML_READER);
***************
*** 127,131 ****
public void startDocument()
{
! result_ = new StringBuffer();
doc_state_machine_.initializeMachine();
}
--- 103,107 ----
public void startDocument()
{
! // result_ = new StringBuffer();
doc_state_machine_.initializeMachine();
}
***************
*** 160,164 ****
try
{
! doc_state_machine_.input(new XMLInput(Const.XML_CHARS,chars,start,length));
}
catch(Exception exc)
--- 136,142 ----
try
{
! data_.popElement();
! data_.pushElement(new String(chars));
! doc_state_machine_.input(new XMLInput(Const.XML_CHARS,chars,start,length));
}
catch(Exception exc)
***************
*** 181,185 ****
try
{
! doc_state_machine_.input(new XMLInput(Const.XML_START_TAG,name));
}
catch(Exception exc)
--- 159,165 ----
try
{
! data_.pushElement(name);
! data_.pushAttributes(attributes);
! doc_state_machine_.input(new XMLInput(Const.XML_START_TAG,name));
}
catch(Exception exc)
***************
*** 202,205 ****
--- 182,187 ----
{
doc_state_machine_.input(new XMLInput(Const.XML_END_TAG,name));
+ data_.popAttributes();
+ data_.popElement();
}
catch(Exception exc)
***************
*** 246,260 ****
//----------------------------------------------------------------------
/**
- * @param finished sets the finished variable
- * @return
- */
-
- public void setFinished(boolean finished)
- {
- finished_ = finished;
- }
-
- //----------------------------------------------------------------------
- /**
* @return the object that has been generated
*/
--- 228,231 ----
***************
*** 262,268 ****
public synchronized Object getResult()
{
! return(result_.toString());
}
}
-
--- 233,238 ----
public synchronized Object getResult()
{
! return(data_.getResult().toString());
}
}
|
|
From: G?nther B. <br...@us...> - 2002-02-07 09:27:56
|
Update of /cvsroot/xpg-xml/edu/iicm/xpg/generator
In directory usw-pr-cvs1:/tmp/cvs-serv3347
Modified Files:
DocumentGenerator.java
Log Message:
internal '.xml' ending for filenames removed
Index: DocumentGenerator.java
===================================================================
RCS file: /cvsroot/xpg-xml/edu/iicm/xpg/generator/DocumentGenerator.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** DocumentGenerator.java 30 Jan 2002 16:33:20 -0000 1.2
--- DocumentGenerator.java 7 Feb 2002 09:27:53 -0000 1.3
***************
*** 48,56 ****
if (args.length <= 1)
{
! System.err.println("usage: DocumentGenerator <config_file> <xml_filename>");
System.exit(-1);
}
! Generator generator = new Generator( args[0] + ".xml", args[1] + ".xml" );
String result = ( String ) generator.getResult();
--- 48,57 ----
if (args.length <= 1)
{
! System.err.println("usage: DocumentGenerator <config_file> "
! + "<xml_filename> <result_file>");
System.exit(-1);
}
! Generator generator = new Generator( args[0], args[1] );
String result = ( String ) generator.getResult();
***************
*** 58,69 ****
try
{
! File result_file = new File ( args[1] + ".html" );
! if ( result_file.exists() )
! result_file.delete();
! result_file.createNewFile();
! FileWriter file_writer = new FileWriter ( result_file );
! file_writer.write ( result, 0, result.length() );
! file_writer.flush();
! file_writer.close();
}
catch ( IOException exc )
--- 59,80 ----
try
{
! String result_filename;
! if ( args.length > 2 )
! result_filename = args[2];
! else
! {
! int dot_index = args[1].lastIndexOf('.');
! if (dot_index != -1)
! result_filename = args[1].substring(0, dot_index) + ".html";
! else result_filename = args[1] + ".html";
! }
! File result_file = new File ( result_filename );
! if ( result_file.exists() )
! result_file.delete();
! result_file.createNewFile();
! FileWriter file_writer = new FileWriter ( result_file );
! file_writer.write ( result, 0, result.length() );
! file_writer.flush();
! file_writer.close();
}
catch ( IOException exc )
|
|
From: G?nther B. <br...@us...> - 2002-02-07 09:25:04
|
Update of /cvsroot/xpg-xml/edu/iicm/xpg
In directory usw-pr-cvs1:/tmp/cvs-serv2247
Modified Files:
statemachine.xml
Log Message:
searchpath changed
Index: statemachine.xml
===================================================================
RCS file: /cvsroot/xpg-xml/edu/iicm/xpg/statemachine.xml,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** statemachine.xml 3 Feb 2002 22:23:13 -0000 1.4
--- statemachine.xml 7 Feb 2002 09:25:01 -0000 1.5
***************
*** 1,7 ****
<?xml version="1.0" standalone="no"?>
! <DOCTYPE statemachine SYSTEM "statemachine.dtd">
<statemachine >
! <path>edu.iicm.xpg.transitions</path>
<states>
<startstate>file top</startstate>
--- 1,7 ----
<?xml version="1.0" standalone="no"?>
! <!DOCTYPE statemachine SYSTEM "statemachine.dtd">
<statemachine >
! <path>edu.iicm.xpg.transitions.simple</path>
<states>
<startstate>file top</startstate>
|
|
From: G?nther B. <br...@us...> - 2002-02-03 22:23:16
|
Update of /cvsroot/xpg-xml/edu/iicm/xpg
In directory usw-pr-cvs1:/tmp/cvs-serv19537
Modified Files:
statemachine.xml
Log Message:
searchpath for transitionfactory added
Index: statemachine.xml
===================================================================
RCS file: /cvsroot/xpg-xml/edu/iicm/xpg/statemachine.xml,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** statemachine.xml 2002/01/30 13:43:03 1.3
--- statemachine.xml 2002/02/03 22:23:13 1.4
***************
*** 1,6 ****
<?xml version="1.0" standalone="no"?>
! <!DOCTYPE statemachine SYSTEM "statemachine.dtd">
<statemachine >
<states>
<startstate>file top</startstate>
--- 1,7 ----
<?xml version="1.0" standalone="no"?>
! <DOCTYPE statemachine SYSTEM "statemachine.dtd">
<statemachine >
+ <path>edu.iicm.xpg.transitions</path>
<states>
<startstate>file top</startstate>
***************
*** 129,130 ****
--- 130,132 ----
</transitions>
</statemachine >
+
|
|
From: G?nther B. <br...@us...> - 2002-02-03 22:18:58
|
Update of /cvsroot/xpg-xml/edu/iicm/xpg In directory usw-pr-cvs1:/tmp/cvs-serv18621 Modified Files: statemachine.dtd Log Message: searchpath for transitionfactory added Index: statemachine.dtd =================================================================== RCS file: /cvsroot/xpg-xml/edu/iicm/xpg/statemachine.dtd,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** statemachine.dtd 2002/01/30 13:52:37 1.3 --- statemachine.dtd 2002/02/03 22:18:55 1.4 *************** *** 1,3 **** ! <!ELEMENT statemachine (states,transitions?)> <!ELEMENT states (startstate,state*)> <!ELEMENT transitions (transition*)> --- 1,4 ---- ! <!ELEMENT statemachine (path,states,transitions?)> ! <!ELEMENT path (#PCDATA)> <!ELEMENT states (startstate,state*)> <!ELEMENT transitions (transition*)> *************** *** 10,13 **** <!ELEMENT classname (#PCDATA)> <!ATTLIST element type ( start | end | enddoc ) #REQUIRED> - --- 11,13 ---- |