[opencms-dev] rebuild search indexes when modify a xmlcontent

Chauhan, Amit Amit_Chauhan at intuit.com
Fri Dec 21 20:09:52 CET 2007


Create your module. In your module, create a class that implements
I_CmsModuleAction interface (or just extends A_CmsModuleAction class).

In it's initialize method, register itself to listen for events. Once
registered cmsEvent method will be invoked everytime any event occurs.
Look for class I_CmsEventListener for what kind of events you can listen
to.

I hope you know how to deploy your own module. If not, then it's in the
documentation that came along with OpenCms.

 

The class would look something like this:

 

public class ActionClass implements I_CmsModuleAction {

 

    public void initialize(CmsObject arg0, CmsConfigurationManager arg1,
CmsModule arg2) {

        try{

            org.opencms.main.OpenCms.addCmsEventListener(this);

        }catch(Exception e){

            // Do not throw anything.

            e.printStackTrace ();

        }

 

    }

 

    public void moduleUninstall(CmsModule arg0) {

        // Do nothing

    }

 

    public void moduleUpdate(CmsModule arg0) {

        // Do nothing

    }

 

    public void publishProject(CmsObject arg0, CmsPublishList arg1, int
arg2, I_CmsReport arg3) {

        // Do nothing

    }

 

    public void shutDown(CmsModule arg0) {

        // Do nothing

    }

 

    public void cmsEvent(CmsEvent event) {

        // send a test email if this method is executed.

        switch (event.getType()) {

            case I_CmsEventListener.EVENT_RESOURCE_MODIFIED:

            // send the email

            break;

        }

    }

}

 

 

 

Thanks

Amit Chauhan

510-449-3402

________________________________

From: opencms-dev-bounces at opencms.org
[mailto:opencms-dev-bounces at opencms.org] On Behalf Of Salvador Santander
Gutierrez
Sent: Friday, December 21, 2007 3:55 AM
To: OpenCms Mailing List (E-mail)
Subject: [opencms-dev] rebuild search indexes when modify a xmlcontent

 

Hi, list.

 

We've verified that opencms 7 rebuild search indexes when publish, but
we need to rebuild anytime you create or modify a xmlcontent. Is it
posible? How? Does exist an event we can use to detect a creation or
modification in a xmlcontent and call to rebuild method?

 

Thanks very much.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opencms.org/pipermail/opencms-dev/attachments/20071221/9010d19e/attachment.html>


More information about the opencms-dev mailing list