parse(options, args);
catch (Exception e) {
System.err.println("Parsing failed. Reason: " + e.getMessage());
Chapter 11
[ 265 ]
formatter.printHelp("ReportExecutor", options);
System.exit(-1);
}
return line;
}
/**
* startupPlatform
*
* This will startup the Eclipse platform and load any plugins
*/
private void startupPlatform()
{
//Initialize the Eclipse platform, plug-ins, and Report Engine
PlatformConfig platformConfig = new PlatformConfig();
platformConfig.setBIRTHome(BIRT_HOME);
try {
Platform.startup(platformConfig);
catch (BirtException e) {
e.printStackTrace();
//We cannot start the platform, exit
System.exit(-1);
}
}
/**
* createReportEngine
*
* This will create a report engine to use
* @return
*/
private IReportEngine createReportEngine()
{
//Create a new report engine factory
IReportEngineFactory factory = (IReportEngineFactory) Platform.createF
actoryObject(IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY);
//create a new report engine
EngineConfig engineConfig = new EngineConfig();
engineConfig.setBIRTHome("C:/BIRT_RUNTIME_2_2/birt-runtime-2_2_0/
ReportEngine"); //will replace with configuration file
return factory.createReportEngine(engineConfig);
}
/**
* Executes a report with no parameters, only requires report name to
execute
* @param reportName
* @return
Deployment
[ 266 ]
*/
public void executeReportNoParams(String reportName, String
outputFile, IReportEngine engine)
{
try {
//Create the report runnable and runandrender task
IReportRunnable runnable = engine.
Pages:
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216