org.bioquery.query
Class QueryFactory

java.lang.Object
  |
  +--org.bioquery.query.QueryFactory

public class QueryFactory
extends java.lang.Object

QueryFactory has the job of returning a list of available databases, and returning an instance of Query that handles any specific database on the list. Querys should never be instantiated directly, but instead should be obtained by calling QueryFactory.createQuery.

The QueryFactory methods are static, but the first time it is referenced in any Virtual Machine it will dynamically load the querys.xml, which tells it what databases are available. The file should be located at ./META-INF/querys.xml, where META-INF is located in the base directory of the virtual machine. If this file is not found or is corrupted, it will throw and IOException.M/p>

Example user:


      try {
          java.util.List databaseList = QueryFactory.getDatabaseList();
          String databaseName = (String)databaseList.get(0);
          Query aQuery = QueryFactory.createQuery(databaseName);
      }
      catch (IOException ex) { }
  

This class is dependent on the jdom package, which is in turn dependent on SAX classes. Inclusion of jdom.jar in a classpath-mapped directory should prevent all ClassNotFoundExceptions. xerces.jar may also be required for some versions of Java. These files are freely available over the internet.

Author:
James Brundege

Constructor Summary
QueryFactory()
           
 
Method Summary
static Query createQuery(java.lang.String database)
          Returns a Query object configured to build and submit searches to the specific database passed as the parameter.
static java.util.List getDatabaseList()
          Returns a java.util.List containing the common name for each database available from this QueryFactory as Strings.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

QueryFactory

public QueryFactory()
Method Detail

getDatabaseList

public static java.util.List getDatabaseList()
                                      throws java.io.IOException
Returns a java.util.List containing the common name for each database available from this QueryFactory as Strings. Any String from this List is a valid parameter for the createQuery method.
Returns:
A java.util.List containing the names of available databases as Strings

createQuery

public static Query createQuery(java.lang.String database)
                         throws java.io.IOException
Returns a Query object configured to build and submit searches to the specific database passed as the parameter. Valid parameters are any String from the List returned by the getDatabaseList method.
Parameters:
database - The name of a database.
Returns:
A Query object made for the given database.