Activity Builder is a framework that allows users (called modelers) to build and execute simple UML activity diagrams associated with simple components.
Users should be able to add new actions and contexts to the system.
Only one activity can be created and executed at a time. Therefore, before a new activity is created, the modeler should be asked if he wants to save the previously edited activity if it contains unsaved changes.
The modeler creates an action or branch node by specifying the name of a .class file containing an Activity or Branch subclass. (Running a branch node executes some Boolean valued test on the context, while running an activity node updates the context.
Users can add control nodes or action nodes to an activity. A list of available actions should be available to the modeler.
The modeler specifies the nodes to be connected. An activity node only has one input pin and one output pin. A branch node has two input pins and one output pin. A merge pin has two input pins and one output pin.
A modeler executes an activity by creating a token and passing it to the activities run method. The modeler also has the option of stepping through the activity one action at a time.
Modelers should be able to save their activities to a database or XML file. (You may choose. There may already be an XML language for activity diagrams that is defined by OMG. Otherwise you can make up your own.)
An activity is a directed graph. Nodes are either actions or control nodes. Arrows indicate the flow of control from one node to the next. Control is explicitly represented by a token, which is passed from node to node. Each node has access to a context object representing the use case, actor, model, or component that executes the activity. The actions may update the context as they run.
Use the Model-View-Controller Pattern [Fowler]. In this case the model will be the activity. Use the Domain Model Pattern [Fowler].
There might be different views showing the nodes, individual nodes, a list of available nodes, the progress of the token through the activity, etc.
For your controller, use the Use Case Controller Pattern [Aguiar, etc.].
For the database, use the Data Mapper Pattern or a Gateway [Fowler].
Consider using the Pluggable Adapter Pattern [Pearce] to allow users to customize nodes.