org.jboss.webservice.handler
Class HandlerChainBaseImpl

java.lang.Object
  extended byorg.jboss.webservice.handler.HandlerChainBaseImpl
All Implemented Interfaces:
java.util.Collection, HandlerChain (src) , java.util.List
Direct Known Subclasses:
ClientHandlerChain (src) , ServerHandlerChain (src)

public abstract class HandlerChainBaseImpl
extends java.lang.Object
implements HandlerChain (src)

Represents a list of handlers. All elements in the HandlerChain are of the type javax.xml.rpc.handler.Handler.

Abstracts the policy and mechanism for the invocation of the registered handlers.

Since:
06-May-2004

Field Summary
protected  int falseIndex
           
protected  java.util.ArrayList handlers
           
protected  java.util.HashSet roles
           
protected  int state
           
static int STATE_CREATED
           
static int STATE_DESTROYED
           
static int STATE_DOES_NOT_EXIST
           
static int STATE_READY
           
 
Constructor Summary
HandlerChainBaseImpl(java.util.List infos, java.util.Set roles)
          Constructs a handler chain with the given handlers infos
 
Method Summary
 void add(int index, java.lang.Object element)
           
 boolean add(java.lang.Object o)
           
 boolean addAll(java.util.Collection c)
           
 boolean addAll(int index, java.util.Collection c)
           
protected  void checkMustUnderstand(MessageContext (src)  msgContext)
          Check if there are mustUnderstand headers that were not processed
 void clear()
           
 boolean contains(java.lang.Object elem)
           
 boolean containsAll(java.util.Collection c)
           
 void destroy()
          Indicates the end of lifecycle for a HandlerChain.
 boolean equals(java.lang.Object o)
           
 java.lang.Object get(int index)
           
protected  Handler (src) getHandlerAt(int pos)
          Get the handler at the requested position
 java.lang.String[] getRoles()
          Gets SOAP actor roles registered for this HandlerChain at this SOAP node.
 int getState()
          Get the state of this handler chain
 boolean handleFault(MessageContext (src)  msgContext)
          Initiates the SOAP fault processing for this handler chain.
 boolean handleRequest(MessageContext (src)  msgContext)
          Initiates the request processing for this handler chain.
 boolean handleResponse(MessageContext (src)  msgContext)
          Initiates the response processing for this handler chain.
 int hashCode()
           
 int indexOf(java.lang.Object elem)
           
 void init(java.util.Map config)
          Initializes the configuration for a HandlerChain.
 boolean isEmpty()
           
 java.util.Iterator iterator()
           
 int lastIndexOf(java.lang.Object elem)
           
 java.util.ListIterator listIterator()
           
 java.util.ListIterator listIterator(int index)
           
 java.lang.Object remove(int index)
           
 boolean remove(java.lang.Object o)
           
 boolean removeAll(java.util.Collection c)
           
protected  void replaceDirtyHandlers()
          Replace handlers that did not survive the previous call
 boolean retainAll(java.util.Collection c)
           
 java.lang.Object set(int index, java.lang.Object element)
           
 void setRoles(java.lang.String[] soapActorNames)
          Sets SOAP Actor roles for this HandlerChain.
 int size()
           
 java.util.List subList(int fromIndex, int toIndex)
           
 java.lang.Object[] toArray()
           
 java.lang.Object[] toArray(java.lang.Object[] a)
           
protected  java.lang.String traceSOAPPart(SOAPPart (src)  soapPart, java.lang.String lastMessageTrace)
          Trace the SOAPPart, do nothing if the String representation is equal to the last one.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STATE_DOES_NOT_EXIST

public static final int STATE_DOES_NOT_EXIST
See Also:
Constant Field Values (src)

STATE_CREATED

public static final int STATE_CREATED
See Also:
Constant Field Values (src)

STATE_READY

public static final int STATE_READY
See Also:
Constant Field Values (src)

STATE_DESTROYED

public static final int STATE_DESTROYED
See Also:
Constant Field Values (src)

handlers

protected java.util.ArrayList handlers

roles

protected java.util.HashSet roles

falseIndex

protected int falseIndex

state

protected int state
Constructor Detail

HandlerChainBaseImpl

public HandlerChainBaseImpl(java.util.List infos,
                            java.util.Set roles)
Constructs a handler chain with the given handlers infos

Method Detail

getState

public int getState()
Get the state of this handler chain


init

public void init(java.util.Map config)
Initializes the configuration for a HandlerChain.

Specified by:
init in interface HandlerChain (src)
Parameters:
config - Configuration for the initialization of this handler chain
Throws:
JAXRPCException (src) - If any error during initialization

destroy

public void destroy()
Indicates the end of lifecycle for a HandlerChain.

Specified by:
destroy in interface HandlerChain (src)
Throws:
JAXRPCException (src) - If any error during destroy

getRoles

public java.lang.String[] getRoles()
Gets SOAP actor roles registered for this HandlerChain at this SOAP node. The returned array includes the special SOAP actor next.

Specified by:
getRoles in interface HandlerChain (src)
Returns:
SOAP Actor roles as URIs

setRoles

public void setRoles(java.lang.String[] soapActorNames)
Sets SOAP Actor roles for this HandlerChain. This specifies the set of roles in which this HandlerChain is to act for the SOAP message processing at this SOAP node. These roles assumed by a HandlerChain must be invariant during the processing of an individual SOAP message through the HandlerChain.

A HandlerChain always acts in the role of the special SOAP actor next. Refer to the SOAP specification for the URI name for this special SOAP actor. There is no need to set this special role using this method.

Specified by:
setRoles in interface HandlerChain (src)
Parameters:
soapActorNames - URIs for SOAP actor name

handleRequest

public boolean handleRequest(MessageContext (src)  msgContext)
Initiates the request processing for this handler chain.

Specified by:
handleRequest in interface HandlerChain (src)
Parameters:
msgContext - MessageContext parameter provides access to the request SOAP message.
Returns:
Returns true if all handlers in chain have been processed. Returns false if a handler in the chain returned false from its handleRequest method.
Throws:
JAXRPCException (src) - if any processing error happens

handleResponse

public boolean handleResponse(MessageContext (src)  msgContext)
Initiates the response processing for this handler chain.

In this implementation, the response handler chain starts processing from the same Handler instance (that returned false) and goes backward in the execution sequence.

Specified by:
handleResponse in interface HandlerChain (src)
Returns:
Returns true if all handlers in chain have been processed. Returns false if a handler in the chain returned false from its handleResponse method.
Throws:
JAXRPCException (src) - if any processing error happens

handleFault

public boolean handleFault(MessageContext (src)  msgContext)
Initiates the SOAP fault processing for this handler chain.

In this implementation, the fault handler chain starts processing from the same Handler instance (that returned false) and goes backward in the execution sequence.

Specified by:
handleFault in interface HandlerChain (src)
Returns:
Returns true if all handlers in chain have been processed. Returns false if a handler in the chain returned false from its handleFault method.
Throws:
JAXRPCException (src) - if any processing error happens

traceSOAPPart

protected java.lang.String traceSOAPPart(SOAPPart (src)  soapPart,
                                         java.lang.String lastMessageTrace)
Trace the SOAPPart, do nothing if the String representation is equal to the last one.


replaceDirtyHandlers

protected void replaceDirtyHandlers()
Replace handlers that did not survive the previous call


getHandlerAt

protected Handler (src)  getHandlerAt(int pos)
Get the handler at the requested position


checkMustUnderstand

protected void checkMustUnderstand(MessageContext (src)  msgContext)
Check if there are mustUnderstand headers that were not processed


remove

public boolean remove(java.lang.Object o)
Specified by:
remove in interface java.util.List

containsAll

public boolean containsAll(java.util.Collection c)
Specified by:
containsAll in interface java.util.List

removeAll

public boolean removeAll(java.util.Collection c)
Specified by:
removeAll in interface java.util.List

retainAll

public boolean retainAll(java.util.Collection c)
Specified by:
retainAll in interface java.util.List

hashCode

public int hashCode()
Specified by:
hashCode in interface java.util.List

equals

public boolean equals(java.lang.Object o)
Specified by:
equals in interface java.util.List

iterator

public java.util.Iterator iterator()
Specified by:
iterator in interface java.util.List

subList

public java.util.List subList(int fromIndex,
                              int toIndex)
Specified by:
subList in interface java.util.List

listIterator

public java.util.ListIterator listIterator()
Specified by:
listIterator in interface java.util.List

listIterator

public java.util.ListIterator listIterator(int index)
Specified by:
listIterator in interface java.util.List

size

public int size()
Specified by:
size in interface java.util.List

clear

public void clear()
Specified by:
clear in interface java.util.List

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface java.util.List

toArray

public java.lang.Object[] toArray()
Specified by:
toArray in interface java.util.List

get

public java.lang.Object get(int index)
Specified by:
get in interface java.util.List

remove

public java.lang.Object remove(int index)
Specified by:
remove in interface java.util.List

add

public void add(int index,
                java.lang.Object element)
Specified by:
add in interface java.util.List

indexOf

public int indexOf(java.lang.Object elem)
Specified by:
indexOf in interface java.util.List

lastIndexOf

public int lastIndexOf(java.lang.Object elem)
Specified by:
lastIndexOf in interface java.util.List

add

public boolean add(java.lang.Object o)
Specified by:
add in interface java.util.List

contains

public boolean contains(java.lang.Object elem)
Specified by:
contains in interface java.util.List

addAll

public boolean addAll(int index,
                      java.util.Collection c)
Specified by:
addAll in interface java.util.List

addAll

public boolean addAll(java.util.Collection c)
Specified by:
addAll in interface java.util.List

set

public java.lang.Object set(int index,
                            java.lang.Object element)
Specified by:
set in interface java.util.List

toArray

public java.lang.Object[] toArray(java.lang.Object[] a)
Specified by:
toArray in interface java.util.List