Hi Matthias,

Today I say: Yes, we need true PSMs and AndroMDA will benefit from them!

no doubt anymore ;-) It's true that PSM != UML diagram "view" (what I said before).

Imagine a UML class with attributes, operations and associations.
Imagine what comes out of the mapping: a Java interface with a pair of
getter/setter methods for each attribute, a method for each operation
and a pair of of getter/setter methods for each association. Everything
results in a method! So, instead of writing a template that treats
attributes, operations and associations separately, I wrote a class that
transforms attributes, operations and associations into simple Java
objects that represent methods. A class in the UML model AST is
translated into methods in the Java model AST. See getMethodDataForPSM()
in the following source code:
http://cvs.sourceforge.net/viewcvs.py/andromda/cartridges/andromda-meta/
src/facades/manual/org/andromda/cartridges/meta/metafacades/Attic/Metafa
cadeFacadeLogicImpl.java?rev=1.1.2.6&only_with_tag=V3x_MMD&view=auto

getMethodDataForPSM() returs a Collection of MethodData objects, and
with the following simple template, I could generate the Java
interfaces:

#foreach ( $method in $class.getMethodDataForPSM(false) )

   /**
$method.documentation
    */
    ${method.buildMethodDeclaration(true)};
#end

That's it! The template engine simply spills out method after method
that the mapping class has fabricated. The template need not think about
where the methods came from.

This is the real value of an explicit PSM-AST: It is only one inch above
the code and code generation becomes *really* easy. And the way from PIM
to PSM is (at times) much more clear than from PIM to code.

Are you saying that as long as we don't have the standardized QVT, we should implement our "PSM" in Java like your example above?

Your example above shows a very good example of not doing the logic
in our template (seperation of concerns). Just as if you are doing
"taglibs" instead of "inserting Java codes" in your JSP file
(presentation layer development). IMO, this is great.

In AndroMDA 2.x you can also do this by pushing all the methods
you need into the ScriptHelper, right? It's not as elegant as in
AndroMDA 3.x (metamodel decorators/facades) but it depends on you,
correct?

I'm anyway for pushing everything into the Java codes instead
of doing them in the templates, as we have compile time strong
type check (no runtime error) ;-)

Greets,
--
---------------------------------------------------
Blasius Lofi Dewanto
---------------------------------------------------
OpenUSS - Open University Support System
http://openuss.sourceforge.net
---------------------------------------------------
E-Mail   : [EMAIL PROTECTED]
ICQ      : 39343280
---------------------------------------------------




------------------------------------------------------- This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click _______________________________________________ Andromda-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/andromda-user

Reply via email to