< Previous | Next >

Lesson 3.7: Create the EJB delegate component subpackage

In this lesson, you model the delegate.ejb subpackage.

About this task

The delegate EJB implementation package contains a business delegate that connects to the EJB component layer. The following table lists the classes that the delegate.ejb subpackage contains:

Class name Description
PiggyBankEJBDelegateFactory This factory class creates an instance of the PiggyBankEJBDelegateImpl class.
PiggyBankEJBDelegateImpl This class contains the implementation of the business delegate and is the wrapper for the EJB session facade.

The PiggyBankEJBDelegateFactory and PiggyBankEJBDelegateImpl classes, along with the BusinessDelegateFactory class, implement the delegate interfaces that you created in Lesson 3.5.

Create the Business Delegate implementation for the EJB Implementation diagram

Procedure

  1. In the Project Explorer view, expand delegate.ejb.
  2. Double-click the Main diagram.
  3. In the diagram editor, add the title delegate.ejb - Business Delegate Implementation for EJB Implementation.

Create the PiggyBankEJBDelegateImpl class

Procedure

  1. In the Palette, double-click Class and name the class PiggyBankEJBDelegateImpl.
  2. In the diagram editor, right-click the PiggyBankEJBDelegateImpl class; then click Add UML > Attribute.
  3. Name the attribute PIGGY_BANK_CONTROLLER_EJB_REF.
  4. In the Properties view, click Select type.
  5. In the Select Type window, click String.
  6. In the Properties view, on the General page, click Static.
  7. In the diagram editor, right-click the PiggyBankEJBDelegateImpl class; then click Add UML > Attribute.
  8. Name the attribute piggyBankController.
  9. In the Properties view, click Select type.
  10. In the Select Type window, expand itso.ad.business, expand ejb, expand facade, click PiggyBankController, and click OK.
  11. In the diagram editor, right-click PiggyBankEJBDelegateImpl; then click Add UML > Operation.
  12. Name the operation PiggyBankEJBDelegateImpl.

Results

You created the PiggyBankEJBDelegateImpl class which is a wrapper for the EJB component layer. Your diagram should look similar to the following figure:

The PiggyBankEJBDelegateImpl class

Create the PiggyBankEJBDelegateFactory class

About this task

To create the PiggyBankEJBDelegateFactory class:

Procedure

  1. In the Palette, double-click Class and name the class PiggyBankEJBDelegateFactory.
  2. In the diagram editor, right-click the PiggyBankEJBDelegateFactory class; then click Add UML > Attribute.
  3. Name the attribute piggyBankDelegateImpl.
  4. In the Properties view, click Select type.
  5. In the Select Type window, expand itso.ad.business, expand delegate.ejb, click PiggyBankEJBDelegateImpl, and click OK.
  6. In the Properties view, on the General page, click Static.
  7. In the diagram editor, right-click PiggyBankEJBDelegateFactory; then click Add UML > Operation.
  8. Name the operation PiggyBankEJBDelegateFactory.

Create the business delegate relationships

About this task

To create the business delegate relationships:

Procedure

  1. In the Project Explorer view, expand itso.ad.business.
  2. In the factory subpackage, click the BusinessDelegateFactory class and drag it into the diagram to the right of the PiggyBankEJBDelegateFactory class.
  3. In the Project Explorer view, in the interfaces.delegates subpackage, click the AbstractBusinessDelegateFactory interface and drag it into the diagram above the PiggyBankEJBDelegateFactory class.
  4. In the Project Explorer view, in the interfaces.delegates subpackage, click the IPiggyBankBusinessDelegate interface and drag it into the diagram above the PiggyBankEJBDelegateImpl class.
  5. In the Palette, click Implements.
  6. In the diagram editor, click the PiggyBankEJBDelegateImpl class and drag the cursor to the IPiggyBankBusinessDelegate interface.
  7. In the Palette, click Implements.
  8. In the diagram editor, click the BusinessDelegateFactory class and drag the cursor to the AbstractBusinessDelegateFactory interface.
  9. In the Palette, click Generalization.
  10. In the diagram editor, click the PiggyBankEJBDelegateFactory class and drag the cursor to the BusinessDelegateFactory class.

Results

You have modeled the component layer of the PiggyBank business delegate. Your diagram should look similar to the following figure:

The business delagate relationships.

< Previous | Next >

Feedback