Version: 1.1.1

org.biomoby.client
Class AsyncClient

java.lang.Object
  extended by org.biomoby.client.AsyncClient

public class AsyncClient
extends Object

Implements the client side of the asynchonous SOAP-based MOBY service invocation specification. Normally, given some input data, one would call sendRequest(), then poll() until the jobs are finished, then getResults(), then destroy().

Author:
Eddie Kawas, Paul Gordon

Field Summary
static String CONTENT_TYPE
           
static String MOBY_RESULT_PROPERTY_PREFIX
           
static String MOBY_SERVICE_INVOC_ID_TAG_NAME
           
static String USER_AGENT
           
static String WS_ADDRESSING_TO_TAG_NAME
           
static String WSRP_MULTI_PROPERTY_TAG_NAME
           
static String WSRP_PROPERTY_TAG_NAME
           
 
Constructor Summary
AsyncClient()
           
 
Method Summary
static void destroy(EndpointReference epr)
          Method to be called when all results have been retrieved from a service invocation, or if the client wishes the invocation to be prematurely terminated.
static MobyPackage getResultPackage(EndpointReference epr, String queryId)
           
static InputStream getResultStream(EndpointReference epr, Collection<String> queryIds)
           
static InputStream getResultStream(EndpointReference epr, String queryId)
           
static InputStream getResultStream(EndpointReference epr, String[] queryIds)
          Retrieves the result message for the given set of jobs in a service invocation.
static String getResultText(EndpointReference epr, Collection<String> queryIds)
           
static String getResultText(EndpointReference epr, String queryId)
          Retrieves the result text for the given set of jobs in a service invocation.
static String getResultText(EndpointReference epr, String[] queryIds)
           
static AnalysisEvent[] poll(EndpointReference epr, Collection<String> queryIds)
           
static AnalysisEvent poll(EndpointReference epr, String queryId)
           
static AnalysisEvent[] poll(EndpointReference epr, String[] queryIds)
          Polls the status (e.g. running, completed) of queries associated with a service invocation.
static EndpointReference sendRequest(MobyService service, MobyContentInstance contents)
           
static EndpointReference sendRequest(MobyService service, String xml)
           
static EndpointReference sendRequest(String serviceURL, String xml, String servicename)
          Initiates a request for service.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

USER_AGENT

public static final String USER_AGENT
See Also:
Constant Field Values

CONTENT_TYPE

public static final String CONTENT_TYPE
See Also:
Constant Field Values

WS_ADDRESSING_TO_TAG_NAME

public static final String WS_ADDRESSING_TO_TAG_NAME
See Also:
Constant Field Values

WSRP_MULTI_PROPERTY_TAG_NAME

public static final String WSRP_MULTI_PROPERTY_TAG_NAME
See Also:
Constant Field Values

WSRP_PROPERTY_TAG_NAME

public static final String WSRP_PROPERTY_TAG_NAME
See Also:
Constant Field Values

MOBY_SERVICE_INVOC_ID_TAG_NAME

public static final String MOBY_SERVICE_INVOC_ID_TAG_NAME
See Also:
Constant Field Values

MOBY_RESULT_PROPERTY_PREFIX

public static final String MOBY_RESULT_PROPERTY_PREFIX
See Also:
Constant Field Values
Constructor Detail

AsyncClient

public AsyncClient()
Method Detail

sendRequest

public static EndpointReference sendRequest(MobyService service,
                                            MobyContentInstance contents)
                                     throws Exception
Throws:
Exception

sendRequest

public static EndpointReference sendRequest(MobyService service,
                                            String xml)
                                     throws Exception
Throws:
Exception

sendRequest

public static EndpointReference sendRequest(String serviceURL,
                                            String xml,
                                            String servicename)
                                     throws Exception
Initiates a request for service. Followup with poll() to check the job's status.

Parameters:
serviceURL - the MOBY servioce endpoint URL for posting data
xml - the MOBY request payload (omit the starting XML declaration)
servicename - the unqualified name of the service
Returns:
the service invocation reference to be used in the followup methods
Throws:
Exception

poll

public static AnalysisEvent poll(EndpointReference epr,
                                 String queryId)
                          throws Exception
Throws:
Exception

poll

public static AnalysisEvent[] poll(EndpointReference epr,
                                   Collection<String> queryIds)
                            throws Exception
Throws:
Exception

poll

public static AnalysisEvent[] poll(EndpointReference epr,
                                   String[] queryIds)
                            throws Exception
Polls the status (e.g. running, completed) of queries associated with a service invocation. Completed queries can be retrieved using the getResultXXX() methods.

Parameters:
epr - a service invocation reference returned from sendRequest()
queryIds - the list of jobs about which a status update is being requested
Throws:
Exception

destroy

public static void destroy(EndpointReference epr)
                    throws Exception
Method to be called when all results have been retrieved from a service invocation, or if the client wishes the invocation to be prematurely terminated. Resources on the server that are associated with the endpoint are destroyed. No data is retrievable from the endpoint reference after this call.

Parameters:
epr - the service invocation whose server-side resources should be freed
Throws:
Exception

getResultPackage

public static MobyPackage getResultPackage(EndpointReference epr,
                                           String queryId)
                                    throws Exception
Throws:
Exception

getResultStream

public static InputStream getResultStream(EndpointReference epr,
                                          String queryId)
                                   throws Exception
Throws:
Exception

getResultStream

public static InputStream getResultStream(EndpointReference epr,
                                          Collection<String> queryIds)
                                   throws Exception
Throws:
Exception

getResultStream

public static InputStream getResultStream(EndpointReference epr,
                                          String[] queryIds)
                                   throws Exception
Retrieves the result message for the given set of jobs in a service invocation. This stream is parsed, for example, in MobyRequest for asynchronous service calls, and turned into a MobyContentInstance.

Returns:
an InputStream giving the raw HTTP (SOAP) response from the server
Throws:
Exception

getResultText

public static String getResultText(EndpointReference epr,
                                   String queryId)
                            throws Exception
Retrieves the result text for the given set of jobs in a service invocation.

Returns:
an string containing the raw HTTP (SOAP) response from the server
Throws:
Exception

getResultText

public static String getResultText(EndpointReference epr,
                                   Collection<String> queryIds)
                            throws Exception
Throws:
Exception

getResultText

public static String getResultText(EndpointReference epr,
                                   String[] queryIds)
                            throws Exception
Throws:
Exception

Version: 1.1.1

Submit a bug or feature
Generated: Sat May 29 04:26:35 EDT 2010