edu.cmu.emulator
Class ConfigFileParser

java.lang.Object
  extended by edu.cmu.emulator.ConfigFileParser
All Implemented Interfaces:
Comparator

public class ConfigFileParser
extends Object
implements Comparator

This is the main class which parses through the XML config file. It uses the DOM APIs to extract information from the XML file. It extracts individual tags from the resulting tree structure and passes the elements to different parsers based on the element type.

See Also:
NodeDefParser, EventDefParser, UserClassDefParser

Field Summary
private  String[][] args
           
private  String[] classNames
           
private static boolean debug
           
private  String defaultDSPConfigFile
           
(package private) static Document doc
           
(package private) static Document doc2
           
(package private) static Document docDSP
           
private  DSPConfiguration dspConfig
           
private  EmuHWConfiguration emuHWConfig
           
private  String emulabInputFile
           
private  ArrayList eventList
           
protected  Logger log
           
private  EmuNode[] nodes
           
private  Element rootEventDef
           
private  SignalEnvironment sigEnv
           
private  String[] urls
           
private  String userInputFile
           
private  VisDefParser visDefParser
           
private  WorldDef worldDef
           
 
Constructor Summary
ConfigFileParser(String inputFile, String pid, String eid, EmuHWConfiguration emuHWConfig)
          Constructor.
 
Method Summary
 int compare(Object o1, Object o2)
           
private  Antenna[] getAntennaList(EmuNode[] nodes)
           
 String[][] getArgs()
           
 String[] getClassNames()
          Method to obtain the array of classes which the URLClassloader should load into the system at run time.
 DSPConfiguration getDSPConfiguration()
           
 ArrayList getEventList()
          Method to obtain the Inputstream which represents the Inputstream of the event file (script).
 EmuNode[] getNodes()
          Method to obtain the array of EmuNode objects that were created after extracting the NodeDef tag in the config file.
 SignalEnvironment getSignalEnvironment()
           
 String[] getURLs()
          Method to obtain the array of URLs through which the URLClassloader can search in order to extract the definition of a class that is to be loaded at run time.
 VisDefParser getVisDefParser()
           
 WorldDef getWorldDef()
          Returns the WorldDef, which specifies the dimensions of the world.
 void parse()
          This is the main function in the ConfigFileParser.
 void parseEvents()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Comparator
equals
 

Field Detail

doc

static Document doc

doc2

static Document doc2

docDSP

static Document docDSP

debug

private static boolean debug

defaultDSPConfigFile

private String defaultDSPConfigFile

userInputFile

private String userInputFile

emulabInputFile

private String emulabInputFile

emuHWConfig

private EmuHWConfiguration emuHWConfig

nodes

private EmuNode[] nodes

eventList

private ArrayList eventList

urls

private String[] urls

classNames

private String[] classNames

worldDef

private WorldDef worldDef

sigEnv

private SignalEnvironment sigEnv

args

private String[][] args

dspConfig

private DSPConfiguration dspConfig

visDefParser

private VisDefParser visDefParser

rootEventDef

private Element rootEventDef

log

protected Logger log
Constructor Detail

ConfigFileParser

public ConfigFileParser(String inputFile,
                        String pid,
                        String eid,
                        EmuHWConfiguration emuHWConfig)
Constructor.

Parameters:
inputFile - The name of the XML experiment config file to be parsed.
pid - XXX What the heck is pid, anyway!?
eid - XXX What the heck is eid, anyway!?
emuHWConfig - The name of hardware configuration file to use
Method Detail

getWorldDef

public WorldDef getWorldDef()
Returns the WorldDef, which specifies the dimensions of the world.

Returns:
WorldDef object.

getNodes

public EmuNode[] getNodes()
Method to obtain the array of EmuNode objects that were created after extracting the NodeDef tag in the config file.

Returns:
An array of EmuNode objects
See Also:
NodeDefParser

getSignalEnvironment

public SignalEnvironment getSignalEnvironment()

getEventList

public ArrayList getEventList()
Method to obtain the Inputstream which represents the Inputstream of the event file (script).

Returns:
The InputStream object corresponding to the Event file.

getURLs

public String[] getURLs()
Method to obtain the array of URLs through which the URLClassloader can search in order to extract the definition of a class that is to be loaded at run time. The URLs are created by extracting the UserClassDef tag in the config file.

Returns:
The array of URLs defined in the config file.
See Also:
UserClassDefParser

getClassNames

public String[] getClassNames()
Method to obtain the array of classes which the URLClassloader should load into the system at run time. The ClassNames are created by extracting the UserClassDef tag in the config file.

Returns:
The array of user-defined class names in the config file.
See Also:
UserClassDefParser

getArgs

public String[][] getArgs()

getVisDefParser

public VisDefParser getVisDefParser()

getDSPConfiguration

public DSPConfiguration getDSPConfiguration()

parse

public void parse()
This is the main function in the ConfigFileParser. It is invoked by the Emulator class during system initialization. This function invokes the various other parser classes in order to parse the appropriate group of tags. It uses the DOM parser to create a tree of elements and passes the appropriate element to each of the tag-specific parsers it invokes.

See Also:
Document

parseEvents

public void parseEvents()

getAntennaList

private Antenna[] getAntennaList(EmuNode[] nodes)

compare

public int compare(Object o1,
                   Object o2)
Specified by:
compare in interface Comparator


Copyright © 2013. All Rights Reserved.