You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by "Lars Gohlke (JIRA)" <ji...@apache.org> on 2010/09/22 12:01:40 UTC

[jira] Created: (CAMEL-3146) FileComponent maybe use inotify interface implemented by jnotify

FileComponent maybe use inotify interface implemented by jnotify
----------------------------------------------------------------

                 Key: CAMEL-3146
                 URL: https://issues.apache.org/activemq/browse/CAMEL-3146
             Project: Apache Camel
          Issue Type: Improvement
          Components: camel-core
    Affects Versions: 2.4.0
            Reporter: Lars Gohlke
            Priority: Minor


What about using jnotify?

The fallback could be always the old behaviour, but in case it could be used it would be an really good improvement in terms of performance

sample from http://jnotify.sourceforge.net/sample.html

public void sample() throws Exception {
    // path to watch
    String path = System.getProperty("user.home");

    // watch mask, specify events you care about,
    // or JNotify.FILE_ANY for all events.
    int mask = JNotify.FILE_CREATED  | 
               JNotify.FILE_DELETED  | 
               JNotify.FILE_MODIFIED | 
               JNotify.FILE_RENAMED;

    // watch subtree?
    boolean watchSubtree = true;

    // add actual watch
    int watchID = JNotify.addWatch(path, mask, watchSubtree, new Listener());

    // sleep a little, the application will exit if you
    // don't (watching is asynchronous), depending on your
    // application, this may not be required
    Thread.sleep(1000000);

    // to remove watch the watch
    boolean res = JNotify.removeWatch(watchID);
    if (!res) {
      // invalid watch ID specified.
    }
  }
  class Listener implements JNotifyListener {
    public void fileRenamed(int wd, String rootPath, String oldName,
        String newName) {
      print("renamed " + rootPath + " : " + oldName + " -> " + newName);
    }
    public void fileModified(int wd, String rootPath, String name) {
      print("modified " + rootPath + " : " + name);
    }
    public void fileDeleted(int wd, String rootPath, String name) {
      print("deleted " + rootPath + " : " + name);
    }
    public void fileCreated(int wd, String rootPath, String name) {
      print("created " + rootPath + " : " + name);
    }
    void print(String msg) {
      System.err.println(msg);
    }
  }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (CAMEL-3146) FileComponent maybe use inotify interface implemented by jnotify

Posted by "Lars Gohlke (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/CAMEL-3146?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Lars Gohlke updated CAMEL-3146:
-------------------------------

    Description: 
What about using jnotify?

JNotify java API
JNotify is a java library that allow java application to listen to file system events, such as:

    * File created
    * File modified
    * File renamed
    * File deleted

Supported platforms

    * Windows (2000 or newer) Windows notes
    * Linux with INofity support (2.6.14 or newer) Linux notes
    * Mac OS X (10.5 or newer) Mac OS notes


The fallback could be always the old behaviour, but in case it could be used it would be an really good improvement in terms of performance

sample from http://jnotify.sourceforge.net/sample.html

public void sample() throws Exception {
    // path to watch
    String path = System.getProperty("user.home");

    // watch mask, specify events you care about,
    // or JNotify.FILE_ANY for all events.
    int mask = JNotify.FILE_CREATED  | 
               JNotify.FILE_DELETED  | 
               JNotify.FILE_MODIFIED | 
               JNotify.FILE_RENAMED;

    // watch subtree?
    boolean watchSubtree = true;

    // add actual watch
    int watchID = JNotify.addWatch(path, mask, watchSubtree, new Listener());

    // sleep a little, the application will exit if you
    // don't (watching is asynchronous), depending on your
    // application, this may not be required
    Thread.sleep(1000000);

    // to remove watch the watch
    boolean res = JNotify.removeWatch(watchID);
    if (!res) {
      // invalid watch ID specified.
    }
  }
  class Listener implements JNotifyListener {
    public void fileRenamed(int wd, String rootPath, String oldName,
        String newName) {
      print("renamed " + rootPath + " : " + oldName + " -> " + newName);
    }
    public void fileModified(int wd, String rootPath, String name) {
      print("modified " + rootPath + " : " + name);
    }
    public void fileDeleted(int wd, String rootPath, String name) {
      print("deleted " + rootPath + " : " + name);
    }
    public void fileCreated(int wd, String rootPath, String name) {
      print("created " + rootPath + " : " + name);
    }
    void print(String msg) {
      System.err.println(msg);
    }
  }

  was:
What about using jnotify?

The fallback could be always the old behaviour, but in case it could be used it would be an really good improvement in terms of performance

sample from http://jnotify.sourceforge.net/sample.html

public void sample() throws Exception {
    // path to watch
    String path = System.getProperty("user.home");

    // watch mask, specify events you care about,
    // or JNotify.FILE_ANY for all events.
    int mask = JNotify.FILE_CREATED  | 
               JNotify.FILE_DELETED  | 
               JNotify.FILE_MODIFIED | 
               JNotify.FILE_RENAMED;

    // watch subtree?
    boolean watchSubtree = true;

    // add actual watch
    int watchID = JNotify.addWatch(path, mask, watchSubtree, new Listener());

    // sleep a little, the application will exit if you
    // don't (watching is asynchronous), depending on your
    // application, this may not be required
    Thread.sleep(1000000);

    // to remove watch the watch
    boolean res = JNotify.removeWatch(watchID);
    if (!res) {
      // invalid watch ID specified.
    }
  }
  class Listener implements JNotifyListener {
    public void fileRenamed(int wd, String rootPath, String oldName,
        String newName) {
      print("renamed " + rootPath + " : " + oldName + " -> " + newName);
    }
    public void fileModified(int wd, String rootPath, String name) {
      print("modified " + rootPath + " : " + name);
    }
    public void fileDeleted(int wd, String rootPath, String name) {
      print("deleted " + rootPath + " : " + name);
    }
    public void fileCreated(int wd, String rootPath, String name) {
      print("created " + rootPath + " : " + name);
    }
    void print(String msg) {
      System.err.println(msg);
    }
  }


> FileComponent maybe use inotify interface implemented by jnotify
> ----------------------------------------------------------------
>
>                 Key: CAMEL-3146
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-3146
>             Project: Apache Camel
>          Issue Type: Improvement
>          Components: camel-core
>    Affects Versions: 2.4.0
>            Reporter: Lars Gohlke
>            Priority: Minor
>   Original Estimate: 1 day
>  Remaining Estimate: 1 day
>
> What about using jnotify?
> JNotify java API
> JNotify is a java library that allow java application to listen to file system events, such as:
>     * File created
>     * File modified
>     * File renamed
>     * File deleted
> Supported platforms
>     * Windows (2000 or newer) Windows notes
>     * Linux with INofity support (2.6.14 or newer) Linux notes
>     * Mac OS X (10.5 or newer) Mac OS notes
> The fallback could be always the old behaviour, but in case it could be used it would be an really good improvement in terms of performance
> sample from http://jnotify.sourceforge.net/sample.html
> public void sample() throws Exception {
>     // path to watch
>     String path = System.getProperty("user.home");
>     // watch mask, specify events you care about,
>     // or JNotify.FILE_ANY for all events.
>     int mask = JNotify.FILE_CREATED  | 
>                JNotify.FILE_DELETED  | 
>                JNotify.FILE_MODIFIED | 
>                JNotify.FILE_RENAMED;
>     // watch subtree?
>     boolean watchSubtree = true;
>     // add actual watch
>     int watchID = JNotify.addWatch(path, mask, watchSubtree, new Listener());
>     // sleep a little, the application will exit if you
>     // don't (watching is asynchronous), depending on your
>     // application, this may not be required
>     Thread.sleep(1000000);
>     // to remove watch the watch
>     boolean res = JNotify.removeWatch(watchID);
>     if (!res) {
>       // invalid watch ID specified.
>     }
>   }
>   class Listener implements JNotifyListener {
>     public void fileRenamed(int wd, String rootPath, String oldName,
>         String newName) {
>       print("renamed " + rootPath + " : " + oldName + " -> " + newName);
>     }
>     public void fileModified(int wd, String rootPath, String name) {
>       print("modified " + rootPath + " : " + name);
>     }
>     public void fileDeleted(int wd, String rootPath, String name) {
>       print("deleted " + rootPath + " : " + name);
>     }
>     public void fileCreated(int wd, String rootPath, String name) {
>       print("created " + rootPath + " : " + name);
>     }
>     void print(String msg) {
>       System.err.println(msg);
>     }
>   }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (CAMEL-3146) FileComponent maybe use inotify interface implemented by jnotify

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/CAMEL-3146?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Claus Ibsen resolved CAMEL-3146.
--------------------------------

         Assignee: Claus Ibsen
    Fix Version/s: 2.5.0
       Resolution: Won't Fix

> FileComponent maybe use inotify interface implemented by jnotify
> ----------------------------------------------------------------
>
>                 Key: CAMEL-3146
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-3146
>             Project: Apache Camel
>          Issue Type: Improvement
>          Components: camel-core
>    Affects Versions: 2.4.0
>            Reporter: Lars Gohlke
>            Assignee: Claus Ibsen
>            Priority: Minor
>             Fix For: 2.5.0
>
>   Original Estimate: 1 day
>  Remaining Estimate: 1 day
>
> What about using jnotify?
> JNotify java API
> JNotify is a java library that allow java application to listen to file system events, such as:
>     * File created
>     * File modified
>     * File renamed
>     * File deleted
> Supported platforms
>     * Windows (2000 or newer) Windows notes
>     * Linux with INofity support (2.6.14 or newer) Linux notes
>     * Mac OS X (10.5 or newer) Mac OS notes
> The fallback could be always the old behaviour, but in case it could be used it would be an really good improvement in terms of performance
> sample from http://jnotify.sourceforge.net/sample.html
> public void sample() throws Exception {
>     // path to watch
>     String path = System.getProperty("user.home");
>     // watch mask, specify events you care about,
>     // or JNotify.FILE_ANY for all events.
>     int mask = JNotify.FILE_CREATED  | 
>                JNotify.FILE_DELETED  | 
>                JNotify.FILE_MODIFIED | 
>                JNotify.FILE_RENAMED;
>     // watch subtree?
>     boolean watchSubtree = true;
>     // add actual watch
>     int watchID = JNotify.addWatch(path, mask, watchSubtree, new Listener());
>     // sleep a little, the application will exit if you
>     // don't (watching is asynchronous), depending on your
>     // application, this may not be required
>     Thread.sleep(1000000);
>     // to remove watch the watch
>     boolean res = JNotify.removeWatch(watchID);
>     if (!res) {
>       // invalid watch ID specified.
>     }
>   }
>   class Listener implements JNotifyListener {
>     public void fileRenamed(int wd, String rootPath, String oldName,
>         String newName) {
>       print("renamed " + rootPath + " : " + oldName + " -> " + newName);
>     }
>     public void fileModified(int wd, String rootPath, String name) {
>       print("modified " + rootPath + " : " + name);
>     }
>     public void fileDeleted(int wd, String rootPath, String name) {
>       print("deleted " + rootPath + " : " + name);
>     }
>     public void fileCreated(int wd, String rootPath, String name) {
>       print("created " + rootPath + " : " + name);
>     }
>     void print(String msg) {
>       System.err.println(msg);
>     }
>   }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CAMEL-3146) FileComponent maybe use inotify interface implemented by jnotify

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-3146?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=62000#action_62000 ] 

Claus Ibsen commented on CAMEL-3146:
------------------------------------

No we cannot use 3rd party jars in the camel-core as we want to keep it light-weight.

People are welcome to implement custom components, and the file component can be easily extended. For example the FTP does that.

Also the JDK will in the future provide API for file notifications. I think thats part of NIO2, which comes in JDK 7.

> FileComponent maybe use inotify interface implemented by jnotify
> ----------------------------------------------------------------
>
>                 Key: CAMEL-3146
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-3146
>             Project: Apache Camel
>          Issue Type: Improvement
>          Components: camel-core
>    Affects Versions: 2.4.0
>            Reporter: Lars Gohlke
>            Priority: Minor
>   Original Estimate: 1 day
>  Remaining Estimate: 1 day
>
> What about using jnotify?
> JNotify java API
> JNotify is a java library that allow java application to listen to file system events, such as:
>     * File created
>     * File modified
>     * File renamed
>     * File deleted
> Supported platforms
>     * Windows (2000 or newer) Windows notes
>     * Linux with INofity support (2.6.14 or newer) Linux notes
>     * Mac OS X (10.5 or newer) Mac OS notes
> The fallback could be always the old behaviour, but in case it could be used it would be an really good improvement in terms of performance
> sample from http://jnotify.sourceforge.net/sample.html
> public void sample() throws Exception {
>     // path to watch
>     String path = System.getProperty("user.home");
>     // watch mask, specify events you care about,
>     // or JNotify.FILE_ANY for all events.
>     int mask = JNotify.FILE_CREATED  | 
>                JNotify.FILE_DELETED  | 
>                JNotify.FILE_MODIFIED | 
>                JNotify.FILE_RENAMED;
>     // watch subtree?
>     boolean watchSubtree = true;
>     // add actual watch
>     int watchID = JNotify.addWatch(path, mask, watchSubtree, new Listener());
>     // sleep a little, the application will exit if you
>     // don't (watching is asynchronous), depending on your
>     // application, this may not be required
>     Thread.sleep(1000000);
>     // to remove watch the watch
>     boolean res = JNotify.removeWatch(watchID);
>     if (!res) {
>       // invalid watch ID specified.
>     }
>   }
>   class Listener implements JNotifyListener {
>     public void fileRenamed(int wd, String rootPath, String oldName,
>         String newName) {
>       print("renamed " + rootPath + " : " + oldName + " -> " + newName);
>     }
>     public void fileModified(int wd, String rootPath, String name) {
>       print("modified " + rootPath + " : " + name);
>     }
>     public void fileDeleted(int wd, String rootPath, String name) {
>       print("deleted " + rootPath + " : " + name);
>     }
>     public void fileCreated(int wd, String rootPath, String name) {
>       print("created " + rootPath + " : " + name);
>     }
>     void print(String msg) {
>       System.err.println(msg);
>     }
>   }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.