KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > mmbase > bridge > Module


1 /*
2
3 This software is OSI Certified Open Source Software.
4 OSI Certified is a certification mark of the Open Source Initiative.
5
6 The license (Mozilla version 1.0) can be read at the MMBase site.
7 See http://www.MMBase.org/license
8
9 */

10
11 package org.mmbase.bridge;
12
13 import java.util.*;
14 import org.mmbase.util.functions.Function;
15 import org.mmbase.util.functions.Parameters;
16 import javax.servlet.*;
17
18 /**
19  * Modules are pieces of functionality that are not MMBase objects.
20  * e.g. Session, Mail, Upload and other functionality
21  *
22  * @author Rob Vermeulen
23  * @author Pierre van Rooden
24  * @version $Id: Module.java,v 1.16 2005/07/28 16:53:45 michiel Exp $
25  */

26 public interface Module {
27
28     /**
29      * Retrieves the CloudContext to which this module belongs
30      * @return CloudContext
31      */

32     public CloudContext getCloudContext();
33
34     /**
35      * Retrieve the name of the module (in the default language defined in mmbaseroot.xml).
36      * @return name of the module
37      */

38     public String JavaDoc getName();
39
40     /**
41      * Retrieve the description of the module.
42      * @return description of the module
43      */

44     public String JavaDoc getDescription();
45
46     /**
47      * Retrieve a property of the module.
48      * @param name the name of the property
49      * @return the property value (null if not given)
50      * @since MMBase-1.7
51      */

52     public String JavaDoc getProperty(String JavaDoc name);
53
54     /**
55      * Retrieve a copy of the module's properties
56      * @return a map of module properties
57      * @since MMBase-1.7
58      */

59     public Map getProperties();
60
61     /**
62      * Runs the command with the given parameter(s).
63      * @param command the command to run, i.e. "MESSAGE-UPDATE".
64      * @param parameter the main parameter for the command. Depends on the command issued. Not all
65      * commands make use of this parameter.
66      */

67     public void process(String JavaDoc command, Object JavaDoc parameter);
68
69     /**
70      * Runs the command with the given parameter(s).
71      * @param command the command to run, i.e. "MESSAGE-UPDATE".
72      * @param parameter the main parameter for the command. Depends on the command issued. Not all
73      * commands make use of this parameter.
74      * @param auxparameters additional parameters for this command.
75      */

76     public void process(String JavaDoc command, Object JavaDoc parameter, Map auxparameters);
77
78     /**
79      * Runs the command with the given parameter(s).
80      * @param command the command to run, i.e. "MESSAGE-UPDATE".
81          * @param parameter the main parameter for the command. Depends on the command issued. Not all
82          * commands make use of this parameter.
83          * @param auxparameters additional parameters for this command.
84      * @param req the Request item to use for obtaining user information. For backward compatibility.
85      * @param resp the Response item to use for redirecting users. For backward compatibility.
86      */

87     public void process(String JavaDoc command, Object JavaDoc parameter, Map auxparameters, ServletRequest req, ServletResponse resp);
88
89     /**
90      * Retrieve info from a module based on a command string.
91      * Similar to the $MOD command in SCAN.
92      * @param command the info to obtain, i.e. "USER-OS".
93      * @return info from a module
94      */

95     public String JavaDoc getInfo(String JavaDoc command);
96
97     /**
98      * Retrieve info from a module based on a command string
99      * Similar to the $MOD command in SCAN.
100      * @param command the info to obtain, i.e. "USER-OS".
101      * @param req the Request item to use for obtaining user information. For backward compatibility.
102      * @param resp the Response item to use for redirecting users. For backward compatibility.
103      * @return info from a module
104      */

105     public String JavaDoc getInfo(String JavaDoc command, ServletRequest req, ServletResponse resp);
106
107     /**
108      * Retrieve info (as a list of virtual nodes) from a module based on a command string.
109      * Similar to the LIST command in SCAN.
110      * The values retrieved are represented as fields of a virtual node, named following the fieldnames listed in the fields paramaters..
111      * @param command the info to obtain, i.e. "USER-OS".
112      * @param parameters a hashtable containing the named parameters of the list.
113      * @return info from a module (as a list of virtual nodes)
114      */

115     public NodeList getList(String JavaDoc command, Map parameters);
116
117     /**
118      * Retrieve info from a module based on a command string
119      * Similar to the LIST command in SCAN.
120      * The values retrieved are represented as fields of a virtual node, named following the fieldnames listed in the fields paramaters..
121      * @param command the info to obtain, i.e. "USER-OS".
122      * @param parameters a hashtable containing the named parameters of the list.
123      * @param req the Request item to use for obtaining user information. For backward compatibility.
124      * @param resp the Response item to use for redirecting users. For backward compatibility.
125      * @return info from a module (as a list of virtual nodes)
126      */

127     public NodeList getList(String JavaDoc command, Map parameters, ServletRequest req, ServletResponse resp);
128
129     /**
130      * Returns all the Function objects of this Module.
131      *
132      * @since MMBase-1.8
133      * @return a Collection of {@link org.mmbase.util.functions.Function} objects.
134      */

135     public Collection getFunctions();
136
137     /**
138      * Returns a Fuction object.
139      * The object returned is a {@link org.mmbase.util.functions.Function} object.
140      * You need to explixitly cast the result to this object, since not all bridge
141      * implementations (i.e. the RMMCI) support this class.
142      *
143      * @since MMBase-1.8
144      * @param functionName name of the function
145      * @return a {@link org.mmbase.util.functions.Function} object.
146      * @throws NotFoundException if the function does not exist
147      */

148     public Function getFunction(String JavaDoc functionName);
149
150     /**
151      * Creates a parameter list for a function.
152      * The list can be filled with parameter values by either using the List set(int, Object) method, to
153      * set values for parameters by psoition, or by using the set(String, Object) method to
154      * set parameters by name.<br />
155      * This object can then be passed to the getFunctionValue method.
156      * Note that adding extra parameters (with the add(Object) method) won't work and may cause exceptions.
157      * @since MMBase-1.8
158      * @param functionName name of the function
159      * @return a {@link org.mmbase.util.functions.Parameters} object.
160      * @throws NotFoundException if the function does not exist
161      */

162     public Parameters createParameters(String JavaDoc functionName);
163
164     /**
165      * Executes a function on this module with the given parameters, and returns the result.
166      *
167      * @since MMBase-1.8
168      * @param functionName name of the function
169      * @param parameters list with parameters for the fucntion
170      * @return the result value of executing the function
171      * @throws NotFoundException if the function does not exist
172      */

173     public FieldValue getFunctionValue(String JavaDoc functionName, List parameters);
174
175 }
176
Popular Tags