[opencms-dev] Java Action class for checking content changed/created
Alessio Zurleni
azurleni at heptra.com
Tue Dec 11 11:21:29 CET 2007
Hi,
Once your module class set up (classe must implement I_CmsModuleAction
as specified by Sylvain), use the CmsEvent method to check for the
wished event.
For a complete events list look at the
org.opencms.main.I_CmsEventListener class. Once the event detected you
can grab resource(s) from event contextual data.
For instance, when a ressource is modified a
I_CmsEventListener.EVENT_RESOURCE_MODIFIED event is fired and the event
data map will contain a key named "resource" (CmsResource object).
Regards,
Alessio Zurleni
Sylvain Courcelle wrote:
> Hi,
> Concerning Action classes, you have to respect only 3 steps :
> 1) declaring the action class ( full package name without ".class" termination ) in the module configuration
> 2) developing your own Java class as Action Class : this action class must implement I_CmsModuleAction ( an OpenCMS API interface ).
> 3) place the brand new class in the Classes directory of your module.
>
> NB: ActionClasses are always used in a Module context. If you don't have one, you should create it.
>
> Then, concerning events capture ...
> The I_CmsModuleAction interface defines many methods :
> - initialize
> - moduleUninstall
> - publishProject
> And a more important one :
> cmsEvent(CmsEvent event)
>
> in this method's body, you can analyse the type of the "event" param to trigger your own actions.
>
> Nevertheless, I don't have a precise idea concerning the manner you could detect changes on a precise Ressource of VFS. Maybe You'll have to declare your own CmsEvent, and make the system listen to it ( look at method AddCmsEventListener of class CmsEventManager, reachable via OpenCms.getEventManager() ).
>
> Hope it will help,
> Regards,
> Sylvain Courcelle
> EURELIS
>
>
>
>
> -----Message d'origine-----
> De : opencms-dev-bounces at opencms.org [mailto:opencms-dev-bounces at opencms.org] De la part de gsriman
> Envoyé : mardi 11 décembre 2007 05:37
> À : opencms-dev at opencms.org
> Objet : [opencms-dev] Java Action class for checking content changed/created
>
>
> Hi All,
> I am new to Opencms and Java. I am trying to write a java class as event
> listener that triggers wheneever the file/content in opencms is changed or
> created and send an email to the project manager that file has been changed.
> Could anybody help me the steps needed to create java class for this and
> necessary steps required to make this happen.
>
> Thanks in advance
> Sriman
>
More information about the opencms-dev
mailing list