Patches item #748970, was opened at 2003-06-04 16:17
Message generated for change (Comment added) made by rkunze
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=536547&aid=748970&group_id=73047
Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Richard Kunze (rkunze)
Assigned to: Richard Kunze (rkunze)
Summary: Improved EJB cartridge
Initial Comment:
Attached is an improved EJB cartridge that provides the following
features above the current EJB cartridge:
- Support for inheritance: If an <<Entity>> or <<Service>> class
extends another class, this is reflected in the generated EJB. If the
super class itself is an <<Entity>> or <<Service>>, the generated
*Bean extends the *BeanInmpl of the super class. In all other
cases, the generated *Bean extends the given super class.
- Support for arbitrary primary key types: If a <<Entity>> class or
any of its super classes has a dependency that is stereotyped as
<<PrimaryKey>>, the provider of that dependency is used as the
primary key type. If no such dependency exists but the class (or a
super class) has a field stereotyped as <<PrimaryKey>>, the type
of this field is used as primary key type. If neither a PK dependency
nor a PK field is found, the primary key type defaults to
"java.lang.String"
- Support for "abstract EJBs": If an <<Entity>> or <<Service>> is
declared abstract in the model, the "@ejb.bean generate" attribute
is set to "false" in the *Bean class. This means that XDoclet will
generate home and component interfaces for this class, but no
deployment descriptor entries.
- Improved support for attributes:
- For attributes that are marked readonly, the setter method is
not exposed to the component interface.
- Non-public attributes are not exposed to the component
interface.
- Attributes marked as both static and read-only are treated as
constants. For each constant, a getter method is created that
returns the initial value of the attribute as defined in the model.
If the constant is public, the getter is exposed on both the
home and component interfaces (i.e. the getter is marked as
"@ejb.interface-method", and an additional ejbHomeGet*()
method is generated). If the constant is stereotyped as
<<EnvEntry>>, an corresponding "@ejb.env-entry" tag is
generated and the getter returns the value of this entry
- Improved support for relations:
- Relation names are constructed based on the model
- Relations of an abstract <<Entity>> are "inherited" by
all derived <<Entity>> classes: For every such relation, a
corresponding get* method and "@ejb.relation" tag is generated
in the derived *Bean class. The only restriction is that the
navigable target of a relation must not be abstract. If it is
abstract, the generator stops with an exception.
- Improved support for operations:
- Non-public operations methods are not exposed on the
interfaces
- Operations declared as both public and static are interpreted as
home methods, i.e. the method name of the generated method is
prefixed with "ejbHome", and the method is marked as
"@ejb.home-method" instead of "@ejb.interface-method"
----------------------------------------------------------------------
>Comment By: Richard Kunze (rkunze)
Date: 2003-07-08 07:49
Message:
Logged In: YES
user_id=785616
Oops, forgot to mention an important caveat...
Note: You need a current version (CVS of 2003-07-04 or later)
of AndroMDA to use the 20030707 version of the cartridge.
The cartridge relies on the "generateEmptyFiles" feature
(see patch #764134) for generating session bean component
and home interfaces based on the "@andromda.ejb.viewType"
tagged value of the <<Service>> class.
The cartridge will probably work with older versions of AndroMDA,
but it will generate empty files for the home/component interfaces
that would not be generated using a current AndroMDA.
I.e., if a <<Service>> class "Foo "has @andromda.ejb.viewType
set to "local", an empty "FooHome.java" and "Foo.java" file is
generated, and if the view type is "remote", then
"FooLocalHome.java" and "FooLocal.java" are empty.
----------------------------------------------------------------------
Comment By: Richard Kunze (rkunze)
Date: 2003-07-08 07:34
Message:
Logged In: YES
user_id=785616
Hello everybody,
Here is a new version of the improved EJB cartridge. New feature:
- Support for value objects. Value objects hold all of an entity
bean's CMP attributes. In addition, a new interface
<Entityname>Attr is generated that defines the accessors
for the bean's CMP fields. This interface is implemented by
the value object and inherited by the component interface.
And of course lots of bug fixes.
----------------------------------------------------------------------
Comment By: Richard Kunze (rkunze)
Date: 2003-06-26 09:59
Message:
Logged In: YES
user_id=785616
Hi nobody :-)
thanks for evaluating my EJB package and for your comments - I think
they are quite valuable. I'd appreciate taking the discussion to one of the
mailing lists, though (preferably andromda-devel, because the patch
messages are sent to this list), because the mailing lists are way more
comfortable for discussions than the web interfaces of the bugtracking
system.
Anyway, here are a few reasons for why I implemented some the things
the way I did.
> the class comments are confusing. I think they should be
> output as they are appear the model
The problem with that is IMO that there are far mor classes in the
generated code than in the model, and all of these classes are documented
by e.g. Javadoc. I think it is confusing to have identical comments on all of
these classes, with no indication of what class is fulfilling what role in the
implementation. This is especially true for the *Bean/*BeanImpl pair, which
doesn't make much sense if you don't know that the *Bean is regenerated
from the model and the *BeanImpl holds manual changes.
Of course, the comment style is very much to my personal taste, and I'm
well aware that others may or may not like it. I think the best solution is
some system that allows users of the cartridge to easily override parts of
a template (e.g. the comments :-) without changing the template itself.
I'm not quite sure how to do this best in velocity, though.
> It would be good to configure the separator used in building
> the table name. Even better, it would be good to base on a
> configurable template. e.g. "T_${class.name}"
Good idea, and this goes along the same lines as I have been thinking
about for overriding parts of the template. The problem with this approach
is, you risk ending up with thousands of little template snippets that are
difficult to understand. Some of the XDoclet modules are a prime example
for this - you can customize pretty much everything, but it's difficult to
find out which template snippet is supposed to override what :-)
But I'll probably end up with something like a set of class specific
templates that override parts of the main template.
> In my template, when there is no role name, I've made the
> CMR fields named the same as the class at the other end
> (with the first letter lower case of course), rather
> than "the<classname>". I think this is a reasonable
> default.
Yes, I think so as well. The problem is, the default names with with "the"
come directly from the model (if you look at EntityBean.vsl, you'll see that
I simply take the target role name here), and I'm not sure what puts them
there. If I could be certain that default relation role names are always
"The<targetname>", I could change the default to be something else. But
as I said, I have no idea where the default is assigned, and I'm reluctant to
change the names based on a guess.
> There are some other issues with my particular model,
> including the fact that I let XDoclet generate value objects
> and include @ejb.value-object tags in the template. I'll think
> about this a bit more before I comment.
Include it as a tagged value on the class in the UML model - all tagged
values that are not handled specifically by the template are copied through
to the java sources.
> I guess these global parameters should belong as tags on the
> model.
Sounds like a good idea to me.
----------------------------------------------------------------------
Comment By: Nobody/Anonymous (nobody)
Date: 2003-06-26 07:43
Message:
Logged In: NO
I have run this cartridge against my model and have the
following comments:
* the class comments are confusing. I think they should be
output as they are appear the model
* It would be good to configure the separator used in building
the table name. Even better, it would be good to base on a
configurable template. e.g. "T_${class.name}"
* In my template, when there is no role name, I've made the
CMR fields named the same as the class at the other end
(with the first letter lower case of course), rather
than "the<classname>". I think this is a reasonable default.
Once again, it would be ideal if the naming convention could
be defined as a pattern.
* Naming convention for foriegn keys: same as above.
* Naming convention for JNDI: same deal.
There are some other issues with my particular model,
including the fact that I let XDoclet generate value objects
and include @ejb.value-object tags in the template. I'll think
about this a bit more before I comment.
I guess these global parameters should belong as tags on the
model.
In general, I think the changes are great.
----------------------------------------------------------------------
Comment By: Richard Kunze (rkunze)
Date: 2003-06-25 09:43
Message:
Logged In: YES
user_id=785616
New version for the improved EJB cartridge. Still very much work in
progress.
Changes to the previous version:
- Tons of bug fixes
- Support for arbitrary super interfaces for the bean component interface:
The bean's component interface extends all interfaces that are realized by
the corresponding <<Entity>> or <<Service>> class in UML.
- Generate home and component interfaces directly because XDoclet gets
confused by the *Bean/*BeanImpl pairs and generates the wrong
inheritance hierarchy, doesn't support multiple super interfaces for a
component interface and cannot properly handle accessors for CMR
relations that are defined on an abstract entity.
- Add support for <<ResourceRef>> dependencies. For every
<<ResourceRef>> class dependency, an "@ejb.resource-ref" class tag is
generated. The name of the referenced resource is the name of the
dependency if given or the unqualified class name of the supplier if the
dependency has no name. Along with the resource-ref tag, a matching
getter to access the dependency is generated.
- Support for the tagged value "@andromda.ejb.generateCMR" on
relations. If this tagged value is set to "false", no CMR xdoclet tags will be
generated for this relation. get/set-Methods are still generated though -
they have to be implemented in the *BeanImpl class.
- Preliminary support for generating SQL scripts to create/drop the
database structure. This is a quick hack to support my current project and
will probably be dropped again in the future because I think Xdoclet is
better at generating that kind of stuff.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=536547&aid=748970&group_id=73047
-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100006ave/direct;at.asp_061203_01/01
_______________________________________________
Andromda-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/andromda-devel