it.imolinfo.jbi4corba.webservice.runtime
Class ConsumerInvocationHandler

java.lang.Object
  extended by it.imolinfo.jbi4corba.webservice.runtime.ConsumerInvocationHandler
All Implemented Interfaces:
InvocationHandler

public class ConsumerInvocationHandler
extends Object
implements InvocationHandler

This class is used at runtime to create the MessageExchange and sending the message on the bus.


Field Summary
static URI IN_ONLY
          A kind of MEP.
static URI IN_OUT
          A kind of MEP.
static URI ROBUST_IN_ONLY
          A kind of MEP.
 
Constructor Summary
ConsumerInvocationHandler(ConsumerServiceDescriptor sd)
          Constructor.
 
Method Summary
protected  javax.jbi.messaging.InOnly createInOnlyExchange()
          Creates the InOnly exchange.
protected  javax.jbi.messaging.InOut createInOutExchange()
          Creates the InOut Exchange.
protected  Object exchangeInOnly(org.apache.cxf.message.Exchange cxfExchange, QName operation, OutputStream xmlResult)
          This method implements the 'InOnly' Message Exchange MEP.
protected  Object exchangeInOut(org.apache.cxf.message.Exchange cxfExchange, QName operation, Method method, OutputStream xmlResult)
          This method implements the 'InOut' Message Exchange MEP.
protected  Object exchangeStatusACTIVE(javax.jbi.messaging.InOut jbiExchange, Method method)
          Exchange status active.
 Object invoke(Object proxy, Method method, Object[] args)
           
protected  boolean isAsynch(QName portType, QName operation)
          This method is used to discover an asynchronous operation.
 void process(javax.jbi.messaging.MessageExchange exchange)
          This method is called by the ESB after the message is sent.
protected  void processInOnly(javax.jbi.messaging.MessageExchange exchange)
          This method is called during the ExchanProcessor when the MEP is InOnly.
protected  void processInOut(javax.jbi.messaging.MessageExchange exchange)
          This method is called during the ExchanProcessor when the MEP is InOut.
protected  void sendASynch(javax.jbi.messaging.InOnly jbiExchange)
          This method is used to send asynchronously a MessageExchange.
protected  boolean sendSynch(javax.jbi.messaging.InOut jbiExchange)
          This method is used to send synchronously a MessageExchange.
protected  void setJbiExchangeToDONE(javax.jbi.messaging.MessageExchange jbiExchange)
          This method is used to set the status of the JbiExchange to DONE.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

IN_ONLY

public static final URI IN_ONLY
A kind of MEP.


IN_OUT

public static final URI IN_OUT
A kind of MEP.


ROBUST_IN_ONLY

public static final URI ROBUST_IN_ONLY
A kind of MEP.

Constructor Detail

ConsumerInvocationHandler

public ConsumerInvocationHandler(ConsumerServiceDescriptor sd)
                          throws ServiceCreationException
Constructor.

Parameters:
sd - The service descriptor used inside the class.
Throws:
ServiceCreationException - The service creation exception
Method Detail

invoke

public Object invoke(Object proxy,
                     Method method,
                     Object[] args)
              throws Throwable
Specified by:
invoke in interface InvocationHandler
Parameters:
proxy - The proxy
method - The method
args - The args
Returns:
The return
Throws:
Throwable - This method should be raise only 2 kind of exception: - Jbi4CorbaRuntimeException; - Jbi4CorbaException. The last one is used to wrap a soap fault and the first one to wrap all the other errors. To avoid classpath problems, the runtime exception set the message exception with the original message exception but doesn't include the original exception itself.

exchangeInOnly

protected Object exchangeInOnly(org.apache.cxf.message.Exchange cxfExchange,
                                QName operation,
                                OutputStream xmlResult)
                         throws Jbi4CorbaRuntimeException
This method implements the 'InOnly' Message Exchange MEP.

Parameters:
executionContext -
op -
nodeResult -
Returns:
The result of the exchange.
Throws:
it.imolinfo.jbi4corba.jbi.processor.wsdl11wrapper.WrapperProcessingException
TransformerException
javax.jbi.messaging.MessagingException
ParserConfigurationException
IOException
SAXException
Jbi4CorbaRuntimeException

exchangeInOut

protected Object exchangeInOut(org.apache.cxf.message.Exchange cxfExchange,
                               QName operation,
                               Method method,
                               OutputStream xmlResult)
                        throws Jbi4CorbaRuntimeException
This method implements the 'InOut' Message Exchange MEP.

Parameters:
executionContext -
op -
nodeResult -
Returns:
The result of the exchange.
Throws:
it.imolinfo.jbi4corba.jbi.processor.wsdl11wrapper.WrapperProcessingException
TransformerException
javax.jbi.messaging.MessagingException
ParserConfigurationException
IOException
SAXException
Jbi4CorbaRuntimeException

setJbiExchangeToDONE

protected void setJbiExchangeToDONE(javax.jbi.messaging.MessageExchange jbiExchange)
                             throws Jbi4CorbaRuntimeException
This method is used to set the status of the JbiExchange to DONE.

Parameters:
jbiExchange - The ME.
Throws:
Jbi4CorbaRuntimeException - If is impossible set up the status.

exchangeStatusACTIVE

protected Object exchangeStatusACTIVE(javax.jbi.messaging.InOut jbiExchange,
                                      Method method)
                               throws javax.jbi.messaging.MessagingException,
                                      TransformerException,
                                      ParserConfigurationException,
                                      IOException,
                                      SAXException,
                                      com.sun.jbi.nms.wsdl11wrapper.WrapperProcessingException
Exchange status active. Converts the XML to the object to be sent back.

Parameters:
jbiExchange -
Returns:
the object (or a Throwable if error)
Throws:
javax.jbi.messaging.MessagingException
TransformerException
ParserConfigurationException
IOException
SAXException
com.sun.jbi.nms.wsdl11wrapper.WrapperProcessingException

sendASynch

protected void sendASynch(javax.jbi.messaging.InOnly jbiExchange)
                   throws javax.jbi.messaging.MessagingException
This method is used to send asynchronously a MessageExchange.

Parameters:
jbiExchange - The message to send.
Throws:
javax.jbi.messaging.MessagingException

sendSynch

protected boolean sendSynch(javax.jbi.messaging.InOut jbiExchange)
                     throws javax.jbi.messaging.MessagingException
This method is used to send synchronously a MessageExchange.

Parameters:
jbiExchange - The message to send.
Returns:
true for 'done'; false for 'error'.
Throws:
javax.jbi.messaging.MessagingException

isAsynch

protected boolean isAsynch(QName portType,
                           QName operation)
This method is used to discover an asynchronous operation.

Parameters:
portType - The QName of the PortType.
operationName - The name of the operation controlled.
Returns:
true, when the operation is asynchronous. false, when the operation is synchronous or when an error occurs.

createInOutExchange

protected javax.jbi.messaging.InOut createInOutExchange()
Creates the InOut Exchange.

Returns:
The return

createInOnlyExchange

protected javax.jbi.messaging.InOnly createInOnlyExchange()
Creates the InOnly exchange.

Returns:

process

public void process(javax.jbi.messaging.MessageExchange exchange)
             throws Exception
This method is called by the ESB after the message is sent.

Parameters:
exchange - The message exchange
Throws:
Exception - The exception
See Also:
ConsumerExchangeProcessor.

processInOnly

protected void processInOnly(javax.jbi.messaging.MessageExchange exchange)
                      throws Jbi4CorbaException
This method is called during the ExchanProcessor when the MEP is InOnly.

Parameters:
exchange - The MessageExchange.
Throws:
Jbi4CorbaException - If the ExchangeStatus is 'Active'.

processInOut

protected void processInOut(javax.jbi.messaging.MessageExchange exchange)
                     throws Jbi4CorbaException
This method is called during the ExchanProcessor when the MEP is InOut.

Parameters:
exchange - The MessageExchange.
Throws:
Jbi4CorbaException - Always, because this MEP shoud not call the process.


Copyright © 2005-2010 Imola Informatica. All Rights Reserved.