EmployeeSystem
This directory contains the sample code presented for the Employee system used in
the Business Objects and Business Object Models chapters. All of the
code is found here, including the employee.prp file,
which is used to control the sample InstantDB database used for this example. Make
sure the InstantDB .jar file (idb.jar) is in your CLASSPATH or your Extensions
directory (preferably) when you run any of the RDBMSModel-related classes.
-
EmployeeSchema.sql: a SQL file containing the
schema the Employee business object layer expects to have available when using
the RDBMSModel class as the business object layer. Note that if you wish to recreate
the schema for InstantDB, use the IDBSchema.sql file
instead--InstantDB doesn't fully support all SQL92 features. Both of these files
are intended to be run using the JDBCTermConnection Service from GJAS.
-
EmployeeTest.java: a test-driver for using the
IEmployeeModel interface layer. Use the "-model" command-line argument to control
which model to use, and the "-build" argument to create a collection of objects
in the storage layer before testing (for use with the HashtableModel, for example).
-
OrgTree.java: The hierarchical JTree-based viewer for
looking at Departments using the IEmployeeModel. Use the command-line argument
"-model:RDBMS" to use the associated RDBMSModel and the data living therein.
In the Employee subdirectory lives the code for the
actual business object classes and interfaces, all part of the employee
package:
-
IEmployeeModel.java: The root Employee model
interface--this leads to all other business object instances.
-
IAddress.java,
IContactInfo.java,
IDepartment.java,
IEMail.java,
IEmployee.java,
IManager.java,
IPerson.java,
IPhone.java,
IPosition.java: The various business object interfaces.
-
BusinessLayerException.java,
DuplicateObjectException.java,
IllegalSalaryException.java,
IntegrityConstraintException.java,
UnknownObjectException.java: Various
exception classes used in the business object layer interfaces and implementation.
-
HashtableModel.java: An in-memory implementation of
the Employee business object layer using Hashtables.
-
RDBMSModel.java: An implementation of the Employee
business object layer using an RDBMS, which by default, uses InstantDB.
-
JSDTModel.java and
JSDTModelServer.java:
-
RMIModel.java,
RMIModelServer.java,
: A naive implementation of the business object layer using RMI, where each object is
exported directly. The URL used, by default, for the RMIModelServer is the RMI url
"rmi://{hostname}/Employee.RMIModel:1.0.0". Note that when you start the RMIModelServer
on the server VM, you must pass it a command-line argument (either "-model:Hashtable" or
"-model:RDBMS") to tell it which back-end storage implementation to use; RMIModelServer
does no actual storage of the business objects itself.