<<Service>> classes

The UML to EJB transformation transforms a class with the <<Service>> stereotype into a container-managed, stateless, or stateful session bean with a bean name that is equal to the name of the source UML class. The transformation always generates the following Java classes for session beans:

 

The transformation generates the following Java classes when, on the Session tab, you click Remote Interfaces Only:

 

The transformation generates the following Java classes when, on the Session tab, you click Local Interfaces Only:

 

The transformation generates the following Java classes when, on the Session tab, you click Local and Remote Interfaces:

The transformation generates all classes in the package folder that is generated for the parent package of the source UML class. If you create a UML model without packages, the transformation creates a default package named ejbs.

The transformation generates the bean class file in the source tree of the target EJB project.

The transformation generates the four interface files in the source tree of the client project of the target EJB project. If no client project exists, the transformation generates the interface files in the target EJB project.

The transformation adds data that defines the session bean to the deployment descriptor (ejb-jar.xml).

Stereotype property - "hasState"

Each UML class with a <<Service>> stereotype has a stereotype property named "hasState". When the value of hasState is false, the transformation generates that UML class as a stateless session bean. Conversely, when the value of hasState is true, the transformation generates the UML class as a stateful session bean.

Note: The stereotype property affects only those UML classes that the transformation generates as new session beans.

By default, the hasState property has a value of false, which is consistent with the default settings in the session bean creation wizard.

Generalization relationships

If the source UML class for the session bean has a generalization relationship (such as an extends relationship) with another UML class with the <<Service>> stereotype, and that stereotype has the same "hasState" property value, the session bean that the class represents becomes the EJB superclass for the session bean to be generated.

Realization relationships

If the source UML class for the session bean has realization relationships (such as implements relationships) with interface elements, the interfaces that the source interfaces represent are implemented by the four interfaces (remote, home, local, local home).

Attributes

The transformation transforms attributes on the source UML class into Java properties in the bean class. For more information about how the attributes are transformed, see the UML to Java transformation documentation.

If the type of the attribute is of another enterprise bean, the EJB transformation does not generate a field and association for the session bean. Instead, the transformation writes a message to the log file that states that the source attribute will not be transformed.

Operations

The transformation transforms operations on the source UML class into business methods on the session bean. Initially, the operation is transformed in the same manner as an operation on an unmarked UML class. The transformed operation is added to the classes listed in the following table, with some modifications.

Class

Method modifications

Bean class

No change

Local interface

Interface method

Remote interface

Interface method, throws java.rmi.RemoteException

Inner classes

Ignored.

Inner interfaces

Ignored.

Terms of use | Feedback
(C) Copyright IBM Corporation 2004.
All Rights Reserved.