Package org.jcsp.net.settings
Class ConfigReader
java.lang.Object
org.jcsp.net.settings.ConfigReader
- All Implemented Interfaces:
XMLConfigConstants
Used internally by the JCSP network infrastructure to load a configuration from an XML file.
This is not a full XML reader, and is capable of reading only a subset of XML.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static class
static class
Thrown in the event of a semantic error in the parsed XML file. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final String[]
private JCSPConfig
The config built up.private static final int
private int
private int
private final String[]
Fields inherited from interface org.jcsp.net.settings.XMLConfigConstants
DATA_TYPE_INDICATOR_BOOLEAN, DATA_TYPE_INDICATOR_DOUBLE, DATA_TYPE_INDICATOR_INT, DATA_TYPE_INDICATOR_STRING, ELEMENT_ADDRESS, ELEMENT_ADDRESS_SETTING, ELEMENT_ADDRESSES, ELEMENT_CONNECTION_ORIENTED, ELEMENT_LINK_PROFILE, ELEMENT_LINK_PROFILES, ELEMENT_LINK_REQ_MAXPING, ELEMENT_LINK_REQ_MINSPEED, ELEMENT_LINK_REQ_OTHER, ELEMENT_LINK_REQ_PROTOCOL, ELEMENT_LINK_REQS, ELEMENT_MAXSPEED, ELEMENT_MEMORY, ELEMENT_NODE_PROFILE, ELEMENT_NODE_PROFILES, ELEMENT_NODE_REQ_MINMEMORY, ELEMENT_NODE_REQ_MINSPEED, ELEMENT_NODE_REQ_OTHER, ELEMENT_NODE_REQS, ELEMENT_NODE_SPECS, ELEMENT_OTHERSPEC, ELEMENT_PLUGIN, ELEMENT_PLUGINS, ELEMENT_PROTOCOL, ELEMENT_PROTOCOL_SETTING, ELEMENT_PROTOCOL_SETTINGS, ELEMENT_PROTOCOLS, ELEMENT_RELIABLE, ELEMENT_SERVICE, ELEMENT_SERVICES, ELEMENT_SETTING, ELEMENT_SETTINGS, ELEMENT_SPECS, ELEMENT_WIRELESS, REQ_COMPARATOR_EQUALS, REQ_COMPARATOR_GREATER, REQ_COMPARATOR_LESS, REQ_NAME_MAXPING, REQ_NAME_MINMEMORY, REQ_NAME_MINSPEED, REQ_NAME_PROTOCOL, RESERVED_SPEC_NAMES, SPEC_NAME_CONNECTION_ORIENTED, SPEC_NAME_MAXSPEED, SPEC_NAME_MEMORY, SPEC_NAME_PING, SPEC_NAME_PROTOCOL, SPEC_NAME_RELIABLE, SPEC_NAME_WIRELESS, XML_BOOLEAN_FALSE, XML_BOOLEAN_TRUE, XML_TRISTATE_CANBE, XML_TRISTATE_FALSE, XML_TRISTATE_TRUE
-
Constructor Summary
ConstructorsConstructorDescriptionConfigReader
(InputStream instream) Constructs a new configuration from the given source stream. -
Method Summary
Modifier and TypeMethodDescriptionprivate void
do_template
(Reader in) private void
private void
doAddresses
(Reader in) private void
doAddressSpecs
(Reader in) private void
doJCSP_Config
(Reader in) private void
doLinkProfile
(Reader in) private void
doLinkProfiles
(Reader in) private void
doLinkReqs
(Reader in) private void
doNodeProfile
(Reader in) private void
doNodeProfiles
(Reader in) private void
doNodeReqs
(Reader in) private void
doNodeSpecs
(Reader in) private void
private void
private void
doProtocol
(Reader in) private void
doProtocols
(Reader in) private void
private void
private void
private void
doServices
(Reader in) private void
doSettings
(Reader in) private boolean
isSpace
(char c) static void
Diagnostic routine.private char
private ConfigReader.Tag
-
Field Details
-
config
The config built up. -
servicePos
private int servicePos -
protocolPos
private int protocolPos -
MAX_ATTRIBS
private static final int MAX_ATTRIBS- See Also:
-
attribs
-
values
-
-
Constructor Details
-
ConfigReader
Constructs a new configuration from the given source stream. This will attempt to parse the file using recursive-descent approach.- Parameters:
instream
- source of the XML configuration.- Throws:
IOException
- if there is a problem with the stream or the file is improperly formatted.ConfigReader.XMLValidationException
- if there is a symantic problem with the configuration.
-
-
Method Details
-
main
Diagnostic routine. This can load an XML configuration file and then display the configuration structure constructed. Specify the name of the file as the first command line parameter. -
do_template
- Throws:
IOException
-
doJCSP_Config
- Throws:
IOException
-
doSettings
- Throws:
IOException
-
doServices
- Throws:
IOException
-
doService
- Throws:
IOException
-
doPlugins
- Throws:
IOException
-
doPlugin
- Throws:
IOException
-
doProtocols
- Throws:
IOException
-
doProtocol
- Throws:
IOException
-
doProtocolSpecs
- Throws:
IOException
-
doProtocolSettings
- Throws:
IOException
-
doAddresses
- Throws:
IOException
-
doAddress
- Throws:
IOException
-
doAddressSpecs
- Throws:
IOException
-
doNodeSpecs
- Throws:
IOException
-
doLinkProfiles
- Throws:
IOException
-
doLinkProfile
- Throws:
IOException
-
doLinkReqs
- Throws:
IOException
-
doNodeProfiles
- Throws:
IOException
-
doNodeProfile
- Throws:
IOException
-
doNodeReqs
- Throws:
IOException
-
getConfig
-
nextTag
- Throws:
IOException
-
isSpace
private boolean isSpace(char c) -
nextChar
- Throws:
IOException
-