|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.dante.extex.ExTeX
This is the programmatic interface to the
The programmatic interface provides the following features:
Settings can be stored in properties files. Those settings are the fallback if none are provided otherwise.
The properties are stored in a file named .extex. It is sought in the users home directory. This determined by the system property user.home. Afterwards it is sought in the current directory. The local settings of a directory overwrite the user's setting. The user's setting overwrite the compiled in defaults
The following properties are recognized:
true
then act as initex. This command line
option is defined for compatibility to There is another level of properties which is considered between the compiled in defaults and the user's properties. Those are the system properties of the Java system. In those properties system wide settings can be stored. Nevertheless, you should use this feature sparsely.
The configuration of
This class is the central point for using an instance of
The class provides several protected methods which are solemnly made accessible to extend the functionality of the class. To do so you need insight into the live cycle of the class.
Mainly there are two steps in using this class. The first step is the creation of a new instance. This phase is depicted in the figure above. Note that no interpreter is created during this phase. Thus the possibilities to influence the run-time behavior is rather limited.
propertyDefault()
applyLanguage()
applyInteraction()
The major activities are carried out when the method
run()
is invoked. The methods used i n this phase are shown
in the figure below.
makeLogFile()
makeLogHandler()
showBanner()
makeOutputFactory()
makeResourceFinder()
makeInterpreter()
makeFontFactory()
makeTokenFactory()
makeContext()
makeDefaultFont()
makeLanguageManager()
loadFormat()
initializeStreams()
makeTypesetter()
run()
logPages()
Field Summary | |
protected static java.lang.String |
PROP_BANNER
The constant PROP_BANNER contains the name of the property for the banner. |
protected static java.lang.String |
PROP_CODE
The constant PROP_CODE contains the name of the property for the |
protected static java.lang.String |
PROP_COLOR_CONVERTER
The constant PROP_COLOR_CONVERTER contains the name of the property for the color converter to use. |
protected static java.lang.String |
PROP_CONFIG
The constant PROP_CONFIG contains the name of the property for the configuration resource to use. |
protected static java.lang.String |
PROP_ENCODING
The constant PROP_ENCODING contains the name of the property for the standard encoding to use. |
protected static java.lang.String |
PROP_ERROR_HANDLER
The constant PROP_ERROR_HANDLER contains the name of the property for the error handler type to use. |
protected static java.lang.String |
PROP_FILE
The constant PROP_FILE contains the name of the property for the input file to read. |
protected static java.lang.String |
PROP_FMT
The constant PROP_FMT contains the name of the property for the name of the format file to use. |
protected static java.lang.String |
PROP_HALT_ON_ERROR
The constant PROP_HALT_ON_ERROR contains the name of the property indicating whether the processing should stop at the first error. |
protected static java.lang.String |
PROP_INI
The constant PROP_INI contains the name of the property for the Boolean value indicating that some kind of emulations for iniTeX should be provided. |
protected static java.lang.String |
PROP_INTERACTION
The constant PROP_INTERACTION contains the name of the property for the interaction mode. |
protected static java.lang.String |
PROP_INTERNAL_STACKTRACE
The constant PROP_INTERNAL_STACKTRACE contains the name of the property indicating that a stack trace should be written for internal errors. |
protected static java.lang.String |
PROP_JOBNAME
The constant PROP_JOBNAME contains the name of the property for the job name. |
protected static java.lang.String |
PROP_JOBNAME_MASTER
The constant PROP_JOBNAME_MASTER contains the name of the property for the job name to be used with high priority. |
protected static java.lang.String |
PROP_LANG
The constant PROP_LANG contains the name of the property for the language to use for messages. |
protected static java.lang.String |
PROP_NAME
The constant PROP_NAME contains the name of the property for the program name used in messages. |
protected static java.lang.String |
PROP_NO_BANNER
The constant PROP_NO_BANNER contains the name of the property for the Boolean value indicating whether or not to show a program banner. |
protected static java.lang.String |
PROP_OUTPUT_DIRS
The constant PROP_OUTPUT_DIRS contains the name of the property for the output directory path. |
protected static java.lang.String |
PROP_OUTPUT_TYPE
The constant PROP_OUTPUT_TYPE contains the name of the property for the output driver. |
protected static java.lang.String |
PROP_PAGE
The constant PROP_PAGE contains the name of the property for the default page dimensions. |
protected static java.lang.String |
PROP_PROGNAME
The constant PROP_PROGNAME contains the name of the property for the program name used in format loading. |
protected static java.lang.String |
PROP_TEXINPUTS
The constant PROP_TEXINPUTS contains the name of the property for the additional texinputs specification of directories. |
protected static java.lang.String |
PROP_TOKEN_STREAM
The constant PROP_TOKEN_STREAM contains the name of the property for the token stream class to use. |
protected static java.lang.String |
PROP_TRACE_FONT_FILES
The constant PROP_TRACE_FONT_FILES contains the name of the property for the Boolean determining whether or not the searching for font files should produce tracing output. |
protected static java.lang.String |
PROP_TRACE_INPUT_FILES
The constant PROP_TRACE_INPUT_FILES contains the name of the property for the Boolean determining whether or not the searching for input files should produce tracing output. |
protected static java.lang.String |
PROP_TRACE_MACROS
The constant PROP_TRACE_MACROS contains the name of the property for the Boolean determining whether or not the execution of macros should produce tracing output. |
protected static java.lang.String |
PROP_TRACE_TOKENIZER
The constant PROP_TRACE_TOKENIZER contains the name of the property for the Boolean determining whether or not the tokenizer should produce tracing output. |
protected static java.lang.String |
PROP_TRACING_ONLINE
The constant PROP_TRACING_ONLINE contains the name of the property for the Boolean determining whether or not the tracing should produce log output in the log file only. |
protected static java.lang.String |
PROP_TYPESETTER_TYPE
The constant PROP_TYPESETTER_TYPE contains the name of the property for the typesetter to use. |
Constructor Summary | |
ExTeX(java.util.Properties theProperties)
Creates a new object and supplies some properties for those keys which are not contained in the properties already. |
|
ExTeX(java.util.Properties theProperties,
java.lang.String dotFile)
Creates a new object and initializes the properties from given properties and possibly from a user's properties in the file .extex. |
Method Summary | |
protected void |
applyInteraction()
Propagate the settings for the interaction mode to the interactionObserver . |
protected void |
applyLanguage()
Try to determine which language to use and configure the localizer accordingly. |
boolean |
getBooleanProperty(java.lang.String key)
Getter for a named property as boolean. |
protected Localizer |
getLocalizer()
Getter for localizer. |
java.util.logging.Logger |
getLogger()
Getter for logger. |
java.io.OutputStream |
getOutStream()
Getter for outStream. |
java.util.Properties |
getProperties()
Getter for properties. |
java.lang.String |
getProperty(java.lang.String key)
Getter for a named property. |
static java.lang.String |
getVersion()
Getter for the version. |
protected boolean |
initializeStreams(Interpreter interpreter,
java.util.Properties prop)
Initialize the input streams. |
protected Context |
loadFormat(java.lang.String fmt,
Interpreter interpreter,
ResourceFinder finder,
java.lang.String jobname,
Configuration config,
OutputStreamFactory outFactory,
TokenFactory tokenFactory)
Load a format if a non-empty name of a format is given. |
protected void |
loadUserProperties(java.io.File file)
Load properties from a given file if it exists. |
protected static void |
logException(java.util.logging.Logger logger,
java.lang.String text,
java.lang.Throwable e)
Log a Throwable including its stack trace
to the logger. |
protected void |
logInternalError(java.lang.Throwable e)
Log a Throwable including its stack trace to the logger. |
protected void |
logPages(BackendDriver backend)
This method can be overwritten to provide logging functionality for the pages produced. |
protected BackendDriver |
makeBackend(Configuration config,
OutputStreamFactory outFactory,
DocumentWriterOptions options,
Configuration colorConfig,
ResourceFinder finder,
FontFactory fontFactory)
Create a new document writer. |
protected ColorConverter |
makeColorConverter(Configuration config)
Make a new instance of a color converter. |
protected Context |
makeContext(Configuration config,
TokenFactory tokenFactory,
FontFactory fontFactory,
Interpreter interpreter,
ResourceFinder finder,
java.lang.String jobname,
OutputStreamFactory outFactory)
Prepare the context according to its configuration. |
protected Font |
makeDefaultFont(Configuration config,
FontFactory fontFactory)
Create a default font for the interpreter context. |
protected FontFactory |
makeFontFactory(Configuration config,
ResourceFinder finder)
Create a new font factory. |
protected Interpreter |
makeInterpreter(Configuration config,
OutputStreamFactory outFactory,
ResourceFinder finder,
java.lang.String jobname)
Create a new interpreter. |
protected LanguageManager |
makeLanguageManager(Configuration config,
OutputStreamFactory outFactory,
ResourceFinder finder)
Prepare the hyphenation manager according to its configuration. |
protected java.io.File |
makeLogFile(java.lang.String jobname)
Find the name for the log file. |
protected java.util.logging.Handler |
makeLogHandler(java.io.File logFile)
Create a new Handler for the log file. |
protected OutputFactory |
makeOutputFactory(java.lang.String jobname,
Configuration config)
Create the output factory. |
protected ResourceFinder |
makeResourceFinder(Configuration config)
Create a ResourceFinder. |
protected TokenFactory |
makeTokenFactory(Configuration config)
Prepare the token factory according to its configuration. |
protected TokenStreamFactory |
makeTokenStreamFactory(Configuration config,
ResourceFinder finder)
Create a TokenStreamFactory. |
protected Typesetter |
makeTypesetter(Interpreter interpreter,
Configuration config,
OutputStreamFactory outFactory,
ResourceFinder finder,
FontFactory fontFactory)
Create a new typesetter. |
protected void |
propertyDefault(java.lang.String name,
java.lang.String value)
Set a property to a given value if not set yet. |
Interpreter |
run()
Run the program with the parameters already stored in the properties. |
void |
setErrorHandler(ErrorHandler handler)
Setter for errorHandler. |
void |
setLogger(java.util.logging.Logger logger)
Setter for logger. |
void |
setOutStream(java.io.OutputStream outputStream)
Setter for outStream. |
protected void |
setProperty(java.lang.String key,
java.lang.String value)
Setter for a named property. |
protected void |
showBanner(Configuration configuration,
java.util.logging.Level priority)
Print the program banner to the logger stream and remember that this has been done already to avoid repetition. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected static final java.lang.String PROP_BANNER
protected static final java.lang.String PROP_CODE
protected static final java.lang.String PROP_COLOR_CONVERTER
protected static final java.lang.String PROP_CONFIG
protected static final java.lang.String PROP_ENCODING
protected static final java.lang.String PROP_ERROR_HANDLER
protected static final java.lang.String PROP_FILE
protected static final java.lang.String PROP_FMT
protected static final java.lang.String PROP_HALT_ON_ERROR
protected static final java.lang.String PROP_INI
protected static final java.lang.String PROP_INTERACTION
protected static final java.lang.String PROP_INTERNAL_STACKTRACE
protected static final java.lang.String PROP_JOBNAME
protected static final java.lang.String PROP_JOBNAME_MASTER
protected static final java.lang.String PROP_LANG
protected static final java.lang.String PROP_NAME
protected static final java.lang.String PROP_NO_BANNER
protected static final java.lang.String PROP_OUTPUT_DIRS
protected static final java.lang.String PROP_OUTPUT_TYPE
DocumentWriterFactory
to find the appropriate class.
protected static final java.lang.String PROP_PAGE
protected static final java.lang.String PROP_PROGNAME
protected static final java.lang.String PROP_TEXINPUTS
protected static final java.lang.String PROP_TOKEN_STREAM
protected static final java.lang.String PROP_TRACE_FONT_FILES
protected static final java.lang.String PROP_TRACE_INPUT_FILES
protected static final java.lang.String PROP_TRACE_MACROS
protected static final java.lang.String PROP_TRACE_TOKENIZER
protected static final java.lang.String PROP_TRACING_ONLINE
protected static final java.lang.String PROP_TYPESETTER_TYPE
TypesetterFactory
to find the appropriate class.
Constructor Detail |
public ExTeX(java.util.Properties theProperties) throws InterpreterException
theProperties
- the properties to start with. This object is
used and modified. The caller should provide a new instance if this is
not desirable.
InterpreterException
- in case of an errorpublic ExTeX(java.util.Properties theProperties, java.lang.String dotFile) throws InterpreterException, java.io.IOException
theProperties
- the properties to considerdotFile
- the name of the local configuration file. In the case
that this value is null
no user properties
will be considered.
InterpreterException
- in case of an invalid interaction mode
java.io.IOException
- in case of an IO Error during the reading of the
properties fileExTeX(java.util.Properties)
Method Detail |
public static java.lang.String getVersion()
protected static void logException(java.util.logging.Logger logger, java.lang.String text, java.lang.Throwable e)
Throwable
including its stack trace
to the logger.
logger
- the target loggertext
- the prefix text to loge
- the Throwable to logprotected void applyInteraction() throws InteractionUnknownException
interactionObserver
.
InteractionUnknownException
- in case that the interaction is
not set properlyprotected void applyLanguage()
public boolean getBooleanProperty(java.lang.String key)
key
- the property name
protected Localizer getLocalizer()
public java.util.logging.Logger getLogger()
public java.io.OutputStream getOutStream()
public java.util.Properties getProperties()
public java.lang.String getProperty(java.lang.String key)
key
- the property name
null
protected boolean initializeStreams(Interpreter interpreter, java.util.Properties prop) throws ConfigurationException
interpreter
- the interpreter contextprop
- the properties
true
if the stream have not been initialized
ConfigurationException
- in case of a configuration errorprotected Context loadFormat(java.lang.String fmt, Interpreter interpreter, ResourceFinder finder, java.lang.String jobname, Configuration config, OutputStreamFactory outFactory, TokenFactory tokenFactory) throws java.io.IOException, GeneralException, ConfigurationException
fmt
- the name of the format to use or null
or the
empty string to suppress loadinginterpreter
- the interpreter to delegate the loading tofinder
- the resource finder to use for locating the format filejobname
- the name of the jobconfig
- the interpreter configurationoutFactory
- the output stream factorytokenFactory
- the token factory to assign to the context or
null
if no assignment should be performed
GeneralException
- in case of some error
java.io.IOException
- in case, well, you guess it
ConfigurationException
- in case of a configuration errorprotected void loadUserProperties(java.io.File file) throws java.io.IOException
file
- the file to consider
java.io.IOException
- in case of an IO Error during the reading of the
properties fileprotected void logInternalError(java.lang.Throwable e)
e
- the Throwable to logprotected void logPages(BackendDriver backend)
backend
- the back-end driverprotected BackendDriver makeBackend(Configuration config, OutputStreamFactory outFactory, DocumentWriterOptions options, Configuration colorConfig, ResourceFinder finder, FontFactory fontFactory) throws DocumentWriterException, ConfigurationException
config
- the configuration object for the document writeroutFactory
- the output factoryoptions
- the options to be passed to the document writercolorConfig
- the configuration for the color converterfinder
- the resource finder if one is requestedfontFactory
- the font factory
DocumentWriterException
- in case of an error
ConfigurationException
- in case of a configuration problemprotected ColorConverter makeColorConverter(Configuration config) throws ConfigurationException
config
- the configuration to use
ConfigurationException
- in case of a configuration problemprotected Context makeContext(Configuration config, TokenFactory tokenFactory, FontFactory fontFactory, Interpreter interpreter, ResourceFinder finder, java.lang.String jobname, OutputStreamFactory outFactory) throws ConfigurationException, GeneralException, FontException, java.io.IOException
config
- the configuration of the interpretertokenFactory
- the token factory to injectfontFactory
- the font factoryinterpreter
- the interpreterfinder
- the resoruce finderjobname
- the job nameoutFactory
- the output stream factory
ConfigurationException
- in case of a configuration error
FontException
- in case of a font error
GeneralException
- in case of an error
java.io.IOException
- in case of an IO errorprotected Font makeDefaultFont(Configuration config, FontFactory fontFactory) throws GeneralException, ConfigurationException, FontException
config
- the configuration object for the font.
This can be null
fontFactory
- the font factory to request the font from
GeneralException
- in case of an error of some other kind
ConfigurationException
- in case that some kind of problems have
been detected in the configuration
FontException
- in case of problems with the font itselfprotected FontFactory makeFontFactory(Configuration config, ResourceFinder finder) throws ConfigurationException
config
- the configuration object for the font factoryfinder
- the resource finder to use
ConfigurationException
- in case that some kind of problems have
been detected in the configurationprotected Interpreter makeInterpreter(Configuration config, OutputStreamFactory outFactory, ResourceFinder finder, java.lang.String jobname) throws ConfigurationException, GeneralException, FontException, java.io.IOException
config
- the configuration object for the interpreteroutFactory
- the factory for new output streamsfinder
- the resource finderjobname
- the job name
ConfigurationException
- in case that some kind of problems have
been detected in the configuration
GeneralException
- in case of an error of some other kind
FontException
- in case of problems with the font itself
java.io.IOException
- in case of an IO errorprotected LanguageManager makeLanguageManager(Configuration config, OutputStreamFactory outFactory, ResourceFinder finder) throws ConfigurationException
This method can be overwritten in derived classes to perform additional tasks. In this case it might be a good idea to invoke this method from the super-class to do its job.
config
- the configurationoutFactory
- the output stream factoryfinder
- the resource finder
ConfigurationException
- in case of a configuration errorprotected java.io.File makeLogFile(java.lang.String jobname)
This method can be overwritten in derived classes to perform additional tasks. In this case it might be a good idea to invoke this method from the super-class to do its job.
jobname
- the name of the job
protected java.util.logging.Handler makeLogHandler(java.io.File logFile)
This method can be overwritten in derived classes to perform additional tasks. In this case it might be a good idea to invoke this method from the super-class to do its job.
logFile
- the name of the log file
protected OutputFactory makeOutputFactory(java.lang.String jobname, Configuration config) throws ConfigurationException
jobname
- the job nameconfig
- the configuration
ConfigurationException
- in case of a configuration errorprotected ResourceFinder makeResourceFinder(Configuration config) throws ConfigurationException
This method can be overwritten in derived classes to perform additional tasks. In this case it might be a good idea to invoke this method from the super-class to do its job.
config
- the configuration
ConfigurationException
- in case of an configuration errorprotected TokenFactory makeTokenFactory(Configuration config) throws ConfigurationException
This method can be overwritten in derived classes to perform additional tasks. In this case it might be a good idea to invoke this method from the super-class to do its job.
config
- the configuration
ConfigurationException
- in case of a configuration errorprotected TokenStreamFactory makeTokenStreamFactory(Configuration config, ResourceFinder finder) throws ConfigurationException, NotObservableException
This method can be overwritten in derived classes to perform additional tasks. In this case it might be a good idea to invoke this method from the super-class to do its job.
config
- the configuration object for the token stream factoryfinder
- the file finder for the token stream factory
ConfigurationException
- in case that some kind of problems have
been detected in the configuration
NotObservableException
- in case that the observer for file
events could not be registeredprotected Typesetter makeTypesetter(Interpreter interpreter, Configuration config, OutputStreamFactory outFactory, ResourceFinder finder, FontFactory fontFactory) throws TypesetterException, ConfigurationException, CatcodeException, DocumentWriterException
This method can be overwritten in derived classes to perform additional tasks. In this case it might be a good idea to invoke this method from the super-class to do its job.
interpreter
- the interpreterconfig
- the global configuration objectoutFactory
- the output stream factoryfinder
- the resource finderfontFactory
- the font factory
ConfigurationException
- in case that some kind of problems have
been detected in the configuration
TypesetterException
- in case of an error
CatcodeException
- in case of a problem with catcodes
DocumentWriterException
- just in caseprotected void propertyDefault(java.lang.String name, java.lang.String value)
name
- the name of the propertyvalue
- the default valuepublic Interpreter run() throws ConfigurationException, java.io.IOException, InterpreterException
java.io.IOException
- in case of a reading errorConfigurationException
- in case of a configuration error
InterpreterException
- in case of another errorpublic void setErrorHandler(ErrorHandler handler)
handler
- the errorHandler to set.public void setLogger(java.util.logging.Logger logger)
logger
- the logger to set.public void setOutStream(java.io.OutputStream outputStream)
outputStream
- the outStream to set.protected void setProperty(java.lang.String key, java.lang.String value)
key
- the property namevalue
- the new value of the named propertyprotected void showBanner(Configuration configuration, java.util.logging.Level priority)
configuration
- the configuration to use. The configuration may
contain a tag banner. If present then the value is used.
The configuration can be null
. Then it is ignored.priority
- the log level
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |