This one time, at band camp, Alexey A. Efimov said:

AAE>I've done this in the past, but not with Castor's descriptor files.
AAE>Here's how I grabbed an XML file out of jar file:
AAE>
AAE>    URL url = null;
AAE>    ...
AAE>    url = this.getClass().getClassLoader().getSystemResource( XML );
AAE>    System.out.println( "URL = " + url );
AAE>
AAE>The println above then outputs the following URL: 
AAE>
AAE>    URL = jar:file:/home/bsnyder/java/cptest/dist/cptest.jar!/user.xml
AAE>
AAE>Mapping#loadMapping() is overloaded to accept a java.net.URL as a
AAE>parameter, but I'm not sure that it can handle the syntax above (where
AAE>the XML descriptor is inside the jar file - notice the bang(!)). It's
AAE>still a valid java.net.URL...
AAE>
AAE>Keith, Aranud, can one of you guys answer this?

I'm going to answer my own question here. Castor can, in fact, load
mapping descriptors from within jar files just fine. At my day job we
actually put the mapping descriptors in jar files. I wasn't aware of
this until today. We locate the mapping descriptor in the CLASSPATH and
then pass on the java.net.URL to Mapping#loadMapping(). Here is the URL
when it locates a mapping descriptor:

    Loading mapping descriptors from
    
jar:file:/home/bsnyder/ltp/phase4/rt/ltp-rt/lib/LTP.jar!/com/digitalglobe/mp/order/spec/ECEFTaskingSpec.xml

HTH. 

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