Description
This plugin will retrieve the weather forecast for a given weather station code and make it available for display in your templates. Values for temperature, wind, visibility, etc are available.
Availability
This plugin is available as of blojsom 2.23.
Installation and Setup
In your global /WEB-INF/plugin.properties file, add the following line:
weather=org.blojsom.plugin.weather.WeatherPlugin
You may then add "weather" to the end one of the flavor-based plugin chains. These plugin chains can be found in the individual user's plugin.properties file. For example:
html.blojsom-plugin-chain=...,weather
The Weather plugin has its own configuration file, weather.properties, that is referenced in /WEB-INF/web.xml.
<init-param>
<param-name>plugin-weather</param-name>
<param-value>weather.properties</param-value>
</init-param>
The weather.properties file will be located in the respective /WEB-INF/(blog-id) directories and has a number of configurable parameters:
| Parameter |
Required |
Default value |
Description |
| weather-station-code |
true |
|
The weather staton id to retrieve the forecast for. Example: KSQL is San Carlos, CA. |
| weather-provider |
true |
org.blojsom.plugin.weather.beans.NWSInformation |
Class that actually retrieves and parses the weather feed. A default provider for the National Weather Service's XML Feeds in included and will be used is non is specified. |
NOTE: You can find your weather station code by visiting the National Weather Service
The Weather plugin poll time which specifies when its internal thread wakes up and checks the weather forecast setup for each user is configured in /WEB-INF/web.xml.
<init-param>
<param-name>plugin-weather-poll-time</param-name>
<param-value>time specified in seconds</param-value>
</init-param>
If this parameter is not found in /WEB-INF/web.xml, a default value of 60 minutes will be used for the poll time.
Usage and URL Parameters
There are no URL parameters to control the operation of the Weather plugin.
Context Attributes and Types
The following table describes the context attributes that are available and their associated type.
| Context key |
Input or Output |
Type |
Description |
| BLOJSOM_WEATHER_INFORMATION |
Output |
org.blojsom.plugin.weather.beans.WeatherInformation |
You may then make use of the WeatherInformation object in your templates. |