[opencms-dev] maintenance class for modules

Simon Knightley simon.knightley at syskinetic.co.uk
Tue Apr 30 10:19:34 CEST 2002


Dan,

We have used moduleWasUploaded (called when your module is first
installed) to configure database tables when a module is first
installed, moduleParameterWasUpdated (called when a parameter in your
module is changed in the module management view) can be used as in the
News example for keeping variables in sync and moduleWasDeleted for
database cleanup after removing the module.  If you try to upload a
module over another, OpenCMS will ask which files you want to replace
and does a pretty good job of the versioning.

Other than for the above, we haven't found much use for the maintenance
class.  Possibly if you are writing large modules with multiple
dependencies then this will come into its own.

The only other tip for module writing is whether you want to follow the
OpenCMS standard module system or whether to write from scratch.  If
your module simple consists of a list of things that you add and remove
(surprising how often this is all you need) then the built in module
system is good, otherwise write everything from scratch.

By the way, the OpenCMS-Lucene integration we did uses a maintenance
class to create the database.  You can see it at
http://www.syskinetic.com/customer/links.html

Good luck

Simon Knightley
Consulting Director
Syskinetic Consulting Limited
http://www.syskinetic.com


-----Original Message-----
From: owner-opencms-dev at www.opencms.org
[mailto:owner-opencms-dev at www.opencms.org] On Behalf Of Dan Moore
Sent: 29 April 2002 23:10
To: opencms-dev at www.opencms.org
Subject: RE: [opencms-dev] maintenance class for modules

Hi Simon.

On Fri, 26 Apr 2002 10:08, Simon Knightley wrote:

> Dan,
> 
> I just realised I may have misunderstood your question.  The methods
you
> need are:
> 
> public static void moduleWasUploaded(CmsObject cms)
> public static void moduleParameterWasUpdated(CmsObject cms) 
> public static void moduleWasDeleted(CmsObject cms)
> 
> The documentation around this area is a little sketchy.  But if you
need
> any more tips we may have someone in the office who can help.

Thanks for the information.  I agree the documentation is a bit sketchy.
It looks like these methods are called the com.opencms.file.CmsRegistry
class, so I guess I should continue looking there.

I'm not even sure whether I need a module maintainance class.  I assume,
based on the parameter names, that these methods are called during
certain
times in the life cycle of a module.  

May I ask what you have found these methods useful for?  

I can see them being good for cleaning up a database on module delete,
and
possibly handling 'module upgrades' nicely (perhaps--right now if you
try
to upload a module over another one, OpenCms complains).

Thanks for the info.

Dan




More information about the opencms-dev mailing list