org.stanwood.media.actions
Class ActionPerformer

java.lang.Object
  extended by org.stanwood.media.actions.ActionPerformer
All Implemented Interfaces:
IActionEventHandler

public class ActionPerformer
extends java.lang.Object
implements IActionEventHandler

This class is used to perform a list of actions upon files in a media directory


Constructor Summary
ActionPerformer(Controller controller, java.util.List<IAction> actions, MediaDirectory dir, java.util.List<java.lang.String> exts)
          Constructor used to create a instance of the class
 
Method Summary
protected  java.util.List<java.io.File> findMediaFiles(IProgressMonitor monitor)
           
 void performActions(IProgressMonitor monitor)
          Used to perform the actions
 void performActions(java.util.List<java.io.File> files, java.util.Set<java.io.File> dirs, IProgressMonitor parentMonitor)
          Used to perform the actions
 void sendEventDeletedFile(java.io.File file)
          Listen for the delete file event and remove it from the stores
 void sendEventNewFile(java.io.File file)
          Listen for the new file event and perform the actions on it
 void sendEventRenamedFile(java.io.File oldFile, java.io.File newFile)
          Listen for the rename file event and and update stores
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ActionPerformer

public ActionPerformer(Controller controller,
                       java.util.List<IAction> actions,
                       MediaDirectory dir,
                       java.util.List<java.lang.String> exts)
                throws ConfigException
Constructor used to create a instance of the class

Parameters:
controller - The controller
actions - List of actions to perform
dir - The media directory
exts - The extensions to search for
Throws:
ConfigException - Thrown if their is a problem reading the config
Method Detail

performActions

public void performActions(IProgressMonitor monitor)
                    throws ActionException
Used to perform the actions

Parameters:
monitor - Progress monitor
Throws:
ActionException - Thrown if their are any errors with the actions

performActions

public void performActions(java.util.List<java.io.File> files,
                           java.util.Set<java.io.File> dirs,
                           IProgressMonitor parentMonitor)
                    throws ActionException
Used to perform the actions

Parameters:
files - The files to perform the actions on
dirs - The directories with the media directory
parentMonitor - Progress monitor parent
Throws:
ActionException - Thrown if their are any errors with the actions

findMediaFiles

protected java.util.List<java.io.File> findMediaFiles(IProgressMonitor monitor)
                                               throws ActionException
Throws:
ActionException

sendEventNewFile

public void sendEventNewFile(java.io.File file)
                      throws ActionException
Listen for the new file event and perform the actions on it

Specified by:
sendEventNewFile in interface IActionEventHandler
Parameters:
file - the File
Throws:
ActionException - Thrown if their are any problems

sendEventDeletedFile

public void sendEventDeletedFile(java.io.File file)
Listen for the delete file event and remove it from the stores

Specified by:
sendEventDeletedFile in interface IActionEventHandler
Parameters:
file - the File

sendEventRenamedFile

public void sendEventRenamedFile(java.io.File oldFile,
                                 java.io.File newFile)
                          throws ActionException
Listen for the rename file event and and update stores

Specified by:
sendEventRenamedFile in interface IActionEventHandler
Parameters:
oldFile - The old filename
newFile - The new filename
Throws:
ActionException - Thrown if their are any problems