|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.matthias_burbach.flux.XmiModelBuilder
Builds the internal UML model representation from an XMI 1.1 UML 1.3 file.
Has been developed for and tested with input files that were created with Rational Rose v2002 and exported with the UniSys XMI 1.1 / UML 1.3 add-in. Other tools or versions are likely to produce (slightly) incompatible XMI results. In such cases a different implementation ofModelBuilder
must be used. If there are only minor differences to what this implementation
can process a pre-transformation might solve the problem most easily (e. g.
using XSLT).
Constructor Summary | |
XmiModelBuilder()
|
Method Summary | |
protected void |
addActionsToState(org.jdom.Element stateElement,
State state)
Adds actions to the state that result from the following
XPath select (relative to the state element):'UML:State.doActivity/ UML:ActionSequence/ UML:ActionSequence.action/ UML:UninterpretedAction' |
protected void |
assignStereotypesToClasses(org.jdom.Element modelElement,
java.util.HashMap classes)
|
protected void |
assignStereotypesToStates(org.jdom.Element modelElement,
java.util.HashMap states)
Reads stereotypes using the XPath select 'descendant::UML:Stereotype' (relative to modelElement ) and assigns them to the states
they are linked to by refIds listed in the extendedElement attribute. |
protected void |
assignTransitionsToStates(org.jdom.Element modelElement,
java.util.HashMap states,
java.util.HashMap events)
Creates UML transitions from the XPath select 'descendant::UML:Transition' (relative to modelElement )
and assigns them to the states they are linked to.
|
protected void |
assignVariablesToStates(java.util.HashMap states,
java.util.Vector variables)
|
Model |
build(java.lang.String sourceUrl)
Loads the XMI document from the sourceUrl and builds
the model from it. |
protected Model |
buildModelFromXmiDocument(org.jdom.Document xmiDocument)
Builds the model from the XMI document. |
protected java.util.Vector |
createAttributesForClass(org.jdom.Element classElement)
Creates UML attributes from the XPath select 'descendant::UML:Attribute' (relative to classElement ) |
protected java.util.HashMap |
createClasses(org.jdom.Element modelElement)
Creates UML classes from the XPath select 'descendant::UML:Class' (relative to modelElement ) |
protected java.util.HashMap |
createEvents(org.jdom.Element modelElement)
Creates UML events from the XPath select 'descendant::UML:SignalEvent' (relative to modelElement ) |
protected java.util.HashMap |
createStates(org.jdom.Element modelElement)
Creates UML states from the following XPath selects (relative to modelElement ):
'descendant::UML:SimpleState'
'descendant::UML:ActionState'
'descendant::UML:FinalState'
|
protected java.util.HashMap |
createStatesForPath(org.jdom.Element modelElement,
java.lang.String xPathExpression)
Creates states from the state elements that can be selected with the xPathExpression (relative to modelElement ); |
protected java.util.Vector |
createVariables(org.jdom.Element modelElement)
Creates variables from classes with stereotype 'Variable'. |
protected Variable |
findVariableByName(java.util.Vector variables,
java.lang.String variableName)
|
protected java.util.List |
getSortedStates(java.util.Collection states)
Sorts the states passed in by name (the order of states will affect the order of generated <action> elements). |
protected void |
sortTransitions(State state)
Sorts the outbound transitions of state by label,
i. e. event name or guard condition if the event name is not defined. |
protected void |
sortTransitionsForEachState(java.util.Collection states)
Sorts the transitions for each state by label, i. e. event name or guard condition if the event name is not defined (the order of transitions will affect the order of several generated <action> and <forward> elements). |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public XmiModelBuilder()
Method Detail |
public Model build(java.lang.String sourceUrl) throws java.lang.Exception
sourceUrl
and builds
the model from it.
build
in interface ModelBuilder
sourceUrl
- the location of the file to build from
java.lang.Exception
- if anything goes wrong unexpectedly.protected Model buildModelFromXmiDocument(org.jdom.Document xmiDocument) throws java.lang.Exception
xmiDocument
- the XMI 1.1 UML 1.3 document that contains exactly
one activity diagram modelling the web application
module
java.lang.Exception
- if anything goes unexpectedly wrongprotected void assignVariablesToStates(java.util.HashMap states, java.util.Vector variables)
states
- the states variables are to be assigned tovariables
- the variables to be assigned to 0, 1 or more statesprotected Variable findVariableByName(java.util.Vector variables, java.lang.String variableName)
variables
- the set of variables to search invariableName
- the name of the variable to be found
null
protected void assignStereotypesToClasses(org.jdom.Element modelElement, java.util.HashMap classes) throws java.lang.Exception
modelElement
- classes
-
java.lang.Exception
protected java.util.Vector createVariables(org.jdom.Element modelElement) throws java.lang.Exception
modelElement
- the model element to select from
Variable
java.lang.Exception
- if anything goes unexpectedly wrongprotected java.util.List getSortedStates(java.util.Collection states)
states
- the states built from the model file that are to be sorted
protected void sortTransitionsForEachState(java.util.Collection states)
states
- the states whose outbound transitions are to be sortedprotected void sortTransitions(State state)
state
by label,
i. e. event name or guard condition if the event name is not defined.
state
- the state whose outbound transitions are to be sortedprotected void assignTransitionsToStates(org.jdom.Element modelElement, java.util.HashMap states, java.util.HashMap events) throws java.lang.Exception
modelElement
)
and assigns them to the states they are linked to.
Creates unnamed but guarded events and attaches them together with
the named but unguarded events
passed in to the transitions.
Sets the transition's action if specified (not to be confounded with
an action activity!).
modelElement
- the model element to select fromstates
- the states transitions are to be assigned toevents
- the named events that need to be attached to
the transitions
java.lang.Exception
protected java.util.HashMap createEvents(org.jdom.Element modelElement) throws java.lang.Exception
modelElement
)
modelElement
- the model element to select from
Event
hashed by their event element counterpart's xmi.id
java.lang.Exception
- if anything goes unexpectedly wrongprotected java.util.HashMap createStates(org.jdom.Element modelElement) throws java.lang.Exception
modelElement
):
modelElement
- the model element to select from
State
hashed by their state element counterpart's xmi.id
java.lang.Exception
- if anything goes unexpectedly wrongprotected java.util.HashMap createStatesForPath(org.jdom.Element modelElement, java.lang.String xPathExpression) throws java.lang.Exception
xPathExpression
(relative to modelElement
);
modelElement
- the model element to select fromxPathExpression
- the select path
State
hashed by their state element counterpart's xmi.id
java.lang.Exception
- if anything goes unexpectedly wrongprotected void addActionsToState(org.jdom.Element stateElement, State state) throws java.lang.Exception
state
that result from the following
XPath select (relative to the state element):'UML:State.doActivity/ UML:ActionSequence/ UML:ActionSequence.action/ UML:UninterpretedAction'
stateElement
- the state element to select fromstate
- the state to add the actions to
java.lang.Exception
- if anything goes unexpectedly wrongprotected void assignStereotypesToStates(org.jdom.Element modelElement, java.util.HashMap states) throws java.lang.Exception
modelElement
) and assigns them to the states
they are linked to by refIds listed in the extendedElement attribute.
modelElement
- the model element to select fromstates
- the states stereotypes get assigned to
java.lang.Exception
- if anything goes unexpectedly wrongprotected java.util.HashMap createClasses(org.jdom.Element modelElement) throws java.lang.Exception
modelElement
)
modelElement
- the model element to select from
Class
hashed by their class element counterpart's xmi.id
java.lang.Exception
- if anything goes unexpectedly wrongprotected java.util.Vector createAttributesForClass(org.jdom.Element classElement) throws java.lang.Exception
classElement
)
classElement
- the class element to select from
String
java.lang.Exception
- if anything goes unexpectedly wrong
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |