public abstract class Module extends DescribedFunctionProvider
MMBase, and the
'jdbc' module.| Modifier and Type | Field and Description |
|---|---|
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.
|
description, guiName, namefunctions, getFunctions| Constructor and Description |
|---|
Module()
Deprecated.
|
Module(String name) |
| Modifier and Type | Method and Description |
|---|---|
protected static Map<String,String> |
addInitParameters(String contextPath,
Map<String,String> map) |
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 <C extends Module> |
getModule(Class<C> clazz) |
static <C extends Module> |
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() |
getDefaultLocale, getDescription, getDescription, getGUIName, getGUIName, getLocalizedDescription, getLocalizedGUIName, getName, setDescription, setDescription, setGUIName, setGUIName, setLocalizedDescription, setLocalizedGUIName, setNameaddFunction, createParameters, getFunction, getFunctions, getFunctionValue, newFunctionInstancepublic final String STATE_START_TIME
protected Function<Integer> getVersionFunction
protected Function<String> getMaintainerFunction
protected Map<String,String> properties
protected String configurationPath
public Module()
public Module(String name)
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 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
IOExceptionpublic static String getInitParameter(String module, Map<String,String> props, String key)
public static String getInitParameter(String module, String key) throws IOException
IOExceptionpublic 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 final 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 final void shutdownModules()
public static final void startModules()
public static boolean hasModule(String name)
public static Module getModule(String name)
name - the name of the module to retrieveModule, 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 Modulenull if no such module.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 startedModule, 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()
MMBase 1.9-SNAPSHOT - ${javadoctimestamp}