ODA Plugin Project Structure / References / Deployment [message #47681] |
Thu, 24 July 2008 12:28 |
Eclipse User |
|
|
|
Originally posted by: birt.lewold.at
Hello Together,
I am in the process to implement an ODA datasource to access our legacy
data. Lots of these data are calculated using very complex formulas
taken from a database.
Calculation code already exists - it is in a "Standard Java Project"
called "datacalc". The project contains a central class called
DataCalculator.
What we try to achieve is to display calculation results using BIRT.
So our idea was:
-) We implement an ODA datasource (datacalc.oda and datacalc.oda.ui
projects)
-) The IQuery ("DataCalculatorQuery") implementation delegats to
"DataCalculator" for data access. (data are "quite" JDBC like).
Q1: Here we had our first problem: What's the proper way to access a
"plain Java Project" from a plugin project???? Do I really have to
export the project everytime it changes and refer to the JAR from the
plugin project? (at least that's what I did for now to be able to proceed)
This all works already, but I get totally stuck now when it comes
towards deployment. (Bear with me - I know java well, but am new to both
BIRT and to PDE. All this osgi stuff is very confusing to me).
I am stuck on the simple task to create a test project.
-) Our test project needs access to the java project "datacalc".
-) Further it references the datacalc.oda plugin project.
Q2: Next problems: the DTP classes (e.g. IConnection) are unresolved.
What is the preferred way to add them to the classpath?
Make the test project a plugin project? I really don't want to do that,
because our "real" project is a J2EE Web project, and I can't change
this one to a plugin.
-) Then we want to load our test report, and inject our instance of
"DataCalculator" into the query using "setAppContext".
Q3: Is this the way to go?
-) I read lots about problems with ClassLoaders etc.
Q4: Is there anything specific I have to be aware of in this area.
I really am impressed with the functionality both in the DTP and Birt area.
Just the stuff concerning "Classpathes, Classloaders, Birt Runtime
Environment, Plugin vs. Plain Java Projects" feels so completely
"unnatural" to me - it's really causing us big troubles (and I found no
nice guide for that, too ... maybe someone can has a hint for me on
where to start here).
Thanks a lot in advance for your help.
Chris
PS. I had troubles using my connection and the news reader. I hope this
message isn't posted multiple times.
|
|
|
Re: ODA Plugin Project Structure / References / Deployment [message #47806 is a reply to message #47681] |
Sat, 26 July 2008 02:06 |
Linda Chan Messages: 845 Registered: July 2009 |
Senior Member |
|
|
Chris,
These seem to be general PDE questions. The IDE help doc "Plug-in
Development Environment Guide" (see Help->Help Contents) has pretty good
info to start with.
By "standard Java project", do you mean your datacalc project is packaged in
a library jar file? It is a good practice to create a plug-in project to
*wrap* a library jar file, for use by other plugin projects. This way, you
don't need to make a copy of the library jar file to each of the plugin
projects that use it. And of course no need to change your existing project
packaging either.
Then specify in the manifest.mf of your datacalc.oda plugin (using the
plugin manifest editor's Dependencies tab to edit), its dependency on your
library jar wrapper plugin. This setup will let osgi take care of
resolving the classes and loading them as needed.
You can also create a plugin project to wrap your test library. Then
specify in its manifest.mf, the plugin dependencies on your datacalc.oda
plugin and all other dependencies For any packages in your datacalc.oda
plugin or other plugins that are accessed by your test code, you would want
to specifiy them in "Export-Package:" in the corresponding plugin
manifest.mf. (See the plugin manifest editor's Runtime tab.)
If your datacalc.oda plugin has specified dependencies on your
"DataCalculator" class library (or its wrapper plugin), there shouldn't be a
need to pass an instance of it thru the oda setAppContext method. Your test
case should be able to call the IQuery interface methods, whose
implementation in your datacalc.oda should then know to use your
"DataCalculator" classes.
You might want to take a look at the JUnit test cases for the DTP ODA
enablement data sources. They are in DTP CVS repository
(dev.eclipse.org:/cvsroot/datatools) under the
HEAD/org.eclipse.datatools.enablement/tests/ folder.
Linda
|
|
|
Re: ODA Plugin Project Structure / References / Deployment [message #47866 is a reply to message #47806] |
Sun, 27 July 2008 08:00 |
Eclipse User |
|
|
|
Originally posted by: birt.lewold.at
Hello Linda,
First of all thanks a lot for your help.
With "standard Java Project" I mean a project created by
"File->New->Java Project".
Our DataCalculator is implemented in such a project, and it is still
under development.
Of course I can always create a JAR file from this project and add this
JAR file as reference to the oda plugin project, but somehow this
doesn't feel "right" to me. (I have to recreate the JAR on every code
change etc.). That's why I thought this can't be the way to go.
I also checked the IDE help about this topic, but simply found nothing
(likely my fault - I check again).
Maybe you can give me a hint about the other question (I re-formulate it
as I likely didn't express myself well):
-) At runtime we have an already initialized Instance of DataCalculator
-) This class is part of our EAR file deployed into our JBoss (pretty
much standard).
-) We want to "inject" this concrete instance of DataCalculator into the
ODA Data Source associated with the Report right before the report is
used to create HTML/PDF/whatever.
The idea behind this is, that DataCalculator knows everything about our
data already, and we don't want to re-implement this logic within the
ODA plugin. Consequently our ODA plugin acts just as a kind of "bridge"
to BIRT using the data provided by DataCalculator.
a) Do you think this approach is the "way to go" ?
b) What is the preferred way to "inject" DataProvider ? (the class
basically is a POJO).
Again - thanks a lot for your hints,
Chris
|
|
|
Re: ODA Plugin Project Structure / References / Deployment [message #592269 is a reply to message #47681] |
Sat, 26 July 2008 02:06 |
Linda Chan Messages: 845 Registered: July 2009 |
Senior Member |
|
|
Chris,
These seem to be general PDE questions. The IDE help doc "Plug-in
Development Environment Guide" (see Help->Help Contents) has pretty good
info to start with.
By "standard Java project", do you mean your datacalc project is packaged in
a library jar file? It is a good practice to create a plug-in project to
*wrap* a library jar file, for use by other plugin projects. This way, you
don't need to make a copy of the library jar file to each of the plugin
projects that use it. And of course no need to change your existing project
packaging either.
Then specify in the manifest.mf of your datacalc.oda plugin (using the
plugin manifest editor's Dependencies tab to edit), its dependency on your
library jar wrapper plugin. This setup will let osgi take care of
resolving the classes and loading them as needed.
You can also create a plugin project to wrap your test library. Then
specify in its manifest.mf, the plugin dependencies on your datacalc.oda
plugin and all other dependencies For any packages in your datacalc.oda
plugin or other plugins that are accessed by your test code, you would want
to specifiy them in "Export-Package:" in the corresponding plugin
manifest.mf. (See the plugin manifest editor's Runtime tab.)
If your datacalc.oda plugin has specified dependencies on your
"DataCalculator" class library (or its wrapper plugin), there shouldn't be a
need to pass an instance of it thru the oda setAppContext method. Your test
case should be able to call the IQuery interface methods, whose
implementation in your datacalc.oda should then know to use your
"DataCalculator" classes.
You might want to take a look at the JUnit test cases for the DTP ODA
enablement data sources. They are in DTP CVS repository
(dev.eclipse.org:/cvsroot/datatools) under the
HEAD/org.eclipse.datatools.enablement/tests/ folder.
Linda
|
|
|
|
Powered by
FUDForum. Page generated in 0.06445 seconds