Pramati Technologies

Modifying Interfaces

Overview

The Bean Wizard generates interfaces during bean creation which must comply with EJB specifications. To modify these interfaces using Bean Wizard, the bean needs to be generated again. The Interface Wizard in Studio improves the efficiency in such situations, by allowing interfaces to be added and removed, and generated interfaces to be modified.

This document describes the Interface Wizard and how the tedious work involved in defining interfaces repeatedly, is spared.

Starting the Interface Wizard

Select Tools > Interface Wizard from the main menu. This brings up Interface Wizard for the active desk. There are two types of interfaces defined in the specification - Local and Remote. Local interfaces allow session beans and entity beans to be tightly coupled with their clients and to be directly accessed without the overhead typically associated with remote method calls. Local interfaces also provide the foundation for container-managed relationships among entity beans with container-managed persistence.

Remote Interfaces hold references to the business logic that is specific to the bean, and remote home interfaces hold functions generic to the execution of the bean in its environment. Follow the given sections to add, remove and modify interfaces in the active desk.

Super interface generation is supported in case of Auto-Interface generation. Methods present in the super class of a bean are not added to its interfaces directly. If the bean class has a super class, and you want to expose its methods in Local or Remote sets of interfaces, then these methods should be added to the respective interfaces, manually.

Providing interface names

In Interface Wizard, the first panel assists in defining local and remote interfaces for the generated beans.

Table 1:
Attribute
Sub option
Description
Source Root
 
Choose from the list of EJB and Java modules in the active desk. Only modules containing beans are available for selection
EJB Name
 
From the dropdown, select the bean for which interfaces are to be generated
Bean Class
 
Bean Class is displayed in this field; it is not editable
Remote Interfaces
 
This field is checked if the bean selected in EJB Name field contains Remote interfaces. To remove Remote interfaces from the bean, uncheck the option
 
Home Interface Name
Displays the default name of Home interface; modify name if required. To enter custom interfaces that this Home interface should extend, click on Adv
 
Remote Interface Name
Displays the default name of Remote interface; modify name if required. To enter the custom interfaces that this Remote interface should extend, click on Adv
Local Interfaces
 
This field is checked if the bean selected in the EJB Name field contains local interfaces. To remove the local interfaces from the beans, uncheck the option. Local interfaces cannot be removed from entity beans with container managed relationships
 
Local Home Interface Name
The default name of the local home interface is displayed here. The name can be modified, if required. To enter the custom interfaces that this local home interface extends, click on Adv
 
Local Interface Name
The default name of the local interface is displayed here. The name can be modified, if required. To enter the custom interfaces that this local interface extends, click on Adv

All generated interfaces extend their javax.ejb.xxx interface as defined in J2EE specification. You need not specify javax.ejb.xxx in the Adv panel. After entering all required information, click Next. This displays Methods to publish in Interface(s) panel.

Publishing methods in Home and Local Home interfaces

Check the Home and Local Home interfaces for finder methods created previously. These methods are then placed in Home interface. Click Next to open Methods to be published in Remote and Local interfaces panel.

Publishing methods in Remote and Local interfaces

The Methods to be published in Remote and Local interfaces panel displays all get/set methods for CMFs and CMRs, and the business methods defined earlier. Check Remote and Local interfaces for the methods to be placed in Local interface. The setXXX() methods for primary key fields is not displayed for selection in this panel. Click Finish. The Interface Wizard then re-generates Local and Remote interfaces for the bean.


Pramati Technologies  © Copyright   TOCPREVNEXTINDEX