Project Organization
The following pages should describe some project organization issues.
Directory Layout
This section should describe the directory layout choosen for this
project. The directory hierarchry is described top-down.
Each project has a root directory, containing the main ant build file
build.xml, and following subdirectories:
| Directory Name
| Description
| Ant Property Name
|
| project-dir
|
Project directory, base directory of all following described
directory
|
project.dir : "."
|
| build
|
Contains all build class, jars, all binaries generated
from the java source
|
build.dir : ${project.dir}/build
|
| dist
|
Contains zip, tar, tar.gz files for distributing the project,
and or making a quick snapshot backup of the project state.
|
dist.dir : ${project.dir}/dist
|
| gen-src
|
Contains all source generated by some tools, eg. XDoclet
generated java sources,
Ant copy filtering=on generated files.
|
gen.src.dir : ${project.dir}/gen-src
|
| lib
|
Contains 3rd party jar libraries, needed for compiling,
and/or running project components.
|
lib.dir : ${project.dir}/lib
|
| report
|
Contains JUnit report files in plain text, or xml format,
plus the JUnit report files.
|
report.dir : ${project.dir}/report
|
| src
|
Contains all kind of sources, eg. java sources,
documentation, everythins written by developers.
|
src.dir : ${project.dir}/src
|
The above table describes directory names having a predefined purpose,
additionally other directories may reside in the project root directory, too.
Src Directory Organization
Usually the src directory further structured for each different source type.
Following source type may occur in a typical J2EE project.
| Source Type
| Description
| Ant Property Name
|
| Java
|
Java Sources; package names are mapped having this directory as base.
Hence subdirectoies of this directory are the top-level package names.
|
java.src.dir : ${src.dir}/java
|
| Webapp
|
Sources dedicated for a webapp, excluding java servlet sources.
Thus this directory usually contains jsp, html, gif, WEB-INF, etc
files.
|
webapp.dir : ${src.dir}/webapp
|
| XDocs
|
XML Documentation
|
xdoc.dir : ${src.dir}/xdoc
|
Component Organization
A project may contain one or more top-Level components.
top-Level components refer to a WebApplication, Standalone-Application.
Each top-level contains one or more subsystems. A subsystem
refers to EJB, SOAP interface, servlet. For each subsystem there
should exists some sort of subsystem test preferably using
JUnit.
Names
Each subsystem may define names in its namespace.
The following sections describe some nameing convention,
or naming interdependencies.
EJB Namespace
Each EJB has a name. This name describes the EJB interface.
A EJB name having suffix Home describes EJB's home interface.
A EJB name having suffix Session, or Entity describes a
concrete EJB implementation, this class is only neccessary,
if the EJB implementation class is abstract.
A EJB implemention class should have the name suffix Bean.
JNDI Namespace
There are some guidelines described in the EJB specification.
The following section summarizes the JNDI namespace guidelines:
-
JDBC datasources, and pools should reside in
a JNDI directory named
jdbc.
-
EJB resource should reside in a JNDI directory
named
ejb.
-
A Mail resource should reside in a JNDI directory
named
mail.
-
EJB environment parameters should reside in
a JNDI directory named
env.
-
EJB resources should reside in a JNDI directory
named
env/{resource-name}.
A resource-name is JDBC resource, Mail session, etc.
URI Namespace
This section tries to setup some guidelines
regarding a URI namespace.