Package org.jgroups.conf
Class ConfiguratorFactory
java.lang.Object
org.jgroups.conf.ConfiguratorFactory
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
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
- Version:
- $Id: ConfiguratorFactory.java,v 1.23 2007/06/06 11:02:35 belaban Exp $
- Author:
- Filip Hanik (filip@filip.net), Bela Ban
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic InputStream
getConfigStream
(File file) static InputStream
getConfigStream
(Object properties) static InputStream
getConfigStream
(String properties) Returns a JGroups XML configuration InputStream based on the provided properties string.static InputStream
getConfigStream
(URL url) static ProtocolStackConfigurator
getStackConfigurator
(File file) Returns a protocol stack configurator based on the XML configuration provided by the specified File.static ProtocolStackConfigurator
getStackConfigurator
(Object properties) Deprecated.Used by the JChannel(Object) constructor which has been deprecated.static ProtocolStackConfigurator
getStackConfigurator
(String properties) Returns a protocol stack configurator based on the provided properties string.static ProtocolStackConfigurator
getStackConfigurator
(URL url) Returns a protocol stack configurator based on the XML configuration provided at the specified URL.static ProtocolStackConfigurator
getStackConfigurator
(Element element) Returns a protocol stack configurator based on the XML configuration provided by the specified XML element.static void
substituteVariables
(ProtocolStackConfigurator configurator) Replace variables of the form ${var:default} with the getProperty(var, default)
-
Field Details
-
JAXP_MISSING_ERROR_MSG
- See Also:
-
-
Constructor Details
-
ConfiguratorFactory
protected ConfiguratorFactory()
-
-
Method Details
-
getStackConfigurator
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:
ChannelException
- if problems occur during the configuration of the protocol stack.
-
getStackConfigurator
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:
ChannelException
- if problems occur during the configuration of the protocol stack.
-
getStackConfigurator
public static ProtocolStackConfigurator getStackConfigurator(Element element) throws ChannelException 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:
ChannelException
- if problems occur during the configuration of the protocol stack.
-
getStackConfigurator
public static ProtocolStackConfigurator getStackConfigurator(String properties) throws ChannelException 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 XML configuration, or a string representing a file name that contains a JGroups XML configuration.- Throws:
ChannelException
-
getStackConfigurator
Deprecated.Used by the JChannel(Object) constructor which has been deprecated.Returns a protocol stack configurator based on the properties passed in.
If the properties parameter is a plain string UDP:FRAG:MERGE:GMS etc, a PlainConfigurator is returned.
If the properties parameter is a string that represents a url for example http://www.filip.net/test.xml or the parameter is a java.net.URL object, an XmlConfigurator is returned- Parameters:
properties
- old style property string, url string, or java.net.URL object- Returns:
- a ProtocolStackConfigurator containing the stack configuration
- Throws:
IOException
- if it fails to parse the XML contentIOException
- if the URL is invalid or a the content can not be reached
-
getConfigStream
- Throws:
Exception
-
getConfigStream
- Throws:
Exception
-
getConfigStream
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:
IOException
- if the provided properties string appears to be a valid URL but is unreachable.
-
getConfigStream
- Throws:
IOException
-
substituteVariables
Replace variables of the form ${var:default} with the getProperty(var, default)- Parameters:
configurator
-
-