com.sun.xml.ws.api.pipe.helper
Class PipeAdapter

java.lang.Object
  extended by com.sun.xml.ws.api.pipe.helper.AbstractTubeImpl
      extended by com.sun.xml.ws.api.pipe.helper.PipeAdapter
All Implemented Interfaces:
Pipe, Tube

public class PipeAdapter
extends AbstractTubeImpl

Tube that invokes Pipe.

This can be used to make a Pipe look like a Tube.


Method Summary
static Tube adapt(Pipe p)
           
static Pipe adapt(Tube p)
           
 PipeAdapter copy(TubeCloner cloner)
          Creates an identical clone of this Tube.
 void preDestroy()
          Invoked before the last copy of the pipeline is about to be discarded, to give Pipes a chance to clean up any resources.
 NextAction processException(Throwable t)
          Acts on a exception and performs some clean up operations.
 NextAction processRequest(Packet p)
          Uses the current fiber and runs the whole pipe to the completion (meaning everything from now on will run synchronously.)
 NextAction processResponse(Packet p)
          Acts on a response and performs some protocol specific operation.
 String toString()
           
 
Methods inherited from class com.sun.xml.ws.api.pipe.helper.AbstractTubeImpl
copy, doInvoke, doInvokeAndForget, doReturnWith, doSuspend, doThrow, process
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

adapt

public static Tube adapt(Pipe p)

adapt

public static Pipe adapt(Tube p)

processRequest

@NotNull
public NextAction processRequest(@NotNull
                                         Packet p)
Uses the current fiber and runs the whole pipe to the completion (meaning everything from now on will run synchronously.)

Parameters:
p - The packet that represents a request message. If the packet has a non-null message, it must be a valid unconsumed Message. This message represents the SOAP message to be sent as a request.

The packet is also allowed to carry no message, which indicates that this is an output-only request. (that's called "solicit", right? - KK)

Returns:
A NextAction object that represents the next action to be taken by the JAX-WS runtime.

processResponse

@NotNull
public NextAction processResponse(@NotNull
                                          Packet p)
Description copied from interface: Tube
Acts on a response and performs some protocol specific operation.

Once a Tube.processRequest(Packet) is invoked, this method will be always invoked with the response, before this Tube processes another request.

Parameters:
p - If the packet has a non-null message, it must be a valid unconsumed Message. This message represents a response to the request message passed to Tube.processRequest(Packet) earlier.

The packet is also allowed to carry no message, which indicates that there was no response. This is used for things like one-way message and/or one-way transports. TODO: exception handling semantics need more discussion

Returns:
A NextAction object that represents the next action to be taken by the JAX-WS runtime.

processException

@NotNull
public NextAction processException(@NotNull
                                           Throwable t)
Description copied from interface: Tube
Acts on a exception and performs some clean up operations.

If a Tube.processRequest(Packet), Tube.processResponse(Packet), Tube.processException(Throwable) throws an exception, this method will be always invoked on all the Tubes in the remaining NextActions.

On the server side, the Throwable thrown will be propagated to the top-most transport. The transport converts the exception to fault reply or simply logs in case of one-way MEP. If you are a filtering Tube like AbstractTubeImpl, you don't have to override the implementation). On the other hand, any intermediate Tube may want to convert the exception to a fault message.

On the client side, the Throwable thrown will be propagated all the way back to the calling client applications. (The consequence of that is that if you are a filtering Tube like AbstractTubeImpl, you don't have to override the implementation)

Returns:
A NextAction object that represents the next action to be taken by the JAX-WS runtime.

preDestroy

public void preDestroy()
Description copied from interface: Pipe
Invoked before the last copy of the pipeline is about to be discarded, to give Pipes a chance to clean up any resources.

This can be used to invoke PreDestroy lifecycle methods on user handler. The invocation of it is optional on the client side, but mandatory on the server side.

When multiple copies of pipelines are created, this method is called only on one of them.


copy

public PipeAdapter copy(TubeCloner cloner)
Description copied from interface: Tube
Creates an identical clone of this Tube.

This method creates an identical pipeline that can be used concurrently with this pipeline. When the caller of a pipeline is multi-threaded and need concurrent use of the same pipeline, it can do so by creating copies through this method.

Implementation Note

It is the implementation's responsibility to call TubeCloner.add(Tube,Tube) to register the copied pipe with the original. This is required before you start copying the other Tube references you have, or else there's a risk of infinite recursion.

For most Tube implementations that delegate to another Tube, this method requires that you also copy the Tube that you delegate to.

For limited number of Tubes that do not maintain any thread unsafe resource, it is allowed to simply return this from this method (notice that even if you are stateless, if you got a delegating Tube and that one isn't stateless, you still have to copy yourself.)

Note that this method might be invoked by one thread while another thread is executing the other process method. See the Codec.copy() for more discussion about this.

Specified by:
copy in interface Tube
Specified by:
copy in class AbstractTubeImpl
Parameters:
cloner - Use this object (in particular its TubeCloner.copy(Tube) method to clone other pipe references you have in your pipe. See TubeCloner for more discussion about why.
Returns:
always non-null Tube.

toString

public String toString()
Overrides:
toString in class Object