本文整理汇总了Java中org.eclipse.birt.report.engine.api.EngineConfig类的典型用法代码示例。如果您正苦于以下问题:Java EngineConfig类的具体用法?Java EngineConfig怎么用?Java EngineConfig使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
EngineConfig类属于org.eclipse.birt.report.engine.api包,在下文中一共展示了EngineConfig类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: init
import org.eclipse.birt.report.engine.api.EngineConfig; //导入依赖的package包/类
@PostConstruct
public void init() {
EngineConfig engineConfig = new EngineConfig();
engineConfig.setLogConfig("logs", Level.WARNING);
try {
Platform.startup(engineConfig);
} catch(Exception e) {
logger.error("Birt platform startup error", e);
System.exit(2);
}
IReportEngineFactory factory =
(IReportEngineFactory) Platform.createFactoryObject(IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY);
reportEngine = factory.createReportEngine(engineConfig);
}
示例2: getObject
import org.eclipse.birt.report.engine.api.EngineConfig; //导入依赖的package包/类
@Override
public IReportEngine getObject() throws Exception {
try {
EngineConfig config = getEngineConfig();
Platform.startup(config);
IReportEngineFactory factory = (IReportEngineFactory) Platform
.createFactoryObject(
IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY);
birtEngine = factory.createReportEngine(config);
return birtEngine;
} catch (BirtException be) {
throw new BirtSystemException("Failed to start birt engine.", be);
}
}
示例3: loadOption
import org.eclipse.birt.report.engine.api.EngineConfig; //导入依赖的package包/类
protected void loadOption( IReportEngine engine )
{
if ( engine != null )
{
EngineConfig config = engine.getConfig( );
if ( config != null )
{
Object locator = config.getResourceLocator( );
if ( locator != null )
{
options.put( ModuleOption.RESOURCE_LOCATOR_KEY, locator );
}
Object resourcePath = config.getResourcePath( );
if ( resourcePath != null )
{
options
.put( ModuleOption.RESOURCE_FOLDER_KEY,
resourcePath );
}
}
}
}
示例4: ReportEngine
import org.eclipse.birt.report.engine.api.EngineConfig; //导入依赖的package包/类
/**
* Create a Report Engine using a configuration.
*
* The user must set the BIRT_HOME in the EngineConfig.
*
* @param config
* an engine configuration object used to configure the engine
*/
public ReportEngine( EngineConfig config )
{
if ( config == null )
{
throw new NullPointerException( "config is null" );
}
this.config = config;
beans = new HashMap<String, Object>( );
mergeConfigToAppContext( );
intializeLogger( );
logger.log( Level.FINE, "ReportEngine created. EngineConfig: {0} ",
config );
this.helper = new ReportEngineHelper( this );
openedDocuments = new LinkedObjectManager<ReportDocumentReader>( );
IStatusHandler handler = config.getStatusHandler( );
if ( handler != null )
{
handler.initialize( );
}
registerCustomFontConfig( );
}
示例5: TemplateExecutor
import org.eclipse.birt.report.engine.api.EngineConfig; //导入依赖的package包/类
public TemplateExecutor( ExecutionContext context )
{
this.context = context;
String tmpDir = null;
if ( context != null )
{
IReportEngine engine = context.getEngine( );
if ( engine != null )
{
EngineConfig config = engine.getConfig( );
if ( config != null )
{
tmpDir = config.getTempDir( );
}
}
}
if ( tmpDir == null )
{
tmpDir = FileUtil.getJavaTmpDir( );
}
if ( tmpDir == null )
{
tmpDir = ".";
}
imageFolder = new File( tmpDir );
}
示例6: createReportEngine
import org.eclipse.birt.report.engine.api.EngineConfig; //导入依赖的package包/类
public IReportEngine createReportEngine( )
{
EngineConfig config = new EngineConfig( );
HashMap map = new HashMap( );
File jar = new File( JAR );
map.put( EngineConstants.PROJECT_CLASSPATH_KEY, jar.getAbsolutePath( ));
config.setAppContext( map );
// assume we has in the platform
Object factory = Platform
.createFactoryObject( IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY );
if ( factory instanceof IReportEngineFactory )
{
return ( (IReportEngineFactory) factory )
.createReportEngine( config );
}
return null;
}
示例7: getEngineConfig
import org.eclipse.birt.report.engine.api.EngineConfig; //导入依赖的package包/类
private EngineConfig getEngineConfig( ModuleHandle handle )
{
EngineConfig ec = new EngineConfig( );
ClassLoader parent = Thread.currentThread( ).getContextClassLoader( );
if ( parent == null )
{
parent = this.getClass( ).getClassLoader( );
}
ClassLoader customClassLoader = DataSetProvider.getCustomScriptClassLoader( parent, handle );
// "customerClassLoader" should not be set into engine appContext, which results in using wrong
// classLoader later in JavascriptEvalUtil class. Comment the following lines can make data
// preview work correctly.
// ec.getAppContext( ).put( EngineConstants.APPCONTEXT_CLASSLOADER_KEY,
// customClassLoader );
return ec;
}
示例8: open
import org.eclipse.birt.report.engine.api.EngineConfig; //导入依赖的package包/类
public void open( Map appContext, EngineConfig config ) throws BirtException
{
engine = createReportEngine( config );
if ( mode == PreviewType.RESULTSET )
{
task = engine.createDatasetPreviewTask( );
}
else
{
task = new OutParameterPreviewTask( (ReportEngine) engine );
}
task.setMaxRow( maxRow );
task.setDataSet( dataSetHandle );
task.setAppContext( appContext );
ReportParameterUtil.completeParamDefalutValues( task, dataSetHandle.getModuleHandle( ) );
}
示例9: getObject
import org.eclipse.birt.report.engine.api.EngineConfig; //导入依赖的package包/类
public IReportEngine getObject() {
EngineConfig config = new EngineConfig();
//This line injects the Spring Context into the BIRT Context
config.getAppContext().put("spring", this.context);
config.setLogConfig(null != this._resolvedDirectory ? this._resolvedDirectory.getAbsolutePath() : null, this.logLevel);
try {
Platform.startup(config);
} catch (BirtException e) {
throw new RuntimeException("Could not start the Birt engine!", e);
}
IReportEngineFactory factory = (IReportEngineFactory) Platform.createFactoryObject(IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY);
IReportEngine be = factory.createReportEngine(config);
this.birtEngine = be;
return be;
}
示例10: startBirtEngine
import org.eclipse.birt.report.engine.api.EngineConfig; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public static synchronized void startBirtEngine(IPlatformContext context)
{
log.info("Starting BIRT Engine and OSGI Platform using: " + context.getClass().getName());
HTMLServerImageHandler imageHandler = new HTMLServerImageHandler();
HTMLRenderOption emitterConfig = new HTMLRenderOption();
emitterConfig.setActionHandler(new HTMLActionHandler());
emitterConfig.setImageHandler(imageHandler);
EngineConfig config = new EngineConfig();
config.setEngineHome("");
config.setPlatformContext(context);
config.setLogConfig(null, Level.ALL);
config.getEmitterConfigs().put("html", emitterConfig);
try
{
Platform.startup(config);
}
catch (BirtException e)
{
log.error("BirtException", e);
}
IReportEngineFactory factory = (IReportEngineFactory) Platform
.createFactoryObject(IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY);
birtEngine = factory.createReportEngine(config);
log.info("BIRT Engine Started");
birtEngine.changeLogLevel(Level.SEVERE);
}
示例11: getEngineConfig
import org.eclipse.birt.report.engine.api.EngineConfig; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private EngineConfig getEngineConfig() {
EngineConfig config = new EngineConfig();
config.setTempDir(env.getProperty("java.io.tmpdir"));
config.getAppContext().put(SPRING_KEY, this.applicationContext);
// config.setLogConfig(".", Level.ALL);
config.setLogger(logger);
return config;
}
示例12: getEngine
import org.eclipse.birt.report.engine.api.EngineConfig; //导入依赖的package包/类
protected IReportEngine getEngine( )
{
if ( engine == null )
{
try
{
EngineConfig config = new EngineConfig( );
// config.setEngineHome( getReportEngineHome( ) );
// Platform.startup( config );
// IReportEngineFactory factory = (IReportEngineFactory)
// Platform.createFactoryObject(
// IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY );
// engine = factory.createReportEngine( config );
engine = new ReportEngine( config );
engine.changeLogLevel( Level.WARNING );
HTMLEmitterConfig hc = new HTMLEmitterConfig( );
HTMLCompleteImageHandler imageHandler = new HTMLCompleteImageHandler( );
hc.setImageHandler( imageHandler );
config.setEmitterConfiguration( HTML_FORMAT, hc );
}
catch ( Exception ex )
{
}
}
return engine;
}
示例13: testIEmitterServices
import org.eclipse.birt.report.engine.api.EngineConfig; //导入依赖的package包/类
/**
* Test IEmitterServices methods.
*
* @throws BirtException
*/
public void testIEmitterServices( ) throws BirtException
{
EngineConfig config = new EngineConfig( );
emitterConfig = new HTMLEmitterConfig( );
config.setEmitterConfiguration( EMITTER_HTML, emitterConfig );
emitterConfig = config.getEmitterConfigs( ).get( EMITTER_HTML );
Platform.startup( config );
IReportEngineFactory factory = (IReportEngineFactory) Platform
.createFactoryObject( IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY );
IReportEngine reportEngine = factory.createReportEngine( config );
IReportRunnable reportRunnable = engine.openReportDesign( this
.genInputFile( report ) );
IRenderOption options = new HTMLRenderOption( );
options.setOutputFormat( EMITTER_HTML );
options.setOutputFileName( this.genOutputFile( "myService.html" ) );
HTMLRenderContext renderContext = new HTMLRenderContext( );
renderContext.setImageDirectory( "myImage" ); //$NON-NLS-1$
HashMap appContext = new HashMap( );
appContext.put(
EngineConstants.APPCONTEXT_HTML_RENDER_CONTEXT,
renderContext );
appContext.put( "emitter_class", this );
IRunAndRenderTask rrTask = reportEngine
.createRunAndRenderTask( reportRunnable );
rrTask.setRenderOption( options );
rrTask.setAppContext( appContext );
rrTask.run( );
rrTask.close( );
}
示例14: testGetConfig
import org.eclipse.birt.report.engine.api.EngineConfig; //导入依赖的package包/类
/**
* Test getConfig() method
*/
public void testGetConfig( )
{
EngineConfig config = new EngineConfig( );
config.setTempDir( "tempdir" );
ReportEngine engine = new ReportEngine( config );
EngineConfig configGet = engine.getConfig( );
assertEquals( "getConfig() fail", config.getTempDir( ), configGet
.getTempDir( ) );
}
示例15: testOpenReportDesign
import org.eclipse.birt.report.engine.api.EngineConfig; //导入依赖的package包/类
/**
* Test openReportDesign(string)
*
* @throws EngineException
*/
public void testOpenReportDesign( ) throws EngineException
{
EngineConfig config = new EngineConfig( );
IReportRunnable reportRunner;
config.setTempDir( "tempdir" );
ReportEngine engine = new ReportEngine( config );
/*
* String input =
* PLUGIN_PATH+System.getProperty("file.separator")+RESOURCE_BUNDLE
* .getString("CASE_INPUT"); input +=
* System.getProperty("file.separator") ; String
* designName=input+"report_engine.rptdesign";
*/
String designName = this.genInputFile( "report_engine.rptdesign" );
try
{
reportRunner = engine.openReportDesign( designName );
designName = "file:" + designName;
designName = designName.replace( '/', '\\' );
String reportName = reportRunner.getReportName( ).replace(
'/',
'\\' );
assertEquals( "openReportDesign(String) fail", designName
.substring( designName.indexOf( "org" ), designName
.length( ) ), reportName.substring( reportName
.indexOf( "org" ), reportName.length( ) ) );
assertNotNull( "openReportDesign(String) fail", reportRunner
.getImage( "23.gif" ) );
}
catch ( EngineException ee )
{
ee.printStackTrace( );
fail( "openReportDesign(String) fail" );
}
engine.destroy( );
}