3.2.4: 2013-12-06

net.sf.basedb.util.extensions.manager.processor
Class UnregisterExtensionsProcessor

java.lang.Object
  extended by net.sf.basedb.util.extensions.manager.processor.UnregisterExtensionsProcessor
All Implemented Interfaces:
ExtensionsFileProcessor

public class UnregisterExtensionsProcessor
extends Object
implements ExtensionsFileProcessor

Extensions file processor implementation that unregisters all extension points and extensions. This processor is usually paired with a DeletedFilter to unregister extensions from deleted files. Using this processor without a filter will unregister all extensions.

Since:
3.0
Author:
Nicklas
Last modified
$Date: 2011-04-15 09:52:28 +0200 (Fri, 15 Apr 2011) $

Field Summary
private static org.apache.log4j.Logger log
           
private  int numError
           
private  int numFiles
           
private  int numUnregistered
           
private  ProcessResults results
           
 
Constructor Summary
UnregisterExtensionsProcessor(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 getNumError()
          Get the number of files that was had an error.
 int getNumFiles()
          Get the number of files that was successfully processed.
 int getNumUnregistered()
          Get the number of extensions + extension points that was unregistered.
 void processFile(ExtensionsManager manager, ExtensionsFile.WriteableExtensionsFile wFile)
          Called by the extensions manager for each extensions file that it manages.
private  void unregisterExtension(ExtensionsFile.WriteableExtensionsFile wFile, Extension ext, Registry registry)
          Unregister the given extension including factory metadata etc.
private  void unregisterExtensionPoint(ExtensionsFile.WriteableExtensionsFile wFile, ExtensionPoint ep, Registry registry)
          Unregister the given extension point including factory metadata etc.
private  void unregisterFactory(ExtensionsFile.WriteableExtensionsFile wFile, Object factory)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

private static final org.apache.log4j.Logger log

results

private final ProcessResults results

numFiles

private int numFiles

numError

private int numError

numUnregistered

private int numUnregistered
Constructor Detail

UnregisterExtensionsProcessor

public UnregisterExtensionsProcessor(ProcessResults results)
Create a new processor.

Parameters:
results - Optional object for storing results
Method Detail

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 interface ExtensionsFileProcessor
Parameters:
manager - The manager that is executing the action
numFiles - 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 calls ExtensionsFile.WriteableExtensionsFile.close() once it is done writing.

Specified by:
processFile in interface ExtensionsFileProcessor
Parameters:
manager - The manager that is executing the action
wFile - 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 interface ExtensionsFileProcessor
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 interface ExtensionsFileProcessor
Parameters:
manager - The manager that is executing the action
t - The exception

unregisterExtension

private void unregisterExtension(ExtensionsFile.WriteableExtensionsFile wFile,
                                 Extension ext,
                                 Registry registry)
Unregister the given extension including factory metadata etc.


unregisterExtensionPoint

private void unregisterExtensionPoint(ExtensionsFile.WriteableExtensionsFile wFile,
                                      ExtensionPoint ep,
                                      Registry registry)
Unregister the given extension point including factory metadata etc.


unregisterFactory

private void unregisterFactory(ExtensionsFile.WriteableExtensionsFile wFile,
                               Object factory)

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.


getNumUnregistered

public int getNumUnregistered()
Get the number of extensions + extension points that was unregistered.


3.2.4: 2013-12-06