Hi. :-)
I've created a small and fast patch for THIS:
In another another mail I described the problem, that I found no
solution
to load mappings from a JAR-File while "database.xml" is stored in a
separate directory.
example:
%APP_PATH%\cfg\database.xml
%APP_PATH%\lib\packed-app.jar /*containing classes and mapping-files*/
The important contents of "database.xml" were:
[...]
<mapping href="bin\de\luis\core\ri\auth\mapping.xml"/>
<mapping href="bin\de\luis\core\ri\contact\mapping.xml"/>
<mapping href="bin\de\luis\erp\ri\kwb\mapping.xml"/>
[...]
Using the patch, mentioned below, you can write:
[...]
<mapping href="de\luis\core\ri\auth\mapping.xml"/>
<mapping href="de\luis\core\ri\contact\mapping.xml"/>
<mapping href="de\luis\erp\ri\kwb\mapping.xml"/>
[...]
The new path syntax now can be use with mappings stored in JAR-Files,
while the datbase.xml ist stored anywhere else.
The patch is very simple and my module tests were successfull.
But I have not tested, if there can be any side effects.
I'm sure, that this code has not the quality expected in this
context and would like the castor community to optimize this ;-)
The modified class is "org.exolab.castor.mapping.Mapping",
the only modified method is "loadMappingInternal(String)"):
""
private void loadMappingInternal( String url )
throws IOException, MappingException
{
InputSource source;
/* <CN001-PI (Change for jar'ed luis distributions)> */
ClassLoader cl = Thread.currentThread().getContextClassLoader();
java.io.InputStream is = cl.getResourceAsStream(url);
/* </CN001> */
try {
source = _resolver.resolveEntity( null, url );
if ( source == null )
{
/* <CN001-PI (Change for jar'ed luis distributions)> */
if ( is != null )
source = new InputSource(is);
else
source = new InputSource( url );
/* </CN001> */
}
if (source.getSystemId() == null)
source.setSystemId(url);
if ( _logWriter != null )
ogWriter.println( Messages.format( "mapping.loadingFrom", url ) );
loadMappingInternal( source );
} catch ( SAXException except ) {
throw new MappingException( except );
}
}
""
-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev