Applications interact with the work area service by implementing the UserWorkArea
interface. This interface, shown below, defines all of the methods used to
create, manipulate, and terminate work areas:
package com.ibm.websphere.workarea;
public interface UserWorkArea {
void begin(String name);
void complete() throws NoWorkArea, NotOriginator;
String getName();
String[] retrieveAllKeys();
void set(String key, java.io.Serializable value)
throws NoWorkArea, NotOriginator, PropertyReadOnly;
void set(String key, java.io.Serializable value, PropertyModeType mode)
throws NoWorkArea, NotOriginator, PropertyReadOnly;
java.io.Serializable get(String key);
PropertyModeType getMode(String key);
void remove(String key)
throws NoWorkArea, NotOriginator, PropertyFixed;
}
Note: Enterprise JavaBeans (EJB) applications can use the UserWorkArea
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.
The work area service defines the following exceptions for use with the
UserWorkArea interface:
- NoWorkArea
- Raised when a request requires an associated work area but
none is present.
- NotOriginator
- Raised when a request attempts to manipulate the contents of an imported
work area.
- PropertyReadOnly
- Raised when a request attempts to modify a read-only or fixed read-only
property.
- PropertyFixed
- Raised by the remove method when the designated property has one of the
fixed modes.