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 classstatic classThrown in the event of a semantic error in the parsed XML file. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final String[]private JCSPConfigThe config built up.private static final intprivate intprivate intprivate final String[]Fields inherited from interface 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 voiddo_template(Reader in) private voidprivate voiddoAddresses(Reader in) private voiddoAddressSpecs(Reader in) private voiddoJCSP_Config(Reader in) private voiddoLinkProfile(Reader in) private voiddoLinkProfiles(Reader in) private voiddoLinkReqs(Reader in) private voiddoNodeProfile(Reader in) private voiddoNodeProfiles(Reader in) private voiddoNodeReqs(Reader in) private voiddoNodeSpecs(Reader in) private voidprivate voidprivate voiddoProtocol(Reader in) private voiddoProtocols(Reader in) private voidprivate voidprivate voidprivate voiddoServices(Reader in) private voiddoSettings(Reader in) private booleanisSpace(char c) static voidDiagnostic routine.private charprivate 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
-