File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Other Open Source Projects and the fly likes Apache Common VFS Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "Apache Common VFS" Watch "Apache Common VFS" New topic

Apache Common VFS

K Maday

Joined: Feb 22, 2012
Posts: 1

I am trying to set up a test case for monitoring files using Apache Commons VFS. Basically I would like to do some work if the monitored file is created, deleted, changed causing a FileChangeEvent.

Here is the test code. I changed the files at both locations. It works for HTTP but not for FTP. Any help would be appreciated.

Files were located and results from showProperties:
URL: ftp://myusername:mypassword@somehost/test.txt
getName(): ftp://myusername:mypassword@somehost/test.txt
BaseName: test.txt
Extension: txt
Path: /test.txt
Scheme: ftp
URI: ftp://myusername:mypassword@somehost/test.txt
Root URI: ftp://myusername:mypassword@somehost/
Parent: ftp://myusername:mypassword@somehost/
Type: file
Exists: true
Readable: true
Writeable: true
Root path: /
Size: 41 bytes
Last modified: 2/21/12 10:00 PM

URL: http://somehost/test/test123.txt
getName(): http://somehost/test/test123.txt
BaseName: test123.txt
Extension: txt
Path: /test/test123.txt
Scheme: http
URI: http://somehost/test/test123.txt
Root URI: http://somehost/
Parent: http://somehost/test
Type: file
Exists: true
Readable: true
Writeable: true
Root path: /
Size: 1237 bytes
Last modified: 2/17/12 9:29 AM

Changing the HTTP File created the FileChangeEvent. FTP did not.
File [http://somehost/test/test123.txt] changed event from [org.pdc.apps.vfs.FileMonitorTest$MyFileListener@56d90453]
I agree. Here's the link:
subject: Apache Common VFS
It's not a secret anymore!