org.netbeans.modules.masterfs/2 2.38

org.netbeans.modules.masterfs.providers
Class Notifier<KEY>

java.lang.Object
  extended by org.netbeans.modules.masterfs.providers.Notifier<KEY>

public abstract class Notifier<KEY>
extends Object

This SPI represents the interface between masterfs and different implementations of filesystem watches on various systems. The SPI is kept very minimal, as the only necessary information is a queue of modified folders, the filesystems code will evaluate the nature of the change itself. The SPI also doesn't distinguish between systems able of hierarchical listening and systems without such a capability. The implementation can report more events than registered, the infrastructure should take care of filtering them.

Since:
2.36

Constructor Summary
Notifier()
           
 
Method Summary
protected abstract  KEY addWatch(String path)
          Register a path for notifications.
protected abstract  String nextEvent()
           
protected abstract  void removeWatch(KEY key)
          Unregister a path.
protected abstract  void start()
          Starts the notifier.
protected  void stop()
          Get ready for stop.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Notifier

public Notifier()
Method Detail

addWatch

protected abstract KEY addWatch(String path)
                         throws IOException
Register a path for notifications. Optionally provide a key useful for unregistering the path. The implementations that need to have every path registered individually shall return a valid key, and shall implement the removeWatch(java.lang.Object) properly.

Parameters:
path - the path to register for notifications
Returns:
a key useful for unregistering the path.
Throws:
IOException - if the path can't be registered. For example if the OS limit on the number of watched folders is reached. The exception should be annotated with localized explanation.

removeWatch

protected abstract void removeWatch(KEY key)
                             throws IOException
Unregister a path. Implementations that listen recursively on the whole filesystem may ignore this request. They shall also return null from the addWatch(java.lang.String) call.

Parameters:
key - the key obtained during registration.
Throws:
IOException

nextEvent

protected abstract String nextEvent()
                             throws IOException,
                                    InterruptedException
Returns:
absolute path of the changed folder or null in case of overflow or any other reason to cause a full rescan
Throws:
IOException
InterruptedException

start

protected abstract void start()
                       throws IOException
Starts the notifier. If the implementation is not ready to work, it may throw I/O exception to signal it has not been initialized properly.

Throws:
IOException - if the initialization cannot be performed

stop

protected void stop()
             throws IOException
Get ready for stop. Clean all resources, the system is about to shutdown the VM. By default this is no-op operation.

Throws:
IOException

org.netbeans.modules.masterfs/2 2.38

Built on May 24 2012.  |  Portions Copyright 1997-2012 Oracle. All rights reserved.