hit counter for blogger

Entries from June 2008 ↓

Start Your First AndroMDA Project

This entry shows you step-by-step how to create an AndroMDA project

Step1: Environment Setup

Requires:
– JDK 6
– maven 2.0.5 (default is 2.0.5 but can configure to use 2.0.7)
– JBoss 4.0.4.GA
– AndroMDA plugin
– UML tool
– ArgoUML (UML1.4/XMI 1.2)
– MagicDraw 9.5 (UML1.4/XMI 1.2)
– MagicDraw 11.5 (UML 2/EMF)
– RSM 6 (Rational Software Modeler/Architect)(UML 2/EMF)
– database server which supports Hibernate
– MySQL
– MySQL database server
– MySQL GUI Tools Bundle
– MySQL Connector/J version 5.0.4 (can confgirue to use other version, but default is 5.0.4)
– Eclipse (optional)

Step2: Create the Starter Application


1) At cmd, type:

mvn.org.andromda.maven.plugins:andromdapp-maven-plugin:3.2:generate

    0Please 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):
Jessica Chiang

Which kind of modeling tool will you use? [uml1.4, uml2, emf-uml2]:
Use the list below to enter the correct choice:
ArgoUML: uml1.4
MagicDraw 9.x: uml1.4
MagicDraw 11.5: uml2
RSM 6: emf-uml2
uml1.4

Please enter the name of your J2EE project (i.e. Animal Quiz):
GMT Repo

Please enter an id for your J2EE project (i.e. animalquiz):
gmtrepo

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.samples.animalquiz):
com.dsc.gmtrepo

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, derby]:
mysql

Will your project need workflow engine capabilities?
(it uses jBPM and Hibernate3)? [yes, no]:
no

Please enter the hibernate version number
(enter '2' for 2.1.x or '3' for 3.0.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

2)After the starter application has been created, there are several configuration changes to be made by hand:
- Spring:
- turn Spring transaction handling off to use EJB
- Open C:gmtrepomdssrcmainconfigandromda.xml, and change "enableSrpingTransactionsWhenEjbsEnabled"
property from true to false
- bpm4struts
- change default date format to MM/dd/yyyy to match the prototype
- Open C:gmtrepomdssrcmainconfigandromda.xml, and add a property at the bpm4struts namespace

<property name="defaultDateFormat">MM/dd/yyyy</property>

- change to generate smaller resource bundles with duplicate elements names specified in a message
- Open C:gmtrepomdssrcmainconfigandromda.xml, adn add a property at the bpm4struts namespace

<property name="normalizeMessages">true</property>


- MySQL
- Change project configuration so MySQL connector jar is used instead of hsql jar
- Open C:gmtdatapom.xml, and replace

<jdbc.driver.jar>${jboss.home}/server/default/lib/hsqldb.jar</jdbc.driver.jar>

with

<jdbc.driver.jar>${jboss.home}/server/default/lib/mysql-connector-java-5.0.4.jar</jdbc.driver.jar>

- Set database user name and password

<jdbc.username>myuser</jdbc.username>
<jdbc.password>mypwd</jdbc.password>

- maven repository

- Add a declaration for Java.net repository
<repositories>
<repository>
<id>andromda</id>
<name>AndroMDA Repository</name>
<url>http://team.andromda.org/maven2</url>
</repository>
<repository>
<id>maven-repository.dev.java.net</id>
<name>Java.net Repository for Maven 2</name>
<url>https://maven-repository.dev.java.net/nonav/repository</url>
<layout>default</layout>
</repository>
</repositories>

NOTE: the AndroMDA tutorial calls for https://maven2-repository.dev.java.net/nonav/repository
but https://maven-repository.dev.java.net/nonav/repository should be used instead.

- Hibernate
- Turn verbose logging off
- Open C:gmtrepomdapom.xml and change hibernate.db.showSql to false

- Comment out andromda-script-wrappers artifact dependency
- Open C:gmtrepopom.xml and C:gmtdatacorepom.xml , C:gmtdatawebpom.xml, and comment out
<!--
<dependency>
<groupId>org.andromda</groupId>
<artifactId>andromda-script-wrappers</artifactId>
</dependency>
-->


Step3: Change model



3.1 Use UML tool to add a DAQConfig class and a DAQData class; both are of Value Object AndroMDA stereotypes

3.2 Use UML tool to add a DAQService to get all DAQConfig and all DAQData

3.2 Configure the project to use TestNG for testing, instead of JUnit

3.2.1 Open C:gmtrepopom.xml, change to use TestNG as followed:


<!--
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
-->
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>4.7</version>
<scope>test</scope>
<classifier>jdk15</classifier>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.0.4</version>
<scope>test</scope>
</dependency>

3.2.2 Also in C:gmtrepopom.xml, add maven compiler and surefire plugin

<pluginManagement>
<plugins>
....
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.2</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.2</version>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>src/test/resources/testng.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</plugin>
</plugins>
</pluginManagement>

3.3 Add TestNG test code to test the DAQService
In C:gmtrepocoresrc, add a folder named "test",

+test
+java
+com
+dsc
+repogmt
+service
-TubeCfgServiceTest.java
+resources
-log4j.xml
-testRefFactory.xml
-testing.xml


 Last stop: Search Criteria Panel 


Problem:
prob1: groovy
prob2: jta.jar
prob3: add TestNG capability (need to add a source package at the project root then add a package at that new source package, then import the
test file to that new package ) (add more documentation here)
prob4: errors importing the project to eclipse
    - need to add M2_REPO environment
    - sometimes need to add the org.testing jar
    - need to create source package and package to put the service test classes
prob5: errors at the "UserService Definition" because the tedious configuration process
prob6: "Access denied while attempting to create the schema"
Did you create an user and a schema? Then assign all priviledges of that schema to the new user?
prob7: Could not get testNG to work
1) tried sync my m2repo with the successful project
2) tried change jdbc connector from 5.0.7 to 5.0.4
3) tried change maven surefire version
4) tried commented out body of the test function

prob8: Need to manually add a comparator for each VO
From eclipse, right click your project root and add a Source Folder, name it comon/src/main/java.
Right click on this new source folder, and create comparator for each value object type. Say there is
a TubeCfgVO, then you would create TubeCfgVOComparator class.



Set up AndroMDA build environment on Windows

Notes on Setting up AndroMDA build environment on Windows

This tutorial show you how to set up AndroMDA build environment on Windows

Continue reading →