Return-Path: Delivered-To: apmail-jakarta-hivemind-user-archive@www.apache.org Received: (qmail 97358 invoked from network); 21 Oct 2004 08:25:39 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 21 Oct 2004 08:25:39 -0000 Received: (qmail 99514 invoked by uid 500); 21 Oct 2004 08:25:39 -0000 Delivered-To: apmail-jakarta-hivemind-user-archive@jakarta.apache.org Received: (qmail 99494 invoked by uid 500); 21 Oct 2004 08:25:38 -0000 Mailing-List: contact hivemind-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: list-post: Reply-To: hivemind-user@jakarta.apache.org Delivered-To: mailing list hivemind-user@jakarta.apache.org Received: (qmail 99458 invoked by uid 99); 21 Oct 2004 08:25:38 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (hermes.apache.org: local policy) Received: from [62.189.199.226] (HELO quobpdc.quindell.com) (62.189.199.226) by apache.org (qpsmtpd/0.28) with ESMTP; Thu, 21 Oct 2004 01:25:37 -0700 Received: by QUOBPDC with Internet Mail Service (5.5.2656.59) id ; Thu, 21 Oct 2004 09:26:15 +0100 Message-ID: <5168BC246FB6D511890A0002A57546973767F2@QUOBPDC> From: "Dyson, Jimmi" To: hivemind-user@jakarta.apache.org Subject: RE: AOPAlliance interceptor factory (WAS: Reflection vs. Javassis t) Date: Thu, 21 Oct 2004 09:26:14 +0100 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2656.59) Content-Type: text/plain X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N That's a very good point that I hadn't thought of... Can anyone think of another way to get around having to declare a factory and an interceptor for each MethodInterceptor interceptor? Even using Knut's ObjectProvider technique (which I never knew about!) means that you have to declare 2 services for each MethodInterceptor, unless you don't want to wire the interceptor implementation together with anything. Please let me know if I've misunderstood something about ObjectProviders, but in order to wire services to your interceptor, wouldn't you need to use the service: prefix in the set-object, meaning that then that service would also need to be declared? Having to declare both the factory and the implementation is over the top when you've already created a generic factory for MethodInterceptor interceptors. -----Original Message----- From: James Carman [mailto:james@carmanconsulting.com] Sent: 20 October 2004 13:27 To: hivemind-user@jakarta.apache.org Subject: RE: AOPAlliance interceptor factory (WAS: Reflection vs. Javassist) Sorry, man. It's early. No coffee yet! :-) Anyway, I think my original did just what you're doing here, give or take. The problem I ran into was that if you wanted to use multiple method interceptors, you have no way of ordering them (security first, then logging, then transactions, etc.), because the service-id of the service interceptor factory is always " cendil.lib.AOPAllianceMethodInterceptorFactory." -----Original Message----- From: Dyson, Jimmi [mailto:dysonj@quindell.com] Sent: Wednesday, October 20, 2004 8:23 AM To: hivemind-user@jakarta.apache.org Subject: RE: AOPAlliance interceptor factory (WAS: Reflection vs. Javassist) The MethodInterceptor implementation is actually a service so what stops you wiring that service with other services? For example, the TransactionInterceptor (in fact, your TransactionInterceptor!): As you know, this uses autowiring to wire the TransactionService implementation to it. Is that what you were getting at or have I missed something? -----Original Message----- From: James Carman [mailto:james@carmanconsulting.com] Sent: 20 October 2004 13:06 To: hivemind-user@jakarta.apache.org Subject: RE: AOPAlliance interceptor factory (WAS: Reflection vs. Javassist) I originally did it similar to that, but what if you want to wire your method interceptor together with other services? You're not using BuilderFactory to build the method interceptor instance, so you can't do that. -----Original Message----- From: Dyson, Jimmi [mailto:dysonj@quindell.com] Sent: Wednesday, October 20, 2004 5:23 AM To: hivemind-user@jakarta.apache.org Subject: AOPAlliance interceptor factory (WAS: Reflection vs. Javassist) Firstly, apologies for the long post! I have taken James Carman's AOPAlliance method interceptor factory and altered it a bit to take a MethodInterceptor as a parameter when declaring an interceptor. I felt that this was worth doing as otherwise we would have to declare a 2 services for each MethodInterceptor service (one for the MethodInterceptor factory and one for the MethodInterceptor itself). This way it needs only 1 declaration for the MethodInterceptor factory and one for each MethodInterceptor. I am having a problem declaring multiple interceptors for the same service point ("Interceptor contribution 'cendil.lib.AOPAllianceMethodInterceptorFactory' duplicates previous value and is being ignored."). The service-point looks like this: The id of the service implementing the MethodInterceptor interface This can then be used like below to add a method interceptor like below: Where the LoggingInterceptor is declared like this: The problem I'm having is that if I want to add a second AOPAlliance MethodInterceptor like this: I get the message that: Interceptor contribution 'cendil.lib.AOPAllianceMethodInterceptorFactory' duplicates previous value and is being ignored. Does anyone have any ideas as to how to get around this? This really does simplify a lot of things (e.g. LoggingInterceptor is only 45 lines of code rather than over 200). Thanks, Jim Dyson -----Original Message----- From: James Carman [mailto:james@carmanconsulting.com] Sent: 21 September 2004 15:18 To: hivemind-user@jakarta.apache.org; 'Knut Wannheden' Subject: RE: Reflection vs. Javassist Well, that's the beauty of it. The class implementation has a setter for an object of type MethodInterceptor, so you can set that property however you want. I chose to use a service, because my interceptor relied upon other services and I wanted to use BuilderFactory to autowire everything for me. I wasn't familiar with object providers, so I just stuck with what I knew. :-) -----Original Message----- From: Knut Wannheden [mailto:knut.wannheden@gmail.com] Sent: Tuesday, September 21, 2004 10:14 AM To: hivemind-user@jakarta.apache.org Subject: Re: Reflection vs. Javassist Can't this be simplified by using the HiveMind ObjectProviders? Then you wouldn't need the first service anymore: --knut On Tue, 21 Sep 2004 10:04:19 -0400, James Carman wrote: > I can do you one better. I can include the source code for a > MethodInterceptorFactory class that I wrote. Now, this class is dependent > upon the AOP Alliance (http://sourceforge.net/projects/aopalliance) jar > file, but it makes creating interceptors EASY! All you have to do is > implement the MethodInterceptor interface (from AOP Alliance). This class > (or some version similar to it) may make it into the hivemind-lib module in > version 1.1, so make sure you switch over to the "official" one once it > arrives. > > Here's an example of how to use it in a hivemodule.xml file... > > id="RollbackOnlyInterceptor" > interface="org.aopalliance.intercept.MethodInterceptor"> > > > > > > id="RollbackOnlyInterceptorFactory" > interface="org.apache.hivemind.ServiceInterceptorFactory"> > > class="example.interceptor.factory.MethodInterceptorFactory"> > service-id="RollbackOnlyInterceptor" > property="methodInterceptor"/> > > > > > > > > > Here, we declared the actual interceptor itself as a service and told the > factory which service to call to intercept the methods. > --------------------------------------------------------------------- To unsubscribe, e-mail: hivemind-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: hivemind-user-help@jakarta.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: hivemind-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: hivemind-user-help@jakarta.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: hivemind-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: hivemind-user-help@jakarta.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: hivemind-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: hivemind-user-help@jakarta.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: hivemind-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: hivemind-user-help@jakarta.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: hivemind-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: hivemind-user-help@jakarta.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: hivemind-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: hivemind-user-help@jakarta.apache.org