Installation and User Guide for the tool  “EJB Wizard For Code Generation”

Introduction to the tool

                           This tool is meant for generation of Enterprise Java Bean Source code files with a minimum effort of coding. Generally most of the industries leading IDEs offer such a wizard, but not many free IDEs like JBuilder Foundation, Forte For Java etc. give such features,  because they offer such features in their Enterprise versions. But the EJB programmers who are learning EJB or using EJB for their personal use, they are in need of such a tool through which they can generate EJBs without much coding. This tool can be used with free EJB servers like the one that comes with Sun’s J2EE SDK. Even it can be used with many open source EJB servers are available for free on the internet.

Why a Wizard is needed for EJB code generation?

                           EJB is such a framework where a lot of mappings between the classes are to be done at the source code level. For example every create method of Home interface should have a corresponding ejbCreate method in the Bean Class with a related signature. It is nothing but a coding complexity to create such related  methods with a proper matching. Another reason is that many EJB classes will have the same code for the EJB framework methods which  should follow some rules to qualify as a valid EJB. Next come the case of Entity beans where a huge volume of code should be written for accomplishing the database tasks. And there are many more complexities in the coding of EJB classes.

                           Each of the above mentioned complexities can be handled by a tool if it can intelligently generate the code by taking a fewer inputs from the user. With such a tool, EJB developer can concentrate on what fields and business logic methods the Bean should have rather than coding the same repetitive code again and again for each bean.  Once such code is ready , he/she can concentrate on the business logic rather than meddling with the code to follow EJB framework rules.

 

What features can this tool offer?

A Few Words from the Author

In future this tool may support creation of the Entity beans from the existing database.Since this tool is in the pre matured stage, it may have bugs or areas of improvement. This is “the tool for you” and it is going to evolve from your requirements and suggestions. Please keep sending the bugs so that I can fix them as soon as possible , to make the tool bug free. Please feel free to send your suggestions and comments so that I can improve the tool.  I am available at nphanindrakumar@yahoo.com.

 

 

Installation and Startup of the tool

1.     Copy the EjbGenerator.zip file into the local machine

2.     Extract the contents into some folder.

3.     Check your classpath so that Java 1.2.*/1.3 SDK and J2EE SDK libraries are available for execution of the tool. Even the alternate SDKs for Java and EJB can be used.

4.     On Windows Operating system, double click the batch file RunEjbGenerator.bat for execution of the tool.  

5.     On other Platforms you can run the tool by directly invoking the java interpreter with  the command “java ejbgen.gui.Driver”. This can be used on Windows also.

6.     Then start using the tool to Generate EJBs

 

How to use the tool

Startup Screen

This tool starts with a screen shown as below.

 

Click “Create Session Bean” button for creating the Session Bean.

Click “Create Entity Bean” button for creating the Entity Bean.

Click “EXIT” button to Quit.

 

Creating Session Bean

On Clicking Click “Create Session Bean” button in the Startup screen the “Basic Info” screen appears as below,  where the session bean specification should be given.

 

In the “Basic Info” screen enter the primary information for the session bean.

Creating Entity Bean

On Clicking “Create Entity Bean” button in the Startup screen the “Basic Info” screen appears as below,  where the entity bean specification should be given.

In the “Basic Info” screen enter the primary information for the entity bean.

 

Adding Bean Fields

“Field Editor” screen will appear by clicking “Next” button in the “Basic Info” Screen. The screen looks as follows for Container managed persistent entity bean.

 

Here the fields or the bean class data members can be added and the fields can be marked for their related methods or additional behavior. The screen when used for different beans, it appears a little different according to type of the bean. Here is the description for using the “Field Editor”.

 

After giving the proper inputs for the fields, click next to enter the “Method Editor” Screen where the methods can be provided for the bean. 

Adding Bean Methods

“Method Editor” screen will appear by clicking “Next” button in the “Field Editor” Screen. The screen looks as follows for Container managed persistent entity bean.

 

Here the methods for the bean class(and in turn to the home and remote interfaces) can be added. The screen when used for different beans, it appears a little different according to type of the bean. Here is the description for using the “Method Editor”.

If the method is a Framework one, then some/all of the widgets may not be editable. But if it is a framework one, the existing content can be changed. Then click “OK” button to confirm the changes or else click “Cancel” button to discard the changes. This closes the “Method Maker” screen and reflects the changes in “Method Editor” screen.

 

Creating the EJB Code

Necessary changes in any screen can be made by navigating to different screens using “Next” and “Prev” buttons.

After completion of defining the methods in the “Method Editor” screen, click “Finish” button which will show the following message.

This message confirms that the EJB classes’ source code is generated in the path specified.  Clicking “Yes” shows the opening screen of the tool, where the next bean can be generated. Clicking “No” will terminate your session with this tool and the tool execution ends there.