Ok.
Here's a zip of my relevent template files and a snippet
(build-template.xml) from my build.xml file.
Hopefully everything that's necessary is in there.
However, since I generate more than a dozen different artifacts (only
two of which are included here) from 4 different data map sets, it's
possible I overlooked something.
This generates
com.xyz.entity -- the interface for SomeObject (where you'd add custom
methods). These files will not be overwritten if you run the task
again. creates SomeObject.java
com.xyz.entity.cayenne -- the implementation for SomeObject (where
you'd add custom implementations of those methods). Note that the
interface and Cayenne implementation have the same class name -- only
the package is different. These files will not be overwritten if you
run the task again. creates SomeObject.java
com.xyz.entity.generated -- the interface for SomeObject -- don't
changes these files directly. creates _SomeObject.java
com.xyz.entity.cayenne.generated -- the cayenne implementation for
SomeObject -- don't changes these files directly. These files are in
the form of SomeObjectImpl. Creates _SomeObjectImpl.java
The "entity stubs" task will create non-cayenne "temporary"
implementations of the objects. Probably not all that useful to you,
but I do intermediate work in these objects which can persist across
multiple requests, and then create Cayenne objects out of them right
before I commit the changes in my web applications.
com.xyz.entity.stub -- the stub implementation for SomeObject.
These files will not be overwritten if you run the task again.
com.xyz.entity.stub.generated -- the stub implementation for
SomeObject -- don't changes these files directly.
On 2/9/06, Gary Jarrel <garyjarre..mail.com> wrote:
> Mike,
>
> Thank you very much for you help, if making your working tasks
> available is not too much trouble, I would love to have a look at
> them!
>
> Thank you again!
>
> Gary
>
> On 2/10/06, Mike Kienenberger <mkienen..mail.com> wrote:
> > Gary,
> >
> > I've got working tasks that create interfaces.
> > I could probably make them available if you like, although they also
> > add in vertical inheritance stuff by overloading some of the multitier
> > client attributes.
> >
> > As for your specific questions, you need to use makepairs=false and
> > usepkgpath=false. You're trying to make the default behavior do
> > something it was not intended to support.
> >
> > Here's the build targets I use. "entity" creates the interfaces and
> > cayenne implementation. "stubs" creates POJO non-persisted
> > implementations.
> >
> > <target name="entity" depends="failure check"
> > description="internal:generate entity">
> > <mkdir dir="${dataMapModelPackageDir}/entity"/>
> > <cgen map="${template.datamap}"
> > additionalMaps="${additional.template.datamaps}"
> > version="1.2"
> > makepairs="false"
> > overwrite="false"
> > mode="entity"
> > destDir="${dataMapModelPackageDir}/entity"
> > superpkg="${dataMapModelPackage}.entity.cayenne.generated"
> > template="${template.subclass.interface}"
> > usepkgpath="false">
> > </cgen>
> > <mkdir dir="${dataMapModelPackageDir}/entity/generated"/>
> > <cgen map="${template.datamap}"
> > additionalMaps="${additional.template.datamaps}"
> > version="1.2"
> > makepairs="false"
> > overwrite="true"
> > mode="entity"
> > outputPattern="_*.java"
> > destDir="${dataMapModelPackageDir}/entity/generated"
> > superpkg="${dataMapModelPackage}.entity.cayenne.generated"
> > template="${template.superclass.interface}"
> > usepkgpath="false">
> > </cgen>
> > <mkdir dir="${dataMapModelPackageDir}/entity/cayenne"/>
> > <cgen map="${template.datamap}"
> > additionalMaps="${additional.template.datamaps}"
> > version="1.2"
> > makepairs="false"
> > overwrite="false"
> > mode="entity"
> > destDir="${dataMapModelPackageDir}/entity/cayenne"
> > superpkg="${dataMapModelPackage}.entity.cayenne.generated"
> > template="${template.subclass}"
> > usepkgpath="false">
> > </cgen>
> > <mkdir dir="${dataMapModelPackageDir}/entity/cayenne/generated"/>
> > <cgen map="${template.datamap}"
> > additionalMaps="${additional.template.datamaps}"
> > version="1.2"
> > makepairs="false"
> > overwrite="true"
> > mode="entity"
> > outputPattern="_*Impl.java"
> > destDir="${dataMapModelPackageDir}/entity/cayenne/generated"
> > superpkg="${dataMapModelPackage}.entity.cayenne.generated"
> > template="${template.superclass}"
> > usepkgpath="false">
> > </cgen>
> > </target>
> >
> > <target name="entity stub" depends="failure check"
> > description="internal:generate entity">
> > <mkdir dir="${dataMapModelPackageDir}/entity/stub/generated"/>
> > <cgen map="${template.datamap}"
> > additionalMaps="${additional.template.datamaps}"
> > version="1.2"
> > makepairs="false"
> > overwrite="true"
> > mode="entity"
> > outputPattern="_*StubImpl.java"
> > destDir="${dataMapModelPackageDir}/entity/stub/generated"
> > superpkg="${dataMapModelPackage}.entity.cayenne.generated"
> > template="${template.superclass.stub}"
> > usepkgpath="false">
> > </cgen>
> > <mkdir dir="${dataMapModelPackageDir}/entity/stub"/>
> > <cgen map="${template.datamap}"
> > additionalMaps="${additional.template.datamaps}"
> > version="1.2"
> > makepairs="false"
> > overwrite="false"
> > mode="entity"
> > outputPattern="*StubImpl.java"
> > destDir="${dataMapModelPackageDir}/entity/stub"
> > superpkg="${dataMapModelPackage}.entity.cayenne.generated"
> > template="${template.subclass.stub}"
> > usepkgpath="false">
> > </cgen>
> > </target>
> >
> > On 2/9/06, Gary Jarrel <garyjarre..mail.com> wrote:
> > > Hi All!
> > >
> > > I'm using the cgen ant task to generate interfaces using the map for a
> > > particular cayenne project.
> > >
> > > I'm generating a pair of interface (as I've seen discussed on this
> > > list) i.e IFooInterface and I_FooInterface. Hence I'm using the
> > > makepairs=true and usepkgpath=true. I'm also setting a custom package
> > > for the super interface using superpkg. This custom package and hence
> > > custom directory is different to that used by the generated cayenne
> > > super classes
> > >
> > > The problem is sub interface get generated into the same folder as the
> > > standard cayenne sub classes, and I can't see an easy way to modify
> > > the directory into which these interface are generated, as it appears
> > > cgen reads the package name from the map file, and builds the
> > > directory structure accordingly. Is there a way to modify this
> > > behaviour?
> > >
> > > Thankyou for you help!
> > >
> > > Gary
> > >
> >
>
This archive was generated by hypermail 2.0.0 : Fri Feb 10 2006 - 11:32:17 EST