2 Replies Latest reply on Mar 6, 2014 9:46 AM by Jay C

    how to utilize the event fired from connector

    Jay C Newbie

      Hi All,


      Could anyone please show me a sample application to utilize the event fired from a connector?

      like how to:

              1) register;

              2) filter (only receive special type of event)

              3) receive/handle the event


      Thanks a lot,



        • 1. Re: how to utilize the event fired from connector
          Randall Hauch Master

          If you want to use the events (whether they're fired from a connector or from other changes to content made by other parts of yours or other applications), then you basically just register with the session's workspace's observation listener an event listener implementation. Just be sure to use a session that you're not using for anything else, and that the session is long-lived. See the documentation for a bit more detail and one of our tests for some examples.


          On the other hand, if you want to implement a connector that fires its own events, have a look at the FileSystemConnector code in the 'master' branch (not yet released). We recently added support to use Java 7's WatchService to monitor the file system for changes and translate those into connector events that are then sent up through ModeShape. Several of the tests in the FileSystemConnectorTest class register event listeners with ModeShape (like mentioned above) to verify that the proper events are fired from ModeShape when the test makes changes to the file system.

          • 2. Re: how to utilize the event fired from connector
            Jay C Newbie

            Thank you very much, Randall.

            Those are really what I am looking for.