org.jasig.portlet.weather.dao.accuweather.xstream
Class WeatherDaoImpl

java.lang.Object
  extended by org.jasig.portlet.weather.dao.accuweather.xstream.WeatherDaoImpl
All Implemented Interfaces:
net.sf.ehcache.constructs.blocking.CacheEntryFactory, IWeatherDao, org.springframework.beans.factory.DisposableBean, org.springframework.beans.factory.InitializingBean

@Repository
public class WeatherDaoImpl
extends java.lang.Object
implements IWeatherDao, org.springframework.beans.factory.DisposableBean, org.springframework.beans.factory.InitializingBean, net.sf.ehcache.constructs.blocking.CacheEntryFactory

AccuWeather.com weather data implementation using Xstream to parse XML.

Version:
$Id$
Author:
Dustin Schultz

Constructor Summary
WeatherDaoImpl()
           
 
Method Summary
 void afterPropertiesSet()
           
protected  void checkCachedException(java.util.Map<java.lang.String,java.lang.Object> key)
           
 java.lang.Object createEntry(java.lang.Object o)
           
 void destroy()
           
 java.util.Collection<Location> find(java.lang.String location)
           
protected  java.lang.Object getAndDeserialize(java.lang.String url, com.thoughtworks.xstream.XStream deserializer)
           
 Weather getWeather(java.lang.String locationCode, TemperatureUnit unit)
          Gets the weather from an implemented source.
 void setConnectionTimeout(int connectionTimeout)
           
 void setReadTimeout(int readTimeout)
           
 void setTimesToRetry(int timesToRetry)
           
 void setWeatherDataCache(net.sf.ehcache.Ehcache ehcache)
           
 void setWeatherDataErrorCache(net.sf.ehcache.Ehcache weatherDataErrorCache)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WeatherDaoImpl

public WeatherDaoImpl()
Method Detail

setConnectionTimeout

public void setConnectionTimeout(int connectionTimeout)

setReadTimeout

public void setReadTimeout(int readTimeout)

setTimesToRetry

public void setTimesToRetry(int timesToRetry)

setWeatherDataCache

public void setWeatherDataCache(net.sf.ehcache.Ehcache ehcache)

setWeatherDataErrorCache

public void setWeatherDataErrorCache(net.sf.ehcache.Ehcache weatherDataErrorCache)

afterPropertiesSet

public void afterPropertiesSet()
                        throws java.lang.Exception
Specified by:
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
Throws:
java.lang.Exception

destroy

public void destroy()
             throws java.lang.Exception
Specified by:
destroy in interface org.springframework.beans.factory.DisposableBean
Throws:
java.lang.Exception

find

public java.util.Collection<Location> find(java.lang.String location)
Specified by:
find in interface IWeatherDao
Parameters:
location - A String representing a location to find
Returns:
A collection of locations representing the possible location or an empty or null collection representing location not found.

createEntry

public java.lang.Object createEntry(java.lang.Object o)
                             throws java.lang.Exception
Specified by:
createEntry in interface net.sf.ehcache.constructs.blocking.CacheEntryFactory
Throws:
java.lang.Exception

getWeather

public Weather getWeather(java.lang.String locationCode,
                          TemperatureUnit unit)
Description copied from interface: IWeatherDao
Gets the weather from an implemented source.

Specified by:
getWeather in interface IWeatherDao
Parameters:
locationCode - A string value representing the location to retrieve weather from.
Returns:
A Weather object representing the current weather and an optional forecast.

checkCachedException

protected void checkCachedException(java.util.Map<java.lang.String,java.lang.Object> key)

getAndDeserialize

protected java.lang.Object getAndDeserialize(java.lang.String url,
                                             com.thoughtworks.xstream.XStream deserializer)


Copyright © 2009 Jasig. All Rights Reserved.