Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » Dependencies from the BIRT_HOME?
Dependencies from the BIRT_HOME? [message #539820] Sun, 13 June 2010 17:35 Go to next message
js Missing name is currently offline js Missing nameFriend
Messages: 73
Registered: July 2009
Member
I have this code which creates a ReportDesignHandle:

import java.util.logging.Level;
import org.eclipse.birt.core.framework.Platform;
import org.eclipse.birt.report.engine.api.EngineConfig;
import org.eclipse.birt.report.engine.api.IReportEngine;
import org.eclipse.birt.report.engine.api.IReportEngineFactory;
import org.eclipse.birt.report.model.api.DesignConfig;
import org.eclipse.birt.report.model.api.IDesignEngine;
import org.eclipse.birt.report.model.api.IDesignEngineFactory;
import org.eclipse.birt.report.model.api.ReportDesignHandle;
import org.eclipse.birt.report.model.api.SessionHandle;

import com.ibm.icu.util.ULocale;

public class BirtEngine {
private String engineDir;
private SessionHandle session;
private IReportEngine reportEngine;
private EngineConfig reportConfig;
private IDesignEngine designEngine;
private DesignConfig designConfig;
private ReportDesignHandle designHandle;

public BirtEngine(String engineDir) {
this.engineDir = engineDir;
}

public void startEngine() {
// Configure the Engine and start the Platform
designConfig = new DesignConfig();
reportConfig = new EngineConfig();
try {
// Design part.
designConfig.setProperty("BIRT_HOME", engineDir);
Platform.startup(designConfig);
IDesignEngineFactory designFactory = (IDesignEngineFactory) Platform
.createFactoryObject(IDesignEngineFactory.EXTENSION_DESIGN_E NGINE_FACTORY);
designEngine = designFactory.createDesignEngine(designConfig);
session = designEngine.newSessionHandle(ULocale.ENGLISH);

// Read design file.
designHandle = session.createDesign();

// Report part.
reportConfig.setEngineHome(engineDir);
reportConfig.setLogConfig(null, Level.FINE);
Platform.startup(reportConfig);
IReportEngineFactory factory = (IReportEngineFactory) Platform
.createFactoryObject(IReportEngineFactory.EXTENSION_REPORT_E NGINE_FACTORY);
reportEngine = factory.createReportEngine(reportConfig);
reportEngine.changeLogLevel(Level.WARNING);

} catch (Exception e) {
System.out.println("BIRT engine could not be started!");
e.printStackTrace();
}

Platform.shutdown();
}

public ReportDesignHandle getDesignHandle() {
return designHandle;
}

public static void main(String[] args) {
String dir = "C:\\birt-runtime-2_5_2_minimal\\ReportEngine";
BirtEngine engine = new BirtEngine(dir);
engine.startEngine();
ReportDesignHandle rr = engine.getDesignHandle();
if (rr == null) {
System.out.println("ERROR!!");

}
}
}






I can develop/compile the above code without specifying the BIRT_HOME
folder. Its only when the application is run that BIRT_HOME must point to a
folder containing the necessary runtime jar files.

I have tried to build (producing a fatjar) the above application with all
its dependencies (using maven and the maven-assembly-plugin) and specifying
the main class. But it still needs the path to the ReportEngine dir to work
:-(

Is it not possible to build a BIRT application with all its dependencies
including those needed at runtime (the necessary jars from the ReportEngine
directory)?
Re: Dependencies from the BIRT_HOME? [message #540909 is a reply to message #539820] Thu, 17 June 2010 15:07 Go to previous messageGo to next message
Scott Rosenbaum is currently offline Scott RosenbaumFriend
Messages: 425
Registered: July 2009
Senior Member
You are running into an issue that has to do with the fact that BIRT is running
on an OSGi framework. The Platform.startUp is where you are starting up
the OSGi framework. The BIRT platform.startup code is looking for BIRT_HOME,
so that it can find all of the required features/plugins that it needs to
run.

Is there a reason why you can't specify BIRT_HOME within your application?

Scott Rosenbaum

> Is it not possible to build a BIRT application with all its
> dependencies including those needed at runtime (the necessary jars
> from the ReportEngine directory)?
>
Re: Dependencies from the BIRT_HOME? [message #540939 is a reply to message #540909] Thu, 17 June 2010 15:32 Go to previous message
js Missing name is currently offline js Missing nameFriend
Messages: 73
Registered: July 2009
Member
"Scott Rosenbaum" <scottr@innoventsolutions.com> wrote in message
news:5926c50145b38ccdc1c0d3f35e0@news.eclipse.org...
> You are running into an issue that has to do with the fact that BIRT is
> running on an OSGi framework. The Platform.startUp is where you are
> starting up the OSGi framework. The BIRT platform.startup code is looking
> for BIRT_HOME, so that it can find all of the required features/plugins
> that it needs to run.

But some of them are already present in my jar file which is created when I
build my application so why can't it find those from this jar instead?


> Is there a reason why you can't specify BIRT_HOME within your application?

Not really I was just wondering why it is not possible to package (build
into a jar) a birt application including those jar/plugins from the runtime
library which are needed and then make the platform startup using the files
from this jar instead - hope it makes sense :-)


>
> Scott Rosenbaum
>
>> Is it not possible to build a BIRT application with all its
>> dependencies including those needed at runtime (the necessary jars
>> from the ReportEngine directory)?
>>
>
>
>
Previous Topic:Setting initial display size for a PDF report
Next Topic:Orientation Landscape
Goto Forum:
  


Current Time: Thu Apr 18 22:52:07 GMT 2024

Powered by FUDForum. Page generated in 0.03286 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top