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-03 22:10:59
|
Update of /cvsroot/xpg-xml/edu/iicm/xpg/statemachine
In directory usw-pr-cvs1:/tmp/cvs-serv16329
Modified Files:
InitStateMachine.java
Log Message:
searchpath added
Index: InitStateMachine.java
===================================================================
RCS file: /cvsroot/xpg-xml/edu/iicm/xpg/statemachine/InitStateMachine.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** InitStateMachine.java 2002/01/31 07:34:46 1.2
--- InitStateMachine.java 2002/02/03 22:10:57 1.3
***************
*** 31,34 ****
--- 31,35 ----
import edu.iicm.xpg.transitions.StoreDataTransition;
import edu.iicm.xpg.transitions.RegisterTransitionTransition;
+ import edu.iicm.xpg.transitions.SetSearchPathTransition;
import org.dinopolis.util.DFactory;
***************
*** 57,61 ****
public class InitStateMachine extends DefaultHandler implements Initializer
{
- // private FileReader file_reader;
protected XMLReader xml_reader;
--- 58,61 ----
***************
*** 68,71 ****
--- 68,72 ----
// XML tags
protected final static String XML_STM_CONFIG = "statemachine";
+ protected final static String XML_PATH_DEF = "path";
protected final static String XML_STATE_LIST = "states";
protected final static String XML_START_STATE_DEF = "startstate";
***************
*** 81,84 ****
--- 82,86 ----
protected final static String STATE_TOP_LEVEL_FILE = "file top";
protected final static String STATE_TOP_LEVEL_DOC_TYPE = "doctype top";
+ protected final static String STATE_PATH_DEF = "path def";
protected final static String STATE_STATE_LIST = "state list";
protected final static String STATE_START_STATE_DEF = "start state def";
***************
*** 104,108 ****
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);
--- 106,110 ----
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);
***************
*** 309,312 ****
--- 311,315 ----
dtd_state_machine_.registerState(new PrimitiveState(),STATE_TOP_LEVEL_FILE);
dtd_state_machine_.registerState(new PrimitiveState(),STATE_TOP_LEVEL_DOC_TYPE);
+ dtd_state_machine_.registerState(new PrimitiveState(),STATE_PATH_DEF);
dtd_state_machine_.registerState(new PrimitiveState(),STATE_STATE_LIST);
dtd_state_machine_.registerState(new PrimitiveState(),STATE_START_STATE_DEF);
***************
*** 345,348 ****
--- 348,356 ----
STATE_TOP_LEVEL_FILE);
+ dtd_state_machine_.registerTransition(new XMLInput(Const.XML_START_TAG,XML_PATH_DEF),
+ new PrimitiveTransition(),
+ STATE_TOP_LEVEL_DOC_TYPE,
+ STATE_PATH_DEF);
+
dtd_state_machine_.registerTransition(new XMLInput(Const.XML_START_TAG,XML_STATE_LIST),
new PrimitiveTransition(),
***************
*** 358,361 ****
--- 366,379 ----
STATE_TOP_LEVEL_DOC_TYPE,
STATE_TOP_LEVEL_DOC_TYPE);
+
+ // STATE_PATH_DEF
+ dtd_state_machine_.registerTransition(new XMLInput(Const.XML_END_TAG,XML_PATH_DEF),
+ new PrimitiveTransition(),
+ STATE_PATH_DEF,
+ STATE_TOP_LEVEL_DOC_TYPE);
+
+ dtd_state_machine_.registerDefaultTransition(new SetSearchPathTransition(),
+ STATE_PATH_DEF,
+ STATE_PATH_DEF);
// STATE_STATE_LIST
|
|
From: G?nther B. <br...@us...> - 2002-02-03 22:05:20
|
Update of /cvsroot/xpg-xml/edu/iicm/xpg/transitions
In directory usw-pr-cvs1:/tmp/cvs-serv14734
Added Files:
SetSearchPathTransition.java
Log Message:
sets the searchpath for the transitionfactory
--- NEW FILE: SetSearchPathTransition.java ---
/***********************************************************************
*
* 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 org.dinopolis.util.DFactory;
import edu.iicm.xpg.statemachine.Transition;
import edu.iicm.xpg.statemachine.StateMachine;
import edu.iicm.xpg.statemachine.Input;
import edu.iicm.xpg.statemachine.XMLInput;
import edu.iicm.xpg.statemachine.State;
import edu.iicm.xpg.statemachine.DataObject;
//----------------------------------------------------------------------
/**
* @author Günther Brand
* @version $Revision: 1.1 $
*/
public class SetSearchPathTransition 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
{
String path = ((XMLInput)input).getValue();
DFactory transition_factory =
(DFactory)((DataObject)data).getObject("transition_factory");
transition_factory.setSearchPath(new String[]{path});
return(null);
}
}
|
|
From: Robert L. <la...@us...> - 2002-02-01 15:04:26
|
Update of /cvsroot/xpg-xml In directory usw-pr-cvs1:/tmp/cvs-serv15441 Added Files: build.xml Log Message: first version of a ant build file. |
|
From: Robert L. <la...@us...> - 2002-02-01 14:39:49
|
Update of /cvsroot/xpg-xml/org In directory usw-pr-cvs1:/tmp/cvs-serv10542 Log Message: Dinopolis Utility Classes Status: Vendor Tag: IICM Release Tags: start N org/dinopolis/util/DFactory.java No conflicts created by this import ***** Bogus filespec: - Imported sources |
|
From: G?nther B. <br...@us...> - 2002-01-31 07:34:49
|
Update of /cvsroot/xpg-xml/edu/iicm/xpg/statemachine
In directory usw-pr-cvs1:/tmp/cvs-serv28789
Modified Files:
InitStateMachine.java
Log Message:
DataObject included; first try of handling attributes
Index: InitStateMachine.java
===================================================================
RCS file: /cvsroot/xpg-xml/edu/iicm/xpg/statemachine/InitStateMachine.java,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** InitStateMachine.java 2002/01/29 10:43:13 1.1.1.1
--- InitStateMachine.java 2002/01/31 07:34:46 1.2
***************
*** 1,493 ****
! /***********************************************************************
! * @(#)$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.
[...966 lines suppressed...]
! STATE_CLASSNAME,
! STATE_CLASSNAME);
!
! File input_file = new File ( filename );
! if (!input_file.exists())
! {
! System.err.println("InitStateMachine: File " + filename + " not existing");
! return;
! }
! FileReader file_reader = new FileReader(input_file);
! xml_reader.parse(new InputSource(file_reader));
! }
! catch (Exception exc)
! {
! exc.printStackTrace();
! }
! }
!
! }
!
|
|
From: G?nther B. <br...@us...> - 2002-01-31 07:33:40
|
Update of /cvsroot/xpg-xml/edu/iicm/xpg/statemachine
In directory usw-pr-cvs1:/tmp/cvs-serv28514
Added Files:
DataObject.java
Log Message:
stores data by using a HashMap
--- NEW FILE: DataObject.java ---
/***********************************************************************
*
* 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.statemachine;
import java.util.HashMap;
//----------------------------------------------------------------------
/**
* @author Günther Brand
* @version $revision$
*/
public class DataObject
{
protected boolean finished_ = false;
protected HashMap data_map_ = new HashMap();
//----------------------------------------------------------------------
/**
* @return
*/
public boolean isFinished()
{
return finished_;
}
//----------------------------------------------------------------------
/**
* @param key a description of the stored data
* @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);
}
//----------------------------------------------------------------------
/**
* @param key the identificator of the stored data
* @return the dataobject
*/
public Object getObject(String key)
{
return data_map_.get(key);
}
//----------------------------------------------------------------------
/**
* @param key the identificator of the stored data
* @return the dataobject
*/
public Object takeObject(String key)
{
return data_map_.remove(key);
}
}
|
|
From: G?nther B. <br...@us...> - 2002-01-31 07:31:46
|
Update of /cvsroot/xpg-xml/edu/iicm/xpg/transitions
In directory usw-pr-cvs1:/tmp/cvs-serv28027
Modified Files:
StoreDataTransition.java
Log Message:
DataObject included
Index: StoreDataTransition.java
===================================================================
RCS file: /cvsroot/xpg-xml/edu/iicm/xpg/transitions/StoreDataTransition.java,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** StoreDataTransition.java 2002/01/29 10:43:16 1.1.1.1
--- StoreDataTransition.java 2002/01/31 07:31:43 1.2
***************
*** 1,97 ****
! /***********************************************************************
! * @(#)$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.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.InitUserData;
!
! //----------------------------------------------------------------------
! /**
! * @author Klaus Schmaranz
! * @author Günther Brand
! * @version $Revision$
! */
!
! public class StoreDataTransition implements Transition
! {
! public static final int BEGINSTATE = 1;
! public static final int NEXTSTATE = 2;
! public static final int ELEMENT = 3;
! public static final int CLASSNAME = 4;
!
! private int data_type;
!
! public StoreDataTransition(int type)
! {
! data_type = type;
! }
!
! //----------------------------------------------------------------------
! /**
! * @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
! {
! if (from_state != to_state)
! {
! System.out.println("StoreDataTransition: differentStates!");
! return(null);
! }
!
! switch (data_type)
! {
! case BEGINSTATE:
! ((InitUserData)data).beginstate = ((XMLInput)input).getValue();
! break;
! case NEXTSTATE:
! ((InitUserData)data).nextstate = ((XMLInput)input).getValue();
! break;
! case ELEMENT:
! ((InitUserData)data).element = ((XMLInput)input).getValue();
! ((InitUserData)data).default_transition = false;
! break;
! case CLASSNAME:
! ((InitUserData)data).classname = ((XMLInput)input).getValue();
! break;
! default: System.err.println("StoreDataTransition: illegal datatype!");
! }
!
! return(null);
! }
! }
!
!
--- 1,100 ----
! /***********************************************************************
! * @(#)$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.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$
! */
!
! public class StoreDataTransition implements Transition
! {
! public static final int BEGINSTATE = 1;
! public static final int NEXTSTATE = 2;
! public static final int ELEMENT = 3;
! public static final int CLASSNAME = 4;
!
! private int data_type_;
!
! public StoreDataTransition(int type)
! {
! data_type_ = type;
! }
!
! //----------------------------------------------------------------------
! /**
! * @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
! {
! if (from_state != to_state)
! {
! System.out.println("StoreDataTransition: differentStates!");
! return(null);
! }
!
! switch (data_type_)
! {
! 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!");
! }
!
! return(null);
! }
! }
!
!
|
|
From: G?nther B. <br...@us...> - 2002-01-31 07:30:34
|
Update of /cvsroot/xpg-xml/edu/iicm/xpg/transitions
In directory usw-pr-cvs1:/tmp/cvs-serv27747
Modified Files:
RegisterTransitionTransition.java
Log Message:
DataObject included; getting StateMachine and TransitionFactory out of this
Index: RegisterTransitionTransition.java
===================================================================
RCS file: /cvsroot/xpg-xml/edu/iicm/xpg/transitions/RegisterTransitionTransition.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** RegisterTransitionTransition.java 2002/01/30 10:23:40 1.2
--- RegisterTransitionTransition.java 2002/01/31 07:30:31 1.3
***************
*** 1,105 ****
! /***********************************************************************
! * @(#)$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.Transition;
! import edu.iicm.xpg.statemachine.PrimitiveStateMachine;
! import edu.iicm.xpg.statemachine.StateMachine;
! import edu.iicm.xpg.statemachine.Input;
! import edu.iicm.xpg.statemachine.XMLInput;
! import edu.iicm.xpg.statemachine.PrimitiveState;
! import edu.iicm.xpg.statemachine.State;
! import edu.iicm.xpg.statemachine.InitUserData;
!
! import edu.iicm.xpg.transitions.ClassLoaderTransition;
!
! //----------------------------------------------------------------------
! /**
! * @author Günther Brand
! * @version $Revision$
! */
!
! public class RegisterTransitionTransition implements Transition
! {
! private PrimitiveStateMachine doc_state_machine_;
!
! public RegisterTransitionTransition ( PrimitiveStateMachine stm )
! {
! doc_state_machine_ = stm;
! }
!
! //----------------------------------------------------------------------
! /**
! * @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
! {
! String beginstate = ((InitUserData)data).beginstate;
! String nextstate = ((InitUserData)data).nextstate;
! String classname = ((InitUserData)data).classname;
!
! Transition transition = new ClassLoaderTransition(classname);
!
! if (((InitUserData)data).default_transition)
! {
! doc_state_machine_.registerDefaultTransition(transition,
! beginstate,
! nextstate);
! }
! else
! {
! String element = ((InitUserData)data).element;
! XMLInput xml_input;
! if (((InitUserData)data).enddoc)
! xml_input = new XMLInput(Const.XML_END_DOCUMENT,null);
! else if (((InitUserData)data).element_start)
! xml_input = new XMLInput(Const.XML_START_TAG,element);
! else xml_input = new XMLInput(Const.XML_END_TAG,element);
!
! doc_state_machine_.registerTransition(xml_input,
! transition,
! beginstate,
! nextstate);
! }
!
! ((InitUserData)data).default_transition = true;
! ((InitUserData)data).enddoc = false;
! ((InitUserData)data).element = null;
!
! return(null);
! }
!
! }
!
!
--- 1,118 ----
! /***********************************************************************
! * @(#)$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 org.xml.sax.Attributes;
!
! import org.dinopolis.util.DFactory;
!
! import edu.iicm.xpg.statemachine.Const;
! import edu.iicm.xpg.statemachine.Transition;
! import edu.iicm.xpg.statemachine.PrimitiveStateMachine;
! import edu.iicm.xpg.statemachine.StateMachine;
! import edu.iicm.xpg.statemachine.Input;
! import edu.iicm.xpg.statemachine.XMLInput;
! import edu.iicm.xpg.statemachine.PrimitiveState;
! import edu.iicm.xpg.statemachine.State;
! import edu.iicm.xpg.statemachine.DataObject;
!
! import edu.iicm.xpg.transitions.ClassLoaderTransition;
!
! //----------------------------------------------------------------------
! /**
! * @author Günther Brand
! * @version $Revision$
! */
!
! public class RegisterTransitionTransition 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
! {
! 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 =
! new ClassLoaderTransition(transition_factory,classname);
!
! // if there exists no elementtag then its a default-transition
! if ( element == null )
! {
! doc_state_machine_.registerDefaultTransition(transition,
! beginstate,
! nextstate);
! }
! else
! {
! XMLInput xml_input;
!
! // storage of whole attributes-object doesn't work yet
! // Attributes attributes =
! // (Attributes)((DataObject)data).takeObject("elementattributes");
! // String type = attributes.getValue("type");
!
! String type = (String)((DataObject)data).takeObject("type");
!
! // System.out.println("fetching Attributes: " + attributes);
! // System.out.println(" type = " + type);
!
! if (type.equals("enddoc"))
! xml_input = new XMLInput(Const.XML_END_DOCUMENT,null);
! else if (type.equals("start"))
! xml_input = new XMLInput(Const.XML_START_TAG,element);
! else xml_input = new XMLInput(Const.XML_END_TAG,element);
!
! doc_state_machine_.registerTransition(xml_input,
! transition,
! beginstate,
! nextstate);
! }
!
! return(null);
! }
!
! }
!
!
|
|
From: G?nther B. <br...@us...> - 2002-01-31 07:28:51
|
Update of /cvsroot/xpg-xml/edu/iicm/xpg/transitions
In directory usw-pr-cvs1:/tmp/cvs-serv27210
Modified Files:
RegisterStateTransition.java
Log Message:
DataObject included
Index: RegisterStateTransition.java
===================================================================
RCS file: /cvsroot/xpg-xml/edu/iicm/xpg/transitions/RegisterStateTransition.java,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** RegisterStateTransition.java 2002/01/29 10:43:16 1.1.1.1
--- RegisterStateTransition.java 2002/01/31 07:28:48 1.2
***************
*** 1,72 ****
! /***********************************************************************
! * @(#)$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.Transition;
! import edu.iicm.xpg.statemachine.PrimitiveStateMachine;
! import edu.iicm.xpg.statemachine.StateMachine;
! import edu.iicm.xpg.statemachine.Input;
! import edu.iicm.xpg.statemachine.XMLInput;
! import edu.iicm.xpg.statemachine.PrimitiveState;
! import edu.iicm.xpg.statemachine.State;
!
! //----------------------------------------------------------------------
! /**
! * @author Günther Brand
! * @version $Revision$
! */
!
! public class RegisterStateTransition implements Transition
! {
! private PrimitiveStateMachine doc_state_machine_;
!
! public RegisterStateTransition ( PrimitiveStateMachine stm )
! {
! doc_state_machine_ = stm;
! }
!
! //----------------------------------------------------------------------
! /**
! * @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
! {
! String state = ((XMLInput)input).getValue();
! doc_state_machine_.registerState(new PrimitiveState(),state);
!
! return(null);
! }
!
! }
!
!
--- 1,69 ----
! /***********************************************************************
! * @(#)$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.Transition;
! import edu.iicm.xpg.statemachine.PrimitiveStateMachine;
! import edu.iicm.xpg.statemachine.StateMachine;
! import edu.iicm.xpg.statemachine.Input;
! import edu.iicm.xpg.statemachine.XMLInput;
! import edu.iicm.xpg.statemachine.PrimitiveState;
! import edu.iicm.xpg.statemachine.State;
! import edu.iicm.xpg.statemachine.DataObject;
!
! //----------------------------------------------------------------------
! /**
! * @author Günther Brand
! * @version $Revision$
! */
!
! public class RegisterStateTransition 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
! {
! 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);
! }
!
! }
!
!
|
|
From: G?nther B. <br...@us...> - 2002-01-31 07:28:06
|
Update of /cvsroot/xpg-xml/edu/iicm/xpg/transitions
In directory usw-pr-cvs1:/tmp/cvs-serv27040
Modified Files:
RegisterStartStateTransition.java
Log Message:
DataObject included
Index: RegisterStartStateTransition.java
===================================================================
RCS file: /cvsroot/xpg-xml/edu/iicm/xpg/transitions/RegisterStartStateTransition.java,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** RegisterStartStateTransition.java 2002/01/29 10:43:16 1.1.1.1
--- RegisterStartStateTransition.java 2002/01/31 07:28:04 1.2
***************
*** 1,74 ****
! /***********************************************************************
! * @(#)$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.Transition;
! import edu.iicm.xpg.statemachine.PrimitiveStateMachine;
! import edu.iicm.xpg.statemachine.StateMachine;
! import edu.iicm.xpg.statemachine.Input;
! import edu.iicm.xpg.statemachine.XMLInput;
! import edu.iicm.xpg.statemachine.PrimitiveState;
! import edu.iicm.xpg.statemachine.State;
!
! //----------------------------------------------------------------------
! /**
! * @author Günther Brand
! * @version $Revision$
! */
!
! public class RegisterStartStateTransition implements Transition
! {
! private PrimitiveStateMachine doc_state_machine_;
!
! public RegisterStartStateTransition ( PrimitiveStateMachine stm )
! {
! doc_state_machine_ = stm;
! }
!
! //----------------------------------------------------------------------
! /**
! * @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
! {
! String state = ((XMLInput)input).getValue();
!
! doc_state_machine_.registerState(new PrimitiveState(),state);
! doc_state_machine_.setStartState(state);
!
! return(null);
! }
!
! }
!
!
--- 1,72 ----
! /***********************************************************************
! * @(#)$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.Transition;
! import edu.iicm.xpg.statemachine.PrimitiveStateMachine;
! import edu.iicm.xpg.statemachine.StateMachine;
! import edu.iicm.xpg.statemachine.Input;
! import edu.iicm.xpg.statemachine.XMLInput;
! import edu.iicm.xpg.statemachine.PrimitiveState;
! import edu.iicm.xpg.statemachine.State;
! import edu.iicm.xpg.statemachine.DataObject;
!
! //----------------------------------------------------------------------
! /**
! * @author Günther Brand
! * @version $Revision$
! */
!
! public class RegisterStartStateTransition 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
! {
! String state = ((XMLInput)input).getValue();
!
! 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);
! }
!
! }
!
!
|
|
From: G?nther B. <br...@us...> - 2002-01-31 07:25:58
|
Update of /cvsroot/xpg-xml/edu/iicm/xpg/transitions
In directory usw-pr-cvs1:/tmp/cvs-serv26618
Modified Files:
ClassLoaderTransition.java
Log Message:
DataObject included and gets transition_factory in constructor
Index: ClassLoaderTransition.java
===================================================================
RCS file: /cvsroot/xpg-xml/edu/iicm/xpg/transitions/ClassLoaderTransition.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** ClassLoaderTransition.java 2002/01/30 10:24:49 1.1
--- ClassLoaderTransition.java 2002/01/31 07:25:56 1.2
***************
*** 39,50 ****
public class ClassLoaderTransition implements Transition
{
! private DFactory transition_factory_;
! private String classname_;
! public ClassLoaderTransition ( String classname )
{
classname_ = classname;
! transition_factory_ = new DFactory();
! transition_factory_.setSearchPath(new String[]{"edu.iicm.xpg.transitions"});
}
--- 39,50 ----
public class ClassLoaderTransition implements Transition
{
! protected DFactory transition_factory_;
! protected String classname_;
! // FIXXME ??
! public ClassLoaderTransition( DFactory transition_factory, String classname )
{
classname_ = classname;
! transition_factory_ = transition_factory;
}
***************
*** 64,69 ****
throws Exception
{
! Transition transition =
! (Transition)transition_factory_.getInstance(classname_);
transition.transitionTriggered(input, from_state, to_state, machine, data);
--- 64,69 ----
throws Exception
{
! Transition transition =
! (Transition)transition_factory_.getInstance(classname_);
transition.transitionTriggered(input, from_state, to_state, machine, data);
|
|
From: Stefan T. <th...@us...> - 2002-01-30 16:33:24
|
Update of /cvsroot/xpg-xml/edu/iicm/xpg/generator
In directory usw-pr-cvs1:/tmp/cvs-serv8793
Modified Files:
DocumentGenerator.java
Log Message:
dos2unix
Index: DocumentGenerator.java
===================================================================
RCS file: /cvsroot/xpg-xml/edu/iicm/xpg/generator/DocumentGenerator.java,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** DocumentGenerator.java 2002/01/29 10:43:15 1.1.1.1
--- DocumentGenerator.java 2002/01/30 16:33:20 1.2
***************
*** 1,79 ****
! /***********************************************************************
! * @(#)$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.generator;
!
! import java.io.FileWriter;
! import java.io.File;
! import java.io.IOException;
!
! //----------------------------------------------------------------------
! /**
! * @author Klaus Schmaranz
! * @author Heimo Haub
! * @author Günther Brand
! * @version $revision$
! */
!
! public class DocumentGenerator
! {
!
! //----------------------------------------------------------------------
! /**
! * @param args command line arguments
! * @return the exit value
! */
!
! public static void main(String[] args)
! {
! 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();
!
! // write resultstring to file
! 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 )
! {
! System.err.println ( exc );
! }
!
! System.exit(0);
! }
! }
!
!
--- 1,78 ----
! /***********************************************************************
! * @(#)$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.generator;
!
! import java.io.FileWriter;
! import java.io.File;
! import java.io.IOException;
!
! //----------------------------------------------------------------------
! /**
! * @author Klaus Schmaranz
! * @author Heimo Haub
! * @author Günther Brand
! * @version $revision$
! */
!
! public class DocumentGenerator
! {
!
! //----------------------------------------------------------------------
! /**
! * @param args command line arguments
! * @return the exit value
! */
!
! public static void main(String[] args)
! {
! 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();
!
! // write resultstring to file
! 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 )
! {
! System.err.println ( exc );
! }
!
! System.exit(0);
! }
! }
!
!
|
|
From: Stefan T. <th...@us...> - 2002-01-30 16:24:04
|
Update of /cvsroot/xpg-xml/edu/iicm/xpg/generator
In directory usw-pr-cvs1:/tmp/cvs-serv5287/generator
Modified Files:
Generator.java
Log Message:
windows auf unix
Index: Generator.java
===================================================================
RCS file: /cvsroot/xpg-xml/edu/iicm/xpg/generator/Generator.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** Generator.java 2002/01/29 16:25:26 1.2
--- Generator.java 2002/01/30 16:24:00 1.3
***************
*** 1,269 ****
! // $Header$
! /***********************************************************************
! * @(#)$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.generator;
!
! import edu.iicm.xpg.statemachine.PrimitiveStateMachine;
! import edu.iicm.xpg.statemachine.Initializer;
! import edu.iicm.xpg.statemachine.InitStateMachine;
! 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;
! import java.io.File;
! import org.xml.sax.XMLReader;
! import org.xml.sax.InputSource;
! import org.xml.sax.Attributes;
! import org.xml.sax.SAXParseException;
! import org.xml.sax.helpers.XMLReaderFactory;
! import org.xml.sax.helpers.DefaultHandler;
!
! //----------------------------------------------------------------------
! /**
! * @author Klaus Schmaranz
! * @author Heimo Haub
! * @author Günther Brand
! * @author Stefan Thalauer
! * @version $revision$
! */
!
! 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";
!
! // two alternatives: seperate statemachine or hardcoded parser
! protected Initializer initializer_;
!
! 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
! */
!
! public Generator(String configfile, String filename)
! {
! try
! {
! // 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);
! reader.setContentHandler(this);
! reader.setErrorHandler(this);
! File input_file = new File(filename);
! if (!input_file.exists())
! {
! System.err.println("Generator: File " + filename + " not existing");
! System.exit(-1);
! }
! FileReader file_reader = new FileReader(input_file);
! // System.out.println("\n ---> start parsing document!\n");
! reader.parse(new InputSource(file_reader));
! }
! catch (Exception exc)
! {
! exc.printStackTrace();
! }
! }
!
! //----------------------------------------------------------------------
! /**
! * @return
! */
!
! public void startDocument()
! {
! result_ = new StringBuffer();
! doc_state_machine_.initializeMachine();
! }
!
! //----------------------------------------------------------------------
! /**
! * @return
! */
!
! public synchronized void endDocument()
! {
! try
! {
! doc_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
! {
! doc_state_machine_.input(new XMLInput(Const.XML_CHARS,chars,start,length));
! }
! catch(Exception exc)
! {
! exc.printStackTrace();
! }
! }
!
! //----------------------------------------------------------------------
! /**
! * @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
! {
! doc_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
! {
! doc_state_machine_.input(new XMLInput(Const.XML_END_TAG,name));
! }
! catch(Exception exc)
! {
! exc.printStackTrace();
! }
! }
!
! //----------------------------------------------------------------------
! /**
! * @param exc the error that occured
! * @return
! */
!
! public void error(SAXParseException exc)
! {
! System.err.println("SAX Error: " + exc.getMessage());
! }
!
! //----------------------------------------------------------------------
! /**
! * @param exc the error that occured
! * @return
! */
!
! public void fatalError(SAXParseException exc)
! {
! System.err.println("SAX Fatal Error: " + exc.getMessage());
! System.exit(-2);
! }
!
! //----------------------------------------------------------------------
! /**
! * @param exc the warning that occured
! * @return
! */
!
! public void warning(SAXParseException exc)
! {
! System.err.println("SAX Warning: " + exc.getMessage());
! exc.printStackTrace();
! }
!
! //----------------------------------------------------------------------
! /**
! * @param finished sets the finished variable
! * @return
! */
!
! public void setFinished(boolean finished)
! {
! finished_ = finished;
! }
!
! //----------------------------------------------------------------------
! /**
! * @return the object that has been generated
! */
!
! public synchronized Object getResult()
! {
! return(result_.toString());
! }
! }
!
!
--- 1,268 ----
! /***********************************************************************
! * @(#)$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.generator;
!
! import edu.iicm.xpg.statemachine.PrimitiveStateMachine;
! import edu.iicm.xpg.statemachine.Initializer;
! import edu.iicm.xpg.statemachine.InitStateMachine;
! 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;
! import java.io.File;
! import org.xml.sax.XMLReader;
! import org.xml.sax.InputSource;
! import org.xml.sax.Attributes;
! import org.xml.sax.SAXParseException;
! import org.xml.sax.helpers.XMLReaderFactory;
! import org.xml.sax.helpers.DefaultHandler;
!
! //----------------------------------------------------------------------
! /**
! * @author Klaus Schmaranz
! * @author Heimo Haub
! * @author Günther Brand
! * @author Stefan Thalauer
! * @version $revision$
! */
!
! 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";
!
! // two alternatives: seperate statemachine or hardcoded parser
! protected Initializer initializer_;
!
! 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
! */
!
! public Generator(String configfile, String filename)
! {
! try
! {
! // 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);
! reader.setContentHandler(this);
! reader.setErrorHandler(this);
! File input_file = new File(filename);
! if (!input_file.exists())
! {
! System.err.println("Generator: File " + filename + " not existing");
! System.exit(-1);
! }
! FileReader file_reader = new FileReader(input_file);
! // System.out.println("\n ---> start parsing document!\n");
! reader.parse(new InputSource(file_reader));
! }
! catch (Exception exc)
! {
! exc.printStackTrace();
! }
! }
!
! //----------------------------------------------------------------------
! /**
! * @return
! */
!
! public void startDocument()
! {
! result_ = new StringBuffer();
! doc_state_machine_.initializeMachine();
! }
!
! //----------------------------------------------------------------------
! /**
! * @return
! */
!
! public synchronized void endDocument()
! {
! try
! {
! doc_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
! {
! doc_state_machine_.input(new XMLInput(Const.XML_CHARS,chars,start,length));
! }
! catch(Exception exc)
! {
! exc.printStackTrace();
! }
! }
!
! //----------------------------------------------------------------------
! /**
! * @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
! {
! doc_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
! {
! doc_state_machine_.input(new XMLInput(Const.XML_END_TAG,name));
! }
! catch(Exception exc)
! {
! exc.printStackTrace();
! }
! }
!
! //----------------------------------------------------------------------
! /**
! * @param exc the error that occured
! * @return
! */
!
! public void error(SAXParseException exc)
! {
! System.err.println("SAX Error: " + exc.getMessage());
! }
!
! //----------------------------------------------------------------------
! /**
! * @param exc the error that occured
! * @return
! */
!
! public void fatalError(SAXParseException exc)
! {
! System.err.println("SAX Fatal Error: " + exc.getMessage());
! System.exit(-2);
! }
!
! //----------------------------------------------------------------------
! /**
! * @param exc the warning that occured
! * @return
! */
!
! public void warning(SAXParseException exc)
! {
! System.err.println("SAX Warning: " + exc.getMessage());
! exc.printStackTrace();
! }
!
! //----------------------------------------------------------------------
! /**
! * @param finished sets the finished variable
! * @return
! */
!
! public void setFinished(boolean finished)
! {
! finished_ = finished;
! }
!
! //----------------------------------------------------------------------
! /**
! * @return the object that has been generated
! */
!
! public synchronized Object getResult()
! {
! return(result_.toString());
! }
! }
!
!
|
|
From: Stefan T. <th...@us...> - 2002-01-30 14:04:30
|
Update of /cvsroot/xpg-xml/edu/iicm/xpg In directory usw-pr-cvs1:/tmp/cvs-serv25447 Added Files: test0.xml Log Message: wegen windows |
|
From: Stefan T. <th...@us...> - 2002-01-30 14:02:59
|
Update of /cvsroot/xpg-xml/edu/iicm/xpg In directory usw-pr-cvs1:/tmp/cvs-serv24348 Removed Files: test0.xml Log Message: wegen windows --- test0.xml DELETED --- |