net.dontdrinkandroot.lastfm.api.ws
Class DefaultLastfmWebServices

java.lang.Object
  extended by net.dontdrinkandroot.lastfm.api.ws.AbstractLastfmWebServices
      extended by net.dontdrinkandroot.lastfm.api.ws.DefaultLastfmWebServices
All Implemented Interfaces:
LastfmWebServices

public class DefaultLastfmWebServices
extends AbstractLastfmWebServices


Field Summary
 
Fields inherited from class net.dontdrinkandroot.lastfm.api.ws.AbstractLastfmWebServices
logger
 
Constructor Summary
DefaultLastfmWebServices(java.lang.String key, java.lang.String secret)
          Set up the WebServices with the required components.
DefaultLastfmWebServices(java.lang.String key, java.lang.String secret, Cache cache)
          Set up the WebServices with the required components.
DefaultLastfmWebServices(java.lang.String key, java.lang.String secret, Cache cache, Fetcher fetcher)
           
 
Method Summary
protected  java.io.Serializable getFromCache(java.util.Map<java.lang.String,java.lang.String> parameters)
          Try to fetch the result from cache.
protected  java.io.Serializable putToCache(java.util.Map<java.lang.String,java.lang.String> parameters, java.io.Serializable result, long timeToLive)
          Store result in cache.
 
Methods inherited from class net.dontdrinkandroot.lastfm.api.ws.AbstractLastfmWebServices
execute, fetch, fetch, getApiKey, getApiSecret, getFetcher, setFetcher, setTimeToLive
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultLastfmWebServices

public DefaultLastfmWebServices(java.lang.String key,
                                java.lang.String secret)
                         throws javax.xml.parsers.ParserConfigurationException
Set up the WebServices with the required components.

Parameters:
key - The last.fm API key, see http://www.last.fm/api/account
secret - The last.fm API secret, see http://www.last.fm/api/account
Throws:
javax.xml.parsers.ParserConfigurationException

DefaultLastfmWebServices

public DefaultLastfmWebServices(java.lang.String key,
                                java.lang.String secret,
                                Cache cache)
                         throws javax.xml.parsers.ParserConfigurationException
Set up the WebServices with the required components.

Parameters:
key - The last.fm API key, see http://www.last.fm/api/account
secret - The last.fm API secret, see http://www.last.fm/api/account
cache - The cache implementation
Throws:
javax.xml.parsers.ParserConfigurationException

DefaultLastfmWebServices

public DefaultLastfmWebServices(java.lang.String key,
                                java.lang.String secret,
                                Cache cache,
                                Fetcher fetcher)
Method Detail

getFromCache

protected java.io.Serializable getFromCache(java.util.Map<java.lang.String,java.lang.String> parameters)
Try to fetch the result from cache.

Specified by:
getFromCache in class AbstractLastfmWebServices
Parameters:
id - Id to lookup.
Returns:
The entry if found or null.

putToCache

protected java.io.Serializable putToCache(java.util.Map<java.lang.String,java.lang.String> parameters,
                                          java.io.Serializable result,
                                          long timeToLive)
Store result in cache.

Specified by:
putToCache in class AbstractLastfmWebServices
Parameters:
id - The id to store the entry for.
result - The query result.
timeToLive - The time to live for the cache entry.
Returns:
The cached result or the original result on caching errors.


Copyright © 2013 dontdrinkandroot. All Rights Reserved.