Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "Tigerstripe M0 Plugin Tutorial"

m (Corrected spelling errors)
 
Line 4: Line 4:
 
Using "standard" generators, Tigerstripe allows you to create output based on the classes that are in your model. In some areas this is known as an "M1" model.  
 
Using "standard" generators, Tigerstripe allows you to create output based on the classes that are in your model. In some areas this is known as an "M1" model.  
  
An "M0" model is a set of instances, and in Tigerstripe these are captured in a instance Diagram. By writing an "M0 generatopr", you can create output files based on the content of instance diagrams.  
+
An "M0" model is a set of instances, and in Tigerstripe these are captured in a instance Diagram. By writing an "M0 generator", you can create output files based on the content of instance diagrams.  
  
 
== M1 vs M0 generator  ==
 
== M1 vs M0 generator  ==
  
The general process for creating M0 generators is exactly the same as for M1 generators. You specify properties and rules as beofre, and the deploy phase is exactly the same. The only major differences are :  
+
The general process for creating M0 generators is exactly the same as for M1 generators. You specify properties and rules as before, and the deploy phase is exactly the same. The only major differences are :  
  
 
== Triggering a rule  ==
 
== Triggering a rule  ==
Line 14: Line 14:
 
Once deployed, an M0 generator needs to be enabled in the "Generator settings" tab of the Tigerstripe descriptor editor for the project where your instance diagram lives. Here you specify the property values required by your plugin.  
 
Once deployed, an M0 generator needs to be enabled in the "Generator settings" tab of the Tigerstripe descriptor editor for the project where your instance diagram lives. Here you specify the property values required by your plugin.  
  
Once enabled, open ayour instance diagram, right click and select the "Generate.." option. This pops up a dialog giving you a couple of options, hit Generater, and the lougin will run over the optons you have chosen (typically "This diagram only". The outout should appear in teh tigerstripe.gen folder as per a standard plugin.  
+
Once enabled, open your instance diagram, right click and select the "Generate.." option. This pops up a dialog giving you a couple of options, hit Generator, and the plugin will run over the options you have chosen (typically "This diagram only". The output should appear in the tigerstripe.gen folder as per a standard plugin.  
  
 
== Context contents  ==
 
== Context contents  ==
  
In an instance generator rule context, there are a few additional entries that are of interest(the same basic "class based" collections are still populated). There are 3 new collections of interest, idientified by the following keys :  
+
In an instance generator rule context, there are a few additional entries that are of interest(the same basic "class based" collections are still populated). There are 3 new collections of interest, identified by the following keys :  
  
 
*classInstances  
 
*classInstances  
Line 24: Line 24:
 
*artifactInstances - a superset of the above two collections.
 
*artifactInstances - a superset of the above two collections.
  
The contents of these colections are (at this stage) internal representations of instances, and there is a very poor interface. In a template rule, you can use the access methods listed below, but in a Runnable rule, you will almost certainly end up using java reflection to get access to the instance properties  
+
The contents of these collections are (at this stage) internal representations of instances, and there is a very poor interface. In a template rule, you can use the access methods listed below, but in a Runnable rule, you will almost certainly end up using java reflection to get access to the instance properties  
  
 
Template methods:  
 
Template methods:  

Latest revision as of 22:10, 17 November 2013

< To: Tigerstripe_Tutorials


Using "standard" generators, Tigerstripe allows you to create output based on the classes that are in your model. In some areas this is known as an "M1" model.

An "M0" model is a set of instances, and in Tigerstripe these are captured in a instance Diagram. By writing an "M0 generator", you can create output files based on the content of instance diagrams.

M1 vs M0 generator

The general process for creating M0 generators is exactly the same as for M1 generators. You specify properties and rules as before, and the deploy phase is exactly the same. The only major differences are :

Triggering a rule

Once deployed, an M0 generator needs to be enabled in the "Generator settings" tab of the Tigerstripe descriptor editor for the project where your instance diagram lives. Here you specify the property values required by your plugin.

Once enabled, open your instance diagram, right click and select the "Generate.." option. This pops up a dialog giving you a couple of options, hit Generator, and the plugin will run over the options you have chosen (typically "This diagram only". The output should appear in the tigerstripe.gen folder as per a standard plugin.

Context contents

In an instance generator rule context, there are a few additional entries that are of interest(the same basic "class based" collections are still populated). There are 3 new collections of interest, identified by the following keys :

  • classInstances
  • associationInstances
  • artifactInstances - a superset of the above two collections.

The contents of these collections are (at this stage) internal representations of instances, and there is a very poor interface. In a template rule, you can use the access methods listed below, but in a Runnable rule, you will almost certainly end up using java reflection to get access to the instance properties

Template methods:

  • $instance.InstanceName
  • $instance.Artifact -> returns the Artifact Class of which this is an instance
  • $instance.Variables -> returns a set of Variables that contain any values you have set against this instance - use $variable.name, $ variable.type to get the details, and $variable.value to get the set of values this will need to be further split to get the individual values.







Back to the top