The connector processes business objects used by enterprise beans. This section describes the key concepts related to the structure of business objects processed by the EJB connector.
For each method defined in a Java class file, the ODA creates an attribute in the business object (for more information, see Attributes and Attribute-level ASI).
The type of the attribute that the ODA creates from a method is a child business object containing further attributes that represent method parameters and return types. These attributes appear in the exact same order as the parameters of the EJB method. The Return_Value attribute (not used if the method being defined is of type void) always appears last in the order of arguments, and represents the result of the EJB method call. Child business object attributes can be simple type or object type (complex), depending on the type of the method parameter or return value. The application specific information (ASI) for such attributes contains the exposed remote method name. For details about attribute ASI, see Attribute-level ASI.
The EJB connector requires a business object to have a creator method, obtained from the list of home interface creator methods, and one or more business object methods that have been specified in the remote interface. An attribute is created in the business object for each creator method on the home interface and for each method defined in the remote interface.
Whenever properties or method names contain special characters, the attribute names corresponding to these are modified to suit WebSphere Business Integration format.
For each public member variable, attribute, and method parameter in an enterprise bean method that has been defined in a Java class file, a corresponding business object attribute is generated by the ODA. The JAR file, which contains the interfaces, is used by the ODA to create business object definitions that map to remote and local enterprise beans.
If an attribute in the bean class is not a simple attribute, but instead is an object, then the business object (BO) attribute maps to a child object whose definition matches the corresponding Java class or EJB interface.
Business objects can be flat or hierarchical. A flat business object only contains simple attributes, that is, attributes that represent a single value (such as a string) and do not point to child business objects. A hierarchical business object contains both simple attributes and child business objects or arrays of child business objects that contain attribute values.
A cardinality 1 container object, or single-cardinality relationship, occurs when an attribute in a parent business object contains a single child business object. In this case, the child business object represents a collection that can contain only one record. The attribute type is the child business object.
A cardinality n container object, or multiple-cardinality relationship, occurs when an attribute in the parent business object contains an array of child business objects. In this case, the child business object represents a collection that can contain multiple records. The attribute type is the same as that of the array of child business objects.
For additional information about business object attributes, see Attribute-level ASI.
Application-specific information provides the connector with application-dependent instructions on how to process business objects. If you extend or modify a business object definition, you must make sure that the application-specific information in the definition matches the syntax that the connector expects.
Application-specific information is represented as a name-value pair and can be specified for the overall business object, for each business object attribute, and for each verb.
Object-level ASI provides fundamental information about the nature of a business object and the objects it contains. To view the ASI of a business object, open the business object in Business Object Designer and click the General tab. The business object-level ASI displays in the Business Object Level Application-specific information field. For details about this screen, see Creating and modifying business objects.
Table 4 describes the business object-level ASI of business objects that represent enterprise beans.
Table 4. Business object-level ASI
Object-level ASI | Description |
---|---|
object_type=RemoteEJB | Indicates that the object is an enterprise bean deployed on an application server (remote), rather than a standard Java class that is not deployed on an application server (local). |
jndi_name=<JNDIName> | The JNDI name of the enterprise bean |
home_name=<className> | The class name of the home interface |
proxy_class=<className> | The class name of the remote interface |
The following example illustrates business object-level ASI for a business object that the connector is processing with enterprise beans deployed on WebSphere Application Server. When the connector receives the business object from the broker, it first locates an instance of the home interface (com.ibm.websphere.AccountBookHome) on the application server, by looking up WsSamples/Account in the configured JNDI context. The connector than uses this home instance to create a new instance of the remote interface (com.ibm.websphere.AccountBook), which it can use to invoke methods on the EJB.
BO ASI=object_type = RemoteEJBObject proxy_class = com.ibm.websphere.AccountBook home_class = com.ibm.websphere.AccountBookHome jndi_name = WsSamples/Account
In this code sample:
A standard Java object (local) can have a BO ASI = auto_load_or_write.
The business object ASI for a data handler-supported message should contain the value object_type=dataHandlerObject; mime_type=<text_value> where <text_value> is the appropriate mime-type defined for the data handler (as specified in the data handler meta-object) that the adapter should use to convert the data.
Every business object contains a verb. A verb indicates which methods to invoke on the enterprise bean. For the adapter for EJB, the first method should be a creator method from the corresponding bean's home interface, and the remaining methods should be business process methods from the bean's remote interface.
The verb ASI contains a sequence of attribute names, each of which contains a method for the business object handler to call. Typically, the method to be invoked belongs to the object itself (versus belonging to a parent of the business object), in which case you specify the method in the object's verb ASI.
If the method to be invoked belongs to a parent in the business object hierarchy, then that parent can be referenced from the child by prefixing the method name with the PARENT tag.
For example, Figure 3
illustrates a business object hierarchy whereby ContactDetails is a
child object of Contact, which itself is a child of
PSRCustomerAccount.
Figure 3. Business object hierarchy and verb ASI
If a method that belongs to PSRCustomerAccount is called on the ContactDetails business object, then the verb ASI for ContactDetails represents the business object hierarchy as follows:
PARENT.PARENT.<methodName>
If the method belongs instead to the Contact business object, then the verb ASI for ContactDetails must be set as:
PARENT.<methodName>
Note that only methods that belong to parent objects within the hierarchy can be called. A parent business object cannot invoke a child's method.
The connector developer determines the EJB operations assigned to the verb. Supported verbs include:
For a given object, you can 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 enterprise bean.
To view the verb ASI of a business object, open a business object in Business Object Designer and click the General tab. The verb ASI appears in the Supported verbs table, which lists the name of the supported verbs and the corresponding ASI for each verb. For more information about Business Object Designer and the ODA wizard tabs and screens, see Creating and modifying business objects.
Every business object has a set of attributes, as described in Attributes, that map to corresponding enterprise bean methods and properties. A business object with a flat structure contains simple attributes, that is, attributes that represent a single value (such as a string) and do not point to child business objects. A hierarchical business object contains both simple attributes and child business objects or arrays of child business objects that contain attribute values.
The ASI of a business object attribute can be for simple attributes and complex attributes, which contain child objects. For a complex attribute, the ASI varies, depending on whether the contained child is a property or a method of an object. The mapping of EJB constructs to the ODA-generated business objects is described in Table 8.
To view the ASI of a business object attribute, open a business object in Business Object Designer and click the Attributes tab. Each attribute of the business object is listed in the Name column. The attribute properties described in Table 5, Table 6, and Table 7, appear in the remaining columns. Included in these properties is the ASI, which appears in the Application Specific Information column. For details about this screen, see Creating and modifying business objects.
Table 5 describes the business object properties of simple attributes. These properties include the ASI (AppSpecificInfo property) of the attribute. A simple attribute is always a non-child, for example a boolean, string, or integer value.
Table 5. BO attribute properties: for simple attributes
Attribute property | Description |
---|---|
Name | Specifies the business object attribute name. |
Type | Specifies the business object attribute type. See Table 8 for details about mapping EJB constructs to business object attribute types. |
MaxLength | Not used. |
IsKey | Each business object must have at least one key attribute, which you specify by setting the key property to true for an attribute. Note that this attribute is used by Business Object Designer, rather than by the connector. |
IsForeignKey | Specifies that the connector should check whether or not the object must be stored in the per call object pool. |
IsRequired | Not used. |
AppSpecInfo | Holds the
original Java type. This property is formatted as follows:
|
DefaultValue | Not used. |
Table 6 describes the elements for complex attributes containing child objects that are not methods. These elements include the ASI of the attribute.
Table 6. BO attribute properties: for non-method child object attributes
Attribute property | Description |
---|---|
Name | Specifies the business object attribute name. |
type | The type of the contained object. Set to proxy if the type is a business object. |
ContainedObjectVersion | Not used. |
Relationship | Specifies that the child is a container attribute. Set to Containment. |
IsKey | Not used |
IsForeignKey | Not used |
Is Required | Not used |
AppSpecificInfo | Holds the
original EJB application field name. This property is formatted as follows:
|
Cardinality | Set to n if the type represents an array or vector. Otherwise, set to 1. |
Table 7 describes the properties of complex attributes containing child objects that are methods. These properties include the ASI of the attribute.
Table 7. BO attribute properties: for method child object attributes
Attribute property | Description |
---|---|
Name | The business object attribute name. |
type | The business object. |
Relationship | Set to Containment, indicating that this is a child object. |
IsKey | Set to true if the attribute name equals UniqueName, otherwise it is set to false. |
IsForeignKey | Set to false. |
Is Required | Set to false. |
AppSpecificInfo | Holds the
exposed remote method interface name, which is the name of the method call placed to the EJB server by the enterprise bean. This attribute is formatted as:
|
Cardinality | Set to 1. |
Note that methods have arguments and return values. Arguments and return values can be complex (containing child objects) or simple.