Section 6.14. Reviewing Iteration 1


6.14. Reviewing Iteration 1

It's taken a while to get here, but we now have the core infrastructure in place to use EJBs. The main purpose of Iteration 1 was to introduce an EJB to the JAW Motors application. So, to review :

  • We modified the Persistence Tier so that we can tell if a car is available or sold by:

    • Adding a STATUS column to the CAR table.

    • Making the CarDTO Serializable, and adding a status field along with getter and setter methods.

    • Adding a filterByStatus( ) method to the HibernateCarDAO.

  • We upgraded the web site by:

    • Refactoring the Controller Servlet's viewCarList action to use the InventoryFacadeBean for finding all available (unsold) cars.

    • Adding a getEjbLocalHome( ) method to the ServiceLocator to look up an EJB's Local Home Interface using JNDI.

    • Adding EJB-based JNDI reference settings to the Web deployment descriptors (web.xml and jboss-web.xml).

    • Automating EJB-based JNDI reference settings in the Web deployment descriptors with XDoclet.

  • We added InventoryFacade Session Bean by:

    • Defining the Local and Remote Interface(s).

    • Creating the Home Interface(s).

    • Developing the Bean Class Code.

    • Deploying the Bean with EJB deployment descriptors.

    • Automating the Bean deployment with Ant and XDoclet so that XDoclet created the Remote, Remote Home, Local, and Local Home interfaces for us. We also used XDoclet to create the ejb-jar.xml and jboss.xml deployment descriptors.

  • We added EJBs to our EAR file by:

    • Creating the EJB JAR file with Ant.

    • Registering the EJB JAR file in application.xml.

    • Copying the EJB JAR file into the EAR.

As you've just seen, adding EJBs to a J2EE application is non-trivial. But you can mitigate this overhead with Ant and XDoclet.



JBoss at Work. A Practical Guide
JBoss at Work: A Practical Guide
ISBN: 0596007345
EAN: 2147483647
Year: 2004
Pages: 197

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net