org.mmbase.module
Class Config
java.lang.Object
|
+--org.mmbase.module.Module
|
+--org.mmbase.module.ProcessorModule
|
+--org.mmbase.module.Config
- All Implemented Interfaces:
- ProcessorInterface
- public class Config
- extends ProcessorModule
- Version:
- $Id: Config.java,v 1.14 2001/07/16 10:08:07 jaco Exp $
$Log: Config.java,v $
Revision 1.14 2001/07/16 10:08:07 jaco
jaco: Moved all configuration stuff to MMBaseContext.
If needed params not found or incorrect a ServletException with a description isthrown.
It's now again possible to not redirect System.out and System.err to a file.
Parameters are searched in the webapp (using context-param parameters) when started using a servlet.
If htmlroot is not specified MMBaseContext will try to set it to the webapp root directory.
Revision 1.13 2001/06/23 16:42:38 daniel
changed init to MMBaseContect
Revision 1.12 2001/03/06 16:17:35 pierre
pierre: added logging
Revision 1.11 2000/09/11 20:19:21 case
cjr: Added processing of $MOD-Config-REPORT, which displays a report on
the configuration, including error notifications, possibly with hints
Revision 1.10 2000/08/27 22:30:02 daniel
small change for mmdemo
Revision 1.8 2000/08/10 21:06:46 case
cjr: Added some badly needed comments
Revision 1.7 2000/08/06 14:56:18 case
cjr: Now tells if no dtd is defined - in this case no validation takes place and previously it was presented as if validation had been done successfully.
Revision 1.6 2000/08/06 10:00:42 case
cjr: very minor change
TODO:
- Add code for examples
- Add code to check whether database configuration works
- Add code for fault oriented results, rather than directory oriented results
- Author:
- cjr@dds.nl
Config module
This module analyses the MMBase XML configuration files.
LIST functions are:
- token=SHOW
- type={builders,databases,modules}
Returns an list of arrays:
$ITEM1 = name of file
$ITEM2 = DTD-based syntax check: false, nodtd, true
and for builders and databases there is:
$ITEM3 = whether the item is active: false, true
REPLACE functions are: SHOW, CHECK and ANNOTATE
where the next argument is the directory, e.g. 'builders'
and the third the name of the file without the .xml extension.
SHOW: return a string with syntax colored XML file
CHECK: return 1 if validates ok, -1 if not
ANNOTATE: return a string with the XML file with errors listed
and pointed out visually.
Example: $MOD-CONFIG-SHOW-builders-people
Additional REPLACE function is: REPORT
which has no arguments.
|
Constructor Summary |
Config()
Config, a support module for servscan |
|
Method Summary |
protected java.lang.String |
annotateXML(java.lang.String path)
|
boolean |
builderIsActive(java.lang.String path)
|
protected java.lang.String |
checkXML(java.lang.String path)
|
protected int |
checkXMLOk(java.lang.String path)
Do validity check on XML file |
boolean |
databaseIsActive(java.lang.String path)
|
java.util.Vector |
getList(scanpage sp,
StringTagger tagger,
java.lang.String value)
Generate a list of values from a command to the processor |
java.lang.String |
getModuleInfo()
provide some info on the module |
protected java.lang.String |
htmlEntities(java.lang.String s)
|
void |
init()
Initializes the module. |
java.util.Vector |
listConfigDirectories(java.lang.String path)
|
protected java.util.Vector |
listDirectory(java.lang.String path)
Retrieve all xml files in a directory |
void |
onload()
|
protected java.lang.String |
prettyPrintXML(java.lang.String path)
|
boolean |
process(scanpage sp,
java.util.Hashtable cmds,
java.util.Hashtable vars)
Execute the commands provided in the form values |
void |
reload()
|
java.lang.String |
replace(scanpage sp,
java.lang.String cmds)
Handle a $MOD command |
java.lang.String |
report(java.lang.String eol)
Temporary overall wrapper for report information |
java.lang.String |
reportBuilders(java.lang.String eol)
|
void |
shutdown()
|
void |
unload()
|
| Methods inherited from class org.mmbase.module.Module |
getClassName, getInitParameter, getInitParameters, getMaintainer, getMimeType, getMimeTypeFile, getModule, getModule, getModules, getName, getProperties, getProperty, getVersion, hasStarted, loadModulesFromDisk, maintainance, setClassName, setInitParameter, setMaintainer, setName, setVersion, startModule, startModules, state |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Config
public Config()
- Config, a support module for servscan
builderIsActive
public boolean builderIsActive(java.lang.String path)
databaseIsActive
public boolean databaseIsActive(java.lang.String path)
- Parameters:
path - Relative path to database mapping file- Returns:
- Whether a database mapping file is for the active DBMS
init
public void init()
- Description copied from class:
Module
- Initializes the module.
Init can be overridden to read the environment variables it needs.
This method is called by Module.startModule(), which makes sure it is not called
more than once. You should not call init() directly, call startModule() instead.
- Overrides:
init in class ProcessorModule
reload
public void reload()
- Overrides:
reload in class ProcessorModule
onload
public void onload()
- Overrides:
onload in class ProcessorModule
unload
public void unload()
- Overrides:
unload in class ProcessorModule
shutdown
public void shutdown()
- Overrides:
shutdown in class ProcessorModule
getList
public java.util.Vector getList(scanpage sp,
StringTagger tagger,
java.lang.String value)
throws ParseException
- Generate a list of values from a command to the processor
- Overrides:
getList in class ProcessorModule
- Following copied from class:
org.mmbase.module.ProcessorModule
- Parameters:
sp - the page contextparams - contains the attributes for the listcommand - the list command to execute.
listConfigDirectories
public java.util.Vector listConfigDirectories(java.lang.String path)
- Parameters:
path - Path to root of configuration files- Returns:
- Vector containing the names of the main configuration directories
listDirectory
protected java.util.Vector listDirectory(java.lang.String path)
throws java.io.IOException
- Retrieve all xml files in a directory
- Parameters:
path - Directory path- Returns:
- String array containing the names of the xml files in the directory
process
public boolean process(scanpage sp,
java.util.Hashtable cmds,
java.util.Hashtable vars)
- Execute the commands provided in the form values
- Overrides:
process in class ProcessorModule
report
public java.lang.String report(java.lang.String eol)
- Temporary overall wrapper for report information
reportBuilders
public java.lang.String reportBuilders(java.lang.String eol)
- Returns:
- String of newline separated active builders
replace
public java.lang.String replace(scanpage sp,
java.lang.String cmds)
- Handle a $MOD command
- Overrides:
replace in class ProcessorModule
getModuleInfo
public java.lang.String getModuleInfo()
- Description copied from class:
Module
- provide some info on the module
- Overrides:
getModuleInfo in class Module
prettyPrintXML
protected java.lang.String prettyPrintXML(java.lang.String path)
checkXMLOk
protected int checkXMLOk(java.lang.String path)
- Do validity check on XML file
- Returns:
- 0: No DTD defined
- 1: ok
- -1: false
htmlEntities
protected java.lang.String htmlEntities(java.lang.String s)
- Returns:
- String with '<' and '>' converted to respectively < and >
annotateXML
protected java.lang.String annotateXML(java.lang.String path)
checkXML
protected java.lang.String checkXML(java.lang.String path)
MMBase 2001