org.mmbase.bridge
Interface Module

All Known Implementing Classes:
ModuleHandler

public interface Module

Modules are pieces of functionality that are not MMBase objects. e.g. Session, Mail, Upload and other functionality

Version:
$Id: Module.java,v 1.16 2005/07/28 16:53:45 michiel Exp $
Author:
Rob Vermeulen, Pierre van Rooden

Method Summary
 Parameters createParameters(String functionName)
          Creates a parameter list for a function.
 CloudContext getCloudContext()
          Retrieves the CloudContext to which this module belongs
 String getDescription()
          Retrieve the description of the module.
 Function getFunction(String functionName)
          Returns a Fuction object.
 Collection getFunctions()
          Returns all the Function objects of this Module.
 FieldValue getFunctionValue(String functionName, List parameters)
          Executes a function on this module with the given parameters, and returns the result.
 String getInfo(String command)
          Retrieve info from a module based on a command string.
 String getInfo(String command, ServletRequest req, ServletResponse resp)
          Retrieve info from a module based on a command string Similar to the $MOD command in SCAN.
 NodeList getList(String command, Map parameters)
          Retrieve info (as a list of virtual nodes) from a module based on a command string.
 NodeList getList(String command, Map parameters, ServletRequest req, ServletResponse resp)
          Retrieve info from a module based on a command string Similar to the LIST command in SCAN.
 String getName()
          Retrieve the name of the module (in the default language defined in mmbaseroot.xml).
 Map getProperties()
          Retrieve a copy of the module's properties
 String getProperty(String name)
          Retrieve a property of the module.
 void process(String command, Object parameter)
          Runs the command with the given parameter(s).
 void process(String command, Object parameter, Map auxparameters)
          Runs the command with the given parameter(s).
 void process(String command, Object parameter, Map auxparameters, ServletRequest req, ServletResponse resp)
          Runs the command with the given parameter(s).
 

Method Detail

getCloudContext

public CloudContext getCloudContext()
Retrieves the CloudContext to which this module belongs

Returns:
CloudContext

getName

public String getName()
Retrieve the name of the module (in the default language defined in mmbaseroot.xml).

Returns:
name of the module

getDescription

public String getDescription()
Retrieve the description of the module.

Returns:
description of the module

getProperty

public String getProperty(String name)
Retrieve a property of the module.

Parameters:
name - the name of the property
Returns:
the property value (null if not given)
Since:
MMBase-1.7

getProperties

public Map getProperties()
Retrieve a copy of the module's properties

Returns:
a map of module properties
Since:
MMBase-1.7

process

public void process(String command,
                    Object parameter)
Runs the command with the given parameter(s).

Parameters:
command - the command to run, i.e. "MESSAGE-UPDATE".
parameter - the main parameter for the command. Depends on the command issued. Not all commands make use of this parameter.

process

public void process(String command,
                    Object parameter,
                    Map auxparameters)
Runs the command with the given parameter(s).

Parameters:
command - the command to run, i.e. "MESSAGE-UPDATE".
parameter - the main parameter for the command. Depends on the command issued. Not all commands make use of this parameter.
auxparameters - additional parameters for this command.

process

public void process(String command,
                    Object parameter,
                    Map auxparameters,
                    ServletRequest req,
                    ServletResponse resp)
Runs the command with the given parameter(s).

Parameters:
command - the command to run, i.e. "MESSAGE-UPDATE".
parameter - the main parameter for the command. Depends on the command issued. Not all commands make use of this parameter.
auxparameters - additional parameters for this command.
req - the Request item to use for obtaining user information. For backward compatibility.
resp - the Response item to use for redirecting users. For backward compatibility.

getInfo

public String getInfo(String command)
Retrieve info from a module based on a command string. Similar to the $MOD command in SCAN.

Parameters:
command - the info to obtain, i.e. "USER-OS".
Returns:
info from a module

getInfo

public String getInfo(String command,
                      ServletRequest req,
                      ServletResponse resp)
Retrieve info from a module based on a command string Similar to the $MOD command in SCAN.

Parameters:
command - the info to obtain, i.e. "USER-OS".
req - the Request item to use for obtaining user information. For backward compatibility.
resp - the Response item to use for redirecting users. For backward compatibility.
Returns:
info from a module

getList

public NodeList getList(String command,
                        Map parameters)
Retrieve info (as a list of virtual nodes) from a module based on a command string. Similar to the LIST command in SCAN. The values retrieved are represented as fields of a virtual node, named following the fieldnames listed in the fields paramaters..

Parameters:
command - the info to obtain, i.e. "USER-OS".
parameters - a hashtable containing the named parameters of the list.
Returns:
info from a module (as a list of virtual nodes)

getList

public NodeList getList(String command,
                        Map parameters,
                        ServletRequest req,
                        ServletResponse resp)
Retrieve info from a module based on a command string Similar to the LIST command in SCAN. The values retrieved are represented as fields of a virtual node, named following the fieldnames listed in the fields paramaters..

Parameters:
command - the info to obtain, i.e. "USER-OS".
parameters - a hashtable containing the named parameters of the list.
req - the Request item to use for obtaining user information. For backward compatibility.
resp - the Response item to use for redirecting users. For backward compatibility.
Returns:
info from a module (as a list of virtual nodes)

getFunctions

public Collection getFunctions()
Returns all the Function objects of this Module.

Returns:
a Collection of Function objects.
Since:
MMBase-1.8

getFunction

public Function getFunction(String functionName)
Returns a Fuction object. The object returned is a Function object. You need to explixitly cast the result to this object, since not all bridge implementations (i.e. the RMMCI) support this class.

Parameters:
functionName - name of the function
Returns:
a Function object.
Throws:
NotFoundException - if the function does not exist
Since:
MMBase-1.8

createParameters

public Parameters createParameters(String functionName)
Creates a parameter list for a function. The list can be filled with parameter values by either using the List set(int, Object) method, to set values for parameters by psoition, or by using the set(String, Object) method to set parameters by name.
This object can then be passed to the getFunctionValue method. Note that adding extra parameters (with the add(Object) method) won't work and may cause exceptions.

Parameters:
functionName - name of the function
Returns:
a Parameters object.
Throws:
NotFoundException - if the function does not exist
Since:
MMBase-1.8

getFunctionValue

public FieldValue getFunctionValue(String functionName,
                                   List parameters)
Executes a function on this module with the given parameters, and returns the result.

Parameters:
functionName - name of the function
parameters - list with parameters for the fucntion
Returns:
the result value of executing the function
Throws:
NotFoundException - if the function does not exist
Since:
MMBase-1.8


MMBase build 1.8.1.20060716