Re: Read connection repository file at runtime
"Steve Vangasse" <[email protected]>
| Newsgroups | gmane.comp.jakarta.ojb.user |
|---|---|
| Message-ID | <032701c6b9fd$98c8f8d0$0300a8c0@SteveLaptop> |
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. 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] >