Exercises

There are several refactoring exercises that could be performed on the case study. One of the most effective is to use Value Objects between the clients and their associated Session beans. This exercise asks to you perform such a refactoring.

  1. Starting with the Agency example under the Day 18 exercise, create a Value Object called ApplicantValueObject. This should contain all of the information about an applicant, such as his or her name, email, and so on. The class you create should be a JavaBean, and you must be able to use it as a parameter or return type in an RMI method call.

    Alter the Register interface so that it passes ApplicantValueObjects between client and server. The interface should only have two methods.

    Alter the RegisterBean EJB so that it implements the updated Register interface and uses ApplicantValueObjects.

    Alter the RegisterClient application so that it uses the updated Register interface and ApplicantValueObjects.

    Build the updated application and re-deploy it. Make sure that everything still works correctly.

An example solution is available under the agency directory in the Day 18 agency code on the Web site. Examine the sample solution in contrast to your own. How might you improve the sample solution? Areas to consider include the EJB home interfaces, the Value Object constructor, the way the Value Object stores skills, and whether the Applicant EJB should create the Value Object.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.116.81.162