You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by "Mark R. Diggory" <md...@latte.harvard.edu> on 2005/03/10 20:20:09 UTC

Re: [jelly] "Implement" taglib

Hmm, I hadn't heard of JDK 1.3 Proxies before this point. This does 
sound very interesting to me, although I'm not a Jelly Commiter. I'd 
like to know more about it. I implemented my own sort of extensibility 
for some of my tags using BSF/BCEL. I'd be interested in knowing more on 
how you approached your solution.

<bcel:class name="foo" implements="bar" extends="bam">
    <bcel:property name="test" type="java.lang.String" read="true" 
write="true"/>
    <bcel:method name="test2" returns="java.lang.String" 
arg0="java.lang.String" arg1="int" language="javascript">
       /*some bsf script to handle the contents */
       arg0 + "=" + arg1;
    </bcel:method>
</bcel:class>

Basically it uses BCEL to generate a BSF Interpreter that evaluates the 
body of the method. Then a class generated in Jelly can be used 
externally if it was saved to file or exported onto the classpath. I've 
launched my project seperately on Sourceforge.

Mark Diggory
http://www.sourceforge.net/projects/repast-jellytag
http://thedata.sourceforge.net

Eric Galluzzo wrote:

>Hello all,
>
>I've created a small taglib to allow Jelly scripts to implement Java
>interfaces.  The implementation uses JDK 1.3 dynamic proxies to do the
>work.  I was just wondering if anyone was interested in it, or if it
>would be suitable for including in the jelly-tags project at all.  If
>so, I can either post it to the list or put it on a web server.
>
>(By the way, if this post looks familiar, it is.  I didn't get a reply,
>yea or nay, last time I posted, so I thought I'd try again. :) )
>
>	Thanks,
>
>	Eric
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>
>  
>



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Re: [jelly] "Implement" taglib

Posted by "Mark R. Diggory" <md...@latte.harvard.edu>.
There was some talk back when I started playing around with the 
taglibrary that using bcel for something like this should be actually 
placed back behind the Dynabean, so that we were making an 
implementation of DynaBean that was BCEL based. Maybe this somewhat 
applies to this case of JDK Proxies as well. Maybe a Proxy based 
DynaBean Implementation could be created too.

A solution like this might be more attractive to the Jelly developers 
for inclusion into the taglibraries, because then they would be just 
extensions of DynaBean. This would make such implementation/extending 
capabilities available where ever DynaBean is used.

I havn't had an opportunity to take it that far yet, but I'd like to 
attempt it sometime.
-Mark


Eric Galluzzo wrote:

>On Thu, 2005-03-10 at 14:20, Mark R. Diggory wrote:
>  
>
>>Hmm, I hadn't heard of JDK 1.3 Proxies before this point. This does 
>>sound very interesting to me, although I'm not a Jelly Commiter. I'd 
>>like to know more about it. I implemented my own sort of extensibility 
>>for some of my tags using BSF/BCEL. I'd be interested in knowing more on 
>>how you approached your solution.
>>    
>>
>
>Here's a snippet of how you might use the "implement" tag library.  Note
>that you can only implement interfaces, not extend existing classes.
>
><impl:implement class="bar">
>	<impl:method name="test2">
>		<impl:parameter name="arg0" type="java.lang.String"/>
>		<impl:parameter name="arg1" type="int"/>
>		<impl:body>
>			<!-- Insert actual Jelly code here. -->
>			<impl:return value="${arg0 + arg1}"/>
>		</impl:body>
>	</impl:method>
></impl:implement>
>
>The difference, it would seem, between your BCEL taglib and my proxy
>taglib is that:
>
>        * yours can extend classes as well as implement interfaces
>        * mine uses regular Jelly tags to implement the method, whereas
>          yours uses BSF
>
>So it sounds like they're both useful. :)
>
>	- Eric
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>
>  
>



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org