de.dante.extex.interpreter
Class ErrorHandlerFactory

java.lang.Object
  extended byde.dante.util.framework.AbstractFactory
      extended byde.dante.extex.interpreter.ErrorHandlerFactory
All Implemented Interfaces:
Configurable, LogEnabled, RegistrarObserver

public class ErrorHandlerFactory
extends AbstractFactory

This is the factory for instances of ErrorHandler. This factory inherits its properties from the AbstractFactory. Among them the support for configuration and logging.

Configuration

Mainly the configuration needs to specify which class to use for the ErrorHandler. The configuration provides a mapping from a type name to the sub-configuration to be used. The name of the class is given as the argument class of the sub-configuration as shown below.

   <ErrorHandler default="ExTeX">
     <ExTeX class="de.dante.extex.main.errorHandler.ErrorHandlerImpl">
       <EditHandler class="de.dante.extex.main.errorHandler.editHandler.EditHandlerTeXImpl"/>
     </ExTeX>
     <TeX class="de.dante.extex.main.errorHandler.ErrorHandlerTeXImpl">
       <EditHandler class="de.dante.extex.main.errorHandler.editHandler.EditHandlerTeXImpl"/>
     </TeX>
     <extex class="de.dante.extex.main.errorHandler.ErrorHandlerImpl"/>
     <tex class="de.dante.extex.main.errorHandler.ErrorHandlerTeXImpl"/>
    </ErrorHandler>
  

The named class need to implement the interface ErrorHandler. If this interface is not implemented an error is raised.

The configuration is passed down to the new instance if it implements the interface Configurable.

If the class implements the interface LogEnabled then a logger is passed to the new instance. For this purpose the factory itself is log enabled to receive the logger.

Version:
$Revision: 1.5 $
Author:
Gerd Neugebauer

Constructor Summary
ErrorHandlerFactory()
          Creates a new object.
ErrorHandlerFactory(Configuration configuration)
          Creates a new object and configures it according to the parameter.
 
Method Summary
 ErrorHandler newInstance(java.lang.String type)
          Get an instance of an error handler.
 
Methods inherited from class de.dante.util.framework.AbstractFactory
configure, configure, createInstance, createInstance, createInstance, createInstanceForConfiguration, createInstanceForConfiguration, createInstanceForConfiguration, enableLogging, enableLogging, getConfiguration, getLogger, reconnect, selectConfiguration
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ErrorHandlerFactory

public ErrorHandlerFactory()
Creates a new object.


ErrorHandlerFactory

public ErrorHandlerFactory(Configuration configuration)
                    throws ConfigurationException
Creates a new object and configures it according to the parameter.

Parameters:
configuration - the configuration to use
Throws:
ConfigurationException - in case of an error during configuration
Method Detail

newInstance

public ErrorHandler newInstance(java.lang.String type)
                         throws ConfigurationException
Get an instance of an error handler. This method selects one of the entries in the configuration. The selection is done with the help of a type String. If the type is null or the empty string then the default from the configuration is used.

Parameters:
type - the type to use
Returns:
a new error handler
Throws:
ConfigurationException - in case of an configuration error