de.dante.extex.interpreter.unit
Class LoadUnit

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

public final class LoadUnit
extends AbstractFactory

This is a factory to units from a configuration. A unit is a configuration consisting of an optional setup class and a set of primitives. When the unit is loaded the setup class is instantiated and run. Then the primitives are created and registered in the context.

  <unit>
    <setup class="the.setup.Class"/>
    <primitive>
      <define name="name" class="class"/>
      <define name="name" class="class">value</define>
      <define name="name" class="class"/>
    </primitive>
  </unit>
 

Version:
$Revision: 1.1 $
Author:
Gerd Neugebauer

Method Summary
 void define(Configuration configuration, TokenFactory tokenFactory, Context context, Typesetter typesetter, java.util.logging.Logger outputLogger, OutputStreamFactory outputFactory)
          Scan a configuration and define the primitives found.
static void loadUnit(Configuration configuration, Context context, TokenSource source, Typesetter typesetter, java.util.logging.Logger logger, OutputStreamFactory outputFactory)
          Prepare the primitives according to their configuration.
 
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
 

Method Detail

loadUnit

public static void loadUnit(Configuration configuration,
                            Context context,
                            TokenSource source,
                            Typesetter typesetter,
                            java.util.logging.Logger logger,
                            OutputStreamFactory outputFactory)
                     throws ConfigurationException,
                            GeneralException
Prepare the primitives according to their configuration. The given configuration may contain sub-configurations with the name primitives which includes the definition of primitives. Those primitives are defined no matter if they are already defined or not.

Parameters:
configuration - the configuration
context - the interpreter context
source - the source for new tokens
typesetter - the typesetter
logger - the logger to use
outputFactory - the output stream factory
Throws:
ConfigurationException - in case of a configuration error
GeneralException - in case of an error

define

public void define(Configuration configuration,
                   TokenFactory tokenFactory,
                   Context context,
                   Typesetter typesetter,
                   java.util.logging.Logger outputLogger,
                   OutputStreamFactory outputFactory)
            throws GeneralException,
                   ConfigurationException
Scan a configuration and define the primitives found.

Parameters:
configuration - the configuration to scan
tokenFactory - the token factory to use
context - the interpreter context to register the primitive in
typesetter - the typesetter
outputLogger - the logger to produce output to
outputFactory - the factory for new output streams
Throws:
GeneralException - In case of an error
ConfigurationException - in case of an error
  • ConfigurationMissingAttributeException in case of a missing argument
  • ConfigurationInstantiationException in case of an error during instantiation
  • ConfigurationClassNotFoundException in case of a missing class
  • ConfigurationWrapperException in case of another error which is wrapped