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
- In the Project Explorer view, expand delegate.ejb.
- Double-click the Main diagram.
- In the diagram editor, add the title delegate.ejb - Business Delegate Implementation for EJB Implementation.
Create the PiggyBankEJBDelegateImpl class
Procedure
- In the Palette, double-click Class and name the class PiggyBankEJBDelegateImpl.
- In the diagram editor, right-click the PiggyBankEJBDelegateImpl class; then click Add UML > Attribute.
- Name the attribute PIGGY_BANK_CONTROLLER_EJB_REF.
- In the Properties view, click Select type.
- In the Select Type window, click String.
- In the Properties view, on the General page, click Static.
- In the diagram editor, right-click the PiggyBankEJBDelegateImpl class; then click .
- Name the attribute piggyBankController.
- In the Properties view, click Select type.
- In the Select Type window, expand itso.ad.business, expand ejb, expand facade, click PiggyBankController, and click OK.
- In the diagram editor, right-click PiggyBankEJBDelegateImpl; then click .
- 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:

Create the PiggyBankEJBDelegateFactory class
About this task
Procedure
- In the Palette, double-click Class and name the class PiggyBankEJBDelegateFactory.
- In the diagram editor, right-click the PiggyBankEJBDelegateFactory class; then click Add UML > Attribute.
- Name the attribute piggyBankDelegateImpl.
- In the Properties view, click Select type.
- In the Select Type window, expand itso.ad.business, expand delegate.ejb, click PiggyBankEJBDelegateImpl, and click OK.
- In the Properties view, on the General page, click Static.
- In the diagram editor, right-click PiggyBankEJBDelegateFactory; then click .
- Name the operation PiggyBankEJBDelegateFactory.
Create the business delegate relationships
About this task
Procedure
- In the Project Explorer view, expand itso.ad.business.
- In the factory subpackage, click the BusinessDelegateFactory class and drag it into the diagram to the right of the PiggyBankEJBDelegateFactory class.
- In the Project Explorer view, in the interfaces.delegates subpackage, click the AbstractBusinessDelegateFactory interface and drag it into the diagram above the PiggyBankEJBDelegateFactory class.
- In the Project Explorer view, in the interfaces.delegates subpackage, click the IPiggyBankBusinessDelegate interface and drag it into the diagram above the PiggyBankEJBDelegateImpl class.
- In the Palette, click Implements.
- In the diagram editor, click the PiggyBankEJBDelegateImpl class and drag the cursor to the IPiggyBankBusinessDelegate interface.
- In the Palette, click Implements.
- In the diagram editor, click the BusinessDelegateFactory class and drag the cursor to the AbstractBusinessDelegateFactory interface.
- In the Palette, click Generalization.
- 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:
