Package org.jgroups.conf
Class XmlConfigurator
- java.lang.Object
-
- org.jgroups.conf.XmlConfigurator
-
- All Implemented Interfaces:
ProtocolStackConfigurator
,ProtocolHook
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 protected static boolean
find(char starting_ch, java.lang.String s, java.io.InputStream in, java.lang.StringBuilder sb, boolean drop)
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
isCommentEnd(java.io.InputStream in, java.lang.StringBuilder sb, boolean drop)
protected static boolean
isCommentStart(java.io.InputStream in, java.lang.StringBuilder sb, boolean drop)
Searches for a sequence of '!--'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 (").protected static java.lang.String
sanitize(java.lang.String s)
Fixes errors like "/ >" with "/>"-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.jgroups.conf.ProtocolStackConfigurator
afterCreation
-
-
-
-
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
-
isCommentStart
protected static boolean isCommentStart(java.io.InputStream in, java.lang.StringBuilder sb, boolean drop) throws java.io.IOException
Searches for a sequence of '!--'- Throws:
java.io.IOException
-
isCommentEnd
protected static boolean isCommentEnd(java.io.InputStream in, java.lang.StringBuilder sb, boolean drop) throws java.io.IOException
- Throws:
java.io.IOException
-
find
protected static boolean find(char starting_ch, java.lang.String s, java.io.InputStream in, java.lang.StringBuilder sb, boolean drop) 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)
-
main
public static void main(java.lang.String[] args) throws java.lang.Exception
- Throws:
java.lang.Exception
-
-