Class ResetProcessor
- java.lang.Object
-
- net.sf.basedb.util.extensions.manager.processor.ResetProcessor
-
- All Implemented Interfaces:
ExtensionsFileProcessor
public class ResetProcessor extends Object implements ExtensionsFileProcessor
File processor implementation that reset the error flag, class loader, etc. for all extension files. This is usually needed to be able to re-install extensions that has been updated or that had an error that has now been fixed.- Since:
- 3.10
- Author:
- Nicklas
- Last modified
- $Date$
-
-
Field Summary
Fields Modifier and Type Field Description private static org.slf4j.Logger
log
private int
numFiles
private boolean
resetClassLoader
private boolean
resetErrorFlag
private ProcessResults
results
-
Constructor Summary
Constructors Constructor Description ResetProcessor(ProcessResults results)
Create a new processor instance using default settings.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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
getNumFiles()
Get the number of files that was processed.boolean
getResetClassLoader()
boolean
getResetrrorFlag()
void
processFile(ExtensionsManager manager, ExtensionsFile.WriteableExtensionsFile wFile)
Called by the extensions manager for each extensions file that it manages.void
setResetClassLoader(boolean resetClassLoader)
This flag controls if the class loader should be reset or not.void
setResetErrorFlag(boolean resetErrorFlag)
This flag controls if the error flag should be reset or not.
-
-
-
Field Detail
-
log
private static final org.slf4j.Logger log
-
results
private final ProcessResults results
-
resetErrorFlag
private boolean resetErrorFlag
-
resetClassLoader
private boolean resetClassLoader
-
numFiles
private int numFiles
-
-
Constructor Detail
-
ResetProcessor
public ResetProcessor(ProcessResults results)
Create a new processor instance using default settings.
-
-
Method Detail
-
setResetClassLoader
public void setResetClassLoader(boolean resetClassLoader)
This flag controls if the class loader should be reset or not. It is on by default.
-
getResetClassLoader
public boolean getResetClassLoader()
-
setResetErrorFlag
public void setResetErrorFlag(boolean resetErrorFlag)
This flag controls if the error flag should be reset or not. It is on by default.
-
getResetrrorFlag
public boolean getResetrrorFlag()
-
begin
public void begin(ExtensionsManager manager, int numFiles)
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
public void processFile(ExtensionsManager manager, ExtensionsFile.WriteableExtensionsFile wFile)
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
public void done(ExtensionsManager manager)
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
public void done(ExtensionsManager manager, Throwable t)
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 processed.
-
-