com.oopitis.weather.owm
Class OwmWeather

java.lang.Object
  extended by com.oopitis.weather.WeatherService<GeoLocation,OwmQueryHint,WeatherReport>
      extended by com.oopitis.weather.owm.OwmWeather

public class OwmWeather
extends WeatherService<GeoLocation,OwmQueryHint,WeatherReport>

WeathherService implementation for Open Weather Map. See http://openweathermap.org for more information.

Supported Features:


Field Summary
static Feature CONDITIONS_14DAYS
          Weather conditions for the next 14 days.
static Feature CONDITIONS_MULTILOCATION
          This feature corresponds to the "city search" function.
static WeatherPropertySet DailyTemperature
          A property set that contains the following properties: TempMorningCelsius TempDayCelsius TempEveningCelsius TempNightCelsius
protected  OwmData data
          The data source.
static WeatherProperty<java.lang.Float> TempDayCelsius
          Daytime temperature.
static WeatherProperty<java.lang.Float> TempEveningCelsius
          Evening temperature.
static WeatherProperty<java.lang.Float> TempMorningCelsius
          Morning temperature.
static WeatherProperty<java.lang.Float> TempNightCelsius
          Nighttime temperature.
static WeatherProperty<OwmSummary> WeatherSummary
          This property corresponds to the weather object in the data.
 
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
  OwmWeather()
          Constructs an OwmWeather object.
protected OwmWeather(OwmData data)
          Constructs an OwmWeather with a data source.
  OwmWeather(java.lang.String apiKey)
          Constructs an OwmWeather object with an API key.
  OwmWeather(java.lang.String apiKey, java.net.Proxy proxy)
          Constructs an OwmWeather object with an API key and a network 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.
 OwmQueryHint newQueryHint()
          Creates a new query hint.
 java.util.List<WeatherReport> query(GeoLocation location, java.util.Date beginTime, OwmQueryHint hint)
          Queries the data source about the weather in a location.
 
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

CONDITIONS_MULTILOCATION

public static final Feature CONDITIONS_MULTILOCATION
This feature corresponds to the "city search" function.


CONDITIONS_14DAYS

public static final Feature CONDITIONS_14DAYS
Weather conditions for the next 14 days.


WeatherSummary

public static final WeatherProperty<OwmSummary> WeatherSummary
This property corresponds to the weather object in the data.


TempDayCelsius

public static final WeatherProperty<java.lang.Float> TempDayCelsius
Daytime temperature.


TempNightCelsius

public static final WeatherProperty<java.lang.Float> TempNightCelsius
Nighttime temperature.


TempEveningCelsius

public static final WeatherProperty<java.lang.Float> TempEveningCelsius
Evening temperature.


TempMorningCelsius

public static final WeatherProperty<java.lang.Float> TempMorningCelsius
Morning temperature.


DailyTemperature

public static final WeatherPropertySet DailyTemperature
A property set that contains the following properties:
  1. TempMorningCelsius
  2. TempDayCelsius
  3. TempEveningCelsius
  4. TempNightCelsius


data

protected final OwmData data
The data source.

Constructor Detail

OwmWeather

public OwmWeather()
Constructs an OwmWeather object.


OwmWeather

public OwmWeather(java.lang.String apiKey)
Constructs an OwmWeather object with an API key.

Parameters:
apiKey - the API key

OwmWeather

public OwmWeather(java.lang.String apiKey,
                  java.net.Proxy proxy)
Constructs an OwmWeather object with an API key and a network proxy.

Parameters:
apiKey - the API key
proxy - the proxy

OwmWeather

protected OwmWeather(OwmData data)
Constructs an OwmWeather with a data source.

Parameters:
data - 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,
                                           OwmQueryHint hint)
Queries the data source about the weather in a location.

Specified by:
query in class WeatherService<GeoLocation,OwmQueryHint,WeatherReport>
Parameters:
location - the location
beginTime - this argument is not supported.
hint - the query hint; null if the data from the basic features should be returned
Returns:
the weather in the given location
Throws:
java.lang.NullPointerException - if the given location is null

newQueryHint

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

Specified by:
newQueryHint in class WeatherService<GeoLocation,OwmQueryHint,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,OwmQueryHint,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,OwmQueryHint,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,OwmQueryHint,WeatherReport>
Parameters:
f - the feature
Returns:
the set of properties applicable to a feature
See Also:
Feature.getProperties(WeatherService)