public class ConfigParser
extends java.lang.Object
ConfigXmlHandler
for more information on the
second usage.Modifier and Type | Field and Description |
---|---|
static java.lang.String |
DEFAULT_SYSTEM_ID
The default path of the default Ptolemy configuration file.
|
Constructor and Description |
---|
ConfigParser()
Construct a configuration parser with no parent node.
|
ConfigParser(ConfigXmlTree xmlTree)
Construct a configuration parser with a parent node.
|
Modifier and Type | Method and Description |
---|---|
void |
addExcludedFile(java.lang.String canonicalPath)
Add an excluded file to the XML handler.
|
void |
addExcludedFiles(java.util.Collection<java.lang.String> canonicalPaths)
Add a collection of excluded files to the XML handler.
|
void |
addPackagePrefix(java.lang.String packagePrefix,
java.util.Set classes)
Add a package prefix to the classes in the XML tree.
|
ConfigXmlTree |
getTree()
Get the parsed XML tree.
|
static void |
main(java.lang.String[] args)
The main function to test the functionality of this class.
|
void |
parseConfigFile(java.lang.String fileName,
java.util.Set<java.lang.String> includedClasses)
Parse a configuration file and build the XML tree below the given
parent node (or null if not given).
|
void |
parseConfigFile(java.lang.String fileName,
java.util.Set<java.lang.String> includedClasses,
boolean backtrackingElement)
Parse a configuration file and build the XML tree below the given
parent node (or null if not given).
|
public static final java.lang.String DEFAULT_SYSTEM_ID
public ConfigParser()
public ConfigParser(ConfigXmlTree xmlTree)
xmlTree
- The parent node of the XML tree.public void addExcludedFile(java.lang.String canonicalPath)
canonicalPath
- The canonical path of the file to be excluded.ConfigXmlHandler.addExcludedFile(String)
public void addExcludedFiles(java.util.Collection<java.lang.String> canonicalPaths)
canonicalPaths
- The collection of canonical paths of the files to
be excluded.ConfigXmlHandler.addExcludedFiles(Collection)
public void addPackagePrefix(java.lang.String packagePrefix, java.util.Set classes)
packagePrefix
- The package prefix to be added to the head of each
class name.classes
- The names of affected classes.public ConfigXmlTree getTree()
public static void main(java.lang.String[] args) throws java.lang.Exception
args
- The command-line arguments (not used).java.lang.Exception
- If error occurs.public void parseConfigFile(java.lang.String fileName, java.util.Set<java.lang.String> includedClasses) throws java.lang.Exception
This method is the same as parseConfigFile(fileName, includedClasses, true).
fileName
- The name of the configuration file.includedClasses
- The set of names of classes to be included.java.lang.Exception
- If error occurs.parseConfigFile(String, Set, boolean)
public void parseConfigFile(java.lang.String fileName, java.util.Set<java.lang.String> includedClasses, boolean backtrackingElement) throws java.lang.Exception
fileName
- The name of the configuration file.includedClasses
- The set of names of classes to be included.backtrackingElement
- Whether to set the parent node of the
constructed XML tree to be the "backtrack" node.java.lang.Exception
- If error occurs.