org.mmbase.module
Class sessions

java.lang.Object
  extended by org.mmbase.util.functions.FunctionProvider
      extended by org.mmbase.util.functions.DescribedFunctionProvider
          extended by org.mmbase.module.Module
              extended by org.mmbase.module.ProcessorModule
                  extended by org.mmbase.module.sessions
All Implemented Interfaces:
Descriptor, sessionsInterface

public class sessions
extends ProcessorModule
implements sessionsInterface

CLEARSET-NAME : This command clears the session variable called NAME ADDSET-NAME-VALUE : This command adds VALUE to the SESSION variable set called NAME, no duplicates are allowed PUTSET-NAME-VALUE : This command adds VALUE to the SESSION variable set called NAME, duplicates are allowed DELSET-NAME-VALUE : This command deletes VALUE form the SESSION variable set called NAME. CONTAINSSET-NAME-VALUE : returns "YES" if the session variable NAME contains the VALUE, otherwise returns "NO" SETSTRING-NAME : This command gives all values of the session variable NAME, comma separated. SETCOUNT-NAME : This command gives the number of values contained by the session variable NAME. AVGSET-NAME : This command returns the average of a set numbers. CLEARSESSIONINFO : This command clears the SessionInfo.

Version:
$Id: sessions.java 35335 2009-05-21 08:14:41Z michiel $
Author:
Daniel Ockeloen
Application:
SCAN
Rename:
Sessions

Nested Class Summary
 
Nested classes/interfaces inherited from class org.mmbase.module.ProcessorModule
ProcessorModule.GetNodeListFunction, ProcessorModule.ProcessFunction, ProcessorModule.ReplaceFunction
 
Field Summary
(package private)  MMObjectBuilder props
           
(package private)  Hashtable<String,sessionInfo> sessions
           
(package private)  MMObjectBuilder users
           
 
Fields inherited from class org.mmbase.module.ProcessorModule
PARAM_PAGEINFO, PARAMS_PAGEINFO
 
Fields inherited from class org.mmbase.module.Module
configurationPath, getMaintainerFunction, getVersionFunction, properties, STATE_START_TIME
 
Fields inherited from class org.mmbase.util.functions.DescribedFunctionProvider
description, guiName, name
 
Fields inherited from class org.mmbase.util.functions.FunctionProvider
functions, getFunctions
 
Constructor Summary
sessions()
          sessions Module constructor.
 
Method Summary
 void addSetValue(sessionInfo session, String key, String value)
          Adds a String to a set.
 void addSetValues(sessionInfo session, String key, Vector<Object> values)
          Adds a number of Strings to a set.
 String doAddSet(scanpage sp, StringTokenizer tok)
          Adds a sessionvariable with specified value
 String doClearSet(scanpage sp, StringTokenizer tok)
          This methode clears a SESSION variable
 String doDelSet(scanpage sp, StringTokenizer tok)
           
 Vector doGetSet(scanpage sp, StringTokenizer tok)
           
 String doPutSet(scanpage sp, StringTokenizer tok)
           
 void forgetSession(String wanted)
           
 String getAvgSet(scanpage sp, StringTokenizer tok)
           
 String getContainsSet(scanpage sp, StringTokenizer tok)
          Checks if a Session variable contains a certain value.
 Vector getList(scanpage sp, StringTagger tagger, String cmd)
           
 sessionInfo getSession(scanpage sp, String wanted)
           
 String getSetCount(scanpage sp, StringTokenizer tok)
          Gives the number of values contained by a certain session variable
 String getSetString(scanpage sp, StringTokenizer tok)
          returns the values of a session variable comma separated
 int getSize()
           
 Map<String,String> getStates()
          Returns the module's runtime-generated state information as a unmodifiable map with name-value pairs.
 String getValue(sessionInfo session, String wanted)
           
 void init()
          Initializes the module.
 void loadNewProperties(sessionInfo session)
           
 void loadProperties(sessionInfo session)
           
 String replace(scanpage sp, String cmds)
          Handle a $MOD command
 String saveValue(sessionInfo session, String key)
           
 String saveValueNew(sessionInfo session, String key)
           
 String setValue(sessionInfo session, String key, String value)
          Sets or changes a parameter in a sessionInfo.
 void setValueFromNode(sessionInfo session, MMObjectNode node)
           
(package private)  void setVisitInfo(sessionInfo session)
          Stores visiting info (counters) in a session
 Map<String,String> state()
           
 String xmlEscape(String s)
          the XML reader will correct the escaped characters again.
 
Methods inherited from class org.mmbase.module.ProcessorModule
getList, getListBuilder, getNodeList, onload, process, reload, replace, replace, unload
 
Methods inherited from class org.mmbase.module.Module
addInitParameters, checkModules, getInitParameter, getInitParameter, getInitParameter, getInitParameters, getInitParameters, getMaintainer, getModule, getModule, getModule, getModule, getModuleInfo, getModuleLoader, getModuleReader, getModuleReader, getModules, getState, getVersion, hasModule, hasStarted, loadInitParameters, loadInitParameters, maintainance, setInitParameter, setMaintainer, setState, setVersion, shutdown, shutdownModules, startModule, startModules
 
Methods inherited from class org.mmbase.util.functions.DescribedFunctionProvider
getDefaultLocale, getDescription, getDescription, getGUIName, getGUIName, getLocalizedDescription, getLocalizedGUIName, getName, setDescription, setDescription, setGUIName, setGUIName, setLocalizedDescription, setLocalizedGUIName, setName
 
Methods inherited from class org.mmbase.util.functions.FunctionProvider
addFunction, createParameters, getFunction, getFunctions, getFunctionValue, newFunctionInstance
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

sessions

Hashtable<String,sessionInfo> sessions

props

MMObjectBuilder props

users

MMObjectBuilder users
Constructor Detail

sessions

public sessions()
sessions Module constructor.

Method Detail

init

public void init()
Description copied from class: ProcessorModule
Initializes the module. Init must be overridden to read the environment variables it needs.
This method is called by Module.startModule(), which makes sure it is not called more than once. You should not call init() directly, call startModule() instead.

Specified by:
init in interface sessionsInterface
Overrides:
init in class ProcessorModule

getSession

public sessionInfo getSession(scanpage sp,
                              String wanted)
Specified by:
getSession in interface sessionsInterface

forgetSession

public void forgetSession(String wanted)
Specified by:
forgetSession in interface sessionsInterface

getValue

public String getValue(sessionInfo session,
                       String wanted)
Specified by:
getValue in interface sessionsInterface

setValue

public String setValue(sessionInfo session,
                       String key,
                       String value)
Sets or changes a parameter in a sessionInfo.

Specified by:
setValue in interface sessionsInterface
Parameters:
session - the sessionInfo wich has to contain the parameter.
key - the name of the parameter to be set.
value - the value to wich the parameter should be set.

addSetValues

public void addSetValues(sessionInfo session,
                         String key,
                         Vector<Object> values)
Adds a number of Strings to a set.

Specified by:
addSetValues in interface sessionsInterface
Parameters:
session - the sessionInfo containing the set.
key - the name of the set.
values - a Vector containing the Strings to be added to the set.

addSetValue

public void addSetValue(sessionInfo session,
                        String key,
                        String value)
Adds a String to a set. If the String is already contained by the set nothing happens.

Specified by:
addSetValue in interface sessionsInterface
Parameters:
session - the sessionInfo containing the set.
key - the name of the set.
value - the String to be added to the set.

setValueFromNode

public void setValueFromNode(sessionInfo session,
                             MMObjectNode node)
Specified by:
setValueFromNode in interface sessionsInterface

loadProperties

public void loadProperties(sessionInfo session)

loadNewProperties

public void loadNewProperties(sessionInfo session)

saveValue

public String saveValue(sessionInfo session,
                        String key)
Specified by:
saveValue in interface sessionsInterface

saveValueNew

public String saveValueNew(sessionInfo session,
                           String key)

getList

public Vector getList(scanpage sp,
                      StringTagger tagger,
                      String cmd)
               throws ParseException
Throws:
ParseException

replace

public String replace(scanpage sp,
                      String cmds)
Handle a $MOD command

Specified by:
replace in interface sessionsInterface

doAddSet

public String doAddSet(scanpage sp,
                       StringTokenizer tok)
Adds a sessionvariable with specified value


doPutSet

public String doPutSet(scanpage sp,
                       StringTokenizer tok)

doClearSet

public String doClearSet(scanpage sp,
                         StringTokenizer tok)
This methode clears a SESSION variable


getAvgSet

public String getAvgSet(scanpage sp,
                        StringTokenizer tok)

doDelSet

public String doDelSet(scanpage sp,
                       StringTokenizer tok)

getContainsSet

public String getContainsSet(scanpage sp,
                             StringTokenizer tok)
Checks if a Session variable contains a certain value.

Returns:
"YES" if the session variable contains the specified value "NO" if the session variable doesn't contains the specified value

doGetSet

public Vector doGetSet(scanpage sp,
                       StringTokenizer tok)

getSetString

public String getSetString(scanpage sp,
                           StringTokenizer tok)
returns the values of a session variable comma separated


getSetCount

public String getSetCount(scanpage sp,
                          StringTokenizer tok)
Gives the number of values contained by a certain session variable

Returns:
the number of values contained by the session variable

getSize

public int getSize()

getStates

public Map<String,String> getStates()
Description copied from class: Module
Returns the module's runtime-generated state information as a unmodifiable map with name-value pairs.

Overrides:
getStates in class Module

state

public Map<String,String> state()

setVisitInfo

void setVisitInfo(sessionInfo session)
Stores visiting info (counters) in a session

Deprecated-now:
remove in 1.7, not used

xmlEscape

public String xmlEscape(String s)
the XML reader will correct the escaped characters again. but scan will not evaluate the tags. only < has to be parsed to &<



MMBase 2.0-SNAPSHOT - null