org.sadun.util.polling
Class ScriptedPollManager

java.lang.Object
  extended byorg.sadun.util.polling.BasePollManager
      extended byorg.sadun.util.polling.ScriptedPollManager
All Implemented Interfaces:
PollManager

public class ScriptedPollManager
extends BasePollManager

A PollManager that hands over the actual handling of polling events to an external script.

The scripts are executed by invoking System.execute() with a given shell command.

By default, win32 invocation uses %COMMSPEC% and Unix invocation uses /bin/sh.

Version:
1.0
Author:
cris

Constructor Summary
ScriptedPollManager(DirectoryPoller poller, java.lang.String scriptPath)
           
ScriptedPollManager(DirectoryPoller poller, java.lang.String[] shellCmd, java.lang.String scriptPath)
           
 
Method Summary
 void cycleEnded(CycleEndEvent evt)
          Invoked when a polling cycle has ended (the pooler is going to sleep)
 void cycleStarted(CycleStartEvent evt)
          Invoked when a polling cycle start (the pooler has just awaken)
 void directoryLookupEnded(DirectoryLookupEndEvent evt)
          Invoked when the poller has finished looking into a directory
 void directoryLookupStarted(DirectoryLookupStartEvent evt)
          Invoked when the poller is starting to look into a directory
 void exceptionDeletingTargetFile(java.io.File target)
          Invoked when an automove operation fails since the given file cannot be deleted
 void exceptionMovingFile(java.io.File file, java.io.File dest)
          Invoked when an automove operation fails since the given file cannot be moved to the given destination
 void fileFound(FileFoundEvent evt)
          Invoked for each of the files found, if setSendSingleFileEvent() has been invoked before starting the poller thread.
 void fileMoved(FileMovedEvent evt)
          If the automove mode is active, is invoked for each automatic move operation executed by the poller.
 void fileSetFound(FileSetFoundEvent evt)
          Invoked when the poller has found a set of file matching the current criteria
static void main(java.lang.String[] args)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ScriptedPollManager

public ScriptedPollManager(DirectoryPoller poller,
                           java.lang.String[] shellCmd,
                           java.lang.String scriptPath)

ScriptedPollManager

public ScriptedPollManager(DirectoryPoller poller,
                           java.lang.String scriptPath)
                    throws java.lang.UnsupportedOperationException
Method Detail

toString

public java.lang.String toString()

cycleEnded

public void cycleEnded(CycleEndEvent evt)
Description copied from interface: PollManager
Invoked when a polling cycle has ended (the pooler is going to sleep)

Specified by:
cycleEnded in interface PollManager
Overrides:
cycleEnded in class BasePollManager
See Also:
PollManager.cycleEnded(org.sadun.util.polling.CycleEndEvent)

cycleStarted

public void cycleStarted(CycleStartEvent evt)
Description copied from interface: PollManager
Invoked when a polling cycle start (the pooler has just awaken)

Specified by:
cycleStarted in interface PollManager
Overrides:
cycleStarted in class BasePollManager
See Also:
PollManager.cycleStarted(org.sadun.util.polling.CycleStartEvent)

directoryLookupEnded

public void directoryLookupEnded(DirectoryLookupEndEvent evt)
Description copied from interface: PollManager
Invoked when the poller has finished looking into a directory

Specified by:
directoryLookupEnded in interface PollManager
Overrides:
directoryLookupEnded in class BasePollManager
See Also:
PollManager.directoryLookupEnded(org.sadun.util.polling.DirectoryLookupEndEvent)

directoryLookupStarted

public void directoryLookupStarted(DirectoryLookupStartEvent evt)
Description copied from interface: PollManager
Invoked when the poller is starting to look into a directory

Specified by:
directoryLookupStarted in interface PollManager
Overrides:
directoryLookupStarted in class BasePollManager
See Also:
PollManager.directoryLookupStarted(org.sadun.util.polling.DirectoryLookupStartEvent)

exceptionDeletingTargetFile

public void exceptionDeletingTargetFile(java.io.File target)
Description copied from interface: PollManager
Invoked when an automove operation fails since the given file cannot be deleted

Specified by:
exceptionDeletingTargetFile in interface PollManager
Overrides:
exceptionDeletingTargetFile in class BasePollManager
See Also:
PollManager.exceptionDeletingTargetFile(java.io.File)

exceptionMovingFile

public void exceptionMovingFile(java.io.File file,
                                java.io.File dest)
Description copied from interface: PollManager
Invoked when an automove operation fails since the given file cannot be moved to the given destination

Specified by:
exceptionMovingFile in interface PollManager
Overrides:
exceptionMovingFile in class BasePollManager
See Also:
PollManager.exceptionMovingFile(java.io.File, java.io.File)

fileFound

public void fileFound(FileFoundEvent evt)
Description copied from interface: PollManager
Invoked for each of the files found, if setSendSingleFileEvent() has been invoked before starting the poller thread.

Specified by:
fileFound in interface PollManager
Overrides:
fileFound in class BasePollManager
See Also:
PollManager.fileFound(org.sadun.util.polling.FileFoundEvent)

fileMoved

public void fileMoved(FileMovedEvent evt)
Description copied from interface: PollManager
If the automove mode is active, is invoked for each automatic move operation executed by the poller.

Specified by:
fileMoved in interface PollManager
Overrides:
fileMoved in class BasePollManager
See Also:
PollManager.fileMoved(org.sadun.util.polling.FileMovedEvent)

fileSetFound

public void fileSetFound(FileSetFoundEvent evt)
Description copied from interface: PollManager
Invoked when the poller has found a set of file matching the current criteria

Specified by:
fileSetFound in interface PollManager
Overrides:
fileSetFound in class BasePollManager
See Also:
PollManager.fileSetFound(org.sadun.util.polling.FileSetFoundEvent)

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
Throws:
java.lang.Exception


Copyright © 1999, 2000 Cristiano Sadun. This software is released under GPL.