InfoCenter Home >
6: Administer applications >
6.6: Tools and resources quick reference >
6.6.5: Administering EJB modules (overview) >
6.6.5.5: Administering EJB modules with Application Assembly Tool >
6.6.5.5.1: Creating an EJB module

6.6.5.5.1: Creating an EJB module

EJB modules can be created by using the property dialog boxes or by using a wizard.


Using the property dialog boxes

The steps for creating an EJB module are as follows:

  1. Click File->New->EJB Module. The navigation pane displays a hierarchical structure used to build the contents of the module. The icons represent the components, assembly properties, and files for the module. A property dialog box containing general information about the module is displayed in the property pane.

  2. By default, the archive file name and the module display name are the same. It is recommended that you change the display name in the property pane.

  3. By default, the temporary location of the EJB module is installation_directory/bin. You must specify a new file name and location by clicking File->Save. You must add at least one enterprise bean to the module before saving it. This is a requirement for a valid archive file.

  4. Enter values for other properties as needed. View the help for 6.6.5.0.a: Assembly properties for EJB modules.

  5. Add enterprise beans to the module. You must add at least one enterprise bean. First, click the icon representing the type of bean being added (Session Beans or Entity Beans). There are several ways of adding beans to a module:

    • Import an existing JAR or EAR file containing enterprise beans. Right-click the icon representing the enterprise bean type and choose Import. Click Browse to browse the file system and locate the desired JAR file. When the file is located, click Open. Select the JAR file in the left window. The enterprise beans in the selected JAR file are displayed in the right window. Select the beans to be added and click Add. The selected items are displayed in the Selected Components window. Click OK. The property dialog box for the enterprise bean is automatically populated with required values. Click the plus sign (+) next to the icon representing the bean type to verify that the beans are included in the module.

    • Use a copy-and-paste operation to copy archive files from an existing module.

    • Create a new enterprise bean. Right-click the icon representing the appropriate bean type and choose New. For entity beans, choose whether the bean has container-managed or bean-managed persistence. In the property dialog box, browse for and select the class files that make up the bean. By default, the root directory or archive is the current archive. If needed, browse the file system for the directory or archive where the class files reside. After you choose a directory or archive, its file structure is displayed. Expand the structure and locate the files that you need. Select the file and click OK. In the property dialog box, click OK. Verify that the beans are added to the module (expand the hierarchy for the bean type in the navigation pane). If there are one or more beans, display the properties for each bean by clicking the bean in the top part of the property pane. The corresponding property dialog box is displayed in the bottom part of the pane.

  6. Specify properties for each enterprise bean. Expand the hierarchy for each bean type. Click a bean instance and, if needed, edit or enter properties for that bean. View the help for 6.6.5.0.1: Assembly properties for entity beans or 6.6.5.0.4: Assembly properties for session beans.

  7. Add assembly properties for each bean. Click the plus sign (+) next to the bean instance to reveal property groups. Click the icon representing a group of properties. If properties are already defined (for example, for an imported bean), edit the properties in the property pane. If properties are not defined, right-click the property icon and click New. A property dialog box is displayed. Enter values for the properties and click OK.

  8. Add assembly properties for the EJB module. In the navigation pane, right-click each property group's icon. Choose New to add new values.

  9. Add files needed by the application. Right-click the Files icon in the navigation pane and choose Add Files. Click Browse to navigate to the desired directory or archive. Click Select. If you are adding an entire archive, select the directory that contains the archive. The directory structure is displayed in the left pane. Browse the directory structure. From the right pane, select one or more files to be added and click Add. If you select a directory and click Add, all files in the directory, including the directory, are added. The selected files are displayed in the Selected Files window. Relative path names are maintained. When the Selected Files window contains the correct set of files, click OK.

  10. Click File->Save to save the archive.

Using the Create EJB Module wizard

Use this wizard to create an EJB module. The module can then be used as a stand-alone application, or it can become part of a J2EE application containing other modules. An EJB module consists of one or more enterprise beans. You can use existing EJB JAR files (import them), or create new ones.

During creation of the EJB module, you specify the files for each enterprise bean to be included in the module. You also specify other information about the bean, such as security roles and references to other enterprise beans and to resource connection factories. After defining the enterprise beans to be included in the module, you specify assembly properties that apply to the module as a whole. Both bean and module information are used to create a deployment descriptor.

You can specify either of the following:

  • One or more EJB 1.1 JAR files, either created manually or with VisualAge for Java. The enterprise beans must conform to J2EE specifications. The JAR files can be deployed or undeployed.

  • One or more EJB 1.0 JAR files. The Application Assembly Tool automatically converts the file to the EJB 1.1 specification format, but you must specify dependent classpaths if any.

  • Enterprise bean class files (not residing in a JAR file).

The wizard creates an EJB module in the file location you specify.

To create an EJB module, click the Wizards icon on the tool bar and then click EJB Module. Follow the instructions on each panel.

Specifying EJB module properties

On the Specifying EJB Module Properties panel:

  1. Indicate the application to which this module is to be added. If a parent application is not indicated, the module is created as a stand-alone application.

  2. Specify a display name for the module. The display name is used by the Application Assembly Tool to identify the module and can be used by other tools.

  3. Specify a file name for the module. The file name specifies a location on your system for the JAR file to be created.

  4. Provide a short description of the module (optional).

  5. Click Next.

Adding files

On the Adding Files panel, specify supplementary files (such as library and utility files) that are to be included in your EJB module. To add or remove files:

  1. Click Add. Use the file browser to choose one or more files. First, browse for the root directory or archive where the files are located and click Select. If you are adding an entire archive, select the directory that contains the archive. The directory structure is displayed in the left pane. Browse the directory structure. From the right pane, select one or more files to be added and click Add. If you select a directory and click Add, all files in the directory, including the directory, are added. Relative path names are maintained. The selected files are displayed in the Selected Files window. Click OK. The files are displayed in a table on the wizard panel.

  2. If you want to remove a file, select the file in the table and then click Remove.

  3. Continue to add or remove files until you have the correct set of files.

  4. Click Next.

Specifying EJB Client JAR and classpath

On the Specifying EJB Client JAR and Classpath panel:

  1. Specify the EJB Client JAR file. This is the location of the JAR file containing deployed classes needed by a client program for accessing the enterprise beans in this module.

  2. Specify the path containing additional classes required by the application. This path is used by the classpath loader.

  3. Click Next.

Choosing EJB module icons

On the Choosing EJB Module Icons panel, specify icons for your module.

  1. Specify the full path name of a file containing a small icon. The icon must be a GIF or JPEG image 16x16 pixels in size.

  2. Specify a full path name of a file containing a large icon. The icon must be a GIF or JPEG image 32x32 pixels in size.

  3. Click Next.

Adding enterprise beans

The Adding Enterprise Beans panel is used to add new enterprise beans, import existing beans, or (if you are modifying this module or make a mistake) remove beans.

To add a new enterprise bean:

  1. Click New. On the dialog box, choose a bean type (session bean, entity bean with BMP, or entity bean with CMP). Click OK.

  2. On the Specifying Enterprise Bean Properties panel, enter values for the properties of the bean. Click Browse to locate the root directory or archive where the bean class files reside. The files are displayed in a window. Locate and click the appropriate file. Click OK. View the help for 6.6.5.0.1: Assembly properties for entity beans or 6.6.5.0.4: Assembly properties for session beans. Click Next.

  3. On the Specifying Container-managed persistence (CMP) fields panel, define the variables for which the container must manage persistence management. View the help for 6.6.5.0.2: Assembly properties for CMP fields. Click Next. This panel is visible only for entity beans with CMP.

  4. On the Specifying Specific Enterprise Bean Type Properties panel, enter values for the properties of the bean. View the help for 6.6.5.0.1: Assembly properties for entity beans or 6.6.5.0.4: Assembly properties for session beans. Click Next.

  5. On the Choosing Enterprise Bean Icons panel, specify icons for the bean. Specify the full path name of a file containing a small icon and large icon. The icon must be a GIF or JPEG image (16x16 pixels or 32x32 pixels in size).

  6. On the Adding Environment Entries panel, enter values for environment entries. Click Add and enter a name and type (required). Click OK. The entry is displayed in the table on the wizard panel. To remove an entry, select the entry and then click Remove. View the help for 6.6.34.0.a: Assembly properties for environment entries. Click Next.

  7. On the Adding Security Role References panel, enter values for security role references. Click Add to enter a role name. Click OK. The role name is displayed in a table on the wizard panel. To remove a role, select the role in the table and then click Remove. View the help for 6.6.43.0.3: Assembly properties for security role references. Click Next.

  8. On the Adding Resource References panel, enter references for resource connection factories. Click Add to add a reference. You must enter values for a name, type, and authorization mode. Click OK. The reference is displayed in a table on the wizard panel. To remove a reference, select the reference in the table and then click Remove. View the help for 6.6.43.0.2 Assembly properties for resource references. Click Next.

  9. On the Adding EJB References panel, enter values for EJB references. Click Add to add a reference. You must enter a value for the name, home interface, remote interface, and type. Click OK. The reference is displayed in a table on the wizard panel. To remove a reference, select the reference in the table and then click Remove. View the help for 6.6.43.0.1: Assembly properties for EJB references.

  10. Click Finish.

  11. Continue to add more enterprise beans as needed.

To import an existing enterprise bean:

  1. Click Import.

  2. Browse the file system to locate the desired archive. The contents of the archive are displayed in a window. Select one or more JAR files. The enterprise beans in the JAR file are displayed in the right window. Select an enterprise bean and then click Add. The enterprise beans are added to the Selected Components window. Click OK.

To remove an enterprise bean, select the enterprise bean in the table and then click Remove.

Continue adding and removing enterprise beans as necessary. Click Next.

Adding security roles

On the Adding Security Roles panel:

  1. Click Add. Type a role name and, optionally, type a description. Click OK. The role name is displayed in a table on the wizard panel. View the help for 6.6.5.0.5: Assembly properties for security roles.

  2. Continue to add security roles as needed. If you need to remove a role, select the role in the table and then click Remove.

  3. Click Next.

Adding method permissions

On the Adding Method Permissions panel, indicate which security roles are permitted to invoke which methods.

  1. To add method permissions, click Add. Enter a name for the method permission. View the help for 6.6.5.0.6: Assembly properties for method permissions.

  2. Click Add next to the table of methods. Locate the method in the JAR file, select it, and then click OK.

  3. Click Add next to the table of security roles. Select the appropriate security role and click OK.

  4. Verify the information and click OK. The method permission is displayed in a table on the wizard panel.

  5. To add multiple method permissions, click Add on the wizard panel and repeat the process.

  6. Continue to add and remove methods and corresponding security roles as needed. If you need to remove a method permission, select the item and then click Remove.

  7. Click Next.

Adding container transactions

On the Adding Container Transactions panel, indicate transaction attributes for the methods of the enterprise bean.

  1. To add a container transaction, click Add. Enter a name and choose a transaction attribute from the menu. View the help for 6.6.5.0.7: Assembly properties for container transactions.

  2. Click Add to choose which methods are to be governed by this attribute. Locate the method in the JAR file, select it, and then click OK.

  3. Verify the information and click OK. The container transaction is displayed in a table on the wizard panel.

  4. To add multiple container transactions, click Add on the wizard panel and repeat the process.

  5. Continue adding or removing container transactions as needed. If you need to remove a container transaction, select the item and then click Remove.

Setting additional properties and saving the archive

Click Finish to complete the wizard. To change settings for properties, click Back to return to the appropriate panel. Make any needed changes, and then click Finish.

After you click Finish, the contents of the archive are displayed in an Application Assembly Tool window. Review the contents in the navigation pane. You can continue adding or modifying properties as needed. For example, you can add binding information. When you are finished editing the archive, click File->Save to save the archive file.

Go to previous article: Administering EJB modules with Application Assembly Tool Go to next article: Administering Web containers

 

 
Go to previous article: Administering EJB modules with Application Assembly Tool Go to next article: Administering Web containers