[Version 5.0.2 and later]Setting EJB module ActivitySession deployment attributes with the Assembly Toolkit

Use this task to set the ActivitySession deployment attributes for an enterprise bean to enable the bean to participate in an ActivitySession context and support ActivitySession-based operations.

Why and when to perform this task

You can configure the deployment attributes of an application by using the Deployment Descriptor Editor of WebSphere Studio Application Developer or the Assembly Toolkit.

This topic describes the use of the Assembly Toolkit to configure the ActivitySession deployment attributes. These attributes are in addition to other deployment attributes, like Load at (which specifies when the bean loads its state from the database). This task description assumes that you have an EAR file, which contains an application enterprise bean that can be deployed in WebSphere Application Server. For more details about using the Assembly Toolkit, see Assembling applications with the Assembly Toolkit. For more detail about the fields in the Assembly Toolkit, and for associated task help, see the help information provided with the toolkit.

To set the ActivitySession deployment attributes for an enterprise bean, use the Assembly Toolkit to complete the following steps:

Steps for this task

  1. Starting the Assembly Toolkit
  2. Create or edit the application EAR file.

    Note: Ensure that you set the target server as WBI Server Foundation v5.1.

    For example, to change attributes of an existing application, use the import wizard to import the EAR file into the Assembly Toolkit. To start the import wizard:

    1. Click File-> Import-> EAR file
    2. Click Next, then select the EAR file.
    3. In the Target server field, select WBI Server Foundation v5.1
    4. Click Finish
  3. In the J2EE Hierarchy view of the J2EE perspective, right-click the EJB module for the enterprise bean instance, then click Open With > Deployment Descriptor Editor.
    A property dialog notebook for the enterprise bean instance is displayed in the property pane.
  4. In the property pane, select the Beans tab.
  5. Select the bean that you want to change.
  6. In the WebSphere Extensions section, under Bean Cache, set the Activate at attribute to ActivitySession:

    An enterprise bean with this activation policy is activated and passivated as follows:

    • On an ActivitySession boundary, if an ActivitySession context is present on activation.
    • On a transaction boundary, if a transaction context, but no ActivitySession context, is present on activation.
    • Otherwise on an invocation boundary.

  7. In the Local Transactions group box, set the Boundary attribute to ActivitySession:
    When this setting is used, the local transaction must be resolved within the scope of any ActivitySession in which it was started or, if no ActivitySession context is present, within the same bean method in which it was started.
  8. For entity beans, or session beans, set the ActivitySessions properties for each EJB method.
    1. In the property pane, select the ActivitySession tab.
    2. In the Configure ActivitySession policies field, click Add or Edit to set the ActivitySession kind attribute for methods of the enterprise bean. This specifies how the container must manage the ActivitySession boundaries when delegating a method invocation to an enterprise bean's business method:
      Never
      The container invokes bean methods without an ActivitySession context.
      • If the client invokes a bean method from within an ActivitySession context, the container throws an InvalidActivityException exception, which is a javax.rmi.RemoteException.
      • If the client invokes a bean method from outside an ActivitySession context, the container behaves in the same way as if the Not Supported value was set. The client must call the method without an ActivitySession context.
      Mandatory
      The container always invokes the bean method within the ActivitySession context associated with the client. If the client attempts to invoke the bean method without an ActivitySession context, the container throws an ActivityRequiredException exception to the client. The ActivitySession context is passed to any EJB object or resource accessed by an enterprise bean method.

      The ActivityRequiredException exception is javax.rmi.RemoteException.

      Requires new
      The container always invokes the bean method within a new ActivitySession context, regardless of whether the client invokes the method within or outside an ActivitySession context. The new ActivitySession context is passed to any enterprise bean objects or resources that are used by this bean method.

      Any received ActivitySession context is suspended for the duration of the method and resumed after the method ends. The container starts a new ActivitySession before method dispatch and completes it after the method ends.

      Required
      The container invokes the bean method within an ActivitySession context. If a client invokes a bean method from within an ActivitySession context, the container invokes the bean method within the client ActivitySession context. If a client invokes a bean method outside an ActivitySession context, the container creates a new ActivitySession context and invokes the bean method from within that context. The ActivitySession context is passed to any enterprise bean objects or resources that are used by this bean method.
      Not supported
      The container invokes bean methods without an ActivitySession context. If a client invokes a bean method from within an ActivitySession context, the container suspends the association between the ActivitySession and the current thread before invoking the method on the enterprise bean instance. The container then resumes the suspended association when the method invocation returns. The suspended ActivitySession context is not passed to any enterprise bean objects or resources that are used by this bean method.
      Supports
      If the client invokes the bean method within an ActivitySession, the container invokes the bean method within an ActivitySession context. If the client invokes the bean method without a ActivitySession context, the container invokes the bean method without an ActivitySession context. The ActivitySession context is passed to any enterprise bean objects or resources that are used by this bean method.
    3. Click Next.
    4. Select the methods to which the ActivitySession kind policy is to be applied.
    5. Click Finish.

    How the container manages the ActivitySession boundaries when delegating a method invocation depends on both the ActivitySession kind attribute, set here, and the Transaction attribute attribute, as described inConfiguring transactional deployment attributes using the Assembly Toolkit. For more detail about the relationship between these two properties, see Combining transaction and ActivitySession container policies.

  9. Save your changes to the deployment descriptor.
    1. Close the Deployment Descriptor Editor.
    2. When prompted, click Yes to indicate that you want to save changes to the deployment descriptor.
  10. Verify the archive files.
  11. Generate code for deployment for EJB modules or for enterprise applications that use EJB modules.
  12. (Optional)   Test your completed module on a WebSphere Application Server installation. Right-click a module, click Run on Server, and follow the instructions in the displayed wizard. Note that Run on Server works on the Windows, Linux/Intel, and AIX operating systems only; you cannot deploy remotely from the Assembly Toolkit to a WebSphere Application Server installation on a UNIX operating system such as Solaris.

    Important: Use Run On Server for unit testing only. Assembly Server Toolkit controls the WebSphere Application Server installation and, when an application is published remotely, the Toolkit overwrites the server configuration file for that server. Do not use on production servers.

    For instructions on remote testing, see the article "Setting Up a Remote WebSphere Application Server in WebSphere Studio V5" at http://www7b.boulder.ibm.com/wsdd/techjournal/0303_yuen/yuen.html .

What to do next

After assembling your application, use a systems management tool to deploy the EAR file onto the application server that is to run the application; for example, using the administrative console as described in Deploying and managing applications.

Related concepts
The ActivitySession service
Related tasks
Using the ActivitySession service
Related reference
Combining transaction and ActivitySession container policies



Searchable topic ID:   tas_depejb2
Last updated: Jun 21, 2007 8:07:48 PM CDT    WebSphere Business Integration Server Foundation, Version 5.0.2
http://publib.boulder.ibm.com/infocenter/wasinfo/index.jsp?topic=/com.ibm.wasee.doc/info/ee/ass/tasks/tas_depejb2.html

Library | Support | Terms of Use | Feedback