Methods Summary |
---|
public void | addHandler(Handler handler)
if (handler == null)
throw new InternalException(
Messages.getMessage("nullHandler00",
"SimpleChain::addHandler"));
if (invoked)
throw new InternalException(
Messages.getMessage("addAfterInvoke00",
"SimpleChain::addHandler"));
handlers.add( handler );
|
public boolean | canHandleBlock(javax.xml.namespace.QName qname)
for ( int i = 0 ; i < handlers.size() ; i++ )
if ( ((Handler) handlers.elementAt( i )).canHandleBlock(qname) )
return( true );
return( false );
|
public void | cleanup()
for ( int i = 0 ; i < handlers.size() ; i++ )
((Handler) handlers.elementAt( i )).cleanup();
|
public boolean | contains(Handler handler)
return( handlers.contains( handler ));
|
private void | doVisiting(MessageContext msgContext, HandlerIterationStrategy visitor)
int i = 0 ;
try {
Enumeration enumeration = handlers.elements();
while (enumeration.hasMoreElements()) {
Handler h = (Handler)enumeration.nextElement();
visitor.visit(h, msgContext);
i++;
}
} catch( AxisFault f ) {
// Something went wrong. If we haven't already put this fault
// into the MessageContext's response message, do so and make sure
// we only do it once. This allows onFault() methods to safely
// set headers and such in the response message without them
// getting stomped.
if (!msgContext.isPropertyTrue(CAUGHTFAULT_PROPERTY)) {
// Attach the fault to the response message; enabling access to the
// fault details while inside the handler onFault methods.
Message respMsg = new Message(f);
msgContext.setResponseMessage(respMsg);
msgContext.setProperty(CAUGHTFAULT_PROPERTY, Boolean.TRUE);
}
while( --i >= 0 )
((Handler) handlers.elementAt( i )).onFault( msgContext );
throw f;
}
|
public void | generateWSDL(MessageContext msgContext)Iterate over the chain letting each handler have a crack at
contributing to a WSDL description.
if (log.isDebugEnabled()) {
log.debug("Enter: SimpleChain::generateWSDL");
}
invoked = true;
doVisiting(msgContext, wsdlVisitor);
if (log.isDebugEnabled()) {
log.debug("Exit: SimpleChain::generateWSDL");
}
|
public org.w3c.dom.Element | getDeploymentData(org.w3c.dom.Document doc)
if (log.isDebugEnabled()) {
log.debug( Messages.getMessage("enter00",
"SimpleChain::getDeploymentData") );
}
Element root = doc.createElementNS("", "chain" );
StringBuffer str = new StringBuffer();
int i = 0;
while (i < handlers.size()) {
if ( i != 0 ) str.append(",");
Handler h = (Handler) handlers.elementAt(i);
str.append( h.getName() );
i++;
}
if (i > 0) {
root.setAttribute( "flow", str.toString() );
}
if ( options != null ) {
Enumeration e = options.keys();
while ( e.hasMoreElements() ) {
String k = (String) e.nextElement();
Object v = options.get(k);
Element e1 = doc.createElementNS("", "option");
e1.setAttribute( "name", k );
e1.setAttribute( "value", v.toString() );
root.appendChild( e1 );
}
}
if (log.isDebugEnabled()) {
log.debug("Exit: SimpleChain::getDeploymentData");
}
return( root );
|
public Handler[] | getHandlers()
if (handlers.size() == 0)
return null;
Handler [] ret = new Handler[handlers.size()];
return( (Handler[]) handlers.toArray(ret) );
|
public void | init()
for ( int i = 0 ; i < handlers.size() ; i++ )
((Handler) handlers.elementAt( i )).init();
|
public void | invoke(MessageContext msgContext)Iterate over the chain invoking each handler. If there's a fault
then call 'onFault' for each completed handler in reverse order, then
rethrow the exception.
if (log.isDebugEnabled()) {
log.debug("Enter: SimpleChain::invoke");
}
invoked = true;
doVisiting(msgContext, iVisitor);
if (log.isDebugEnabled()) {
log.debug("Exit: SimpleChain::invoke");
}
|
public void | onFault(MessageContext msgContext)Notify the handlers in this chain because some handler
later on has faulted - in reverse order. If any handlers
have been added since we visited the chain, they will get
notified too!
if (log.isDebugEnabled()) {
log.debug("Enter: SimpleChain::onFault");
}
for ( int i = handlers.size()-1 ; i >= 0 ; i-- )
((Handler) handlers.elementAt( i )).onFault( msgContext );
if (log.isDebugEnabled()) {
log.debug("Exit: SimpleChain::onFault");
}
|