Hi,
I am still pursuing the idea of loading cayenne configuration files from
different locations. I need an advice on how to load mapping files from
different location other then the same location as cayenne.xml.
I am looking at the source code (Configuration, DefaultConfiguration,
RuntimeLoadDElegate, ResourceLocator,...) and did't just figured it out.
I have project-model1 with:
cayenne.xml
my-map-1.map.xml
and some data object classes
and project-model2 with
cayenne.xml
my-map-2.map.xml
and some data object classes.
Now in my web project I need data objects from both JARs (project-model1.jar
and project-model2.jar). The web project has "manually crafted" cayenne.xml
which is read by
DefaultConfiguration conf = new
DefaultConfiguration("my-manually-crafted-cayenne.xml");
Configuration.initializeSharedConfiguration(conf);
my-manually-crafted-cayenne.xml looks like:
<?xml version="1.0" encoding="utf-8"?>
<domains project-version="3.0.0.1">
<domain name="MyDomain">
<map name="my-map-1" location="my-map-1.map.xml"/>
<map name="my-map-2" location="my-map-2.map.xml"/>
<node name="my-map-1Node"
datasource="dbcp-1.properties"
factory="org.apache.cayenne.conf.DBCPDataSourceFactory">
<map-ref name="my-map-1"/>
</node>
<node name="my-map-2Node"
datasource="dbcp-2.properties"
factory="org.apache.cayenne.conf.DBCPDataSourceFactory">
<map-ref name="my-map-2"/>
</node>
</domain>
</domains>
Question is: Can ResourceLocator be configured to read mapping files
my-map-1.map.xml and my-map-2.map.xml from the root of project-model1.jar
and project-model2.jar?
The DefaultConfiguration read from classpath, but it seems it does not find
mapping files inside the JARs (at root of it).
Thanks for tips,
Borut
This archive was generated by hypermail 2.0.0 : Tue Feb 16 2010 - 07:39:30 EST