RE: [equinox-dev] Hibernate and classloaders

2008-03-28 Thread Emmanuel Potvin
Thanks, I solved my problem with Eclipse-BuddyPolicy and
Eclipse-RegisterBuddy. It's exactly what I wanted.

-Message d'origine-
De : [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] De la part de Alin Dreghiciu
Envoyé : 27 mars 2008 21:56
À : Equinox development mailing list
Objet : Re: [equinox-dev] Hibernate and classloaders

On Fri, Mar 28, 2008 at 12:01 AM, Emmanuel Potvin [EMAIL PROTECTED]
wrote:




 My question is about classloaders. Hibernate is just an example.



 How can I change temporarily the classpath of an object? In this case, I
 pass a string to a configurator class containing « /hibernate.cfg.xml ».
The
 configurator open the file and configure hibernate. The problem is : the
 hibernate.cfg.xml file (and any entity classes) are in my current bundle,
 but the configurator run as in his proper bundle, so it don't see any of
my
 files.



 I know that the httpservice use string for resource registering. I want
the
 same thing.

If you want the same thing than you will have to:

1. from your hibernate bundle register a HibernateService with a
method like, lets say, registerMappings(String hbmLocaton)
2. the above service should implement ServiceFactory (read more about
on the core osgi specs)
3. in getService(...) implementation you will get the Bundle that
contains the class that made the call to the service so you are now
able to do Bundle.getResource or Bundle.getEntry to find the url of
your hbm file
4. on ungetService(...) ou can deconfgure (undo) what you have done above.

I don't know if this is workable for our use case but at least this is
how HttpService implementations works.

Hope it helps,
Alin Dreghiciu




 Emmanuel
 ___
  equinox-dev mailing list
  equinox-dev@eclipse.org
  https://dev.eclipse.org/mailman/listinfo/equinox-dev


___
equinox-dev mailing list
equinox-dev@eclipse.org
https://dev.eclipse.org/mailman/listinfo/equinox-dev

___
equinox-dev mailing list
equinox-dev@eclipse.org
https://dev.eclipse.org/mailman/listinfo/equinox-dev


Re: [equinox-dev] Hibernate and classloaders

2008-03-27 Thread Alin Dreghiciu
On Fri, Mar 28, 2008 at 12:01 AM, Emmanuel Potvin [EMAIL PROTECTED] wrote:




 My question is about classloaders. Hibernate is just an example.



 How can I change temporarily the classpath of an object? In this case, I
 pass a string to a configurator class containing « /hibernate.cfg.xml ». The
 configurator open the file and configure hibernate. The problem is : the
 hibernate.cfg.xml file (and any entity classes) are in my current bundle,
 but the configurator run as in his proper bundle, so it don't see any of my
 files.



 I know that the httpservice use string for resource registering. I want the
 same thing.

If you want the same thing than you will have to:

1. from your hibernate bundle register a HibernateService with a
method like, lets say, registerMappings(String hbmLocaton)
2. the above service should implement ServiceFactory (read more about
on the core osgi specs)
3. in getService(...) implementation you will get the Bundle that
contains the class that made the call to the service so you are now
able to do Bundle.getResource or Bundle.getEntry to find the url of
your hbm file
4. on ungetService(...) ou can deconfgure (undo) what you have done above.

I don't know if this is workable for our use case but at least this is
how HttpService implementations works.

Hope it helps,
Alin Dreghiciu




 Emmanuel
 ___
  equinox-dev mailing list
  equinox-dev@eclipse.org
  https://dev.eclipse.org/mailman/listinfo/equinox-dev


___
equinox-dev mailing list
equinox-dev@eclipse.org
https://dev.eclipse.org/mailman/listinfo/equinox-dev