You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by yanshaozhiGmail <ya...@gmail.com> on 2009/02/24 06:17:53 UTC

Question about event litener .

HI everyone:
I created a event listener to listen the Event.NODE_ADD events for specified path ,and I put a file into repository through webdav , In window XP system I can get jcr: data property's data not null all time, however , sometime I can get "jcr: data" with null with mac System ,is there any different between the to opration system about add file node ?

thanks!

2009-02-24 



yanjie 

Re: Re: Question about event litener .

Posted by yanjie <ya...@gmail.com>.
HI :
Thanks for telling me so much , I only want to know why and I handle it by listen the Event.PROPERT_SET event, and it works well.



2009-02-24 



yanjie 



发件人: Alexander Klimetschek 
发送时间: 2009-02-24  17:07:52 
收件人: dev 
抄送: 
主题: Re: Question about event litener . 
 
On Tue, Feb 24, 2009 at 6:17 AM, yanshaozhiGmail
<ya...@gmail.com> wrote:
> I created a event listener to listen the燛vent.NODE_ADD events爁or specified
> path ,and I put a file into repository through webdav ,營n window XP system
> I can get jcr: data爌roperty's data not null燼ll time, however , sometime I
> can get "jcr: data" with null with mac System ,is there any different
> between the to opration system about add file node ?
Oh, yes, this can be very tricky. On the Mac, the standard behaviour
(either by applications or by the WebDAV filesystem) is something like
this IIRC: it creates a separate file with some prefix (I think
".filename" or "~filename") where the content is actually stored, then
makes the real file "filename" empty (that's why you get an empty
jcr:data sometimes) and finally moves the "~filename" file to
"filename". I can imagine other WebDAV fs clients have similar quirks.
To work around that, you could wait for some time after you got the
events, remember just the path, and then handle it later, when the
file is no longer changing.
Regards,
Alex
-- 
Alexander Klimetschek
alexander.klimetschek@day.com

Re: Question about event litener .

Posted by Alexander Klimetschek <ak...@day.com>.
On Tue, Feb 24, 2009 at 6:17 AM, yanshaozhiGmail
<ya...@gmail.com> wrote:
> I created a event listener to listen the Event.NODE_ADD events for specified
> path ,and I put a file into repository through webdav , In window XP system
> I can get jcr: data property's data not null all time, however , sometime I
> can get "jcr: data" with null with mac System ,is there any different
> between the to opration system about add file node ?

Oh, yes, this can be very tricky. On the Mac, the standard behaviour
(either by applications or by the WebDAV filesystem) is something like
this IIRC: it creates a separate file with some prefix (I think
".filename" or "~filename") where the content is actually stored, then
makes the real file "filename" empty (that's why you get an empty
jcr:data sometimes) and finally moves the "~filename" file to
"filename". I can imagine other WebDAV fs clients have similar quirks.

To work around that, you could wait for some time after you got the
events, remember just the path, and then handle it later, when the
file is no longer changing.

Regards,
Alex

-- 
Alexander Klimetschek
alexander.klimetschek@day.com