de.matthias_burbach.flux
Class NonModelledActionMappingGenerator

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

public class NonModelledActionMappingGenerator
extends AbstractActionMappingGenerator

Preserves non-modelled action mappings by copying them from the old struts-config.xml to the new struts-config.xml's section 'Non-modelled Action Mappings'.

'Non-modelled' means, these action mappings would actually have to be deleted to maintain perfect consistency between the current UML model and the new struts-config.xml because they cannot be derived from anything that's in the model (anymore).

It is generally not recommended to keep these mappings because it reduces the completeness and potentially even the correctness of the model.
Situations may however arise where special mappings are needed that cannot be well expressed or maintained in the model. For these, hopefully rare cases 'non-modelled action mappings' might be the solution. In all other cases they should be manually deleted from the new struts-config.xml.

Must be configured to be the last ActionMappingGenerator in the sequence of generator mappings in flux-config.xml to ensure proper results.

Author:
Matthias Burbach

Field Summary
 
Fields inherited from class de.matthias_burbach.flux.AbstractActionMappingGenerator
settings
 
Constructor Summary
NonModelledActionMappingGenerator()
           
 
Method Summary
 void begin(StateMachine stateMachine, org.jdom.Document oldDocument, org.jdom.Element oldActionMappingsElement, org.jdom.Document newDocument, org.jdom.Element newActionMappingsElement)
          Does nothing if the global setting 'PreserveNonModelledActionMappings' is not set to 'true'.
protected  void doBegin(StateMachine stateMachine, org.jdom.Document oldDocument, org.jdom.Element oldActionMappingsElement, org.jdom.Document newDocument, org.jdom.Element newActionMappingsElement)
          Copies all old action mapping elements that were not (re-)generated so far to the section of 'Non-modelled Action Mappings'.
protected  boolean isNonModelled(org.jdom.Element actionMappingElement, org.jdom.Element newActionMappingsElement)
          Checks whether actionMappingElement was not generated from the model into newActionMappingsElement by a preceding ActionMappingGenerator, i. e. it is not modelled (anymore).
 
Methods inherited from class de.matthias_burbach.flux.AbstractActionMappingGenerator
end, generate, 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

NonModelledActionMappingGenerator

public NonModelledActionMappingGenerator()
Method Detail

begin

public void begin(StateMachine stateMachine,
                  org.jdom.Document oldDocument,
                  org.jdom.Element oldActionMappingsElement,
                  org.jdom.Document newDocument,
                  org.jdom.Element newActionMappingsElement)
           throws java.lang.Exception
Does nothing if the global setting 'PreserveNonModelledActionMappings' is not set to 'true'.
Calls doBegin(StateMachine, Document , Element, Document, Element) otherwise.

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

doBegin

protected void doBegin(StateMachine stateMachine,
                       org.jdom.Document oldDocument,
                       org.jdom.Element oldActionMappingsElement,
                       org.jdom.Document newDocument,
                       org.jdom.Element newActionMappingsElement)
                throws java.lang.Exception
Copies all old action mapping elements that were not (re-)generated so far to the section of 'Non-modelled Action Mappings'.

This affects those mappings that never had or now don't have a correspondence in the model anymore from which they could be derived/generated.

Parameters:
stateMachine -
oldDocument -
oldActionMappingsElement -
newDocument -
newActionMappingsElement -
Throws:
java.lang.Exception

isNonModelled

protected boolean isNonModelled(org.jdom.Element actionMappingElement,
                                org.jdom.Element newActionMappingsElement)
                         throws java.lang.Exception
Checks whether actionMappingElement was not generated from the model into newActionMappingsElement by a preceding ActionMappingGenerator, i. e. it is not modelled (anymore).

Parameters:
actionMappingElement - the element to check for
newActionMappingsElement - the elements that have been generated so far
Returns:
false iff newActionMappingsElement has an action mapping whose path attribute equals the path of actionMappingElement
Throws:
java.lang.Exception - if anything goes unexpectedly wrong