Package org.jivesoftware.weather
Class WeatherComponent
java.lang.Object
org.xmpp.component.AbstractComponent
org.jivesoftware.weather.WeatherComponent
- All Implemented Interfaces:
org.xmpp.component.Component
public class WeatherComponent
extends org.xmpp.component.AbstractComponent
This component provides weather information obtained from http://weather.noaa.gov. Each request
will generate an HTTP request to the above URL. The JWeather library was used for getting
weather information in the METAR format.
Note: This code shouldn't be considered ready for production since it generate an HTTP request for each received request. Therefore, it won't scale much.
- Author:
- Gaston Dombiak
-
Field Summary
Fields inherited from class org.xmpp.component.AbstractComponent
compMan, jid, NAMESPACE_DISCO_INFO, NAMESPACE_DISCO_ITEMS, NAMESPACE_ENTITY_TIME, NAMESPACE_LAST_ACTIVITY, NAMESPACE_XMPP_PING -
Constructor Summary
ConstructorsConstructorDescriptionWeatherComponent(String name, String serverDomain) Create a new component which provides weather information. -
Method Summary
Modifier and TypeMethodDescriptiongetName()protected voidhandleMessage(org.xmpp.packet.Message message) Handle a receied message and answer the weather information of the requested station id.Methods inherited from class org.xmpp.component.AbstractComponent
discoInfoFeatureNamespaces, discoInfoIdentityCategory, discoInfoIdentityCategoryType, getJID, handleDiscoInfo, handleDiscoItems, handleEntityTime, handleIQError, handleIQGet, handleIQResult, handleIQSet, handleLastActivity, handlePing, handlePresence, initialize, postComponentShutdown, postComponentStart, preComponentShutdown, preComponentStart, processPacket, send, servesLocalUsersOnly, shutdown, start
-
Constructor Details
-
WeatherComponent
Create a new component which provides weather information.- Parameters:
name- The name of this component.serverDomain- The XMPP domain to which this component is registered to.
-
-
Method Details
-
getName
- Specified by:
getNamein interfaceorg.xmpp.component.Component- Specified by:
getNamein classorg.xmpp.component.AbstractComponent
-
getDescription
- Specified by:
getDescriptionin interfaceorg.xmpp.component.Component- Specified by:
getDescriptionin classorg.xmpp.component.AbstractComponent
-
getDomain
- Overrides:
getDomainin classorg.xmpp.component.AbstractComponent
-
handleMessage
protected void handleMessage(org.xmpp.packet.Message message) Handle a receied message and answer the weather information of the requested station id. The request must be made using Message packets where the body of the message should be the station id.Note: I don't know the list of valid station ids so if you find the list please send it to me so I can add it to this example.
- Overrides:
handleMessagein classorg.xmpp.component.AbstractComponent- Parameters:
message- the Message requesting information about a certain station id.
-