public abstract class JRAbstractCompiler extends java.lang.Object implements JRCompiler
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
EXCEPTION_MESSAGE_KEY_CROSSTAB_ID_NOT_FOUND |
static java.lang.String |
EXCEPTION_MESSAGE_KEY_DESIGN_COMPILE_ERROR |
static java.lang.String |
EXCEPTION_MESSAGE_KEY_LANGUAGE_NOT_SUPPORTED |
static java.lang.String |
EXCEPTION_MESSAGE_KEY_REPORT_EXPRESSIONS_COMPILE_ERROR |
static java.lang.String |
EXCEPTION_MESSAGE_KEY_TEMP_DIR_NOT_FOUND |
protected JasperReportsContext |
jasperReportsContext |
COMPILER_CLASS, COMPILER_CLASSPATH, COMPILER_KEEP_JAVA_FILE, COMPILER_PREFIX, COMPILER_TEMP_DIR
Modifier | Constructor and Description |
---|---|
protected |
JRAbstractCompiler(boolean needsSourceFiles)
Deprecated.
Replaced by
JRAbstractCompiler(JasperReportsContext, boolean) . |
protected |
JRAbstractCompiler(JasperReportsContext jasperReportsContext,
boolean needsSourceFiles)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
protected abstract void |
checkLanguage(java.lang.String language)
Checks that the report language is supported by the compiler.
|
JasperReport |
compileReport(JasperDesign jasperDesign)
Compiles a report design.
|
protected abstract java.lang.String |
compileUnits(JRCompilationUnit[] units,
java.lang.String classpath,
java.io.File tempDirFile)
Compiles several expression evaluator units.
|
protected abstract JRCompilationSourceCode |
generateSourceCode(JRSourceCompileTask sourceTask)
Generates expression evaluator code.
|
protected java.lang.String |
getCompilerClass() |
protected java.io.File |
getSourceFile(java.io.File saveSourceDir,
java.lang.String unitName,
JRCompilationSourceCode sourceCode) |
protected abstract java.lang.String |
getSourceFileName(java.lang.String unitName)
Returns the name of the source file where generated source code for an unit is saved.
|
static java.lang.String |
getUnitName(JasperReport report,
JRCrosstab crosstab)
Returns the name of the expression evaluator unit for a crosstab of a report.
|
static java.lang.String |
getUnitName(JasperReport report,
JRDataset dataset)
Returns the name of the expression evaluator unit for a dataset of a report.
|
protected static java.lang.String |
getUnitName(JRReport report,
int crosstabId,
java.lang.String nameSuffix) |
protected static java.lang.String |
getUnitName(JRReport report,
JRCrosstab crosstab,
JRExpressionCollector expressionCollector,
java.lang.String nameSuffix) |
protected static java.lang.String |
getUnitName(JRReport report,
JRDataset dataset,
java.lang.String nameSuffix) |
JREvaluator |
loadEvaluator(JasperReport jasperReport)
Loads the evaluator for a report's main dataset.
|
JREvaluator |
loadEvaluator(JasperReport jasperReport,
JRCrosstab crosstab)
Loads a expression evaluator class for a crosstab of a report.
|
JREvaluator |
loadEvaluator(JasperReport jasperReport,
JRDataset dataset)
Loads a expression evaluator class for a dataset of a report.
|
protected abstract JREvaluator |
loadEvaluator(java.io.Serializable compileData,
java.lang.String unitName)
Creates an expression evaluator instance from data saved when the report was compiled.
|
public static final java.lang.String EXCEPTION_MESSAGE_KEY_CROSSTAB_ID_NOT_FOUND
public static final java.lang.String EXCEPTION_MESSAGE_KEY_DESIGN_COMPILE_ERROR
public static final java.lang.String EXCEPTION_MESSAGE_KEY_LANGUAGE_NOT_SUPPORTED
public static final java.lang.String EXCEPTION_MESSAGE_KEY_REPORT_EXPRESSIONS_COMPILE_ERROR
public static final java.lang.String EXCEPTION_MESSAGE_KEY_TEMP_DIR_NOT_FOUND
protected final JasperReportsContext jasperReportsContext
protected JRAbstractCompiler(JasperReportsContext jasperReportsContext, boolean needsSourceFiles)
needsSourceFiles
- whether the compiler needs source files or is able to do in memory compilation
If true, the generated code is saved in source files to be used by the compiler.
protected JRAbstractCompiler(boolean needsSourceFiles)
JRAbstractCompiler(JasperReportsContext, boolean)
.public static java.lang.String getUnitName(JasperReport report, JRDataset dataset)
report
- the reportdataset
- the datasetprotected static java.lang.String getUnitName(JRReport report, JRDataset dataset, java.lang.String nameSuffix)
public static java.lang.String getUnitName(JasperReport report, JRCrosstab crosstab)
report
- the reportcrosstab
- the crosstabprotected static java.lang.String getUnitName(JRReport report, JRCrosstab crosstab, JRExpressionCollector expressionCollector, java.lang.String nameSuffix)
protected static java.lang.String getUnitName(JRReport report, int crosstabId, java.lang.String nameSuffix)
public final JasperReport compileReport(JasperDesign jasperDesign) throws JRException
JRCompiler
The compilation consists of verification of the design, generation of expression evaluators and construction of a serializable read-only version of the report.
A report compiler should usually extend JRAbstractCompiler
.
compileReport
in interface JRCompiler
jasperDesign
- the report designJRException
protected java.lang.String getCompilerClass()
protected java.io.File getSourceFile(java.io.File saveSourceDir, java.lang.String unitName, JRCompilationSourceCode sourceCode)
public JREvaluator loadEvaluator(JasperReport jasperReport) throws JRException
JRCompiler
loadEvaluator
in interface JRCompiler
jasperReport
- the reportJRException
public JREvaluator loadEvaluator(JasperReport jasperReport, JRDataset dataset) throws JRException
JRCompiler
loadEvaluator
in interface JRCompiler
jasperReport
- the reportdataset
- the datasetJRException
public JREvaluator loadEvaluator(JasperReport jasperReport, JRCrosstab crosstab) throws JRException
JRCompiler
loadEvaluator
in interface JRCompiler
jasperReport
- the reportcrosstab
- the crosstabJRException
protected abstract JREvaluator loadEvaluator(java.io.Serializable compileData, java.lang.String unitName) throws JRException
compileData
- the data saved when the report was compiledunitName
- the evaluator unit nameJRException
protected abstract void checkLanguage(java.lang.String language) throws JRException
language
- the report languageJRException
protected abstract JRCompilationSourceCode generateSourceCode(JRSourceCompileTask sourceTask) throws JRException
sourceTask
- the source code generation informationJRException
protected abstract java.lang.String compileUnits(JRCompilationUnit[] units, java.lang.String classpath, java.io.File tempDirFile) throws JRException
The result of the compilation should be set by calling
setCompileData
on all compile units.
units
- the compilation unitsclasspath
- the compilation classpathtempDirFile
- temporary directoryJRException
protected abstract java.lang.String getSourceFileName(java.lang.String unitName)
If the compiler needs source files for compilation
or COMPILER_KEEP_JAVA_FILE
is set, the generated source
will be saved in a file having the name returned by this method.
unitName
- the unit name© 2001-2014 TIBCO Software Inc. www.jaspersoft.com