Chapter 12. Additional Functions

Table of Contents

12.1. WorkArea Service
12.1.1. UserWorkArea Interface
12.1.2. PropertyModeType
12.1.3. Exceptions
12.1.4. Nested UserWorkArea
12.1.5. Development of Application Programs that Use UserWorkArea

This chapter describes additional functions that are used to implement EJB in JEUS.

The Work Area service enables a program to continuously propagate a particular implicit context. Like with a security context or transaction context, even if the implicit context is not propagated as a separate argument, it will automatically be transmitted during a local or remote method invocation. Work Area can be used when it is needed to transmit a context or there are multiple method arguments.

As a kind of user repository, Work Area is stored as a map in the form of a name-value pair. When Work Area is newly started, it gets transmitted with the current thread, and so it can continuously be used inside the same component as that of the invoked method or EJB. It also gets propagated during a remote EJB invocation.

The UserWorkArea interface, jeus.workarea.UserWorkArea, is used to access the Work Area service.

Note

For detailed information on the API, refer to the jeus.workarea package in JEUS API JavaDoc.

Currently, the remote Work Area propagation function is available only when using EJB 3.0 business interface. It is unavailable when using the EJBObject remote component interface, or IIOP invocation instead of JEUS basic RMI invocation.

This section shows an example of EJBs using the UserWorkArea interface.

The example consists of two EJBs, the UserWorkAreaSampleSender and UserWorkAreaSampleReceiver. In the example, the sender creates the UserWorkArea and transmits data, and the receiver creates a message using the specified value in UserWorkArea and returns the message to the original sender.

  1. UserWorkArea Access

    To use the UserWorkArea, JNDI has to look up the UserWorkArea.

    The following example shows how JNDI looks up the UserWorkArea.


  2. Starting a New UserWorkArea

    A new UserWorkArea needs to be started, because there was no information available for the first UserWorkArea that was looked up in JNDI. If a UserWorkArea name returned is null, NullPointerException occurs.


  3. Configuring Registration in WorkArea

    Configuring registration information in the new UserWorkArea. The registration information includes <key, value, mode>. The key is String, and the value is a serializable object.

    If there is no UserWorkArea when configuring the value, a NoWorkAreaException occurs. If the UserWorkArea has not started yet, a NotOriginatorException occurs, and if a value which is already set to READ_ONLY is tried to be modified, a PropertyReadOnlyException occurs.


  4. Obtaining Registration Information Configured in WorkArea

    Creates a message by using the registration information configured in UserWorkArea that was propagated from the receiver. Null is returned if a key, which does not exist in the UserWorkArea, is used when getting the information.


  5. Completing UserWorkArea

    Completes the UserWorkArea that was started. Only the originator who started the UserWorkArea can complete it, and if others attempt to complete it, a NotOriginatorException occurs.