org.apache.synapse.config
Class SynapseConfigUtils

java.lang.Object
  extended by org.apache.synapse.config.SynapseConfigUtils

public class SynapseConfigUtils
extends Object


Constructor Summary
SynapseConfigUtils()
           
 
Method Summary
static int getConnectTimeout()
           
static long getGlobalTimeoutInterval()
           
static InputSource getInputSourceFormURI(URI uri)
           
static InputStream getInputStream(Object o)
           
static Object getObject(URL url, Properties properties)
          Get an object from a given URL.
static OMNode getOMElementFromURL(String urlStr, String synapseHome)
          Return an OMElement from a URL source
static int getReadTimeout()
           
static StatisticsCollector getStatisticsCollector(ServerContextInformation contextInfo)
          Get the StatisticsCollector from synapse env.
static StreamSource getStreamSource(Object o)
          Return a StreamSource for the given Object
static SynapseEnvironment getSynapseEnvironment(AxisConfiguration axisCfg)
           
static long getTimeoutHandlerInterval()
           
static URLConnection getURLConnection(URL url)
          Returns a URLCOnnection for given URL.
static URL getURLFromPath(String path, String synapseHome)
          Utility method to resolve url(only If need) path using synapse home system property
static XMLToObjectMapper getXmlToObjectMapper(String contentType)
          Return a suitable XMLToObjectMapper for the given content type if one is available, else return null;
static boolean isFailSafeEnabled(String componentName)
           
static SynapseConfiguration newConfiguration()
          Construct a fresh SynapseConfiguration instance and registers the observers with it as specified in the synapse.properties file.
static OMNode readNonXML(URL url)
          Helper method to handle non-XMl resources
static String resolveRelativeURI(String parentLocation, String relativeLocation)
           
static void setDefaultFaultSequence(SynapseConfiguration config)
          Return the fault sequence if one is not defined.
static void setDefaultMainSequence(SynapseConfiguration config)
          Return the main sequence if one is not defined.
static OMElement stringToOM(String xml)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SynapseConfigUtils

public SynapseConfigUtils()
Method Detail

getStreamSource

public static StreamSource getStreamSource(Object o)
Return a StreamSource for the given Object

Parameters:
o - the object
Returns:
the StreamSource

getInputStream

public static InputStream getInputStream(Object o)

getObject

public static Object getObject(URL url,
                               Properties properties)
Get an object from a given URL. Will first fetch the content from the URL and depending on the content-type, a suitable XMLToObjectMapper (if available) would be used to transform this content into an Object. If a suitable XMLToObjectMapper cannot be found, the content would be treated as XML and an OMNode would be returned

Parameters:
url - the URL to the resource
properties - bag of properties to pass in any information to the factory
Returns:
an Object created from the given URL

readNonXML

public static OMNode readNonXML(URL url)
Helper method to handle non-XMl resources

Parameters:
url - The resource url
Returns:
The content as an OMNode

getOMElementFromURL

public static OMNode getOMElementFromURL(String urlStr,
                                         String synapseHome)
                                  throws IOException
Return an OMElement from a URL source

Parameters:
urlStr - a URL string
synapseHome - synapse home parameter to be used
Returns:
an OMElement of the resource
Throws:
IOException - for invalid URL's or IO errors

getInputSourceFormURI

public static InputSource getInputSourceFormURI(URI uri)

getURLConnection

public static URLConnection getURLConnection(URL url)
Returns a URLCOnnection for given URL. If the URL is https one , then URLConnectin is a HttpsURLCOnnection and it is configured with KeyStores given in the synapse.properties file

Parameters:
url - URL
Returns:
URLConnection for given URL

getXmlToObjectMapper

public static XMLToObjectMapper getXmlToObjectMapper(String contentType)
Return a suitable XMLToObjectMapper for the given content type if one is available, else return null;

Parameters:
contentType - the content type for which a mapper is required
Returns:
a suitable XMLToObjectMapper or null if none can be found

getURLFromPath

public static URL getURLFromPath(String path,
                                 String synapseHome)
Utility method to resolve url(only If need) path using synapse home system property

Parameters:
path - Path to the URL
synapseHome - synapse home parameter value to be used
Returns:
Valid URL instance or null(if it is invalid or can not open a connection to it )

resolveRelativeURI

public static String resolveRelativeURI(String parentLocation,
                                        String relativeLocation)

getConnectTimeout

public static int getConnectTimeout()

getReadTimeout

public static int getReadTimeout()

getTimeoutHandlerInterval

public static long getTimeoutHandlerInterval()

getGlobalTimeoutInterval

public static long getGlobalTimeoutInterval()

getSynapseEnvironment

public static SynapseEnvironment getSynapseEnvironment(AxisConfiguration axisCfg)

getStatisticsCollector

public static StatisticsCollector getStatisticsCollector(ServerContextInformation contextInfo)
Get the StatisticsCollector from synapse env.

Parameters:
contextInfo - server information
Returns:
StatisticsCollector instance if there is any

stringToOM

public static OMElement stringToOM(String xml)

newConfiguration

public static SynapseConfiguration newConfiguration()
Construct a fresh SynapseConfiguration instance and registers the observers with it as specified in the synapse.properties file. Use the initial.observers property in the synapse.properties file to specify observers as a comma separated list.

Returns:
a SynapseConfiguration instance

setDefaultMainSequence

public static void setDefaultMainSequence(SynapseConfiguration config)
Return the main sequence if one is not defined. This implementation defaults to a simple sequence with a

Parameters:
config - the configuration to be updated

setDefaultFaultSequence

public static void setDefaultFaultSequence(SynapseConfiguration config)
Return the fault sequence if one is not defined. This implementation defaults to a simple sequence :

Parameters:
config - the configuration to be updated

isFailSafeEnabled

public static boolean isFailSafeEnabled(String componentName)


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