Stdlib workflow components

Stdlib workflow components

Besides the extensions described in the previous section Xpand's Stdlib provides some workflow components.

This component executes a system command.


Example:

<component class="org.eclipse.xtend.util.stdlib.SystemCommand">
  <directory value="src-gen"/>
  <command value="sh"/>
  <arg value="processdot.sh"/>
</component>

Console output:

1639 INFO  - Running command '[sh, processdot.sh]' in directory [absolutepath] ...
1667 INFO  - processing shape_box.dot ...
2597 INFO  - processing shape_polygon.dot ...
...
3564 INFO  - Execution of command was successful.

Windows tip:

When executing a command on windows this is typically done with the cmd as command value. It is important that the command terminates, therefore the argument /c must be appended as arg value.[10]

This component copies an element from one slot to another. The slot content is not cloned.


Example:

<component class="org.eclipse.xtend.util.stdlib.SlotCopier">
    <fromSlot value="model"/>
    <toSlot value="target"/>
</component>

Console output:

INFO SlotCopier copying org.eclipse.emf.ecore.impl.DynamicEObjectImpl@1fdbef 
  (eClass: org.eclipse.emf.ecore.impl.EClassImpl@fc5b01 
  (name: Model) (instanceClassName: null) (abstract: false, interface: false)) 
  [org.eclipse.emf.ecore.impl.DynamicEObjectImpl]

This component copies an element from one slot to a list contained in another slot.


Example:

This example adds the content of slot 'model' to the slot 'targetList'. The slot 'targetList' does not contain anything at the time of execution.

<component class="org.eclipse.xtend.util.stdlib.SlotListAdder">
    <modelSlot value="model"/>
    <listSlot value="targetList"/>
</component>

Console output:

INFO CompositeComponent SlotListAdder: adding contents of slot 'model' to the list of 
   stuff in 'targetList' 
...
...
INFO WorkflowRunner workflow completed in 1503ms! 
WARN WorkflowRunner 'targetList' is empty, creating a new list. 
   [org.eclipse.xtend.util.stdlib.SlotListAdder@7536e7]

Note that the warn messages will appear after the workflow finished, since they are reported as a workflow warn issue.

This component prints a workflow context slot content to the log. This can be useful for debugging purposes.


Example:

<component class="org.eclipse.xtend.util.stdlib.SlotPrinter">
    <slotName value="model"/>
    <message value="DUMP"/>
    <level value="INFO"/>
</component>

Console output:

INFO SlotPrinter DUMP: (slot: model)org.eclipse.emf.ecore.impl.DynamicEObjectImpl@d22ddb 
  (eClass: org.eclipse.emf.ecore.impl.EClassImpl@fe0ce9 (name: Model) (instanceClassName: null) 
  (abstract: false, interface: false))