[opencms-dev] Java Action class for checking content changed/created

sriman gsriman at gmail.com
Wed Dec 12 17:15:52 CET 2007


Hi Alessio,
   Thanks a lot for your quick response on this. I will try to test these
events in my class.

Thanks again
Sriman

On Dec 11, 2007 11:52 PM, Alessio Zurleni <azurleni at heptra.com> wrote:

>  Sriman,
>
> You can check event EVENT_RESOURCE_MOVED and also EVENT_RESOURCE_CREATED
> EVENT_RESOURCE_COPIED EVENT_RESOURCE_DELETED (which occurs when a resource
> is moved).
> Please, copy message to the opencms list.
>
> Regards,
>
> Alessio
>
> gsriman at gmail.com wrote:
>
> Hi Alessio,
>   Thanks a lot for your response. I am able to get the Resource info using CmsResource. I have one more quick question I have downloaded workflow2 module and I have 2 different projects "Offline" and "Approval". When I move the file from one project to another can I catch this event? for example I have test.html file in "Offline" project when I move this file to project "Approval" I want to catch this eveny. Can you tell mehow can I do this?
>
> Thanks in advance
> Sriman
> Alessio Zurleni wrote:
>
>
>  Sriman,
>
> you cast the "resource" key from event data this way  (in case of event
> resource modified) :
>
> CmsResource  res = (CmsResource)<event object>.getData().get("resource");
>
> U can access all resource informations with CmsResource methods.
>
> Pay attention to the fact that getData method and keys are event
> dependents, so have a
> look at the org.opencms.main.I_CmsEventListener class.
>
>
> Regards,
>
> Alessio
>
> gsriman wrote:
>
>
>  Hi Alessio  & Sylvain ,
>   Thanks a lot for your response. As you told I wrote a action class and
> registered in my module. It's listening to my action class . I am trying
> to
> get mofified or created Resouce path and resouce name only but the
> functionevent.getData() is giving lot of info which I don't need it.  Can you
> tell
> me what shoould I do to get only Resource path and name.
>
> Thanks in advance
> Sriman
>
> Alessio Zurleni wrote:
>
>
>
>  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 viaOpenCms.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 <opencms-dev-bounces at opencms.org>] De la part de gsriman
> EnvoyÃ(c) : mardi 11 dÃ(c)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
>
>
>
>
>  _______________________________________________
> This mail is sent to you from the opencms-dev mailing list
> To change your list options, or to unsubscribe from the list, please
> visithttp://lists.opencms.org/mailman/listinfo/opencms-dev
>
>
>
>
>        _______________________________________________
> This mail is sent to you from the opencms-dev mailing list
> To change your list options, or to unsubscribe from the list, please visithttp://lists.opencms.org/mailman/listinfo/opencms-dev
>
>      Quoted from: http://www.nabble.com/Re%3A-Java-Action-class-for-checking-content-changed-created-tp14270583p14285158.html
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20071212/65f55bdc/attachment.htm>


More information about the opencms-dev mailing list