Package atessera.comp
package atessera.comp
Provides the compilation subsystem.
This package encapsulates the process of invoking external compilers and
tools (such as pdflatex, mpost, and gnuplot) in
isolated temporary directories. It follows a three-layer architecture:
- Contracts
Compiler(strategy interface),CompilationTask(input DTO),CompilationResult(output DTO) — define the protocol for compilation.- Runtime
LocalCompiler— the default implementation that executes shell commands inside aTempDir.- Facades
PdfLatex,Metapost,GNUPlot— high-level classes that encapsulate multi-step pipelines for specific tools and delegate the actual execution to aCompiler.
Typical usage
Compiler compiler = new LocalCompiler();
// Compile a LaTeX document
PdfLatex pdfLatex = new PdfLatex(compiler, latexSource, images, listings);
if (pdfLatex.compile()) {
byte[] pdf = pdfLatex.getOutput();
}
// Compile a MetaPost figure
Metapost mp = new Metapost(compiler, mpSource);
if (mp.compile()) {
byte[] pdf = mp.getOutput();
}
// Compile a GNUPlot chart
GNUPlot gp = new GNUPlot(compiler, gpSource);
if (gp.compile()) {
byte[] pdf = gp.getOutput();
}
-
ClassDescriptionHolds the outcome of a compilation executed by a
Compiler.Describes a compilation job to be executed by aCompiler.Strategy interface for executing a compilation task.Facade for compiling GNUPlot scripts to cropped PDF charts.DefaultCompilerimplementation that executes commands locally in an isolated temporary directory.Facade for compiling MetaPost figures to cropped PDF.Facade for compiling LaTeX documents to PDF usingpdflatex.