|
||||||||||
| 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.fio.FioData<T>
T - the type of the parsed JSON data from forecast.iopublic abstract class FioData<T>
Helper class for retrieving data from forecast.io. This class is kept abstract to allow the use of a different JSON parser.
| Nested Class Summary | |
|---|---|
static class |
FioData.BlockType
The data block types. |
static interface |
FioData.DataBlock
This is roughly a Data Block object described by forecast.io. |
static interface |
FioData.DataPoint
Data access interface that accepts a forecast.io property name or a WeatherProperty object. |
static interface |
FioData.Response
The full forecast.io response. |
| Nested classes/interfaces inherited from class com.oopitis.weather.URLDataSource |
|---|
URLDataSource.FetchException |
| Field Summary | |
|---|---|
protected java.lang.String |
baseUrl
The base URL, which is "https://api.forecast.io/forecast/<licenseKey>/". |
| Fields inherited from class com.oopitis.weather.URLDataSource |
|---|
licenseKey |
| Constructor Summary | |
|---|---|
protected |
FioData(java.lang.String apiKey,
java.net.Proxy proxy)
Constructs a data source with an API key. |
| Method Summary | |
|---|---|
WeatherPropertySet |
getApplicableProperties(Feature f)
Returns the set of applicable properties for a feature. |
protected java.lang.String |
getFioPropertyName(WeatherProperty p)
Gets the corresponding forecast.io property name for a weather property. |
abstract FioData.Response |
getResponse(GeoLocation location,
java.util.Date beginTime,
java.util.Set<Feature> features)
Returns the parsed, organized data ready for report creation. |
protected java.lang.String |
getUrl(GeoLocation.Coordinates c,
java.util.Date beginTime,
java.util.Set<Feature> features)
Constructs a URL based on a location, time and set of features. |
protected abstract T |
parse(java.io.BufferedReader reader)
Parses the data from a reader and returns the parsed data. |
| Methods inherited from class com.oopitis.weather.URLDataSource |
|---|
fetch, setProxy |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected final java.lang.String baseUrl
"https://api.forecast.io/forecast/<licenseKey>/".
| Constructor Detail |
|---|
protected FioData(java.lang.String apiKey,
java.net.Proxy proxy)
apiKey - the required API keyproxy - the proxy; null if a direct connection should be used
java.lang.NullPointerException - if the given API key is null| Method Detail |
|---|
protected abstract T parse(java.io.BufferedReader reader)
URLDataSource
parse in class URLDataSource<T>reader - the reader that supplies the raw data
URLDataSource.fetch(String)
protected java.lang.String getUrl(GeoLocation.Coordinates c,
java.util.Date beginTime,
java.util.Set<Feature> features)
units is always si.
c - the coordinates of the locationbeginTime - the begin time; null if the begin time is
the current time. Note that if the begin time is
null, no time is included in the query.features - the set of features; null if all features
should be included
protected java.lang.String getFioPropertyName(WeatherProperty p)
p - the weather property
null if
no corresponding property is foundpublic WeatherPropertySet getApplicableProperties(Feature f)
f - the feature
public abstract FioData.Response getResponse(GeoLocation location,
java.util.Date beginTime,
java.util.Set<Feature> features)
location - the locationbeginTime - the begin time;null if the time portion of
the request URL is not neededfeatures - the set of features
getUrl(com.oopitis.weather.GeoLocation.Coordinates, java.util.Date, java.util.Set)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||