ix.iface.domain
Class DomainParser

java.lang.Object
  extended by ix.iface.domain.DomainParser
Direct Known Subclasses:
DomainParser.DomainParserWrapper, LTF_Parser

public abstract class DomainParser
extends java.lang.Object

An object that parses a domain description to populate a Domain.


Nested Class Summary
protected static class DomainParser.DomainParserWrapper
          Class used to wrap a FileSyntax as a DomainParser.
 
Constructor Summary
protected DomainParser()
           
 
Method Summary
static java.io.File getLibraryDirectory()
          Returns an abstract pathname (File) that refers to the default library of domain descriptions.
static java.io.File loadDomain(java.awt.Component parentComponent, Domain domain)
          Reads a description of a domain from a file selected by the user, conducting all necessary dialogs along the way.
protected static DomainParser makeParser(java.io.File domainFile)
          Factory method that returns an appropriate parser for the indicated file based on the file name's type or extension.
abstract  Domain readDomain()
           
abstract  Domain readDomain(Domain dom)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DomainParser

protected DomainParser()
Method Detail

readDomain

public abstract Domain readDomain()

readDomain

public abstract Domain readDomain(Domain dom)

getLibraryDirectory

public static java.io.File getLibraryDirectory()
Returns an abstract pathname (File) that refers to the default library of domain descriptions. This default can be set by the "domain-library" command-line argument or by calling the Parameters.setParameter(String, String) method. If no such value has been specified, a File constructed from the name "domain-library" is returned as a default.

For backwards compatibility, the parameter "domain-library" will also be recognized if no "library-directory" is supplied.

See Also:
Parameters

makeParser

protected static DomainParser makeParser(java.io.File domainFile)
                                  throws java.io.FileNotFoundException
Factory method that returns an appropriate parser for the indicated file based on the file name's type or extension. Here's how it might be used:
   File domainName = ...;
   Domain domain = ...;
   try {
       DomainParser.makeParser(domainName).readDomain(domain);
   }
   catch (FileNotFoundException e) { ... }
 

Throws:
java.io.FileNotFoundException

loadDomain

public static java.io.File loadDomain(java.awt.Component parentComponent,
                                      Domain domain)
Reads a description of a domain from a file selected by the user, conducting all necessary dialogs along the way. It repeatedly asks the user to select a file until either the domain description has been successfully read or the user decides to cancel the operation. The user is informed of any exceptions thrown while attempting to read, and "success" means that no exceptions were thrown. If the description has been read from a file, a corresponding File (abstract pathname) is returned; otherwise, the result is null.

The input syntax is a function of the file's type as understood by makeParser(File).

Note that this method modifies an existing Domain object rather than creating a new one. However, no modifications occur until after the file has been completely processed without an exception being thrown.

Parameters:
parentComponent - determines the Frame in which dialogs are displayed.
domain - the Domain object to modify
Returns:
a File if the domain description has been read successfully, otherwise null
See Also:
makeParser(File)