com.tivoli.jmx.jar
Class DirectoryObserver

com.tivoli.jmx.jar.DirectoryObserver

public class DirectoryObserver
implements DirectoryObserverMBean

Observes a directory.

Gets a directory list and verifies whether these files that comply with the current filter have been added, removed or modified. The following ObserverNotification are sent:

An added notification when a file has been added

An removed notification when a file has been removed

An modified notification when a file has been modified

An error notification when the directory does not exist

The files to be considered can be fitered according to an array of file suffixes. In case the array is null, all the files in the directory will be considered.

Version:
1.3
Author:
Eliseba Costantini, Max Parlione

Constructor Summary
DirectoryObserver()
          Creates a DirectoryObserver
DirectoryObserver(java.io.File directory, java.lang.String[] filter)
          Creates a DirectoryObserver
 
Method Summary
 java.io.File getDirectory()
          The directory to be observed
 java.lang.String[] getFilter()
          The suffixes used to filter the direcory
 javax.management.MBeanNotificationInfo[] getNotificationInfo()
          Returns an array of notification types emitted.
 void handleNotification(javax.management.Notification notification, java.lang.Object handback)
          Gets a directory list and verifies whether these files that comply with the current filter have been added, removed or modified.
 void observe()
          Gets a directory list and verifies whether these files that comply with the current filter have been added, removed or modified.
 void setDirectory(java.io.File directory)
          The directory to be observed
 void setFilter(java.lang.String[] filter)
          The suffixes used to filter the direcory
 

Constructor Detail

DirectoryObserver

public DirectoryObserver()
Creates a DirectoryObserver

DirectoryObserver

public DirectoryObserver(java.io.File directory,
                         java.lang.String[] filter)
Creates a DirectoryObserver
Parameters:
directory - the directory to be observed
filter - the filter to be applied to the directory
Method Detail

setDirectory

public void setDirectory(java.io.File directory)
The directory to be observed
Specified by:
setDirectory in interface DirectoryObserverMBean
Parameters:
file - the directory to be observed

getDirectory

public java.io.File getDirectory()
The directory to be observed
Specified by:
getDirectory in interface DirectoryObserverMBean
Returns:
file the dirctory to be observed

handleNotification

public void handleNotification(javax.management.Notification notification,
                               java.lang.Object handback)
Gets a directory list and verifies whether these files that comply with the current filter have been added, removed or modified. The following ObserverNotification are sent:

An added notification when a file has been added

An removed notification when a file has been removed

An modified notification when a file has been modified

An error notification when the directory does not exist

. Invokes observe method

Parameters:
notification - the timer notification
handback - ignored in thi implementation

getFilter

public java.lang.String[] getFilter()
The suffixes used to filter the direcory
Specified by:
getFilter in interface DirectoryObserverMBean
Returns:
the filter

setFilter

public void setFilter(java.lang.String[] filter)
The suffixes used to filter the direcory
Specified by:
setFilter in interface DirectoryObserverMBean

observe

public void observe()
Gets a directory list and verifies whether these files that comply with the current filter have been added, removed or modified. The following ObserverNotification are sent:

An added notification when a file has been added

An removed notification when a file has been removed

An modified notification when a file has been modified

An error notification when the directory does not exist

.

Specified by:
observe in interface DirectoryObserverMBean

getNotificationInfo

public javax.management.MBeanNotificationInfo[] getNotificationInfo()
Returns an array of notification types emitted.
Returns:
the notifications type emitted