com.oopitis.weather.fio
Class FioWeather

java.lang.Object
  extended by com.oopitis.weather.WeatherService<GeoLocation,QueryHint,WeatherReport>
      extended by com.oopitis.weather.fio.FioWeather

public class FioWeather
extends WeatherService<GeoLocation,QueryHint,WeatherReport>

WeatherService implementation for forecast.io. See http://forecast.io for more information.

Supported Features:


Field Summary
static WeatherProperty<java.lang.String> Icon
          A machine-readable text summary of a data point.
 
Fields inherited from class com.oopitis.weather.WeatherService
Alert, ALERT, AlertDescription, AlertTitle, Astronomy, CloudCoverPercent, CONDITIONS, CONDITIONS_DAY, CONDITIONS_HOUR, CONDITIONS_MINUTE, DewPointCelsius, HumidityPercent, OzoneColumnarDensityDU, PrecipAccumCentimeter, PrecipForm, Precipitation, PrecipMaxMillimeterPerHour, PrecipMaxTime, PrecipMillimeterPerHour, PrecipProbabilityPercent, PressureHectopascal, SunriseTime, SunsetTime, TempCelsius, Temperature, TempMaxCelsius, TempMaxTime, TempMinCelsius, TempMinTime, UltravioletIndex, VisibilityKilometer, Wind, WindDirectionDegree, WindMeterPerSecond
 
Constructor Summary
protected FioWeather(FioData weatherData)
          Constructs a FioWeather object with a data source.
  FioWeather(java.lang.String apiKey)
          Constructs a FioWeather object.
  FioWeather(java.lang.String apiKey, java.net.Proxy proxy)
          Constructs a FioWeather object that retrieves data via a proxy.
 
Method Summary
 WeatherPropertySet getApplicableProperties(Feature f)
          Gets the set of properties applicable to a feature.
 java.util.Set<Feature> getBasicFeatures()
          Returns the set of features for which the weather reports are created when the query hint does not exist or does not specify properties of interest or features to include.
 java.util.Set<Feature> getSupportedFeatures()
          Gets all features this service supports.
 QueryHint newQueryHint()
          Creates a new query hint.
 java.util.List<WeatherReport> query(GeoLocation location, java.util.Date beginTime, QueryHint hint)
          Queries the data source about the weather in a location from a specific date onward.
 
Methods inherited from class com.oopitis.weather.WeatherService
getApplicableFeatures, listFeatures, print, query, query, query, query, query, subList, subList
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

Icon

public static final WeatherProperty<java.lang.String> Icon
A machine-readable text summary of a data point.

Constructor Detail

FioWeather

public FioWeather(java.lang.String apiKey)
Constructs a FioWeather object.

Parameters:
apiKey - the required API key
Throws:
java.lang.NullPointerException - if the given API key is null

FioWeather

public FioWeather(java.lang.String apiKey,
                  java.net.Proxy proxy)
Constructs a FioWeather object that retrieves data via a proxy.

Parameters:
apiKey - the required API key
proxy - the proxy
Throws:
java.lang.NullPointerException - if the given API key is null

FioWeather

protected FioWeather(FioData weatherData)
Constructs a FioWeather object with a data source.

Parameters:
weatherData - the data source
Throws:
java.lang.NullPointerException - if the given data source is null
Method Detail

query

public java.util.List<WeatherReport> query(GeoLocation location,
                                           java.util.Date beginTime,
                                           QueryHint hint)
Description copied from class: WeatherService
Queries the data source about the weather in a location from a specific date onward.

Specified by:
query in class WeatherService<GeoLocation,QueryHint,WeatherReport>
Parameters:
location - the location
beginTime - the first date of the reporting period; null if the report should start from the current date. This argument is mostly used to retrieve historical data. Since weather forecast cannot extend indefinitely, giving a future date far from now is impractical. To get forecast data for a future date, pass null for this argument, include appropriate features such as CONDITIONS_DAY, and use WeatherService.subList(List, Date, Date) to filter the reports. A service provider may ignore this argument if it cannot provide historical data.
hint - the query hint; null if the data from the basic features should be returned
Returns:
the weather in the given location in the given period of time

newQueryHint

public QueryHint newQueryHint()
Description copied from class: WeatherService
Creates a new query hint.

Specified by:
newQueryHint in class WeatherService<GeoLocation,QueryHint,WeatherReport>
Returns:
the new query hint

getSupportedFeatures

public java.util.Set<Feature> getSupportedFeatures()
Description copied from class: WeatherService
Gets all features this service supports.

Specified by:
getSupportedFeatures in class WeatherService<GeoLocation,QueryHint,WeatherReport>
Returns:
all features this service supports

getBasicFeatures

public java.util.Set<Feature> getBasicFeatures()
Description copied from class: WeatherService
Returns the set of features for which the weather reports are created when the query hint does not exist or does not specify properties of interest or features to include.

Specified by:
getBasicFeatures in class WeatherService<GeoLocation,QueryHint,WeatherReport>
Returns:
the basic features when the query hint does not specify any

getApplicableProperties

public WeatherPropertySet getApplicableProperties(Feature f)
Description copied from class: WeatherService
Gets the set of properties applicable to a feature.

Specified by:
getApplicableProperties in class WeatherService<GeoLocation,QueryHint,WeatherReport>
Parameters:
f - the feature
Returns:
the set of properties applicable to a feature
See Also:
Feature.getProperties(WeatherService)