org.eaglei.search.provider.ncbi
Class EUtils

java.lang.Object
  extended by org.eaglei.search.provider.ncbi.EUtils
Direct Known Subclasses:
EFetch, ESearch, ESummary

public class EUtils
extends java.lang.Object

Contains logic for using NCBI EUtils. TODO: try to switch to the SOAP-based interface via axis2 or an equivalent framework

Author:
rfrost

Field Summary
static java.lang.String DB
           
static java.lang.String EUTILS_URL
           
static java.lang.String ID
           
static java.lang.String ID_PARAM
           
static java.lang.String IDLIST
           
static java.lang.String RETMAX
           
static java.lang.String RETMODE
           
static java.lang.String RETSTART
           
static java.lang.String TERM
           
static java.lang.String TOOL
           
 
Constructor Summary
EUtils()
           
 
Method Summary
static java.lang.String buildServiceURL(java.lang.String serviceURL, java.util.List<java.lang.String> ids, java.lang.String db, int max, java.lang.String tool)
          Builds a query URL for executing an eUtils service that retrieves information for a set of IDs.
static org.w3c.dom.Document executeNCBIRequest(java.lang.String url)
          Executes an NCBI request at the specified eUtils URL and returns the XML response as a DOM Document
static java.lang.String serializeDocument(org.w3c.dom.Document doc)
          Utility method to serialize an XML document.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EUTILS_URL

public static final java.lang.String EUTILS_URL
See Also:
Constant Field Values

DB

public static final java.lang.String DB
See Also:
Constant Field Values

TERM

public static final java.lang.String TERM
See Also:
Constant Field Values

RETMAX

public static final java.lang.String RETMAX
See Also:
Constant Field Values

RETSTART

public static final java.lang.String RETSTART
See Also:
Constant Field Values

TOOL

public static final java.lang.String TOOL
See Also:
Constant Field Values

ID_PARAM

public static final java.lang.String ID_PARAM
See Also:
Constant Field Values

RETMODE

public static final java.lang.String RETMODE
See Also:
Constant Field Values

IDLIST

public static final java.lang.String IDLIST
See Also:
Constant Field Values

ID

public static final java.lang.String ID
See Also:
Constant Field Values
Constructor Detail

EUtils

public EUtils()
Method Detail

executeNCBIRequest

public static org.w3c.dom.Document executeNCBIRequest(java.lang.String url)
                                               throws java.io.IOException
Executes an NCBI request at the specified eUtils URL and returns the XML response as a DOM Document

Parameters:
url - eUtils URL with all params.
Returns:
Response as DOM Document.
Throws:
java.io.IOException - Thrown if there is an error.

buildServiceURL

public static java.lang.String buildServiceURL(java.lang.String serviceURL,
                                               java.util.List<java.lang.String> ids,
                                               java.lang.String db,
                                               int max,
                                               java.lang.String tool)
Builds a query URL for executing an eUtils service that retrieves information for a set of IDs.

Parameters:
serviceURL - Base URL for the service
ids - IDs of artifacts whose information is being retrieved
db - The target db
max - Max number of results
tool - The source tool
Returns:
Query URL.

serializeDocument

public static java.lang.String serializeDocument(org.w3c.dom.Document doc)
Utility method to serialize an XML document.

Parameters:
doc - The DOM document.
Returns:
String serialization.


Copyright © 2009-2011 Eagle-I. All Rights Reserved.