Jason Essington
2002-08-28 16:46:03 UTC
Aslak what a great tool, thanks!
Everyone, for discussion:
I am trying to divide my tables (actually their generated beans) into
multiple packages that represent their real purpose in life.
currently I have an ejb.entity and an ejb.reporting.entity package and I
am sure I'll have more as I go on.
So here is what I have found:
I can't use multiple <cmp20> elements in the build.xml file as the name=
attribute doesn't seem to take effect until too late and middlegen
assumes both have a name of cmp20 then fails.
I did work around this by creating multiple <plugin> references in the
plugins/entitybean/classes/META-INF/middlegen.xml file that just had
different name attributes. This allowed me to acces the cmp20 plugin as
<cmp20> , <cmp20-2>, etc. Then used embeded <fileproducer> with embeded
<table> tags to limit which plugin produced which tables.
This works but of course in the gui you are presented with 2 plugin tabs
and when a table is selected you are allowed to set its properties in
each tab weather or not that plugin is going to generate the file for
the table. This isn't currently an issue for me as I am only generating
beans from say 14 tables, but when my table count gets too much over 50
tables and I am trying to put the resulting beans into 3 or more
packages, my brain won't be able to remember which tab I should be
setting the properties on.
Would it be possible to for a plugin to check which tables the it is
actually going to generate files for, and only display(allow the editing
of) information on its gui tab for tables it is actually going to
generate a file for?
Or, perhaps, there would be value in making multiple <fileproducer>
elements inside the <cmp20> element that could override many of the
attributes that are currently set in the cmp20 element (package,
interfacepackage, jndiprefix, etc). This would allow the plugin to
define several fileproducers to write the beans out to different
packages, or different jndi contexts, or whatever. This would also leave
only 1 tab in the gui for this plugin thus reducing the possiblity of
configuring a table in a tab that isn't going to produce a file for it
anyway.
for instance if I wanted some of my tables generated into the
.ejb.reporting.entity package but others in the .ejb.entity package.
something like this could be done.
<cmp20
name="cmpEntityBeans"
destination="${build.gen-src.dir}"
package="${name}.ejb.entity"
interfacepackage="${name}.ejb.local"
jndiprefix="ejb"
generatepk="false"
dataobject="true"
viewtype="local"
mergedir="${basedir}/src/middlegen"
readonly="false"
fkcmp="true"
<!-- this fileproducer would just use the values from the
cmp20 element (current behavior)-->
<fileproducer
id="entity-cmp-20"
template="${template.dir}/entity-cmp-20.vm"
<table name="tclients"/>
<table name="tcodes"/>
</fileproducer>
<!-- multiple fileproducers are not currently possible, nor
is overriding attributes of the parent plugin element -->
<!-- but this fileproducer overrides package,
interfacepackage, and jndiprefix -->
<fileproducer
id="entity-cmp-20"
template="${template.dir}/entity-cmp-20.vm"
package="${name}.ejb.reporting.entity"
interfacepackage="${name}.ejb.reporting.local"
jndiprefix="ejb/reporting"
<table name="treportbatches"/>
<table name="treportcmds"/>
</fileproducer>
</cmp20>
Maybe I am trying to do something that has no value to anyone else, or
maybe there is a better way to do this altogether.
-jason
Everyone, for discussion:
I am trying to divide my tables (actually their generated beans) into
multiple packages that represent their real purpose in life.
currently I have an ejb.entity and an ejb.reporting.entity package and I
am sure I'll have more as I go on.
So here is what I have found:
I can't use multiple <cmp20> elements in the build.xml file as the name=
attribute doesn't seem to take effect until too late and middlegen
assumes both have a name of cmp20 then fails.
I did work around this by creating multiple <plugin> references in the
plugins/entitybean/classes/META-INF/middlegen.xml file that just had
different name attributes. This allowed me to acces the cmp20 plugin as
<cmp20> , <cmp20-2>, etc. Then used embeded <fileproducer> with embeded
<table> tags to limit which plugin produced which tables.
This works but of course in the gui you are presented with 2 plugin tabs
and when a table is selected you are allowed to set its properties in
each tab weather or not that plugin is going to generate the file for
the table. This isn't currently an issue for me as I am only generating
beans from say 14 tables, but when my table count gets too much over 50
tables and I am trying to put the resulting beans into 3 or more
packages, my brain won't be able to remember which tab I should be
setting the properties on.
Would it be possible to for a plugin to check which tables the it is
actually going to generate files for, and only display(allow the editing
of) information on its gui tab for tables it is actually going to
generate a file for?
Or, perhaps, there would be value in making multiple <fileproducer>
elements inside the <cmp20> element that could override many of the
attributes that are currently set in the cmp20 element (package,
interfacepackage, jndiprefix, etc). This would allow the plugin to
define several fileproducers to write the beans out to different
packages, or different jndi contexts, or whatever. This would also leave
only 1 tab in the gui for this plugin thus reducing the possiblity of
configuring a table in a tab that isn't going to produce a file for it
anyway.
for instance if I wanted some of my tables generated into the
.ejb.reporting.entity package but others in the .ejb.entity package.
something like this could be done.
<cmp20
name="cmpEntityBeans"
destination="${build.gen-src.dir}"
package="${name}.ejb.entity"
interfacepackage="${name}.ejb.local"
jndiprefix="ejb"
generatepk="false"
dataobject="true"
viewtype="local"
mergedir="${basedir}/src/middlegen"
readonly="false"
fkcmp="true"
<!-- this fileproducer would just use the values from the
cmp20 element (current behavior)-->
<fileproducer
id="entity-cmp-20"
template="${template.dir}/entity-cmp-20.vm"
<table name="tclients"/>
<table name="tcodes"/>
</fileproducer>
<!-- multiple fileproducers are not currently possible, nor
is overriding attributes of the parent plugin element -->
<!-- but this fileproducer overrides package,
interfacepackage, and jndiprefix -->
<fileproducer
id="entity-cmp-20"
template="${template.dir}/entity-cmp-20.vm"
package="${name}.ejb.reporting.entity"
interfacepackage="${name}.ejb.reporting.local"
jndiprefix="ejb/reporting"
<table name="treportbatches"/>
<table name="treportcmds"/>
</fileproducer>
</cmp20>
Maybe I am trying to do something that has no value to anyone else, or
maybe there is a better way to do this altogether.
-jason