[albatross-users] An application generator for Albatross - preliminary work

Dave Kuhlman dkuhlman at cutter.rexx.com
Fri Jul 5 10:05:20 EST 2002


Attached is support I've been working on to enable developers to
generate Albatross applications from an application description. 
Actually, the application description is an XML document that
contains a specification of an FSM (finite state machine).

Here is a bit of rational, or,  Why I'm doing this -- I believe
that business analysts (those who design and manage applications,
but who are not programmers) want to produce Web applications or
Web services from an application specification.  In the Web
services world, they are busily at work defining a variety of PMLs
(process markup languages), for example WSFL, WSCI, XLANG, UML,
etc.  I believe that some of the content of a PML can be mapped
onto or translated into an FSM and then into an Albatross
application in two stages:

    PML --> FSM --> Albatross application

What is attached is an attempt at the 2nd stage of this
translation.

You will need to install PyXML in order generate an application. 

However, if you only want to look at samples of the files
generated, I've generated a few.  Look in the sub-directories
appgen/TestObject and appgen/TestModular.

The attachment contains documentation generated with the Python
LaTex2HTML tool-set.  (Give someone a powerful tool and they
become dangerous.  Heh, heh. Heh, heh.) I've included a text
version below.

I'm very interested in any ideas, comments, and suggestions.

  - Dave K


                     An Application Generator for Albatross                  

     ----------------------------------------------------------------------

                     An Application Generator for Albatross

                                  Dave Kuhlman

                           E-mail: dkuhlman at rexx.com

                                  Release 1.0
                                  July 2, 2002

                                  Front Matter

  Abstract:

   This document describes the use of fsmlib to generate skeleton Albatross
   applications. fsmlib can take an XML representation of an FSM (finite
   state machine) and generate an Albatross application containing a page for
   each state in the FSM. Both Python code and HTML Albatross template files
   are generated.

Contents

     * Front Matter
          * 1 Introduction - What It Does
          * 2 How-to Use it
               * 2.1 Commands
               * 2.2 Options
          * 3 Input - Defining the FSM XML Document
               * 3.1 Element fsm
               * 3.2 Element endstatenames
               * 3.3 Element state
               * 3.4 Element transition
               * 3.5 Element inputs
     * License, See also, Etc.
     * About this document ...

                                        
                         1 Introduction - What It Does

   fsmlib generates the skeleton of an Albatross application.

   It takes an XML document that describes the pages in the application.

   The XML input document describes an FSM (finite state machine). The XML
   FSM document a list of states. Each state in the FSM describes a page in
   the application. Each state in the FSM (or page in the application)
   contains a list of transitions. Each transition specifies (1) a target
   state (page) and (2) the conditions (a button to be pressed and input
   items to be entered) that must occur in order to go-to that target state
   (page).

   For each state in the FSM fsmlib generates Python code and (optionally) an
   HTML template file for one page in the application. For each transition,
   fsmlib generates Python code to activate that transition. In particular,
   for each transition, Python code is generated to test for the button and
   to test the values of the specified input items.

   The XML input document is described in detail in the section ``Defining
   the FSM XML Document''3.

                                        
                                2 How-to Use it

   The ability to load an FSM document and generate an Albatross application
   from it are in module fsmlib.

   A Python script (runAppGen.py) is provided as a harness to call the
   application generation functionality in fsmlib.

   Here is the help message for runAppGen.py:

 Usage:
     python testGen.py <command> [ <option> ] <in_file_name> <out_file_name>

 Commands:
     -o    Generate object-based Albatross application.
     -m    Generate modular Albatross application.
     -h    Display this help.

 Options:
     -p    Generate HTML template files.

 Examples:
     python testGen.py -o fsm_app1.xml dispatch.py
         Generate object-based Albatross application.

     python testGen.py -m -p fsm_app2.xml dispatch.py
         Generate modular Albatross application and generate
             HTML template files.

2.1 Commands

   -o
           Generate an object-based Albatross application. An object-based
           application is one which contains a module containing a class for
           each page. These classes and the initialization code for the
           application are written to out_file_name.

   -m
           Generate a modular Albatross application. A modular application
           contains one python module for each page in the application. Each
           module contains functions page_process, page_display, etc. The
           application initialization code and top-level logic is written to
           file out_file_name.

2.2 Options

   -p
           Generate an Albatross HTML template page file for each state in
           the FSM. The generated file contains a button and input items for
           the button and input items specified in each transition for the
           state. Note: Since one file is generated in the current directory
           for each state (page) in the application, you may want to change
           to an empty directory before using the -p option.

                                        
                    3 Input - Defining the FSM XML Document

   The file fsm1.xml contains a sample XML FSM document.

   The file fsm.xsd contains an XSchema description of XML FSM documents.

   Here is a description of the elements in the XML FSM document:

3.1 Element fsm

     * name -- The name of the FSM or application.

     * lastmodified -- The date of the most recent modification of this
       document.

     * description -- A description of this application.

     * currentstate -- The current state. This element might be used when
       saving an FSM during execution.

     * startstatename -- The start or initial state (page) for the FSM.

     * endstatenames -- A list of the names of the end/last states or pages
       in the application.

     * state -- A definition of one of the states (pages) in the application.

3.2 Element endstatenames

     * endstatename -- The name of one of the end or final states (pages) in
       the application.

3.3 Element state

     * name -- The name of the state. Note: The page name can be different
       and is specified by pagename.

     * pagename -- The name of the page associated with this state.

     * transition -- A definition of a transition from this state (page) to
       another state (page).

3.4 Element transition

     * button -- The button which must be pressed in order for this
       transition to be activated. Python code is generated (in the function
       page_process) to test whether this button was pressed.

     * inputs -- A list of inputs along with conditions (tests) on the
       inputs. All of these conditions must be satisfied in order for this
       transition to be activated.

     * action -- And action to be performed when the transition is activated.
       Note: Not currently implemented.

     * newstatename -- The name of the state which will become the current
       state if this transition is activated.

3.5 Element inputs

     * input -- An input. A Python test and an HTML text edit field is
       generated for each input item.

          * name -- The name of the input item.

          * value -- The value for comparison.

          * condition -- The test to be applied to the input and value. The
            following values are accepted:

             +-------------------------------------------------------------+
             | Condition  | Meaning               | Translation in Python  |
             |------------+-----------------------+------------------------|
             | eq         | equal                 | ==                     |
             |------------+-----------------------+------------------------|
             | ne         | not equal             | !=                     |
             |------------+-----------------------+------------------------|
             | lt         | less than             | <                      |
             |------------+-----------------------+------------------------|
             | gt         | greater than          | >                      |
             |------------+-----------------------+------------------------|
             | le         | less than or equal    | <=                     |
             |------------+-----------------------+------------------------|
             | ge         | greater than or equal | >=                     |
             +-------------------------------------------------------------+

                                        
                            License, See also, Etc.

                        Copyright (c) 2002 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.

   See Also:

   Dave's Web Site
           for more software and information on using Python for XML and the
           Web

   Albatross Web Site
           for information on the Albatross package

   The main Python Web Site
           for more information on Python

   The Python XML Special Interest Group
           for more information on processing XML with Python

                            About this document ...

   An Application Generator for Albatross, July 2, 2002, Release 1.0

   This document was generated using the LaTeX2HTML translator.

   LaTeX2HTML is Copyright (c) 1993, 1994, 1995, 1996, 1997, Nikos Drakos,
   Computer Based Learning Unit, University of Leeds, and Copyright (c) 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.

     ----------------------------------------------------------------------

                     An Application Generator for Albatross                  

     ----------------------------------------------------------------------

   Release 1.0, documentation updated on July 2, 2002.


-- 
Dave Kuhlman
dkuhlman at rexx.com
http://www.rexx.com/~dkuhlman
-------------- next part --------------
A non-text attachment was scrubbed...
Name: appgen.tar.gz
Type: application/x-tar-gz
Size: 17755 bytes
Desc: not available
URL: <http://www.object-craft.com.au/pipermail/albatross-users/attachments/20020704/67e3a6a3/attachment.bin>


More information about the Albatross-users mailing list