| <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" |
| "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> |
| <html xmlns="http://www.w3.org/1999/xhtml"> |
| <head> |
| <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /> |
| <title>org.eclipse.uml2.uml.ecore.importer Read Me</title> |
| </head> |
| <body lang="EN-US"> |
| <h3>Introduction</h3> |
| <p>This document describes how you can use scripts to generate code from a UML model. The |
| script can be either a regular shell script that invokes <a href="#headlessApplication">Eclipse headless |
| applications</a> or an Ant script that invokes the <a href="#antTasks">task</a> provided by this plug-in.</p> |
| |
| <h3><a name="overallComments">Overall Comments</a></h3> |
| <ul> |
| <li>If you didn't extract this plug-in from CVS, the "examples" directory mentioned |
| in this document is available in the UML2 source plug-in |
| (org.eclipse.uml2.source_<i><version></i>/src/org.eclipse.uml2.uml.ecore.importer_<i><version></i>). |
| <br/><br/></li> |
| <li>Before running your build scripts or the examples provided here, make sure you have the two |
| JAR files required by this plug-in ("uml2.uml.ecore.importer.jar" and |
| "uml2.uml.ecore.importer.tasks.jar") and also the two JAR files required by the <tt>org.eclipse.emf.ant</tt> |
| plug-in ("emf.ant.jar" and "emf.ant.tasks.jar"). If necessary, Eclipse |
| can generate them for you. All you need to do is to run the Ant script created by PDE when you right click on the manifest file |
| and select "PDE Tools > Create Ant Build File". |
| <br/><br/></li> |
| <li>Although the applications and task mentioned here must be executed by Eclipse (usually in headless mode), they can |
| work on files located in any directory. In other words, your models, templates and other files don't need |
| to be in the "plugins" directory nor in the workspace. |
| <br/><br/></li> |
| <li>In order to preserve the original state of this plug-in's "examples" directory, you |
| should copy it to a different location and run the Ant scripts from there. |
| <br/><br/></li> |
| <li>Starting a new JVM process and invoking Eclipse are expensive operations. Your build will |
| perform better if you are able to group the steps that require Eclipse in a few scripts |
| (one script would be ideal). This is probably a reason to use Ant instead of invoking the |
| applications - you can generate code for multiple models using one single Ant script. |
| <br/><br/></li> |
| <li>The "examples/library" directory contains a UML model, and shell and Ant scripts |
| to generate its code. |
| </li> |
| </ul> |
| |
| <h3><a name="headlessApplication">UML Importer and Generator Applications</a></h3> |
| <p>The application provided by this plug-in generates the ecore and genmodel files from models defined |
| using UML.</p> |
| <table border="1" cellpadding="2" cellspacing="0" |
| summary="Lists the details about the UML Importer application."> |
| <tr><td colspan="2">UML Importer application details</td></tr> |
| <tr><td>ID</td><td><tt>org.eclipse.uml2.uml.ecore.importer.UML2GenModel</tt></td></tr> |
| <tr><td>Class</td><td><tt>org.eclipse.uml2.uml.ecore.importer.UMLImporterApplication</tt></td></tr> |
| </table> |
| <p>To generate the actual Java code you will need to use a second application, provided by |
| the "org.eclipse.emf.codegen.ecore" plug-in.</p> |
| <table border="1" cellpadding="2" cellspacing="0" |
| summary="Lists the details about the Generator application."> |
| <tr><td colspan="2">Generator application details</td></tr> |
| <tr><td>ID</td><td><tt>org.eclipse.emf.codegen.ecore.Generator</tt></td></tr> |
| <tr><td>Class</td><td><tt>org.eclipse.emf.codegen.ecore.Generator</tt></td></tr> |
| </table> |
| <p>In order to run these or any other Eclipse application, you need to execute the following |
| command (without the line breaks):</p> |
| <p> |
| eclipse |
| <br/> -noSplash |
| <br/> -data <i><full path to a workspace - ideally an empty directory></i> |
| <br/> -application <i><application ID></i> |
| <br/> <i><application arguments></i> |
| </p> |
| <p>In Windows you should execute <i>eclipsec</i> instead of <i>eclipse</i> in order to have |
| access to the application's console output.</p> |
| <p>The directory "examples/library/build" has shell scripts that generate the code for |
| the model provided. If you have any questions after reading and experimenting with it, look at the |
| applications's javadoc for more details. Also, check the application's class |
| "getUsage()" method for the list of possible arguments.</p> |
| |
| |
| <h3><a name="antTasks">UML Generator Ant Task</a></h3> |
| <p>The UML Generator task details are:</p> |
| <table border="1" cellpadding="2" cellspacing="0" |
| summary="Lists the details about the UML Generator task."> |
| <tr><td>Name</td><td><tt>uml2.UML2Java</tt></td></tr> |
| <tr><td>Class</td><td><tt>org.eclipse.uml2.uml.ecore.importer.taskdefs.UMLGeneratorTask</tt></td></tr> |
| </table> |
| <p>This is the usual command line to run an Ant script using a headless Eclipse instance (remove the line breaks):</p> |
| <p> |
| eclipse |
| <br/> -noSplash |
| <br/> -data <i><full path to a workspace - ideally an empty directory></i> |
| <br/> -application org.eclipse.ant.core.antRunner |
| <br/> -buildfile <i><full path to your script></i> |
| </p> |
| <p>In Windows you should execute <i>eclipsec</i> instead of <i>eclipse</i> in order to have |
| access to the Ant build script console output.</p> |
| <p>You can also use the Eclipse UI to execute an Ant script containing a UML2 task. This can be |
| done by right-clicking the script and selecting |
| <i>Run As > Ant Build... > JRE > "Run in the same JRE as the workspace"</i>.</p> |
| <p>The directory "examples/library/build" has an Ant script that generates the code for |
| the model provided. The task's javadoc also has information you may find useful.</p> |
| |
| </body> |
| </html> |