The Work area partition manager interface
Applications interact with the work area partition service by using the work area partition manager interface. A user can retrieve an instance of the work area partition manager interface out of naming and use the methods that are defined in the following section. An implementation of the work area partition manager interface is bound in Java naming at java:comp/websphere/WorkAreaPartitionManager. This interface is responsible for creating, retrieving, and manipulating work area partitions:
package com.ibm.websphere.workarea; import com.ibm.websphere.workarea.UserWorkArea; import com.ibm.websphere.workarea.PartitionAlreadyExistsException; import com.ibm.websphere.workarea.NoSuchPartitionException; import java.util.Properties; public interface WorkAreaPartitionManager { public UserWorkArea getWorkAreaPartition(String partitionName) throws NoSuchPartitionException; public UserWorkArea createWorkAreaPartition(String partitionName, Properties props) throws PartitionAlreadyExistsException, java.lang.IllegalAccessException; }EJB applications can use the work area partition manager interface only within the implementation of methods in the remote interface; likewise, servlets can use the interface only within the service method of the HTTPServlet class. Use of work areas within any life cycle method of a servlet or enterprise bean is considered a deviation from the work area programming model and is not supported.
Programmatically creating a work area partition through the createWorkAreaPartition method is only available on the Java 2 platform, Enterprise Edition (J2EE) client. To create a work area partition on the server, use the WebSphere administrative console. All partitions in a server process must be created before server startup is complete so that the work area service can register with the appropriate container collaborators. Therefore, calling the createWorkAreaPartition method in a server process after the server starts results in a java.lang.IllegalAccessException exception. The createWorkAreaPartition method can be called in a J2EE process at any time.
Exceptions
The work area partition service defines the following exceptions for use with the work area partition manager interface:
- PartitionAlreadyExistsException
- This exception is raised by the createWorkAreaPartition method on the WorkAreaPartitionManager implementation if a user tries to create a work area partition with a partition name that already exists. Partition names must be unique.
- NoSuchPartitionException
- This exception is raised by the getWorkAreaPartition method on the WorkAreaPartitionManager implementation if a user requests a work area partition with a partition name that does not exist.
- java.lang.IllegalAccessException
- This exception is raised by the createWorkAreaPartition method on the WorkAreaPartitionManager implementation if a user tries to create a work area partition during run time on a server process. This method can only be used on a J2EE client process. In the server process, a partition must be created using the administrative console.
See Also
Work area partition service
Related Tasks
Configuring work area partitions on the server
See Also
Example: Work area partition manager