org.jwall.web.audit.session
Interface SessionContext

All Known Implementing Classes:
Session

public interface SessionContext

This interface defines an abstract session context that is associated with a session-identifier and provides features like setting variables and removing or expiring variables of session scope.

Author:
Christian Bockermann <chris@jwall.org>

Method Summary
 java.lang.String getId()
          This method returns an unique identifier that serves as a key to this session.
 java.lang.String getVariable(java.lang.String name)
          This method returns the string-value of the variable given by name.
 java.util.Set<java.lang.String> getVariableNames()
          This method returns a set of variable names (strings) that are set within the session scope and did not expire yet.
 void increment(java.lang.String var, int count)
          This method will increment the count of the variable var by the amount of count.
 void removeVariable(java.lang.String name)
          This method shall remove the variable with the given name from the session-context.
 void setVariable(java.lang.String name, java.lang.String value, java.util.Date expires)
          This method creates a new variable with the given name and initializes it to the value provided by value.
 

Method Detail

getId

java.lang.String getId()
This method returns an unique identifier that serves as a key to this session.

Returns:
The session identifier.

getVariableNames

java.util.Set<java.lang.String> getVariableNames()
This method returns a set of variable names (strings) that are set within the session scope and did not expire yet. Not that due to expiration the returned set of variables may not reflect the set of currently set variables, as after calling this method a variable might expire.

Returns:
The variable-names that are valid in this session-context.

getVariable

java.lang.String getVariable(java.lang.String name)
This method returns the string-value of the variable given by name. If no such variable exists within this session, null is returned.

Parameters:
name -
Returns:
The value of the variable given by name or null if the variable does not exist.

increment

void increment(java.lang.String var,
               int count)
This method will increment the count of the variable var by the amount of count. If the variable is a non-numeric one, calling this method will have no effect.

Parameters:
var -
count -

setVariable

void setVariable(java.lang.String name,
                 java.lang.String value,
                 java.util.Date expires)
This method creates a new variable with the given name and initializes it to the value provided by value. The variable will expire at the given date or as the session itself expires. By providing a null value for the date, the variable will be set to expire at the sessions end.

Parameters:
name -
value -
expires -

removeVariable

void removeVariable(java.lang.String name)
This method shall remove the variable with the given name from the session-context. If no such variable exists, calling this method will have no effect.

Parameters:
name -