You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by Steve Vangasse <st...@boardshop.co.uk> on 2006/07/02 10:45:06 UTC
Read connection repository file at runtime
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.
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.
Any help would be much appreciated.
Thanks,
Steve Vangasse
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org
Re: Read connection repository file at runtime
Posted by Armin Waibel <ar...@apache.org>.
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" <ar...@apache.org>
> To: "OJB Users List" <oj...@db.apache.org>
> 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: ojb-user-unsubscribe@db.apache.org
>>> For additional commands, e-mail: ojb-user-help@db.apache.org
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
>> For additional commands, e-mail: ojb-user-help@db.apache.org
>>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org
Re: Read connection repository file at runtime
Posted by Steve Vangasse <st...@boardshop.co.uk>.
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" <ar...@apache.org>
To: "OJB Users List" <oj...@db.apache.org>
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: ojb-user-unsubscribe@db.apache.org
>> For additional commands, e-mail: ojb-user-help@db.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org
Re: Read connection repository file at runtime
Posted by Armin Waibel <ar...@apache.org>.
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: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org