Class Command
- java.lang.Object
-
- rocks.xmpp.extensions.commands.model.Command
-
- All Implemented Interfaces:
LanguageElement
public final class Command extends Object implements LanguageElement
The implementation of the<command/>
element in thehttp://jabber.org/protocol/commands
namespace.This class is immutable.
- See Also:
- XEP-0050: Ad-Hoc Commands, XML Schema
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Command.Action
Represents a command action.static class
Command.BadAction
The responding JID cannot accept the specified action.static class
Command.BadLocale
The responding JID cannot accept the specified language/locale.static class
Command.BadPayload
The responding JID cannot accept the specified payload (e.g. the data form did not provide one or more required fields).static class
Command.BadSessionId
The responding JID cannot accept the specified sessionid.static class
Command.MalformedAction
The responding JID does not understand the specified action.static class
Command.Note
Represents a note associated with a command.static class
Command.SessionExpired
The requesting JID specified a sessionid that is no longer active (either because it was completed, canceled, or timed out).static class
Command.Status
Represents the status of the command.
-
Constructor Summary
Constructors Constructor Description Command(String node, String sessionId, Command.Action action, List<Object> payloads)
Creates a command request, which is created by the requester.Command(String node, String sessionId, Command.Action action, List<Object> payloads, Locale language, List<Command.Note> notes)
Creates a command request, which is created by the requester.Command(String node, String sessionId, Command.Status status, Collection<Command.Action> actions, Command.Action defaultAction, List<Object> payloads)
Creates a command result, which is created by the responder.Command(String node, String sessionId, Command.Status status, Collection<Command.Action> actions, Command.Action defaultAction, List<Object> payloads, Locale language, List<Command.Note> notes)
Creates a command result, which is created by the responder.Command(String node, Command.Action action)
Creates a command request for simple execution.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Command.Action
getAction()
Gets the action, which is used by the requester.Collection<Command.Action>
getActions()
Gets the possible command actions, which are provided by the responder.Command.Action
getDefaultAction()
Gets the default action or null, if there is no default action.Locale
getLanguage()
Gets the language.String
getNode()
Gets the node.List<Command.Note>
getNotes()
Gets the notes.List<Object>
getPayloads()
Gets the command payload.String
getSessionId()
Gets the session id.Command.Status
getStatus()
Gets the status of the command.
-
-
-
Field Detail
-
NAMESPACE
public static final String NAMESPACE
http://jabber.org/protocol/commands- See Also:
- Constant Field Values
-
-
Constructor Detail
-
Command
public Command(String node, Command.Action action)
Creates a command request for simple execution.- Parameters:
node
- The node.action
- The action. If null,Command.Action.EXECUTE
is implied.
-
Command
public Command(String node, String sessionId, Command.Action action, List<Object> payloads)
Creates a command request, which is created by the requester.- Parameters:
node
- The node.sessionId
- The session id.action
- The action. If null,Command.Action.EXECUTE
is implied.payloads
- The payloads.
-
Command
public Command(String node, String sessionId, Command.Action action, List<Object> payloads, Locale language, List<Command.Note> notes)
Creates a command request, which is created by the requester.- Parameters:
node
- The node.sessionId
- The session id.action
- The action. If null,Command.Action.EXECUTE
is implied.payloads
- The payloads.language
- The language.notes
- The notes.
-
Command
public Command(String node, String sessionId, Command.Status status, Collection<Command.Action> actions, Command.Action defaultAction, List<Object> payloads)
Creates a command result, which is created by the responder.- Parameters:
node
- The node.sessionId
- The session id.status
- The status.actions
- The actions, which are possible to execute by the requester.defaultAction
- The default action, which should be executed by the requester.payloads
- The payloads.
-
Command
public Command(String node, String sessionId, Command.Status status, Collection<Command.Action> actions, Command.Action defaultAction, List<Object> payloads, Locale language, List<Command.Note> notes)
Creates a command result, which is created by the responder.- Parameters:
node
- The node.sessionId
- The session id.status
- The status.actions
- The actions, which are possible to execute by the requester.defaultAction
- The default action, which should be executed by the requester.payloads
- The payloads.language
- The language.notes
- The notes.
-
-
Method Detail
-
getPayloads
public final List<Object> getPayloads()
Gets the command payload.- Returns:
- The command payload.
- See Also:
- 3.5 Command Payloads
-
getAction
public final Command.Action getAction()
Gets the action, which is used by the requester.- Returns:
- The action.
-
getNode
public final String getNode()
Gets the node.- Returns:
- The node.
- See Also:
- 3.2 Command Nodes
-
getStatus
public final Command.Status getStatus()
Gets the status of the command.- Returns:
- The status.
-
getSessionId
public final String getSessionId()
Gets the session id.- Returns:
- The session id.
-
getActions
public final Collection<Command.Action> getActions()
Gets the possible command actions, which are provided by the responder.- Returns:
- The command actions.
- See Also:
- 3.4 Command Actions
-
getDefaultAction
public final Command.Action getDefaultAction()
Gets the default action or null, if there is no default action.- Returns:
- The default action.
-
getNotes
public final List<Command.Note> getNotes()
Gets the notes.- Returns:
- The notes.
-
getLanguage
public final Locale getLanguage()
Gets the language.The "xml:lang" attribute specifies the language/locale this
<command/>
is intended for. This element MAY be specified by the requester to request a specific language/locale, and SHOULD be included by the responder to indicate the language/locale in use.- Specified by:
getLanguage
in interfaceLanguageElement
- Returns:
- The language.
-
-