This section describes how to use the EJB ODA in Business Object Designer to generate business object definitions. For information on launching and using Business Object Designer, see IBM WebSphere Business Integration Adapters Business Object Development Guide.
The ODA can be run from any machine that can mount the file system on which the metadata repository (the JAR files) resides, using the ODA startup file. This file contains start parameters, including the paths to certain required EJB and connector JAR files. These JAR files must also be accessible from the machine on which you are running the ODA.
The ODA for EJB has a default name of EJBODA. The name can be changed by changing the value of the AGENTNAME variable in the start script.
To start the ODA, run this command:
The CLIENT JARPATH variable of the startup file contains no default value, so before running the start command, set the value to the directory and filename of the client JAR path, so as to allow the ODA to include the file in its Java class path. For example:
set CLIENTJARPATH=C:\BIA_MusicBeanSample.jar
Business Object Designer provides a wizard that guides you through the steps to generate a business object definition using the ODA. The steps are as follows:
To select the agent, follow these steps.
After you click Next on the Select Agent screen, the Business Object Wizard - Step 2 of 6 - Configure Agent screen appears. Figure 6 illustrates this screen with sample values.
Figure 6. Configure Agent screen
The properties you set on this screen are described in Table 9. You can save all the values you enter on this screen to a profile. Instead of retyping the property data the next time you run the ODA, you simply select a profile from the Current profile drop-down menu and re-use the saved values. You can save multiple profiles, each with a different set of specified values.
Table 9. Configure Agent properties
Property name | Default value | Type | Description |
---|---|---|---|
EJBJarFilePath | None | String | (required) The fully qualified path to the EJB JAR file. This is the file that the ODA reads as input to generate business objects. |
DefaultBOPrefix | None | String | The prefix that the ODA will add to the names of the business objects it generates |
TraceFileName | <agentname>trace.txt | String | The name of the trace message file; for example, BIA_EJBODAtrace.txt. Note that the connector supports globalized values for this property, which means that the file path and name can be globalized, though the file content cannot. |
TraceLevel | 0 | Integer | (required) The tracing level (from 0 to 5) for the Agent. For details about tracing levels, see Tracing. |
MessageFile | <agentname>Agent.txt | String | The name of the message file that contains all the messages displayed by the ODA. For the connector for EJB, the name of this file is BIA_EJBODAAgent.txt. If you do not correctly specify the name of the message file, the ODA will run without messages. Note that the connector supports globalized values for this property, which means that the file path and name can be globalized, though the file content cannot. |
The Business Object Wizard - Step 3 of 6 - Select Source screen appears, as illustrated in Figure 7. The screen lists the objects that have been defined in the EJB JAR file. Use this screen to select any number of EJB objects for which the ODA will generate business object definitions.
Notice that the list contains a total of eight methods. The first two objects in the list are the creator methods from the home interface. The remaining six methods are remote interface business methods.
Figure 7. Select Source screen
In Figure 7, the MusicCartHome and MusicCart class are selected. Although only the class names are selected, the ODA will also create objects of the associated methods of each selected class.
The Business Object Wizard - Step 4 of 6 - Confirm source nodes for business object definitions screen appears. It shows the object(s) you selected.
Figure 8. Confirm source node screen
Click Back to make changes or Next to confirm that the list is correct.
The Business Object Wizard - Step 5 of 6 - Generating business objects... screen appears with a message stating that the wizard is generating the business objects.
After you click Next, the Enter JNDI name for this Enterprise Java Bean screen appears. It appears for each selected EJB source object. Use this screen to select the supported verbs for this object and to assign a JNDI name.
In the example provided in Figure 9, the JNDI name assigned is MusicCartJNDI.
Figure 9. Enter JNDI Name for Enterprise Java Bean screen
On this screen you also specify the verbs that the business object supports. The ODA allows you to specify the four supported verbs (Create, Retrieve, Delete, and Update) and assign as actions of each verb n methods, where n equals the number of methods in the corresponding EJB object. To specify additional verbs beyond the supported four, or to edit verb information after you create a business object, use Business Object Designer.
For details about business object verbs for the EJB connector, see Verb ASI.
For each verb you select, a separate window appears where you specify the method sequence that must be executed for the verb.
Figure 10 illustrates this screen for the Create verb of the MusicCart business object created in Figure 7 and Figure 8.
Figure 10. Setting the verb method sequence
Note that if the first method selected on the verb ASI is not a creator or finder method, the connector throws the following error message: 'The first method obtained from the list of methods in the verb ASI is not a home creator method. Select a creator method from the home interface and try again.'
By specifying a method sequence for the verb, you are creating the verb ASI that is associated with that verb. If necessary, this verb ASI can be modified later using Business Object Designer.
The Business Object Wizard - Step 6 of 6 - Save business objects screen appears.
Figure 11. Save business objects screen
You can optionally open the new business objects in separate windows within Business Object Designer, or (after specifying a key for the top-level business object) you can save the generated business object definitions to a file.
To open the business objects in separate windows
To save the business objects to a file (only after you specify a key for the parent-level business object):
Business Object Designer saves the files to the specified location.
If you have finished working with the ODA, you can shut it down by checking "Shutdown ODA EJBODA" before clicking Finish.
After you define the verb ASI (by specifying a method sequence that must be executed for each verb), Business Object Designer displays the attributes for the business object. For details about the attribute-level ASI in the EJB connector, see Attribute-level ASI.
The attributes are listed on the Attributes tab in the order in which they appear in the EJB object structure, as defined by the numeric value in the Pos column. Simple EJB object attributes are represented as simple attributes and their ASI contains the original EJB attribute name and type.
For each attribute, the screen provides the name of the attribute, its type, and the ASI information. Figure 12 illustrates the method (complex) attributes. The getAllRecordsInfo attribute of the business object has an ASI that maps the attribute to the original EJB object method. In this example, the original method is indicated under the App Spec Info column, by the method_name=getAllRecordInfo ASI.
The getCustomer attribute of the business object has an ASI that maps the attribute to the original EJB object method. In this example, the original method is indicated under the App Spec Info column, by the method_name=getCustomer ASI.
In addition, getCustomer (a child business object) has the child object attribute Return_Value, which is used to capture the return value of the getCustomer method. In the EJB JAR file, the method is defined as having a return value of type CustomerHelper, which itself is a method. The attribute ASI of CustomerHelper is set to type=proxy because the object type is a return value. Note that if a method in the EJB JAR file does not return a value, the Return_Value attribute is not included in the list of business object attributes.
Notice also that the Return_Value attribute of type CustomerHelper has three non-method child object attributes: name, password, and email. In the original EJB JAR file where the MusicCartBean class is defined, these are all defined as parameters of type String of the CustomerHelper method. In the business object, the attribute ASI of these parameters indicates the Java property name and type (String) of each in the original JAR file.
Figure 12. Setting the attribute ASI
On this screen, you should specify whether or not a parent-level object is a key (which is required by the ODA for saving the business objects to a separate file). You can also use this screen to set child object keys as needed and to specify the following information:
You can view and modify the business object-level ASI. For details about business object-level ASI, see Business object-level ASI.
The business object-level ASI is listed on the General tab. The ASI value that appears in the field Business Object Level Application-specific information contains the name of the remote interface that corresponds to this business object. The connector uses this information to map a remote object to a business object.
The General tab also lists all the verbs that are supported by the business object and provides the ASI for each verb, as it was defined in Specify the verb ASI. If a verb is blank, then a method sequence will not be executed for that verb.