org.extex.interpreter
Class LoadUnit

java.lang.Object
  extended by org.extex.framework.AbstractFactory
      extended by org.extex.interpreter.LoadUnit
All Implemented Interfaces:
Configurable, LogEnabled, RegistrarObserver, ResourceAware

public final class LoadUnit
extends AbstractFactory

This is a factory load 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 name="the name"
        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: 4770 $
Author:
Gerd Neugebauer

Field Summary
 
Fields inherited from class org.extex.framework.AbstractFactory
CLASS_ATTRIBUTE, DEFAULT_ATTRIBUTE, SELECT_ATTRIBUTE
 
Method Summary
 void define(Configuration configuration, TokenFactory tokenFactory, Context context, Typesetter typesetter, java.util.logging.Logger outputLogger, OutputStreamFactory outputFactory, ResourceFinder resourcefinder)
          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, ResourceFinder resourcefinder)
          Prepare the primitives according to their configuration.
 
Methods inherited from class org.extex.framework.AbstractFactory
configure, configure, createInstance, createInstance, createInstance, createInstance, createInstanceForConfiguration, createInstanceForConfiguration, createInstanceForConfiguration, enableLogging, enableLogging, getConfiguration, getLogger, getResourceFinder, reconnect, selectConfiguration, setResourceFinder
 
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,
                            ResourceFinder resourcefinder)
                     throws 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
resourcefinder - the resource finder
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,
                   ResourceFinder resourcefinder)
            throws GeneralException
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
resourcefinder - the resource finder
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