You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by og...@yahoo.com on 2005/05/05 00:52:16 UTC

[VFS] FileChangeEvent, inotify, and file changes outside JVM

Hello,

I'm looking at Commons VFS project and see FileChangeEvent.  I'm
wondering if this lets an application listen for file/directory change
events that happen outside of the JVM (e.g. a user deletes a file,
edits it, or creates a new one, or perhaps creates a new directory)?

I suspect the answer is no.... but perhaps somebody did some magic. :)

Also, I am wondering if anyone is looking into inotify and will be
building something to let Java listen for inotify events under Linux. 
This would be suuuuuuuuuuuper useful!

Does anyone know if there is a Java piece that listens to
file/directory change events under Windows or Mac?

Thanks,
Otis


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Re: [VFS] FileChangeEvent, inotify, and file changes outside JVM

Posted by Mario Ivankovits <ma...@ops.co.at>.
Hi!
>Regarding DefaultFileMonitor - how scalable is this?  More precisely,
>say I wanted to build yet another desktop indexing/search tool, and
>thus monitor _everything_, or a few hundred or thousands of
>directories, would DefaultFileMonitor be able to handle it?
>
>I know, it depends on CPU, memory, etc., but have people tested it with
>more than a few dozen directories?
>  
The latest changes to the DefaultFileMonitor (not commited yet) 
introduces a new function which allows you to configure it to sleep 
every e.g. 1000 scanned files.
So it should be possible to let it run very passive.

A problem might be that it will keep the whole filestructure in memory 
and thus it might be a problem with memory if you try to index a large 
filesystem.
You have to try to see if this could be a way.
However, if you are bound to local files only it might be better to use 
JNI to access the os filesystem-events.

Maybe its time to start off a new project for this ...

Ciao,
Mario


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Re: [VFS] FileChangeEvent, inotify, and file changes outside JVM

Posted by og...@yahoo.com.
Hello Mario, thanks for the answer.

Regarding DefaultFileMonitor - how scalable is this?  More precisely,
say I wanted to build yet another desktop indexing/search tool, and
thus monitor _everything_, or a few hundred or thousands of
directories, would DefaultFileMonitor be able to handle it?

I know, it depends on CPU, memory, etc., but have people tested it with
more than a few dozen directories?

Thanks,
Otis


--- Mario Ivankovits <ma...@ops.co.at> wrote:

> Hi!
> >I'm looking at Commons VFS project and see FileChangeEvent.  I'm
> >wondering if this lets an application listen for file/directory
> change
> >events that happen outside of the JVM (e.g. a user deletes a file,
> >edits it, or creates a new one, or perhaps creates a new directory)?
> >
> >I suspect the answer is no.... but perhaps somebody did some magic.
> :)
> >  
> Have a look at DefaultFileMonitor.
> The magic it does is to regulary scan the directories/files and fires
> 
> some events if it detect changes.
> 
> Well, this is not far as good as inotify et al, but if you simply
> have 
> to check a directory about new files you have to process then it
> could 
> safe a lot of work for you.
> >Also, I am wondering if anyone is looking into inotify and will be
> >building something to let Java listen for inotify events under
> Linux. 
> >This would be suuuuuuuuuuuper useful!
> >  
> I have to admit I was only aware of dnotify, inotify is new to me.
> How usefull this could be for VFS needs to be discussed. VFS trys to 
> combine many various filesystems and such a daemon do only work with 
> local files.
> So the first home for this implementation could be commons-io.
> 
> >Does anyone know if there is a Java piece that listens to
> >file/directory change events under Windows or Mac?
> >  
> Windows allows a api for this, so you could use JNI to register to
> it.
> Sorry I dont know a ready made java-api for this. Intellij IDEA do 
> something like this to monitor filesystem changes.
> 
> I dont know what the Mac provides in this area.
> 
> Ciao,
> Mario
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Re: digester question

Posted by Simon Kitching <sk...@apache.org>.
On Thu, 2005-05-05 at 11:50 -0400, shailesh.ligade wrote:
> I have a an xml
> 
> <tr>
> <td colnum="c0">7</td> 
> <td colnum="c1">8</td> 
> </tr>
> 
> I have class called Row and and another Rows
> 
> Row class has two mthods (one for column and one for data)
> and Rows class has addRow(Row row) method
> 
> code is 
> 
> digester.addSetProperties("tr/td", "colnum", "column");
> digester.addCallMethod("tr/td", "setData", 0); 	
> 
> and
> 
> digester.addSetNext("tr/td", "addRow");	
> 
> What i get in system.out inside addRow is c0 - null so so my data is always
> null. Actaully setData() method is getting called, but it is called after
> addRow() method.
> 
> How to fix this?

See the FAQ entry titled:
  "How do I get CallMethodRule to fire before SetNextRule?"
at
  http://wiki.apache.org/jakarta-commons/Digester/FAQ

I think this is the information you are looking for..

Regards,

Simon



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


digester question

Posted by "shailesh.ligade" <sh...@wfinet.com>.
I have a an xml

<tr>
<td colnum="c0">7</td> 
<td colnum="c1">8</td> 
</tr>

I have class called Row and and another Rows

Row class has two mthods (one for column and one for data)
and Rows class has addRow(Row row) method

code is 

digester.addSetProperties("tr/td", "colnum", "column");
digester.addCallMethod("tr/td", "setData", 0); 	

and

digester.addSetNext("tr/td", "addRow");	

What i get in system.out inside addRow is c0 - null so so my data is always
null. Actaully setData() method is getting called, but it is called after
addRow() method.

How to fix this?

SL


�
Attention:
Any views expressed in this message are those of the individual sender, except where the message states otherwise and the sender is authorized to state them to be the views of any such entity. The information contained in this message and or attachments is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material.  If you received this in error, please contact the sender and delete the material from any system and destroy any copies.

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Re: [VFS] FileChangeEvent, inotify, and file changes outside JVM

Posted by Mario Ivankovits <ma...@ops.co.at>.
Hi!
>I'm looking at Commons VFS project and see FileChangeEvent.  I'm
>wondering if this lets an application listen for file/directory change
>events that happen outside of the JVM (e.g. a user deletes a file,
>edits it, or creates a new one, or perhaps creates a new directory)?
>
>I suspect the answer is no.... but perhaps somebody did some magic. :)
>  
Have a look at DefaultFileMonitor.
The magic it does is to regulary scan the directories/files and fires 
some events if it detect changes.

Well, this is not far as good as inotify et al, but if you simply have 
to check a directory about new files you have to process then it could 
safe a lot of work for you.
>Also, I am wondering if anyone is looking into inotify and will be
>building something to let Java listen for inotify events under Linux. 
>This would be suuuuuuuuuuuper useful!
>  
I have to admit I was only aware of dnotify, inotify is new to me.
How usefull this could be for VFS needs to be discussed. VFS trys to 
combine many various filesystems and such a daemon do only work with 
local files.
So the first home for this implementation could be commons-io.

>Does anyone know if there is a Java piece that listens to
>file/directory change events under Windows or Mac?
>  
Windows allows a api for this, so you could use JNI to register to it.
Sorry I dont know a ready made java-api for this. Intellij IDEA do 
something like this to monitor filesystem changes.

I dont know what the Mac provides in this area.

Ciao,
Mario