|
Openfire 3.4.1 Javadoc | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jivesoftware.openfire.commands.AdHocCommand
public abstract class AdHocCommand
An ad-hoc command is a stateless object responsbile for executing the provided service. Each subclass will only have one instance that will be shared across all users sessions. Therefore, it is important to not keep any information related to executions as permanent data (i.e. as instance or static variables). Each command has a code 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 beig executed. However, users may request the "cancel" action when submiting 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).
Nested Class Summary | |
---|---|
static class |
AdHocCommand.Action
|
static class |
AdHocCommand.Status
|
Constructor Summary | |
---|---|
AdHocCommand()
|
Method Summary | |
---|---|
void |
addNextStageInformation(SessionData data,
org.dom4j.Element command)
Increments the stage number by one and adds to the command element the new data form and new allowed actions that the user might perform. |
void |
addPreviousStageInformation(SessionData data,
org.dom4j.Element command)
Decrements the stage number by one and adds to the command the data form and allowed actions that the user might perform of the previous stage. |
protected void |
addStageActions(SessionData data,
org.dom4j.Element command)
Adds the allowed actions to follow from the current stage. |
protected abstract void |
addStageInformation(SessionData data,
org.dom4j.Element command)
Adds to the command element the data form or notes required by the current stage. |
abstract void |
execute(SessionData data,
org.dom4j.Element command)
Executes the command with the specified session data. |
protected abstract List<AdHocCommand.Action> |
getActions(SessionData data)
Returns a collection with the allowed actions based on the current stage as defined in the SessionData. |
abstract String |
getCode()
Returns the unique identifier for this command for the containing JID. |
abstract String |
getDefaultLabel()
Returns the default label used for describing this commmand. |
protected abstract AdHocCommand.Action |
getExecuteAction(SessionData data)
Returns which of the actions available for the current stage is considered the equivalent to "execute". |
String |
getLabel()
|
abstract int |
getMaxStages(SessionData data)
Returns the max number of stages for this command. |
boolean |
hasPermission(JID requester)
Returns true if the requester is allowed to execute this command. |
void |
setLabel(String label)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AdHocCommand()
Method Detail |
---|
public String getLabel()
public void setLabel(String label)
public boolean hasPermission(JID requester)
Note: The bare JID of the requester will be compared with the bare JID of the admins.
requester
- the JID of the user requesting to execute this command.
public abstract String getCode()
public abstract String getDefaultLabel()
setLabel(String)
to set a new label and reset to the default value at any time.
public abstract int getMaxStages(SessionData data)
data
- the gathered data through the command stages or null if the
command does not have stages or the requester is requesting the execution for the
first time.
public abstract void execute(SessionData data, org.dom4j.Element command)
data
- the gathered data through the command stages or null if the
command does not have stages.command
- the command element to be sent to the command requester with a reported
data result or note element with the answer of the execution.protected abstract void addStageInformation(SessionData data, org.dom4j.Element command)
data
- the gathered data through the command stages or null if the
command does not have stages or the requester is requesting the execution for the
first time.command
- the command element to be sent to the command requester.protected abstract List<AdHocCommand.Action> getActions(SessionData data)
data
- the gathered data through the command stages or null if the
command does not have stages or the requester is requesting the execution for the
first time.
protected abstract AdHocCommand.Action getExecuteAction(SessionData data)
data
- the gathered data through the command stages or null if the
command does not have stages or the requester is requesting the execution for the
first time.
public void addNextStageInformation(SessionData data, org.dom4j.Element command)
data
- the gathered data through the command stages.command
- the command element to be sent to the command requester.public void addPreviousStageInformation(SessionData data, org.dom4j.Element command)
data
- the gathered data through the command stages.command
- the command element to be sent to the command requester.protected void addStageActions(SessionData data, org.dom4j.Element command)
data
- the gathered data through the command stages or null if the
command does not have stages or the requester is requesting the execution for the
first time.command
- the command element to be sent to the command requester.
|
Openfire 3.4.1 Javadoc | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |