...
Library | Description | Where to Obtain | |
commons-collections-2.1.1.jar | Apache commons for collection handling. | For all Apache Commons libraries either:
| |
commons-dbcp-1.2.1.jar | Apache commons library for DB. | ||
commons-logging-1.0.4.jar | Apache commons for logging. | ||
commons-pool-1.3.jar | Apache commons for DB connection pooling. | ||
derby.jar | JavaDB embedded database. | Either: | |
ibatis-2.3.3.720.jar | iBATIS library | Apache iBATIS | |
spring-webmvc.jar | Spring WebMVC, needed for MultiActionController. | For all Spring libraries: Spring | |
spring.jar | Core Spring classes library. |
Files
Figure 1: Database Sample Application Architecture
...
File | Description | Location in Application Project |
web.xml | J2EE configuration file. Creates the hooks to load Spring framework. dbSampleController-servlet provides the Spring DispatcherServlet. | WebContent/WEB-INF/ |
applicationContext.xml | Spring configuration/bootstrapping file. | WebContent/WEB-INF/ |
dbSampleController-servlet.xml | The web configuration file for Spring.
| WebContent/WEB-INF/ |
SqlMapConfig.xml | Bootstraps and loads the iBATIS mappings. | WebContent/WEB-INF/ |
Contact.xml | Contains the CRUD SQL commands to interact with the DB. | src/com/nexaweb/samples/ db/dao/ibatis/ |
IbatisContactDAO.java | Utilizes the Contact.xml file to interact with iBATIS, in turn, to interact with the embedded JavaDB instance. | src/com/nexaweb/samples/ db/dao/ |
JavaDBServiceImpl.java | This constitutes the service layer and calls the DAO methods to manage data from the DB. | src/com/nexaweb/samples/ db/service/ |
DBSampleController.java | This is the primary point of contact from the client side. The controller requests the service layer (JavaDBServiceImpl.java) to get/manage data. | src/com/nexaweb/samples/ db/controller/ |
ServerSideUtils.java | Server-side utility class to send and receive objects to and from the client, respectively. | src/com/nexaweb/services/ server/util/ |
DBSampleMco.java | The client side management object that manages the event handling in the application and communication with the server. | src-client/com/nexaweb/samples/ db/mco/ |
McoUtils.java | Client-side utility class to send and receives object to and from the server, respectively. | src-client/com/nexaweb/samples/ db/util/ |
Contact.java | The data class representing a Contact. | src-clientshared/com/nexaweb/samples/ db/domain/ |
java-index.xal | A single UI files where the application elements are declared. | WebContent/ |
...
Application Flow
Figure 2: Database Sample Application Process Flow
Step | Description |
1 | UI submits DB action (CRUD). |
2 | DBSampleMCO.java creates contact.java object to hold data, passes it to MCOUtils.java for HTTP request encapsulation. |
3 | DBSampleMCO.java sends HTTP request to ServerSideUtils.java on the server. |
4 | ServerSideUtils.java unloads HTTP packet and passes contact.java object to DBSampleController.java. |
5 | DBSampleController.java passes contact.java to JavaDBServiceImpl.java. |
6 | JavaDBServiceImpl.java.passes contact.java to IBATISContactDAO.java. |
7 | IBATISContactDAO.java gets appropriate SQL statement for this action from Contact.XML. |
8 | IBATISContactDAO.java sends SQL statement to DB. Receives response from DB and sends it in Contact.java object back through server components to client. |
Links
Browse Subversion (browse)