Date post: | 06-May-2015 |
Category: |
Technology |
Upload: | eric-dillon |
View: | 868 times |
Download: | 2 times |
1© 2008, Cisco Systems, Inc. – Made available under the Eclipse Public License 1.0
Tigerstripe
Richard Craddock, Eric Dillon (Cisco)
Integrated Model-Driven Engineering
2
© 2008, Cisco Systems, Inc. – Made available under the Eclipse Public License 1.0
Tigerstripe
Get started with Tigerstripe
• Quick project overview• Tigerstripe Workbench: highlights• Requirements for Real-life MDE• Customize the Tigerstripe Framework• Wrap-up – Q&A
3
© 2008, Cisco Systems, Inc. – Made available under the Eclipse Public License 1.0
Tigerstripe
Project Overview
• Technology sub-project, in Incubation–Model-Driven-Engineering framework for
large Telecom and Enterprise Models–Open-sourced by Cisco in Jan’08–Used in production (Cisco ANA)
• Website: www.eclipse.org/tigerstripe• Wiki: http://wiki.eclipse.org/Tigerstripe(all materials available at http://wiki.eclipse.org/TigerstripeAtEclipseSummit08 )
4
© 2008, Cisco Systems, Inc. – Made available under the Eclipse Public License 1.0
Tigerstripe
Tigerstripe: The Workbench
• A Scalable MDE environment–Class Diagrams, Instance Diagrams–Model Scoping (facets)– Integrated Code/Content Generation–Scalable, production-ready– Integration
with Continuous builds Env.
5
© 2008, Cisco Systems, Inc. – Made available under the Eclipse Public License 1.0
Tigerstripe
Concepts: Componentized Modelsre
fere
nce
s
• Models are hosted in a project• Cross-project dependencies can be used in a Java-Classpath fashion• Models can be packaged as .zip for read-only distribution.• Allow to “Componentize” large models• Buckminster integration to materialize large number of inter-dependent model projects.
• Models are hosted in a project• Cross-project dependencies can be used in a Java-Classpath fashion• Models can be packaged as .zip for read-only distribution.• Allow to “Componentize” large models• Buckminster integration to materialize large number of inter-dependent model projects.
6
© 2008, Cisco Systems, Inc. – Made available under the Eclipse Public License 1.0
Tigerstripe
Concepts: SCM Friendly Models
• Model Artifacts are stored in separate files in project• Allows SCM to handle them separately, and set own revisions• Reduces number of required merges when large distributed team work on large models.
• Model Artifacts are stored in separate files in project• Allows SCM to handle them separately, and set own revisions• Reduces number of required merges when large distributed team work on large models.
7
© 2008, Cisco Systems, Inc. – Made available under the Eclipse Public License 1.0
Tigerstripe
Concepts: Model Scoping
Out of
Scope
• Define model self-contained, valid, sub-models by walking all relevant relationships• Use Stereotypes/Annotations to control model lifecycle• Use sub-model as driver for code/content generation
• Define model self-contained, valid, sub-models by walking all relevant relationships• Use Stereotypes/Annotations to control model lifecycle• Use sub-model as driver for code/content generation
8
© 2008, Cisco Systems, Inc. – Made available under the Eclipse Public License 1.0
Tigerstripe
Template-based Code/Content Generation
9
© 2008, Cisco Systems, Inc. – Made available under the Eclipse Public License 1.0
Tigerstripe
Instance-based vs. Class-based Generation
10
© 2008, Cisco Systems, Inc. – Made available under the Eclipse Public License 1.0
Tigerstripe
Real-life Model-Driven Engineering
• The model…– Is shipped with product (partners/customers)– Is annotated
• To drive code generation• To document design• Documentation
• The platform…– Controls the model is valid– Facilitates distributed development– Generates content/code
Dev. Team (not shared with Partners/Customers)
Dev. Team (not shared with Partners/Customers)
Modeling Team (shared with Partners)
Modeling Team (shared with Partners)
Doc. Team (shared with Partners/Customers)Doc. Team (shared with Partners/Customers)
11
© 2008, Cisco Systems, Inc. – Made available under the Eclipse Public License 1.0
Tigerstripe
Tigerstripe Annotation Framework
• Principles– Associate Arbitrary
EMF object with URI– Independent of
Tigerstripe Core– Allow for custom UI,
both as property view or on GMF diagrams
– Control where they are persisted
package org.eclipse.tigerstripe.annotation.core;
import org.eclipse.emf.common.util.URI;import org.eclipse.emf.ecore.EObject;
public interface Annotation extends EObject { … URI getUri(); void setUri(URI value); … EObject getContent(); void setContent(EObject value); … String getId(); void setId(String value);
} // Annotation
package org.eclipse.tigerstripe.annotation.core;
import org.eclipse.emf.common.util.URI;import org.eclipse.emf.ecore.EObject;
public interface Annotation extends EObject { … URI getUri(); void setUri(URI value); … EObject getContent(); void setContent(EObject value); … String getId(); void setId(String value);
} // Annotation
12
© 2008, Cisco Systems, Inc. – Made available under the Eclipse Public License 1.0
Tigerstripe
• Goals:1. Documentation Annotations created when
Entities are created
2. Visual indication of documentation, and design notes
3. Require documentation content for code/content generation.
4. Integrate with Continous Build Environment
Let’s build an example!
1. Define an Artifact pattern to ensure “Entities are created with ‘Documentation’ Annotations”
<pattern:creationPatternpatternName="org.eclipse.tigerstripe.samples.eclipseSummit08.DocumentedEntity"uiLabel="Documented Entity" iconPath="icons/cube-new.png" disabledIconPath="icons/cube-new-gs.png"patternType="node" index="100"xmlns:pattern="http://org.eclipse.tigerstripe/xml/tigerstripeCreationPattern/v1-0"xmlns:ts="http://org.eclipse.tigerstripe/xml/tigerstripeExport/v2-0"><pattern:description>Create a new Documented Entity</pattern:description>
<ts:artifact name="_user1” artifactType="org.eclipse.tigerstripe.workbench.model.deprecated_.IManagedEntityArtifact">
<ts:annotations> <![CDATA[<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"
xmlns:d="http:///org/eclipse/tigerstripe/samples/eclipseSummit08/annotations/documentation.ecore">
<d:Documentation author="" content=""/> </xmi:XMI>]]> </ts:annotations></pattern:creationPattern>
1. Define an Artifact pattern to ensure “Entities are created with ‘Documentation’ Annotations”
<pattern:creationPatternpatternName="org.eclipse.tigerstripe.samples.eclipseSummit08.DocumentedEntity"uiLabel="Documented Entity" iconPath="icons/cube-new.png" disabledIconPath="icons/cube-new-gs.png"patternType="node" index="100"xmlns:pattern="http://org.eclipse.tigerstripe/xml/tigerstripeCreationPattern/v1-0"xmlns:ts="http://org.eclipse.tigerstripe/xml/tigerstripeExport/v2-0"><pattern:description>Create a new Documented Entity</pattern:description>
<ts:artifact name="_user1” artifactType="org.eclipse.tigerstripe.workbench.model.deprecated_.IManagedEntityArtifact">
<ts:annotations> <![CDATA[<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"
xmlns:d="http:///org/eclipse/tigerstripe/samples/eclipseSummit08/annotations/documentation.ecore">
<d:Documentation author="" content=""/> </xmi:XMI>]]> </ts:annotations></pattern:creationPattern>
3. Define custom audit code (IArtifactAuditor & ext. pt into Tigerstripe Incremental Builder) to check on content of Annotation.
3. Define custom audit code (IArtifactAuditor & ext. pt into Tigerstripe Incremental Builder) to check on content of Annotation.
2. Define custom IconProvider and ITigerstripeLabelDecorator driven by presence/Content of Annotations
2. Define custom IconProvider and ITigerstripeLabelDecorator driven by presence/Content of Annotations
4. Use buckminster to materialize and Maven to generate code/content.4. Use buckminster to materialize and Maven to generate code/content.
13
© 2008, Cisco Systems, Inc. – Made available under the Eclipse Public License 1.0
Tigerstripe
Example: Define 2 Annotation Types
• Annotation content is defined thru .Ecore• Register as AnnotationType, with proper target• Add LabelProvider, Validators, Constraints, etc…• See http://wiki.eclipse.org/Tigerstripe_APIs
• Annotation content is defined thru .Ecore• Register as AnnotationType, with proper target• Add LabelProvider, Validators, Constraints, etc…• See http://wiki.eclipse.org/Tigerstripe_APIs
<extension point="org.eclipse.tigerstripe.annotation.core.annotationType"> <definition description="Documentation content" eclass="Documentation" epackage-uri="http:///org/eclipse/… /annotations/documentation.ecore" name="Documentation"> <target type="org.eclipse.tigerstripe.workbench.model.deprecated_.IModelComponent" unique="true"> </target> </definition> </extension>
<extension point="org.eclipse.tigerstripe.annotation.core.annotationType"> <definition description="Documentation content" eclass="Documentation" epackage-uri="http:///org/eclipse/… /annotations/documentation.ecore" name="Documentation"> <target type="org.eclipse.tigerstripe.workbench.model.deprecated_.IModelComponent" unique="true"> </target> </definition> </extension>
14
© 2008, Cisco Systems, Inc. – Made available under the Eclipse Public License 1.0
Tigerstripe
Install Annotations… … and annotate the model.
Selection-based viewSelection-based view
Native EditPart on GMF DiagramsNative EditPart on GMF Diagrams
Annotation “routed” to .ann fileAnnotation “routed” to .ann file
15
© 2008, Cisco Systems, Inc. – Made available under the Eclipse Public License 1.0
Tigerstripe
Customized Workbench
16
© 2008, Cisco Systems, Inc. – Made available under the Eclipse Public License 1.0
Tigerstripe
Materialize and Build
• Use Buckminster to materialize
• Drive headless generation
<cs:cspec xmlns:cs="http://www.eclipse.org/buckminster/CSpec-1.0" name="Equipment-model" componentType="tigerstripe">
<cs:dependencies> <cs:dependency name="common-model" componentType="tigerstripe" /> <cs:dependency name="ClassLevel-Generator" componentType="tigerstripe.generator" /> </cs:dependencies> <cs:actions> <cs:public name="install-generator" actor="ant"> <cs:properties> <cs:property key="projectname" value="ClassLevel-Generator"/> </cs:properties> </cs:public> </cs:actions></cs:cspec> `
<cs:cspec xmlns:cs="http://www.eclipse.org/buckminster/CSpec-1.0" name="Equipment-model" componentType="tigerstripe">
<cs:dependencies> <cs:dependency name="common-model" componentType="tigerstripe" /> <cs:dependency name="ClassLevel-Generator" componentType="tigerstripe.generator" /> </cs:dependencies> <cs:actions> <cs:public name="install-generator" actor="ant"> <cs:properties> <cs:property key="projectname" value="ClassLevel-Generator"/> </cs:properties> </cs:public> </cs:actions></cs:cspec> `
<plugin> <groupId>cisco-tigerstripe</groupId> <artifactId>maven-tigerstripe-plugin</artifactId> <version>1.1</version> <executions> <execution> <configuration> <workspace>${basedir}/workspace</workspace> <projects> <param>${workspace}/base-defs</param> <param>${workspace}/common-model</param> <param>${workspace}/Equipment-model</param> </projects> <generationProject>${workspace}/Equipment-model</generationProject> </configuration> <goals> <goal>generate</goal> </goals> </execution> </executions> </plugin>
<plugin> <groupId>cisco-tigerstripe</groupId> <artifactId>maven-tigerstripe-plugin</artifactId> <version>1.1</version> <executions> <execution> <configuration> <workspace>${basedir}/workspace</workspace> <projects> <param>${workspace}/base-defs</param> <param>${workspace}/common-model</param> <param>${workspace}/Equipment-model</param> </projects> <generationProject>${workspace}/Equipment-model</generationProject> </configuration> <goals> <goal>generate</goal> </goals> </execution> </executions> </plugin>
17
© 2008, Cisco Systems, Inc. – Made available under the Eclipse Public License 1.0
Tigerstripe
Wrap-up
• Tigerstripe–As a workbench–As a MDE framework
• Annotation Framework• Integration with Continuous build
environments.
18
© 2008, Cisco Systems, Inc. – Made available under the Eclipse Public License 1.0
Tigerstripe