Package org.jgroups.conf
Class XmlConfigurator
- java.lang.Object
-
- org.jgroups.conf.XmlConfigurator
-
- All Implemented Interfaces:
ProtocolStackConfigurator
public class XmlConfigurator extends java.lang.Object implements ProtocolStackConfigurator
Uses XML to configure a protocol stack- Author:
- Vladimir Blagojevic, Bela Ban
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
XmlConfigurator.ElementType
-
Constructor Summary
Constructors Modifier Constructor Description protected
XmlConfigurator(java.util.List<ProtocolConfiguration> protocols)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static XmlConfigurator
getInstance(java.io.InputStream stream)
java.util.List<ProtocolConfiguration>
getProtocolStack()
java.lang.String
getProtocolStackString()
java.lang.String
getProtocolStackString(boolean convert)
protected static XmlConfigurator.ElementType
getType(java.lang.String s)
protected static boolean
isClosed(java.lang.String s)
protected static boolean
isComment(java.lang.String s)
static void
main(java.lang.String[] args)
protected static XmlConfigurator
parse(java.io.InputStream stream)
protected static XmlConfigurator
parse(XmlNode root)
static java.util.List<ProtocolConfiguration>
parseProtocols(XmlNode root)
static XmlNode
parseXmlDocument(java.io.InputStream in)
Reads XML and returns a simple tree of XmlNodesprotected static Tuple<java.lang.String,java.lang.String>
readAttribute(java.io.InputStream in)
protected static java.lang.String
readNode(java.io.InputStream in)
protected static java.lang.String
readQuotedString(java.io.InputStream in)
Reads the characters between a start and end quote (").static java.lang.String
replace(java.lang.String input, java.lang.String expr, java.lang.String replacement)
protected static java.lang.String
sanitize(java.lang.String s)
Fixes errors like "/ >" with "/>"
-
-
-
Field Detail
-
log
protected static final Log log
-
-
Constructor Detail
-
XmlConfigurator
protected XmlConfigurator(java.util.List<ProtocolConfiguration> protocols)
-
-
Method Detail
-
getInstance
public static XmlConfigurator getInstance(java.io.InputStream stream) throws java.io.IOException
- Throws:
java.io.IOException
-
getProtocolStackString
public java.lang.String getProtocolStackString(boolean convert)
- Parameters:
convert
- If false: print old plain output, else print new XML format- Returns:
- String with protocol stack in specified format
-
getProtocolStackString
public java.lang.String getProtocolStackString()
- Specified by:
getProtocolStackString
in interfaceProtocolStackConfigurator
-
getProtocolStack
public java.util.List<ProtocolConfiguration> getProtocolStack()
- Specified by:
getProtocolStack
in interfaceProtocolStackConfigurator
-
parse
protected static XmlConfigurator parse(java.io.InputStream stream) throws java.io.IOException
- Throws:
java.io.IOException
-
parse
protected static XmlConfigurator parse(XmlNode root) throws java.lang.Exception
- Throws:
java.lang.Exception
-
parseProtocols
public static java.util.List<ProtocolConfiguration> parseProtocols(XmlNode root) throws java.lang.Exception
- Throws:
java.lang.Exception
-
parseXmlDocument
public static XmlNode parseXmlDocument(java.io.InputStream in) throws java.io.IOException
Reads XML and returns a simple tree of XmlNodes- Throws:
java.io.IOException
-
readNode
protected static java.lang.String readNode(java.io.InputStream in) throws java.io.IOException
- Throws:
java.io.IOException
-
sanitize
protected static java.lang.String sanitize(java.lang.String s)
Fixes errors like "/ >" with "/>"
-
readAttribute
protected static Tuple<java.lang.String,java.lang.String> readAttribute(java.io.InputStream in) throws java.io.IOException
- Throws:
java.io.IOException
-
readQuotedString
protected static java.lang.String readQuotedString(java.io.InputStream in) throws java.io.IOException
Reads the characters between a start and end quote ("). Skips chars escaped with '\'- Throws:
java.io.IOException
-
getType
protected static XmlConfigurator.ElementType getType(java.lang.String s)
-
isClosed
protected static boolean isClosed(java.lang.String s)
-
isComment
protected static boolean isComment(java.lang.String s)
-
main
public static void main(java.lang.String[] args) throws java.lang.Exception
- Throws:
java.lang.Exception
-
replace
public static java.lang.String replace(java.lang.String input, java.lang.String expr, java.lang.String replacement)
-
-