[opencms-dev] Getting changed module parameters without restarting

Pavel Peringer pavel.peringer at qbizm.cz
Fri May 12 12:50:42 CEST 2006


Hello Ruben

Thanks for your help, it works the way I want.
I maybe used the wrong term "parent module", I thought the module that 
the action class belongs to, not a "super" class.

I have debug the OpenCms module update code and did not notice that they 
call the updateModule() method for module..
So in my suggested way I have got to the this method on over generating 
event instead overwrite that method directly.

Thanks again :-)

Pavel Peringer

>
>
> i didn't read the "parent module" part. sorry.
>
> :)
>
> .rm
>
> Ruben Malchow wrote:
>
>>
>> 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
>>>
>>
>> _______________________________________________
>> This mail is sent to you from the opencms-dev mailing list
>> To change your list options, or to unsubscribe from the list, please 
>> visit
>> http://lists.opencms.org/mailman/listinfo/opencms-dev
>>
>
> _______________________________________________
> This mail is sent to you from the opencms-dev mailing list
> To change your list options, or to unsubscribe from the list, please 
> visit
> http://lists.opencms.org/mailman/listinfo/opencms-dev



-- 
Pavel Peringer                              Qbizm technologies, a.s.
programator                                 ... the art of software.
____________________________________________________________________
www.qbizm-technologies.cz    www.qbizm.cz      www.qbizm-services.cz




More information about the opencms-dev mailing list