uk.ac.ebi.intact.util
Class NewtServerProxy

java.lang.Object
  |
  +--uk.ac.ebi.intact.util.NewtServerProxy

public class NewtServerProxy
extends java.lang.Object

The proxy to the Newt server. An example for the use of this class:

 URL url = new URL("http://web7-node1.ebi.ac.uk:9120/newt/display");
 // The server to connect to.
 NewtServerProxy server = new NewtServerProxy(url);
 NewtServerProxy.NewtResponse response = server.query(45009);
 // response.getShortLabel() or response.getFullName().
 

Version:
$Id: NewtServerProxy.java,v 1.9 2003/11/12 17:54:53 smudali Exp $
Author:
Sugath Mudali (smudali@ebi.ac.uk)
See Also:
uk.ac.ebi.intact.util.test.NewtServerProxyTest

Nested Class Summary
static class NewtServerProxy.NewtResponse
           
static class NewtServerProxy.TaxIdNotFoundException
           
 
Field Summary
static int MAX_CACHED_ITEM
           
 
Constructor Summary
NewtServerProxy()
          Deafult constructor.
NewtServerProxy(java.net.URL url)
          Constructs an instance of this class using the URL to connect to the Newt server.
 
Method Summary
 void disableCaching()
           
 void enableCaching()
           
 void enableCaching(int maxElement)
           
 NewtServerProxy.NewtResponse query(int taxid)
          Queries the Newt server with given tax id.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAX_CACHED_ITEM

public static final int MAX_CACHED_ITEM
See Also:
Constant Field Values
Constructor Detail

NewtServerProxy

public NewtServerProxy()
                throws java.net.MalformedURLException
Deafult constructor. Uses the public newt url.

Throws:
java.net.MalformedURLException - for invalid URL. This should never happen.

NewtServerProxy

public NewtServerProxy(java.net.URL url)
Constructs an instance of this class using the URL to connect to the Newt server.

Parameters:
url - the URL to connect to the server.
Method Detail

enableCaching

public void enableCaching()

enableCaching

public void enableCaching(int maxElement)

disableCaching

public void disableCaching()

query

public NewtServerProxy.NewtResponse query(int taxid)
                                   throws java.io.IOException,
                                          NewtServerProxy.TaxIdNotFoundException
Queries the Newt server with given tax id.

Parameters:
taxid - the tax id to query the Newt server.
Returns:
an array with two elements. The first element contains the short label and the second contains the full name (scientific name). It is possible for the server to return empty values for both.
Throws:
java.io.IOException - for network errors.
NewtServerProxy.TaxIdNotFoundException - thrown when the server fails to find a response for tax id.
NewtServerProxy.TaxIdNotFoundException


IntAct Project - EMBL-EBI 2004 - intact-help@ebi.ac.uk