org.eclipse.birt.report.engine.api
Class ReportRunner

java.lang.Object
  extended by org.eclipse.birt.report.engine.api.ReportRunner

public class ReportRunner
extends java.lang.Object

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
protected  java.lang.String[] args
          the input paramters
protected  java.lang.String encoding
          the output encoding, used in html format in Render and RunAndRender modes.
protected  java.lang.String format
          the output format, used in Render and RunAndRender.
protected  java.lang.String htmlType
          used to decorate the HTML output, used in Render and RunAndRender mode.
protected  java.lang.String locale
          the output locale, used in Run and RunAndRender modes.
protected static java.util.logging.Logger logger
           
protected  java.lang.String mode
          execution mode, one of the Run, RunAndRender and Render.
protected  long pageNumber
          output page number, used in Render mode.
protected  java.util.HashMap params
          paramters used to execute the report, used in Run and RunAndRender modes.
protected  java.lang.String source
          the source input ,can be designName or reportArchive name
protected  java.lang.String targetFile
          The target file name
 
Constructor Summary
ReportRunner(java.lang.String[] args)
          Constructor of ReportRunner
 
Method Summary
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.
protected  EngineConfig createEngineConfig()
          new a EngineConfig and config it with user's setting
 int execute()
          Check if the arguments are valid.
static void main(java.lang.String[] args)
          Main function.
protected  void parseConfigurationOptions()
          paraser the config/paramter/renderoption command line inputs.
protected  void parseOptions()
          parse the arguments.
protected  void parseRenderOptions()
          Parse render options.
protected  void parseRunAndRenderOptions()
          Parse run and render options.
protected  void parseRunOptions()
          Parse running options.
protected  void printUsage()
          print out the command line usage.
protected  void readConfigurationFile(java.lang.String fileName, java.util.HashMap params)
          read Config-Parameter-Render file
protected  void readParamString(java.lang.String param, java.util.HashMap params)
          read paramters from the param and add it into the params.
protected  int renderReport()
          render the report.
protected  int runAndRenderReport()
          Execute the report design which includes:
1.
protected  int runReport()
          running the report to create the report document
protected  java.lang.Object stringToObject(int type, java.lang.String value)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected static java.util.logging.Logger logger

args

protected java.lang.String[] args
the input paramters


source

protected java.lang.String source
the source input ,can be designName or reportArchive name


targetFile

protected java.lang.String targetFile
The target file name


mode

protected java.lang.String mode
execution mode, one of the Run, RunAndRender and Render. the default mode is RunAndRender


locale

protected java.lang.String locale
the output locale, used in Run and RunAndRender modes.


format

protected java.lang.String format
the output format, used in Render and RunAndRender.


htmlType

protected java.lang.String htmlType
used to decorate the HTML output, used in Render and RunAndRender mode.


encoding

protected java.lang.String encoding
the output encoding, used in html format in Render and RunAndRender modes.


params

protected java.util.HashMap params
paramters used to execute the report, used in Run and RunAndRender modes.


pageNumber

protected long pageNumber
output page number, used in Render mode.

Constructor Detail

ReportRunner

public ReportRunner(java.lang.String[] args)
Constructor of ReportRunner

Parameters:
args - - application arguments
Method Detail

main

public static void main(java.lang.String[] args)
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.


printUsage

protected void printUsage()
print out the command line usage.


parseRunOptions

protected void parseRunOptions()
                        throws java.lang.Exception
Parse running options.

Throws:
java.lang.Exception

parseRenderOptions

protected void parseRenderOptions()
                           throws java.lang.Exception
Parse render options.

Throws:
java.lang.Exception

parseRunAndRenderOptions

protected void parseRunAndRenderOptions()
                                 throws java.lang.Exception
Parse run and render options.

Throws:
java.lang.Exception

parseOptions

protected void parseOptions()
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

protected void readParamString(java.lang.String param,
                               java.util.HashMap params)
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

protected void readConfigurationFile(java.lang.String fileName,
                                     java.util.HashMap params)
read Config-Parameter-Render file


stringToObject

protected java.lang.Object stringToObject(int type,
                                          java.lang.String value)
                                   throws org.eclipse.birt.core.exception.BirtException
Parameters:
p - the scalar parameter
expr - 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

protected EngineConfig createEngineConfig()
new a EngineConfig and config it with user's setting



Copyright © 2008 Actuate Corp. All rights reserved.