org.mmbase.applications.community.modules
Class CommunityPrc

java.lang.Object
  extended byorg.mmbase.module.Module
      extended byorg.mmbase.module.ProcessorModule
          extended byorg.mmbase.applications.community.modules.CommunityPrc
All Implemented Interfaces:
ProcessorInterface

public class CommunityPrc
extends ProcessorModule

This module is the general manager for the community objects (chat and forums). It processes message posts, retrieves info, and generates lists of messages and users. In this manner, it is more an application than a module. The community 'application' consists of the Community, Channel, and Message builder.
The org.mmbase.module.builders.Community builder is a pool of channels of a similar type (chatbox, forum, or guestbook).
The org.mmbase.module.builders.Channel builder defines a channel - a 'location' which manages a forum discussion or chat.
The org.mmbase.module.builders.Message builder defines a single message - a persistent message in case of a forum or guestbook, a temporary message in the case of a chat.
Optional builders that provide additional information are a Moods builder (associated with a channel, it may provide backgrounds, colors, or other dressing), a Chatter builder (which hold the users of a chat or forum), or a Maps builder (used for generating links).

Version:
$Id: CommunityPrc.java,v 1.15 2004/03/16 12:24:45 michiel Exp $
Author:
Dirk-Jan Hoekstra, Pierre van Rooden

Constructor Summary
CommunityPrc()
          Create a Community module instance.
 
Method Summary
protected  boolean activate()
          Initialize the community and activate it if all builders are present.
 java.util.Vector getList(scanpage sp, StringTagger params, java.lang.String command)
          Generates a list of values from a command to the processor.
 MMObjectBuilder getListBuilder(java.lang.String command, java.util.Map params)
          Returns a virtual builder used to create node lists from the results returned by getList().
 java.util.Vector getListTemporaryRelations(StringTagger params)
          This function returns a vector, like LIST RELATED does, with the values of the specified fields of the related nodes to a specified node.
 java.util.Vector getNodeList(java.lang.Object context, java.lang.String command, java.util.Map params)
          Generates a list of values from a command to the processor.
 java.util.Vector getNodeListTemporaryRelations(java.util.Map params)
          This function returns a vector, like LIST RELATED does, with the values of the specified fields of the related nodes to a specified node.
 void init()
          Initialize the community.
 boolean process(scanpage sp, java.util.Hashtable cmds, java.util.Hashtable vars)
          Execute the commands provided in the form values.
 java.lang.String replace(scanpage sp, java.lang.String cmds)
          Handle a $MOD command.
 
Methods inherited from class org.mmbase.module.ProcessorModule
cacheCheck, onload, reload, replace, unload
 
Methods inherited from class org.mmbase.module.Module
getInitParameter, getInitParameters, getMaintainer, getMimeType, getMimeTypeFile, getModule, getModule, getModuleInfo, getModules, getName, getProperties, getProperty, getVersion, hasStarted, loadModulesFromDisk, maintainance, setInitParameter, setMaintainer, setName, setVersion, shutdown, shutdownModules, startModule, startModules, state
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CommunityPrc

public CommunityPrc()
Create a Community module instance.

Method Detail

init

public void init()
Initialize the community. Makes sure MMBase starts first (as it needs a reference to its builders).

Overrides:
init in class ProcessorModule

activate

protected boolean activate()
Initialize the community and activate it if all builders are present.

Since:
MMBase-1.7

replace

public java.lang.String replace(scanpage sp,
                                java.lang.String cmds)
Handle a $MOD command. The actual commands are directed to the Message, Channel, and Community builders.

Specified by:
replace in interface ProcessorInterface
Overrides:
replace in class ProcessorModule
Parameters:
sp - The scanpage (containing http and user info) that calls the function
cmds - the command to execute
Returns:
the result value as a String

process

public boolean process(scanpage sp,
                       java.util.Hashtable cmds,
                       java.util.Hashtable vars)
Execute the commands provided in the form values. This method returns values which allow the page to check whether the operation was succesful (MESSAGE-NUMBER or MESSAGE-ERROR). If the page has a session object, the data is stored in the session object. This means that SCAN can retrieve the data using the $SESSION command. If session is not present, the data is stored (added) in the vars parameter. This allows a system that uses the MMCI (such as jsp) to retrieve the value.
XXX: This is a bit of a sloppy way to pass results, and the actual mechanics may get changed (formalized) in the future.

Specified by:
process in interface ProcessorInterface
Overrides:
process in class ProcessorModule
Parameters:
sp - The scanpage (containing http and user info) that calls the function
cmds - the commands to process
vars - variables that were set to be used during processing.
Returns:
the result value as a String

getListBuilder

public MMObjectBuilder getListBuilder(java.lang.String command,
                                      java.util.Map params)
Returns a virtual builder used to create node lists from the results returned by getList(). The default method does not associate the builder with a cloud (mmbase module), so processormodules that need this association need to override this method. Note that different lists may return different builders.

Specified by:
getListBuilder in interface ProcessorInterface
Overrides:
getListBuilder in class ProcessorModule
Parameters:
command - the LIST command for which to retrieve the builder
params - contains the attributes for the list

getNodeList

public java.util.Vector getNodeList(java.lang.Object context,
                                    java.lang.String command,
                                    java.util.Map params)
                             throws ParseException
Generates a list of values from a command to the processor. Recognized commands are TREE, WHO, and TEMPORARYRELATIONS.

Specified by:
getNodeList in interface ProcessorInterface
Overrides:
getNodeList in class ProcessorModule
Parameters:
context - the context of the page or calling application (currently, this should be a scanpage object)
command - the list command to execute.
params - contains the attributes for the list
Returns:
a Vector that contains the list values as MMObjectNodes
Throws:
ParseException

getList

public java.util.Vector getList(scanpage sp,
                                StringTagger params,
                                java.lang.String command)
                         throws ParseException
Generates a list of values from a command to the processor. Recognized commands are TREE, WHO, and TEMPORARYRELATIONS. If the command is not one of these, it returns null;

Specified by:
getList in interface ProcessorInterface
Overrides:
getList in class ProcessorModule
Parameters:
sp - the page context
params - contains the attributes for the list
command - the list command to execute.
Returns:
a Vector that contains the list values
Throws:
ParseException

getListTemporaryRelations

public java.util.Vector getListTemporaryRelations(StringTagger params)
This function returns a vector, like LIST RELATED does, with the values of the specified fields of the related nodes to a specified node. Only the field values of nodes that are related via a temporary insrel object are returned. Both real and temporary nodes are returned.
  • <LIST TEMPORARYRELATED NODE="..." TYPE="..." FIELDS="...">
  • NODE - The node to get the related nodes from.
  • TYPE - The wanted type of nodes to return.
  • FIELDS - The values of the fields to return.


getNodeListTemporaryRelations

public java.util.Vector getNodeListTemporaryRelations(java.util.Map params)
This function returns a vector, like LIST RELATED does, with the values of the specified fields of the related nodes to a specified node. Only the field values of nodes that are related via a temporary insrel object are returned. Both real and temporary nodes are returned.
  • <LIST TEMPORARYRELATED NODE="..." TYPE="..." FIELDS="...">
  • NODE - The node to get the related nodes from.
  • TYPE - The wanted type of nodes to return.
  • FIELDS - The values of the fields to return.



MMBase build 1.7.1.20041002