> On Jan 8, 2017, at 10:40 AM, Andrus Adamchik <and...@objectstyle.org> wrote:
> 
>> 
>> I'm also viewing this as a separate XML file.  One that wouldn't need to be
>> deployed, although it wouldn't hurt if present.  Nothing in it is required
>> for runtime support, unlike the main model.  Everything is class-generation
>> extensions only.
> 
> This definitely has merit. Lazy loading of all this metadata (i.e. skipping 
> it in runtime) is a good idea. But we need to make sure this file is fully 
> integrated in Cayenne project model and toolchain and can be loaded on-demand 
> from anywhere, not just the Modeler.
> 
> Also we need to look at the bigger picture here. We want to be able to add 
> and manage extra project files for many different reasons. I have this list 
> for now:
> 
> 1. cgen-related metadata - this discussion.
> 2. cgen custom templates - makes sense to keep them in the project and in 
> version control together with Cayenne XML files.
> 3. cdbimport filters and settings - currently this is configured inside the 
> build system (pom.xml, etc.), but I'd really like to move it to the Cayenne 
> project (and make it editable in the Modeler).
> 
> So a generic mechanism for referencing and managing extra files with the 
> project (lazy-loading, saving, etc.) is a prerequisite to implementing the 
> above.

On the XML side, I guess we should start using all the standard XML machinery 
to enable extensions. Namely namespaces and entity includes. This should clean 
up the format, allowing to split the overall model into multiple files, and 
cleanly separate pieces handled by different Cayenne "plugins". E.g.:

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE doc [
    <!ENTITY metadata SYSTEM "cgenmstuff.xml">
]>
<data-map xmlns="http://cayenne.apache.org/schema/9/modelMap";
          xmlns:cdbi="http://...."; 
          xmlns:cgenm="http://....";
          project-version="9">

    <!-- Including metadata file as an entity -->
    &metadata

    <!-- Including cdbimport filter inline -->
    <cdbi:filter>
        <cdbi:catalog>mydb</cdbi:catalog>
    </cdbi:filter>

    <db-entity name="TABLE1">
       <!-- Including comments inline -->
       <cgenm:comment>DB comment</cgenm:comment>
       <db-attribute name="ID" type="INTEGER" isPrimaryKey="true" 
isMandatory="true"/>
    </db-entity>
    ...
</data-map>

Andrus

Reply via email to