Class AbstractAdHocCommand

java.lang.Object
org.jivesoftware.smackx.commands.AbstractAdHocCommand
Direct Known Subclasses:
AdHocCommand, AdHocCommandHandler

public abstract class AbstractAdHocCommand extends Object
An ad-hoc command is responsible for executing the provided service and storing the result of the execution. Each new request will create a new instance of the command, allowing information related to executions to be stored in it. For example suppose that a command that retrieves the list of users on a server is implemented. When the command is executed it gets that list and the result is stored as a form in the command instance, i.e. the getForm method retrieves a form with all the users.

Each command has a node that should be unique within a given JID.

Commands may have zero or more stages. Each stage is usually used for gathering information required for the command execution. Users are able to move forward or backward across the different stages. Commands may not be cancelled while they are being executed. However, users may request the "cancel" action when submitting a stage response indicating that the command execution should be aborted. Thus, releasing any collected information. Commands that require user interaction (i.e. have more than one stage) will have to provide the data forms the user must complete in each stage and the allowed actions the user might perform during each stage (e.g. go to the previous stage or go to the next stage).

All the actions may throw an XMPPException if there is a problem executing them. The XMPPError of that exception may have some specific information about the problem. The possible extensions are:
  • malformed-action. Extension of a bad-request error.
  • bad-action. Extension of a bad-request error.
  • bad-locale. Extension of a bad-request error.
  • bad-payload. Extension of a bad-request error.
  • bad-sessionid. Extension of a bad-request error.
  • session-expired. Extension of a not-allowed error.

See the SpecificErrorCondition class for detailed description of each one.

Use the getSpecificErrorConditionFrom to obtain the specific information from an XMPPError.