[opencms-dev] maintenance class for modules
Simon Knightley
simon.knightley at syskinetic.co.uk
Mon May 27 17:19:02 CEST 2002
Stephan,
Make sure you have the latest version of the module from our website;
one of the previous versions did not create the tables on upload. The
file you need to look at is IndexContentDefinition.java there is a
constant set at the beginning of the file:
private static final String C_CREATE_TABLE = "create table
lucene_index (id int not null,name varchar(50) not null, description
varchar(50), path varchar(200), date timestamp(14), lockstate int not
null, primary key(id), unique(name));";
later in the same file you will find the function
moduleWasUploaded(CmsObject cms) this uses the OpenCMS connection pool
to execute the SQL statement held in C_CREATE_TABLE
moduleWasUploaded is called automatically when the module is uploaded
for the first time.
I hope this makes sense. Let me know if you are still unclear.
Regards
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 Stephan Hartmann
Sent: 27 May 2002 14:47
To: opencms-dev at www.opencms.org
Subject: Re: [opencms-dev] maintenance class for modules
Hi Simon,
i just ran into this problem that i want my database tables to be
created
during module upload. Unfortunatelly, it does not create anything. I
downloaded your Lucene module but can't find the place where the tables
are
created. Can you explain it a little?
Bye,
Stephan
Am Dienstag, 30. April 2002 10:19 schrieben Sie:
> 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
--
Stephan Hartmann
Währisch & Feykes GmbH
Gustav-Adolf-Str. 5
47057 Duisburg
Tel. 0203 / 373 070
Fax 0203 / 376 766
hartmann at wfnetz.de
------------------------------------------------------
Ausschlusserklärung (Disclaimer):
Über das Internet versandte E-mails können unter fremden Namen erstellt
oder
manipuliert werden. Aus diesem Grund enthalten unsere mit E-mail
verschickten
Nachrichten grundsätzlich keine rechtsverbindlichen Willenserklärungen.
More information about the opencms-dev
mailing list