Agree,
user doe's not need to  know about cglib API used by hibernate.
I will add prefix  all Factory methods this way: "cglib$GetInterceptor()",
"cglib$GetDelegate()"
They are used for optimizations and we do not need "nice" names. Very
possible we will decide to generate
separate class for factory, It is possible to have all optimizations without
cglib interface implemented by proxy,
MetaClass doe's almost the same.

<snip>

Also - I'm still rather confused why sometimes getInterceptor() is
exposed and sometimes it isn't.

It must be always implemented by generated classes, possible some of objects
are not instances of proxy class.

  I'm introspecting the proxy with
java.beans.Introspector and printing out the PropertyDescriptors.  It's
also odd that I don't see a property called "delegate".

Version used by hibernate doe's not have this method, it is introduced later
to eleminate "java.lang.reflect.Method.invoke".
Instance returned form "getDelegate()" is the same as parameter "delegate"
in "newInstance(interceptor,delegate)"
 used to redirect all intercepted methods.

 It is possible to live without "delegate" paramater in "newInstance" and
"getDelegate" in "Factory", user defined interceptor can store this
reference itself.
Both methods  can be implemented in MethodProxy :

"invokeSuper" - indirect  delegation to "super"
(
this.method()->MethodProxy.invokeSuper(this)->this.CGLIB$ACCESS_x_method()->
super.method()  )

"invoke"  - direct   delegation to "delegate"
(  this.method()->MethodProxy.invoke(param)->param.method() )

I see we will have nice weekend :)


Jeff Schnitzer
[EMAIL PROTECTED]

> -----Original Message-----
> From: Juozas Baliuka [mailto:[EMAIL PROTECTED]
> Sent: Thursday, January 30, 2003 10:34 PM
> To: Schnitzer, Jeff; [EMAIL PROTECTED]
> Cc: [EMAIL PROTECTED]
> Subject: Re: [Hibernate] Trouble with proxy implementations
>
>
> This public method implemented for *all* proxy instances.
> Proxy implements net.sf.cglib.Factory interface it is used for
> optimization
> to eleminate reflection.
> We can rename getters and setters, but it is public API and you can
filter
> methods this way:
> public boolean accept(){
>   return net.sf.cglib.Factory.class != method.getDeclaringClass() ;
> }
>
>
> public interface Factory {
>     /**
>      * Creates new instance of the same type as factory
>      * @param ih interceptor
>      * @return instance
>      */
>     public Object newInstance(MethodInterceptor ih);
>
>     public MethodInterceptor getInterceptor();
>
>     public Object newInstance(MethodInterceptor ih, Object delegate);
>
>     public Object newInstance( Class types[], Object args[],
> MethodInterceptor ih);//calls multiarg constructor
>
>     public Object getDelegate();//new getter
>
>     public void setDelegate(Object delegate);//new setter
>
>     public void setInterceptor(MethodInterceptor ih);//new setter
> }
>
>
> It gets weird.  The problem is that *sometimes* the proxy exposes a
> getInterceptor() method of type net.sf.cglib.proxy.MethodInterceptor.
>
> When I restart the JVM, it usually works for a while - this method is
> not exposed.  Eventually, however, something "breaks" and this method
is
> consistently exposed.
>
> ???
>
> Jeff
>
> > -----Original Message-----
> > From: Schnitzer, Jeff
> > Sent: Thursday, January 30, 2003 5:23 PM
> > To: [EMAIL PROTECTED]
> > Cc: [EMAIL PROTECTED]
> > Subject: RE: [Hibernate] Trouble with proxy implementations
> >
> > It's possible that there is a getter on the proxy that returns an
> object
> > that has the getSession() method.  Difficult to tell from my current
> > test app.  I'll write some introspection code to find out what's
going
> > on.
> >
> > Jeff
> >
> > > -----Original Message-----
> > > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> > > Sent: Thursday, January 30, 2003 4:45 PM
> > > To: Schnitzer, Jeff
> > > Cc: [EMAIL PROTECTED]
> > > Subject: RE: [Hibernate] Trouble with proxy implementations
> > >
> > >
> > > Wierd .... those methods are defined on the _handler_ class,
> > > not the proxy interface itself.....
> > >
> > > And I didn't thing the proxies implement the interface of the
> > > MethodInterceptor....
> > >
> > >
> > >
> > >
> > >                     "Schnitzer,
> > >                     Jeff"                To:
> > > <[EMAIL PROTECTED]>
> > >                     <[EMAIL PROTECTED]       cc:
> > >                     xis.com>             Subject:     RE:
> [Hibernate]
> > > Trouble with proxy implementations
> > >
> > >                     31/01/03 11:04
> > >                     AM
> > >
> > >
> > >
> > >
> > >
> > >
> > > It's with a very recent CVS copy of hibernate2.  The getters must
be
> > > generated by CGLIB.  It's hard to follow the exact call graph (I
get
> > an
> > > exception that prevents the full XML from being displayed) but one
> > > example:
> > >
> > > It looks like the proxy has a method getSession() that returns a
> > > net.sf.hibernate.impl.SessionImpl.
> > >
> > > Jeff
> > >
> > >
> > > > -----Original Message-----
> > > > From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]
> > > > Sent: Thursday, January 30, 2003 3:42 PM
> > > > To: Schnitzer, Jeff
> > > > Cc: [EMAIL PROTECTED]
> > > > Subject: Re: [Hibernate] Trouble with proxy implementations
> > > >
> > > >
> > > > Hmmmm. HibernateProxy itself only declares writeReplace(). Do
you
> > mean
> > > > methods
> > > > that are coming from CGLIB, or are you referring to an older
> version
> > > of
> > > > Hibernate?
> > > >
> > > >
> > > >
> > > >
> > > >                     "Schnitzer, Jeff"
> > > >                     <[EMAIL PROTECTED]>                  To:
> > > > <[EMAIL PROTECTED]>
> > > >                     Sent by:                                cc:
> > > >                     [EMAIL PROTECTED]
> Subject:
> > > > [Hibernate] Trouble with proxy implementations
> > > >                     eforge.net
> > > >
> > > >
> > > >                     31/01/03 10:30 AM
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > I'm having a small problem with the generated proxy
> implementations
> > in
> > > > one of my webapps.  My data objects are of course java beans,
and
> > > these
> > > > java beans are passed up into the presentation tier.
> > > >
> > > > Among other things, my presentation tier uses reflection to
> examine
> > > the
> > > > data (model) components and generate XML from them.  This works
> > great
> > > > with real beans but causes a lot of trouble with proxies.
> > > >
> > > > Unfotunately the generated proxies have a lot of methods that
fit
> > the
> > > > javabeans property pattern getXXX() and return sophisticated
> > objects.
> > > > This really makes a mess out of the process.
> > > >
> > > > Is it possible to change these methods so that they do not
> coincide
> > > with
> > > > the pattern for javabeans properties?
> > > >
> > > > Jeff Schnitzer
> > > > [EMAIL PROTECTED]
> > > >
> > > >
> > > > -------------------------------------------------------
> > > > This SF.NET email is sponsored by:
> > > > SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2
> See!
> > > > http://www.vasoftware.com
> > > > _______________________________________________
> > > > hibernate-devel mailing list
> > > > [EMAIL PROTECTED]
> > > > https://lists.sourceforge.net/lists/listinfo/hibernate-devel
> > > >
> > > >
> > > >
> > > >
> > > >
> >
**********************************************************************
> > > > Any personal or sensitive information contained in this email
and
> > > > attachments must be handled in accordance with the Victorian
> > > Information
> > > > Privacy Act 2000, the Health Records Act 2001 or the Privacy Act
> > 1988
> > > > (Commonwealth), as applicable.
> > > >
> > > > This email, including all attachments, is confidential.  If you
> are
> > > not
> > > > the
> > > > intended recipient, you must not disclose, distribute, copy or
use
> > the
> > > > information contained in this email or attachments.  Any
> > > confidentiality
> > > > or
> > > > privilege is not waived or lost because this email has been sent
> to
> > > you in
> > > > error.  If you have received it in error, please let us know by
> > reply
> > > > email, delete it from your system and destroy any copies.
> > > >
> >
**********************************************************************
> > > >
> > > >
> > > >
> > >
> > >
> > >
> > >
> > >
> > >
> **********************************************************************
> > > Any personal or sensitive information contained in this email and
> > > attachments must be handled in accordance with the Victorian
> > Information
> > > Privacy Act 2000, the Health Records Act 2001 or the Privacy Act
> 1988
> > > (Commonwealth), as applicable.
> > >
> > > This email, including all attachments, is confidential.  If you
are
> > not
> > > the
> > > intended recipient, you must not disclose, distribute, copy or use
> the
> > > information contained in this email or attachments.  Any
> > confidentiality
> > > or
> > > privilege is not waived or lost because this email has been sent
to
> > you in
> > > error.  If you have received it in error, please let us know by
> reply
> > > email, delete it from your system and destroy any copies.
> > >
> **********************************************************************
> > >
> > >
> > >
> >
> >
> >
> > -------------------------------------------------------
> > This SF.NET email is sponsored by:
> > SourceForge Enterprise Edition + IBM + LinuxWorld =omething 2 See!
> > http://www.vasoftware.com
> > _______________________________________________
> > hibernate-devel mailing list
> > [EMAIL PROTECTED]
> > https://lists.sourceforge.net/lists/listinfo/hibernate-devel
>
>
>
> -------------------------------------------------------
> This SF.NET email is sponsored by:
> SourceForge Enterprise Edition + IBM + LinuxWorld =omething 2 See!
> http://www.vasoftware.com
> _______________________________________________
> hibernate-devel mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/hibernate-devel
>




-------------------------------------------------------
This SF.NET email is sponsored by:
SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
http://www.vasoftware.com
_______________________________________________
hibernate-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/hibernate-devel


Reply via email to