Re: Read connection repository file at runtime

Armin Waibel <[email protected]>
Newsgroups gmane.comp.jakarta.ojb.user
Message-ID <[email protected]>
Steve Vangasse wrote:
> Thanks Armin. Sorry for taking so long to reply. I've solved it 
> programatically for now. I would say the best solution would be the 
> customizable class to read xml metadata interface that you suggested.
>

Done.
For 1.0.x (OJB_1_0_RELEASE branch) you can now extend class 
RepositoryDescriptor and declare the custom class in OJB.properties file 
or set the class at runtime using MetadataManager.
For OJB 2.x it's planned to rework the metadata package (then we can 
introduce interface based metadata handling).

regards,
Armin

> Steve Vangasse
> www.boardshop.co.uk
> 
> ----- Original Message ----- From: "Armin Waibel" <[email protected]>
> To: "OJB Users List" <[email protected]>
> Sent: Thursday, July 06, 2006 11:22 AM
> Subject: Re: Read connection repository file at runtime
> 
> 
>> Hi Steve,
>>
>> Steve Vangasse wrote:
>>> I'm trying to load a connection repository xml file at runtime using 
>>> MetadataManager.readConnectionRepository method. The problem is that 
>>> the xml file is inside a jar. Passing readConnectionRepository the 
>>> file name causes it to look inside the filesystem relative to the 
>>> application (in this case Tomcat's bin directory). Passing 
>>> readConnectionRepository a stream read using 
>>> MyClass.class.getResourceAsStream("repository_frag.xml") finds the 
>>> xml file but then has a problem finding the repository.dtd for which 
>>> it looks in the filesystem relative to the application.
>>>
>>
>> You are right, I can reproduce this behavior with latest version from 
>> SVN (OJB_1_0_RELEASE branch).
>>
>>
>>> Does anyone know of a way of getting round either of these problems? 
>>> I thought their might be a way of using a custom EntityResolver that 
>>> forces OJB to find the dtd file inside my jar file but I couldn't 
>>> find a way of doing this.
>>
>> Currently it's not possible to solve this problem without modifying 
>> the class RepositoryPersistor (this class read/write xml metadata and 
>> was used by MetadataManager to read in metadata classes).
>>
>> Locally I fixed your problem by using a custom EntityResolver (as you 
>> suggested above) in class RepositoryPersistor (latest from 
>> OJB_1_0_RELEASE branch) to resolve the URI.
>>
>> I will fix this issue for OJB 1.0.5, what do you think will be the 
>> best solution (configurable class RepositoryPersistor / new 
>> customizable class to read xml metadata interface "RepositoryReader")?
>>
>> regards,
>> Armin
>>
>>>
>>> Any help would be much appreciated.
>>>
>>> Thanks,
>>>
>>> Steve Vangasse
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [email protected]
>>> For additional commands, e-mail: [email protected]
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [email protected]
>> For additional commands, e-mail: [email protected]
>>
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
> 
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.