Developers information

maven targets, profiles, variables

There are two main ways to install, either just compiling, running the simple tests and installing, or running the full testsuite which does integration tests by deploying some sample stuff into a jboss instance.
You can choose by using one of the following targets.


mvn install
mvn -Dfulltest install

To be able to run the full test suite, you need to include a profile in your maven local settings (.m2/settings.xml).


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

<equanda.db.url>jdbc:firebirdsql:localhost/3050:/home/joachim/data/equanda.fdb</equanda.db.url>
<equanda.db.login>sysdba</equanda.db.login>
<equanda.db.password>masterkey</equanda.db.password>
<equanda.db.location>/home/joachim/data/equanda.fdb</equanda.db.location>
<equanda.db.empty>/home/joachim/data/equanda-empty.fdb</equanda.db.empty>
<equanda.cargo.wait>true</equanda.cargo.wait>
<!-- jboss properties-->
<equanda.jboss.home>/home/joachim/java/equandajboss</equanda.jboss.home>
<equanda.jboss.config>equanda</equanda.jboss.config>
<equanda.jboss.host>localhost</equanda.jboss.host>
<equanda.jboss.port>8080</equanda.jboss.port>
<equanda.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
</equanda.jboss.jvmargs>
<equanda.jboss.logging>medium</equanda.jboss.logging>

</properties>
</profile>
</profiles>
<activeProfiles>
<activeProfile>dev-joachim</activeProfile>
</activeProfiles>

<pluginGroups>
<pluginGroup>org.equanda</pluginGroup>
</pluginGroups>

</settings>

Coding quality and style

Class, method and variable names

Use meaningful names. Especially class and method names should explain their purpose. Use standard java camelcase conventions.

Comments

  • Each file should have a copyright notice at the start of the file.
  • Each class should have class comments indicating the purpose of the class and the authors.
  • Public methods should be commented if the meaning is not entirely clear from method and parameter names (is it ever?). When the method overrides or implements a method, then repeating the javadoc is not needed.
  • Comments in the code are recommended when they explain a block of code or when they explain why things are done in a certain way. Repeating the code in human readable wording is wasteful.
  • Use "@todo" comments to indicate shortcuts or hacks which should be fixed. Better still is just to do it right and not have the shortcut.
  • When inserting debug statements, always put them inside a "log.isDebugEnabled()" test.

Claim your code

Be proud of your code and take responsibility of your changes. When making any kind of significant changes (not for reformatting, fixing typing errors or renaming), add your name and e-mail address at the bottom of the authors list in the class comments.

Coding style

In equanda we use a coding style which prefers easy reading above displaying a lot of information. Most of the features should be clear in the following piece of code.


/**
* This file is part of the equanda project.
*
* The contents of this file are subject to the Mozilla Public License Version 1.1 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF
* ANY KIND, either express or implied. See the License for the specific language governing rights and
* limitations under the License.
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*/

package org.equanda.bladibla;

/**
* Page for importing/updating a portfolio from one of a selection of formats.
*
* @author <a href="mailto:author@email.adr">Author's name</a>
*/
@Annotation( param1 = "value1", param2 = "value2" )
public class Foo
implements Serializable
{
int[] x = new int[] { 1, 3, 5, 6, 7, 87, 1213, 2 };

/**
* Do something
*
* @param x some data
* @param y more data
*/
public void foo( int x, int y )
throws Exception
{
for ( int i = 0; i < x ; i++ )
{
y += ( y ^ 0x123 ) << 2;
}
do
{
try
{
if ( 0 < x && x < 10 )
{
while ( x != y )
{
x = f( x * 3 + 5 );
}
}
else
{
synchronized ( this )
{
switch ( e.getCode() )
{
//...
}
}
}
}
catch ( MyException e )
{}
finally
{
int[] arr = (int[]) g( y );
x = y >= 0 ? arr[ y ] : -1;
}
}
while ( true );
}
}

The code is written with the right margin at 120 characters and lines should not be longer than that if possible.
An indentation is 4 spaces, tabs should not be used.

  • 1. Developers information
  • 1.1. maven targets, profiles, variables
  • 1.2. Coding quality and style
  • 1.2.1. Class, method and variable names
  • 1.2.2. Comments
  • 1.2.3. Claim your code
  • 1.2.4. Coding style