I like each proxy, interceptor, etc. to provide its own toString().
When I'm debugging, I can find out what each oddly named object on the
stack is easily. As is, the class names are unitellgable on their
own, i.e., $SingletonProxy_17234ac... to having a real toString() for
each level of proxy is important.
On Fri, 04 Feb 2005 00:14:53 -0600, Brian K. Wallace
<[EMAIL PROTECTED]> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> First off, let me apologize for dwelling on a non-issue. I've been very
> impressed with what I can do with HiveMind and decided to take a closer
> look at 'how' - and instead of complaining, try to learn it and help
> improve it. Just a bit stuck in the 'learn it' stage.
>
> I found out what is happening, but I'm not sure if it's a bug in
> EJBProxyFactory, ProxyBuilder or a non-issue (non-issue being a relative
> term). EJBProxyFactory adds a toString method if there isn't one. The
> problem is that it isn't the toString() that is used when getting the
> service from the registry. The proxy's toString() is used (hence the
> "<SingletonProxy...." output). Modifying ProxyBuilder's toString to use
> the inner class' toString() results in Java Object toString() until the
> class is actually used - then it returns the output defined. Removing
> the toString building entirely from EJBProxyFactory isn't noticable as
> the proxy's toString is used anyway. The difference being:
> <SingletonProxy for
> hivemind.test.lib.SimpleRemote(hivemind.test.lib.SimpleRemote)>
> vs.
> <EJBProxy for SimpleRemote(hivemind.test.lib.SimpleRemote) at
> hivemind.test.lib.Simple>
>
> My question is: while removal of the 'addToString' from EJBProxyFactory
> clears this up, is it actually a bug in ProxyBuilder? Where a
> subordinate factory doesn't attempt to add a toString method, or the
> implementation actually has a toString, it's a non-issue entirely. But
> if a factory tries to add a toString method (as EJBProxyFactory does -
> and I'd assume someone could come up with other factories to plug in),
> that method will not be the method used.
>
> Again, my apologies for harping on a fringe example.
>
> Howard Lewis Ship wrote:
> | You'll have to dig through the SingletonProxy to get to the EJBProxy.
> |
> | Most of the code that generates classes is careful to work around
> | toString(). The logic for this is part of the MethodIterator. This
> | may be a minor bug in EJBProxyFactory, but toString() is generally not
> | a valid EJB method (it certainly doesn't throw RemoteException).
> |
> |
> | On Thu, 03 Feb 2005 17:15:49 -0600, Brian K. Wallace
> | <[EMAIL PROTECTED]> wrote:
> |
> | Continuing on through understanding what happens when...
> |
> | Looking at TestEJBProxyFactory, one portion of the code that was never
> | tested was an implementation that already had a toString() method. I
> | added one. This covered that case - verified with an assertEquals() on
> | the object.toString() - that if a class already had a toString() method,
> | it wouldn't try to add another one.
> |
> | What I found, however, was in going back to verify the original
> | toString() returned what I thought it should. Since the
> | 'addToStringMethod' was being called (3 times), I looked at the code for
> | that which does the following:
> | ~ ClassFabUtils.addToStringMethod(classFab,
> | ImplMessages.ejbProxyDescription(serviceId, serviceInterface, jndiName));
> |
> | Since ImplMessages isn't visible, I created a
> | MessagesUtil.getEjbProxyDescription(...) method taking the same
> | parameters and returning what should be passed to addToStringMethod(...).
> |
> | To the testEJBProxy() method, I then added:
> |
> |
> assertEquals(MessagesUtil.getEjbProxyDescription("hivemind.test.lib.SimpleRemote",
> | SimpleRemote.class, "hivemind.test.lib.Simple"), object.toString());
> |
> | This assertion fails.
> |
> | I added a debug to the addToStringMethod(...) to verify I was using the
> | right values, then printed out the object's toString() and what's
> | returned from my MessagesUtil method. What I got was the following:
> |
> | Service Id: hivemind.test.lib.SimpleRemote, ServiceInterface: interface
> | hivemind.test.lib.SimpleRemote, JNDI: hivemind.test.lib.Simple
> | SimpleRemote toString: <SingletonProxy for
> | hivemind.test.lib.SimpleRemote(hivemind.test.lib.SimpleRemote)>
> | MessageUtil toString: <EJBProxy for
> | SimpleRemote(hivemind.test.lib.SimpleRemote) at hivemind.test.lib.Simple>
> |
> | The toString() actually added to the class is from SingletonProxy, not
> | EJBProxy. I'm willing to bet I'm missing something, but I'm at a loss as
> | to what. Am I missing it? Or is this a bug somewhere?
>
> - ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.2.5 (MingW32)
>
> iD8DBQFCAxLdaCoPKRow/gARAuKLAJ9cig6MxIUdqp/vQGvylRpypsQ+lgCgt0IQ
> wP8/r9uM3unKngA5DcmtD7c=
> =+6Lg
> -----END PGP SIGNATURE-----
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
--
Howard M. Lewis Ship
Independent J2EE / Open-Source Java Consultant
Creator, Jakarta Tapestry
Creator, Jakarta HiveMind
Professional Tapestry training, mentoring, support
and project work. http://howardlewisship.com
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]