Class SessionData
- java.lang.Object
-
- org.jivesoftware.openfire.commands.SessionData
-
public class SessionData extends Object
A SessionData instance is responsible for keeping information gathered during the many stages of the command being executed. Each session data is associated with thesessionid
attribute included in thecommand
child element of the IQ packet.- Author:
- Gaston Dombiak
-
-
Constructor Summary
Constructors Constructor Description SessionData(String sessionid, org.xmpp.packet.JID owner)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected void
addStageForm(Map<String,List<String>> data)
Instant
getCreationInstant()
long
getCreationStamp()
Deprecated, for removal: This API element is subject to removal in a future version.Map<String,List<String>>
getData()
Returns a Map with all the variables and values obtained during all the command stages.protected AdHocCommand.Action
getExecuteAction()
String
getId()
Lock
getLock()
Returns a mutex that should be obtained before accessing any immutable field of an instance of this class.org.xmpp.packet.JID
getOwner()
Returns the JID of the entity that is executing the command.int
getStage()
Returns the current stage where the requester is located.protected boolean
isValidAction(String actionName)
Returns true if the specified action is valid in the current stage.protected void
setAllowedActions(List<AdHocCommand.Action> allowedActions)
Sets the valid actions that the user can follow from the current stage.protected void
setExecuteAction(AdHocCommand.Action executeAction)
protected void
setStage(int stage)
Sets the current stage where the requester is located.
-
-
-
Constructor Detail
-
SessionData
public SessionData(String sessionid, org.xmpp.packet.JID owner)
-
-
Method Detail
-
getId
public String getId()
-
getOwner
public org.xmpp.packet.JID getOwner()
Returns the JID of the entity that is executing the command.- Returns:
- the JID of the entity that is executing the command.
-
getCreationStamp
@Deprecated(since="4.8.1", forRemoval=true) public long getCreationStamp()
Deprecated, for removal: This API element is subject to removal in a future version.
-
getCreationInstant
public Instant getCreationInstant()
-
getExecuteAction
protected AdHocCommand.Action getExecuteAction()
-
setExecuteAction
protected void setExecuteAction(AdHocCommand.Action executeAction)
-
setAllowedActions
protected void setAllowedActions(List<AdHocCommand.Action> allowedActions)
Sets the valid actions that the user can follow from the current stage.- Parameters:
allowedActions
- list of valid actions.
-
isValidAction
protected boolean isValidAction(String actionName)
Returns true if the specified action is valid in the current stage. The action should have previously been offered to the user.- Parameters:
actionName
- the name of the action to validate.- Returns:
- true if the specified action is valid in the current stage.
-
getData
public Map<String,List<String>> getData()
Returns a Map with all the variables and values obtained during all the command stages.- Returns:
- a Map with all the variables and values obtained during all the command stages.
-
getStage
public int getStage()
Returns the current stage where the requester is located. Stages are numbered from 0. A stage with value 0 means that a command request has just been received and no data form has been sent to the requester yet. The first sent data form of the first stage would be represented as stage 1.- Returns:
- the current stage where the requester is located.
-
setStage
protected void setStage(int stage)
Sets the current stage where the requester is located. Stages are numbered from 0. A stage with value 0 means that a command request has just been received and no data form has been sent to the requester yet. The first sent data form of the first stage would be represented as stage 1.- Parameters:
stage
- the current stage where the requester is located.
-
getLock
public Lock getLock()
Returns a mutex that should be obtained before accessing any immutable field of an instance of this class.- Returns:
- A mutex.
-
-