Class ReportRunner
java.lang.Object
org.eclipse.birt.report.engine.api.ReportRunner
Defines a standalone reporting application that uses
StandaloneReportEngine
class. This application allows running a
report to output in one or multiple formats.
Report parameters are handled as command line parameters. Currently, only scalar parameters are handled.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected String[]
the input paramtersprotected String
the output encoding, used in html format in Render and RunAndRender modes.protected String
the output format, used in Render and RunAndRender.protected String
used to decorate the HTML output, used in Render and RunAndRender mode.protected String
the output locale, used in Run and RunAndRender modes.protected static Logger
protected String
execution mode, one of the Run, RunAndRender and Render.protected long
output page number, used in Render mode.protected HashMap
paramters used to execute the report, used in Run and RunAndRender modes.protected String
the source input ,can be designName or reportArchive nameprotected String
The target file name -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
If -o (targetFile) is not specified, assume same directory as inputfile, and inputfile.*** as output file name (where *** is the output format.protected EngineConfig
new a EngineConfig and config it with user's settingint
execute()
Check if the arguments are valid.static void
Main function.protected void
paraser the config/paramter/renderoption command line inputs.protected int
protected void
parse the arguments.protected void
Parse render options.protected void
Parse run and render options.protected void
Parse running options.protected void
protected void
protected void
print out the command line usage.protected void
protected void
protected void
protected void
protected void
readConfigurationFile
(String fileName, HashMap params) read Config-Parameter-Render fileprotected void
readParamString
(String param, HashMap params) read paramters from the param and add it into the params.protected int
render the report.protected int
Execute the report design which includes:
1.protected int
running the report to create the report documentprotected Object
stringToObject
(int type, String value)
-
Field Details
-
logger
-
args
the input paramters -
source
the source input ,can be designName or reportArchive name -
targetFile
The target file name -
mode
execution mode, one of the Run, RunAndRender and Render. the default mode is RunAndRender -
locale
the output locale, used in Run and RunAndRender modes. -
format
the output format, used in Render and RunAndRender. -
htmlType
used to decorate the HTML output, used in Render and RunAndRender mode. -
encoding
the output encoding, used in html format in Render and RunAndRender modes. -
params
paramters used to execute the report, used in Run and RunAndRender modes. -
pageNumber
protected long pageNumberoutput page number, used in Render mode.
-
-
Constructor Details
-
ReportRunner
Constructor of ReportRunner- Parameters:
args
- - application arguments
-
-
Method Details
-
main
Main function.- Parameters:
args
- - application argumetns.
-
execute
public int execute()Check if the arguments are valid. If yes, continue to execuate the report. If no, simply return. -
runAndRenderReport
protected int runAndRenderReport()Execute the report design which includes:
1. Read the input design and create the task.
2. Set report render options (including format, locale, output file name etc).
3. Run the task. -
runReport
protected int runReport()running the report to create the report document -
renderReport
protected int renderReport()render the report. -
printGeneralUsage
protected void printGeneralUsage()print out the command line usage. -
printRunUsage
protected void printRunUsage() -
printRenderUsage
protected void printRenderUsage() -
printRunRenderUsage
protected void printRunRenderUsage() -
printConfigUsage
protected void printConfigUsage() -
printRenderOptionUsage
protected void printRenderOptionUsage() -
printFileUsage
protected void printFileUsage() -
parseRunOptions
Parse running options.- Throws:
Exception
-
parseRenderOptions
Parse render options.- Throws:
Exception
-
parseRunAndRenderOptions
Parse run and render options.- Throws:
Exception
-
parseHelpOptions
protected int parseHelpOptions()- Returns:
- 1 if this command is for help information; 0 if it's normal
-
parseNormalOptions
protected void parseNormalOptions()parse the arguments. -html html-file-name -pdf pdf-file-name -fo fo-file-name -l locale-name -p page-number design-file-name- Parameters:
args
- - arguments
-
readParamString
read paramters from the param and add it into the params.- Parameters:
param
- parameter string line. use '=' to separate the name and value.params
- maps contains all the paramter name and value.
-
parseConfigurationOptions
protected void parseConfigurationOptions()paraser the config/paramter/renderoption command line inputs. -
readConfigurationFile
read Config-Parameter-Render file -
stringToObject
protected Object stringToObject(int type, String value) throws org.eclipse.birt.core.exception.BirtException - Parameters:
p
- the scalar parameterexpr
- the default value expression- Throws:
org.eclipse.birt.core.exception.BirtException
-
checkTargetFileName
protected void checkTargetFileName()If -o (targetFile) is not specified, assume same directory as inputfile, and inputfile.*** as output file name (where *** is the output format. If -o specifies a directory, assume the file name is the same as inputfile.***. If -o specifies a file, it has a path part and a filename part. Take the path as the directory to store the file and other resources (for example image). -
createEngineConfig
new a EngineConfig and config it with user's setting
-