Java Reference
In-Depth Information
21.6.2
Design
This prototype consists of a set of JSP classes that give access to the WfMS
interfaces. We must keep the information about the users when they are
connected to the system, and the information on the state of the processes
and activities across the user sessions.
Decision point
How do we keep the state for both the connected user and the processes?
The JSP standard defines two name spaces that can be used to store that
information: the context and the session. The former is initialized when the
JSP container starts, and destroyed when it shuts down; therefore it is suited
for keeping the long-lived information about the process state. The session is
associated with an HTTP session and is suited for keeping the information
about the user.
The overall structure of the user interface is presented in the class diagram
shown in Figure 21.15. The figure is divided into two parts: the upper part
shows the classes involved in the context, while the lower part contains the
classes involved in the session.
The context is initialized by the ContextListener class that is invoked on
startup. It creates an Organization and a Catalog and initializes them, then
stores them in the application context that is represented by class
ServletContext .
The session contains only one object of class Actor which represents the
user. It is created and registered within the session when the user enters the
application. The application entry point is represented by the Login page and
it is linked to the main page that contains all the useful information. It is pos-
sible to start a process through the Instantiate page and monitor its state
through the Process page. Likewise, it is possible to access a work item using
the WorkItem page and complete the corresponding activity through the
Complete page. Finally the Logout page closes the session.
The Main page authenticates the user and creates the corresponding Actor
object, then all the pages access the Actor to perform their operations.
21.6.3
Implementation
The context of the WfMS applications is built up by the ContextListener class,
whose method contextInitialized() is invoked when the container starts. This
method defines two objects that are part of the context: the organization and
the process catalogue.
import WfEngine.*;
import ProcessDefinition.*;
import javax.xml.parsers.*;
 
Search WWH ::




Custom Search