org.mmbase.module.gui.html
Class StateManager

java.lang.Object
  extended byorg.mmbase.module.gui.html.StateManager
All Implemented Interfaces:
CommandHandlerInterface

public class StateManager
extends java.lang.Object
implements CommandHandlerInterface

The StateManager class maintains a list of EditStates for users logged on to MMBase through SCAN. It provides the states so a user can browse the SCAN editors and edit objects, letting the server remember the change history. Changes to the state are made either by calling a replace ($MOD) command, or by processing parameters passed to a SCAN page. State info (such as the current editnode number) can be retrieved using $MOD.

Version:
$Id: StateManager.java,v 1.16 2003/07/04 14:38:46 pierre Exp $
Author:
Daniel Ockeloen, Hans Speijer, Pierre van Rooden

Field Summary
 MMBase mmBase
          Reference to the MMBase module.
 
Constructor Summary
StateManager(MMBase mmBase)
          Initialises the StateManager, by creating a new (empty) map of editstates.
 
Method Summary
 EditState getEditState(java.lang.String user)
          Retrieves the EditState for a user, or creates a new one if the user did not yet have an EditState assigned.
 java.util.Vector getList(scanpage sp, StringTagger args, java.util.StringTokenizer command)
          List commands
 java.util.Vector getOpenBuilders(EditState state, StringTagger args)
           
 EditState getState(java.lang.String user)
          Retrieves the EditState for a user, or creates a new one if the user did not yet have an EditState assigned.
 void initUserStates()
          Loads all previously persistified editstates from the database.
 boolean process(scanpage sp, java.util.StringTokenizer command, java.util.Hashtable cmds, java.util.Hashtable vars)
          The hook that passes all form related pages to the correct handler
 java.lang.String replace(scanpage sp, java.util.StringTokenizer commands)
          Handle a $MOD command.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mmBase

public MMBase mmBase
Reference to the MMBase module.

Constructor Detail

StateManager

public StateManager(MMBase mmBase)
Initialises the StateManager, by creating a new (empty) map of editstates.

Parameters:
mmBase - reference to the MMBase module
Method Detail

initUserStates

public void initUserStates()
Loads all previously persistified editstates from the database.


getEditState

public EditState getEditState(java.lang.String user)
Retrieves the EditState for a user, or creates a new one if the user did not yet have an EditState assigned. The EditState contains status information for a specific user (which node is being edited, for instance). EditStates are associated by username. They are kept in memory as long as teh StateManager is.

Parameters:
user - the user for which to retrieve an EditState object
Returns:
the EditState objevt associated with this user

replace

public java.lang.String replace(scanpage sp,
                                java.util.StringTokenizer commands)
Handle a $MOD command. This generally replaces the command in the SCAN page with the value returned by the command.
Commands include:

Specified by:
replace in interface CommandHandlerInterface

getList

public java.util.Vector getList(scanpage sp,
                                StringTagger args,
                                java.util.StringTokenizer command)
                         throws ParseException
List commands

Specified by:
getList in interface CommandHandlerInterface
Throws:
ParseException
Warning: No Java Documentation Available.

process

public boolean process(scanpage sp,
                       java.util.StringTokenizer command,
                       java.util.Hashtable cmds,
                       java.util.Hashtable vars)
The hook that passes all form related pages to the correct handler

Specified by:
process in interface CommandHandlerInterface
Warning: No Java Documentation Available.

getOpenBuilders

public java.util.Vector getOpenBuilders(EditState state,
                                        StringTagger args)
Warning: No Java Documentation Available.

getState

public EditState getState(java.lang.String user)
Retrieves the EditState for a user, or creates a new one if the user did not yet have an EditState assigned.

Parameters:
user - the user for which to retrieve an EditState object
Returns:
the EditState objevt associated with this user


MMBase build 1.7.4.20050922