next up previous contents
Next: To be changed Up: Jython Engine Previous: Differences from XCAT-SP   Contents


Implementation

The jython engine code is defined in the xbooks.server.engine package in JythonEngine.java. It implements the Engine interface as follows:

initialize(xbookPath, engineArgs)
It records the location of the xbook, xbookPath. It also expects 2 engineArgs: the name of the jython file to interpret (i.e., the xbook implementation), which contains a class definition referred to as the xbook handler, and that xbook handler class name.

start(out)
Creates the jython interpreter and then creates a xbook handler object. Next, it calls the xbook handler's initialize routine. So far, the initialize routine has been used to read in a html form and send the output to the xbook client.

stop(out)
Calls the xbook handler's finalize routine and then destroys the jython interpreter.

execute(command, formValues, out)
Calls the xbook handler's do$ <$command$ >$ routine (e.g., if command is 'Submit, 'doSubmit' is called').

For example, suppose the following entry exists in the registry:

     sample: JythonEngine handler.py SampleHandler

JythonEngine would expect handler.py to contain the definition of a class named SampleHandler. This class, at a minimum, needs to define initialize and finalize. It will also (most likely, but not required) define one or more doXXX routines where XXX is an command request from the xbook client.



Subsections
next up previous contents
Next: To be changed Up: Jython Engine Previous: Differences from XCAT-SP   Contents
Shava Smallen 2002-12-31