Lesson 3.5: Create the framework component layer
About this task
The following table lists the design subpackages that the framework component layer contains:
| Package | Description |
|---|---|
| exception | This subpackage contains the ServiceException and DataAccessException exception classes that provide error recovery for the PiggyBank online banking system. |
| factory | This subpackage contains the BusinessDelegateFactory class that is used to dynamically create a business delegate. |
| interfaces.delegates | This subpackage contains the interfaces for the business delegate. |
| interfaces.to | This subpackage contains the interfaces for the transfer objects. |
Transfer objects are used as return types for remote procedure calls. The PiggyBank transfer objects transport customer and account information between layers in the PiggyBank design. This lesson models the transfer object interfaces.
Create the ICustomerTO interface
Procedure
- In the Project Explorer view, expand Enterprise IT Design Model, and expand PiggyBank Implementation Designs.
- In the itso.ad.business subpackage, right-click the framework package; then click
- Name the new package interfaces.to.
- In the Project Explorer view, double-click the Main diagram and add the title interfaces.to - Transfer Object Interfaces.
- In the Palette, double-click Interface and name the interface ICustomerTO.
- In the diagram editor, right-click the ICustomerTO class; then click .
- Name the operation getId.
- In the Properties view, on the General page, click Set return type.
- In the Select Element window, click String.
- In the diagram editor, right-click the ICustomerTO class; then click .
- Name the operation getName.
- In the Properties view, on the General page, click Set return type.
- In the Select Element window, click String.
Create the IAccountTO interface
Procedure
- In the Palette, double-click Interface and name the interface IAccountTO.
- In the diagram editor, right-click the IAccountTO class; then click .
- Name the operation getBalance.
- In the Properties view, on the General page, click Set return type.
- In the Select Element window, click Integer.
- In the diagram editor, right-click the IAccountTO class; then click .
- Name the operation getNumber.
- In the Properties view, on the General page, click Set return type.
- In the Select Element window, click String.
Results
You created the transfer object interfaces. Your diagram should look similar to the following figure:

Create the delegate interfaces
Create the IPiggyBankBusinessDelegate interface
Procedure
- In the Project Explorer view, expand Enterprise IT Design Model and expand PiggyBank Implementation Designs.
- In the itso.ad.business subpackage, right-click the framework package; then click .
- Name the new package interfaces.delegates.
- In the Project Explorer view, double-click the Main diagram and add the title interfaces.delegates - Delegate Interfaces.
- In the Palette, double-click Interface and name the interface IPiggyBankBusinessDelegate.
Create the cashCheck operation
Procedure
- In the diagram editor, right-click the IPiggyBankBusinessDelegate class; then click .
- Name the operation cashCheck ( accountToCredit, checkAmount, checkReference ).
- In the Properties view, on the Parameters page, for the accountToCredit parameter, click the Type field and change the parameter type to String.
- For the checkAmount parameter, click the Type field and change the parameter type to Integer.
- For the checkReference parameter, click the Type field and change the parameter type to String.
Create the getAccountByCustomer operation
Procedure
- In the diagram editor, right-click the IPiggyBankBusinessDelegate class; then click .
- Name the operation getAccountByCustomer ( customer ).
- In the Properties view, on the Parameters page, for the getAccountByCustomer parameter, beside Multiplicity, click the down arrow beside 1..-1, and click 1..*.
- On the General page, click Set return type.
- In the Select Element window, click the Browse tab, expand itso.ad.business, expand framework and, in the interfaces.to package, click IAccountTO.
- On the General page, select the Ordered check box, and clear the Unique check box.
Create the getBalance operation
Procedure
- In the diagram editor, right-click the IPiggyBankBusinessDelegate class; then click .
- Name the operation getBalance ( accountNumber, customer ).
- In the Properties view, on the Parameters page, for the accountNumber parameter, click the Type field and change the parameter type to String.
- For the customer parameter, click the Type field and change the parameter type to ICustomerTO.
- In the Properties view, on the General page, click Set return type.
- In the Select Element window, click Integer.
Create the getCustomerById operation
Procedure
- In the diagram editor, right-click the IPiggyBankBusinessDelegate class; then click .
- Name the operation getCustomerById ( customerId ).
- In the Properties view, on the Parameters page, for the customerId parameter, click the Type field and change the parameter type to String.
- In the Properties view, on the General page, click Set return type.
- In the Select Element window, click the Browse tab, expand Enterprise IT Design Model, expand PiggyBank Implementation Design, expand itso.ad.business, expand framework and, in the interfaces.to package, click ICustomerTO.
Create the transfer operation
Procedure
- In the diagram editor, right-click the IPiggyBankBusinessDelegate class; then click .
- Name the operation transfer ( amountToTransfer, creditAccount, customer, debitAccount ).
- In the Properties view, on the Parameters page, for the amountToTransfer parameter, click the Type field and change the parameter type to Integer.
- For the creditAccount parameter, click the Type field and change the parameter type to String.
- For the customer parameter, click the Type field and change the parameter type to ICustomerTO.
- For the debitAccount parameter, click the Type field and change the parameter type to String.
- In the Properties view, on the General page, click Set return type.
- In the Select Element window, click Boolean.
Create the AbstractBusinessDelegateFactory interface:
Procedure
- In the Palette, double-click Interface and name the interface AbstractBusinessDelegateFactory.
- In the diagram editor, right-click the AbstractBusinessDelegateFactory class; then click .
- Name the operation createPiggyBankBusinessDelegate.
- In the Properties view, on the General page, click Set return type.
- In the Select Element window, click the Browse tab, expand Enterprise IT Design Model, expand PiggyBank Implementation Design, expand itso.ad.business, expand framework and, in the interfaces.delegates package, click IPiggyBankBusinessDelegate, and click OK.
Results
You modeled the delegate interfaces. Note that the getAccountsByCustomer and getCustomerById operations return the transfer object interfaces that you created in the previous lesson. Your diagrams should look similar to the following figures:

Create the business-delegate factory
Create the BusinessDelegateFactoryClass interface
Procedure
- In the Project Explorer view, expand Enterprise IT Design Model and expand PiggyBank Implementation Designs.
- In the itso.ad.business subpackage, right-click the framework package; then click .
- Name the new package factory.
- In the Project Explorer view, double-click the Main diagram and add the title factory - Business Delegate Factory abstract implementation.
- In the Palette, double-click Class and name the class BusinessDelegateFactory.
- Click the BusinessDelegateFactory class.
- In the Properties view, on the General page, select the Abstract check box.
Create the delegateFactory attribute
Procedure
- In the diagram editor, right-click the BusinessDelegateFactory class; then click .
- Name the attribute delegateFactory.
- Click the delegateFactory attribute.
- In the Properties view, on the General page, click Select type.
- In the Select Element window, click the Browse tab, expand Enterprise IT Design Model, expand PiggyBank Implementation Design, expand itso.ad.business, expand framework, and in the interfaces.delegates package, click AbstractBusinessDelegateFactory.
- In the Properties view, on the General page, click Static.
Create the getInstance operation
Procedure
- In the diagram editor, right-click the BusinessDelegateFactory class; then click .
- Name the operation getInstance.
- Click the getInstance operation.
- In the Properties view, on the General page, click Select type.
- In the Select Element window, click the Browse tab, expand Enterprise IT Design Model, expand PiggyBank Implementation Design, expand itso.ad.business, expand framework and, in the interfaces.delegates package, click AbstractBusinessDelegateFactory.
- In the Properties view, on the General page, click Static.
Create the init operation
Procedure
- In the diagram editor, right-click the BusinessDelegateFactory class; then click .
- Name the operation init ( factoryClassName ).
- In the Properties view, on the Parameters page, for the factoryClassName parameter, click the Type field and change the parameter type to String.
- In the Properties view, on the General page, click Static.
- In the Project Explorer view, in the interfaces.delegate subpackage, click the AbstractBusinessDelegateFactory interface and drag it into the diagram.
- In the Palette, click Implements.
- In the diagram editor, click the BusinessDelegateFactory class and drag the cursor to the AbstractBusinessDelegateFactory class.
Results
You modeled the itso.ad.business layer factory classes. Your diagram should look similar to the following figure:

Create the itso.ad.business framework exceptions
Create the DataAccessException and ServiceException classes
Procedure
- In the Project Explorer view, expand Enterprise IT Design Model and expand PiggyBank Implementation Designs.
- In the itso.ad.business subpackage, right-click the framework package; then click .
- Name the new package exception.
- In the Project Explorer view, double-click the Main diagram and add the title exception.
- In the Palette, double-click Class and name the class DataAccessException.
- In the Palette, double-click Class and name the class ServiceException.
- In the Project Explorer view, click and drag the factory and exception packages into the itso.ad.business Design Elements diagram.
- In the Palette, click the Usage relationship and click delegate.ejb package and drag the cursor to the ejb package.
- In the Palette, click the Association relationship and click factory package and drag the cursor to the framework package.
Results
You modeled the itso.ad.business framework component layer. The framework layer is an isolation layer that hides the PiggyBank client interface from the PiggyBank implementation. Your diagram should look similar to the following figure:
