org.ow2.petals.binding.soap.listener.incoming
Class RequestProcessor

java.lang.Object
  extended by org.ow2.petals.binding.soap.listener.incoming.RequestProcessor
Direct Known Subclasses:
RESTProcessor, SOAPProcessor

public abstract class RequestProcessor
extends java.lang.Object

An abstract request processor. It is used by the external listener to handle incoming requests such as SOAP, REST... Created on 14 févr. 08

Since:
Author:
Christophe HAMERLING - eBM WebSourcing

Constructor Summary
RequestProcessor(org.ow2.petals.component.framework.AbstractComponent component, javax.jbi.messaging.DeliveryChannel channel, java.util.logging.Logger log)
          The constructor.
 
Method Summary
protected  void closeMessageExchange(javax.jbi.messaging.MessageExchange exchange)
           
protected  javax.jbi.messaging.MessageExchange createMessageExchange(org.ow2.petals.component.framework.jbidescriptor.generated.MEPType mep)
          Create a message exchange matching a specified mep.
protected  javax.jbi.messaging.MessageExchange createMessageExchange(org.apache.axis2.context.MessageContext inContext, javax.xml.namespace.QName operation, org.ow2.petals.component.framework.jbidescriptor.generated.MEPType mep, PetalsAxisService axisService)
          Create the JBI message exchange.
protected  javax.security.auth.Subject createSecuritySubject(org.apache.axis2.context.MessageContext messageContext)
          Create the security Subject from the MessageContext.
 javax.jbi.messaging.DeliveryChannel getChannel()
          Get the channel.
 java.util.logging.Logger getLogger()
          Get the logger.
protected abstract  java.lang.String getProcessorName()
          Get the processor name.
protected  void handleFault(javax.jbi.messaging.MessageExchange exchange, org.apache.axis2.context.MessageContext outMessage, org.apache.axiom.soap.SOAPFactory factory)
           
protected  void handleResponseAttachments(org.apache.axiom.soap.SOAPFactory soapFactory, javax.jbi.messaging.NormalizedMessage nm, org.apache.axis2.context.MessageContext outMessage)
          Put the NormalizedMessage attachments in the output Axis2 MessageContext.
protected  boolean isSecuredService(PetalsAxisService service)
          Check is the service is secured ie rampart module has been engaged by the service unit.
protected abstract  org.apache.axis2.context.MessageContext process(org.apache.axis2.context.MessageContext inContext, org.apache.axiom.soap.SOAPFactory soapfactory)
          Process the request.
protected  org.apache.axis2.context.MessageContext processJBIResponse(javax.jbi.messaging.MessageExchange exchange, org.apache.axis2.context.MessageContext inMessage, org.apache.axiom.soap.SOAPFactory factory)
          Process the JBI response.
protected  javax.xml.namespace.QName retrieveOperationFromSOAPBody(org.apache.axis2.context.MessageContext message)
          Get the operation from the message context.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RequestProcessor

public RequestProcessor(org.ow2.petals.component.framework.AbstractComponent component,
                        javax.jbi.messaging.DeliveryChannel channel,
                        java.util.logging.Logger log)
The constructor.

Parameters:
component - the component
channel - the channel
log - the logger
Method Detail

closeMessageExchange

protected final void closeMessageExchange(javax.jbi.messaging.MessageExchange exchange)
                                   throws org.apache.axis2.AxisFault
Throws:
org.apache.axis2.AxisFault

createMessageExchange

protected final javax.jbi.messaging.MessageExchange createMessageExchange(org.ow2.petals.component.framework.jbidescriptor.generated.MEPType mep)
                                                                   throws javax.jbi.messaging.MessagingException
Create a message exchange matching a specified mep. If the MEP is not defined, it will be IN_OPTIONAL_OUT.

Parameters:
mep - the mep
Returns:
a message exchange matching the specified pattern
Throws:
javax.jbi.messaging.MessagingException - if the message exchange can't be created

createMessageExchange

protected final javax.jbi.messaging.MessageExchange createMessageExchange(org.apache.axis2.context.MessageContext inContext,
                                                                          javax.xml.namespace.QName operation,
                                                                          org.ow2.petals.component.framework.jbidescriptor.generated.MEPType mep,
                                                                          PetalsAxisService axisService)
                                                                   throws org.apache.axis2.AxisFault,
                                                                          javax.jbi.messaging.MessagingException
Create the JBI message exchange.

Parameters:
inContext - the SOAP message
operation - the operation
mep - the mep
axisService - the axis service into petals
Returns:
the message exchange
Throws:
org.apache.axis2.AxisFault - the axis fault
javax.jbi.messaging.MessagingException

createSecuritySubject

protected final javax.security.auth.Subject createSecuritySubject(org.apache.axis2.context.MessageContext messageContext)
Create the security Subject from the MessageContext.
TODO : Check if there are security features in REST too.

Parameters:
messageContext - the message context
Returns:
the security subject created from the message context if we have found Principal in the message context else return null;

getChannel

public final javax.jbi.messaging.DeliveryChannel getChannel()
Get the channel.

Returns:
the channel

getLogger

public final java.util.logging.Logger getLogger()
Get the logger.

Returns:
the logger

getProcessorName

protected abstract java.lang.String getProcessorName()
Get the processor name. This name MUST be unique ie two processors can not have the same name !

Returns:
the processor name

handleFault

protected final void handleFault(javax.jbi.messaging.MessageExchange exchange,
                                 org.apache.axis2.context.MessageContext outMessage,
                                 org.apache.axiom.soap.SOAPFactory factory)
                          throws org.apache.axis2.AxisFault
Throws:
org.apache.axis2.AxisFault

handleResponseAttachments

protected final void handleResponseAttachments(org.apache.axiom.soap.SOAPFactory soapFactory,
                                               javax.jbi.messaging.NormalizedMessage nm,
                                               org.apache.axis2.context.MessageContext outMessage)
                                        throws java.io.UnsupportedEncodingException
Put the NormalizedMessage attachments in the output Axis2 MessageContext.

Parameters:
soapFactory - the SOAP factory
nm - the normalized message
outMessage - the SOAP message
Throws:
java.io.UnsupportedEncodingException - the unsupported encoding exception

isSecuredService

protected final boolean isSecuredService(PetalsAxisService service)
Check is the service is secured ie rampart module has been engaged by the service unit.

Parameters:
service - the axis service into petals
Returns:
true if it's securised, false else

process

protected abstract org.apache.axis2.context.MessageContext process(org.apache.axis2.context.MessageContext inContext,
                                                                   org.apache.axiom.soap.SOAPFactory soapfactory)
                                                            throws org.apache.axis2.AxisFault,
                                                                   java.io.UnsupportedEncodingException
Process the request.

Parameters:
inContext - the SOAP context
soapfactory - the SOAP factory
Returns:
the out message context
Throws:
org.apache.axis2.AxisFault - the axis fault
java.io.UnsupportedEncodingException - the unsupported encoding exception

processJBIResponse

protected org.apache.axis2.context.MessageContext processJBIResponse(javax.jbi.messaging.MessageExchange exchange,
                                                                     org.apache.axis2.context.MessageContext inMessage,
                                                                     org.apache.axiom.soap.SOAPFactory factory)
                                                              throws org.apache.axis2.AxisFault,
                                                                     java.io.UnsupportedEncodingException
Process the JBI response.
According to the response status :

Parameters:
exchange - JBI response
inMessage - the SOAP message
factory - soap factory used to create body response
Returns:
a FAULT or OUT JBI response or null if no response
Throws:
org.apache.axis2.AxisFault - with ERROR JBI status, or problem while creating response
java.io.UnsupportedEncodingException - the unsupported encoding exception

retrieveOperationFromSOAPBody

protected final javax.xml.namespace.QName retrieveOperationFromSOAPBody(org.apache.axis2.context.MessageContext message)
Get the operation from the message context. Assume that the operation is always the root element of the SOAP body.

Parameters:
message - the SOAP message
Returns:
null if the operation has not been found


Copyright © 2005-2012 Petals Link (EBM Websourcing). All Rights Reserved.