|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.dontdrinkandroot.lastfm.api.ws.AbstractLastfmWebServices
public abstract class AbstractLastfmWebServices
| Field Summary | |
|---|---|
protected org.slf4j.Logger |
logger
Our logger. |
| Constructor Summary | |
|---|---|
AbstractLastfmWebServices(java.lang.String key,
java.lang.String secret)
Set up the WebServices with the required components. |
|
AbstractLastfmWebServices(java.lang.String key,
java.lang.String secret,
Fetcher fetcher)
|
|
| Method Summary | ||
|---|---|---|
|
execute(PostQuery<T> query)
Execute an authenticated POST Query. |
|
|
fetch(AuthenticatedGetQuery<T> query)
Fetch an authenticated GET Query. |
|
|
fetch(UnauthenticatedGetQuery<T> query)
Fetch an unauthenticated GET Query. |
|
java.lang.String |
getApiKey()
Get the current api key. |
|
java.lang.String |
getApiSecret()
Get the current api secret. |
|
Fetcher |
getFetcher()
Get the current fetcher. |
|
protected abstract java.io.Serializable |
getFromCache(java.lang.String id)
Try to fetch the result from cache. |
|
protected abstract java.io.Serializable |
putToCache(java.lang.String id,
java.io.Serializable result,
long timeToLive)
Store result in cache. |
|
void |
setFetcher(Fetcher fetcher)
Sets the current fetcher. |
|
void |
setTimeToLive(java.util.Properties ttls)
You can specify how long the data of each method should be cached. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected final org.slf4j.Logger logger
| Constructor Detail |
|---|
public AbstractLastfmWebServices(java.lang.String key,
java.lang.String secret)
throws javax.xml.parsers.ParserConfigurationException
key - The last.fm API key, see http://www.last.fm/api/accountsecret - The last.fm API secret, see http://www.last.fm/api/accountcache - The cache implementation
javax.xml.parsers.ParserConfigurationException
public AbstractLastfmWebServices(java.lang.String key,
java.lang.String secret,
Fetcher fetcher)
| Method Detail |
|---|
public final <T extends java.io.Serializable> T fetch(AuthenticatedGetQuery<T> query)
throws LastfmWebServicesException
LastfmWebServices
fetch in interface LastfmWebServicesT - The return type of the Query.query - The query.
LastfmWebServicesException - If fetching the Query fails.
public final <T extends java.io.Serializable> T execute(PostQuery<T> query)
throws LastfmWebServicesException
LastfmWebServices
execute in interface LastfmWebServicesT - The return type of the query.query - The query.
LastfmWebServicesException - If executing the Query fails.
public final <T extends java.io.Serializable> T fetch(UnauthenticatedGetQuery<T> query)
throws LastfmWebServicesException
LastfmWebServices
fetch in interface LastfmWebServicesT - The return type of the query.query - The query.
LastfmWebServicesException - If fetching the Query fails.public final java.lang.String getApiSecret()
LastfmWebServices
getApiSecret in interface LastfmWebServicespublic final java.lang.String getApiKey()
LastfmWebServices
getApiKey in interface LastfmWebServicespublic Fetcher getFetcher()
LastfmWebServices
getFetcher in interface LastfmWebServicesFetcher responsible for fetching the data.public void setFetcher(Fetcher fetcher)
LastfmWebServices
setFetcher in interface LastfmWebServicespublic final void setTimeToLive(java.util.Properties ttls)
artist.getinfo = 2419200000A special entry is exception, this is used to cache exceptions.
ttls - Properties containing method time to lives.protected abstract java.io.Serializable getFromCache(java.lang.String id)
T - Return type of the query.id - Id to lookup.
protected abstract java.io.Serializable putToCache(java.lang.String id,
java.io.Serializable result,
long timeToLive)
T - Return type of the query.id - The id to store the entry for.result - The query result.timeToLive - The time to live for the cache entry in milliseconds.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||