Developper documentation

Environment Setup

Caution : Everything must run with JDK 1.5
SVN URL: https://www.eservices.accelya.fr/svn/loader
Seam version : 2.1.2

IDE

We'll use eclipse Ganymede (3.4) or Galilleo (3.5) jee edition on this project.

Server :
JBoss AS 5.1.0.GA

To install jboss you have to download it from jboss.org, and to decompress it in the folder that you want.
We have choosen jboss 5.1.0.GA. It would be better if we all have the same version.

Then you have to put the datasource file (eservices-loader-ds.xml) in the server/default/deploy folder.
This file configure the database connexion, so you have to change the jdbc connection line according to your development database.
You can find an example of this kind of file in the project eservices-loader-static on the SVN, i'll put all the static file on this directory. The database is your eservices development database.

When you add your server in the Server View in eclipse, you can double click on the server that you added to edit it.
Click on open launch configuration and set theses parameters :

-Djava.endorsed.dirs="/pathtojboss/jboss-5.1.0.GA/lib/endorsed" 
-Dprogram.name="JBossTools JBoss 5.1.0 Runtime" -Xms128m -Xmx512m -Dcom.sun.management.jmxremote -Djava.net.preferIPv4Stack=true -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000  -Djava.awt.headless=true -XX:+UseConcMarkSweepGC -XX:+CMSPermGenSweepingEnabled -XX:+CMSClassUnloadingEnabled -XX:MaxPermSize=512m   

Of course you have to adapt the -Djava.endorsed.dirs to your configuration.
If you have less than 4GB of RAM and if JBoss use too many ram for you, you can decrease the values of -Xms and Xmx to a lesser value, always a 8 multiple. You can also decrease the MaxPermSize if you have too many PermGen error.

Don't forget to put the JDBC 3 driver of postgre in the jboss-5.1.0.GA/server/default/lib folder.

You also have to replace jboss-log4.xml in jboss-5.1.0.GA/server/default/conf folder by the one you can found in the eservices-loader-static project.

JMS Configuration

Loader use JMS queue to make parallel processing through MDB Components.
You can find a destinations-services.xml file in the static project, please open it and copy his content in your jboss-5.1.0.GA/server/default/deploy/messaging/destinations-services.xml file. ( at the end of the file don't remove the existing jms queue).

Plugins

The link between parenthesis are the location site to install the plugin from the software update eclipse menu.

1. JBoss Tools v3

To make your work easier you could install the Jboss Tools plugins v3 for eclipse, this plugin will help you to interact with Seam and the Jboss Server.
This plugin is optional but is helpful. You can install it by downloading it on the jboss.org website, and copying the extracted plugins and features folder on your eclipse installation.

2. Maven ( installation site : http://m2eclipse.sonatype.org/update/)

Now, as you can see, in the project i have already comited (loader/eservices-loader) there are pom.xml files which are the instruction file for building the project with maven2. 
So you have to install maven2 on your computer, and to configure an external tool in eclipse to build the project with it and with the arguments : clean install and with working directory : eservices-loader
You also have to configure the pom.xml of the eservices-loader-ear project and to change this line according to your jboss installation.
<outputDirectory>
/home/leakim/jboss-5.0.1.GA/server/default/deploy
</outputDirectory>
The maven configuration of the project download the necessary libraries, build the three projects, build the webapp in a war, and then create an EAR file with all the
previous build.
Finally, if you have well configured the line explicated previously, the EAR file will be moved in your JBoss Deploy directory.
To use Maven for build the project please use a version >= 2.0.9. In eclipse, next to the usual launch button you have a launch button with red luggage. Click on the
arrow on this button and then external tool configuration.
Point "Location" on your Maven local installation.
Point working directory on the parent project (eservices-loader)
Set in arguments : clean install
If you want skip the test : add -Dmaven.test.skip=true
Be sure to add in "Environnement" a JAVA_HOME variable, pointing on your jdk 1.5 installation. To generate maven site with quality report : mvn site site:deploy

3. Checkstyle (http://eclipse-cs.sf.net/update)

This plugin is intended to check if everyone use the same code syntax, the same name format for the classes, attributes and methods, and check a part of your code automatically.
If you don't respect the checkstyle configuration, you'll have warning and errors on your code.
Like we are good developper, we'll develop a project with NO WARNING AT ALL. So if you have warnings in your code, you'll have to justify its. Good developers don't like warnings.
If you respect the checkstyle configuration, i will not have to correct the code syntax when i'll make a code review on your sources code.
you could find the checkstyle.xml file on the SVN repository eservices-loader-static.
You can import the checkstyle file in the Eclipse Preferences, by adding a new external file. When it is added you can set it as the default checkstyle file.
Checkstyle with our configuration must be activated on the eservices-loader-entites and eservices-loader-services projects.

4. AnyEdit (http://andrei.gmxhome.de/eclipse/)

This plugin replace all the tab characters with space, if you don't have it, you will have error with the checkstyle.
On Eclipse preference, for any edit, check the checkbox replace tab with spaces.

eServices-Loader architecture

As you can see if you checkout the eservices-loader project you have tree project inside it. Indeed, it's a MVC architecture.

eservices-loader
This project encapsulate the others to manage the library versioning, and the module configuration of the project.
eservices-loader-entites.
This project will contains all the classes which are EJB Entities, or Model Classes.
eservices-loader-services
This project will only contains services classes which means business classes.
eservices-loader-war
This project will contains the webapp of the project, it is build on a war file.

Database
You have to use an existing eservices databasae for develop.

Boot Loader

You also have to create a working folder for the application.
In this folder add the file "loader.properties" found in eservices-loader-static project.
Then add a line in the table PropertiesFile with id 1, and path pointing on this file : /path/to/your/file/loader.properties
It is necessary to allow the application boot.
As you can see in the properties file you have to create folder, and to change the properties file corresponding to your local path.
Check in eservices-loader-static project, to know the content of the file.
The Log4J configuration can be found on this project also.
Then you can boot the application, hibernate will create the needed table.
Once it's done, you can execute the scripts contained in eservices-loader/sql/ to fill your database with the required data for file conversion.