|
3.0.1: 2011-11-10 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sf.basedb.util.extensions.manager.processor.DeleteResourcesProcessor
public class DeleteResourcesProcessor
A file processor implementation that removes all resources that was previously extracted from a JAR file. The main target directory must be specified when an instance is constructed. Each processed JAR file is assumed to have been extracted into a subdirectory with the same name as the JAR file. This directory will be removed.
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.
Field Summary | |
---|---|
private static Logger |
log
|
private File |
mainDir
|
private int |
numDeleted
|
private int |
numError
|
private int |
numFiles
|
private ProcessResults |
results
|
Constructor Summary | |
---|---|
DeleteResourcesProcessor(File mainDir,
ProcessResults results)
Create a new processor. |
Method Summary | |
---|---|
void |
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 |
getNumDeleted()
Get the total number of resources that was deleted. |
int |
getNumError()
Get the number of files that was had an error. |
int |
getNumFiles()
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final Logger log
private final File mainDir
private final ProcessResults results
private int numFiles
private int numError
private int numDeleted
Constructor Detail |
---|
public DeleteResourcesProcessor(File mainDir, ProcessResults results)
mainDir
- The main directory to where the resources are locatedresults
- Optional object for storing resultsMethod Detail |
---|
public void begin(ExtensionsManager manager, int numFiles)
ExtensionsFileProcessor
begin
in interface ExtensionsFileProcessor
manager
- The manager that is executing the actionnumFiles
- The number of extension files that is going to be processed this timepublic void processFile(ExtensionsManager manager, ExtensionsFile.WriteableExtensionsFile wFile)
ExtensionsFileProcessor
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 calls ExtensionsFile.WriteableExtensionsFile.close()
once it is done writing.
processFile
in interface ExtensionsFileProcessor
manager
- The manager that is executing the actionwFile
- The file to be processedpublic void done(ExtensionsManager manager)
ExtensionsFileProcessor
done
in interface ExtensionsFileProcessor
manager
- The manager that is executing the actionpublic void done(ExtensionsManager manager, Throwable t)
ExtensionsFileProcessor
done
in interface ExtensionsFileProcessor
manager
- The manager that is executing the actiont
- The exceptionpublic int getNumFiles()
public int getNumError()
public int getNumDeleted()
|
3.0.1: 2011-11-10 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |