Package org.jivesoftware.smackx.commands
Class AdHocCommandHandler
java.lang.Object
org.jivesoftware.smackx.commands.AbstractAdHocCommand
org.jivesoftware.smackx.commands.AdHocCommandHandler
- Direct Known Subclasses:
AdHocCommandHandler.SingleStage
Represents a command that can be executed locally from a remote location. This
class must be extended to implement an specific ad-hoc command. This class
provides some useful tools:
- Node
- Name
- Session ID
- Current Stage
- Available actions
- Default action
-
Nested Class Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected abstract AdHocCommandData
complete
(AdHocCommandDataBuilder response, SubmitForm submittedForm) protected abstract AdHocCommandData
execute
(AdHocCommandDataBuilder response) long
Returns the date the command was created.final int
Returns the currently executing stage number.boolean
hasPermission
(Jid jid) Returns true if the specified requester has permission to execute all the stages of this action.protected static XMPPException.XMPPErrorException
newBadRequestException
(String descriptiveTest) protected static XMPPException.XMPPErrorException
newXmppErrorException
(StanzaError.Condition condition) protected static XMPPException.XMPPErrorException
newXmppErrorException
(StanzaError.Condition condition, String descriptiveText) protected abstract AdHocCommandData
next
(AdHocCommandDataBuilder response, SubmitForm submittedForm) protected abstract AdHocCommandData
prev
(AdHocCommandDataBuilder response) Methods inherited from class org.jivesoftware.smackx.commands.AbstractAdHocCommand
cancel, getActions, getExecuteAction, getLastRequest, getLastResult, getName, getNode, getNotes, getSessionId, getSpecificErrorCondition, getStatus, isCompleted, isValidAction, setSessionId
-
Constructor Details
-
AdHocCommandHandler
-
-
Method Details
-
execute
-
next
protected abstract AdHocCommandData next(AdHocCommandDataBuilder response, SubmitForm submittedForm) throws SmackException.NoResponseException, XMPPException.XMPPErrorException, SmackException.NotConnectedException, InterruptedException, IllegalStateException -
complete
protected abstract AdHocCommandData complete(AdHocCommandDataBuilder response, SubmitForm submittedForm) throws SmackException.NoResponseException, XMPPException.XMPPErrorException, SmackException.NotConnectedException, InterruptedException, IllegalStateException -
prev
protected abstract AdHocCommandData prev(AdHocCommandDataBuilder response) throws SmackException.NoResponseException, XMPPException.XMPPErrorException, SmackException.NotConnectedException, InterruptedException, IllegalStateException -
getCreationDate
Returns the date the command was created.- Returns:
- the date the command was created.
-
hasPermission
Returns true if the specified requester has permission to execute all the stages of this action. This is checked when the first request is received, if the permission is grant then the requester will be able to execute all the stages of the command. It is not checked again during the execution.- Parameters:
jid
- the JID to check permissions on.- Returns:
- true if the user has permission to execute this action.
-
getCurrentStage
Returns the currently executing stage number. The first stage number is 1. During the execution of the first action this method will answer 1.- Returns:
- the current stage number.
-
newXmppErrorException
protected static XMPPException.XMPPErrorException newXmppErrorException(StanzaError.Condition condition) -
newXmppErrorException
protected static XMPPException.XMPPErrorException newXmppErrorException(StanzaError.Condition condition, String descriptiveText) -
newBadRequestException
-