umich.cac.queryengine
Class QueryEngineDigester

java.lang.Object
  extended byumich.cac.queryengine.QueryEngineDigester

public final class QueryEngineDigester
extends java.lang.Object

Responsible for parsing the XML configuration file.

Creates the appropriate objects based on the configuration data.

Version:
$Header: /cvsroot/pbsaccounting/pbsaccounting/darkslide/doc/javadoc/umich/cac/queryengine/QueryEngineDigester.html,v 1.3 2003/12/18 17:16:08 rodmach Exp $
Author:
rmach@umich.edu

Constructor Summary
QueryEngineDigester()
           
 
Method Summary
 void addDataSource(java.lang.String name, java.lang.String driver, java.lang.String url, java.lang.String userName, java.lang.String password, java.lang.String schema)
          Create a DataSource object from the config file.
 java.lang.String getConfigFile()
          Return the config file that was configured
 DataSource getDataSource()
          Return a DataSource object created after parsing the config file.
 java.util.logging.Level getDebugLevel()
          Returns the debug level.
 java.lang.String getReportModule()
          Returns the full name of the report module class, like umich.cac.queryengine.LookupService
 java.lang.String getUserReportTitle()
          Get the title for the user report.
 boolean run()
          Read the config file, and create the appropriate Objects
 void setConfigFile(java.lang.String configFile)
          Set the config file to use, override the default "QueryEngineconfig.xml"
 void setDebugLevel(java.lang.String debugLevelString)
          Set the debugging level to use for Java logging facility.
 void setReportModule(java.lang.String reportModule)
          Sets the full class name for the reporting module to use for the report
 void setUserReportTitle(java.lang.String reportTitle)
          Set the title for the user report.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

QueryEngineDigester

public QueryEngineDigester()
Method Detail

run

public boolean run()
Read the config file, and create the appropriate Objects

Returns:
true if successfully read the config file, false if problems

setDebugLevel

public void setDebugLevel(java.lang.String debugLevelString)
Set the debugging level to use for Java logging facility.

Parameters:
debugLevelString - The debug level, like INFO, WARNING, SEVERE

setUserReportTitle

public void setUserReportTitle(java.lang.String reportTitle)
Set the title for the user report.

Parameters:
reportTitle - The title for the user report

setReportModule

public void setReportModule(java.lang.String reportModule)
Sets the full class name for the reporting module to use for the report

Parameters:
reportModule - name of report module class, like umich.cac.queryengine.LookupService

getReportModule

public java.lang.String getReportModule()
Returns the full name of the report module class, like umich.cac.queryengine.LookupService

Returns:
full name of the report module class

getUserReportTitle

public java.lang.String getUserReportTitle()
Get the title for the user report.

Returns:
The Title of the user report

getDebugLevel

public java.util.logging.Level getDebugLevel()
                                      throws java.lang.IllegalStateException
Returns the debug level. In the config file this is configured with
  <debugging>SEVERE</debugging>
 
tag.

Returns:
Level The debugging Level
Throws:
java.lang.IllegalStateException - if debugLevel is null, as run() not called yet

setConfigFile

public void setConfigFile(java.lang.String configFile)
Set the config file to use, override the default "QueryEngineconfig.xml"

Parameters:
configFile - path the config file to use

getConfigFile

public java.lang.String getConfigFile()
Return the config file that was configured

Returns:
configFile path the config file to use

addDataSource

public void addDataSource(java.lang.String name,
                          java.lang.String driver,
                          java.lang.String url,
                          java.lang.String userName,
                          java.lang.String password,
                          java.lang.String schema)
Create a DataSource object from the config file.

This method is called when the following tag is encountered
<datasource> <name>Xindice connection parameters</name> <driver>org.apache.xindice.client.xmldb.DatabaseImpl</driver> <url>xmldb:xindice:///db/</url> <username>none</username> <password>none</password> <collection>morpheus.engin.umich.edu<collection> </datasource>

Parameters:
name - A descriptive name for the datasource
driver - The XML:DB driver classname
url - URL for driver, like xmldb:xindice:///db/
userName - the user name to login, can be null
password - for the given userName, can be null
schema - schema used for this datasource connection

getDataSource

public DataSource getDataSource()
                         throws java.lang.IllegalStateException
Return a DataSource object created after parsing the config file.

run() must be called before this method is called

Returns:
DataSource a DataSource object suitable for passing to QueryEngine
Throws:
java.lang.IllegalStateException - if dataSource is null, as run() not called