BRICKS Development HOW-TO

Version 0.1

Copyright © 2005 BRICKS Consortium.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation. A copy of the license is included in the section entitled Appendix A.

Revision History
Revision 0.116.04.2005PK

Initial version

Revision 0.219.04.2005BH

Added testing section


1. Introduction

The authors of the document assume that the reader has already knowledge in:

  • Installing and using Apache Ant (i.e. running Ant tasks)

  • Basic usage of a CVS repository, i.e. being able to checkout, update, add, remote, and commit content

[Note]Java IDEs and Ant Integration

Almost all popular Java IDEs are integrated more or less with Ant. How the integration can be done with every single IDE is out of the scope of the presented content.

Checking Out the Project

A necessary step before starting development is to check out the project source tree from the CVS repository. You should user your BRICKSforge username and password to set up CVSROOT

CVSROOT=:ext:username@develop.bricksfactory.org:/cvsroot

where module name is bindings/java

[Note]Note

In the rest of the document, we assume that the project is checkouted in the directory /$HOME/bindings/java, where $HOME is your home directory, or any other directory where you have checked out the project.

Steps After Checkout

framework.test.dir=/test/bricks
framework.host=localhost
framework.port=8080

Figure 1.  framework.properties file

After a successful checkout, your local project copy must be configured. In order to do so, you should copy file framework.properties.template located in /$HOME/bindings/java into framework.properties. A possible content of the file is shown on Figure 1. Basically, it is only important to fill properly framework.test.dir: it should be a directory where the test framework will be copied and started. Additionally, one can change the address/name of the machine where the test framework will be executed (framework.host) and the port on which the framework will be available (framework.port).

[Important]Developers Using Windows

DO NOT USE WHITESPACES IN PATHS, JAVA DOES NOT LIKE THEM. If you want to use backslashes (\) then you must repeat them twice e.g. c:\\foo\\bar or you can use just slashes, e.g. c:/foo/bar

In order to run JUnit test later, you need to copy lib/build/junit.jar into $ANT_HOME/lib.

Additionally, in the root of /$HOME/bindings/java are the also the following files:

  • project.properties (Figure 2), contains system-wide project informations like project name and version.

    [Important]Important

    Edit it only if you now what you are doing. Usually the file will be modified only when a new software release will be ready.

  • README, various information for developers

  • License.txt, BRICKS software license

  • RELEASE-NOTES, release informations for users

  • build.xml, main Ant build script

#Project name
project.name=bnode

# enabling debug option during compile
project.code.debug=true

# project version
project.version=0.0

Figure 2.  project.properties file

Directory Hierarchy

bindings/java
	framework (Jakarta Tomcat 5.0 installation)
    axis (Apache Axis installation)
	components (BNode source code)
		component1 (component1 subtree) 
		component2 (component2 subtree)
		component3 (component3 subtree)
		.
		.
		componentN (componentN subtree)
	lib (common project libs)
		build (needed only during build)		
		endorsed (JDK endorsed libs)
		installer (IzPack installation)
		licenses (various licenses)
    legal    
		3rdparty.xml (external component tracking and licenses)
	build (place for storing build results)
	installer (standalone installer for software release)

Figure 3. Project Directory Hierarchy

Figure 3 shows project code tree that exist in your local project copy. framework contains Jakarta Tomcat installation. Currently used version is 5.0.28.

Directory lib contains various libraries needed for the proper building and running BNode software. Additionally, subdirectories contain libraries:

  • needed during build phase (lib/build)

  • Apache Axis installation (axis)

  • Endorsed libraries (lib/endorsed)

  • IzPack installer (installer)

  • Various licenses (legal)

Directory components is just a container for BRICKS components, which code structure is presented on Figure 4. componentX is just an example name, every component should have a name that gives better descriptions (e.g. api, core, usermanagement,..).

component1
	main
		src (source code)
		resources (various needed resources)
	lib (needed libs, but not other BNode components) 
		endorsed (endorsed libs)
	build (place for building the component)
		lib (generated jar files)
		classes (generated classes)
	web (web interfaces)
	test (test cases)
		src (source code)
		resources (various needed resources)
	build.xml (component build script)
	README (for developers)

Figure 4. Component Directory Hierarchy

Component source code should be place under main/src . A component might need some additional resources (e.g. config files), and they should be placed under main/resources.

Various tests (including JUnit tests) should be placed under test/src , and the appropriate resources under test/resources

Similarly to the main lib directory, component lib directory contains needed libraries, but only those that are specific for the component. If the component depends on some libraries already included in the main lib directory, or part of the framework installation, they should be copied again here; they will be simply used during building and deploying phase.

If you want to make a web interface for controlling your components, needed .html, .jsp and other files should be placed under web directory. These files will be copied on the appropriate place during deployment and installation phase.

[Important]Important

Please notice that build directories are created in your filesystem during the build process, and it should not be committed back into CVS.

Ant Targets

The following Ant targets can be used from the main or component build file (build.xml) during development process:

  • compile the component

  • test the component

  • build the component .jar file

  • clean the component build results

[Note]Note

If the targets are invoked from a component build file, they are performed only on the component; otherwise calling them from the main build file, they will applied on the whole source tree, i.e. the complete project will be compiled, tested, or built.

Additionally, the following target are available only in the main build file:

  • make-component, create new component under components directory

  • javadoc, generate javadoc for the BNode software

  • start-framework, copy and start the framework, and software components in the test directory

  • stop-framework, stop the test framework running

  • full-installer, generate release with installer that includes framework + all software components

  • installer, generate release without installer

  • sdk, generate SDK release

BRICKS Java Package Hierarchy

  • API

    • org.bricks

    • org.bricks.core

    • org.bricks.services.*

    • org.bricks.modeles.*

  • CORE

    • org.bricks.framework.*

    • org.bricks.util

  • Component implementations

    • org.bricks.impl.*

[Note]Note

Javadoc is generated only for API and Core.

[Important] Be careful when you chose files for committing back to CVS

  • Do not commit any file contained in build or the directory itself, or any other files that appear somewhere in the tree, and are not created by you manually

  • Update from root before commit, and if something is changed, rebuilt your component. If everything is ok, you are allow to commit your changes.

BRICKSforge | About Us | Contact Us | ©2005 BRICKS Consortium