< To: Tigerstripe
- 1 Tigerstripe Overview
- 2 What is the relationship with Tigerstripe Software?
- 3 What's up with version numbers?
- 4 OSS/J Support with Tigerstripe
- 5 How do I Access Stereotype Values From a Template?
- 6 How do I Access Stereotype Values on a method Return?
- 7 What is in the Default Velocity Context?
- 8 How do I run a Tigerstripe Generation in a Headless Environment?
Tigerstripe Workbench provides an integrated Model-Driven Engineering framework allowing users to create/edit/maintain models across large teams, configure transformations to code, documentation or specifications and integrate it in a continuous build environment.
What is the relationship with Tigerstripe Software?
This is the open-source incarnation of Tigerstripe Workbench as it was distributed by ex-Tigerstripe Software. In January'07 the source code for Tigerstripe was cleaned up and contributed to the Tigerstripe Eclipse Project as a sub-project of the Eclipse Technology Project.
What's up with version numbers?
The last non-open source version of Tigerstripe Workbench was released as v2.2.4 on http://www.tigerstripedev.net. This was a stop gap release for existing users of Tigerstripe until the first open-source releases were made available. Additionally, following Eclipse Guidelines, Tigerstripe release numbering needs to comply with Eclipse rules. In particular, during the incubation period only 0.xx versions can be released.
So, although the contributed code remains the same, the first open-source build (Incubation 0.3) corresponds to a bugfix release for the last non-open release (v2.2.4).
OSS/J Support with Tigerstripe
How do I Access Stereotype Values From a Template?
Most model components support accessing Stereotypes, but the method of access is the same for all types. (See also method return Stereotypes)
The following example will generate an XML snippet for all of the stereotypes on "$component" which must be an IStereotypeCapable. It first checks for teh existence of *any* stereotype instances, then iterates over each instance. The CharacterizingStereotype is used to look up the *defined* attributes (ie in the profile) for this particular stereotype, and then we examine the attribute values - checking for array type attributes.
Note that not all of these steps will be applicable/required in all cases - for example you may not need the isEnpty() step at the start if there is no "wrapper" element required. Note also that the value of any StereotypeAttribute will be a String - in the case of a boolean Attribute type the values will be limited to "true" or "false".
## Check if there are *any* stereotype instance on $component #if(!$component.StereotypeInstances.isEmpty()) <ts:stereotypes> ## Iterate over each instance #foreach ($instance in $component.StereotypeInstances) <ts:stereotype name="$instance.Name"> ## Check the defined attributes for this instance (note that these might not have any value for a given instance) #foreach ($attribute in $instance.CharacterizingStereotype.Attributes) <ts:stereotypeAttribute name="$attribute.Name" array="$attribute.Array"> ## Handle array types if necessary #if($attribute.Array == "false") <ts:value>$instance.getAttributeValue($attribute)</ts:value> #else #foreach ($val in $instance.getAttributeValues($attribute)) <ts:value>$val</ts:value> #end #end </ts:stereotypeAttribute> #end </ts:stereotype> #end </ts:stereotypes> #end
How do I Access Stereotype Values on a method Return?
The logic is exactly the same as for stereotypes on other model components, but the stereotype instances are obtained using the method :
What is in the Default Velocity Context?
When you run a template based rule, the Velocity context is pre-loaded with a whole set of collections and other useful items. The full list of the items loaded can be found in the Tigerstripe Plugin Miscellany tutorial.
How do I run a Tigerstripe Generation in a Headless Environment?
You may run a Tigerstripe workbench generation from a command line script or using Maven 2. Please see Tigerstripe Headless Generation Tutorial for more information on headless build environments and Tigerstripe.