db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Neeme Praks <ne...@apache.org>
Subject Re: OJB inside JBoss
Date Mon, 31 Mar 2003 23:00:04 GMT

Phil Warrick ::

> There are EJB sample beans for OJB. Check out the jBoss deployment 
> section of the OJB docs and see how far that helps you. 

Thanks, found them... was quite helpful, but some questions are still 
unclear for me...

> Neeme Praks wrote:
>
>> There is support for JBoss and other application servers in OJB, but 
>> the documentation is lacking, so here are some questions:
>> * what version of Jboss OJB has been tested with? 2.4.x vs. 3.x?
>> * any specific problems that I should be aware of when trying to run 
>> OJB under JBoss?
>> * location and loading of repository.xml... How is this achieved 
>> under JBoss? AFAIU, repository.xml is located outside of EJB EAR 
>> system, in some well-defined location? Is there any support for 
>> loading repository.xml file from the deployed EAR achive? I saw 
>> something is CVS that dealt with loading mapping info from per-class 
>> XML snippets... not sure that this would be the best route to take, 
>> however, some way for registering "external" repository.xml with OJB 
>> service would be useful? Something like this (pseudo-code):
>>
>> Context context = new InitialContext();
>> OJBService ojb = context.lookup("OJBService");
>> InputStream is = 
>> getContextClassloader().getResourceasStream("META-INF/repository.xml");
>> ojb.loadRepository(is);
>> //... rest of the stuff here, using OJB, etc
>>
>> Would something like this be possible? Or maybe it is already possible?
>
Now I checked the sources and this did not seem to be implemented at the 
current stage...
Is there any interest in implementing this?

Something like this?:
RepositoryPersistor persistor = new RepositoryPersistor();
MetadataManager.getInstance().mergeDescriptorRepository(persistor.readDescriptorRepository("META-INF/repository.xml"));

As the descriptor is read in through the following call:
Thread.currentThread().getContextClassLoader().getResource(repositoryFileName)
then the above code should most probably work ok?

>> * also, do I have to declare something "special" in my deployment 
>> descriptors, in order to get access to OJB?
>> * and, is it a good idea to put all the OJB jar files under Jboss lib 
>> directory? Or will it create some classloading problems?
>> * what about the OM classes? should these be also in the same 
>> classloader as OJB? Or can OM classes stay in my EAR classloader and 
>> OJB stay in Jboss "root" classloader? 
>
after consulting the sources, I came to the conlusion, that it should be 
possible to keep OM classes in a separate classloader? ClassHelper.java 
seems to be loading all classes though the following line of code:
Class.forName(className, initialize, 
Thread.currentThread().getContextClassLoader());
and, as JBoss is supposed to set the contextClassloader properly, then 
this should work....

Rgds,
Neeme


Mime
View raw message