org.apache.synapse.transport.base
Class BaseUtils

java.lang.Object
  extended by org.apache.synapse.transport.base.BaseUtils
Direct Known Subclasses:
AMQPUtils, JMSUtils, MailUtils, VFSUtils

public abstract class BaseUtils
extends Object


Constructor Summary
BaseUtils()
           
 
Method Summary
static SOAPEnvelope getEnvelope(InputStream in, String namespace)
          Create a SOAP envelope using SOAP 1.1 or 1.2 depending on the namespace
abstract  InputStream getInputStream(Object message)
          Get an InputStream to the message payload
abstract  byte[] getMessageBinaryPayload(Object message)
          Get the message payload as a byte[], if the message is a non-SOAP, non-XML, binary message
static MessageFormatter getMessageFormatter(MessageContext msgContext)
          Get the MessageFormatter for the given message.
abstract  String getMessageTextPayload(Object message)
          Get the message payload as a String, if the message is a non-SOAP, non-XML, plain text message
static long getMinPollTime(List pollTable)
           
static OMOutputFormat getOMOutputFormat(MessageContext msgContext)
          Get the OMOutput format for the given message
abstract  String getProperty(Object message, String property)
          Get a String property from a message
static QName getQNameFromString(Object obj)
          Return a QName from the String passed in of the form {ns}element
protected static void handleException(String s)
           
protected static void handleException(String s, Exception e)
           
static boolean isUsingTransport(AxisService service, String transportName)
           
static boolean isValid(String str)
          Utility method to check if a string is not null and not empty
static void markServiceAsFaulty(String serviceName, String msg, AxisConfiguration axisCfg)
          Marks the given service as faulty with the given comment
 void setSOAPEnvelope(Object message, MessageContext msgContext, String contentType)
          Create a SOAPEnvelope from the given message and set it into the axis MessageContext passed
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BaseUtils

public BaseUtils()
Method Detail

getQNameFromString

public static QName getQNameFromString(Object obj)
Return a QName from the String passed in of the form {ns}element

Parameters:
obj - a QName or a String containing a QName in {ns}element form
Returns:
a corresponding QName object

markServiceAsFaulty

public static void markServiceAsFaulty(String serviceName,
                                       String msg,
                                       AxisConfiguration axisCfg)
Marks the given service as faulty with the given comment

Parameters:
serviceName - service name
msg - comment for being faulty
axisCfg - configuration context

getEnvelope

public static SOAPEnvelope getEnvelope(InputStream in,
                                       String namespace)
                                throws javax.xml.stream.XMLStreamException
Create a SOAP envelope using SOAP 1.1 or 1.2 depending on the namespace

Parameters:
in - InputStream for the payload
namespace - the SOAP namespace
Returns:
the SOAP envelope for the correct version
Throws:
javax.xml.stream.XMLStreamException - on error

getOMOutputFormat

public static OMOutputFormat getOMOutputFormat(MessageContext msgContext)
Get the OMOutput format for the given message

Parameters:
msgContext - the axis message context
Returns:
the OMOutput format to be used

getMessageFormatter

public static MessageFormatter getMessageFormatter(MessageContext msgContext)
Get the MessageFormatter for the given message.

Parameters:
msgContext - the axis message context
Returns:
the MessageFormatter to be used

getMinPollTime

public static long getMinPollTime(List pollTable)

setSOAPEnvelope

public void setSOAPEnvelope(Object message,
                            MessageContext msgContext,
                            String contentType)
                     throws AxisFault
Create a SOAPEnvelope from the given message and set it into the axis MessageContext passed

Parameters:
message - the message object
msgContext - the axis MessageContext
contentType -
Throws:
AxisFault - on errors encountered while setting the envelope to the message context

getProperty

public abstract String getProperty(Object message,
                                   String property)
Get a String property from a message

Parameters:
message - the message object
property - property name
Returns:
property value

getInputStream

public abstract InputStream getInputStream(Object message)
Get an InputStream to the message payload

Parameters:
message - Object
Returns:
an InputStream to the payload

getMessageTextPayload

public abstract String getMessageTextPayload(Object message)
Get the message payload as a String, if the message is a non-SOAP, non-XML, plain text message

Parameters:
message - the message Object
Returns:
the plain text payload of the message if applicable

getMessageBinaryPayload

public abstract byte[] getMessageBinaryPayload(Object message)
Get the message payload as a byte[], if the message is a non-SOAP, non-XML, binary message

Parameters:
message - the message Object
Returns:
the payload of the message as a byte[]

handleException

protected static void handleException(String s)

handleException

protected static void handleException(String s,
                                      Exception e)

isValid

public static boolean isValid(String str)
Utility method to check if a string is not null and not empty

Parameters:
str - the string to check
Returns:
true if not null and not empty

isUsingTransport

public static boolean isUsingTransport(AxisService service,
                                       String transportName)


Copyright © 2005-2008 Apache Software Foundation. All Rights Reserved.