Pramati Technologies

Modifying Interfaces

Using Bean Wizard automatically generate interfaces, along with Beans. These interfaces must comply to a strict set of rules, which are well defined by the standard. To modify these interfaces in the Bean Wizard, the Bean needs to be generated again, which can be quite a burden.

The Interface Wizard in Studio improves the efficiency of developers in such situations, by allowing interfaces to be added and removed, and generated interfaces to be modified. This chapter describes the Interface Wizard such that the tedious work involved in defining these interfaces again and again is spared.

Starting the Interface Wizard

Click on Tools > Interface Wizard from the main menu. This brings up the 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.

Note: Super Interface generation is supported in case of Auto-Interface generation.

Methods present in the super class of the beans are not directly added to its interfaces. In case the bean class has a super class, and the user wants to expose its methods in the Local/Remote sets of interfaces, then these methods have to be manually added in the respective interfaces.

Providing Interface Names

The first panel in the Interface wizard assists in defining local and remote interfaces for the generated beans.

Source Root Choose from the list of EJB Modules and Java Modules in the active Desk. Only modules containing beans are displayed in the list.

EJB Name Choose the bean for which the interfaces are to be generated from the Bean Name combo box.

Bean Class The Bean Class is displayed in this field, and is not editable.

Remote Interfaces This field is checked if the bean selected in the EJB Name field contains remote interfaces. To remove the remote interfaces from the beans, uncheck the option.

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.

All the generated interfaces extend their javax.ejb.xxx interface as defined by the J2EE specification. Therefore the user need not specify javax.ejb.xxx in the Adv panel.

After entering all the information required, click Next. This displays the next panel called Methods to publish in Interface(s).

Methods to be published in Interface(s)- Home and Local Home

Check the home and local home interfaces for the finder methods created previously. These methods are then placed in the home interface. Click Next.

Methods to be published in Interface(s) - Remote and Local

This panel displays all the get and set methods of the CMFs and CMRs, and also the business methods that were defined earlier. Check the remote and local interfaces for those methods that are to be placed in the local interface. Click Finish.

The setXXX() methods for the primary key fields is not displayed for selection in this panel.

The Interface Wizard then re-generates the local and remote interfaces for the bean.


Pramati Technologies  © Copyright   TOCPREVNEXTINDEX