Re: Plastic: An ASM wrapper for Tapestry 5.3

Howard Lewis Ship <[email protected]>
Newsgroups gmane.comp.java.objectweb.asm
Message-ID <[email protected]>
On Thu, Apr 21, 2011 at 1:14 PM, Paul Hammant <[email protected]> wrote:
> Hi Howard,
> Is Plastic a separate project to Tapestry?
> I've done similar things, but aimed for them to be reusable by more than
> just me.  http://paranamer.codehaus.org/
> Maybe Plastic could spun out if not already?  Github's a great place FYI ;-)
> Also, a bunch of ThoughtWorkers and friends did a wrapper around CGLib for
> pattern retrofitting to classes called ProxyToys that sounds a little like
> what you're talking about :- http://proxytoys.codehaus.org/
> Regards,

Actually, Plastic started as a private GitHub project and went the
other direction ... it's evolving quickly meeting the demands for its
intended purpose (Tapestry IoC proxies and component class
transformation) ... but I'm expended every effort to ensure that it
has no real dependency on Tapestry (beyond the package name).

Having Plastic  co-located with the rest of the Tapestry code base
makes it much easier to evolve them quickly, together.  Certainly,
some shortcuts and presumptions I made earlier were quickly identified
and fixed once I did "real work" replacing the existing code in
Tapestry with Plastic ... especially, some things related to how the
many different class loaders in a Tapestry application are layered and
work together.


> - Paul
>
> On Thu, Apr 21, 2011 at 2:59 PM, Howard Lewis Ship <[email protected]> wrote:
>>
>> I'm not sure how many of you are aware of Tapestry
>> (http://tapestry.apache.org/) ... it's a sophisticated Java web
>> application framework.  At its core, it does some sophisticated
>> meta-programming on Java classes, transforming them at load time to
>> give them a number of new capabilities and such. This has built up in
>> Tapestry 5 over the last few years, using a wrapper around Javassist.
>>
>> However, Javassist is poorly documented, supported and maintained.
>> It's also repeatedly caused problems with code compiled for JDK 1.6.
>> Several months ago, I decided to see if I could port my highest level
>> abstractions from Javassist to ASM (in fact, the move to higher
>> abstractions goes back a year or more).
>>
>> The result is Plastic.  Plastic is a layer on top of ASM.  It entirely
>> hides the ASM APIs.
>>
>> The JavaDoc is here (from Tapestry's continuous integration build):
>>
>>
>> https://builds.apache.org/hudson/job/tapestry-trunk-freestyle/ws/trunk/build/documentation/javadocs/org/apache/tapestry5/plastic/package-summary.html
>>
>> (start with PlasticManager and PlasticClass)
>>
>> Plastic is used in two ways:
>>
>> 1) To create new objects, typically proxy objects implementing one or
>> more interfaces
>>
>> 2) To instrument existing code, modifying its implementation
>> incrementally as classes are individually loaded
>>
>> In most cases, you add behavior by introducing new interfaces and new
>> methods and by applying advice to existing methods.  For fields you
>> may inject values into the field, or outright replace access to the
>> field with delegation through a supplied FieldConduit.
>>
>> You also get efficient access to methods, regardless of visibility,
>> via MethodHandle, as well as efficient access to fields (which are
>> required to be private) via FieldHandle.
>>
>> Finally, there's a nice DSL, InstructionBuilder, used for providing
>> the implementation of a method directly.
>>
>> Although Plastic is part of Tapestry, it is entirely usable outside of
>> Tapestry; it's a sub-project of Tapestry with no dependencies (it even
>> uses a repackaged copy of the ASM 3.3.1 source).  Tapestry 5.3,
>> including Plastic, is currently in an alpha state.
>>
>> I'm generally quite pleased with how Plastic has come out, and I'd
>> like to share it with others with a similar interest.
>>
>> Tapestry's inversion-of-control layer uses Plastic to generate various
>> kinds of proxies, to handle everything from just-in-time
>> initialization, to more advanced design patterns (such as
>> chain-of-command), to crazy stuff such as allowing method invocations
>> to return placeholder objects while computations execute on separate
>> thread.
>>
>> In Tapestry's web layer, Plastic is used for additional types of
>> proxies, and for the property expression language (Tapestry compiles
>> template expressions such "user.name" directly to bytecode for optimal
>> execution).
>>
>> In the next few weeks, I'll be converted the component class
>> transformation part from the Javassist layer to Plastic.
>>
>> I'm very interested in comments and suggestions concerning Plastic.
>>
>> --
>> Howard M. Lewis Ship
>>
>> Creator of Apache Tapestry
>>
>> The source for Tapestry training, mentoring and support. Contact me to
>> learn how I can get you up and productive in Tapestry fast!
>>
>> (971) 678-5210
>> http://howardlewisship.com
>>
>>
>> --
>> You receive this message as a subscriber of the [email protected] mailing list.
>> To unsubscribe: mailto:[email protected]
>> For general help: mailto:[email protected]?subject=help
>> OW2 mailing lists service home page: http://www.ow2.org/wws
>>
>
>



-- 
Howard M. Lewis Ship

Creator of Apache Tapestry

The source for Tapestry training, mentoring and support. Contact me to
learn how I can get you up and productive in Tapestry fast!

(971) 678-5210
http://howardlewisship.com
message-footer.txt (text/plain, 238 B)
-- 
You receive this message as a subscriber of the [email protected] mailing list.
To unsubscribe: mailto:[email protected]
For general help: mailto:[email protected]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.