Generating the XML Schema - FuGE

advertisement
Installing FuGE Milestone 3 UML Release 2 (Windows)
Page 1 of 20
Installing FuGE Milestone 3 UML Release 2 for XML Schema
Generation (Windows)
Settimo Szliske, BC Cancer Research Centre, Vancouver BC, Canada
Email: sszliske@bccrc.ca
Installing FuGE Milestone 3 UML Release 2 for XML Schema Generation (Windows).......................... 1
Introduction: ............................................................................................................................................ 2
Install Java .............................................................................................................................................. 2
Checking your java version: ............................................................................................................... 2
Install Java 1.5 if necessary ................................................................................................................ 2
Install Maven 2.0.4 ................................................................................................................................. 2
Downloaded maven 2.0.4. .................................................................................................................. 2
Set up Environmental Variables for Java and Maven ............................................................................. 3
Test Maven and create a local repository ............................................................................................... 4
Install AndroMDA Application plugin ................................................................................................... 5
Install the AndroMDA SNAPSHOT for Maven 2(not needed).............................................................. 6
Install MagicDraw Community Edition 11.6.......................................................................................... 6
Create the Starter Application ................................................................................................................. 7
FuGE specific configuration ....................................................................................................................... 9
Setting up XMLSChemaMappings.xml file ........................................................................................... 9
Setting up the XML Schema cartridge.................................................................................................... 9
Download the FuGE Milestone 3 UML 2 files ..................................................................................... 10
Installing the FuGE Milestone 3 UML 2 files ...................................................................................... 11
Download 7-zip (a freeware tar utility) ............................................................................................ 11
Using 7-zip to extract the files from ExampleModelAndProfiles.tar ............................................... 11
Creating a Test Model in Magic Draw ..................................................................................................... 12
Modifying Andromda configuration files to work with your Magic Draw model ............................... 15
Generating the XML Schema ................................................................................................................... 19
Appendix A- Unable to download the artifact from any repository ..................................................... 19
Installing FuGE Milestone 3 UML Release 2 (Windows)
Page 2 of 20
Introduction:
This guide is intended to provide clear, complete and detailed instructions on how to create an XML
schema based on the FuGE model using Andromda. The approach taken was to compile information
from several sources and combine it into one document.
Special thanks to Andy Jones for his invaluable assistance. Junmin Liu has provided an insightful guide
to creating XML schemas in a wiki posting. Finally, the Andromda site has an excellent tutorial on its
site called “Java getting started (3.2) which was written by Naresh Bhatia. Note that this document only
includes what is needed to generate an XML schema.
Install Java
Checking your java version:
Navigate to Start | Settings | Control Panel and look for a Java icon
If there is no Java icon you will need to install it (see the next section)
If you found the Java icon, double click on it. In the General tab, click on the About button. You will
see something like the following:
Java 2 Platform Standard Edition
Version 1.5.0 (build 1.5.0_06-b05)
One of the tools that FuGE relies on is called AndroMDA. The AndroMDA “Getting Started Java”
tutorial strongly recommends using the J2SE Development Kit 5.0 (JDK 5.0).
Note: “Version 1.5.0” above actually refers to JDK 5.0, so this PC has the correct version of Java
If you have an earlier version of java such as 1.4 it is recommended to upgrade to version 1.5 (see the
next section)
Install Java 1.5 if necessary
For our purposes you will need to install Java SE (Standard Edition).
Note: NetBeans and Java EE (Enterprise Edition) also appear on the Java download page but they are
not required in our case.
The J2SE Development Kit 5.0 (JDK 5.0) is available from here
Install Maven 2.0.4
Downloaded maven 2.0.4.
Installing FuGE Milestone 3 UML Release 2 (Windows)
Page 3 of 20
For windows select maven-2.0.4-bin.zip from http://maven.apache.org/download.html. Right click one
of the links under the HTTP heading and use Save Target As. Navigate to a convenient location to save
the file to and click the Save button.
Create a folder to install maven into.
The recommended folder to install maven into is C:\Program Files\Apache Software Foundation
If you are restricted from created folders in C:\Program Files then you can skip
this step and install maven into c:\.
Unzip maven-2.0.4-bin.zip by double clicking on it. Extract the files into C:\Program Files\Apache
Software Foundation if you were able to create it, otherwise extract the files to
c:\
Create a folder for maven repository (this directory is used in a later step)
To work off your local c: drive use:
C:\Documents and Settings\your user name\.m2\repository
To work off of your organizations LAN use:
E:\.m2\repository
(where E: is the drive letter of your LAN home directory)
Set up Environmental Variables for Java and Maven
Set environmental variables for java and maven 2 go to Start | Settings | Control Panel | System. Click
on Advanced tab. Click on “Environmental Variables” button. Use New and Edit buttons as needed.
Variable name
M2_HOME
Variable value
C:\maven-2.0.4
or
C:\Program Files\Apache Software Foundation\maven-2.0.4
M2_REPO
MAVEN_OPTS
JAVA_HOME
PATH
E:\.m2\repository
or
C:\Documents and Settings\your user name\.m2\repository
-XX:MaxPermSize=128m -Xmx512m
C:\Program Files\Java\jdk1.5.0_06 (your last two digits may be different)
In some organizations this may be locked down (Edit will be greyed out)
If you can update the path add the following to the end of the PATH variable:
;%JAVA_HOME%\bin;%M2_HOME%\bin
When you are done, it will look similar to the following (some of your values may be different)
Installing FuGE Milestone 3 UML Release 2 (Windows)
Page 4 of 20
Click OK twice to save the changes.
IMPORTANT NOTE: If you could not change the path variable, you will need to substitute
%M2_HOME%\bin\mvn whereever you see mvn in the instructions that follow.
Test Maven and create a local repository
The rest of this section is copied from the AndroMDA “Getting Started Java” instructions.
“Maven is based on the concept of a central, local repository located on your machine, where it stores artifacts
such as 3rd party libraries as well as components created by you. …. Note that so far we have installed only the
Maven application, we have not created a local repository. Follow the steps below to test your Maven installation
and force the creation of a local repository. We will use a standard Maven plugin to create a temporary project
which we will delete later.”
1. Open a Command Prompt and change the current directory to any temporary directory, such as
C:\temp.
2. Execute the following command to make sure you can run Maven:
mvn --version
3. Maven should display the following output:
Maven version: 2.0.4.
4. Now execute the following command to create a temporary project:
mvn archetype:create -DgroupId=testapp -DartifactId=testapp
Make sure that you get a BUILD SUCCESSFUL message at the end. Sometimes due to bad Internet
connectivity, Maven may not be able to download all dependencies. If your build fails due to this reason,
try to issue the command again until you get a successful build.
5. Verify that Maven created a temporary project called testapp in the current directory and also a local
repository at the default location mentioned above. If both these results are achieved successfully, you
can delete the temporary project that was just created.
(Note: In other words, you can delete the c:\temp\testapp folder)
Installing FuGE Milestone 3 UML Release 2 (Windows)
Page 5 of 20
Install AndroMDA Application plugin
The rest of this section is copied from the AndroMDA “Getting Started Java” instructions.
1. Click here to download the AndroMDA plugin installer (to a convenient location).
2. Unzip the contents of the installer into your Maven repository at C:\Documents and Settings\your
user name\.m2\repository.
3. Verify that the following directory was created:
C:\Documents and Settings\your user
name\.m2\repository\org\andromda\maven\plugins\andromda-maven-plugin
Installing FuGE Milestone 3 UML Release 2 (Windows)
Page 6 of 20
Install the AndroMDA SNAPSHOT for Maven 2(not needed)
1. Use this URL http://andromda.org/maven2/org/andromda/distributions/
2. Click on andromda-bin-3.2-SNAPSHOT and you will be prompted to save this zip file
4. Double click on the file above and extract the files to your maven 2 repository (e.g.
E:\.m2\repository or C:\Documents and Settings\your user name\.m2\repository)
Install MagicDraw Community Edition 11.6
Note: The FuGE Milestone 3 UML release requires MagicDraw 11.5 or greater.
Use the ftp site to download MagicDraw 11.6 Community Edition
ftp://ftp.magicdraw.com/pub/MagicDraw/community_edition/11.6/
Double click on the windows version: MD_UML_116_CE_win.exe
Select the path to save the installation files to’ (e.g. c:\downloads)
Create the folder for MagicDraw to (c:\program files\ MagicDraw UML Community Edition)







Double click on MD_UML_116_CE_win.exe to start the install.
Select language and click OK
Click Next twice
Make sure the “Install a Java VM specifically for this application” is selected (this is the default)
Click Next.
Choose folder to install MagicDraw that you created above and click on Next.
Click on Install
The following section is taken from the “Java Getting Started” tutorial:
Set up a path variables in MagicDraw specifying the location of your Maven 2 repository.
1. Start MagicDraw.
2. Choose Options > Environment from the main menu.
3. Click on Path Variables.
4. Click on Add in the Path Variables panel.
5. Enter maven2.repository in the Name field.
6. Enter the location of your Maven 2 repository in the Value field, e.g.C:\Documents and
Settings\your user name\.m2\repository
7. Click OK twice.
8. Close MagicDraw.
Installing FuGE Milestone 3 UML Release 2 (Windows)
Page 7 of 20
Create the Starter Application
The following steps create the project and the directory structure for xml schema generation.
Open a command prompt window ( Start | Programs | Accessories | Command Prompt)
Change to the drive you want to work in if necessary (Example: c: and press ENTER key)
Change to the folder you want to work in if necessary (Example: cd \)
Type in the responses in bold exactly as shown below. This is based on the example from the
AndroMDA “Java Getting Started” tutorial.
Note: If you get a BUILD FAILURE with an error like “unable to download the mavenandromdapp-plugin” while running the following step, see Appendix A and then try it again.
c:\>mvn org.andromda.maven.plugins:andromdapp-maven-plugin:3.2-SNAPSHOT:generate
[INFO] Scanning for projects...
[INFO] --------------------------------------------------------------------------[INFO] Building Maven Default Project
[INFO] task-segment: [org.andromda.maven.plugins:andromdapp-maven-plugin:3.2SNAPSHOT:generate] (aggregator-style)
[INFO] --------------------------------------------------------------------------[INFO] snapshot org.andromda:andromda-core:3.2-SNAPSHOT: checking for updates fr
om andromda
[INFO] snapshot org.andromda.templateengines:andromda-templateengine-velocity:3.
2-SNAPSHOT: checking for updates from andromda
[INFO] snapshot org.andromda.templateengines:andromda-templateengines:3.2-SNAPSH
OT: checking for updates from andromda
[INFO] snapshot org.andromda.andromdapp.projects:andromda-andromdapp-project-ric
hclient-ant:3.2-SNAPSHOT: checking for updates from andromda
[INFO] snapshot org.andromda.andromdapp.projects:andromda-andromdapp-projects:3.
2-SNAPSHOT: checking for updates from andromda
[INFO] snapshot org.andromda.andromdapp:andromda-andromdapp:3.2-SNAPSHOT: checki
ng for updates from andromda
[INFO] snapshot org.andromda.andromdapp:andromda-andromdapp-core:3.2-SNAPSHOT: c
hecking for updates from andromda
[INFO] snapshot org.andromda.andromdapp.projects:andromda-andromdapp-project-j2e
e-maven2:3.2-SNAPSHOT: checking for updates from andromda
[INFO] [andromdapp:generate]
INFO [AndroMDA] discovered andromdapp type --> 'richclient'
INFO [AndroMDA] discovered andromdapp type --> 'j2ee'
Please choose the type of application to generate [richclient, j2ee]
j2ee
Please enter the location in which your new application will be created (i.e. f:
/java/development):
c:/
Please enter your first and last name (i.e. Chad Brandon):
Settimo Szliske
Which kind of modeling tool will you use? [uml1.4, uml2, emf-uml2]:
uml2
Please enter the name of your J2EE project (i.e. Animal Quiz):
FlowFuGE
Installing FuGE Milestone 3 UML Release 2 (Windows)
Page 8 of 20
Please enter an id for your J2EE project (i.e. animalquiz):
flowfuge
Please enter a version for your project (i.e. 1.0-SNAPSHOT):
1.0-SNAPSHOT
Please enter the root package name for your J2EE project (i.e. org.andromda.samp
les.animalquiz):
org.andromda.flowfuge
Would you like an EAR or standalone WAR? [ear, war]:
ear
Please enter the type of transactional/persistence cartridge to use [hibernate,
ejb, ejb3, spring, none]:
spring
Please enter the database backend for the persistence layer [hypersonic, mysql,
oracle, db2, informix, mssql, pointbase, postgres, sybase, sabdb, progress, derb
y]:
mysql
Will your project need workflow engine capabilities? (it uses jBPM and Hibernate
3)? [yes, no]:
no
Please enter the hibernate version number (enter '2' for 2.x or '3' for 3.x) [2,
3]:
3
Will your project have a web user interface? [yes, no]:
yes
Would you like your web user interface to use JSF or Struts? [jsf, struts]:
struts
Would you like to be able to expose your services as web services? [yes, no]:
no
------------------------------------------------------------------------------------G e n e r a t i n g A n d r o M D A P o w e r e d A p p l i c a t i on
------------------------------------------------------------------------------------Output: 'file:/c:/flowfuge/app/src/main/application/META-INF/jboss-app.xml'
Output: 'file:/c:/flowfuge/app/src/main/config/flowfuge-ds.xml'
Output: 'file:/c:/flowfuge/app/pom.xml'
Output: 'file:/c:/flowfuge/core/target/classes/META-INF/ejb-jar.xml'
Output: 'file:/c:/flowfuge/core/pom.xml'
Output: 'file:/c:/flowfuge/pom.xml'
Output: 'file:/c:/flowfuge/readme.txt'
Output: 'file:/c:/flowfuge/common/pom.xml'
Output: 'file:/c:/flowfuge/mda/src/main/config/mappings/WebMergeMappings.xml
'
Output: 'file:/c:/flowfuge/mda/src/main/config/andromda.xml'
Output: 'file:/c:/flowfuge/mda/src/main/uml/flowfuge.xml'
Output: 'file:/c:/flowfuge/mda/pom.xml'
Output: 'file:/c:/flowfuge/web/src/main/properties/messages.properties'
Output: 'file:/c:/flowfuge/web/pom.xml'
Output: 'file:/c:/flowfuge/web/target/flowfuge-web-1.0-SNAPSHOT/WEB-INF/web.
xml'
------------------------------------------------------------------------------------New application generated to --> 'file:/c:/flowfuge/'
Instructions for your new application --> 'file:/c:/flowfuge/readme.txt'
------------------------------------------------------------------------------------[INFO] -----------------------------------------------------------------------[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
Installing FuGE Milestone 3 UML Release 2 (Windows)
Page 9 of 20
[INFO] Total time: 2 minutes 58 seconds
[INFO] Finished at: Mon Nov 06 13:56:30 PST 2006
[INFO] Final Memory: 11M/27M
[INFO] -----------------------------------------------------------------------c:\>
FuGE specific configuration
Setting up XMLSChemaMappings.xml file
Navigate your browser to http://galaxy.andromda.org/docs/mappings/XmlSchemaMappings.xml
This will load the file into your browser.
Use File | Save As and then navigate to the folder C:\your project name\mda\src\main\config\mappings
Change the file name to XmlSchemaMappings.xml and click the Save button.
Setting up the XML Schema cartridge
1. Create the folder structure for the custom xml schema file provided for FuGE
milestone 3.
Note: In the instructions that follow replace “E:\flowgate” with the project
directory that you are using:
To create a subdirectory, navigate to the parent directory
(e.g. E:\flowgate\mda\src)
Select File | New Folder
Right-click on the folder and select Rename
Type in the name of the folder you want to create.
Create the following directories:
1.
2.
3.
4.
E:\flowgate\mda\src\cartridge
E:\flowgate\mda\src\cartridge\custom
E:\flowgate\mda\src\cartridge\custom\templates
E:\flowgate\mda\src\cartridge\custom\templates\xmlschema
2. Save the FuGE xml schema cartridge file to the directory you just created in
step 4 above
Point your browser to http://fuge.sourceforge.net/dev/index.php#m3_u2
Installing FuGE Milestone 3 UML Release 2 (Windows)
Page 10 of 20
Save the cartridge file to the directory E:\your project\mda\src\catridge\custom\templates\xmlschema
and rename it to XMLSchema.vsl. See the screen shot below for the instructions in red:
XMLSchema.vsl <-- for now didn’t do anything with the FuGE custom velocity template for new
schema method
Created folder structure “C:\fcmv1\mda\src\cartridge\custom\templates\xmlschema”
Copy target from http://fuge.sourceforge.net/dev/XmlSchema_Milestone3.vsl
Note: appears as “XmlSchema_Milestone3.xml”, not “XmlSchema_Milestone3.vsl” (didn’t rename for
now)
Download the FuGE Milestone 3 UML 2 files
Fuge M3 UML link
Use this link for FuGE Milestone 3 UML release http://fuge.sourceforge.net/dev/index.php#m3_u2
There are two files to download:
1. Double click on the gzip link. Click on Save and navigate to the directory where you want to
save it to (e.g. i:\flowtemp). Click on Save
This will download the FuGE_M3 profile and the AndroMDA profiles
2. Right click on the Cartridge link and select Save Target As and save to a convenient location.
This file is used to customize the XML Schema
See the screen shot below
Installing FuGE Milestone 3 UML Release 2 (Windows)
Page 11 of 20
Step 1 will save the file ExampleModelAndProfiles.tar to the location that you specified.
Installing the FuGE Milestone 3 UML 2 files
( Extracting the tar file ExampleModelAndProfiles.tar )
The first step is to download and install a Windows program that can extract tar files.
Download 7-zip (a freeware tar utility)
Create a directory for 7-zip (for example c:\7-zip or i:\7-zip on a network)
Go to the link: http://www.7-zip.org/
Double click on the Download link next to the Type .exe
Double click on the Download link for the location nearest to you.
Click on Save and navigate to the location of the directory created above (e.g. c:\7-zip)
To install double click on the file created above and click on Run. (e.g. c:\7-zip\7z442)
You will be prompted to install the program, click on browse to select the directory you
created above (e.g.c:\zip), click OK and then click Install. Click Finish when done.
Using 7-zip to extract the files from ExampleModelAndProfiles.tar
Start | Programs | 7-Zip | 7-Zip File Manager
Navigate to the folder that contains ExampleModelAndProfiles.tar (e.g. )
Note: click on the
icon to change folders if needed.
Click on the Extract button (click OK to select the default location)
You will see a folder with the same name as the tar file (e.g. ExampleModelAndProfiles.tar)
Double click on this folder (e.g. ExampleModelAndProfiles.tar)
Double click on the tar file in this folder (e.g. ExampleModelAndProfiles.tar)
Click on Edit | Select All to select all three files)
Installing FuGE Milestone 3 UML Release 2 (Windows)
Page 12 of 20
Click on Extract. You will see a dialog box. Navigate to the final location where you want to install
these files (e.g. xxxx)
Click on OK on both dialog boxes.
To confirm that the files were installed you can navigate to the install directory using Windows
Explorer
Eg. E:\ExampleFuge
Creating a Test Model in Magic Draw
Start Magic Draw (Start | Programs | Magic Draw UML Community Edition
Navigate to the folder that you extracted the zip into (e.g. E:\ExampleFuge)
Open the magic draw file ExampleModel.mdzip
Immediately, save this project to a new name ( File | Save Project As and type in the name for your
Magic Draw project (e.g. TestModel) and click on the Save button.
Make sure that the following profiles are displayed
To prepare for modeling, set up a package.
1. Right click on Data
Installing FuGE Milestone 3 UML Release 2 (Windows)
Page 13 of 20
2. Select New Element | Package
3. Name the package with a short and meaningful name (e.g. FlowCyt) Note that this package
name will be used in configuration file later in the process.
Add a Class Diagram
1. Right click on the package name created above (e.g. FlowCyt)
2. Select New Diagram | Class Diagram
3. Name the Class Diagram with a descriptive name (e.g. FlowcytometerEquipment)
Make sure that you screen exactly matches the diagram below (except you will have chosen different
names for your package and class diagram)
You are now ready to add Classes to the Class Diagram and start building your model. It is
recommended that you create a single class model to test generating an xml schema before creating
more advanced models.
Add the Stereotypes XMLSchemaType and Entity to TestClass
Installing FuGE Milestone 3 UML Release 2 (Windows)
1.
2.
3.
4.
Page 14 of 20
Right click on TestClass and select Stereotypes
Type x in the dialog box to display the XMLSchemaType stereotype.
Click the check box next to XMLSchemaType stereotype.to select it.
Click on the Apply button
1. Right click on TestClass and select Stereotypes
2. Type e in the dialog box to display the Entity stereotype (make sure that you select
Entity[Class].[org.andromda.profiles:.persistance])
3. Click the check box next to Entity .to select it.
Click on the Apply button
You can display the Sterotypes to make sure they are set up correctly.
1. Right click on TestClass and scroll down to Presentation Options.
2. Scroll down to the arrow at the bottom to display all the choices.
3. Check the box next to Show Stereotypes
Use File | Save Project to save your work.
Exporting your model to Andromda
One of the previous steps created a starter application and a directory structure. To use our uml2 model
in Andromda we simply export it to the correct directory.
1. Click on the File Menu and scroll to the downward arrow at the bottom to display all File menu
selections
2. Select Export | EMF UML2 (v1.x) XMI
3. A select location dialog will appear
4. Browse to the uml directory in the project created above (for example E:\your
project\mda\src\main\uml)
After you do this the first time you will be prompted to overwrite files. Select Yes in this case.
Installing FuGE Milestone 3 UML Release 2 (Windows)
Page 15 of 20
Modifying Andromda configuration files to work with your Magic Draw
model
The first file to modify is called pom.xml and it is located in the directory E:\your project\mda.
I have included the entire file, which takes up more space, but it almost makes it clearer. Changes are
highlighted in red.
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.andromda.flowcytometry</groupId>
<artifactId>flowcytometry</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>flowcytometry-mda</artifactId>
<packaging>pom</packaging>
<name>FlowCytometry MDA</name>
<dependencies>
<dependency>
<groupId>org.andromda.profiles.uml2</groupId>
<artifactId>andromda-profile</artifactId>
<type>xml.zip</type>
</dependency>
<dependency>
<groupId>org.andromda.cartridges</groupId>
<artifactId>andromda-spring-cartridge</artifactId>
</dependency>
<dependency>
<groupId>org.andromda.cartridges</groupId>
<artifactId>andromda-hibernate-cartridge</artifactId>
</dependency>
<dependency>
<groupId>org.andromda.cartridges</groupId>
<artifactId>andromda-java-cartridge</artifactId>
</dependency>
<dependency>
<groupId>org.andromda.cartridges</groupId>
<artifactId>andromda-bpm4struts-cartridge</artifactId>
</dependency>
<dependency>
<groupId>org.andromda.translationlibraries</groupId>
<artifactId>andromda-ocl-validation-library</artifactId>
</dependency>
<dependency>
<groupId>org.andromda.translationlibraries</groupId>
<artifactId>andromda-ocl-query-library</artifactId>
</dependency>
<!-- Addeed the following based on Junmin Lui’s wiki -->
<dependency>
<groupId>org.andromda.cartridges</groupId>
<artifactId>andromda-xmlschema-cartridge</artifactId>
<version>${andromda.version}</version>
</dependency>
</dependencies>
<build>
<sourceDirectory>${project.basedir}/src/main/uml</sourceDirectory>
<plugins>
<plugin>
<groupId>org.andromda.maven.plugins</groupId>
<artifactId>andromda-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>run</goal>
</goals>
</execution>
Installing FuGE Milestone 3 UML Release 2 (Windows)
Page 16 of 20
</executions>
<configuration>
<configurationUri>${pom.basedir}/src/main/config/andromda.xml</configurationUri>
</configuration>
</plugin>
<plugin>
<groupId>org.andromda.maven.plugins</groupId>
<artifactId>andromdapp-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>eclipse</goal>
</goals>
</execution>
</executions>
<configuration>
<excludes>
<exclude>app/pom.xml</exclude>
<exclude>mda/pom.xml</exclude>
<exclude>webservice/pom.xml</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
<properties>
<!—the line below corresponds to your Magic Draw model name with the extention
.uml2 added, in our case TestModel.uml2 -->
<model.uri>file:${project.build.sourceDirectory}/TestModel.uml2</model.uri>
<!-- added below per jumin wiki/Andy -->
<andromda.version>3.2-SNAPSHOT</andromda.version>
<filter></filter>
<validation>true</validation>
<conf.dir>${pom.basedir}/src/main/config</conf.dir>
<!-- cartridge output locations -->
<core.generated.dir>${pom.basedir}/../core/target/src</core.generated.dir>
<core.manual.dir>${pom.basedir}/../core/src/main/java</core.manual.dir>
<web.generated.dir>${pom.basedir}/../web/target/src</web.generated.dir>
<web.manual.dir>${pom.basedir}/../web/src/main</web.manual.dir>
<web.manual.java.dir>${web.manual.dir}/java</web.manual.java.dir>
<common.generated.dir>${pom.basedir}/../common/target/src</common.generated.dir>
<!-- hibernate configuration -->
<!-- default strategy to use when using inhertiance -->
<hibernate.inheritance.strategy>subclass</hibernate.inheritance.strategy>
<hibernate.db.showSql>true</hibernate.db.showSql>
<!-- hibernate generator class to use for identifiers -->
<hibernate.generatorClass>native</hibernate.generatorClass>
</properties>
</project>
The second file to modify is called andromda.xml. It is located in the directory
E:\flowcytometry\mda\src\main\config. I have included the entire file, which takes up more space, but it
almost makes it clearer. Changes are highlighted in red. Deletions are in blue
<andromda>
<properties>
<property name="modelValidation">${validation}</property>
<property name="cartridgeFilter">${filter}</property>
</properties>
<server>
<host>localhost</host>
<port>4447</port>
</server>
<repositories>
<repository name="emf-uml2">
<models>
<model type="emf-uml2">
<uri>${model.uri}</uri>
<!-- add the following lines -->
Installing FuGE Milestone 3 UML Release 2 (Windows)
Page 17 of 20
<modelPackages processAll="true"> <!-- changed to false, only produced xml header -->
<!-- added the following 2 lines -->
<modelPackage process="false">FuGE::**</modelPackage>
<!-- in the following line, change FlowCty to the package name you used in Magic Draw -->
<modelPackage process="true">FlowCyt::**</modelPackage>
<!-- This can be used for testing, generating particular packages only -->
<!-<modelPackage process="false">FuGE::**</modelPackage> -->
<!-<modelPackage process="true">PSI-PI::**</modelPackage> -->
<!-<modelPackage process="true">GelML::**</modelPackage> -->
</model>
</models>
</repository>
</repositories>
<namespaces>
<namespace name="default">
<properties>
<property name="languageMappingsUri">Java</property>
<property name="wrapperMappingsUri">JavaWrapper</property>
<property name="sqlMappingsUri">${sql.mappings}</property>
<property name="jdbcMappingsUri">JDBC</property>
<property name="maxSqlNameLength">30</property>
<property name="foreignKeySuffix">_FK</property>
<property name="ejbJndiNamePrefix">${application.id}-${pom.version}</property>
<!-- these masking properties allow you to configure the way
your model element names are generated -->
<property name="classifierNameMask">none</property>
<property name="operationNameMask">none</property>
<property name="roleNameMask">none</property>
<property name="enumerationNameMask">none</property>
<property name="enumerationLiteralNameMask">upperunderscore</property>
<property name="entityNameMask">none</property>
<property name="entityPropertyNameMask">none</property>
<property name="parameterNameMask">none</property>
<property name="hibernateVersion">3</property>
</properties>
</namespace>
<!-- delete the following sections in blue-->
<namespace name="spring">
<properties>
<property name="dataSource">${dataSource}</property>
<property name="username">${jdbc.username}</property>
<property name="password">${jdbc.password}</property>
<property name="driver">${jdbc.driver}</property>
<property name="connectionUrl">${jdbc.url}</property>
<property name="hibernateDialect">${hibernate.dialect}</property>
<property name="hibernateShowSql">${hibernate.db.showSql}</property>
<property name="hibernateQueryUseNamedParameters">true</property>
<property name="sessionFactory">org.springframework.orm.hibernate3.LocalSessionFactoryBean</property>
<property name="localTransactionManager">org.springframework.orm.hibernate3.HibernateTransactionManager</property>
<property name="hibernateCacheProvider">org.hibernate.cache.EhCacheProvider</property>
<property name="hibernateQueryCacheFactory">org.hibernate.cache.StandardQueryCacheFactory</property>
<property name="hibernateInheritanceStrategy">${hibernate.inheritance.strategy}</property>
<property name="springTypesPackage">${application.package}</property>
<property name="daos">${core.generated.dir}</property>
<property name="dao-impls">${core.manual.dir}</property>
<property name="spring-configuration">${core.generated.dir}</property>
<property name="services">${core.generated.dir}</property>
<property name="service-impls">${core.manual.dir}</property>
<property name="service-interfaces">${common.generated.dir}</property>
<property name="criteria">${common.generated.dir}</property>
<property name="value-objects">${common.generated.dir}</property>
<property name="enableSpringTransactionsWhenEjbsEnabled">true</property>
<!-- to remove any dependency on EJB, comment the following property -->
<property name="session-ejbs">${core.generated.dir}</property>
<!-- uncomment to enable EJB security
<property name="securityRealm">${application.id}</property>
-->
</properties>
</namespace>
<namespace name="hibernate">
<properties>
Installing FuGE Milestone 3 UML Release 2 (Windows)
Page 18 of 20
<property name="hibernateEnableCache">false</property>
<property name="hibernateEnableAssociationsCache">false</property>
<property name="hibernateTypeMappingsUri">Hibernate</property>
<property name="hibernateInheritanceStrategy">${hibernate.inheritance.strategy}</property>
<property name="defaultHibernateGeneratorClass">${hibernate.generatorClass}</property>
<property name="hibernateAggregationCascade">delete</property>
<property name="hibernateDefaultCascade">none</property>
<property name="entities">${core.generated.dir}</property>
<property name="entity-impls">${core.manual.dir}</property>
<property name="entity-mappings">${core.generated.dir}</property>
<property name="user-types">${core.generated.dir}</property>
<property name="customTypesPackage">${application.package}</property>
<property name="compositionDefinesEagerLoading">true</property>
<property name="cache">${core.generated.dir}</property>
</properties>
</namespace>
<namespace name="java">
<properties>
<property name="enumerations">${common.generated.dir}</property>
<property name="exceptions">${common.generated.dir}</property>
<property name="value-objects">${common.generated.dir}</property>
<property name="interfaces">${common.generated.dir}</property>
</properties>
</namespace>
<namespace name="bpm4struts">
<properties>
<property name="forms">${web.generated.dir}</property>
<property name="pages">${web.generated.dir}</property>
<property name="actions">${web.generated.dir}</property>
<property name="controllers">${web.generated.dir}</property>
<property name="controller-impls">${web.manual.java.dir}</property>
<property name="decorators">${web.manual.java.dir}</property>
<property name="messages">${web.generated.dir}/WEB-INF/classes</property>
<property name="configuration">${web.generated.dir}/WEB-INF</property>
<!-- uncomment to enable web tier security
<property name="securityRealm">${application.id}</property>
-->
<property name="serviceAccessorPattern">${application.package}.ServiceLocator.instance().get{1}()</property>
<property name="mergeMappingsUri">file:${conf.dir}/mappings/WebMergeMappings.xml</property>
<property name="manageableServiceAccessorPattern">${application.package}.ManageableServiceLocator.instance().get{1}()</property>
</properties>
</namespace>
<!-- added the following namespace -->
<namespace name="xmlschema">
<properties>
<property name="overwrite">true</property>
<!-- <property name="mergeMappingsUri">file:${conf.dir}/mappings/XMLSchemaMappings.xml</property> Added this line AJ 19/12/05 -->
<!-- <property name="languageMappingsUri">XmlSchema</property> -->
<property name="languageMappingsUri">file:${conf.dir}/mappings/XMLSchemaMappings.xml</property> <!-- Uncomment to override the
default mappings -->
<property name="mergeLocation">${pom.basedir}/src/cartridge/custom</property>
<property name="wrapperMappingsUri">JavaWrapper</property>
<property name="schema">${web.generated.dir}</property>
<!-- Set this property for the namespace of the schema
<property name="namespace">fuge.sf.net</property> -->
<property name="namespace">www.flowcyt.org</property>
<!-- <property name="namespace">psidev.sf.net/anXML</property> -->
<!-- AJ: invented the following property to see if it can be used by XML cartridge - seemingly cannot invent properties...
<property name="namePrefix">psidev.sf.net/gelml</property>
-->
<!-- From Junmin's Wiki:
<property name="overwrite">true</property>
<property name="languageMappingsUri">XmlSchema</property>
<property name="wrapperMappingsUri">JavaWrapper</property>
<property name="schema">${web.generated.dir}</property>
<property name="namespace">http://www.mged.org</property>
<property name="mergeMappingsUri">file:${conf.dir}/mappings/XMLSchemaMappings.xml</property>
<property name="mergeLocation">${pom.basedir}/src/cartridge/custom</property>
Installing FuGE Milestone 3 UML Release 2 (Windows)
Page 19 of 20
-->
</properties>
</namespace>
</namespaces>
</andromda>
Generating the XML Schema
Start | Programs | Accessories | Command Prompt
Change to the drive that your model is on if necessary (e.g. type e:<Enter>)
Change to the mda directory of your model (for example cd \flowcytometry\mda)
Execute the following command to generate your schema
mvn -o
You should see a “Build Successful” message.
By default your xml schema will named xmlSchema.xsd. It will be created in the directory
“\your project\web\target\src”
If you get an errors such as an empty schema, see the trouble shooting section (this section still needs
work).
Appendix A- Unable to download the artifact from any repository
If you get an error when you run
mvn org.andromda.maven.plugins:andromdapp-maven-plugin:generate
Change the pom.xml file located at
C:\Documents and Settings\sszliske\.m2\repository\org\andromda\maven\plugins\andromdapp-mavenplugin\3.2
This is based on andromda forum posting: http://galaxy.andromda.org/forum/viewtopic.php?p=18148#18148
<?xml version="1.0"?><project>
<parent>
<artifactId>andromda-maven-plugins</artifactId>
<groupId>org.andromda.maven.plugins</groupId>
<version>3.2</version>
</parent>
<!-- added the following section based to
http://galaxy.andromda.org/forum/viewtopic.php?p=18148#18148
this is to work around an error "maven-andromdapp-plugin not found" -->
<repositories>
Installing FuGE Milestone 3 UML Release 2 (Windows)
<repository>
<releases />
<snapshots>
<enabled>true</enabled>
</snapshots>
<id>AndroMDA</id>
<name>AndroMDA</name>
<url>http://team.andromda.org/maven2</url>
</repository>
</repositories>
<!-- end of added section -->
<modelVersion>4.0.0</modelVersion>
<artifactId>andromdapp-maven-plugin</artifactId>
Page 20 of 20
Download