Getting started

To create a new project which uses equanda, you can use the maven archetype.


mvn equanda:archetype
-DgroupId=org.equanda.example -DartifactId=example
-DarchetypeVersion=0.9.4 -DarchetypeGroupId=org.equanda -DarchetypeArtifactId=equanda-maven-plugin -DremoteRepositories=http://maven.progs.be/m2repo

This will create a mostly empty example project in the "example" subdirectory. The base package for the classes is "org.equanda.example".

For more details about the archetype, see here.

The archetype create a project with everything in place to start using equanda, bu also has some features that will be useful when your want to use more of the features.

The following shows how to get up and running with this sample application.
For the demonstation, we deploy this using firebird as database. It should also work with other databases (equanda uses EJB3 after all), but the ddltool does not have support for them (patches are welcome).

Get all the stuff

  • Install maven. It has been tested with v2.07, higher versions should also work, not sure about lower versions.

For the compilation and deployment you should use java 1.5. No attempts have been made to make it work on 1.6 (JBoss 4.2 is not java 6 compatible anyway).

Prepare the deployment

  • You should create an empty database file. There are many ways to do this, one is using the firebird isql tool. (When on linux, assure the "firebird" user has read/write rights on the directory where the database will be stored).

isql -u myusername -p mypassword
CREATE DATABASE "/home/joachim/data/example-data.fdb" DEFAULT CHARACTER SET UTF8;
  • Adjust you maven settings file to specify the database location. This is the file .m2/settings.xml under your home directory.

<settings>
<profiles>
<profile>
<id>mine</id>
<properties>
<!-- selenium properties-->
<firefox.path>firefox /usr/lib/firefox/firefox-bin</firefox.path>

<!-- example app -->
<example.db.url>jdbc:firebirdsql:localhost/3050:/home/joachim/data/example.fdb</example.db.url>
<example.db.login>sysdba</example.db.login>
<example.db.password>masterkey</example.db.password>
<example.db.location>/home/joachim/data/example.fdb</example.db.location>
<example.db.empty>/home/joachim/data/example-empty.fdb</example.db.empty>
<example.cargo.wait>true</example.cargo.wait>
<example.jboss.home>/home/joachim/java/examplejboss</example.jboss.home>
<example.jboss.config>equanda</example.jboss.config>
<example.jboss.host>localhost</example.jboss.host>
<example.jboss.port>8080</example.jboss.port>
<example.jboss.jvmargs>
-server -Xms256m -Xmx382m -XX:MaxPermSize=128m -Dsun.net.inetaddr.ttl=15
-Dsun.rmi.dgc.client.gcInterval=3600000
-Dsun.rmi.dgc.server.gcInterval=3600000
</example.jboss.jvmargs>
<example.jboss.logging>medium</example.jboss.logging>

</properties>
</profile>
</profiles>
<activeProfiles>
<activeProfile>mine</activeProfile>
</activeProfiles>
<pluginGroups>
<pluginGroup>org.equanda</pluginGroup>
</pluginGroups>

</settings>

You need to check all the settings, but specifically the "example.db.url" contains the database location and "example.jboss.home" contains the jboss location.

  • Assure that the data source as defined in jboss is correct. This is part of the server/equanda/deploy/equanda-example-ds.xml file.

<?xml version="1.0" encoding="UTF-8"?>

<connection-factories>

<local-tx-datasource>
<jndi-name>exampleDS</jndi-name>

<connection-url>jdbc:firebirdsql:localhost/3050:/home/joachim/data/example.fdb</connection-url>
<driver-class>org.firebirdsql.jdbc.FBDriver</driver-class>
<transaction-isolation>TRANSACTION_REPEATABLE_READ</transaction-isolation>
<connection-property name="lc_ctype" type="java.lang.String">UNICODE_FSS</connection-property>
<connection-property name="maxStatements">10</connection-property>
<user-name>SYSDBA</user-name>
<password>masterkey</password>

<min-pool-size>0</min-pool-size>
<max-pool-size>200</max-pool-size>
<blocking-timeout-millis>5000</blocking-timeout-millis>
<idle-timeout-minutes>15</idle-timeout-minutes>

<check-valid-connection-sql>SELECT CAST(1 as INTEGER) FROM rdb$database</check-valid-connection-sql>
<exception-sorter-class-name>be.unid.util.FirebirdExceptionSorter</exception-sorter-class-name>

<track-statements>false</track-statements>
<prepared-statement-cache-size>0</prepared-statement-cache-size>

<metadata>
<type-mapping>Firebird</type-mapping>
</metadata>
</local-tx-datasource>

</connection-factories>

Specifically, the contents of the "connection-url" tag may need changing.

Deploy and run

With all the preparations in place, compiling and deploying is as simple as running


mvn -Drun install

You can now point your browser to http://localhost:8080/example and the application should display.
You can login using the defaults of login/login. You can change this is jboss-dir/server/equanda/conf/props/default-users.properties and jboss-dir/server/equanda/conf/props/default-roles.properties

Making changes

You can have project files generated for the project using one of (depending on the IDE you use)


mvn idea:idea
mvn eclipse:eclipse

If you want to change the translations, you can use


mvn equanda:translate

This will show a program which allows you to modify or update the translations.

To just have the system update the database using the latest definition. The database connection settings come from the .m2/settings.xml file.


mvn equanda:ddltool

You can create a site which documents your project, including documentation about the domain model.


mvn site

Making some changes

..........

More information

  • 1. Getting started
  • 1.1. Get all the stuff
  • 1.2. Prepare the deployment
  • 1.3. Deploy and run
  • 1.4. Making changes
  • 1.5. Making some changes
  • 1.6. More information