Use an EntityResolver to load the relative files:

jdo.setEntityResolver( new EntityResolver() {
 public InputSource resolveEntity (String publicId, String systemId) {
  InputStream is = <code to find the entity from the URL (systemId)>
  if (is != null) {
   return new InputSource(is);
  } else {
   return null;
  }
 }
});
With this you can load the file (entity) from the classpath using the classloader.
 
Hope this helps.
Steve

-----Original Message-----
From: Christopher Pennock [
mailto:[EMAIL PROTECTED]]
Sent: Thursday, November 15, 2001 6:50 AM
To: [EMAIL PROTECTED]
Subject: [castor-dev] database.xml finding mapping.xml via relative uri


In the DTD for database.xml [
http://castor.exolab.org/jdo-conf.dtd], it
is said that <mapping> can be the path to mapping.xml relative to the
directory of database.xml, eg if they are in the same directory, it
could be <mapping>mapping.xml</mapping>.

However, this seems only to work if the location of the database.xml
file is specified via:
myJdo.setConfiguration( "
http://myhost/myWebapp/etc/database.xml")

and not by:
myJdo.setConfiguration("c:/etc/database.xml")
or:
myJdo.loadConfiguration(myInputSource) // where myInputSource is
database.xml

Are relative paths for mapping.xml supposed to work in either of the
latter two cases? Is there any way to make it work?
It would be nice not to have to open up URLs to either of these files
such that they could both be in WEB-INF, and hardcoding the full system
path of mapping.xml in database.xml decreases portability.

thanks in advance for your help.

Chris

________________________________________________________________________
p l u m b d e s i g n

chris pennock | interface developer
157 chambers st ny ny 10007
p.212-285-8600 x484 f.212-285-8999

-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-dev

Reply via email to