|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectptolemy.backtrack.xmlparser.ConfigParser
public class ConfigParser
Ptolemy XML configuration parser. This parser builds an XML tree in memory
as it parses a configuration. The tree is either a complete representation
of the configuration file, or a partial representation that defines only the
given Java classes. See ConfigXmlHandler
for more information on the
second usage.
Red (tfeng) |
Red (tfeng) |
Field Summary | |
---|---|
private java.util.Set<java.lang.String> |
_excludedFiles
The set of excluded files. |
private ConfigXmlTree |
_xmlTree
The XML tree. |
static java.lang.String |
DEFAULT_SYSTEM_ID
The default path of the default Ptolemy configuration file. |
Constructor Summary | |
---|---|
ConfigParser()
Construct a configuration parser with no parent node. |
|
ConfigParser(ConfigXmlTree xmlTree)
Construct a configuration parser with a parent node. |
Method Summary | |
---|---|
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. |
private void |
addPackagePrefix(ConfigXmlTree tree,
java.lang.String packagePrefix,
java.util.Set classes)
The recursive function to traverse the XML tree and add a package prefix to each class name found in the given set. |
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). |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String DEFAULT_SYSTEM_ID
private java.util.Set<java.lang.String> _excludedFiles
private ConfigXmlTree _xmlTree
Constructor Detail |
---|
public ConfigParser()
public ConfigParser(ConfigXmlTree xmlTree)
xmlTree
- The parent node of the XML tree.Method Detail |
---|
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.private void addPackagePrefix(ConfigXmlTree tree, java.lang.String packagePrefix, java.util.Set classes)
tree
- The XML tree to be traversed.packagePrefix
- The package prefix to be added.classes
- The set of names of affected classes.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |