An Application Generator for Albatross

Dave Kuhlman

E-mail:

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

 
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

3.2 Element endstatenames

3.3 Element state

3.4 Element transition

3.5 Element inputs

 
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 © 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.