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 { //Returns an instance of a work area partition for the given name, or throws an exception if the //partition name doesn't exists. public UserWorkArea getWorkAreaPartition(String partitionName) throws NoSuchPartitionException; //Returns a new instance of a work area partition (an implementation of the UserWorkArea interface) //or throws an exception if the partition name already exists. The createWorkAreaPartition should //only be used within a Java 2 platform, Enterprise Edition (J2EE) client and NOT on the //server. To create a work area partition on the server, use the WebSphere administrative //console. 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 either the remote or local interface, or both; 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 as described in Configuring work area partitions. 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 application client at any time.
This section applies to the use of the createWorkAreaPartition method on the WorkAreaPartitionManager interface. As is described above, this method should only be used on a Java 2 platform, Enterprise Edition (J2EE) client. To create a partition on the server, please see Configuring work area partitions.
java.util.Properties props = new java.util.Properties(): props.put("maxSendSize","12345");Acceptable key/values pairs (properties) for defining a partition are as follows:
For additional information about work area, see the com.ibm.websphere.workarea package in the API documentation. The generated API documentation is available in the information center table of contents from the path Reference > APIs - Application Programming Interfaces.