An Application Generator for Albatross

Dave Kuhlman

http://www.rexx.com/~dkuhlman
Email:

Release 1.0
July 5, 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 FSM contains 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.

 
1.1 Motivation

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, various organizations 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

This application generator is one attempt at the 2nd stage of this translation. OK, so it generates a Web application and not a Web service. We can fix that up later. We'll just generate SOAP envelopes instead of HTML pages and we'll ...

It should be noted that the emphasis, currently, is on the transitions between pages (or services in a business process that defines a Web service), i.e. the top level application/service logic. Hopefully the details (the contents of pages, the information items in a service request and response) can be filled in later.

 
2 How-to Use it

2.1 Requirements

You will need PyXML in order to run the application generator. You can obtain it at the Python XML special interest group.

2.2 Running the Generator

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 runAppGen.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 runAppGen.py -o fsm_app1.xml dispatch.py
        Generate object-based Albatross application.

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

2.3 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.4 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.

2.5 Help and Sample Files

The distribution contains a number of files that you might find informative:

 
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

 
4 Implementation

The fsmlib was initially generated using the generateDS with the XSchema document fsm.xsd as input. You can learn more about generateDS at http://www.rexx.com/~dkuhlman/#generateDS.

 
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 5, 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.