org.jgroups.conf
Class ConfiguratorFactory

java.lang.Object
  extended by org.jgroups.conf.ConfiguratorFactory

public class ConfiguratorFactory
extends java.lang.Object

The ConfigurationFactory is a factory that returns a protocol stack configurator. The protocol stack configurator is an object that read a stack configuration and parses it so that the ProtocolStack can create a stack.
Currently the factory returns one of the following objects:
1. XmlConfigurator - parses XML files
2. PlainConfigurator - uses the old style strings UDP:FRAG: etc etc

Author:
Filip Hanik (filip@filip.net), Bela Ban

Field Summary
static java.lang.String JAXP_MISSING_ERROR_MSG
           
 
Constructor Summary
protected ConfiguratorFactory()
           
 
Method Summary
static java.io.InputStream getConfigStream(java.io.File file)
           
static java.io.InputStream getConfigStream(java.lang.Object properties)
           
static java.io.InputStream getConfigStream(java.lang.String properties)
          Returns a JGroups XML configuration InputStream based on the provided properties string.
static java.io.InputStream getConfigStream(java.net.URL url)
           
static ProtocolStackConfigurator getStackConfigurator(org.w3c.dom.Element element)
          Returns a protocol stack configurator based on the XML configuration provided by the specified XML element.
static ProtocolStackConfigurator getStackConfigurator(java.io.File file)
          Returns a protocol stack configurator based on the XML configuration provided by the specified File.
static ProtocolStackConfigurator getStackConfigurator(java.io.InputStream input)
           
static ProtocolStackConfigurator getStackConfigurator(java.lang.String properties)
          Returns a protocol stack configurator based on the provided properties string.
static ProtocolStackConfigurator getStackConfigurator(java.net.URL url)
          Returns a protocol stack configurator based on the XML configuration provided at the specified URL.
static void substituteVariables(ProtocolStackConfigurator configurator)
          Replace variables of the form ${var:default} with the getProperty(var, default)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

JAXP_MISSING_ERROR_MSG

public static final java.lang.String JAXP_MISSING_ERROR_MSG
See Also:
Constant Field Values
Constructor Detail

ConfiguratorFactory

protected ConfiguratorFactory()
Method Detail

getStackConfigurator

public static ProtocolStackConfigurator getStackConfigurator(java.io.File file)
                                                      throws java.lang.Exception
Returns a protocol stack configurator based on the XML configuration provided by the specified File.

Parameters:
file - a File with a JGroups XML configuration.
Returns:
a ProtocolStackConfigurator containing the stack configuration.
Throws:
java.lang.Exception - if problems occur during the configuration of the protocol stack.

getStackConfigurator

public static ProtocolStackConfigurator getStackConfigurator(java.io.InputStream input)
                                                      throws java.lang.Exception
Throws:
java.lang.Exception

getStackConfigurator

public static ProtocolStackConfigurator getStackConfigurator(java.net.URL url)
                                                      throws java.lang.Exception
Returns a protocol stack configurator based on the XML configuration provided at the specified URL.

Parameters:
url - a URL pointing to a JGroups XML configuration.
Returns:
a ProtocolStackConfigurator containing the stack configuration.
Throws:
java.lang.Exception - if problems occur during the configuration of the protocol stack.

getStackConfigurator

public static ProtocolStackConfigurator getStackConfigurator(org.w3c.dom.Element element)
                                                      throws java.lang.Exception
Returns a protocol stack configurator based on the XML configuration provided by the specified XML element.

Parameters:
element - a XML element containing a JGroups XML configuration.
Returns:
a ProtocolStackConfigurator containing the stack configuration.
Throws:
java.lang.Exception - if problems occur during the configuration of the protocol stack.

getStackConfigurator

public static ProtocolStackConfigurator getStackConfigurator(java.lang.String properties)
                                                      throws java.lang.Exception
Returns a protocol stack configurator based on the provided properties string.

Parameters:
properties - an old style property string, a string representing a system resource containing a JGroups XML configuration, a string representing a URL pointing to a JGroups XML configuration, or a string representing a file name that contains a JGroups XML configuration.
Throws:
java.lang.Exception

getConfigStream

public static java.io.InputStream getConfigStream(java.io.File file)
                                           throws java.lang.Exception
Throws:
java.lang.Exception

getConfigStream

public static java.io.InputStream getConfigStream(java.net.URL url)
                                           throws java.lang.Exception
Throws:
java.lang.Exception

getConfigStream

public static java.io.InputStream getConfigStream(java.lang.String properties)
                                           throws java.io.IOException
Returns a JGroups XML configuration InputStream based on the provided properties string.

Parameters:
properties - a string representing a system resource containing a JGroups XML configuration, a string representing a URL pointing to a JGroups ML configuration, or a string representing a file name that contains a JGroups XML configuration.
Throws:
java.io.IOException - if the provided properties string appears to be a valid URL but is unreachable.

getConfigStream

public static java.io.InputStream getConfigStream(java.lang.Object properties)
                                           throws java.io.IOException
Throws:
java.io.IOException

substituteVariables

public static void substituteVariables(ProtocolStackConfigurator configurator)
Replace variables of the form ${var:default} with the getProperty(var, default)

Parameters:
configurator -


Copyright © 1998-2012 Bela Ban / Red Hat. All Rights Reserved.