org.mmbase.bridge
Interface Module

All Superinterfaces:
Comparable<Module>, Descriptor
All Known Implementing Classes:
ModuleHandler

public interface Module
extends Descriptor, Comparable<Module>

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

Version:
$Id: Module.java 34900 2009-05-01 16:29:42Z michiel $
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
 Function getFunction(String functionName)
          Returns a Function object.
 Collection<Function<?>> 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<String,?> parameters)
          Retrieve info (as a list of virtual nodes) from a module based on a command string.
 NodeList getList(String command, Map<String,?> 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<String,Object> auxparameters)
          Runs the command with the given parameter(s).
 void process(String command, Object parameter, Map<String,Object> auxparameters, ServletRequest req, ServletResponse resp)
          Runs the command with the given parameter(s).
 
Methods inherited from interface org.mmbase.bridge.Descriptor
getDescription, getDescription, getGUIName, getGUIName, getLocalizedDescription, getLocalizedGUIName, setDescription, setDescription, setGUIName, setGUIName
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Method Detail

getCloudContext

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

Returns:
CloudContext

getName

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

Specified by:
getName in interface Descriptor
Returns:
name of the module

getProperty

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

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

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

process

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

void process(String command,
             Object parameter,
             Map<String,Object> 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

void process(String command,
             Object parameter,
             Map<String,Object> 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

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

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

NodeList getList(String command,
                 Map<String,?> 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

NodeList getList(String command,
                 Map<String,?> 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

Collection<Function<?>> getFunctions()
Returns all the Function objects of this Module.

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

getFunction

Function getFunction(String functionName)
Returns a Function object. The object returned is a Function object. You need to explicitly 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

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 position, 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

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 function
Returns:
the result value of executing the function
Throws:
NotFoundException - if the function does not exist
Since:
MMBase-1.8


MMBase 2.0-SNAPSHOT - null