wood burning stoves 2.0*
The moose likes Other JSE/JEE APIs and the fly likes Any open source tools discussed in Java Reflection in Action? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "Any open source tools discussed in Java Reflection in Action?" Watch "Any open source tools discussed in Java Reflection in Action?" New topic
Author

Any open source tools discussed in Java Reflection in Action?

Ko Ko Naing
Ranch Hand

Joined: Jun 08, 2002
Posts: 3178
Hi Dr.Forman,
I just would like to know whether any open source tool is discussed in chapter-7 Code Generation of the book or not... There are a couple of tools out there which we can pick up and use. Do you discuss any of them in the book? Thanks...


Co-author of SCMAD Exam Guide, Author of JMADPlus
SCJP1.2, CCNA, SCWCD1.4, SCBCD1.3, SCMAD1.0, SCJA1.0, SCJP6.0
Nate Forman
author
Ranch Hand

Joined: Jan 20, 2005
Posts: 32
Howdy,

Section 7.8 briefly discusses some of the concepts in Aspect-Oriented Programming (as realized in tools like Aspect/J). However, we don't go into a detailed discussion of the use of such tools or others like Jikes BT and Javassist.

Chapters 7&8 are more about prescribing a way to use reflection to solve problems. To do AOP-style programming, you can use reflection to examine an existing class and then generate another class that has additional capability. We call this class-to-class transformation.

In the book, we present ideas on problems to solve with this technique. We also provide a framework that facilitates performing the up-front examination of the source class, as well as the generation of the result class. Any of the excellent toolkits out there could be used in the way we prescribe in the book, but detailing their use was out of our scope.

When they last came through Austin, I heard one of the Lone Star Symposium (No Fluff Just Stuff) guys do a really interesting talk on generation tools and use cases. (off the top of my head, I'm not sure who--I'll post again if I can find it)

Hope this helps,

Nate


Co-author of <a href="http://www.amazon.com/exec/obidos/ASIN/1932394184/ref=jranch-20" target="_blank" rel="nofollow">Java Reflection in Action</a>
Ko Ko Naing
Ranch Hand

Joined: Jun 08, 2002
Posts: 3178
Originally posted by Nate Forman:
To do AOP-style programming, you can use reflection to examine an existing class and then generate another class that has additional capability. We call this class-to-class transformation.


Thanks a million to your great explanation...

BTW, I have heard about class-to-class transformation from one of my colleagues at work... But I'm wondering if there are any other kinds of transformation else... If so, could you please give us a hints what they are? So that we can find more info later as well...

Thanks...
Nate Forman
author
Ranch Hand

Joined: Jan 20, 2005
Posts: 32
Hi Ko Ko,

My dad's the transformation enthusiast, so I'm going to defer this to him. He'll be available later in the week...

Best Regards,

Nate
Alexandru Popescu
Ranch Hand

Joined: Jul 12, 2004
Posts: 995
When talking about code generation the first thoughts went two ways:
- source code generation (with tools a la XDoclet)
- bytecode generation (excellently applied in aop frameworks, jdo implementations).

However while inspecting the existing classes you can generate your custom metadata model and from here the ways are infinite.

--
./pope
[the_mindstorm]


blog - InfoQ.com
Nate Forman
author
Ranch Hand

Joined: Jan 20, 2005
Posts: 32
Hi Ali,

I've enjoyed your insightful postings.

When you say "custom metadata model," do you refer to MDA (Model Driven Architectures)? I haven't had a chance to do a lot of looking, but people have suggested that there seems to be potential synergy between that and reflection. Care to comment?

Best Regards,

Nate
Alexandru Popescu
Ranch Hand

Joined: Jul 12, 2004
Posts: 995
The first example that comes to my mind is the project i am currently involved in: TestNG. Using reflection (including annotations related reflection) we are building the testing flow metamodel that is later run according to suites/tests configurations.
As regards bytecode based metamodel I can think of JDO implementations, that are instrumenting according the persistent classes.

--
./pope
[the_mindstorm]
Ko Ko Naing
Ranch Hand

Joined: Jun 08, 2002
Posts: 3178
Originally posted by Nate Forman:
When you say "custom metadata model," do you refer to MDA (Model Driven Architectures)? I haven't had a chance to do a lot of looking, but people have suggested that there seems to be potential synergy between that and reflection. Care to comment?


Oh... I have no idea about both the custom metadata model and Model Driven Architectures that u guys are talking about here... Could anyone of you shed a light on me for these things?

But I know that MDA is from OMG and it is kinda abstract system model and so and so... But I can't figure out the custom metadata model that Ali talked about is somehow related to the MDA... Thanks...
Alexandru Popescu
Ranch Hand

Joined: Jul 12, 2004
Posts: 995
Here you can read an intro to MDA.
While my answer was not directly referring to MDA, I can probably see some usages out there .

--
./pope
[the_mindstorm]
Ira Forman
author
Greenhorn

Joined: Jan 25, 2005
Posts: 2
Let me follow-up on class-to-class transformations. There are many difference kinds of program transformations (for example, common expression elimination is one). However, I am especially interested in transformations that take a whole class and return a new class that has new property; this is a class-to-class transformation. Achieving class-to-class transformation is the way to modularize the properties that OO programers talk about (for example, persistent, atomic, and so on). This is one of the goals of AOP. This modularization may be achieved in many ways: with a new language (AspectJ), with bytecode manipulation (JBOSS does this), with metaclasses ("Putting Metaclasses to Work"), or through program generation (Chapters 7 and 8 of "Java Reflection in Action").


Ira Forman<br />Co-author of <a href="http://www.amazon.com/exec/obidos/ASIN/1932394184/ref=jranch-20" target="_blank" rel="nofollow">Java Reflection in Action</a>
Alexandru Popescu
Ranch Hand

Joined: Jul 12, 2004
Posts: 995
Ira, AspectJ and AspectWerkz are doing in background bytecode manipulation too.

--
./pope
[the_mindstorm]
Ko Ko Naing
Ranch Hand

Joined: Jun 08, 2002
Posts: 3178
Originally posted by Ira Forman:
Let me follow-up on class-to-class transformations. There are many difference kinds of program transformations (for example, common expression elimination is one). However, I am especially interested in transformations that take a whole class and return a new class that has new property; this is a class-to-class transformation. Achieving class-to-class transformation is the way to modularize the properties that OO programers talk about (for example, persistent, atomic, and so on). This is one of the goals of AOP. This modularization may be achieved in many ways: with a new language (AspectJ), with bytecode manipulation (JBOSS does this), with metaclasses ("Putting Metaclasses to Work"), or through program generation (Chapters 7 and 8 of "Java Reflection in Action").


Thank you very much for your most informative explanation to me about other transformations...

So now I can see that those other transformation are available in the modularizations that were listed above... I never know that before... Thanks a lot...
Alexandru Popescu
Ranch Hand

Joined: Jul 12, 2004
Posts: 995
Originally posted by Ira Forman:
[...] with bytecode manipulation (JBOSS does this)[...]


What part of JBoss are you referring to?

--
./pope
[the_mindstorm]
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
Originally posted by Ali Pope:
What part of JBoss are you referring to?

The EJB container, if I remember correctly.


Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
Alexandru Popescu
Ranch Hand

Joined: Jul 12, 2004
Posts: 995
Weird. Why should the ejb container do bytecode manipulation? Afaik they are using some interceptors that are proxy-based solution. Maybe the 4.0 series is doing bytecode manipulation, but i cannot comment on this - never had the time to dig into it.

--
./pope
[the_mindstorm]
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
Originally posted by Ali Pope:
Weird. Why should the ejb container do bytecode manipulation? Afaik they are using some interceptors that are proxy-based solution.

Here's a quote from Bill Burke's article:
JBoss AOP does bytecode manipulation to attach interceptors

And I think I remember JBoss 3.x doing bytecode manipulation as well, even before the birth of JBoss AOP.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Any open source tools discussed in Java Reflection in Action?
 
Similar Threads
UML to XML Schema Tools ?
SCJD is the worthless lazy bum of the family?
logging and auditing
reports in swing
What tools are discussed?