Thanks for the reply :)

I had a look the sites before I post the question.
So far I have this code, but when there's an event for the folder it doesn't 
trigger the monitor.
I would like to monitor a folder for any event, such as file creation, delete, 
or update.

Any idea what did I do wrong?

[CODE]
public void watchFile()
    {
        FileSystemManager fsManager;
        try
        {
            fsManager = VFS.getManager();
            FileObject sourceFile = 
fsManager.resolveFile("ftp://username:passw...@host/myfolder"; ,authenticate());
            FileSystem fs = sourceFile.getFileSystem();
            DefaultFileMonitor monitor = new DefaultFileMonitor(new 
FileListener(){

                @Override
                public void fileChanged(FileChangeEvent event) throws Exception
                {
                    System.out.println("File Changed" + 
event.getFile().getName().getBaseName());
                    
                }

                @Override
                public void fileCreated(FileChangeEvent event) throws Exception
                {
                    System.out.println("File Changed" + 
event.getFile().getName().getBaseName());
                    
                }

                @Override
                public void fileDeleted(FileChangeEvent event) throws Exception
                {
                    System.out.println("File Changed" + 
event.getFile().getName().getBaseName());
                    
                }
            
            });
            monitor.addFile(sourceFile);
            monitor.start();
        
        }
        catch (FileSystemException e)
        {
            e.printStackTrace();
        }
        catch (Exception e)
        {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }

[/CODE]


________________________________
From: Anand Shankar <anand.al....@gmail.com>
To: Commons Users List <user@commons.apache.org>
Sent: Tue, 20 October, 2009 2:54:31 PM
Subject: Re: monitor file update help

Hi
I am giving some links and hope will be helpful for you.


http://commons.apache.org/vfs/

http://ant.apache.org/ivy/history/latest-milestone/resolver/vfs.html



Thanks!

Anand Shankar




On Tue, Oct 20, 2009 at 8:33 AM, geek.shrek <miss_cool_...@yahoo.com> wrote:

> Hi,
>
> I would like to monitor a file creation, file update in particular folder.
> I'm not sure how can I achieve this using VFS apache version 1.0
>
> Can someone please point me to an example or tutorial.
>
> Much appreciate.
>
> Thanks,
>
>
>
>
>  
> __________________________________________________________________________________
> Get more done like never before with Yahoo!7 Mail.
> Learn more: http://au.overview.mail.yahoo.com/
>



-- 
Anand Shankar



      
__________________________________________________________________________________
Get more done like never before with Yahoo!7 Mail.
Learn more: http://au.overview.mail.yahoo.com/

Reply via email to