avalon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Neeme Praks <ne...@apache.org>
Subject FYI: [donation] dynamicProxy implementation, based on BCEL
Date Thu, 05 Dec 2002 23:08:05 GMT

As there seemed to be a need for this beast, I took some time off and 
implemented it.
Hopefully it will be useful for helping Cocoon to get rid of ECM sooner 
rather that later ;-)


-- Original Message --
Teema: [donation] dynamicProxy implementation, based on BCEL
KuupƤev: Fri, 06 Dec 2002 01:05:07 +0200
Kellelt: Neeme Praks <neeme@apache.org>
Adressaat: bcel-dev <bcel-dev@jakarta.apache.org>

After some digging and wrestling, I finally managed to complete first
shot at implementing dynamic proxies with BCEL.

Attached are the sources and some patches to the existing files that I
found useful:
* classfile/ConstantUtf8.java should not allow null reference to bytes
* classfile/Field.java sent already earlier
* classfile/Method.java sent already earlier
* generic/PUTSTATIC.java mistake in javadocs
* util/Repository.java sent already earlier

* invocation handler is set via a public
setInvocationHandler(InvocationHandler ih) method on a proxy. If someone
figures out, how to pass InvocationHandler to a constructor then that
would be even better... but AFAIK, this is not possible?
* in order to use the generator, there is currently some classloader
magic involved... should look for ways to make this easier (if possible?)

* implement the other three standard static methods for Proxy class:
      * getInvocationHandler(Object proxy)
      * getProxyClass(ClassLoader loader, Class[] interfaces)
      * isProxyClass(Class cl)
* javadocs everywhere
* unit tests
* probably should move some stuff from ProxyClassLoader to util/ClassLoader
* package name... right now I put it in proxy subpackage, but this is
just a matter of preference

If someone feels like helping me out with any of the issues, feel free
to contribute.

In order to see the generator in action, extract the archive and apply
the patches.
Then run:
java -cp bin/classes org.apache.bcel.proxy.sample.SampleLoader

And you should see the result on your console.

While generating the proxy in debug mode, generator prints out a bunch
of debugging information that should give some idea, what is happening
behind the scenes.

Ok, will get some sleep now, probably will try to check up on the TODO
list next week (short of time this week...)


View raw message