Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 13 Next »

Weather Providers

The weather portlet ships with two different weather data providers, Yahoo Weather and World Weather Online. Both services require an API key which can be retrieved by a self-service registration process.

Yahoo Weather

World Weather Online

  • Free to both non-commercial and commercial users
  • Requires a key for both weather and location lookups
  • Requires 15 minute caching of each feed (already the weather portlet's default caching strategy)
  • Limit of 500 requests / hour
  • Provides forecasts several days into the future (configurable)
  • API key requests at http://www.worldweatheronline.com/register.aspx

Configuring the Provider

Maven Overlay

The weather portlet has been included in uPortal since 3.2 via an overlay.

Add overlayContext.xml file in the overlay project:

WeatherPortlet
├── pom.xml
└── src
    └── main
        └── webapp
            └── WEB-INF
                └── context
                    └── overlay
                        └── overlayContext.xml

Un-comment the provider you want to use in the overlayContext.xml file and specify the API key for the service.

overlayContext.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:lang="http://www.springframework.org/schema/lang"
    xsi:schemaLocation="http://www.springframework.org/schema/lang http://www.springframework.org/schema/lang/spring-lang-2.5.xsd
		http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
    
    <!-- WWO 
    <bean id="weatherDaoImpl" class="org.jasig.portlet.weather.dao.worldwide.WorldWeatherOnlineDaoImpl">
        <property name="key" value="YOURKEY"/>
        <property name="imageMapping"><value>classpath:wwo-image-mapping.properties</value></property>
    </bean>
     -->
        
    <!-- Yahoo Weather
    <bean id="weatherDaoImpl" class="org.jasig.portlet.weather.dao.yahoo.YahooWeatherDaoImpl">
        <property name="key" value="YOURKEY"/>
        <property name="weatherParsingService" ref="weatherParsingService"/>
        <property name="locationParsingService" ref="locationParsingService"/>
    </bean>
    
    <lang:groovy id="weatherParsingService"
        script-source="classpath:org/jasig/portlet/weather/dao/yahoo/YahooWeatherParsingServiceImpl.groovy"/>

    <lang:groovy id="locationParsingService"
        script-source="classpath:org/jasig/portlet/weather/dao/yahoo/YahooLocationParsingServiceImpl.groovy"/>
         -->
</beans>

Custom WeatherPortlet Build

The overlayContext.xml file is included in the WeatherPortlet release in the location referenced above. Just edit this file as instructed above.

  • No labels