Package org.jivesoftware.smackx.commands
Class RemoteCommand
- java.lang.Object
-
- org.jivesoftware.smackx.commands.AdHocCommand
-
- org.jivesoftware.smackx.commands.RemoteCommand
-
public class RemoteCommand extends AdHocCommand
Represents a command that is in a remote location. Invoking one of theexecute,next,prev,cancelorcompleteactions results in executing that action in the remote location. In response to that action the internal state of the this command instance will change. For example, if the command is a single stage command, then invoking the execute action will execute this action in the remote location. After that the local instance will have a state of "completed" and a form or notes that applies.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.jivesoftware.smackx.commands.AdHocCommand
AdHocCommand.Action, AdHocCommand.SpecificErrorCondition, AdHocCommand.Status
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedRemoteCommand(XMPPConnection connection, java.lang.String node, Jid jid)Creates a new RemoteCommand that uses an specific connection to execute a command identified bynodein the host identified byjid
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcancel()Cancels the execution of the command.voidcomplete(FillableForm form)Completes the command execution with the information provided in theresponse.voidexecute()Executes the command.voidexecute(FillableForm form)Executes the default action of the command with the information provided in the Form.JidgetOwnerJID()Returns the full JID of the owner of this command.voidnext(FillableForm form)Executes the next action of the command with the information provided in theresponse.voidprev()Goes to the previous stage.-
Methods inherited from class org.jivesoftware.smackx.commands.AdHocCommand
addActionAvailable, addNote, getActions, getExecuteAction, getForm, getName, getNode, getNotes, getRaw, getSpecificErrorCondition, getStatus, isCompleted, isValidAction, setExecuteAction, setForm, setName, setNode
-
-
-
-
Constructor Detail
-
RemoteCommand
protected RemoteCommand(XMPPConnection connection, java.lang.String node, Jid jid)
Creates a new RemoteCommand that uses an specific connection to execute a command identified bynodein the host identified byjid- Parameters:
connection- the connection to use for the execution.node- the identifier of the command.jid- the JID of the host.
-
-
Method Detail
-
cancel
public void cancel() throws SmackException.NoResponseException, XMPPException.XMPPErrorException, SmackException.NotConnectedException, java.lang.InterruptedException
Description copied from class:AdHocCommandCancels the execution of the command. This can be invoked on any stage of the execution. If there is a problem executing the command it throws an XMPPException.- Specified by:
cancelin classAdHocCommand- Throws:
SmackException.NoResponseException- if there was no response from the remote entity.XMPPException.XMPPErrorException- if there is a problem executing the command.SmackException.NotConnectedException- if the XMPP connection is not connected.java.lang.InterruptedException- if the calling thread was interrupted.
-
complete
public void complete(FillableForm form) throws SmackException.NoResponseException, XMPPException.XMPPErrorException, SmackException.NotConnectedException, java.lang.InterruptedException
Description copied from class:AdHocCommandCompletes the command execution with the information provided in theresponse. This form must be the answer form of the previous stage. This method will be only invoked for commands that have one or more stages. If there is a problem executing the command it throws an XMPPException.- Specified by:
completein classAdHocCommand- Parameters:
form- the form answer of the previous stage.- Throws:
SmackException.NoResponseException- if there was no response from the remote entity.XMPPException.XMPPErrorException- if there is a problem executing the command.SmackException.NotConnectedException- if the XMPP connection is not connected.java.lang.InterruptedException- if the calling thread was interrupted.
-
execute
public void execute() throws SmackException.NoResponseException, XMPPException.XMPPErrorException, SmackException.NotConnectedException, java.lang.InterruptedException
Description copied from class:AdHocCommandExecutes the command. This is invoked only on the first stage of the command. It is invoked on every command. If there is a problem executing the command it throws an XMPPException.- Specified by:
executein classAdHocCommand- Throws:
SmackException.NoResponseException- if there was no response from the remote entity.XMPPException.XMPPErrorException- if there is an error executing the command.SmackException.NotConnectedException- if the XMPP connection is not connected.java.lang.InterruptedException- if the calling thread was interrupted.
-
execute
public void execute(FillableForm form) throws SmackException.NoResponseException, XMPPException.XMPPErrorException, SmackException.NotConnectedException, java.lang.InterruptedException
Executes the default action of the command with the information provided in the Form. This form must be the answer form of the previous stage. If there is a problem executing the command it throws an XMPPException.- Parameters:
form- the form answer of the previous stage.- Throws:
XMPPException.XMPPErrorException- if an error occurs.SmackException.NoResponseException- if there was no response from the server.SmackException.NotConnectedException- if the XMPP connection is not connected.java.lang.InterruptedException- if the calling thread was interrupted.
-
next
public void next(FillableForm form) throws SmackException.NoResponseException, XMPPException.XMPPErrorException, SmackException.NotConnectedException, java.lang.InterruptedException
Description copied from class:AdHocCommandExecutes the next action of the command with the information provided in theresponse. This form must be the answer form of the previous stage. This method will be only invoked for commands that have one or more stages. If there is a problem executing the command it throws an XMPPException.- Specified by:
nextin classAdHocCommand- Parameters:
form- the form answer of the previous stage.- Throws:
SmackException.NoResponseException- if there was no response from the remote entity.XMPPException.XMPPErrorException- if there is a problem executing the command.SmackException.NotConnectedException- if the XMPP connection is not connected.java.lang.InterruptedException- if the calling thread was interrupted.
-
prev
public void prev() throws SmackException.NoResponseException, XMPPException.XMPPErrorException, SmackException.NotConnectedException, java.lang.InterruptedException
Description copied from class:AdHocCommandGoes to the previous stage. The requester is asking to re-send the information of the previous stage. The command must change it state to the previous one. If there is a problem executing the command it throws an XMPPException.- Specified by:
previn classAdHocCommand- Throws:
SmackException.NoResponseException- if there was no response from the remote entity.XMPPException.XMPPErrorException- if there is a problem executing the command.SmackException.NotConnectedException- if the XMPP connection is not connected.java.lang.InterruptedException- if the calling thread was interrupted.
-
getOwnerJID
public Jid getOwnerJID()
Description copied from class:AdHocCommandReturns the full JID of the owner of this command. This JID is the "to" of a execution request.- Specified by:
getOwnerJIDin classAdHocCommand- Returns:
- the owner JID.
-
-