Craig,
Here is a few ideas.
1. Your model generator may fit into Cayenne as a new Ant task. We
already have a frontend for DbGenerator [1]. Yours will be
complimentary to cdbgen. Does anyone know how much trouble it is to
accept small (2-3 Java classes) donations @Apache? Hope this doesn't
have to go through the Incubator.
2. For now you may keep it either on sourceforge or in your own
repository - whatever is convenient to you.
3. An improvement suggestion - take a look at 1.2 AutoAdapter. By
using AutoAdapter you won't need to hardcode Cayenne adapter in the
code. The correct adapter will be determined dynamically in runtime.
[1] http://objectstyle.org/confluence/display/CAYDOC/cdbgen
Andrus
On Apr 8, 2006, at 7:47 AM, Craig Turner wrote:
Andrus and Mike, thanks for your help with this. I've now got a
simple implementation working. I've put a tar.gz of the work I've
done up at
http://203.15.93.19/GenerateModelTool.tar.gz
(2.6MB, including scripts, pgsql driver and cayenne1.1M12 jar)
It's far from mature:
- Project isn't using ant yet, just a simple build script
- I want to generate the XML using jdom rather than PrintWriter :)
- I want to add command-line options to have the user set the
package for the entities
- I'd like to add support for Properties file configuration
- I'd like to write a wrapper object so that it can be launched
from java with simple configuration to a single class rather than
from the command-line
I wanted to get something working so that I could then ask the list
where to go next and that's where it's at. Would there be interest
to move this tool into the project, and if so would one of the
developers indicate how to move forwards with this?
If not then I'd like to set this up as a distinct tool administered
out of my firm or sourceforge. Does anyone have strong feelings
about things I could improve about this, or what the boundaries
should be for a well-rounded tool of this type?
Mike Kienenberger wrote:
On 4/4/06, Andrus Adamchik <[EMAIL PROTECTED]> wrote:
Everything in Cayenne can be assembled via API. So you'd go about
assembling Cayenne stack in the following order:
* create DefaultConfiguration
* add DataDomain
* add DataNode
* add DataMap (using org.objectstyle.cayenne.access.DbLoader to
create it from DB on the fly)
Also since a generic DataObject class is supported, this will even
work in Java:
http://objectstyle.org/confluence/display/CAYDOC/Generic+Persistent
+Class
Andrus, I think he's asking about how to create the xml config
files. So he'd need to do everything above, and then call some
kind of xml
writer (probably a class in modeler.jar) to save it all back out as
xml. He'd probably also want to do the "sync to ObjEntity" stuff as
well to create the ObjEntities.
Craig, I don't know how "straightforward" it would be, but the
modeler
project should contain everything you need. You'd just call the
java
"work" methods directly instead of going through the swing callbacks.