Smack

org.jivesoftware.smackx.packet
Class Version

java.lang.Object
  extended by org.jivesoftware.smack.packet.Packet
      extended by org.jivesoftware.smack.packet.IQ
          extended by org.jivesoftware.smackx.packet.Version

public class Version
extends IQ

A Version IQ packet, which is used by XMPP clients to discover version information about the software running at another entity's JID.

An example to discover the version of the server:

 // Request the version from the server.
 Version versionRequest = new Version();
 timeRequest.setType(IQ.Type.GET);
 timeRequest.setTo("example.com");

 // Create a packet collector to listen for a response.
 PacketCollector collector = con.createPacketCollector(
                new PacketIDFilter(versionRequest.getPacketID()));

 con.sendPacket(versionRequest);

 // Wait up to 5 seconds for a result.
 IQ result = (IQ)collector.nextResult(5000);
 if (result != null && result.getType() == IQ.Type.RESULT) {
     Version versionResult = (Version)result;
     // Do something with result...
 }

Author:
Gaston Dombiak

Nested Class Summary
 
Nested classes/interfaces inherited from class org.jivesoftware.smack.packet.IQ
IQ.Type
 
Field Summary
 
Fields inherited from class org.jivesoftware.smack.packet.Packet
ID_NOT_AVAILABLE
 
Constructor Summary
Version()
           
 
Method Summary
 String getChildElementXML()
          Returns the sub-element XML section of the IQ packet, or null if there isn't one.
 String getName()
          Returns the natural-language name of the software.
 String getOs()
          Returns the operating system of the queried entity.
 String getVersion()
          Returns the specific version of the software.
 void setName(String name)
          Sets the natural-language name of the software.
 void setOs(String os)
          Sets the operating system of the queried entity.
 void setVersion(String version)
          Sets the specific version of the software.
 
Methods inherited from class org.jivesoftware.smack.packet.IQ
getType, setType, toXML
 
Methods inherited from class org.jivesoftware.smack.packet.Packet
addExtension, deleteProperty, getError, getExtension, getExtension, getExtensions, getExtensionsXML, getFrom, getPacketID, getProperty, getPropertyNames, getTo, removeExtension, setError, setFrom, setPacketID, setProperty, setTo
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Version

public Version()
Method Detail

getName

public String getName()
Returns the natural-language name of the software. This property will always be present in a result.

Returns:
the natural-language name of the software.

setName

public void setName(String name)
Sets the natural-language name of the software. This message should only be invoked when parsing the XML and setting the property to a Version instance.

Parameters:
name - the natural-language name of the software.

getVersion

public String getVersion()
Returns the specific version of the software. This property will always be present in a result.

Returns:
the specific version of the software.

setVersion

public void setVersion(String version)
Sets the specific version of the software. This message should only be invoked when parsing the XML and setting the property to a Version instance.

Parameters:
version - the specific version of the software.

getOs

public String getOs()
Returns the operating system of the queried entity. This property will always be present in a result.

Returns:
the operating system of the queried entity.

setOs

public void setOs(String os)
Sets the operating system of the queried entity. This message should only be invoked when parsing the XML and setting the property to a Version instance.

Parameters:
os - operating system of the queried entity.

getChildElementXML

public String getChildElementXML()
Description copied from class: IQ
Returns the sub-element XML section of the IQ packet, or null if there isn't one. Packet extensions must be included, if any are defined.

Extensions of this class must override this method.

Specified by:
getChildElementXML in class IQ
Returns:
the child element section of the IQ XML.

Smack

Copyright © 2003-2007 Jive Software.