[opencms-dev] maintenance class for modules

Stephan Hartmann hartmann at waehrisch-feykes.de
Wed May 29 12:54:45 CEST 2002


Hi Simon,

i am using MySQL and the standard poolname.
so far i can say that it is not working in OpenCms version 4.6.0 and 4.6.1.
I already tested it with debug code in method moduleWasUploaded, but got no 
output.
But i get debug output from the method moduleParameterWasUpdated.
I will try it again with version 4.4.6. From the CVS web i can see that there 
have been some changes between this versions in 
com.opencms.file.CmsRegistry.java

Maybe the guy who was programming the module upload part reads this and can 
give some information.

Bye,
Stephan


>
> Try going to administration then modules and properties for the module.
> There should be a value for poolname.  In my distribution this is set
> to:
> poolname: jdbc:opencmspool:mysql
>
> This should be the same as the value in the opencms.properties file:
> resourcebroker.mysql.pool=jdbc:opencmspool:mysql
>
> If you are not using mysql, this will not work and will need to be
> changed to match your installation.  The module has only been tested
> with mysql and OpenCMS 4.4.6.  I can't guarantee the behaviour under any
> other platform.
>
> Also, perhaps you could put some debug code next to where the database
> is created and check to make sure that the code is actually being
> executed and whether any exceptions are being generated.  I'd be
> interested in your results.
>
> If someone wants to test on other platforms I would appreciate any
> observations about its behaviour.
>
> 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: 28 May 2002 11:03
> To: opencms-dev at www.opencms.org
> Subject: Re: [opencms-dev] maintenance class for modules
>
> Hi Simon,
>
> i got the latest version and found the interesting places. It's the same
> as
> in my class. When i upload your module, the lucene_index table is not
> created
> neither.
> I am using OpenCms version 4.6.0. Does it only work with version 4.6.1?
> I'll
> give it a try.
>
> Bye,
> Stephan
>
> Am Montag, 27. Mai 2002 17:19 schrieben Sie:
> > 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