J2EEDO APPLICATION description
This package contains a web application base on JDO facilities ; This
application is named "J2EEDO". It's a sample of a Web application
to be depoyed on a J2EE server.
Package description
This package contains two JUnit test case classes:
- TestJ2eedoApplication
allows to test the application in standalone mode directly form JUnit.
- TestJ2eedoJ2ee
allows to test the application deployed on a J2EE application server
form JUnit.
The J2EEDO application
Introduction
It's a sample of a Web application to be depoyed on a J2EE server.
Application's description
This application provides with 16 types of action:
Action
|
Description
|
ping
|
Returns a fixed string to ensure the j2ee application is started.
|
newDept
|
Creates a new department and some new employees (random
number defined between 10 and 70).
|
newProj
|
Creates a new project and affect few employees (random
number defined between 5 and 20).
|
newEmp
|
Selects one of the known departments and creates a new
employee.
|
setDeptBoss
|
Selects one of the known departments and sets the manager
for the department's employees.
|
delEmployee
|
Removes an employee.
|
delProject
|
Removes a project.
|
splitProject
|
Selects one of the known departments, creates a new project
and duplicates the member list from the former project.
|
splitDepartment
|
Selects one of the known departments, creates a new
department and affect the 50% of the former employees and
project to the latter department.
|
mergeDept
|
Removes a department and adds all projects and employees to
an other project.
|
incSalary
|
Increase an employee's salary.
|
getDepartment
|
Gets a department by id.
|
getProject
|
Gets a project by id.
|
getEmployee
|
Gets an employee by id.
|
queryEmployees
|
Performs one of the four queries:
- Get employee by its id,
- Get employees between min and max,
- Get employees having the same manager,
- Get employees member of a project.
|
queryProjects
|
Performs one of the two queries:
- Get project by it's id,
- Get projects by members.
|
All those actions can be called directly form a batch file or
through an HTTP call to a servlet.
The called servlets (see Servlet
detail), depending of HTTP parameters, can directly call the requested
action, or call it using a Session bean container.
J2EEDO Application implementation
Database modele overview
This application implements the following data model
built on 4 tables:
- Department
- Employee
- Address
- Project
|
|
Packages content
The application is made of 7 main java packages:
org.objectweb.speedo.j2eedo:
contains two JUnit test case classes:
- TestJ2eedoApplication
allows to test the application in standalone mode directly form JUnit.
- TestJ2eedoJ2ee
allows to test the application deployed on a J2EE application server
form JUnit.
org.objectweb.speedo.j2eedo.bo:
contains all business object class handling the data modele.
- DatabaseImpl is the main class
and implements all defined actions. This class defines 3 static vectors used
to store known department,
employee and
project. Those 3 local vectors
must decrease the number of access to database object, they are also called
the static polls.
Remark:Those pool contents are update by the Synchronization class
PollsSynchronizations each time a
department, an employee or a project is added or removed. This task is
performed while the current action is commited (when a transaction is required)
otherwise, this treatment is done when the current Persistence Manager is closed.
- PollsSynchronizations
defines the Synchronization Object used to update DatabaseImpl's static polls content.
- DepartmentFactory,
EmployeeFactory and
ProjectFactory classes define the different treatment on
Department, Employee and Project
org.objectweb.speedo.j2eedo.common:
contains is a tool box, it contains all common
class used by the application.
org.objectweb.speedo.j2eedo.database:
contains all classes to be enhanced used to
access to the database content.
org.objectweb.speedo.j2eedo.ejb:
contains is the EJB session definition.
- StoreServices implements
the interface to perform DatabaseImpl action in a Session Container.
org.objectweb.speedo.j2eedo.test:
contains all test class use to highlight errors or
behaviours.
- MainLauncher is used for basic
test implementation. The developper needs to create a new class extended of
this class and writes its own test method doTest().
- BasicTest executes 20 times all
DatabaseImpl actions.
- ShowConcurrencyErrors
allows to highlight some conccurent access deadlocks and issues.
org.objectweb.speedo.j2eedo.web:
contains the servlets classes' definition.
- MainServlet executes current request:
- Gets the Persistence manager when required (false by default),
- Starts a local transaction when requested (false by default),
- Calls the dedicated action directly or through a Session Bean Container
(direct call by default),
- Close the PM when initialized at the servlet level.
- ApplicationServlet is an
extended of the former servlet MainServlet. This class implements the
two methods used to execute the resquest through a Session Bean or directly
from the DataBaseImpl class.
|