1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2025-09-10 17:49:38 +02:00

HTML and comment cleanup. Small API refactors. Moved use of StringBuffer to StringBuilder.

git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@10865 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
Matt Tucker 2008-11-03 16:28:57 +00:00 committed by matt
parent b927475caa
commit 334838d28e
32 changed files with 271 additions and 305 deletions

View file

@ -32,7 +32,9 @@ import org.jivesoftware.smackx.packet.AdHocCommandData;
/**
* Represents a command that is in a remote location. Invoking one of the
* execute, next, prev, cancel or complete methods results in executing that
* {@link AdHocCommand.Action#execute execute}, {@link AdHocCommand.Action#next next},
* {@link AdHocCommand.Action#prev prev}, {@link AdHocCommand.Action#cancel cancel} or
* {@link AdHocCommand.Action#complete complete} actions 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
@ -64,12 +66,9 @@ public class RemoteCommand extends AdHocCommand {
* command identified by <code>node</code> in the host identified by
* <code>jid</code>
*
* @param connection
* the connection to use for the execution.
* @param node
* the identifier of the command.
* @param jid
* the JID of the host.
* @param connection the connection to use for the execution.
* @param node the identifier of the command.
* @param jid the JID of the host.
*/
protected RemoteCommand(XMPPConnection connection, String node, String jid) {
super();
@ -99,7 +98,7 @@ public class RemoteCommand extends AdHocCommand {
* there is a problem executing the command it throws an XMPPException.
*
* @param form the form anwser of the previous stage.
* @throws XMPPException
* @throws XMPPException if an error occurs.
*/
public void execute(Form form) throws XMPPException {
executeAction(Action.execute, form);
@ -122,15 +121,16 @@ public class RemoteCommand extends AdHocCommand {
/**
* Executes the <code>action</codo> with the <code>form</code>.
* The action could be any of the available actions. The form must
* be the anwser of the previous stage. It can be null if it is the first stage.
* be the anwser of the previous stage. It can be <tt>null</tt> if it is the first stage.
*
* @param action the action to execute
* @param form the form with the information
* @throws XMPPException if there is a problem executing the command.
*/
private void executeAction(Action action, Form form) throws XMPPException {
// TODO Check that all the requiered fields of the form were filled, if
// not throw the corresponding exeption. This will make a faster response,
// since the request is stoped before it's sended.
// TODO: Check that all the required fields of the form were filled, if
// TODO: not throw the corresponding exeption. This will make a faster response,
// TODO: since the request is stoped before it's sent.
AdHocCommandData data = new AdHocCommandData();
data.setType(IQ.Type.SET);
data.setTo(getOwnerJID());
@ -142,13 +142,12 @@ public class RemoteCommand extends AdHocCommand {
data.setForm(form.getDataFormToSend());
}
PacketCollector collector = connection
.createPacketCollector(new PacketIDFilter(data.getPacketID()));
PacketCollector collector = connection.createPacketCollector(
new PacketIDFilter(data.getPacketID()));
connection.sendPacket(data);
Packet response = collector.nextResult(SmackConfiguration
.getPacketReplyTimeout());
Packet response = collector.nextResult(SmackConfiguration.getPacketReplyTimeout());
// Cancel the collector.
collector.cancel();
@ -168,4 +167,4 @@ public class RemoteCommand extends AdHocCommand {
public String getOwnerJID() {
return jid;
}
}
}