|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.oopitis.weather.URLDataSource<T>
com.oopitis.weather.owm.OwmData<T>
public abstract class OwmData<T>
Helper class to retrieve data from openweathermap.org. This class is kept abstract to allow the use of a different parser.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class com.oopitis.weather.URLDataSource |
|---|
URLDataSource.FetchException |
| Field Summary |
|---|
| Fields inherited from class com.oopitis.weather.URLDataSource |
|---|
licenseKey |
| Constructor Summary | |
|---|---|
protected |
OwmData(java.lang.String apiKey,
java.net.Proxy proxy)
Constructs a data source with an API key and a network proxy. |
| Method Summary | |
|---|---|
WeatherPropertySet |
getApplicableProperties(Feature f)
Returns the applicable properties associated with a feature. |
protected java.lang.String |
getBaseUrl()
Gets the base URL; for example, "http://api.openweathermap.org/data/2.5/". |
protected abstract WeatherReport |
getCurrentConditions(GeoLocation loc,
OwmQueryHint.Language lang)
Gets the current weather conditions for a location. |
protected abstract java.util.List<WeatherReport> |
getDailyConditions(GeoLocation loc,
OwmQueryHint.Language lang,
java.lang.Integer numOfDays)
Gets daily weather conditions for a location. |
protected abstract java.util.List<WeatherReport> |
getHourlyConditions(GeoLocation loc,
OwmQueryHint.Language lang)
Gets hourly weather conditions for a location. |
protected abstract java.util.List<WeatherReport> |
getMultiLocationConditions(GeoLocation loc,
OwmQueryHint.Language lang)
Gets weather conditions for multiple locations. |
protected java.lang.String |
getUrlCurrent(GeoLocation loc,
OwmQueryHint.Language lang)
Constructs a URL for retrieving the current weather data. |
protected java.lang.String |
getUrlDaily(GeoLocation loc,
OwmQueryHint.Language lang,
java.lang.Integer numOfDays)
Constructs a URL for retrieving daily weather data up to 14 days. |
protected java.lang.String |
getUrlHourly(GeoLocation loc,
OwmQueryHint.Language lang)
Constructs a URL for retrieving hourly (actually every 3 hours) weather data. |
protected java.lang.String |
getUrlMultiLocation(GeoLocation loc,
OwmQueryHint.Language lang)
Constructs a URL for retrieving weather data from multiple locations. |
protected OwmLocation |
newOwmLocation(java.lang.Long id,
java.lang.String city,
java.lang.String countryCodeOrName,
GeoLocation.Coordinates coordinates)
Creates a location object to be used in a report. |
protected abstract boolean |
xmlMode()
Returns true if the data requested from openwewathermap.org should be in XML; otherwise the data will be in JSON format. |
| Methods inherited from class com.oopitis.weather.URLDataSource |
|---|
fetch, parse, setProxy |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
protected OwmData(java.lang.String apiKey,
java.net.Proxy proxy)
apiKey - the API keyproxy - the network proxy| Method Detail |
|---|
protected java.lang.String getBaseUrl()
protected java.lang.String getUrlCurrent(GeoLocation loc,
OwmQueryHint.Language lang)
loc - the locationlang - the language; null to use the default
protected java.lang.String getUrlHourly(GeoLocation loc,
OwmQueryHint.Language lang)
loc - the locationlang - the language; null to use the default
protected java.lang.String getUrlDaily(GeoLocation loc,
OwmQueryHint.Language lang,
java.lang.Integer numOfDays)
loc - the locationlang - the language; null to use the defaultnumOfDays - the number of days ranging from 1 to 14;
null to use the default
java.lang.IllegalArgumentException - if the number of days is out of range
protected java.lang.String getUrlMultiLocation(GeoLocation loc,
OwmQueryHint.Language lang)
loc - the common attributes of the locationslang - the language; null to use the default
protected OwmLocation newOwmLocation(java.lang.Long id,
java.lang.String city,
java.lang.String countryCodeOrName,
GeoLocation.Coordinates coordinates)
id - the city IDcity - the city namecountryCodeOrName - the two-letter country code or full country namecoordinates - the latitude and longitude
public WeatherPropertySet getApplicableProperties(Feature f)
f - the feature
protected abstract boolean xmlMode()
URLDataSource.parse(BufferedReader)
protected abstract WeatherReport getCurrentConditions(GeoLocation loc,
OwmQueryHint.Language lang)
loc - the locationlang - the language; null to use the default
protected abstract java.util.List<WeatherReport> getHourlyConditions(GeoLocation loc,
OwmQueryHint.Language lang)
loc - the locationlang - the language; null to use the default
protected abstract java.util.List<WeatherReport> getDailyConditions(GeoLocation loc,
OwmQueryHint.Language lang,
java.lang.Integer numOfDays)
loc - the locationlang - the language; null to use the defaultnumOfDays - the number of days ranging from 1 to 14; null
to use the default
java.lang.IllegalArgumentException - if the number of days is out of range
protected abstract java.util.List<WeatherReport> getMultiLocationConditions(GeoLocation loc,
OwmQueryHint.Language lang)
loc - the common attributes of the locationslang - the language; null to use the default
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||