Package org.jcsp.net.settings

# Class ConfigReader

java.lang.Object
org.jcsp.net.settings.ConfigReader

All Implemented Interfaces:
  `XMLConfigConstants`

public class ConfigReader extends Object implements 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.

Author:
  Quickstone Technologies Limited

## Nested Class Summary

Nested Classes
Modifier and Type
Class
Description
`static class`
`ConfigReader.XMLValidationException`
Thrown in the event of a semantic error in the parsed XML file.

## Field Summary

### 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

Constructors
Constructor
Description
`ConfigReader(InputStream instream)`
Constructs a new configuration from the given source stream.

## Method Summary

Modifier and Type
Method
Description
`JCSPConfig`
`getConfig()`
`static void`
`main(String[] args)`
Diagnostic routine.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### ConfigReader

public ConfigReader(InputStream instream) throws IOException
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

public static void main(String[] args)
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.

### getConfig

public JCSPConfig getConfig()