edu.iastate.jtm.jmed
Class EUtility

java.lang.Object
  extended by edu.iastate.jtm.jmed.EUtility
Direct Known Subclasses:
EFetch, ELink, EPost, ESearch

public abstract class EUtility
extends java.lang.Object

An abstract superclass for eSearch, eFetch, eLink, ...
It deals with the common issues for all services, such as min request interval, response parsing, service job queueing...
Subclasses (ESearch, ELink, EFetch, etc.) focus on dealing with user input and output of specific services.
In replace of PubMedQuerier, PubMedFetcher, PubMedTimer.

Author:
Jing Ding edu.iastate.jtm.jmed jtm

Nested Class Summary
protected static interface EUtility.Processor
          A processor is responsible for processing the response of a service.
 
Field Summary
protected  java.lang.String database
           
protected  EUtility.Processor defaultProcessor
          A processor that parses the response into a DOM document.
protected static java.util.logging.Logger logger
           
static int MAX_IDS
          Maximum number of IDs that can be sent in a URL.
protected  java.lang.Boolean resultReady
           
protected  boolean showOriginal
           
protected  org.dom4j.io.SAXReader xmlParser
           
protected  org.dom4j.Document xmlResult
           
protected  org.dom4j.io.XMLWriter xmlWriter
           
 
Constructor Summary
EUtility(java.lang.String base, java.lang.String email, java.lang.String tool)
           
 
Method Summary
protected  void addJob(java.lang.String parameter, EUtility.Processor processor, boolean waitForResult)
          Entry point for subclasses.
 void setDatabase(int db)
           
 void setShowOriginal(boolean show)
           
 void setXmlParser(org.dom4j.io.SAXReader parser)
           
 void setXmlWriter(org.dom4j.io.XMLWriter writer)
           
static void startService()
          Start processing job queue.
static void stopService(boolean dropAllJobs)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAX_IDS

public static final int MAX_IDS
Maximum number of IDs that can be sent in a URL.

See Also:
Constant Field Values

logger

protected static java.util.logging.Logger logger

xmlParser

protected org.dom4j.io.SAXReader xmlParser

xmlWriter

protected org.dom4j.io.XMLWriter xmlWriter

showOriginal

protected boolean showOriginal

resultReady

protected java.lang.Boolean resultReady

database

protected java.lang.String database

xmlResult

protected org.dom4j.Document xmlResult

defaultProcessor

protected EUtility.Processor defaultProcessor
A processor that parses the response into a DOM document.

Constructor Detail

EUtility

public EUtility(java.lang.String base,
                java.lang.String email,
                java.lang.String tool)
Method Detail

startService

public static void startService()
Start processing job queue.


stopService

public static void stopService(boolean dropAllJobs)

setDatabase

public void setDatabase(int db)

setXmlParser

public void setXmlParser(org.dom4j.io.SAXReader parser)

setXmlWriter

public void setXmlWriter(org.dom4j.io.XMLWriter writer)

setShowOriginal

public void setShowOriginal(boolean show)

addJob

protected void addJob(java.lang.String parameter,
                      EUtility.Processor processor,
                      boolean waitForResult)
Entry point for subclasses. A subclass prepares user input as a parameter string, and add it to the job queue. The default processor can be used for parsing the response into a DOM document.

Parameters:
parameter -
processor -
waitForResult -