gov.usgs.earthquake.event
Class EventWebService

java.lang.Object
  extended by gov.usgs.earthquake.event.EventWebService

public class EventWebService
extends java.lang.Object

A wrapper around the Event Web Service.


Constructor Summary
EventWebService(java.net.URL serviceURL)
          Construct an EventWebService.
 
Method Summary
 java.util.List<JsonEvent> getEvents(EventQuery query)
          Request events from the event web service.
 java.net.URL getServiceUrl()
           
 java.net.URL getUrl(EventQuery query, Format format)
          Convert an EventQuery object into an EventWebService URL, using a specific return format.
protected  java.util.List<JsonEvent> parseJsonEventCollection(java.io.InputStream input)
          Parse the response from event web service into an array of JSONEvent objects.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EventWebService

public EventWebService(java.net.URL serviceURL)
Construct an EventWebService.

Parameters:
serviceURL -
Method Detail

getUrl

public java.net.URL getUrl(EventQuery query,
                           Format format)
                    throws java.net.MalformedURLException
Convert an EventQuery object into an EventWebService URL, using a specific return format.

Parameters:
query - the query.
format - the format.
Returns:
a URL for query and format.
Throws:
java.net.MalformedURLException

getEvents

public java.util.List<JsonEvent> getEvents(EventQuery query)
                                    throws java.lang.Exception
Request events from the event web service.

Parameters:
query - query describing events to return.
Returns:
list of events.
Throws:
java.lang.Exception - if any occur.

parseJsonEventCollection

protected java.util.List<JsonEvent> parseJsonEventCollection(java.io.InputStream input)
                                                      throws java.lang.Exception
Parse the response from event web service into an array of JSONEvent objects.

Parameters:
input - input stream response from event web service.
Returns:
list of parsed events
Throws:
java.lang.Exception - if format is unexpected.

getServiceUrl

public java.net.URL getServiceUrl()