This one time, at band camp, Ross Gibb said:

RG>Is it possible to put a mapping.xml file into a jar file to make a clean 
deployment.  For example, say I have file database.xml which is as follows,
RG>
RG><database name="mydb" engine="mysql" >
RG>  <driver url="jdbc:mysql://localhost/dbtest" 
RG>          class-name="org.gjt.mm.mysql.Driver">
RG>    <param name="user" value="root"/>
RG>    <param name="password" value="" />
RG>  </driver>
RG>  <mapping href="..\properties\mapping.xml" />
RG></database>
RG>
RG>You can see that the mapping file is located in relative path 
..\properties\mapping.xml.  How can one put the file mapping.xml in a jar file and 
have castor be able to access it.  I saw some mail about this in the archive along 
with a modification to the Castor source, has this been implemented into a released 
version of the castor source?  Any help is appreciated.

Ross, 

I've done this in the past, but not with Castor's descriptor files. Here's
how I grabbed an XML file out of jar file:

    URL url = null;
    ...
    url = this.getClass().getClassLoader().getSystemResource( XML );
    System.out.println( "URL = " + url );

The println above then outputs the following URL: 

    URL = jar:file:/home/bsnyder/java/cptest/dist/cptest.jar!/user.xml

Mapping#loadMapping() is overloaded to accept a java.net.URL as a
parameter, but I'm not sure that it can handle the syntax above (where
the XML descriptor is inside the jar file - notice the bang(!)). It's
still a valid java.net.URL...

Keith, Aranud, can one of you guys answer this?

Bruce
-- 
perl -e 'print unpack("u30","<0G)[EMAIL PROTECTED]&5R\"F9E<G)E=\$\!F<FEI+F-O;0\`\`");'

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

Reply via email to