Package tigase.server
Class Iq
- java.lang.Object
-
- tigase.server.Packet
-
- tigase.server.Iq
-
public class Iq extends Packet
Created: Dec 31, 2009 8:43:21 PM- Author:
- Artur Hefczyc
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
ELEM_NAME
static java.lang.String[]
IQ_BIND_PATH
static java.lang.String[]
IQ_BIND_RESOURCE_PATH
static java.lang.String[]
IQ_CHAT_PATH
static java.lang.String[]
IQ_COMMAND_PATH
static java.lang.String[]
IQ_ERROR_PATH
static java.lang.String[]
IQ_PUBSUB_PATH
static java.lang.String[]
IQ_QUERY_PATH
static java.lang.String
QUERY_NAME
-
Fields inherited from class tigase.server.Packet
CLIENT_XMLNS, elem, ERROR_NS, FROM_ATT, FULL_DEBUG, ID_ATT, PERM_ATT, PRIORITY_ATT, TO_ATT, TYPE_ATT, XMLNS_ATT
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Packet
commandResult(Command.DataType cmd_type)
static Packet
commandResultForm(Iq packet)
static Packet
commandResultResult(Iq packet)
static Iq
createRosterPacket(java.lang.String iq_type, java.lang.String iq_id, JID from, JID to, JID item_jid, java.lang.String item_name, java.lang.String[] item_groups, java.lang.String subscription, java.lang.String item_type)
Method creates a newPacket
instance orIq
instance more specificly with a roster entry content.Command
getCommand()
The method always returns NULL.protected java.lang.String[]
getElNameErrorPath()
A convenience method to provide XML path asString[]
to error element.java.lang.String
getIQChildName()
java.lang.String
getIQXMLNS()
java.lang.String
getStrCommand()
boolean
isCommand()
The method checks whether the stanza enclosed by thisPacket
instance is an ad-hoc command.boolean
isServiceDisco()
A convenience method which checks whether the enclosed stanza is a service discovery query.-
Methods inherited from class tigase.server.Packet
copyElementOnly, debug, elemToString, elemToStringSecure, errorResult, getAttributeStaticStr, getAttributeStaticStr, getElemCData, getElemCDataStaticStr, getElemChild, getElemChild, getElemChildrenStaticStr, getElement, getElemName, getErrorCondition, getFrom, getPacketFrom, getPacketTo, getPermissions, getPriority, getProcessorsIds, getServerAuthorisedStanzaFrom, getSkippedProcessorsIds, getStableId, getStanzaFrom, getStanzaId, getStanzaTo, getTo, getType, getXMLNS, initVars, initVars, isElement, isRouted, isXMLNSStaticStr, notProcessedBy, okResult, okResult, packetInstance, packetInstance, packetInstance, packRouted, processedBy, setPacketFrom, setPacketTo, setPermissions, setPriority, setServerAuthorisedStanzaFrom, setStableId, setXMLNS, swapFromTo, swapFromTo, swapStanzaFromTo, swapStanzaFromTo, toString, toString, toStringFull, toStringSecure, unpackRouted, wasProcessed, wasProcessedBy, wasSkipped
-
-
-
-
Field Detail
-
ELEM_NAME
public static final java.lang.String ELEM_NAME
- See Also:
- Constant Field Values
-
QUERY_NAME
public static final java.lang.String QUERY_NAME
- See Also:
- Constant Field Values
-
IQ_QUERY_PATH
public static final java.lang.String[] IQ_QUERY_PATH
-
IQ_PUBSUB_PATH
public static final java.lang.String[] IQ_PUBSUB_PATH
-
IQ_ERROR_PATH
public static final java.lang.String[] IQ_ERROR_PATH
-
IQ_COMMAND_PATH
public static final java.lang.String[] IQ_COMMAND_PATH
-
IQ_CHAT_PATH
public static final java.lang.String[] IQ_CHAT_PATH
-
IQ_BIND_RESOURCE_PATH
public static final java.lang.String[] IQ_BIND_RESOURCE_PATH
-
IQ_BIND_PATH
public static final java.lang.String[] IQ_BIND_PATH
-
-
Constructor Detail
-
Iq
public Iq(Element elem) throws TigaseStringprepException
- Throws:
TigaseStringprepException
-
-
Method Detail
-
commandResultForm
public static Packet commandResultForm(Iq packet) throws TigaseStringprepException
- Throws:
TigaseStringprepException
-
commandResultResult
public static Packet commandResultResult(Iq packet) throws TigaseStringprepException
- Throws:
TigaseStringprepException
-
createRosterPacket
public static Iq createRosterPacket(java.lang.String iq_type, java.lang.String iq_id, JID from, JID to, JID item_jid, java.lang.String item_name, java.lang.String[] item_groups, java.lang.String subscription, java.lang.String item_type)
Method creates a newPacket
instance orIq
instance more specificly with a roster entry content. TODO: Remove dependency on RosterAbstract class, possibly move the method again to more proper location but it needs to be accessible from all parts of the application.- Parameters:
iq_type
- is aString
value with the stanza type: 'set', 'get', 'result'.iq_id
- is aString
value with the stanza unique id.from
- is aJID
instance with the packet source address.to
- is aJID
instance with the packet destination address.item_jid
- is aJID
instance with the roster item JID, note in most cases the jid should not have a resource part, but this method does not cut it off. This is because there are cases when we want to have a resource part in the roster item.item_name
- is aString
vakue with the roster item name.item_groups
- is aString[]
array with all groups the item belongs to.subscription
- is aString
instance with the item subscription state.item_type
- is aString
of the user item type. This isnull
in most cases as this is not part of the XMPP RFC. Some deployments needs some extra information about the roster item type though.- Returns:
- a new
Packet
instance orIq
instance more specificly with a roster entry content.
-
commandResult
public Packet commandResult(Command.DataType cmd_type)
-
getCommand
public Command getCommand()
Description copied from class:Packet
The method always returns NULL. It is overwritten in theIq
class where it returns a command identifier if theiq
stanza represents an ad-hoc command. It is provided here is a convenience so the developer does not have to cast the packet to IQ before retrieving the command id.- Overrides:
getCommand
in classPacket
- Returns:
- the method always returns a NULL.
-
getIQChildName
public java.lang.String getIQChildName()
-
getIQXMLNS
public java.lang.String getIQXMLNS()
-
getStrCommand
public java.lang.String getStrCommand()
-
isCommand
public boolean isCommand()
Description copied from class:Packet
The method checks whether the stanza enclosed by thisPacket
instance is an ad-hoc command. This is a generic method which in fact always returnsfalse
. It is overwritten in theIq
class where the real checking is performed. This class has been provided as a convenience method to perform the check without a need for casting thePacket
instance to theIq
class.
-
isServiceDisco
public boolean isServiceDisco()
Description copied from class:Packet
A convenience method which checks whether the enclosed stanza is a service discovery query. This is a generic method which in fact always returnsfalse
. It is overwritten in theIq
class where the real checking is performed. This class has been provided as a convenience method to perform the check without a need for casting thePacket
instance to theIq
class.- Overrides:
isServiceDisco
in classPacket
- Returns:
- a
boolean
valuetrue
if the stanza is a a service discovery query andfalse
otherwise.
-
getElNameErrorPath
protected java.lang.String[] getElNameErrorPath()
Description copied from class:Packet
A convenience method to provide XML path asString[]
to error element. This method should be override by all classes extending this class.- Overrides:
getElNameErrorPath
in classPacket
- Returns:
- XML path to error element.
-
-