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.
You can configure the deployment attributes of an application
by using an assembly tool such as the Application Server Toolkit (AST) or Rational Web Developer.
This topic describes the use of the Application Server Toolkit (AST) 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 assembling applications, see assembling applications.
For more detail about the fields in the assembly tool, and for associated task help, see the help information provided with the toolkit.
To set the ActivitySession deployment attributes for an enterprise bean, complete the following steps:
Note: Ensure that you set the target server as WebSphere Application Server version 6.
For example, to change attributes of an existing application, use the import wizard to import the EAR file into the assembly tool. To start the import wizard:
Click File-> Import-> EAR file
Click Next , then select the EAR file.
In the Target server field, select WebSphere Application Server v6.0
Click Finish
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.
In the property pane, select the Beans tab.
Select the bean that you want to change.
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.
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.
For entity beans, or session beans, set the ActivitySessions properties for each EJB method.
In the property pane, select the ActivitySession tab.
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.
Click Next .
Select the methods to which the ActivitySession kind policy is to be applied.
From the popup menu of the project, click Deploy to generate EJB deployment code.
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 Application Server Toolkit (AST) or Rational Web Developer to a WebSphere Application Server installation on a UNIX operating system
such as Solaris.
Important
Note: Use Run On Server for unit testing only. The Application Server Toolkit (AST)
or Rational Web Developer controls the WebSphere Application Server installation and, when an application is published remotely, the assembly tool overwrites the server configuration file for that server. Do not use on production servers.
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.