You can do it if you manually proxy your bean class to your dynamic proxy,
but you cannot just supply an interface and simply tell the container to use
the dynamic proxy as the bean class at runtime. This is a limitation of
declarative typing of the EJB specs.
I've thought of this idea before and wished I could do the same thing... no
more bean class writing! However, CMP 2.0 is slowly converging towards
this: in 2.0, you provide an abstract class where all getters and setters
are also abstract. This is ALMOST as bare-bone as an interface!
Gene
-----Original Message-----
From: Kenji Konaka [mailto:[EMAIL PROTECTED]]
Sent: Monday, July 30, 2001 11:41 AM
To: [EMAIL PROTECTED]
Subject: Proxy based Bean implementation ?
hi!
I'm wondering if it is possible to do something similar to
java.lang.reflect.Proxy (dynamic proxy generation)
but in the place of EJBBean Implementation class.
that is,...
my bean deployment descriptor file may looked like this (originally):
<session>
<ejb-name>Me.MyBean</ejb-name>
<home>com.foo.bar.MyBeanHome</home>
<remote>com.foo.bar.MyBean</remote>
<ejb-class>com.foo.bar.MyBeanProxy</ejb-class>
...
</session>
and if the above MyBeanProxy was just a proxy to some other
class (say MyBeanBody), and the call graph have looked like this:
client -> (container stubs) -> MyBeanProxy -> MyBeanBody
(ie.,MyBeanProxy delegates all the calls to MyBeanBody instance)
doing this is not so difficult if I were to generate the code
for MyBeanProxy statically (in form of .java source files) and
then have declared explicitly all of the delegated methods in
the MyBeanProxy code.
but then if I'd wanted to do this dynamically so that the
MyBeanProxy part of the code is formed on the fly like in the case of
java.lang.reflect.Proxy.getProxyClass(...)
what should I do? (also how should the ejb-jar.xml file should look like?)
the motivation behind this, is that I may have not single MyBeanBody
but many of these: MyBeanBody1,MyBeanBody2,MyBeanBodyN...
and may want to serve these with single code in place of MyBeanProxy,
without replicating similar code for each of
MyBeanProxy1,MyBeanProxy2,MyBeanProxy3,...
any hints?
thanks in advance,
kenji
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".