Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » EMF ODA DataSource, Report Viewer and Classloader Problems
EMF ODA DataSource, Report Viewer and Classloader Problems [message #764723] Mon, 12 December 2011 18:46 Go to next message
Eclipse UserFriend
Have been working to migrate from the old ECore ODA driver to the new one.
(For a wiki description of the two Drivers, see:
http://wiki.eclipse.org/Ecore_ODA_Driver)

On the new Driver the biggest problem we are having for BIRT Report
Designers:
Prior to using the NEW driver and BIRT to run a report on EMF models,
the driver and all EMF models associated with the report must be added
to the Preference > Report Design > Classpath.
(aka "org.eclipse.birt.report.designer.ui.preferences.classpath")

This configuration is only necessary for running a report in the
ReportViewer. The report design editor preview works fine without the
classpath configured.

The current configuration effort of finding the correct location of the
jar containing the driver and the all the model jars in the plugins
directory of the installation is too tedious and error prone for our end
users. Especially when a p2 update may change the plugins and require a
manual reconfiguration.

I reported this as bug:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=359306

Have considered searching for EMF registered packages and filling in
the "org.eclipse.birt.report.designer.ui.preferences.classpath"
preference on startup, but I don't think this is the right approach.

Alternatively from within the new driver itself, I have tried using
setThreadContextClassLoader=true
and setting up an classloader as was done in the HibernateUtil, but have
not met with success.

What other options do we have?

thanks for any tips on fixing our new EMF Driver,

John
Re: EMF ODA DataSource, Report Viewer and Classloader Problems [message #764808 is a reply to message #764723] Mon, 12 December 2011 22:13 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

John,

How are you searching for registered EMF packages? When I did the hibernate oda I added a directory to the classpath.
Are you using the code that is available from http://wiki.eclipse.org/Ecore_ODA_Driver or do you use a modified version of this?

Jason
Re: EMF ODA DataSource, Report Viewer and Classloader Problems [message #764876 is a reply to message #764808] Tue, 13 December 2011 02:14 Go to previous messageGo to next message
Eclipse UserFriend
Hi Jason,

On 12/12/2011 04:13 PM, Jason Weathersby wrote:
> John,
>
> How are you searching for registered EMF packages?

First attempt was to just iterate through the EPackage.Registry like this.

EPackage.Registry reg = EPackage.Registry.INSTANCE;
for (String key : reg.keySet()) {
Object o = reg.getEPackage(key);
logger.info(bundleMarker,
"{}: Found Package key {} ",
this, key);
logger.info(bundleMarker,
"{}: Found Package object {} ",
this, o); }
}


When I did the
> hibernate oda I added a directory to the classpath.

From what I saw it looks like you have
setThreadContextClassLoader=true
and then built a ClassLoader and filled it up with URLs you create from the
HibernateUtil.refreshURLs()

I tried something similar, adding a new ClassLoader during the
Connection.open(Properties connProperties) method, but not with all the
EMF packages - just with the two I needed to confirm that the
classloader was being called and at least finding the classes. It wasn't.

Funny thing is that one of the classes it can not find is the driver
itself. Put that on the classpath along with the model jar and it
works. Again it's a hassle telling the users how to set this up.

> Are you using the code that is available from
> http://wiki.eclipse.org/Ecore_ODA_Driver or do you use a modified
> version of this?

Yes, I am using the new Driver that is packaged in the features:
org.eclipse.emf.oda-feature
org.eclipse.emf.oda.ecore-feature
org.eclipse.emf.oda.ecore.ui-feature

And have been experimenting changing it to see if I can set the
classpath or a loader from with the driver. I have also explored during
the Driver.setAppContext(Object context) method attaching another
classloader in the to the AppContext's "PARENT_CLASSLOADER" and have
tried setting the classpath in AppContext's
"webapplication.projectclasspath".
No luck so far.

Have also tried the approach of adding to the user preference Report
Design | Classpath from an external bundle at startup. I can get this
to work, (I could also kludge it by copying jars to the birt/scriptlib
in the report.designer working directory, but I think a better way would
be to fix this in the org.eclipse.emf.oda driver and submit a patch, to bug:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=359306
so the new Driver will be more well behaved and of course others can
benefit from it as well.

thanks,
John
Re: EMF ODA DataSource, Report Viewer and Classloader Problems [message #765227 is a reply to message #764876] Tue, 13 December 2011 16:57 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

John,

Do you have a simple model that I can test with? I think the best
approach would be to add a class loader to pick up EMF packages
automatically.

Jason

On 12/12/2011 9:14 PM, John E. Conlon wrote:
> Hi Jason,
>
> On 12/12/2011 04:13 PM, Jason Weathersby wrote:
>> John,
>>
>> How are you searching for registered EMF packages?
>
> First attempt was to just iterate through the EPackage.Registry like this.
>
> EPackage.Registry reg = EPackage.Registry.INSTANCE;
> for (String key : reg.keySet()) {
> Object o = reg.getEPackage(key);
> logger.info(bundleMarker,
> "{}: Found Package key {} ",
> this, key);
> logger.info(bundleMarker,
> "{}: Found Package object {} ",
> this, o); }
> }
>
>
> When I did the
>> hibernate oda I added a directory to the classpath.
>
> From what I saw it looks like you have
> setThreadContextClassLoader=true
> and then built a ClassLoader and filled it up with URLs you create from the
> HibernateUtil.refreshURLs()
>
> I tried something similar, adding a new ClassLoader during the
> Connection.open(Properties connProperties) method, but not with all the
> EMF packages - just with the two I needed to confirm that the
> classloader was being called and at least finding the classes. It wasn't.
>
> Funny thing is that one of the classes it can not find is the driver
> itself. Put that on the classpath along with the model jar and it works.
> Again it's a hassle telling the users how to set this up.
>
>> Are you using the code that is available from
>> http://wiki.eclipse.org/Ecore_ODA_Driver or do you use a modified
>> version of this?
>
> Yes, I am using the new Driver that is packaged in the features:
> org.eclipse.emf.oda-feature
> org.eclipse.emf.oda.ecore-feature
> org.eclipse.emf.oda.ecore.ui-feature
>
> And have been experimenting changing it to see if I can set the
> classpath or a loader from with the driver. I have also explored during
> the Driver.setAppContext(Object context) method attaching another
> classloader in the to the AppContext's "PARENT_CLASSLOADER" and have
> tried setting the classpath in AppContext's
> "webapplication.projectclasspath".
> No luck so far.
>
> Have also tried the approach of adding to the user preference Report
> Design | Classpath from an external bundle at startup. I can get this to
> work, (I could also kludge it by copying jars to the birt/scriptlib in
> the report.designer working directory, but I think a better way would be
> to fix this in the org.eclipse.emf.oda driver and submit a patch, to bug:
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=359306
> so the new Driver will be more well behaved and of course others can
> benefit from it as well.
>
> thanks,
> John
>
>
>
Re: EMF ODA DataSource, Report Viewer and Classloader Problems [message #765464 is a reply to message #765227] Wed, 14 December 2011 05:47 Go to previous messageGo to next message
Eclipse UserFriend
Jason,

See inline comments

On 12/13/2011 10:57 AM, Jason Weathersby wrote:
> John,
>
> Do you have a simple model that I can test with?
Once EMF is installed, the easiest way to get a sample EMF model, the
edit and the editor plugins is to:

New | Examples | Eclipse Modeling Framework | Extended Library Model
Example.


Then launch an Eclipse Application containing these plugins. From the
launched application (Sorry could not find an instance of the model
already with sample data, so ) you will need to create an instance of
the model in order to report on it. Create a project and then

New | Example EMF Model Creation Wizards | EXTLibrary Model

I think the best
> approach would be to add a class loader to pick up EMF packages
> automatically.

I agree!

John

>
> Jason
>
> On 12/12/2011 9:14 PM, John E. Conlon wrote:
>> Hi Jason,
>>
>> On 12/12/2011 04:13 PM, Jason Weathersby wrote:
>>> John,
>>>
>>> How are you searching for registered EMF packages?
>>
>> First attempt was to just iterate through the EPackage.Registry like
>> this.
>>
>> EPackage.Registry reg = EPackage.Registry.INSTANCE;
>> for (String key : reg.keySet()) {
>> Object o = reg.getEPackage(key);
>> logger.info(bundleMarker,
>> "{}: Found Package key {} ",
>> this, key);
>> logger.info(bundleMarker,
>> "{}: Found Package object {} ",
>> this, o); }
>> }
>>
>>
>> When I did the
>>> hibernate oda I added a directory to the classpath.
>>
>> From what I saw it looks like you have
>> setThreadContextClassLoader=true
>> and then built a ClassLoader and filled it up with URLs you create
>> from the
>> HibernateUtil.refreshURLs()
>>
>> I tried something similar, adding a new ClassLoader during the
>> Connection.open(Properties connProperties) method, but not with all the
>> EMF packages - just with the two I needed to confirm that the
>> classloader was being called and at least finding the classes. It wasn't.
>>
>> Funny thing is that one of the classes it can not find is the driver
>> itself. Put that on the classpath along with the model jar and it works.
>> Again it's a hassle telling the users how to set this up.
>>
>>> Are you using the code that is available from
>>> http://wiki.eclipse.org/Ecore_ODA_Driver or do you use a modified
>>> version of this?
>>
>> Yes, I am using the new Driver that is packaged in the features:
>> org.eclipse.emf.oda-feature
>> org.eclipse.emf.oda.ecore-feature
>> org.eclipse.emf.oda.ecore.ui-feature
>>
>> And have been experimenting changing it to see if I can set the
>> classpath or a loader from with the driver. I have also explored during
>> the Driver.setAppContext(Object context) method attaching another
>> classloader in the to the AppContext's "PARENT_CLASSLOADER" and have
>> tried setting the classpath in AppContext's
>> "webapplication.projectclasspath".
>> No luck so far.
>>
>> Have also tried the approach of adding to the user preference Report
>> Design | Classpath from an external bundle at startup. I can get this to
>> work, (I could also kludge it by copying jars to the birt/scriptlib in
>> the report.designer working directory, but I think a better way would be
>> to fix this in the org.eclipse.emf.oda driver and submit a patch, to bug:
>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=359306
>> so the new Driver will be more well behaved and of course others can
>> benefit from it as well.
>>
>> thanks,
>> John
>>
>>
>>
>
Re: EMF ODA DataSource, Report Viewer and Classloader Problems [message #765778 is a reply to message #765464] Wed, 14 December 2011 16:58 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

John,

I will look at this but it will probably be next week before I can.
Have you logged a bugzilla entry yet?

Jason

On 12/14/2011 12:47 AM, John E. Conlon wrote:
> Jason,
>
> See inline comments
>
> On 12/13/2011 10:57 AM, Jason Weathersby wrote:
>> John,
>>
>> Do you have a simple model that I can test with?
> Once EMF is installed, the easiest way to get a sample EMF model, the
> edit and the editor plugins is to:
>
> New | Examples | Eclipse Modeling Framework | Extended Library Model
> Example.
>
>
> Then launch an Eclipse Application containing these plugins. From the
> launched application (Sorry could not find an instance of the model
> already with sample data, so ) you will need to create an instance of
> the model in order to report on it. Create a project and then
>
> New | Example EMF Model Creation Wizards | EXTLibrary Model
>
> I think the best
>> approach would be to add a class loader to pick up EMF packages
>> automatically.
>
> I agree!
>
> John
>
>>
>> Jason
>>
>> On 12/12/2011 9:14 PM, John E. Conlon wrote:
>>> Hi Jason,
>>>
>>> On 12/12/2011 04:13 PM, Jason Weathersby wrote:
>>>> John,
>>>>
>>>> How are you searching for registered EMF packages?
>>>
>>> First attempt was to just iterate through the EPackage.Registry like
>>> this.
>>>
>>> EPackage.Registry reg = EPackage.Registry.INSTANCE;
>>> for (String key : reg.keySet()) {
>>> Object o = reg.getEPackage(key);
>>> logger.info(bundleMarker,
>>> "{}: Found Package key {} ",
>>> this, key);
>>> logger.info(bundleMarker,
>>> "{}: Found Package object {} ",
>>> this, o); }
>>> }
>>>
>>>
>>> When I did the
>>>> hibernate oda I added a directory to the classpath.
>>>
>>> From what I saw it looks like you have
>>> setThreadContextClassLoader=true
>>> and then built a ClassLoader and filled it up with URLs you create
>>> from the
>>> HibernateUtil.refreshURLs()
>>>
>>> I tried something similar, adding a new ClassLoader during the
>>> Connection.open(Properties connProperties) method, but not with all the
>>> EMF packages - just with the two I needed to confirm that the
>>> classloader was being called and at least finding the classes. It
>>> wasn't.
>>>
>>> Funny thing is that one of the classes it can not find is the driver
>>> itself. Put that on the classpath along with the model jar and it works.
>>> Again it's a hassle telling the users how to set this up.
>>>
>>>> Are you using the code that is available from
>>>> http://wiki.eclipse.org/Ecore_ODA_Driver or do you use a modified
>>>> version of this?
>>>
>>> Yes, I am using the new Driver that is packaged in the features:
>>> org.eclipse.emf.oda-feature
>>> org.eclipse.emf.oda.ecore-feature
>>> org.eclipse.emf.oda.ecore.ui-feature
>>>
>>> And have been experimenting changing it to see if I can set the
>>> classpath or a loader from with the driver. I have also explored during
>>> the Driver.setAppContext(Object context) method attaching another
>>> classloader in the to the AppContext's "PARENT_CLASSLOADER" and have
>>> tried setting the classpath in AppContext's
>>> "webapplication.projectclasspath".
>>> No luck so far.
>>>
>>> Have also tried the approach of adding to the user preference Report
>>> Design | Classpath from an external bundle at startup. I can get this to
>>> work, (I could also kludge it by copying jars to the birt/scriptlib in
>>> the report.designer working directory, but I think a better way would be
>>> to fix this in the org.eclipse.emf.oda driver and submit a patch, to
>>> bug:
>>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=359306
>>> so the new Driver will be more well behaved and of course others can
>>> benefit from it as well.
>>>
>>> thanks,
>>> John
>>>
>>>
>>>
>>
>
Re: EMF ODA DataSource, Report Viewer and Classloader Problems [message #765794 is a reply to message #765778] Wed, 14 December 2011 17:33 Go to previous messageGo to next message
Eclipse UserFriend
Jason - See inline comments...

On 12/14/2011 10:58 AM, Jason Weathersby wrote:
> John,
>
> I will look at this but it will probably be next week before I can.
That will be great.

Have
> you logged a bugzilla entry yet?
Yes, this is reported as bugzilla 359306

https://bugs.eclipse.org/bugs/show_bug.cgi?id=359306

John


>
> Jason
>
> On 12/14/2011 12:47 AM, John E. Conlon wrote:
>> Jason,
>>
>> See inline comments
>>
>> On 12/13/2011 10:57 AM, Jason Weathersby wrote:
>>> John,
>>>
>>> Do you have a simple model that I can test with?
>> Once EMF is installed, the easiest way to get a sample EMF model, the
>> edit and the editor plugins is to:
>>
>> New | Examples | Eclipse Modeling Framework | Extended Library Model
>> Example.
>>
>>
>> Then launch an Eclipse Application containing these plugins. From the
>> launched application (Sorry could not find an instance of the model
>> already with sample data, so ) you will need to create an instance of
>> the model in order to report on it. Create a project and then
>>
>> New | Example EMF Model Creation Wizards | EXTLibrary Model
>>
>> I think the best
>>> approach would be to add a class loader to pick up EMF packages
>>> automatically.
>>
>> I agree!
>>
>> John
>>
>>>
>>> Jason
>>>
>>> On 12/12/2011 9:14 PM, John E. Conlon wrote:
>>>> Hi Jason,
>>>>
>>>> On 12/12/2011 04:13 PM, Jason Weathersby wrote:
>>>>> John,
>>>>>
>>>>> How are you searching for registered EMF packages?
>>>>
>>>> First attempt was to just iterate through the EPackage.Registry like
>>>> this.
>>>>
>>>> EPackage.Registry reg = EPackage.Registry.INSTANCE;
>>>> for (String key : reg.keySet()) {
>>>> Object o = reg.getEPackage(key);
>>>> logger.info(bundleMarker,
>>>> "{}: Found Package key {} ",
>>>> this, key);
>>>> logger.info(bundleMarker,
>>>> "{}: Found Package object {} ",
>>>> this, o); }
>>>> }
>>>>
>>>>
>>>> When I did the
>>>>> hibernate oda I added a directory to the classpath.
>>>>
>>>> From what I saw it looks like you have
>>>> setThreadContextClassLoader=true
>>>> and then built a ClassLoader and filled it up with URLs you create
>>>> from the
>>>> HibernateUtil.refreshURLs()
>>>>
>>>> I tried something similar, adding a new ClassLoader during the
>>>> Connection.open(Properties connProperties) method, but not with all the
>>>> EMF packages - just with the two I needed to confirm that the
>>>> classloader was being called and at least finding the classes. It
>>>> wasn't.
>>>>
>>>> Funny thing is that one of the classes it can not find is the driver
>>>> itself. Put that on the classpath along with the model jar and it
>>>> works.
>>>> Again it's a hassle telling the users how to set this up.
>>>>
>>>>> Are you using the code that is available from
>>>>> http://wiki.eclipse.org/Ecore_ODA_Driver or do you use a modified
>>>>> version of this?
>>>>
>>>> Yes, I am using the new Driver that is packaged in the features:
>>>> org.eclipse.emf.oda-feature
>>>> org.eclipse.emf.oda.ecore-feature
>>>> org.eclipse.emf.oda.ecore.ui-feature
>>>>
>>>> And have been experimenting changing it to see if I can set the
>>>> classpath or a loader from with the driver. I have also explored during
>>>> the Driver.setAppContext(Object context) method attaching another
>>>> classloader in the to the AppContext's "PARENT_CLASSLOADER" and have
>>>> tried setting the classpath in AppContext's
>>>> "webapplication.projectclasspath".
>>>> No luck so far.
>>>>
>>>> Have also tried the approach of adding to the user preference Report
>>>> Design | Classpath from an external bundle at startup. I can get
>>>> this to
>>>> work, (I could also kludge it by copying jars to the birt/scriptlib in
>>>> the report.designer working directory, but I think a better way
>>>> would be
>>>> to fix this in the org.eclipse.emf.oda driver and submit a patch, to
>>>> bug:
>>>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=359306
>>>> so the new Driver will be more well behaved and of course others can
>>>> benefit from it as well.
>>>>
>>>> thanks,
>>>> John
>>>>
>>>>
>>>>
>>>
>>
>
Re: EMF ODA DataSource, Report Viewer and Classloader Problems [message #766574 is a reply to message #764723] Fri, 16 December 2011 02:28 Go to previous messageGo to next message
Linda ChanFriend
Messages: 845
Registered: July 2009
Senior Member
If you need to locate the emf.oda.ecore bundle jar to automatically add to the classpath, the following ODA framework utility API methods might come in handy:

bundle org.eclipse.datatools.connectivity.oda
package org.eclipse.datatools.connectivity.oda.util.manifest
class ManifestExplorer
public ExtensionManifest getExtensionManifest( String dataSourceId )
throws OdaException

class ExtensionManifest
public URL getDriverLocation() throws IOException


>> copying jars to the birt/scriptlib in the report.designer working directory

If taking the approach to copy the model jars to a BIRT appl location, it is more common practice to put them under the BIRT resources folder. An ODA runtime driver like the EMF ODA ECore, can locate the resource entries using the BIRT host application resource identifiers (org.eclipse.datatools.connectivity.oda.util.ResourceIdentifiers). An instance is passed by BIRT host to an ODA runtime driver, via the application context Map.
E.g. oda.IDriver#setAppContext( Object )
oda.IConnection#setAppContext( Object )

You can find sample reference implementation in org.eclipse.datatools.connectivity.oda.flatfile bundle, e.g. in Connection#getInputStream( String )

Hope that helps.

Linda

Re: EMF ODA DataSource, Report Viewer and Classloader Problems [message #768391 is a reply to message #766574] Tue, 20 December 2011 03:25 Go to previous messageGo to next message
Eclipse UserFriend
Hi Linda,

See inline comments.

On 12/15/2011 08:28 PM, Linda Chan wrote:
> If you need to locate the emf.oda.ecore bundle jar to automatically add
> to the classpath, the following ODA framework utility API methods might
> come in handy:
>
> bundle org.eclipse.datatools.connectivity.oda
> package org.eclipse.datatools.connectivity.oda.util.manifest
> class ManifestExplorer
> public ExtensionManifest getExtensionManifest( String dataSourceId )
> throws OdaException
>
> class ExtensionManifest
> public URL getDriverLocation() throws IOException
>
Yes, I tried it and it works very nicely.
>
>>> copying jars to the birt/scriptlib in the report.designer working
>>> directory
>
> If taking the approach to copy the model jars to a BIRT appl location,
> it is more common practice to put them under the BIRT resources folder.

In retrospect I agree with the approach Jason mentioned:
> I think the best approach would be to add a class loader to pick up EMF packages automatically.

The question that I still have though is how to add that classloader...

thanks,
John
Re: EMF ODA DataSource, Report Viewer and Classloader Problems [message #769913 is a reply to message #765794] Thu, 22 December 2011 22:17 Go to previous messageGo to next message
Eclipse UserFriend
Hi Jason,

Please note that I updated the description and added steps to reproduce
for the bug
https://bugs.eclipse.org/bugs/show_bug.cgi?id=359306

thanks for all your help,
John



On 12/14/2011 11:33 AM, John E. Conlon wrote:
> Jason - See inline comments...
>
> On 12/14/2011 10:58 AM, Jason Weathersby wrote:
>> John,
>>
>> I will look at this but it will probably be next week before I can.
> That will be great.
>
> Have
>> you logged a bugzilla entry yet?
> Yes, this is reported as bugzilla 359306
>
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=359306
>
> John
>
>
>>
>> Jason
>>
>> On 12/14/2011 12:47 AM, John E. Conlon wrote:
>>> Jason,
>>>
>>> See inline comments
>>>
>>> On 12/13/2011 10:57 AM, Jason Weathersby wrote:
>>>> John,
>>>>
>>>> Do you have a simple model that I can test with?
>>> Once EMF is installed, the easiest way to get a sample EMF model, the
>>> edit and the editor plugins is to:
>>>
>>> New | Examples | Eclipse Modeling Framework | Extended Library Model
>>> Example.
>>>
>>>
>>> Then launch an Eclipse Application containing these plugins. From the
>>> launched application (Sorry could not find an instance of the model
>>> already with sample data, so ) you will need to create an instance of
>>> the model in order to report on it. Create a project and then
>>>
>>> New | Example EMF Model Creation Wizards | EXTLibrary Model
>>>
>>> I think the best
>>>> approach would be to add a class loader to pick up EMF packages
>>>> automatically.
>>>
>>> I agree!
>>>
>>> John
>>>
>>>>
>>>> Jason
>>>>
>>>> On 12/12/2011 9:14 PM, John E. Conlon wrote:
>>>>> Hi Jason,
>>>>>
>>>>> On 12/12/2011 04:13 PM, Jason Weathersby wrote:
>>>>>> John,
>>>>>>
>>>>>> How are you searching for registered EMF packages?
>>>>>
>>>>> First attempt was to just iterate through the EPackage.Registry like
>>>>> this.
>>>>>
>>>>> EPackage.Registry reg = EPackage.Registry.INSTANCE;
>>>>> for (String key : reg.keySet()) {
>>>>> Object o = reg.getEPackage(key);
>>>>> logger.info(bundleMarker,
>>>>> "{}: Found Package key {} ",
>>>>> this, key);
>>>>> logger.info(bundleMarker,
>>>>> "{}: Found Package object {} ",
>>>>> this, o); }
>>>>> }
>>>>>
>>>>>
>>>>> When I did the
>>>>>> hibernate oda I added a directory to the classpath.
>>>>>
>>>>> From what I saw it looks like you have
>>>>> setThreadContextClassLoader=true
>>>>> and then built a ClassLoader and filled it up with URLs you create
>>>>> from the
>>>>> HibernateUtil.refreshURLs()
>>>>>
>>>>> I tried something similar, adding a new ClassLoader during the
>>>>> Connection.open(Properties connProperties) method, but not with all
>>>>> the
>>>>> EMF packages - just with the two I needed to confirm that the
>>>>> classloader was being called and at least finding the classes. It
>>>>> wasn't.
>>>>>
>>>>> Funny thing is that one of the classes it can not find is the driver
>>>>> itself. Put that on the classpath along with the model jar and it
>>>>> works.
>>>>> Again it's a hassle telling the users how to set this up.
>>>>>
>>>>>> Are you using the code that is available from
>>>>>> http://wiki.eclipse.org/Ecore_ODA_Driver or do you use a modified
>>>>>> version of this?
>>>>>
>>>>> Yes, I am using the new Driver that is packaged in the features:
>>>>> org.eclipse.emf.oda-feature
>>>>> org.eclipse.emf.oda.ecore-feature
>>>>> org.eclipse.emf.oda.ecore.ui-feature
>>>>>
>>>>> And have been experimenting changing it to see if I can set the
>>>>> classpath or a loader from with the driver. I have also explored
>>>>> during
>>>>> the Driver.setAppContext(Object context) method attaching another
>>>>> classloader in the to the AppContext's "PARENT_CLASSLOADER" and have
>>>>> tried setting the classpath in AppContext's
>>>>> "webapplication.projectclasspath".
>>>>> No luck so far.
>>>>>
>>>>> Have also tried the approach of adding to the user preference Report
>>>>> Design | Classpath from an external bundle at startup. I can get
>>>>> this to
>>>>> work, (I could also kludge it by copying jars to the birt/scriptlib in
>>>>> the report.designer working directory, but I think a better way
>>>>> would be
>>>>> to fix this in the org.eclipse.emf.oda driver and submit a patch, to
>>>>> bug:
>>>>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=359306
>>>>> so the new Driver will be more well behaved and of course others can
>>>>> benefit from it as well.
>>>>>
>>>>> thanks,
>>>>> John
>>>>>
>>>>>
>>>>>
>>>>
>>>
>>
>
Re: EMF ODA DataSource, Report Viewer and Classloader Problems [message #771604 is a reply to message #768391] Tue, 27 December 2011 18:20 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

One option may be to look at the WEBAPP_CLASSPATH_KEY.
If you look at the source specifically ReportEngine.java and look at the
function createEngineClassLoader function to see how this key is used by
the engine. You may also want to look at createDesignClassLoader() in
ApplicationClassLoader.java.

Jason


On 12/19/2011 10:25 PM, John E. Conlon wrote:
> Hi Linda,
>
> See inline comments.
>
> On 12/15/2011 08:28 PM, Linda Chan wrote:
>> If you need to locate the emf.oda.ecore bundle jar to automatically add
>> to the classpath, the following ODA framework utility API methods might
>> come in handy:
>>
>> bundle org.eclipse.datatools.connectivity.oda
>> package org.eclipse.datatools.connectivity.oda.util.manifest
>> class ManifestExplorer
>> public ExtensionManifest getExtensionManifest( String dataSourceId )
>> throws OdaException
>>
>> class ExtensionManifest
>> public URL getDriverLocation() throws IOException
>>
> Yes, I tried it and it works very nicely.
>>
>>>> copying jars to the birt/scriptlib in the report.designer working
>>>> directory
>>
>> If taking the approach to copy the model jars to a BIRT appl location,
>> it is more common practice to put them under the BIRT resources folder.
>
> In retrospect I agree with the approach Jason mentioned:
>> I think the best approach would be to add a class loader to pick up
>> EMF packages automatically.
>
> The question that I still have though is how to add that classloader...
>
> thanks,
> John
>
>
Re: EMF ODA DataSource, Report Viewer and Classloader Problems [message #773894 is a reply to message #771604] Mon, 02 January 2012 20:37 Go to previous messageGo to next message
Eclipse UserFriend
Hi Jason,

Yes, I see how the classpaths are created by the engine and how the keys
are used to create the classpath urls from parsed properties saved in
the appcontect WEBAPP_CLASSPATH_KEY.

I also see that the creation of the engines classpath takes place before
my implementation of the EMF ODA IConnection setAppContext(Object
context) is called.

Do I need to modify the appcontect WEBAPP_CLASSPATH_KEY?


If so how do I add the urls to EMF driver and model jars to the
appContext Map entry WEBAPP_CLASSPATH_KEY before the engine is started?

thanks,
John




On 12/27/2011 12:20 PM, Jason Weathersby wrote:
> One option may be to look at the WEBAPP_CLASSPATH_KEY.
> If you look at the source specifically ReportEngine.java and look at the
> function createEngineClassLoader function to see how this key is used by
> the engine. You may also want to look at createDesignClassLoader() in
> ApplicationClassLoader.java.
>
> Jason
>
>
> On 12/19/2011 10:25 PM, John E. Conlon wrote:
>> Hi Linda,
>>
>> See inline comments.
>>
>> On 12/15/2011 08:28 PM, Linda Chan wrote:
>>> If you need to locate the emf.oda.ecore bundle jar to automatically add
>>> to the classpath, the following ODA framework utility API methods might
>>> come in handy:
>>>
>>> bundle org.eclipse.datatools.connectivity.oda
>>> package org.eclipse.datatools.connectivity.oda.util.manifest
>>> class ManifestExplorer
>>> public ExtensionManifest getExtensionManifest( String dataSourceId )
>>> throws OdaException
>>>
>>> class ExtensionManifest
>>> public URL getDriverLocation() throws IOException
>>>
>> Yes, I tried it and it works very nicely.
>>>
>>>>> copying jars to the birt/scriptlib in the report.designer working
>>>>> directory
>>>
>>> If taking the approach to copy the model jars to a BIRT appl location,
>>> it is more common practice to put them under the BIRT resources folder.
>>
>> In retrospect I agree with the approach Jason mentioned:
>>> I think the best approach would be to add a class loader to pick up
>>> EMF packages automatically.
>>
>> The question that I still have though is how to add that classloader...
>>
>> thanks,
>> John
>>
>>
>
Re: EMF ODA DataSource, Report Viewer and Classloader Problems [message #774270 is a reply to message #773894] Tue, 03 January 2012 16:07 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

John,

What I was thinking is you could get the value of WEBAPP_CLASSPATH_KEY
and append your urls. If this will not work you can try using the
application context extension point that allows you to to modify the
appcontext before the engine runs in the designer. Try adding the urls
first and if that does not work we can look at the app context extension
point.

Jason

On 1/2/2012 3:37 PM, John E. Conlon wrote:
> Hi Jason,
>
> Yes, I see how the classpaths are created by the engine and how the keys
> are used to create the classpath urls from parsed properties saved in
> the appcontect WEBAPP_CLASSPATH_KEY.
>
> I also see that the creation of the engines classpath takes place before
> my implementation of the EMF ODA IConnection setAppContext(Object
> context) is called.
>
> Do I need to modify the appcontect WEBAPP_CLASSPATH_KEY?
>
>
> If so how do I add the urls to EMF driver and model jars to the
> appContext Map entry WEBAPP_CLASSPATH_KEY before the engine is started?
>
> thanks,
> John
>
>
>
>
> On 12/27/2011 12:20 PM, Jason Weathersby wrote:
>> One option may be to look at the WEBAPP_CLASSPATH_KEY.
>> If you look at the source specifically ReportEngine.java and look at the
>> function createEngineClassLoader function to see how this key is used by
>> the engine. You may also want to look at createDesignClassLoader() in
>> ApplicationClassLoader.java.
>>
>> Jason
>>
>>
>> On 12/19/2011 10:25 PM, John E. Conlon wrote:
>>> Hi Linda,
>>>
>>> See inline comments.
>>>
>>> On 12/15/2011 08:28 PM, Linda Chan wrote:
>>>> If you need to locate the emf.oda.ecore bundle jar to automatically add
>>>> to the classpath, the following ODA framework utility API methods might
>>>> come in handy:
>>>>
>>>> bundle org.eclipse.datatools.connectivity.oda
>>>> package org.eclipse.datatools.connectivity.oda.util.manifest
>>>> class ManifestExplorer
>>>> public ExtensionManifest getExtensionManifest( String dataSourceId )
>>>> throws OdaException
>>>>
>>>> class ExtensionManifest
>>>> public URL getDriverLocation() throws IOException
>>>>
>>> Yes, I tried it and it works very nicely.
>>>>
>>>>>> copying jars to the birt/scriptlib in the report.designer working
>>>>>> directory
>>>>
>>>> If taking the approach to copy the model jars to a BIRT appl location,
>>>> it is more common practice to put them under the BIRT resources folder.
>>>
>>> In retrospect I agree with the approach Jason mentioned:
>>>> I think the best approach would be to add a class loader to pick up
>>>> EMF packages automatically.
>>>
>>> The question that I still have though is how to add that classloader...
>>>
>>> thanks,
>>> John
>>>
>>>
>>
>
Re: EMF ODA DataSource, Report Viewer and Classloader Problems [message #774394 is a reply to message #774270] Tue, 03 January 2012 20:37 Go to previous messageGo to next message
Eclipse UserFriend
Jason,

The only way I see to append to the WEBAPP_CLASSPATH_KEY before the
engine runs would be to set a system property WEBAPP_CLASSPATH_KEY (aka
webapplication.projectclasspath) with the additional urls in a bundle
that has a startlevel earlier than the default. Then in the
ReportEngine the mergeSystemProperty( String property ) would merge it in.

But this seems to be kludgy.

Are there any downsides for using the App context extension point
org.eclipse.birt.report.viewer.appcontext ?

John


On 01/03/2012 10:07 AM, Jason Weathersby wrote:
> John,
>
> What I was thinking is you could get the value of WEBAPP_CLASSPATH_KEY
> and append your urls. If this will not work you can try using the
> application context extension point that allows you to to modify the
> appcontext before the engine runs in the designer. Try adding the urls
> first and if that does not work we can look at the app context extension
> point.
>
> Jason
>
> On 1/2/2012 3:37 PM, John E. Conlon wrote:
>> Hi Jason,
>>
>> Yes, I see how the classpaths are created by the engine and how the keys
>> are used to create the classpath urls from parsed properties saved in
>> the appcontect WEBAPP_CLASSPATH_KEY.
>>
>> I also see that the creation of the engines classpath takes place before
>> my implementation of the EMF ODA IConnection setAppContext(Object
>> context) is called.
>>
>> Do I need to modify the appcontect WEBAPP_CLASSPATH_KEY?
>>
>>
>> If so how do I add the urls to EMF driver and model jars to the
>> appContext Map entry WEBAPP_CLASSPATH_KEY before the engine is started?
>>
>> thanks,
>> John
>>
>>
>>
>>
>> On 12/27/2011 12:20 PM, Jason Weathersby wrote:
>>> One option may be to look at the WEBAPP_CLASSPATH_KEY.
>>> If you look at the source specifically ReportEngine.java and look at the
>>> function createEngineClassLoader function to see how this key is used by
>>> the engine. You may also want to look at createDesignClassLoader() in
>>> ApplicationClassLoader.java.
>>>
>>> Jason
>>>
>>>
>>> On 12/19/2011 10:25 PM, John E. Conlon wrote:
>>>> Hi Linda,
>>>>
>>>> See inline comments.
>>>>
>>>> On 12/15/2011 08:28 PM, Linda Chan wrote:
>>>>> If you need to locate the emf.oda.ecore bundle jar to automatically
>>>>> add
>>>>> to the classpath, the following ODA framework utility API methods
>>>>> might
>>>>> come in handy:
>>>>>
>>>>> bundle org.eclipse.datatools.connectivity.oda
>>>>> package org.eclipse.datatools.connectivity.oda.util.manifest
>>>>> class ManifestExplorer
>>>>> public ExtensionManifest getExtensionManifest( String dataSourceId )
>>>>> throws OdaException
>>>>>
>>>>> class ExtensionManifest
>>>>> public URL getDriverLocation() throws IOException
>>>>>
>>>> Yes, I tried it and it works very nicely.
>>>>>
>>>>>>> copying jars to the birt/scriptlib in the report.designer working
>>>>>>> directory
>>>>>
>>>>> If taking the approach to copy the model jars to a BIRT appl location,
>>>>> it is more common practice to put them under the BIRT resources
>>>>> folder.
>>>>
>>>> In retrospect I agree with the approach Jason mentioned:
>>>>> I think the best approach would be to add a class loader to pick up
>>>>> EMF packages automatically.
>>>>
>>>> The question that I still have though is how to add that classloader...
>>>>
>>>> thanks,
>>>> John
>>>>
>>>>
>>>
>>
>
Re: EMF ODA DataSource, Report Viewer and Classloader Problems [message #774828 is a reply to message #774394] Wed, 04 January 2012 17:58 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

If you look at:
Window->preferences->Report Design->Preview you will see there is an
option for setting the "Use custom application context". The draw back
is that this would need to be set to use the new app context object in
the designer.

Jason

On 1/3/2012 3:37 PM, John E. Conlon wrote:
> Jason,
>
> The only way I see to append to the WEBAPP_CLASSPATH_KEY before the
> engine runs would be to set a system property WEBAPP_CLASSPATH_KEY (aka
> webapplication.projectclasspath) with the additional urls in a bundle
> that has a startlevel earlier than the default. Then in the ReportEngine
> the mergeSystemProperty( String property ) would merge it in.
>
> But this seems to be kludgy.
>
> Are there any downsides for using the App context extension point
> org.eclipse.birt.report.viewer.appcontext ?
>
> John
>
>
> On 01/03/2012 10:07 AM, Jason Weathersby wrote:
>> John,
>>
>> What I was thinking is you could get the value of WEBAPP_CLASSPATH_KEY
>> and append your urls. If this will not work you can try using the
>> application context extension point that allows you to to modify the
>> appcontext before the engine runs in the designer. Try adding the urls
>> first and if that does not work we can look at the app context extension
>> point.
>>
>> Jason
>>
>> On 1/2/2012 3:37 PM, John E. Conlon wrote:
>>> Hi Jason,
>>>
>>> Yes, I see how the classpaths are created by the engine and how the keys
>>> are used to create the classpath urls from parsed properties saved in
>>> the appcontect WEBAPP_CLASSPATH_KEY.
>>>
>>> I also see that the creation of the engines classpath takes place before
>>> my implementation of the EMF ODA IConnection setAppContext(Object
>>> context) is called.
>>>
>>> Do I need to modify the appcontect WEBAPP_CLASSPATH_KEY?
>>>
>>>
>>> If so how do I add the urls to EMF driver and model jars to the
>>> appContext Map entry WEBAPP_CLASSPATH_KEY before the engine is started?
>>>
>>> thanks,
>>> John
>>>
>>>
>>>
>>>
>>> On 12/27/2011 12:20 PM, Jason Weathersby wrote:
>>>> One option may be to look at the WEBAPP_CLASSPATH_KEY.
>>>> If you look at the source specifically ReportEngine.java and look at
>>>> the
>>>> function createEngineClassLoader function to see how this key is
>>>> used by
>>>> the engine. You may also want to look at createDesignClassLoader() in
>>>> ApplicationClassLoader.java.
>>>>
>>>> Jason
>>>>
>>>>
>>>> On 12/19/2011 10:25 PM, John E. Conlon wrote:
>>>>> Hi Linda,
>>>>>
>>>>> See inline comments.
>>>>>
>>>>> On 12/15/2011 08:28 PM, Linda Chan wrote:
>>>>>> If you need to locate the emf.oda.ecore bundle jar to automatically
>>>>>> add
>>>>>> to the classpath, the following ODA framework utility API methods
>>>>>> might
>>>>>> come in handy:
>>>>>>
>>>>>> bundle org.eclipse.datatools.connectivity.oda
>>>>>> package org.eclipse.datatools.connectivity.oda.util.manifest
>>>>>> class ManifestExplorer
>>>>>> public ExtensionManifest getExtensionManifest( String dataSourceId )
>>>>>> throws OdaException
>>>>>>
>>>>>> class ExtensionManifest
>>>>>> public URL getDriverLocation() throws IOException
>>>>>>
>>>>> Yes, I tried it and it works very nicely.
>>>>>>
>>>>>>>> copying jars to the birt/scriptlib in the report.designer working
>>>>>>>> directory
>>>>>>
>>>>>> If taking the approach to copy the model jars to a BIRT appl
>>>>>> location,
>>>>>> it is more common practice to put them under the BIRT resources
>>>>>> folder.
>>>>>
>>>>> In retrospect I agree with the approach Jason mentioned:
>>>>>> I think the best approach would be to add a class loader to pick up
>>>>>> EMF packages automatically.
>>>>>
>>>>> The question that I still have though is how to add that
>>>>> classloader...
>>>>>
>>>>> thanks,
>>>>> John
>>>>>
>>>>>
>>>>
>>>
>>
>
Re: EMF ODA DataSource, Report Viewer and Classloader Problems [message #774856 is a reply to message #774828] Wed, 04 January 2012 19:31 Go to previous messageGo to next message
Eclipse UserFriend
See In line...

On 01/04/2012 11:58 AM, Jason Weathersby wrote:
> If you look at:
> Window->preferences->Report Design->Preview you will see there is an
> option for setting the "Use custom application context". The draw back
> is that this would need to be set to use the new app context object in
> the designer.

Ouch. That does not seem to work well for this use-case. Is the only
way then to do as I was previously contemplating and

>> engine runs would be to set a system property WEBAPP_CLASSPATH_KEY (aka
>> webapplication.projectclasspath) with the additional urls in a bundle
>> that has a startlevel earlier than the default. Then in the ReportEngine
>> the mergeSystemProperty( String property ) would merge it in.

John

>
> Jason
>
> On 1/3/2012 3:37 PM, John E. Conlon wrote:
>> Jason,
>>
>> The only way I see to append to the WEBAPP_CLASSPATH_KEY before the
>> engine runs would be to set a system property WEBAPP_CLASSPATH_KEY (aka
>> webapplication.projectclasspath) with the additional urls in a bundle
>> that has a startlevel earlier than the default. Then in the ReportEngine
>> the mergeSystemProperty( String property ) would merge it in.
>>
>> But this seems to be kludgy.
>>
>> Are there any downsides for using the App context extension point
>> org.eclipse.birt.report.viewer.appcontext ?
>>
>> John
>>
>>
>> On 01/03/2012 10:07 AM, Jason Weathersby wrote:
>>> John,
>>>
>>> What I was thinking is you could get the value of WEBAPP_CLASSPATH_KEY
>>> and append your urls. If this will not work you can try using the
>>> application context extension point that allows you to to modify the
>>> appcontext before the engine runs in the designer. Try adding the urls
>>> first and if that does not work we can look at the app context extension
>>> point.
>>>
>>> Jason
>>>
>>> On 1/2/2012 3:37 PM, John E. Conlon wrote:
>>>> Hi Jason,
>>>>
>>>> Yes, I see how the classpaths are created by the engine and how the
>>>> keys
>>>> are used to create the classpath urls from parsed properties saved in
>>>> the appcontect WEBAPP_CLASSPATH_KEY.
>>>>
>>>> I also see that the creation of the engines classpath takes place
>>>> before
>>>> my implementation of the EMF ODA IConnection setAppContext(Object
>>>> context) is called.
>>>>
>>>> Do I need to modify the appcontect WEBAPP_CLASSPATH_KEY?
>>>>
>>>>
>>>> If so how do I add the urls to EMF driver and model jars to the
>>>> appContext Map entry WEBAPP_CLASSPATH_KEY before the engine is started?
>>>>
>>>> thanks,
>>>> John
>>>>
>>>>
>>>>
>>>>
>>>> On 12/27/2011 12:20 PM, Jason Weathersby wrote:
>>>>> One option may be to look at the WEBAPP_CLASSPATH_KEY.
>>>>> If you look at the source specifically ReportEngine.java and look at
>>>>> the
>>>>> function createEngineClassLoader function to see how this key is
>>>>> used by
>>>>> the engine. You may also want to look at createDesignClassLoader() in
>>>>> ApplicationClassLoader.java.
>>>>>
>>>>> Jason
>>>>>
>>>>>
>>>>> On 12/19/2011 10:25 PM, John E. Conlon wrote:
>>>>>> Hi Linda,
>>>>>>
>>>>>> See inline comments.
>>>>>>
>>>>>> On 12/15/2011 08:28 PM, Linda Chan wrote:
>>>>>>> If you need to locate the emf.oda.ecore bundle jar to automatically
>>>>>>> add
>>>>>>> to the classpath, the following ODA framework utility API methods
>>>>>>> might
>>>>>>> come in handy:
>>>>>>>
>>>>>>> bundle org.eclipse.datatools.connectivity.oda
>>>>>>> package org.eclipse.datatools.connectivity.oda.util.manifest
>>>>>>> class ManifestExplorer
>>>>>>> public ExtensionManifest getExtensionManifest( String dataSourceId )
>>>>>>> throws OdaException
>>>>>>>
>>>>>>> class ExtensionManifest
>>>>>>> public URL getDriverLocation() throws IOException
>>>>>>>
>>>>>> Yes, I tried it and it works very nicely.
>>>>>>>
>>>>>>>>> copying jars to the birt/scriptlib in the report.designer working
>>>>>>>>> directory
>>>>>>>
>>>>>>> If taking the approach to copy the model jars to a BIRT appl
>>>>>>> location,
>>>>>>> it is more common practice to put them under the BIRT resources
>>>>>>> folder.
>>>>>>
>>>>>> In retrospect I agree with the approach Jason mentioned:
>>>>>>> I think the best approach would be to add a class loader to pick up
>>>>>>> EMF packages automatically.
>>>>>>
>>>>>> The question that I still have though is how to add that
>>>>>> classloader...
>>>>>>
>>>>>> thanks,
>>>>>> John
>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>>
>
Re: EMF ODA DataSource, Report Viewer and Classloader Problems [message #774876 is a reply to message #774856] Wed, 04 January 2012 20:35 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

John,

Would you have anytime to discuss this on Skype?

Jason

On 1/4/2012 2:31 PM, John E. Conlon wrote:
> See In line...
>
> On 01/04/2012 11:58 AM, Jason Weathersby wrote:
>> If you look at:
>> Window->preferences->Report Design->Preview you will see there is an
>> option for setting the "Use custom application context". The draw back
>> is that this would need to be set to use the new app context object in
>> the designer.
>
> Ouch. That does not seem to work well for this use-case. Is the only way
> then to do as I was previously contemplating and
>
> >> engine runs would be to set a system property WEBAPP_CLASSPATH_KEY (aka
> >> webapplication.projectclasspath) with the additional urls in a bundle
> >> that has a startlevel earlier than the default. Then in the
> ReportEngine
> >> the mergeSystemProperty( String property ) would merge it in.
>
> John
>
>>
>> Jason
>>
>> On 1/3/2012 3:37 PM, John E. Conlon wrote:
>>> Jason,
>>>
>>> The only way I see to append to the WEBAPP_CLASSPATH_KEY before the
>>> engine runs would be to set a system property WEBAPP_CLASSPATH_KEY (aka
>>> webapplication.projectclasspath) with the additional urls in a bundle
>>> that has a startlevel earlier than the default. Then in the ReportEngine
>>> the mergeSystemProperty( String property ) would merge it in.
>>>
>>> But this seems to be kludgy.
>>>
>>> Are there any downsides for using the App context extension point
>>> org.eclipse.birt.report.viewer.appcontext ?
>>>
>>> John
>>>
>>>
>>> On 01/03/2012 10:07 AM, Jason Weathersby wrote:
>>>> John,
>>>>
>>>> What I was thinking is you could get the value of WEBAPP_CLASSPATH_KEY
>>>> and append your urls. If this will not work you can try using the
>>>> application context extension point that allows you to to modify the
>>>> appcontext before the engine runs in the designer. Try adding the urls
>>>> first and if that does not work we can look at the app context
>>>> extension
>>>> point.
>>>>
>>>> Jason
>>>>
>>>> On 1/2/2012 3:37 PM, John E. Conlon wrote:
>>>>> Hi Jason,
>>>>>
>>>>> Yes, I see how the classpaths are created by the engine and how the
>>>>> keys
>>>>> are used to create the classpath urls from parsed properties saved in
>>>>> the appcontect WEBAPP_CLASSPATH_KEY.
>>>>>
>>>>> I also see that the creation of the engines classpath takes place
>>>>> before
>>>>> my implementation of the EMF ODA IConnection setAppContext(Object
>>>>> context) is called.
>>>>>
>>>>> Do I need to modify the appcontect WEBAPP_CLASSPATH_KEY?
>>>>>
>>>>>
>>>>> If so how do I add the urls to EMF driver and model jars to the
>>>>> appContext Map entry WEBAPP_CLASSPATH_KEY before the engine is
>>>>> started?
>>>>>
>>>>> thanks,
>>>>> John
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> On 12/27/2011 12:20 PM, Jason Weathersby wrote:
>>>>>> One option may be to look at the WEBAPP_CLASSPATH_KEY.
>>>>>> If you look at the source specifically ReportEngine.java and look at
>>>>>> the
>>>>>> function createEngineClassLoader function to see how this key is
>>>>>> used by
>>>>>> the engine. You may also want to look at createDesignClassLoader() in
>>>>>> ApplicationClassLoader.java.
>>>>>>
>>>>>> Jason
>>>>>>
>>>>>>
>>>>>> On 12/19/2011 10:25 PM, John E. Conlon wrote:
>>>>>>> Hi Linda,
>>>>>>>
>>>>>>> See inline comments.
>>>>>>>
>>>>>>> On 12/15/2011 08:28 PM, Linda Chan wrote:
>>>>>>>> If you need to locate the emf.oda.ecore bundle jar to automatically
>>>>>>>> add
>>>>>>>> to the classpath, the following ODA framework utility API methods
>>>>>>>> might
>>>>>>>> come in handy:
>>>>>>>>
>>>>>>>> bundle org.eclipse.datatools.connectivity.oda
>>>>>>>> package org.eclipse.datatools.connectivity.oda.util.manifest
>>>>>>>> class ManifestExplorer
>>>>>>>> public ExtensionManifest getExtensionManifest( String
>>>>>>>> dataSourceId )
>>>>>>>> throws OdaException
>>>>>>>>
>>>>>>>> class ExtensionManifest
>>>>>>>> public URL getDriverLocation() throws IOException
>>>>>>>>
>>>>>>> Yes, I tried it and it works very nicely.
>>>>>>>>
>>>>>>>>>> copying jars to the birt/scriptlib in the report.designer working
>>>>>>>>>> directory
>>>>>>>>
>>>>>>>> If taking the approach to copy the model jars to a BIRT appl
>>>>>>>> location,
>>>>>>>> it is more common practice to put them under the BIRT resources
>>>>>>>> folder.
>>>>>>>
>>>>>>> In retrospect I agree with the approach Jason mentioned:
>>>>>>>> I think the best approach would be to add a class loader to pick up
>>>>>>>> EMF packages automatically.
>>>>>>>
>>>>>>> The question that I still have though is how to add that
>>>>>>> classloader...
>>>>>>>
>>>>>>> thanks,
>>>>>>> John
>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>>
>
Re: EMF ODA DataSource, Report Viewer and Classloader Problems [message #774885 is a reply to message #774876] Wed, 04 January 2012 21:02 Go to previous message
Eclipse UserFriend
Jason,

I have time to discuss, (Tomorrow morning or afternoon?).
Unfortunately, I do not have skype configured on my machine, but I could
give you a call directly.

Send me your number -
jconlon@verticon.com

John

On 01/04/2012 02:35 PM, Jason Weathersby wrote:
> John,
>
> Would you have anytime to discuss this on Skype?
>
> Jason
>
> On 1/4/2012 2:31 PM, John E. Conlon wrote:
>> See In line...
>>
>> On 01/04/2012 11:58 AM, Jason Weathersby wrote:
>>> If you look at:
>>> Window->preferences->Report Design->Preview you will see there is an
>>> option for setting the "Use custom application context". The draw back
>>> is that this would need to be set to use the new app context object in
>>> the designer.
>>
>> Ouch. That does not seem to work well for this use-case. Is the only way
>> then to do as I was previously contemplating and
>>
>> >> engine runs would be to set a system property WEBAPP_CLASSPATH_KEY
>> (aka
>> >> webapplication.projectclasspath) with the additional urls in a bundle
>> >> that has a startlevel earlier than the default. Then in the
>> ReportEngine
>> >> the mergeSystemProperty( String property ) would merge it in.
>>
>> John
>>
>>>
>>> Jason
>>>
>>> On 1/3/2012 3:37 PM, John E. Conlon wrote:
>>>> Jason,
>>>>
>>>> The only way I see to append to the WEBAPP_CLASSPATH_KEY before the
>>>> engine runs would be to set a system property WEBAPP_CLASSPATH_KEY (aka
>>>> webapplication.projectclasspath) with the additional urls in a bundle
>>>> that has a startlevel earlier than the default. Then in the
>>>> ReportEngine
>>>> the mergeSystemProperty( String property ) would merge it in.
>>>>
>>>> But this seems to be kludgy.
>>>>
>>>> Are there any downsides for using the App context extension point
>>>> org.eclipse.birt.report.viewer.appcontext ?
>>>>
>>>> John
>>>>
>>>>
>>>> On 01/03/2012 10:07 AM, Jason Weathersby wrote:
>>>>> John,
>>>>>
>>>>> What I was thinking is you could get the value of WEBAPP_CLASSPATH_KEY
>>>>> and append your urls. If this will not work you can try using the
>>>>> application context extension point that allows you to to modify the
>>>>> appcontext before the engine runs in the designer. Try adding the urls
>>>>> first and if that does not work we can look at the app context
>>>>> extension
>>>>> point.
>>>>>
>>>>> Jason
>>>>>
>>>>> On 1/2/2012 3:37 PM, John E. Conlon wrote:
>>>>>> Hi Jason,
>>>>>>
>>>>>> Yes, I see how the classpaths are created by the engine and how the
>>>>>> keys
>>>>>> are used to create the classpath urls from parsed properties saved in
>>>>>> the appcontect WEBAPP_CLASSPATH_KEY.
>>>>>>
>>>>>> I also see that the creation of the engines classpath takes place
>>>>>> before
>>>>>> my implementation of the EMF ODA IConnection setAppContext(Object
>>>>>> context) is called.
>>>>>>
>>>>>> Do I need to modify the appcontect WEBAPP_CLASSPATH_KEY?
>>>>>>
>>>>>>
>>>>>> If so how do I add the urls to EMF driver and model jars to the
>>>>>> appContext Map entry WEBAPP_CLASSPATH_KEY before the engine is
>>>>>> started?
>>>>>>
>>>>>> thanks,
>>>>>> John
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> On 12/27/2011 12:20 PM, Jason Weathersby wrote:
>>>>>>> One option may be to look at the WEBAPP_CLASSPATH_KEY.
>>>>>>> If you look at the source specifically ReportEngine.java and look at
>>>>>>> the
>>>>>>> function createEngineClassLoader function to see how this key is
>>>>>>> used by
>>>>>>> the engine. You may also want to look at
>>>>>>> createDesignClassLoader() in
>>>>>>> ApplicationClassLoader.java.
>>>>>>>
>>>>>>> Jason
>>>>>>>
>>>>>>>
>>>>>>> On 12/19/2011 10:25 PM, John E. Conlon wrote:
>>>>>>>> Hi Linda,
>>>>>>>>
>>>>>>>> See inline comments.
>>>>>>>>
>>>>>>>> On 12/15/2011 08:28 PM, Linda Chan wrote:
>>>>>>>>> If you need to locate the emf.oda.ecore bundle jar to
>>>>>>>>> automatically
>>>>>>>>> add
>>>>>>>>> to the classpath, the following ODA framework utility API methods
>>>>>>>>> might
>>>>>>>>> come in handy:
>>>>>>>>>
>>>>>>>>> bundle org.eclipse.datatools.connectivity.oda
>>>>>>>>> package org.eclipse.datatools.connectivity.oda.util.manifest
>>>>>>>>> class ManifestExplorer
>>>>>>>>> public ExtensionManifest getExtensionManifest( String
>>>>>>>>> dataSourceId )
>>>>>>>>> throws OdaException
>>>>>>>>>
>>>>>>>>> class ExtensionManifest
>>>>>>>>> public URL getDriverLocation() throws IOException
>>>>>>>>>
>>>>>>>> Yes, I tried it and it works very nicely.
>>>>>>>>>
>>>>>>>>>>> copying jars to the birt/scriptlib in the report.designer
>>>>>>>>>>> working
>>>>>>>>>>> directory
>>>>>>>>>
>>>>>>>>> If taking the approach to copy the model jars to a BIRT appl
>>>>>>>>> location,
>>>>>>>>> it is more common practice to put them under the BIRT resources
>>>>>>>>> folder.
>>>>>>>>
>>>>>>>> In retrospect I agree with the approach Jason mentioned:
>>>>>>>>> I think the best approach would be to add a class loader to
>>>>>>>>> pick up
>>>>>>>>> EMF packages automatically.
>>>>>>>>
>>>>>>>> The question that I still have though is how to add that
>>>>>>>> classloader...
>>>>>>>>
>>>>>>>> thanks,
>>>>>>>> John
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>>
>
Previous Topic:Number format - complete zero suppress
Next Topic:How to change the name of the database for a datasource dynamically?
Goto Forum:
  


Current Time: Thu Mar 28 09:00:12 GMT 2024

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

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

Back to the top