edu.berkeley.cs.db.yfilter.filterinstance
Class FilterInstance

java.lang.Object
  |
  +--java.lang.Thread
        |
        +--edu.berkeley.cs.db.yfilter.filterinstance.FilterInstance
All Implemented Interfaces:
java.lang.Runnable

public class FilterInstance
extends java.lang.Thread

A wrapper thread around the filter engine that provides an API to access the message queue, the document queue and the results.


Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
FilterInstance()
          Constructor Creates an EXfilter instance.
 
Method Summary
 java.util.Hashtable addQuery(java.lang.String queryFile)
          Adds a query to the query queue
 java.util.Hashtable bindDoc(java.lang.String strFileName)
          Enqueues an XML document or documents to the document queue
 void deleteQuery(int qid)
          Marks query for deletion.
 java.util.Hashtable dynamicQueries(int rate, java.lang.String dtdAbsolutePath)
          Generates queries based on ms "milliseconds" and the rate
 java.util.Hashtable generateQueries(long amount)
          Generate queries and put them into buffer
 EXfilter getInstance()
          Returns an EXfilter instance
 java.lang.String getResult(int qid, int docID)
          For a given query, returns the matched paths
 QueryParser parseQueryFile(java.lang.String queryFile)
           
 void run()
           
 int setDynamicQueryRate(int rate)
          Sets the query arrival rate and returns the previous value.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FilterInstance

public FilterInstance()
Constructor Creates an EXfilter instance.

Method Detail

getInstance

public EXfilter getInstance()
Returns an EXfilter instance

Returns:
EXfilter a filter instance

setDynamicQueryRate

public int setDynamicQueryRate(int rate)
Sets the query arrival rate and returns the previous value.

Parameters:
rate - the new query arrival rate (queries/sec)
Returns:
int the previous query arrival rate

parseQueryFile

public QueryParser parseQueryFile(java.lang.String queryFile)

dynamicQueries

public java.util.Hashtable dynamicQueries(int rate,
                                          java.lang.String dtdAbsolutePath)
Generates queries based on ms "milliseconds" and the rate

Parameters:
rate - Query arrival rate in documents/sec
dtdAbsolutePath - Absolute path to the DTD path
Returns:
Hashtable A query to ID map

generateQueries

public java.util.Hashtable generateQueries(long amount)
Generate queries and put them into buffer

Parameters:
amount - Number of queries
Returns:
Hashtable A map of query strings to IDs

addQuery

public java.util.Hashtable addQuery(java.lang.String queryFile)
Adds a query to the query queue

Parameters:
queryFile - a file containing XPath queries
Returns:
Hashtable a query string to id map

bindDoc

public java.util.Hashtable bindDoc(java.lang.String strFileName)
Enqueues an XML document or documents to the document queue

Returns:
Hashtable a filename to doc id (a hash of the XMLTree data structure) map

getResult

public java.lang.String getResult(int qid,
                                  int docID)
For a given query, returns the matched paths

Parameters:
docID - a doc hash or a doc id
Returns:
String

deleteQuery

public void deleteQuery(int qid)
Marks query for deletion. Query will be deleted from filter after the current document is processed.

Parameters:
qid - The query hash or query id

run

public void run()
Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread