Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: file system events



Adam,
I worked on this problem on a contract recently.  I did not find any cross
platform libraries for this. (Even amongst the *NIXs)

The best you could do is have a standard Java class/interface with OS
specific libraries doing the actual work. This is what we ended up doing,
but we only needed OSX and Windows.

For OSX I ended using kqueue/kevent.  But the implementation is not very
scalable because it consumes one file descriptor per directory being
watched.  It still uses a Java thread but rather than polling it sits
blocked until an event occurs.

If you look in /usr/include/sys/event.h, there are event filters defined for
file system events.  But they are not documented.
> #define EVFILT_FS               (-9)    /* Filesystem events */

After listening to an Apple developer talk about Spotlight it was apparent
that they must be doing this to watch for new files so they can be indexed.
I asked him if he could share how they did it and his response was that "the
mechanism Spotlight uses wasn't public..."

Perhaps when 10.4 is released Apple will document these event filters.

Hope this helps.

    -chrisb
 

On 3/22/05 8:35 AM, "Adam Fisk" <email@hidden> wrote:

> Does anyone know of an open source, cross platform library for receiving
> file system events in Java?  I noticed your POSIX library, Greg.  Does
> it generate an event when, for example, a file is added to a directory
> or when a file in a watched directory is changed?  I also need a Windows
> implementation, but if your POSIX stuff responds to those events on OSX,
> I can probably figure something else out for Windows.
> 
> Thanks.
> 
> -Adam
>  _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Java-dev mailing list      (email@hidden)
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/java-dev/email@hidden
> 
> This email sent to email@hidden
> 
> 


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden

This email sent to email@hidden

References: 
 >file system events (From: Adam Fisk <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.