edu.ucsb.nceas.metacat
Class DBQuery

java.lang.Object
  extended byedu.ucsb.nceas.metacat.DBQuery

public class DBQuery
extends java.lang.Object

A Class that searches a relational DB for elements and attributes that have free text matches a query string, or structured query matches to a path specified node in the XML hierarchy. It returns a result set consisting of the document ID for each document that satisfies the query


Constructor Summary
DBQuery(java.lang.String parserName)
          construct an instance of the DBQuery class
 
Method Summary
static java.lang.String createQuery(java.lang.String value)
          format a simple free-text value query as an XML document that conforms to the pathquery.dtd and is appropriate for submission to the DBQuery structured query engine
static java.lang.String createQuery(java.lang.String value, java.lang.String doctype)
          format a simple free-text value query as an XML document that conforms to the pathquery.dtd and is appropriate for submission to the DBQuery structured query engine
 java.lang.StringBuffer createResultDocument(java.lang.String xmlquery, QuerySpecification qspec, java.io.PrintWriter out, java.lang.String user, java.lang.String[] groups, boolean useXMLIndex)
           
static java.lang.String createSQuery(java.util.Hashtable params)
          format a structured query as an XML document that conforms to the pathquery.dtd and is appropriate for submission to the DBQuery structured query engine
 void findDocuments(javax.servlet.http.HttpServletResponse response, java.io.PrintWriter out, java.util.Hashtable params, java.lang.String user, java.lang.String[] groups, java.lang.String sessionid)
          Method put the search result set into out printerwriter
 void findDocuments(javax.servlet.http.HttpServletResponse response, java.io.PrintWriter out, java.util.Hashtable params, java.lang.String user, java.lang.String[] groups, java.lang.String sessionid, boolean useXMLIndex)
          Method put the search result set into out printerwriter
 java.util.zip.ZipOutputStream getZippedPackage(java.lang.String docIdString, javax.servlet.ServletOutputStream out, java.lang.String user, java.lang.String[] groups, java.lang.String passWord)
          put a data packadge into a zip output stream
static void main(java.lang.String[] args)
          the main routine used to test the DBQuery utility.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DBQuery

public DBQuery(java.lang.String parserName)
construct an instance of the DBQuery class

Generally, one would call the findDocuments() routine after creating an instance to specify the search query

Parameters:
parserName - the fully qualified name of a Java class implementing the org.xml.sax.XMLReader interface
Method Detail

main

public static void main(java.lang.String[] args)
the main routine used to test the DBQuery utility.

Usage: java DBQuery


findDocuments

public void findDocuments(javax.servlet.http.HttpServletResponse response,
                          java.io.PrintWriter out,
                          java.util.Hashtable params,
                          java.lang.String user,
                          java.lang.String[] groups,
                          java.lang.String sessionid)
Method put the search result set into out printerwriter

Parameters:
out - the output printer
params - the paratermer hashtable
user - the user name (it maybe different to the one in param)
groups - the group array
sessionid - the sessionid

findDocuments

public void findDocuments(javax.servlet.http.HttpServletResponse response,
                          java.io.PrintWriter out,
                          java.util.Hashtable params,
                          java.lang.String user,
                          java.lang.String[] groups,
                          java.lang.String sessionid,
                          boolean useXMLIndex)
Method put the search result set into out printerwriter

Parameters:
out - the output printer
params - the paratermer hashtable
user - the user name (it maybe different to the one in param)
groups - the group array
sessionid - the sessionid

createResultDocument

public java.lang.StringBuffer createResultDocument(java.lang.String xmlquery,
                                                   QuerySpecification qspec,
                                                   java.io.PrintWriter out,
                                                   java.lang.String user,
                                                   java.lang.String[] groups,
                                                   boolean useXMLIndex)

createSQuery

public static java.lang.String createSQuery(java.util.Hashtable params)
format a structured query as an XML document that conforms to the pathquery.dtd and is appropriate for submission to the DBQuery structured query engine

Parameters:
params - The list of parameters that should be included in the query

createQuery

public static java.lang.String createQuery(java.lang.String value,
                                           java.lang.String doctype)
format a simple free-text value query as an XML document that conforms to the pathquery.dtd and is appropriate for submission to the DBQuery structured query engine

Parameters:
value - the text string to search for in the xml catalog
doctype - the type of documents to include in the result set -- use "any" or "ANY" for unfiltered result sets

createQuery

public static java.lang.String createQuery(java.lang.String value)
format a simple free-text value query as an XML document that conforms to the pathquery.dtd and is appropriate for submission to the DBQuery structured query engine

Parameters:
value - the text string to search for in the xml catalog

getZippedPackage

public java.util.zip.ZipOutputStream getZippedPackage(java.lang.String docIdString,
                                                      javax.servlet.ServletOutputStream out,
                                                      java.lang.String user,
                                                      java.lang.String[] groups,
                                                      java.lang.String passWord)
                                               throws java.lang.ClassNotFoundException,
                                                      java.io.IOException,
                                                      java.sql.SQLException,
                                                      McdbException,
                                                      java.lang.NumberFormatException,
                                                      java.lang.Exception
put a data packadge into a zip output stream

Throws:
java.lang.ClassNotFoundException
java.io.IOException
java.sql.SQLException
McdbException
java.lang.NumberFormatException
java.lang.Exception


Copyright © 2000 National Center for Ecological Analysis and Synthesis. All Rights Reserved.