[opencms-dev] Getting changed module parameters without restarting
Ruben Malchow
ruben at khm.de
Fri May 12 10:49:30 CEST 2006
hello pavel,
do you use the module management frontend to change the parameters?
because here, it works swell: when i change module parameters, the
moduleUpdate(CmsModule cmsmod)
method is called. and
cmsmod.getParameters()
returns a map of the new parameters. to register that, you will have to
extend
org.opencms.module.A_CmsModuleAction
example:
package foo.bar.module;
import org.opencms.module.A_CmsModuleAction;
public class FooBarModuleAction extends A_CmsModuleAction {
private String saveDir=null;
[...]
public void moduleUpdate(CmsModule arg0) {
this.saveDir=arg0.getParameter("saveDir");
}
}
and register it in your manifest.xml:
<module>
<name>foo.bar.module</name>
<class>foo.bar.module.FooBarModuleAction</class>
[...]
</module>
regards
.rm
Pavel Peringer wrote:
> Hello
>
> I have some module using its module parameters for working. I would like
> change the module parameters ie. files store dir. But I do not want
> restart whole web application only for this not so important change.
>
> If I change the module parameters, the module state is frozen after
> calling org.opencms.module.CmsModule.initialize() and I allways get the
> "old" parameters until restart.
>
> When some resource in VFS is changed, the appropriate event is fired.
> Could be possible fire similar event (ie.
> EVENT_MODULE_PARAMETERS_CHANGED) in
> org.opencms.workplace.tools.modules.CmsModulesEditBase.actionCommit()?
>
> Example (update module code part):
> OpenCms.getModuleManager().updateModule(getCms(), m_module);
>
> Map data = new HashMap();
> data.put(KEY_MODULE_NAME, m_module.getName());
> data.put(KEY_MODULE_PARAMETERS, m_module.getParameters());
> OpenCms.fireCmsEvent(EVENT_MODULE_PARAMETERS_CHANGED, data);
>
> Of cource add these constants to the interface.
>
> Every action module class listening to this event then could be able to
> update parameters when the event was fired from its "parent" module.
> For this purpose it must have its own Map object because the "parent"
> module is frozen and do not return new values.
>
> Or there is other existing solution for reload changed module parameters
> without restarting webapp container (Apache/Tomcat/..) ?
>
> Thanks for answer
>
> Pavel Peringer
>
More information about the opencms-dev
mailing list