Coding Conventions

JDK Version.

Be compatible with JDK 1.4.2.

Indentation, tab stops, etc.

There is currently no project-specific conventions for coding style. Just follow the Code Conventions for the Java Programming Language.

At the time of this writing, the team is looking at using the Jalopy (http://jalopy.sourceforge.net) Java Source Code Formatter Beautifier Pretty Printer to reinforce consistency.

Logging

Initializing logging

For the logging setup to include the name of the correct class name when outputting log messages, you should create a static log variable in each class that you define, similar to the following:

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

public class class-name ... {
    private static final Log log = LogFactory.getLog(class-name.class.getName());
...
}

Using logging

You can create log messages of varying severity, and whether or not they are output when the program runs depends on the runtime settings. The templates for the methods from the Log interface, in increasing order of severity, are:

void trace(java.lang.Object message)
void trace(java.lang.Object message, java.lang.Throwable t)

void debug(java.lang.Object message)
void debug(java.lang.Object message, java.lang.Throwable t)

void info(java.lang.Object message)
void info(java.lang.Object message, java.lang.Throwable t) 

void warn(java.lang.Object message)
void warn(java.lang.Object message, java.lang.Throwable t)

void error(java.lang.Object message)
void error(java.lang.Object message, java.lang.Throwable t)

void fatal(java.lang.Object message)
void fatal(java.lang.Object message, java.lang.Throwable t)

Logging only when necessary

The Log interface includes methods for testing the current logging level. You can use these to test whether or not to execute the potentially expensive code related to logging.

boolean isTraceEnabled()
boolean isDebugEnabled()
boolean isInfoEnabled()
boolean isWarnEnabled()
boolean isErrorEnabled()
boolean isFatalEnabled()

Standard Header

The standard header that should be included in all Java files is:

/*
 * ====================================================================
 *
 * This code is subject to the freebxml License, Version 1.1
 *
 * Copyright (c) 2001 - 2004 freebxml.org.  All rights reserved.
 *
 * $Header$
 * ====================================================================
 */

Note the the $Header$ keyword will be expanded and updated to reflect the current state of the file whenever you check the file into CVS.

Standard Footer in Documentation Files

The standard footer will be added by Maven script. Do not add any footer or banner.