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 2003/01/20 00:06:03 UTC

[Jelly] BCEL Taglibrary Beginnings

I started writting the beginnings of a BCEL taglibrary. Although it may 
be a bit different than others may anticipate.

Basically I've built two tags and a supporting "BeanExtender" class to 
support them.

<bcel:extends
    baseClass="java.lang.Object" 	
    packageName="org.foo"
    className="Test">
    <bcel:add-property name="bar" propertyType="int" write="false"/>
    <bcel:add-property name="bam" propertyType="java.lang.String"/>
</bcel:extends>

Basically creates a new Class (org.foo.Test) that has:

package org.foo;

public Test extends java.lang.Object {

   private int bar;
   private String bam;

   public Test(){}

   public int getBar(){
    return bar;
    }

   public String getBam(){
    return bam;
    }

   public void setBam(String bam){
    this.bam = bam;
    }
}

It then "changes" the Security access on the ClassLoader "define" 
method. Allowing the class to be added into the current loader. Once the 
class is available it can then be instantiated by <useBean> or <new>.

I'm sure there are some more "flexible" ways to design the Taglibrary, I 
consider this to be a "first blush" over the idea. I'd be glad to donate 
the code if others are interested in developing it too.

-Mark Diggory


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [Jelly] BCEL Taglibrary Beginnings

Posted by James Strachan <ja...@yahoo.co.uk>.
+1. This looks great!

James
-------
http://radio.weblogs.com/0112098/

----- Original Message -----
From: "Jason van Zyl" <ja...@zenplex.com>
To: "Jakarta Commons Developers List" <co...@jakarta.apache.org>
Sent: Monday, January 20, 2003 5:22 AM
Subject: Re: [Jelly] BCEL Taglibrary Beginnings


> On Sun, 2003-01-19 at 18:06, Mark R. Diggory wrote:
> > I started writting the beginnings of a BCEL taglibrary. Although it may
> > be a bit different than others may anticipate.
> >
> > Basically I've built two tags and a supporting "BeanExtender" class to
> > support them.
> >
> > <bcel:extends
> >     baseClass="java.lang.Object"
> >     packageName="org.foo"
> >     className="Test">
> >     <bcel:add-property name="bar" propertyType="int" write="false"/>
> >     <bcel:add-property name="bam" propertyType="java.lang.String"/>
> > </bcel:extends>
> >
> > Basically creates a new Class (org.foo.Test) that has:
> >
> > package org.foo;
> >
> > public Test extends java.lang.Object {
> >
> >    private int bar;
> >    private String bam;
> >
> >    public Test(){}
> >
> >    public int getBar(){
> >     return bar;
> >     }
> >
> >    public String getBam(){
> >     return bam;
> >     }
> >
> >    public void setBam(String bam){
> >     this.bam = bam;
> >     }
> > }
> >
> > It then "changes" the Security access on the ClassLoader "define"
> > method. Allowing the class to be added into the current loader. Once the
> > class is available it can then be instantiated by <useBean> or <new>.
> >
> > I'm sure there are some more "flexible" ways to design the Taglibrary, I
> > consider this to be a "first blush" over the idea. I'd be glad to donate
> > the code if others are interested in developing it too.
>
> +1
>
> I think that's nifty neato! What I'm really interested in is the Java
> code backing the Jelly. I've always wanted to make a simple API for BCEL
> for creating bytecode and it looks like you've got a awesome start to
> one.
>
> > -Mark Diggory
> >
> >
> > --
> > To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> > For additional commands, e-mail:
<ma...@jakarta.apache.org>
> --
> jvz.
>
> Jason van Zyl
> jason@zenplex.com
> http://tambora.zenplex.org
>
> In short, man creates for himself a new religion of a rational
> and technical order to justify his work and to be justified in it.
>
>   -- Jacques Ellul, The Technological Society
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>

__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [Jelly] BCEL Taglibrary Beginnings

Posted by Jason van Zyl <ja...@zenplex.com>.
On Sun, 2003-01-19 at 18:06, Mark R. Diggory wrote:
> I started writting the beginnings of a BCEL taglibrary. Although it may 
> be a bit different than others may anticipate.
> 
> Basically I've built two tags and a supporting "BeanExtender" class to 
> support them.
> 
> <bcel:extends
>     baseClass="java.lang.Object" 	
>     packageName="org.foo"
>     className="Test">
>     <bcel:add-property name="bar" propertyType="int" write="false"/>
>     <bcel:add-property name="bam" propertyType="java.lang.String"/>
> </bcel:extends>
> 
> Basically creates a new Class (org.foo.Test) that has:
> 
> package org.foo;
> 
> public Test extends java.lang.Object {
> 
>    private int bar;
>    private String bam;
> 
>    public Test(){}
> 
>    public int getBar(){
>     return bar;
>     }
> 
>    public String getBam(){
>     return bam;
>     }
> 
>    public void setBam(String bam){
>     this.bam = bam;
>     }
> }
> 
> It then "changes" the Security access on the ClassLoader "define" 
> method. Allowing the class to be added into the current loader. Once the 
> class is available it can then be instantiated by <useBean> or <new>.
> 
> I'm sure there are some more "flexible" ways to design the Taglibrary, I 
> consider this to be a "first blush" over the idea. I'd be glad to donate 
> the code if others are interested in developing it too.

+1

I think that's nifty neato! What I'm really interested in is the Java
code backing the Jelly. I've always wanted to make a simple API for BCEL
for creating bytecode and it looks like you've got a awesome start to
one.

> -Mark Diggory
> 
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
-- 
jvz.

Jason van Zyl
jason@zenplex.com
http://tambora.zenplex.org

In short, man creates for himself a new religion of a rational
and technical order to justify his work and to be justified in it.
  
  -- Jacques Ellul, The Technological Society


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


[Jelly] BCEL Taglibrary applied changes

Posted by "Mark R. Diggory" <md...@latte.harvard.edu>.
Thaks everyone for all the great ideas. I've applied many of the changes 
suggested in the list. I've also moved the taglibrary into the 
org.apache.commons.jelly.tags.bcel namespace for future inclusion into 
the Jelly taglibraries CVS tree. First however, I want to expand upon 
the Class Extender to attempt to apply some of the ideas that Jouzas 
suggested in relation to BSF.

The new syntax is outlined in the attached model.xml file.
-Mark Diggory




Re: [Jelly] BCEL Taglibrary Beginnings

Posted by "Mark R. Diggory" <md...@latte.harvard.edu>.
It would be nice to see, with all the work done to access and manipulate 
the bytecode, a utility that then parses bytecode back into java would 
be benificial. I'm sure that there are a number of opensource projects 
already available outside of BCEL specificially for that purpose.

http://www.jsurfer.org/links.php?op=viewslink&sid=18
http://www.andromeda.com/people/ddyer/java/decompiler-table.html
http://www.developer.com/java/article.php/779831
http://www.pdr.cx/projects/hbd/

It would be valuble to see such a libary actually independent of bcel, 
in that you could apply it to any class in the ClassLoader, not just the 
ones generated by BCEL.

Of course, with all the people out there that think of java bytecode as 
"compiled binaries" and not "enterpreted source code", that may cause a 
little hoopla, foolish are those who think compiling something somehow 
secures its source. As a promoter of "Open Source" approaches, I'm not 
sure of Apache's legal opinion on such a "proactive" means of exposing 
the content of others "compiled bytecode" as I'm not affiliated beyond 
being a user/experimenter/hopeful future developer.

-Mark

Robert McIntosh wrote:
> Fully typed business objects on the fly. Really cool. Might be a 
> 'selling' point for those who don't want to use DynaBeans for whatever 
> reason.
> 
> How about an option to spit out the source code as well? Or maybe that 
> it out of scope for BCEL?
> 
> Robert
> 
> Mark R. Diggory wrote:
> 
>> I started writting the beginnings of a BCEL taglibrary. Although it 
>> may be a bit different than others may anticipate.
>>
>> Basically I've built two tags and a supporting "BeanExtender" class to 
>> support them.
>>
>> <bcel:extends
>>    baseClass="java.lang.Object"       packageName="org.foo"
>>    className="Test">
>>    <bcel:add-property name="bar" propertyType="int" write="false"/>
>>    <bcel:add-property name="bam" propertyType="java.lang.String"/>
>> </bcel:extends>
>>
>> Basically creates a new Class (org.foo.Test) that has:
>>
>> package org.foo;
>>
>> public Test extends java.lang.Object {
>>
>>   private int bar;
>>   private String bam;
>>
>>   public Test(){}
>>
>>   public int getBar(){
>>    return bar;
>>    }
>>
>>   public String getBam(){
>>    return bam;
>>    }
>>
>>   public void setBam(String bam){
>>    this.bam = bam;
>>    }
>> }
>>
>> It then "changes" the Security access on the ClassLoader "define" 
>> method. Allowing the class to be added into the current loader. Once 
>> the class is available it can then be instantiated by <useBean> or <new>.
>>
>> I'm sure there are some more "flexible" ways to design the Taglibrary, 
>> I consider this to be a "first blush" over the idea. I'd be glad to 
>> donate the code if others are interested in developing it too.
>>
>> -Mark Diggory
>>
>>
>> -- 
>> To unsubscribe, e-mail:   
>> <ma...@jakarta.apache.org>
>> For additional commands, e-mail: 
>> <ma...@jakarta.apache.org>
>>
> 
> 
> -- 
> To unsubscribe, e-mail:   
> <ma...@jakarta.apache.org>
> For additional commands, e-mail: 
> <ma...@jakarta.apache.org>
> 


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [Jelly] BCEL Taglibrary Beginnings

Posted by Robert McIntosh <ro...@bull-enterprises.com>.
Fully typed business objects on the fly. Really cool. Might be a 
'selling' point for those who don't want to use DynaBeans for whatever 
reason.

How about an option to spit out the source code as well? Or maybe that 
it out of scope for BCEL?

Robert

Mark R. Diggory wrote:

> I started writting the beginnings of a BCEL taglibrary. Although it 
> may be a bit different than others may anticipate.
>
> Basically I've built two tags and a supporting "BeanExtender" class to 
> support them.
>
> <bcel:extends
>    baseClass="java.lang.Object"    
>    packageName="org.foo"
>    className="Test">
>    <bcel:add-property name="bar" propertyType="int" write="false"/>
>    <bcel:add-property name="bam" propertyType="java.lang.String"/>
> </bcel:extends>
>
> Basically creates a new Class (org.foo.Test) that has:
>
> package org.foo;
>
> public Test extends java.lang.Object {
>
>   private int bar;
>   private String bam;
>
>   public Test(){}
>
>   public int getBar(){
>    return bar;
>    }
>
>   public String getBam(){
>    return bam;
>    }
>
>   public void setBam(String bam){
>    this.bam = bam;
>    }
> }
>
> It then "changes" the Security access on the ClassLoader "define" 
> method. Allowing the class to be added into the current loader. Once 
> the class is available it can then be instantiated by <useBean> or <new>.
>
> I'm sure there are some more "flexible" ways to design the Taglibrary, 
> I consider this to be a "first blush" over the idea. I'd be glad to 
> donate the code if others are interested in developing it too.
>
> -Mark Diggory
>
>
> -- 
> To unsubscribe, e-mail:   
> <ma...@jakarta.apache.org>
> For additional commands, e-mail: 
> <ma...@jakarta.apache.org>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [Jelly] BCEL Taglibrary Beginnings

Posted by di...@multitask.com.au.
Cool. We almost have a CodeDOM :)
--
dIon Gillard, Multitask Consulting
Blog:      http://www.freeroller.net/page/dion/Weblog
Work:      http://www.multitask.com.au


"Mark R. Diggory" <md...@latte.harvard.edu> wrote on 20/01/2003 
10:06:03 AM:

> I started writting the beginnings of a BCEL taglibrary. Although it may 
> be a bit different than others may anticipate.
> 
> Basically I've built two tags and a supporting "BeanExtender" class to 
> support them.
> 
> <bcel:extends
>     baseClass="java.lang.Object" 
>     packageName="org.foo"
>     className="Test">
>     <bcel:add-property name="bar" propertyType="int" write="false"/>
>     <bcel:add-property name="bam" propertyType="java.lang.String"/>
> </bcel:extends>
> 
> Basically creates a new Class (org.foo.Test) that has:
> 
> package org.foo;
> 
> public Test extends java.lang.Object {
> 
>    private int bar;
>    private String bam;
> 
>    public Test(){}
> 
>    public int getBar(){
>     return bar;
>     }
> 
>    public String getBam(){
>     return bam;
>     }
> 
>    public void setBam(String bam){
>     this.bam = bam;
>     }
> }
> 
> It then "changes" the Security access on the ClassLoader "define" 
> method. Allowing the class to be added into the current loader. Once the 

> class is available it can then be instantiated by <useBean> or <new>.
> 
> I'm sure there are some more "flexible" ways to design the Taglibrary, I 

> consider this to be a "first blush" over the idea. I'd be glad to donate 

> the code if others are interested in developing it too.
> 
> -Mark Diggory
> 
> 
> --
> To unsubscribe, e-mail: 
<ma...@jakarta.apache.org>
> For additional commands, e-mail: 
<ma...@jakarta.apache.org>
> 

> ForwardSourceID:NT000A55CE 

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>