Discussion:
[Middlegen-user] User of Fully Qualified class names.
Dries De Moor
2004-03-19 15:40:13 UTC
Permalink
Hello,

I starte to expirment with MiddleGen this week. The first thing I'm looking at is the generation of Beans etc.
The problem I'm having can be focused on the use of fully qualified names.
In the generated files you use the fully qualified name of interfaces, util classes but you really don't know the package for it.

I'll explain.
This is the middlegen part in my build.xml file
<middlegen
appname="${name}"
prefsdir="${middlegen}"
gui="true"
databaseurl="${database.url}"
initialContextFactory="${java.naming.factory.initial}"
providerURL="${java.naming.provider.url}"
datasourceJNDIName="${datasource.jndi.name}"
driver="${database.driver}"
username="${database.userid}"
password="${database.password}"
schema="${database.schema}"
catalog="${database.catalog}"
<cmp20
destination="${packages}"
package="be.ddm.projectmanagement.beans.entity"
jndiprefix="ejb"
pkclass="false"
dataobject="false"
valueobject="false"
sessionfacade="true"
viewtype="local"
mergedir="${basedir}/src/middlegen"
readonly="false"
fkcmp="true"
guid="true">

<sequenceblock
package="be.ddm.projectmanagement.beans.entity"
blocksize="5"
retrycount="2"
table="idmanager"/>
<jboss/>
</cmp20>
</middlegen>

Th entity beans are generate in the package be.ddm.projectmanagement.beans.entity. But in every ejbCreate method of the entity beans there is a reference to the SequenceBean Local interface: being: be.ddm.projectmanagement.beans.entity.interfaces

But I generate the the interfaces in be.ddm.projectmanagement.beans.interfaces

<target name="gen_interfaces">
<taskdef
name="ejbdoclet"
classname="xdoclet.modules.ejb.EjbDocletTask"
classpathref="lib.class.path"/>

<ejbdoclet
destdir="${packages}"
excludedtags="@version,@author"
ejbspec="2.0">

<fileset dir="${packages}">
<include name="**/beans/entity/*Bean.java"/>
<exclude name="**/beans/session/*Bean.java"/>
<exclude name="**/beans/sessionfacades/*FacadeEJB.java"/>
</fileset>

<localinterface>
<packageSubstitution packages="entity" substituteWith="interfaces"/>
</localinterface>

<localhomeinterface>
<packageSubstitution packages="entity" substituteWith="interfaces"/>
</localhomeinterface>

<remoteinterface>
<packageSubstitution packages="entity" substituteWith="interfaces"/>
</remoteinterface>
<homeinterface>
<packageSubstitution packages="entity" substituteWith="interfaces"/>
</homeinterface>
</ejbdoclet>
</target>

Middlegen is assuming things which can change when generating ejb interfaces, util classes. So we gave to manual change the code.
Is there a solution to this?
An other issue for me is the use of these fully qualified names. java.lang.String, etc. Is it possible to avoid this by setting some property?

BTW: I cannot download the source code of Middlegen I always end up on the binaries.


thanks a lot,


Dries De Moor
Eivind Waaler
2004-03-22 06:11:00 UTC
Permalink
Hi,

Seems you're not using the "interfacepackage" attribute in the <cmp20>
task:

<cmp20
destination="${build.gen-src.dir}"
package="${name}.ejb"
interfacepackage="${name}.interfaces"
jndiprefix="${unique.name}"
...

Currently to get the sourccode you have to checkout from cvs:
http://sourceforge.net/cvs/?group_id=36044

Cheers
.eivind
Post by Dries De Moor
Hello,
I starte to expirment with MiddleGen this week. The first thing I'm looking at is the generation of Beans etc.
The problem I'm having can be focused on the use of fully qualified names.
In the generated files you use the fully qualified name of interfaces, util classes but you really don't know the package for it.
I'll explain.
This is the middlegen part in my build.xml file
<middlegen
appname="${name}"
prefsdir="${middlegen}"
gui="true"
databaseurl="${database.url}"
initialContextFactory="${java.naming.factory.initial}"
providerURL="${java.naming.provider.url}"
datasourceJNDIName="${datasource.jndi.name}"
driver="${database.driver}"
username="${database.userid}"
password="${database.password}"
schema="${database.schema}"
catalog="${database.catalog}"
<cmp20
destination="${packages}"
package="be.ddm.projectmanagement.beans.entity"
jndiprefix="ejb"
pkclass="false"
dataobject="false"
valueobject="false"
sessionfacade="true"
viewtype="local"
mergedir="${basedir}/src/middlegen"
readonly="false"
fkcmp="true"
guid="true">
<sequenceblock
package="be.ddm.projectmanagement.beans.entity"
blocksize="5"
retrycount="2"
table="idmanager"/>
<jboss/>
</cmp20>
</middlegen>
Th entity beans are generate in the package be.ddm.projectmanagement.beans.entity. But in every ejbCreate method of the entity beans there is a reference to the SequenceBean Local interface: being: be.ddm.projectmanagement.beans.entity.interfaces
But I generate the the interfaces in be.ddm.projectmanagement.beans.interfaces
<target name="gen_interfaces">
<taskdef
name="ejbdoclet"
classname="xdoclet.modules.ejb.EjbDocletTask"
classpathref="lib.class.path"/>
<ejbdoclet
destdir="${packages}"
ejbspec="2.0">
<fileset dir="${packages}">
<include name="**/beans/entity/*Bean.java"/>
<exclude name="**/beans/session/*Bean.java"/>
<exclude name="**/beans/sessionfacades/*FacadeEJB.java"/>
</fileset>
<localinterface>
<packageSubstitution packages="entity" substituteWith="interfaces"/>
</localinterface>
<localhomeinterface>
<packageSubstitution packages="entity" substituteWith="interfaces"/>
</localhomeinterface>
<remoteinterface>
<packageSubstitution packages="entity" substituteWith="interfaces"/>
</remoteinterface>
<homeinterface>
<packageSubstitution packages="entity" substituteWith="interfaces"/>
</homeinterface>
</ejbdoclet>
</target>
Middlegen is assuming things which can change when generating ejb interfaces, util classes. So we gave to manual change the code.
Is there a solution to this?
An other issue for me is the use of these fully qualified names. java.lang.String, etc. Is it possible to avoid this by setting some property?
BTW: I cannot download the source code of Middlegen I always end up on the binaries.
thanks a lot,
Dries De Moor
Loading...