|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||

java.lang.Objectorg.mmbase.util.functions.FunctionProvider
org.mmbase.util.functions.DescribedFunctionProvider
org.mmbase.module.Module
public abstract class Module
An MMBase Module is an extension of this class, which is configured by an XML file in the <mmbase
config dir>/modules directory. All modules whose xml configuration file defines them as 'active' are
automaticly loaded and initialized.
There are several modules which are more or less compulsary in MMBase, like the 'mmbaseroot'
module, the actual core of MMBase implemented by MMBase, and the
'jdbc' module.
| Field Summary | |
|---|---|
protected String |
configurationPath
|
protected Function<String> |
getMaintainerFunction
This function returns the Module's maintainer as a String. |
protected Function<Integer> |
getVersionFunction
This function returns the Module's version number as an Integer. |
protected Map<String,String> |
properties
Properties (initparameters) set by reading (or re-reading) the module configuration. |
String |
STATE_START_TIME
State identifier for module startup time. |
| Fields inherited from class org.mmbase.util.functions.DescribedFunctionProvider |
|---|
description, guiName, name |
| Fields inherited from class org.mmbase.util.functions.FunctionProvider |
|---|
functions, getFunctions |
| Constructor Summary | |
|---|---|
Module()
Deprecated. |
|
Module(String name)
|
|
| Method Summary | ||
|---|---|---|
protected static Map<String,String> |
addInitParameters(String contextPath,
Map<String,String> map)
|
|
static void |
checkModules(boolean startOnLoad,
String... names)
Makes sure that modules are loaded and started. |
|
String |
getInitParameter(String key)
Gets an init-parameter key-value pair |
|
static String |
getInitParameter(String module,
Map<String,String> props,
String key)
|
|
static String |
getInitParameter(String module,
String key)
|
|
Map<String,String> |
getInitParameters()
Gets own modules properties |
|
static Map<String,String> |
getInitParameters(String module)
|
|
String |
getMaintainer()
|
|
static
|
getModule(Class<C> clazz)
|
|
static
|
getModule(Class<C> clazz,
boolean check)
Since modules normally all have a different class, you can also obtain a module by its Class, in stead of by its name. |
|
static Module |
getModule(String name)
Retrieves a reference to a Module. |
|
static Module |
getModule(String name,
boolean startOnLoad)
Retrieves a reference to a Module. |
|
String |
getModuleInfo()
Deprecated. use getDescription |
|
static ResourceLoader |
getModuleLoader()
|
|
ModuleReader |
getModuleReader()
|
|
static ModuleReader |
getModuleReader(String configurationPath)
|
|
static Iterator<Module> |
getModules()
Returns an iterator of all the modules that are currently active. |
|
String |
getState(String name)
Returns a state value by name. |
|
Map<String,String> |
getStates()
Returns the module's runtime-generated state information as a unmodifiable map with name-value pairs. |
|
int |
getVersion()
|
|
static boolean |
hasModule(String name)
|
|
boolean |
hasStarted()
Returns whether the module has started (has been initialized or is in its initialization fase). |
|
void |
init()
Initializes the module. |
|
void |
loadInitParameters()
Override properties through application context |
|
protected void |
loadInitParameters(String contextPath)
Override properties through application context |
|
void |
maintainance()
Deprecated. Method name is not correct english. And btw the complete method is dubious. It is called once an hour for every module. But I know of no modules which actually do something useful here, because an hours is always either too short, or too long. |
|
void |
onload()
prepares the module when loaded. |
|
void |
setInitParameter(String key,
String value)
Sets an init-parameter key-value pair |
|
void |
setMaintainer(String m)
|
|
String |
setState(String name,
String value)
Sets a state value by name. |
|
void |
setVersion(int v)
|
|
protected void |
shutdown()
Shuts down the module. |
|
static void |
shutdownModules()
Calls shutdown of all registered modules. |
|
void |
startModule()
Starts the module. |
|
static void |
startModules()
|
|
| Methods inherited from class org.mmbase.util.functions.DescribedFunctionProvider |
|---|
getDefaultLocale, getDescription, getDescription, getGUIName, getGUIName, getLocalizedDescription, getLocalizedGUIName, getName, setDescription, setDescription, setGUIName, setGUIName, setLocalizedDescription, setLocalizedGUIName, setName |
| Methods inherited from class org.mmbase.util.functions.FunctionProvider |
|---|
addFunction, createParameters, getFunction, getFunctions, getFunctionValue, newFunctionInstance |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public final String STATE_START_TIME
protected Function<Integer> getVersionFunction
protected Function<String> getMaintainerFunction
protected Map<String,String> properties
protected String configurationPath
| Constructor Detail |
|---|
public Module()
public Module(String name)
| Method Detail |
|---|
public static ResourceLoader getModuleLoader()
public static ModuleReader getModuleReader(String configurationPath)
public ModuleReader getModuleReader()
public final void startModule()
init() of a module exactly once.
In other words, once the init() is called, it does not call it again.
This method is final and cannot be overridden.
It is used to safely initialize modules during startup, and allows other modules
to force the 'startup' of another module without risk.
public final boolean hasStarted()
public void init()
startModule(), which makes sure it is not called
more than once. You should not call init() directly, call startModule() instead.
public void onload()
startModules(). You should not call onload() directly.
protected void shutdown()
public String getState(String name)
public final String setState(String name,
String value)
public Map<String,String> getStates()
public void setInitParameter(String key,
String value)
public static Map<String,String> getInitParameters(String module)
throws IOException
IOException
public static String getInitParameter(String module,
Map<String,String> props,
String key)
public static String getInitParameter(String module,
String key)
throws IOException
IOExceptionpublic String getInitParameter(String key)
public Map<String,String> getInitParameters()
public void loadInitParameters()
protected static Map<String,String> addInitParameters(String contextPath,
Map<String,String> map)
protected void loadInitParameters(String contextPath)
contextPath - path in application context where properties are locatedpublic static Iterator<Module> getModules()
null if no attempt has the modules have (not) yet been to loaded.
Unlike getModule(java.lang.String), this method does not automatically load modules if this hadn't occurred yet.
Synchorinze on Module.class.
Iterator with all active modules.public String getModuleInfo()
public void maintainance()
public static void shutdownModules()
public static void startModules()
public static boolean hasModule(String name)
public static Module getModule(String name)
name - the name of the module to retrieve
Module, or null if the
module does not exist or is inactive.
public static <C extends Module> C getModule(Class<C> clazz,
boolean check)
clazz - The class of the desired Module
null if no such module.public static <C extends Module> C getModule(Class<C> clazz)
public static void checkModules(boolean startOnLoad,
String... names)
names - Limit to these modules.
public static Module getModule(String name,
boolean startOnLoad)
startOnLoad to true,
this call ensures that the requested module has been initialized by
calling the startModule() method.
This is needed if you need to call Module methods from the init() of
another module.
name - the name of the module to retrievestartOnLoad - if true, the code makes sure the module has been started
Module, or null if the
module does not exist or is inactive.public String getMaintainer()
public void setMaintainer(String m)
public void setVersion(int v)
public int getVersion()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||