Class DeleteResourcesProcessor
- All Implemented Interfaces:
ExtensionsFileProcessor
This processor is usually paired with a DeletedFilter
to only
delete resources related to extension files that have been deleted.
Using this processor without a filter will remove resources for
all extensions.
Extensions files that are not a JAR file are always ignored by this processer.
- Since:
- 3.0
- Author:
- Nicklas
- Last modified
- $Date: 2014-04-09 14:21:20 +0200 (on, 09 apr 2014) $
-
Field Summary
Modifier and TypeFieldDescriptionprivate static final Logger
private final File
private int
private int
private int
private final ProcessResults
-
Constructor Summary
ConstructorDescriptionDeleteResourcesProcessor
(File mainDir, ProcessResults results) Create a new processor. -
Method Summary
Modifier and TypeMethodDescriptionvoid
begin
(ExtensionsManager manager, int numFiles) Called by the extensions manager before the processing starts.void
done
(ExtensionsManager manager) Called by the extensions manager after a successful completion of the processing.void
done
(ExtensionsManager manager, Throwable t) Called by the extensions manager if an exception was thrown by the processor.int
Get the total number of resources that was deleted.int
Get the number of files that was had an error.int
Get the number of files that was successfully processed.void
processFile
(ExtensionsManager manager, ExtensionsFile.WriteableExtensionsFile wFile) Called by the extensions manager for each extensions file that it manages.
-
Field Details
-
log
-
mainDir
-
results
-
numFiles
private int numFiles -
numError
private int numError -
numDeleted
private int numDeleted
-
-
Constructor Details
-
DeleteResourcesProcessor
Create a new processor.- Parameters:
mainDir
- The main directory to where the resources are locatedresults
- Optional object for storing results
-
-
Method Details
-
begin
Description copied from interface:ExtensionsFileProcessor
Called by the extensions manager before the processing starts.- Specified by:
begin
in interfaceExtensionsFileProcessor
- Parameters:
manager
- The manager that is executing the actionnumFiles
- The number of extension files that is going to be processed this time
-
processFile
Description copied from interface:ExtensionsFileProcessor
Called by the extensions manager for each extensions file that it manages. The order of the files is generally not predicatable and may change from one invokation to the next.If the processor throws an exception the manager will abort processing and call
ExtensionsFileProcessor.done(ExtensionsManager, Throwable)
. Error that are related to a specific file should be catched by the processor and registered by calling .......If all files was processed without exceptions the manager will call
ExtensionsFileProcessor.done(ExtensionsManager)
.Note that the file is read-only to begin with. If the processor wants to call any write-operation the file must be opened by calling
ExtensionsFile.WriteableExtensionsFile.open()
. It is recommended that the processor callsExtensionsFile.WriteableExtensionsFile.close()
once it is done writing.- Specified by:
processFile
in interfaceExtensionsFileProcessor
- Parameters:
manager
- The manager that is executing the actionwFile
- The file to be processed
-
done
Description copied from interface:ExtensionsFileProcessor
Called by the extensions manager after a successful completion of the processing.- Specified by:
done
in interfaceExtensionsFileProcessor
- Parameters:
manager
- The manager that is executing the action
-
done
Description copied from interface:ExtensionsFileProcessor
Called by the extensions manager if an exception was thrown by the processor.- Specified by:
done
in interfaceExtensionsFileProcessor
- Parameters:
manager
- The manager that is executing the actiont
- The exception
-
getNumFiles
public int getNumFiles()Get the number of files that was successfully processed. -
getNumError
public int getNumError()Get the number of files that was had an error. -
getNumDeleted
public int getNumDeleted()Get the total number of resources that was deleted.
-