weather_service.weatherprovider
Class WeatherGateway
java.lang.Object
weather_service.weatherprovider.WeatherGateway
public class WeatherGateway
- extends java.lang.Object
Gateway to the weather.com XML Data Feed. Performs its own caching,
in compliance with the mandatory refresh rates in the weather.com
implementation guide.
Field Summary |
protected static org.apache.commons.logging.Log |
LOG
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
LOG
protected static org.apache.commons.logging.Log LOG
WeatherGateway
public WeatherGateway(WeatherConfigurationIF config)
getDefaultInstance
public static WeatherGateway getDefaultInstance()
setUIHook
public void setUIHook(Task.ProgressMonitor.UIHookAdapter hook)
searchForLocations
public SearchLocations searchForLocations(java.lang.String where)
throws WeatherError,
java.io.IOException
- Throws:
WeatherError
java.io.IOException
doSearchQuery
protected SearchLocations doSearchQuery(org.apache.commons.httpclient.NameValuePair[] queryString)
throws WeatherError,
java.io.IOException
- Throws:
WeatherError
java.io.IOException
getFullForecast
public WeatherReport getFullForecast(java.lang.String locationID,
int forecastLength)
throws WeatherError,
java.io.IOException
- Throws:
WeatherError
java.io.IOException
getLocation
public WeatherReport getLocation(java.lang.String locationID)
throws WeatherError,
java.io.IOException
- Throws:
WeatherError
java.io.IOException
getCurrentConditions
public WeatherReport getCurrentConditions(java.lang.String locationID)
throws WeatherError,
java.io.IOException
- Throws:
WeatherError
java.io.IOException
getCurrentConditions
public WeatherReport getCurrentConditions(java.lang.String locationID,
boolean metricSystem)
throws java.io.IOException,
WeatherError
- Throws:
java.io.IOException
WeatherError
getForecast
public WeatherReport getForecast(java.lang.String locationID,
int forecastLength)
throws java.io.IOException,
WeatherError
- Throws:
java.io.IOException
WeatherError
getForecast
public WeatherReport getForecast(java.lang.String locationID,
int forecastLength,
boolean metricSystem)
throws java.io.IOException,
WeatherError
- Throws:
java.io.IOException
WeatherError
setDefaultMetricSystem
public void setDefaultMetricSystem(boolean defaultMetricSystem)
doWeatherQuery
protected WeatherReport doWeatherQuery(java.lang.String locationID,
long allowedAge,
org.apache.commons.httpclient.NameValuePair[] query)
throws WeatherError,
java.io.IOException
- this method actually performs the "local" query against the weather.com server.
the response is an XML document with the element and data, or an elment and errors.
It should not return an empty document - if it does, then an a WeatherError.WEATHER_PARSING_ERROR will be thrown.
If there is a problem getting this call over the network, then an IOException is thrown.
- Throws:
WeatherError
java.io.IOException
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object