Exercise 3.7: Creating the EJB delegate component subpackage

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

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

Class name Description
PiggyBankEJBDelegateFactory This factory class creates an instance of the PiggyBankEJBDelegateImpl class.
PiggyBankEJBDelegateImpl This class contains the implementation of the business delegate. This class 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 Exercise 3.5.

Creating the EJB delegate classes

The business delegate classes connect to the EJB component layer.

To create the Business Delegate Implementation for the EJB Implementation diagram:
  1. In the Model 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.

To model the PiggyBankEJBDelegateImpl class:
  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.

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

The PiggyBankDelegateImpl class.

To model the PiggyBankEJBDelegateFactory class:
  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; then 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.
You have created the PiggyBankEJBDelegateFactory class that creates PiggyBankEJBDelegateImpl instances. You can now model the business delegate relationships.

Modeling the business delegate relationships

The business delegate classes in the delegate.ejb subpackage implement the delegate interfaces that are defined in the framework subpackage.

To model the business delegate relationships:
  1. In the Model 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 Model Explorer view, in the interfaces.delegates subpackage, click the AbstractBusinessDelegateFactory interface and drag it into the diagram above the PiggyBankEJBDelegateFactory class.
  4. In the Model 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 it to the IPiggyBankBusinessDelegate interface.
  7. In the Palette, click Implements.
  8. In the diagram editor, click the BusinessDelegateFactory class and drag it to the AbstractBusinessDelegateFactory interface.
  9. In the Palette, click Generalization.
  10. In the diagram editor, click the PiggyBankEJBDelegateFactory class and drag it to the BusinessDelegateFactory class.

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

The EJB business delegate implementation class diagram.

You have modeled the final classes of the PiggyBank design model. In exercise 3.8 you mark up the model by applying a profile to the EJB subcomponent layer. To continue, proceed to Exercise 3.8: Applying a profile to the design model.

Terms of use | Feedback
(C) Copyright IBM Corporation 2004, 2005. All Rights Reserved.