Dave Kuhlman
http://www.rexx.com/~dkuhlman
Email: [email protected]
Release 1.01
Feb 20, 2003
Copyright (c) 2003 Dave Kuhlman
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Our goal is to expose BP (business processes) or WFs (workflows) across the Web in a REST style. This document describes facilities for generating the skeleton of Web applications that run on top of the Quixote application server. We can perform this process in two steps:
This document describes support for the second stage of this process (i.e. generating an application skeleton).
A few implications:
Samples and example code are available in workflow_examples.zip.
Note that portions of this code were taken from flux. You can find flux at http://sourceforge.net/projects/lleu. You should consult the flux license, and I hope you will respect it.
Here is a brief description of fluxappgen:
Here is the help message produced by typing "python fluxappgen.py -h":
python fluxappgen.py -h Usage: python fluxappgen.py [ options ] <infilename> [ <outname> ] Options: -s, --state <module> Module implementing parser and data structures for XML doc. -m, --mode <mode> Modes -- See below. Modes: package_class Generate Quixote/REST app. Container: package State: module/class module_class Generate Quixote/FSM/REST app. Container: module State: class module_function Generate Quixote/FSM/REST app. Container: module State: function test1 Generate some classes and XML output. test2 Read an XML file, create classes, and re-generate XML output. Examples: python fluxappgen.py -m package_class workflow1.xml WorkflowAppDir python fluxappgen.py -m module_class workflow1.xml workflow1.py python fluxappgen.py -m module_function workflow1.xml workflow1.py python fluxappgen.py -m test1 python fluxappgen.py -m test1 > workflow1.xml python fluxappgen.py -m test2 workflow1.xml
And here is some explanation for the different modes or operations:
fsmappgen also generates skeletons of REST/FSM applications that run on top of Quixote. It produces applications very similar to those produced by fluxappgen. The input FSM/XML document is different, but similar. The classes that represent the elements in the FSM/XML document were initially generated by generateDS.py (http://www.rexx.com/~dkuhlman/#generateDS), and then extended, e.g., with the capability to generate the Quixote/FSM/REST application.
Here is the help message produced by typing "python fsmappgen.py -h":
Usage: python fsmappgen.py [ options ] <infilename> <outname> Options: -s, --state <module> Module implementing parser and data structures for XML doc. -m, --mode <mode> See below. Modes: package_class Generate Quixote/REST app. Container: package State: module/class module_class Generate Quixote/REST app. Container: module State: class module_function Generate Quixote/REST app. Container: module State: function wxg Generate .wxg file for wxGlade Examples: python fsmappgen.py -m package_class workflow1.xml WorkflowAppDir python fsmappgen.py -m module_class fsm1.xml app1.py python fsmappgen.py -m module_function fsm1.xml app1.py python fsmappgen.py -m wxg fsm1.xml test.wxg
And here is some explanation for the different modes or operations:
This section makes the following assumptions: First, you are dissatisfied with the two application generators described above (fluxappgen and fsmappgen). Second, your application can be described by an FSM (or an FSM digraph). And, third, that you have a representation of your application in an FSM/XML document.
The first option you should consider is to begin with the source code for either fluxappgen or fsmappgen and then to extend and modify that implementation. If you choose this strategy, I'll assume that you can figure out the source code for yourself. The remainder of this section, therefore, discusses implementation an application generator from scratch. However, since that strategy is the same one used to implement fluxappgen and fsmappgen, the following discussion may of use in learning how to modify and rework either fluxappgen or fsmappgen.
Implementing an application generator is easier than you might think. Some of the infrastructure and tools are available. And, the rest follows a very orderly process. There are also examples in workflow_examples.zip. Here, briefly, are the steps in that process:
python generateDS.py -o mysups.py fsm.xsd python generateDS.py -s mysubs.py fsm.xsd
Or, combining the above into one operation:
python generateDS.py -o mysups.py -s mysubs.py fsm.xsd
An alternative is to use the flux FSM document definition. For example:
python generateDS.py -o mysups.py -s mysubs.py flux.xsd
While it is relatively easy to implement client applications that interact with the FSM REST server-side applications that we've seen generated above, creating a graphical user interface (GUI) to accept input information from a human user so that it can be fed to the server application is a more problematic and laborious task. This section describes a feature of fsmappgen that can save a great deal of the labor involved in completing that task.
The FSM XML document that describes an FSM (the same document type from which we generated application skeletons (above) contains specifications of input items. This capability enables you to generate a Python module containing a wxPython frame for each state in your FSM. This frame contains a wxPython input control for each input item specified in the FSM XML document.
This capability works are follows:
In order to use this, you will need to install wxPython and wxGlade.
python fsmappgen -m wxg fsm_plants.xml test.wxg
This will produce a file test.wxg, which is an XML file that contains the GUI definition.
Note that the Python code will be generated into the directory and file that is stored in the .wxg file (in the path attribute of the application element). fsmappgen sets this to the same directory and file name as the .wxg file with ``wxg'' replaced with ``py''. You can change this in wxGlade in the application property dialog.
Thanks to the implementors of Quixote for producing an exceptionally usable application server that is so suitable for REST.
Thanks to Juan David Ibáñez Palomar <[email protected]> for flux.
Thanks to Alberto Griggio <[email protected]> for wxGlade.
See Also:
This document was generated using the LaTeX2HTML translator.
LaTeX2HTML is Copyright © 1993, 1994, 1995, 1996, 1997, Nikos Drakos, Computer Based Learning Unit, University of Leeds, and Copyright © 1997, 1998, Ross Moore, Mathematics Department, Macquarie University, Sydney.
The application of LaTeX2HTML to the Python documentation has been heavily tailored by Fred L. Drake, Jr. Original navigation icons were contributed by Christopher Petrilli.