de.matthias_burbach.flux
Class ModuleActionMappingGenerator

java.lang.Object
  extended byde.matthias_burbach.flux.AbstractActionMappingGenerator
      extended byde.matthias_burbach.flux.ModuleActionMappingGenerator
All Implemented Interfaces:
ActionMappingGenerator

public class ModuleActionMappingGenerator
extends AbstractActionMappingGenerator

Generates two action mappings for each UML state with stereotype 'Module'. The first is used to enter the module and the second is used to continue in the calling module when the entered module returns (with a return code).

Author:
Matthias Burbach

Field Summary
 
Fields inherited from class de.matthias_burbach.flux.AbstractActionMappingGenerator
settings
 
Constructor Summary
ModuleActionMappingGenerator()
           
 
Method Summary
 void begin(StateMachine stateMachine, org.jdom.Document oldDocument, org.jdom.Element oldActionMappingsElement, org.jdom.Document newDocument, org.jdom.Element newActionMappingsElement)
          Introduces the <action> elements generated by this generator with the comment <--Module Activities-->.
 void generate(StateMachine stateMachine, State state, org.jdom.Document oldDocument, org.jdom.Element oldActionMappingsElement, org.jdom.Document newDocument, org.jdom.Element newActionMappingsElement)
          Generates an 'enter' and an 'exit' module mapping.
protected  void generateEnterMapping(StateMachine stateMachine, State state, org.jdom.Document oldDocument, org.jdom.Element oldActionMappingsElement, org.jdom.Document newDocument, org.jdom.Element newActionMappingsElement)
          Generates the module enter mapping.
protected  void generateExitMapping(StateMachine stateMachine, State state, org.jdom.Document oldDocument, org.jdom.Element oldActionMappingsElement, org.jdom.Document newDocument, org.jdom.Element newActionMappingsElement)
          Generates the exit mapping.
protected  java.lang.String getEnteredModule(State state)
           
protected  java.lang.String getEnterPath(State state)
           
 
Methods inherited from class de.matthias_burbach.flux.AbstractActionMappingGenerator
end, generateForward, generateForward, generateForwards, generateProperty, getActionMappingElementForPath, getBasePath, getBasePathExtension, getDefaultName, getDefaultPackage, getDefaultType, getForwardElementForName, getForwardPath, getForwardPathPrefix, getForwardPathSuffix, getNamePartOfBasePath, setSettings
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ModuleActionMappingGenerator

public ModuleActionMappingGenerator()
Method Detail

begin

public void begin(StateMachine stateMachine,
                  org.jdom.Document oldDocument,
                  org.jdom.Element oldActionMappingsElement,
                  org.jdom.Document newDocument,
                  org.jdom.Element newActionMappingsElement)
Introduces the <action> elements generated by this generator with the comment <--Module Activities-->.

Specified by:
begin in interface ActionMappingGenerator
Overrides:
begin in class AbstractActionMappingGenerator

generate

public void generate(StateMachine stateMachine,
                     State state,
                     org.jdom.Document oldDocument,
                     org.jdom.Element oldActionMappingsElement,
                     org.jdom.Document newDocument,
                     org.jdom.Element newActionMappingsElement)
              throws java.lang.Exception
Generates an 'enter' and an 'exit' module mapping.

Specified by:
generate in interface ActionMappingGenerator
Overrides:
generate in class AbstractActionMappingGenerator
Throws:
java.lang.Exception

generateEnterMapping

protected void generateEnterMapping(StateMachine stateMachine,
                                    State state,
                                    org.jdom.Document oldDocument,
                                    org.jdom.Element oldActionMappingsElement,
                                    org.jdom.Document newDocument,
                                    org.jdom.Element newActionMappingsElement)
                             throws java.lang.Exception
Generates the module enter mapping. The generated path attribute follows the pattern '/Module.%NAME%.enter'.

Preserves all attributes from the previous version of the element except the disallowed forward and include attributes and the type attribute, which must not be manually changed because the framework class specified by the settings property 'EnterModuleAction' is used for it.

Generates exactly one nested <forward> element to forward into the other module and preserves all other child elements (like <set-property>, e. g.) from the previous version.

For a description of the parameters see generate(StateMachine, State, Document, Element, Document, Element)

Throws:
java.lang.Exception

generateExitMapping

protected void generateExitMapping(StateMachine stateMachine,
                                   State state,
                                   org.jdom.Document oldDocument,
                                   org.jdom.Element oldActionMappingsElement,
                                   org.jdom.Document newDocument,
                                   org.jdom.Element newActionMappingsElement)
                            throws java.lang.Exception
Generates the exit mapping. The generated path attribute follows the pattern '/Module.%NAME%.exit'.

Preserves all attributes from the previous version of the element except the disallowed forward and include attributes and the type attribute, which must not be manually changed because the framework class specified by the settings property 'RelayAction' is used for it.

Generates nested <forward> elements using AbstractActionMappingGenerator.generateForwards(State, Document, Element, Element) and preserves all other child elements (like <set-property>, e. g.) from the previous version.

For a description of the parameters see generate(StateMachine, State, Document, Element, Document, Element)

Throws:
java.lang.Exception

getEnteredModule

protected java.lang.String getEnteredModule(State state)
Parameters:
state - the state of stereotype 'Module' to derive the module name from
Returns:
the slash prepended, lower-cased name of the module which is the name of the state up to the first occurrence of a '.'; if there is no '.' the whole name of the state is returned; if the state represents the root module '' is returned

getEnterPath

protected java.lang.String getEnterPath(State state)
Parameters:
state - the state of stereotype 'Module' the enter path is to be extracted from
Returns:
the expression property of the do-action nested into the state