Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

LibraryDescriptionWhere to Obtain
commons-collections-2.1.1.jarApache commons for collection handling.For all Apache Commons libraries either:
  • Use JARs distributed with Spring
    (in $SPRING_HOME/lib/jakarta-commons)
  • Download latest version from Apache Commons.
commons-dbcp-1.2.1.jarApache commons library for DB. 
commons-logging-1.0.4.jarApache commons for logging. 
commons-pool-1.3.jarApache commons for DB connection pooling. 
derby.jarJavaDB embedded database.Either:
ibatis-2.3.3.720.jariBATIS library Apache iBATIS
spring-webmvc.jarSpring WebMVC, needed for MultiActionController.For all Spring libraries:
Spring
spring.jarCore Spring classes library.
  
 


Files

Nexaweb

Figure 1: Database Sample Application Architecture

...

FileDescriptionLocation in Application Project
web.xmlJ2EE configuration file.

Creates the hooks to load Spring framework. dbSampleController-servlet provides the Spring DispatcherServlet.

WebContent/WEB-INF/
applicationContext.xmlSpring configuration/bootstrapping file.WebContent/WEB-INF/
dbSampleController-servlet.xmlThe web configuration file for Spring.
  • Specifies the URL mapping to the controller(MultiActionController) class controller.ds. Maps controller.ds to DBSampleController, which has MethodNameResolver configured 'action' as the URL parameter to send the method name.
  • Creates instances of:

    - The service class(JavaDBServiceImpl)

    - DataAccessObject (DAO) class(IbatisContactDAO), declares the datasource to the embedded JavaDB instance, the iBATIS adapter(sqlMap)
     

  • Injects reference of:

    - The iBATIS adapter into the DAO

    - The DAO object into the Service class

    - The Service class into the controller.

WebContent/WEB-INF/
SqlMapConfig.xmlBootstraps and loads the iBATIS mappings.WebContent/WEB-INF/
Contact.xmlContains the CRUD SQL commands to interact with the DB.src/com/nexaweb/samples/
db/dao/ibatis/
IbatisContactDAO.javaUtilizes the Contact.xml file to interact with iBATIS, in turn, to interact with the embedded JavaDB instance.src/com/nexaweb/samples/
db/dao/
JavaDBServiceImpl.javaThis constitutes the service layer and calls the DAO methods to manage data from the DB.src/com/nexaweb/samples/
db/service/
DBSampleController.javaThis 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.javaServer-side utility class to send and receive objects to and from the client, respectively.src/com/nexaweb/services/
server/util/
DBSampleMco.javaThe 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.javaClient-side utility class to send and receives object to and from the server, respectively.src-client/com/nexaweb/samples/
db/util/
Contact.javaThe data class representing a Contact.src-clientshared/com/nexaweb/samples/
db/domain/
java-index.xalA single UI files where the application elements are declared.WebContent/

...


Application Flow

Nexaweb

Figure 2: Database Sample Application Process Flow

StepDescription
1UI submits DB action (CRUD).
2DBSampleMCO.java creates contact.java object to hold data, passes it to MCOUtils.java for HTTP request encapsulation.
3DBSampleMCO.java sends HTTP request to ServerSideUtils.java on the server.
4ServerSideUtils.java unloads HTTP packet and passes contact.java object to DBSampleController.java.
5DBSampleController.java passes contact.java to JavaDBServiceImpl.java.
6JavaDBServiceImpl.java.passes contact.java to IBATISContactDAO.java.
7IBATISContactDAO.java gets appropriate SQL statement for this action from Contact.XML.
8IBATISContactDAO.java sends SQL statement to DB. Receives response from DB and sends it in Contact.java object back through server components to client.  


Browse Subversion (browse)