public class PluginInstallationProcessor extends java.lang.Object implements ExtensionsFileProcessor
Modifier and Type | Field and Description |
---|---|
private DbControl |
dc |
private XmlLoader |
loader |
private static org.slf4j.Logger |
log |
private int |
numError |
private int |
numFiles |
private int |
numTotalPlugins |
private ProcessResults |
results |
Constructor and Description |
---|
PluginInstallationProcessor(DbControl dc,
ProcessResults results)
Create a new processor.
|
Modifier and Type | Method and 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,
java.lang.Throwable t)
Called by the extensions manager if an exception was thrown
by the processor.
|
int |
getNumError()
Get the number of files that was had an error.
|
int |
getNumFiles()
Get the number of files that was successfully processed.
|
int |
getNumPlugins()
Get the total number of plug-in installed or updated
by the processor.
|
ProcessResults |
getProcessResults() |
XmlLoader |
getXmlLoader()
Get the loader the processor is using for parsing xml files with
plug-in definitions.
|
void |
processFile(ExtensionsManager manager,
ExtensionsFile.WriteableExtensionsFile wFile)
Called by the extensions manager for each extensions file that it
manages.
|
private static final org.slf4j.Logger log
private final DbControl dc
private final XmlLoader loader
private final ProcessResults results
private int numFiles
private int numError
private int numTotalPlugins
public PluginInstallationProcessor(DbControl dc, ProcessResults results)
dc
- Optional DbControl to use when installing plug-ins
(if not given, only the information from the XML files are loaded,
the plug-ins are not installed)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, java.lang.Throwable t)
ExtensionsFileProcessor
done
in interface ExtensionsFileProcessor
manager
- The manager that is executing the actiont
- The exceptionpublic XmlLoader getXmlLoader()
public ProcessResults getProcessResults()
public int getNumFiles()
public int getNumError()
public int getNumPlugins()