You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hivemind.apache.org by "David J. M. Karlsen" <da...@davidkarlsen.com> on 2005/05/09 14:23:43 UTC

interceptor: getting name of implemened interface

Hi!

I'm writing an interceptor for timing of method-calls (based on jamon).

I want to get the name of the implemented service-interface from the 
delegate passed to the constructor. (Following the example at: 
http://jakarta.apache.org/hivemind/hivemind-examples/logging.html)

How could I get the name the easiest way possible? Is there a 
helper-class somewhere? How am I assured to get the name of the 
interface of the service (in all cases, the delegate is another class 
depending on service-model, other interceptors and so on). I want to 
avoid a lot of introspection and checking on Hivemind specific 
service-models etc.).


Kind regards,
David K.


-- 
David J. M. Karlsen - +47 90 68 22 43
http://www.davidkarlsen.com
http://mp3.davidkarlsen.com

---------------------------------------------------------------------
To unsubscribe, e-mail: hivemind-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: hivemind-dev-help@jakarta.apache.org


Re: interceptor: getting name of implemened interface

Posted by Knut Wannheden <kn...@gmail.com>.
David,

It's defined the other way around. You use <include method="foo"/> and
<exclude method="bar*"/> elements instead.

--knut

On 5/12/05, David J. M. Karlsen <da...@davidkarlsen.com> wrote:
> James Carman wrote:
> 
> Hmm, now HM complaints:
> 
> 2005-05-12 13:53:17,495 [main] ERROR my.package.ProxyTimingInterceptor
> - Error at
> file:/Q:/hivemodule.xml, line 58, column 25: Element method is not
> allowed here. (DefaultErrorHandler.java:37)
> 2005-05-12 13:53:17,495 [main] ERROR
> my.package.ProxyTimingInterceptor  - Error at
> file:/Q:/hivemodule.xml, line 59, column 28: Element method is not
> allowed here. (DefaultErrorHandler.java:37)
> 
> but still the registry gets constructed and the application runs!?
> 
> 
> > HiveMind doesn't know how to transform your <method> elements into
> > MethodContribution objects unless you tell it.  Try setting up the
> > parameters schema for your service interceptor factory the same way HM
> > does...
> >
> > <service-point id="ProxyTimingInterceptor"
> > interface="org.apache.hivemind.ServiceInterceptorFactory"
> > parameters-schema-id="hivemind.MethodFilter">
> >   <create-instance class="my.package.ProxyJAMonTimingInterceptorFactory"/>
> > </service>
> >
> > See if that helps.  I'm pretty sure you can refer to schemas defined in
> > other modules.  I wouldn't see any reason why you shouldn't be able to.
> >
> > -----Original Message-----
> > From: David J. M. Karlsen [mailto:david@davidkarlsen.com]
> > Sent: Thursday, May 12, 2005 7:39 AM
> > To: hivemind-dev@jakarta.apache.org
> > Subject: Re: interceptor: getting name of implemened interface
> >
> >
> > James Carman wrote:
> >
> > That may certainly be the cause! I've never grasped the config, schema
> > and config-contribution ideas....
> >
> > relevant parts:
> >
> > <service-point id="ProxyTimingInterceptor"
> > interface="org.apache.hivemind.ServiceInterceptorFactory">
> >       <create-instance
> > class="my.package.ProxyJAMonTimingInterceptorFactory"/>
> > </service>
> >
> >
> >
> > And later on, on a "normal service" I add this after the invoke-factory
> > element
> >
> > <interceptor service-id="ProxyTimingInterceptor">
> >       <method include="*"/>
> >       <method exclude="test"/>
> > </interceptor>
> >
> > what am I missing out on?
> >
> >
> >
> >>Actually, I think that might happen when you omit the schema
> >>altogether. Can you paste in your hivemodule.xml file (or the relevant
> >>pieces of it)?
> >>
> >>-----Original Message-----
> >>From: James Carman [mailto:james@carmanconsulting.com]
> >>Sent: Thursday, May 12, 2005 7:26 AM
> >>To: hivemind-dev@jakarta.apache.org
> >>Subject: RE: interceptor: getting name of implemened interface
> >>
> >>
> >>Did you make sure you called addElement() at the end of your schema
> >>rules?
> >>
> >>-----Original Message-----
> >>From: David J. M. Karlsen [mailto:david@davidkarlsen.com]
> >>Sent: Thursday, May 12, 2005 7:18 AM
> >>To: hivemind-dev@jakarta.apache.org
> >>Subject: Re: interceptor: getting name of implemened interface
> >>
> >>
> >>Knut Wannheden wrote:
> >>
> >>
> >>>David,
> >>>
> >>>Yes all method calls will go through the interceptor you add. It is
> >>>thus up to the interceptor to decide whether it should actually do
> >>>something or just pass on to the delegate. For the interceptor to know
> >>>what to do the interceptor factory must pass the parameters (in your
> >>>case <include> and <exclude>) on (e.g. through the interceptor
> >>>constructor).
> >>>
> >>>If you like you can also take a look at HiveMind's logging interceptor
> >>>LoggingInterceptorFactory. It uses Javassist to create an interceptor
> >>>class and an instance thereof on the fly. The <include> and <exclude>
> >>>method matching logic is encapsulated directly by this generated
> >>>class. You may of course also prefer the dynamic proxy approach and
> >>>code a generic interceptor class yourself. YMMV.
> >>
> >>
> >>I took a look at the class - but I'm a little confused over this:
> >>
> >>In the LoggingInterceptorFactory you get a List of parameters (the
> >>include/exclude patterns), and the elements in the list are cast to
> >>MethodContribution objects.
> >>
> >>In my interceptorfactory I receive a List of parameters containing
> >>org.apache.hivemind.impl.ElementImpl objects.
> >>
> >>Howcome?
> >>
> >>
> >
> >
> >
> 
> --
> David J. M. Karlsen - +47 90 68 22 43
> http://www.davidkarlsen.com
> http://mp3.davidkarlsen.com
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: hivemind-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: hivemind-dev-help@jakarta.apache.org
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: hivemind-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: hivemind-dev-help@jakarta.apache.org


Re: interceptor: getting name of implemened interface

Posted by "David J. M. Karlsen" <da...@davidkarlsen.com>.
James Carman wrote:

Hmm, now HM complaints:

2005-05-12 13:53:17,495 [main] ERROR my.package.ProxyTimingInterceptor 
- Error at
file:/Q:/hivemodule.xml, line 58, column 25: Element method is not
allowed here. (DefaultErrorHandler.java:37)
2005-05-12 13:53:17,495 [main] ERROR
my.package.ProxyTimingInterceptor  - Error at
file:/Q:/hivemodule.xml, line 59, column 28: Element method is not
allowed here. (DefaultErrorHandler.java:37)


but still the registry gets constructed and the application runs!?




> HiveMind doesn't know how to transform your <method> elements into
> MethodContribution objects unless you tell it.  Try setting up the
> parameters schema for your service interceptor factory the same way HM
> does...
> 
> <service-point id="ProxyTimingInterceptor"
> interface="org.apache.hivemind.ServiceInterceptorFactory"
> parameters-schema-id="hivemind.MethodFilter">
>   <create-instance class="my.package.ProxyJAMonTimingInterceptorFactory"/>
> </service>
> 
> See if that helps.  I'm pretty sure you can refer to schemas defined in
> other modules.  I wouldn't see any reason why you shouldn't be able to.
> 
> -----Original Message-----
> From: David J. M. Karlsen [mailto:david@davidkarlsen.com] 
> Sent: Thursday, May 12, 2005 7:39 AM
> To: hivemind-dev@jakarta.apache.org
> Subject: Re: interceptor: getting name of implemened interface
> 
> 
> James Carman wrote:
> 
> That may certainly be the cause! I've never grasped the config, schema 
> and config-contribution ideas....
> 
> relevant parts:
> 
> <service-point id="ProxyTimingInterceptor" 
> interface="org.apache.hivemind.ServiceInterceptorFactory">
> 	<create-instance
> class="my.package.ProxyJAMonTimingInterceptorFactory"/>
> </service>
> 
> 
> 
> And later on, on a "normal service" I add this after the invoke-factory 
> element
> 
> <interceptor service-id="ProxyTimingInterceptor">
> 	<method include="*"/>
> 	<method exclude="test"/>
> </interceptor>
> 
> what am I missing out on?
> 
> 
> 
>>Actually, I think that might happen when you omit the schema 
>>altogether. Can you paste in your hivemodule.xml file (or the relevant 
>>pieces of it)?
>>
>>-----Original Message-----
>>From: James Carman [mailto:james@carmanconsulting.com]
>>Sent: Thursday, May 12, 2005 7:26 AM
>>To: hivemind-dev@jakarta.apache.org
>>Subject: RE: interceptor: getting name of implemened interface
>>
>>
>>Did you make sure you called addElement() at the end of your schema 
>>rules?
>>
>>-----Original Message-----
>>From: David J. M. Karlsen [mailto:david@davidkarlsen.com]
>>Sent: Thursday, May 12, 2005 7:18 AM
>>To: hivemind-dev@jakarta.apache.org
>>Subject: Re: interceptor: getting name of implemened interface
>>
>>
>>Knut Wannheden wrote:
>>
>>
>>>David,
>>>
>>>Yes all method calls will go through the interceptor you add. It is 
>>>thus up to the interceptor to decide whether it should actually do 
>>>something or just pass on to the delegate. For the interceptor to know 
>>>what to do the interceptor factory must pass the parameters (in your 
>>>case <include> and <exclude>) on (e.g. through the interceptor 
>>>constructor).
>>>
>>>If you like you can also take a look at HiveMind's logging interceptor 
>>>LoggingInterceptorFactory. It uses Javassist to create an interceptor 
>>>class and an instance thereof on the fly. The <include> and <exclude> 
>>>method matching logic is encapsulated directly by this generated 
>>>class. You may of course also prefer the dynamic proxy approach and 
>>>code a generic interceptor class yourself. YMMV.
>>
>>
>>I took a look at the class - but I'm a little confused over this:
>>
>>In the LoggingInterceptorFactory you get a List of parameters (the
>>include/exclude patterns), and the elements in the list are cast to 
>>MethodContribution objects.
>>
>>In my interceptorfactory I receive a List of parameters containing
>>org.apache.hivemind.impl.ElementImpl objects.
>>
>>Howcome?
>>
>>
> 
> 
> 


-- 
David J. M. Karlsen - +47 90 68 22 43
http://www.davidkarlsen.com
http://mp3.davidkarlsen.com

---------------------------------------------------------------------
To unsubscribe, e-mail: hivemind-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: hivemind-dev-help@jakarta.apache.org


RE: interceptor: getting name of implemened interface

Posted by James Carman <ja...@carmanconsulting.com>.
HiveMind doesn't know how to transform your <method> elements into
MethodContribution objects unless you tell it.  Try setting up the
parameters schema for your service interceptor factory the same way HM
does...

<service-point id="ProxyTimingInterceptor"
interface="org.apache.hivemind.ServiceInterceptorFactory"
parameters-schema-id="hivemind.MethodFilter">
  <create-instance class="my.package.ProxyJAMonTimingInterceptorFactory"/>
</service>

See if that helps.  I'm pretty sure you can refer to schemas defined in
other modules.  I wouldn't see any reason why you shouldn't be able to.

-----Original Message-----
From: David J. M. Karlsen [mailto:david@davidkarlsen.com] 
Sent: Thursday, May 12, 2005 7:39 AM
To: hivemind-dev@jakarta.apache.org
Subject: Re: interceptor: getting name of implemened interface


James Carman wrote:

That may certainly be the cause! I've never grasped the config, schema 
and config-contribution ideas....

relevant parts:

<service-point id="ProxyTimingInterceptor" 
interface="org.apache.hivemind.ServiceInterceptorFactory">
	<create-instance
class="my.package.ProxyJAMonTimingInterceptorFactory"/>
</service>



And later on, on a "normal service" I add this after the invoke-factory 
element

<interceptor service-id="ProxyTimingInterceptor">
	<method include="*"/>
	<method exclude="test"/>
</interceptor>

what am I missing out on?


> Actually, I think that might happen when you omit the schema 
> altogether. Can you paste in your hivemodule.xml file (or the relevant 
> pieces of it)?
> 
> -----Original Message-----
> From: James Carman [mailto:james@carmanconsulting.com]
> Sent: Thursday, May 12, 2005 7:26 AM
> To: hivemind-dev@jakarta.apache.org
> Subject: RE: interceptor: getting name of implemened interface
> 
> 
> Did you make sure you called addElement() at the end of your schema 
> rules?
> 
> -----Original Message-----
> From: David J. M. Karlsen [mailto:david@davidkarlsen.com]
> Sent: Thursday, May 12, 2005 7:18 AM
> To: hivemind-dev@jakarta.apache.org
> Subject: Re: interceptor: getting name of implemened interface
> 
> 
> Knut Wannheden wrote:
> 
>>David,
>>
>>Yes all method calls will go through the interceptor you add. It is 
>>thus up to the interceptor to decide whether it should actually do 
>>something or just pass on to the delegate. For the interceptor to know 
>>what to do the interceptor factory must pass the parameters (in your 
>>case <include> and <exclude>) on (e.g. through the interceptor 
>>constructor).
>>
>>If you like you can also take a look at HiveMind's logging interceptor 
>>LoggingInterceptorFactory. It uses Javassist to create an interceptor 
>>class and an instance thereof on the fly. The <include> and <exclude> 
>>method matching logic is encapsulated directly by this generated 
>>class. You may of course also prefer the dynamic proxy approach and 
>>code a generic interceptor class yourself. YMMV.
> 
> 
> I took a look at the class - but I'm a little confused over this:
> 
> In the LoggingInterceptorFactory you get a List of parameters (the
> include/exclude patterns), and the elements in the list are cast to 
> MethodContribution objects.
> 
> In my interceptorfactory I receive a List of parameters containing
> org.apache.hivemind.impl.ElementImpl objects.
> 
> Howcome?
> 
> 


-- 
David J. M. Karlsen - +47 90 68 22 43 http://www.davidkarlsen.com
http://mp3.davidkarlsen.com

---------------------------------------------------------------------
To unsubscribe, e-mail: hivemind-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: hivemind-dev-help@jakarta.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: hivemind-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: hivemind-dev-help@jakarta.apache.org


Re: interceptor: getting name of implemened interface

Posted by "David J. M. Karlsen" <da...@davidkarlsen.com>.
James Carman wrote:

That may certainly be the cause! I've never grasped the config, schema 
and config-contribution ideas....

relevant parts:

<service-point id="ProxyTimingInterceptor" 
interface="org.apache.hivemind.ServiceInterceptorFactory">
	<create-instance class="my.package.ProxyJAMonTimingInterceptorFactory"/>
</service>



And later on, on a "normal service" I add this after the invoke-factory 
element

<interceptor service-id="ProxyTimingInterceptor">
	<method include="*"/>
	<method exclude="test"/>
</interceptor>

what am I missing out on?


> Actually, I think that might happen when you omit the schema altogether.
> Can you paste in your hivemodule.xml file (or the relevant pieces of it)?
> 
> -----Original Message-----
> From: James Carman [mailto:james@carmanconsulting.com] 
> Sent: Thursday, May 12, 2005 7:26 AM
> To: hivemind-dev@jakarta.apache.org
> Subject: RE: interceptor: getting name of implemened interface
> 
> 
> Did you make sure you called addElement() at the end of your schema rules?  
> 
> -----Original Message-----
> From: David J. M. Karlsen [mailto:david@davidkarlsen.com] 
> Sent: Thursday, May 12, 2005 7:18 AM
> To: hivemind-dev@jakarta.apache.org
> Subject: Re: interceptor: getting name of implemened interface
> 
> 
> Knut Wannheden wrote:
> 
>>David,
>>
>>Yes all method calls will go through the interceptor you add. It is
>>thus up to the interceptor to decide whether it should actually do 
>>something or just pass on to the delegate. For the interceptor to know 
>>what to do the interceptor factory must pass the parameters (in your 
>>case <include> and <exclude>) on (e.g. through the interceptor 
>>constructor).
>>
>>If you like you can also take a look at HiveMind's logging interceptor
>>LoggingInterceptorFactory. It uses Javassist to create an interceptor 
>>class and an instance thereof on the fly. The <include> and <exclude> 
>>method matching logic is encapsulated directly by this generated 
>>class. You may of course also prefer the dynamic proxy approach and 
>>code a generic interceptor class yourself. YMMV.
> 
> 
> I took a look at the class - but I'm a little confused over this:
> 
> In the LoggingInterceptorFactory you get a List of parameters (the 
> include/exclude patterns), and the elements in the list are cast to 
> MethodContribution objects.
> 
> In my interceptorfactory I receive a List of parameters containing 
> org.apache.hivemind.impl.ElementImpl objects.
> 
> Howcome?
> 
> 


-- 
David J. M. Karlsen - +47 90 68 22 43
http://www.davidkarlsen.com
http://mp3.davidkarlsen.com

---------------------------------------------------------------------
To unsubscribe, e-mail: hivemind-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: hivemind-dev-help@jakarta.apache.org


RE: interceptor: getting name of implemened interface

Posted by James Carman <ja...@carmanconsulting.com>.
Actually, I think that might happen when you omit the schema altogether.
Can you paste in your hivemodule.xml file (or the relevant pieces of it)?

-----Original Message-----
From: James Carman [mailto:james@carmanconsulting.com] 
Sent: Thursday, May 12, 2005 7:26 AM
To: hivemind-dev@jakarta.apache.org
Subject: RE: interceptor: getting name of implemened interface


Did you make sure you called addElement() at the end of your schema rules?  

-----Original Message-----
From: David J. M. Karlsen [mailto:david@davidkarlsen.com] 
Sent: Thursday, May 12, 2005 7:18 AM
To: hivemind-dev@jakarta.apache.org
Subject: Re: interceptor: getting name of implemened interface


Knut Wannheden wrote:
> David,
> 
> Yes all method calls will go through the interceptor you add. It is
> thus up to the interceptor to decide whether it should actually do 
> something or just pass on to the delegate. For the interceptor to know 
> what to do the interceptor factory must pass the parameters (in your 
> case <include> and <exclude>) on (e.g. through the interceptor 
> constructor).
> 
> If you like you can also take a look at HiveMind's logging interceptor
> LoggingInterceptorFactory. It uses Javassist to create an interceptor 
> class and an instance thereof on the fly. The <include> and <exclude> 
> method matching logic is encapsulated directly by this generated 
> class. You may of course also prefer the dynamic proxy approach and 
> code a generic interceptor class yourself. YMMV.

I took a look at the class - but I'm a little confused over this:

In the LoggingInterceptorFactory you get a List of parameters (the 
include/exclude patterns), and the elements in the list are cast to 
MethodContribution objects.

In my interceptorfactory I receive a List of parameters containing 
org.apache.hivemind.impl.ElementImpl objects.

Howcome?


-- 
David J. M. Karlsen - +47 90 68 22 43 http://www.davidkarlsen.com
http://mp3.davidkarlsen.com

---------------------------------------------------------------------
To unsubscribe, e-mail: hivemind-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: hivemind-dev-help@jakarta.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: hivemind-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: hivemind-dev-help@jakarta.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: hivemind-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: hivemind-dev-help@jakarta.apache.org


RE: interceptor: getting name of implemened interface

Posted by James Carman <ja...@carmanconsulting.com>.
Did you make sure you called addElement() at the end of your schema rules?  

-----Original Message-----
From: David J. M. Karlsen [mailto:david@davidkarlsen.com] 
Sent: Thursday, May 12, 2005 7:18 AM
To: hivemind-dev@jakarta.apache.org
Subject: Re: interceptor: getting name of implemened interface


Knut Wannheden wrote:
> David,
> 
> Yes all method calls will go through the interceptor you add. It is 
> thus up to the interceptor to decide whether it should actually do 
> something or just pass on to the delegate. For the interceptor to know 
> what to do the interceptor factory must pass the parameters (in your 
> case <include> and <exclude>) on (e.g. through the interceptor 
> constructor).
> 
> If you like you can also take a look at HiveMind's logging interceptor 
> LoggingInterceptorFactory. It uses Javassist to create an interceptor 
> class and an instance thereof on the fly. The <include> and <exclude> 
> method matching logic is encapsulated directly by this generated 
> class. You may of course also prefer the dynamic proxy approach and 
> code a generic interceptor class yourself. YMMV.

I took a look at the class - but I'm a little confused over this:

In the LoggingInterceptorFactory you get a List of parameters (the 
include/exclude patterns), and the elements in the list are cast to 
MethodContribution objects.

In my interceptorfactory I receive a List of parameters containing 
org.apache.hivemind.impl.ElementImpl objects.

Howcome?


-- 
David J. M. Karlsen - +47 90 68 22 43 http://www.davidkarlsen.com
http://mp3.davidkarlsen.com

---------------------------------------------------------------------
To unsubscribe, e-mail: hivemind-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: hivemind-dev-help@jakarta.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: hivemind-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: hivemind-dev-help@jakarta.apache.org


Re: interceptor: getting name of implemened interface

Posted by "David J. M. Karlsen" <da...@davidkarlsen.com>.
Knut Wannheden wrote:
> David,
> 
> Yes all method calls will go through the interceptor you add. It is
> thus up to the interceptor to decide whether it should actually do
> something or just pass on to the delegate. For the interceptor to know
> what to do the interceptor factory must pass the parameters (in your
> case <include> and <exclude>) on (e.g. through the interceptor
> constructor).
> 
> If you like you can also take a look at HiveMind's logging interceptor
> LoggingInterceptorFactory. It uses Javassist to create an interceptor
> class and an instance thereof on the fly. The <include> and <exclude>
> method matching logic is encapsulated directly by this generated
> class. You may of course also prefer the dynamic proxy approach and
> code a generic interceptor class yourself. YMMV.

I took a look at the class - but I'm a little confused over this:

In the LoggingInterceptorFactory you get a List of parameters (the 
include/exclude patterns), and the elements in the list are cast to 
MethodContribution objects.

In my interceptorfactory I receive a List of parameters containing 
org.apache.hivemind.impl.ElementImpl objects.

Howcome?


-- 
David J. M. Karlsen - +47 90 68 22 43
http://www.davidkarlsen.com
http://mp3.davidkarlsen.com

---------------------------------------------------------------------
To unsubscribe, e-mail: hivemind-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: hivemind-dev-help@jakarta.apache.org


Re: interceptor: getting name of implemened interface

Posted by "David J. M. Karlsen" <da...@davidkarlsen.com>.
Knut Wannheden wrote:
> David,
> 
> On 5/25/05, David J. M. Karlsen <da...@davidkarlsen.com> wrote:
> 
>>Didn't help. I moved the return statement to after the catch block - now
>>  it works. Like this:
>>
> 
> 
> Glad you got it working finally!
Sort of:

Unable to create class $Interceptor_1041511b5ba_38: (class: 
$Interceptor_1041511b5ba_38, method: defaultIntValueOf signature: 
(Ljava/lang/String;Ljava/lang/Object;I)I) Expecting to find object/array 
on stack


but this only happens on some methods - not all.
Anything you recognize?


> I think that a lot of  problems have been fixed in Javassist 3.0 (and
> thus HiveMind 1.1). The problem you had with 'finally' for instance.
> Javassist has really worked great for HiveMind so far. Moreover as a
> HiveMind user you are free to implement the interceptor factories
> using dynamic proxies, CGLib, or any other framework. Thus I don't see
> a compelling reason for HiveMind to switch to another technology in
> this area.
That is true - but I save a lot of time by using the utilities already 
in hivemind (which are javassist-based). I'll have a peek at ASM though.


-- 
David J. M. Karlsen - +47 90 68 22 43
http://www.davidkarlsen.com
http://mp3.davidkarlsen.com

---------------------------------------------------------------------
To unsubscribe, e-mail: hivemind-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: hivemind-dev-help@jakarta.apache.org


Re: interceptor: getting name of implemened interface

Posted by Knut Wannheden <kn...@gmail.com>.
David,

On 5/25/05, David J. M. Karlsen <da...@davidkarlsen.com> wrote:
> Didn't help. I moved the return statement to after the catch block - now
>   it works. Like this:
> 

Glad you got it working finally!

> 
> I'm not too convinced over javassist. Will you concider CGlib or ASM
> instead?
> 

I think that a lot of  problems have been fixed in Javassist 3.0 (and
thus HiveMind 1.1). The problem you had with 'finally' for instance.
Javassist has really worked great for HiveMind so far. Moreover as a
HiveMind user you are free to implement the interceptor factories
using dynamic proxies, CGLib, or any other framework. Thus I don't see
a compelling reason for HiveMind to switch to another technology in
this area.

--knut

---------------------------------------------------------------------
To unsubscribe, e-mail: hivemind-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: hivemind-dev-help@jakarta.apache.org


RE: interceptor: getting name of implemened interface

Posted by James Carman <ja...@carmanconsulting.com>.
You can use whatever you want to write interceptors, that's the beauty of
the framework.  So, to get it working, you might consider using the
MethodInterceptorFactory rather than trying to create an interceptor using
bytecode manipulation/generation.

-----Original Message-----
From: David J. M. Karlsen [mailto:david@davidkarlsen.com] 
Sent: Wednesday, May 25, 2005 11:40 AM
To: hivemind-dev@jakarta.apache.org
Subject: Re: interceptor: getting name of implemened interface

Knut Wannheden wrote:
> David,
> 
> On 5/25/05, David J. M. Karlsen <da...@davidkarlsen.com> wrote:
> 
>>Hmm, HM1.1 is still beta stuff - and I need a very stable
>>production-ready API. How many more betas?
>>
>>So I went for the try/catch, but I still get a source-error - "no return
>>statement". BodyBuilder toString():
>>
>>{
>>   com.jamonapi.Monitor mon =
>>com.jamonapi.MonitorFactory.start("sendAndReceive");
>>   try {
>>   Object result = _delegate.sendAndReceive($$);
>>   mon.stop();
>>   return ($r) result;
>>   }
>>   catch (Throwable t){
>>   if (mon!=null) mon.stop();
>>   throw t;
>>   };
>>}
>>
>>
> Hmm, maybe that's another Javassist bug. Try removing that last
> semicolon (after the '}')...

Didn't help. I moved the return statement to after the catch block - now 
  it works. Like this:

  com.jamonapi.Monitor mon = 
com.jamonapi.MonitorFactory.start("sendAndReceive");
   Object result = null;
   try {
   result = _delegate.sendAndReceive($$);
   mon.stop();
   }
   catch (Throwable t){
   if (mon!=null) mon.stop();
   throw t;
   };
   return ($r) result;



I'm not too convinced over javassist. Will you concider CGlib or ASM 
instead?

-- 
David J. M. Karlsen - +47 90 68 22 43
http://www.davidkarlsen.com
http://mp3.davidkarlsen.com

---------------------------------------------------------------------
To unsubscribe, e-mail: hivemind-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: hivemind-dev-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: hivemind-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: hivemind-dev-help@jakarta.apache.org


Re: interceptor: getting name of implemened interface

Posted by "David J. M. Karlsen" <da...@davidkarlsen.com>.
Knut Wannheden wrote:
> David,
> 
> On 5/25/05, David J. M. Karlsen <da...@davidkarlsen.com> wrote:
> 
>>Hmm, HM1.1 is still beta stuff - and I need a very stable
>>production-ready API. How many more betas?
>>
>>So I went for the try/catch, but I still get a source-error - "no return
>>statement". BodyBuilder toString():
>>
>>{
>>   com.jamonapi.Monitor mon =
>>com.jamonapi.MonitorFactory.start("sendAndReceive");
>>   try {
>>   Object result = _delegate.sendAndReceive($$);
>>   mon.stop();
>>   return ($r) result;
>>   }
>>   catch (Throwable t){
>>   if (mon!=null) mon.stop();
>>   throw t;
>>   };
>>}
>>
>>
> Hmm, maybe that's another Javassist bug. Try removing that last
> semicolon (after the '}')...

Didn't help. I moved the return statement to after the catch block - now 
  it works. Like this:

  com.jamonapi.Monitor mon = 
com.jamonapi.MonitorFactory.start("sendAndReceive");
   Object result = null;
   try {
   result = _delegate.sendAndReceive($$);
   mon.stop();
   }
   catch (Throwable t){
   if (mon!=null) mon.stop();
   throw t;
   };
   return ($r) result;



I'm not too convinced over javassist. Will you concider CGlib or ASM 
instead?

-- 
David J. M. Karlsen - +47 90 68 22 43
http://www.davidkarlsen.com
http://mp3.davidkarlsen.com

---------------------------------------------------------------------
To unsubscribe, e-mail: hivemind-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: hivemind-dev-help@jakarta.apache.org


Re: interceptor: getting name of implemened interface

Posted by Knut Wannheden <kn...@gmail.com>.
David,

On 5/25/05, David J. M. Karlsen <da...@davidkarlsen.com> wrote:
> Hmm, HM1.1 is still beta stuff - and I need a very stable
> production-ready API. How many more betas?
> 
> So I went for the try/catch, but I still get a source-error - "no return
> statement". BodyBuilder toString():
> 
> {
>    com.jamonapi.Monitor mon =
> com.jamonapi.MonitorFactory.start("sendAndReceive");
>    try {
>    Object result = _delegate.sendAndReceive($$);
>    mon.stop();
>    return ($r) result;
>    }
>    catch (Throwable t){
>    if (mon!=null) mon.stop();
>    throw t;
>    };
> }
> 
> 

Hmm, maybe that's another Javassist bug. Try removing that last
semicolon (after the '}')...

--knut

---------------------------------------------------------------------
To unsubscribe, e-mail: hivemind-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: hivemind-dev-help@jakarta.apache.org


Re: interceptor: getting name of implemened interface

Posted by "David J. M. Karlsen" <da...@davidkarlsen.com>.
Knut Wannheden wrote:
> David,
> 
> On 5/25/05, David J. M. Karlsen <da...@davidkarlsen.com> wrote:
> 
>>Knut Wannheden wrote:
>>
>>>David,
>>>
>>>
>>>The problem is a class loader issue. You're creating your own
>>>ClassFactory instance, which in turn uses its own Javassist ClassPool,
>>>which can't find the PooledProxy class HiveMind created using its own
>>>ClassPool. You'll have to use HiveMind's ClassFactory.
>>>
>>>For this you should define a setFactory(ClassFactory) method on your
>>>interceptor factory and then add a line like this to the <construct>
>>>of your interceptor factory service:
>>>
>>> <set-service property="factory" service-id="hivemind.ClassFactory"/>
>>
>>Cool - now it nearly works. But I'm using a finally block with classfab
>>- and this doesn't seem to be supported:
>>
> 
> 
> This is a limitation in Javassist. I think it's been fixed in version
> 3.0. So you could either try to use HiveMind 1.1 (your interceptor
> factory needs to be slightly changed for this) or you could try to
> work without finally; i.e. try working with try { ... } catch(...) {
> ... }.
Hmm, HM1.1 is still beta stuff - and I need a very stable 
production-ready API. How many more betas?

So I went for the try/catch, but I still get a source-error - "no return 
statement". BodyBuilder toString():

{
   com.jamonapi.Monitor mon = 
com.jamonapi.MonitorFactory.start("sendAndReceive");
   try {
   Object result = _delegate.sendAndReceive($$);
   mon.stop();
   return ($r) result;
   }
   catch (Throwable t){
   if (mon!=null) mon.stop();
   throw t;
   };
}





-- 
David J. M. Karlsen - +47 90 68 22 43
http://www.davidkarlsen.com
http://mp3.davidkarlsen.com

---------------------------------------------------------------------
To unsubscribe, e-mail: hivemind-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: hivemind-dev-help@jakarta.apache.org


Re: interceptor: getting name of implemened interface

Posted by Knut Wannheden <kn...@gmail.com>.
David,

On 5/25/05, David J. M. Karlsen <da...@davidkarlsen.com> wrote:
> Knut Wannheden wrote:
> > David,
> >
> >
> > The problem is a class loader issue. You're creating your own
> > ClassFactory instance, which in turn uses its own Javassist ClassPool,
> > which can't find the PooledProxy class HiveMind created using its own
> > ClassPool. You'll have to use HiveMind's ClassFactory.
> >
> > For this you should define a setFactory(ClassFactory) method on your
> > interceptor factory and then add a line like this to the <construct>
> > of your interceptor factory service:
> >
> >  <set-service property="factory" service-id="hivemind.ClassFactory"/>
> Cool - now it nearly works. But I'm using a finally block with classfab
> - and this doesn't seem to be supported:
> 

This is a limitation in Javassist. I think it's been fixed in version
3.0. So you could either try to use HiveMind 1.1 (your interceptor
factory needs to be slightly changed for this) or you could try to
work without finally; i.e. try working with try { ... } catch(...) {
... }.

--knut

---------------------------------------------------------------------
To unsubscribe, e-mail: hivemind-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: hivemind-dev-help@jakarta.apache.org


Re: interceptor: getting name of implemened interface

Posted by "David J. M. Karlsen" <da...@davidkarlsen.com>.
Knut Wannheden wrote:
> David,
> 
> 
> The problem is a class loader issue. You're creating your own
> ClassFactory instance, which in turn uses its own Javassist ClassPool,
> which can't find the PooledProxy class HiveMind created using its own
> ClassPool. You'll have to use HiveMind's ClassFactory.
> 
> For this you should define a setFactory(ClassFactory) method on your
> interceptor factory and then add a line like this to the <construct>
> of your interceptor factory service:
> 
>  <set-service property="factory" service-id="hivemind.ClassFactory"/>
Cool - now it nearly works. But I'm using a finally block with classfab 
- and this doesn't seem to be supported:


BodyBuilder.toString():


   com.jamonapi.Monitor mon = 
com.jamonapi.MonitorFactory.start("sendAndReceive");
   try {
   return _delegate.sendAndReceive($$);
   }
   finally {
   mon.stop();
   };
}

  (JAMonInterceptorFactory.java:155)
2005-05-25 16:03:59,696 [main] ERROR 
org.apache.hivemind.schema.rules.ReadContentRule  - Error at 
file:/Q:/hivemodule.xml, line 62, column 14: Unable to process content 
of element construct/service: Unable to add method org.dom4j.Document 
sendAndReceive(MyPackage.MyType, org.dom4j.Document, java.lang.Integer) 
throws TransportException to class $Interceptor_104142ab208_35: [source 
error] sorry, finally has not been supported yet 
(DefaultErrorHandler.java:37)


will it be supported in 1.1?

-- 
David J. M. Karlsen - +47 90 68 22 43
http://www.davidkarlsen.com
http://mp3.davidkarlsen.com

---------------------------------------------------------------------
To unsubscribe, e-mail: hivemind-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: hivemind-dev-help@jakarta.apache.org


Re: interceptor: getting name of implemened interface

Posted by Knut Wannheden <kn...@gmail.com>.
David,

On 5/23/05, David J. M. Karlsen <da...@davidkarlsen.com> wrote:
> Knut Wannheden wrote:
> 
> 
> Hi - I took the javassist approach now, the code follows.
> I get an exception at classFab.addField("_delegate", topClass); in the
> createInfrastructure method.
> 
> The error is: Unable to process content of element construct/service:
> Unable to lookup $PooledProxy_1040a2b0b42_32:
> $PooledProxy_1040a2b0b42_32 (DefaultErrorHandler.java:37)
> 
> 
> Can you see why?
> 

The problem is a class loader issue. You're creating your own
ClassFactory instance, which in turn uses its own Javassist ClassPool,
which can't find the PooledProxy class HiveMind created using its own
ClassPool. You'll have to use HiveMind's ClassFactory.

For this you should define a setFactory(ClassFactory) method on your
interceptor factory and then add a line like this to the <construct>
of your interceptor factory service:

 <set-service property="factory" service-id="hivemind.ClassFactory"/>

--knut

---------------------------------------------------------------------
To unsubscribe, e-mail: hivemind-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: hivemind-dev-help@jakarta.apache.org


Re: interceptor: getting name of implemened interface

Posted by "David J. M. Karlsen" <da...@davidkarlsen.com>.
Knut Wannheden wrote:


Hi - I took the javassist approach now, the code follows.
I get an exception at classFab.addField("_delegate", topClass); in the 
createInfrastructure method.

The error is: Unable to process content of element construct/service: 
Unable to lookup $PooledProxy_1040a2b0b42_32: 
$PooledProxy_1040a2b0b42_32 (DefaultErrorHandler.java:37)


Can you see why?




import java.lang.reflect.Constructor;
import java.util.Iterator;
import java.util.List;

import org.apache.hivemind.ApplicationRuntimeException;
import org.apache.hivemind.InterceptorStack;
import org.apache.hivemind.ServiceInterceptorFactory;
import org.apache.hivemind.internal.Module;
import org.apache.hivemind.methodmatch.MethodMatcher;
import org.apache.hivemind.service.ClassFab;
import org.apache.hivemind.service.ClassFabUtils;
import org.apache.hivemind.service.ClassFactory;
import org.apache.hivemind.service.MethodContribution;
import org.apache.hivemind.service.MethodIterator;
import org.apache.hivemind.service.MethodSignature;
import org.apache.hivemind.service.impl.ClassFactoryImpl;

/**
  * @author  David J. M. karlsen
  *
  */
abstract public class AbstractInterceptorFactory implements 
ServiceInterceptorFactory {
	private ClassFactory factory = new ClassFactoryImpl();
	
	
	/* (non-Javadoc)
	 * @see 
org.apache.hivemind.ServiceInterceptorFactory#createInterceptor(org.apache.hivemind.InterceptorStack, 
org.apache.hivemind.internal.Module, java.util.List)
	 */
	public void createInterceptor(InterceptorStack stack, Module module, 
List parameterList) {
		Class interceptorClass = constructInterceptorClass(stack, parameterList);
		try {
			Object interceptor = instantiateInterceptor(stack, interceptorClass);
			stack.push(interceptor);
		}
		catch (Exception e){
			throw new ApplicationRuntimeException("Problem adding interceptor to 
service " + stack.getServiceExtensionPointId(), e);
		}
	}
	
	private Object instantiateInterceptor(InterceptorStack stack, Class 
interceptorClass) throws Exception {
		Object stackTop = stack.peek();
		Constructor constructor = interceptorClass.getConstructors()[0];
		
		return constructor.newInstance( new Object[] {stackTop} );
	}
	
	
	
	private Class constructInterceptorClass(InterceptorStack stack, List 
parameterList){
		Class serviceInterfaceClass = stack.getServiceInterface();
		String name = 
ClassFabUtils.generateClassName(serviceInterfaceClass.getName());
		
		ClassLoader classloader = 
stack.getServiceModule().getClassResolver().getClassLoader();
		ClassFab classFab = factory.newClass(name, Object.class, classloader);
		classFab.addInterface(serviceInterfaceClass);
		createInfrastructure(stack, classFab);
		addServiceMethods(stack, classFab, parameterList);
		
		return classFab.createClass();
	}
	
	private void createInfrastructure(InterceptorStack stack, ClassFab 
classFab){
		Class topClass = ClassFabUtils.getInstanceClass(stack.peek(), 
stack.getServiceInterface());
		classFab.addField("_delegate", topClass);
		classFab.addConstructor( new Class[] { topClass }, null, "{ _delegate 
= $1; }" );
	}
	
	
	private void addServiceMethods(InterceptorStack stack, ClassFab 
classFab, List parameterList){
		MethodMatcher matcher = buildMethodMatcher(parameterList);
		MethodIterator mi = new MethodIterator(stack.getServiceInterface());
		while (mi.hasNext()){
			MethodSignature sig = (MethodSignature) mi.next();
			if ( includeMethod(matcher, sig) ){
				addServiceMethodImplementation(classFab, sig);
			}
			else {
				addPassThroughMethodImplementation(classFab, sig);
			}
		}
	}
	
	private MethodMatcher buildMethodMatcher(List parameters){
		MethodMatcher result = new MethodMatcher();
		Iterator i = parameters.iterator();
		while (i.hasNext()){
			MethodContribution mc = (MethodContribution) i.next();
			result.put(mc.getMethodPattern(), mc);
		}
		
		return result;
	}
	
	private boolean includeMethod(MethodMatcher matcher, MethodSignature sig){
		if (matcher == null){
			return true;
		}
		
		MethodContribution mc = (MethodContribution) matcher.get(sig);
		return (mc == null) || mc.getInclude();
	}
	
	abstract void addServiceMethodImplementation(ClassFab classFab, 
MethodSignature sig);
	
	abstract void addPassThroughMethodImplementation(ClassFab classFab, 
MethodSignature sig);
	


> David,
> 
> Yes all method calls will go through the interceptor you add. It is
> thus up to the interceptor to decide whether it should actually do
> something or just pass on to the delegate. For the interceptor to know
> what to do the interceptor factory must pass the parameters (in your
> case <include> and <exclude>) on (e.g. through the interceptor
> constructor).
> 
> If you like you can also take a look at HiveMind's logging interceptor
> LoggingInterceptorFactory. It uses Javassist to create an interceptor
> class and an instance thereof on the fly. The <include> and <exclude>
> method matching logic is encapsulated directly by this generated
> class. You may of course also prefer the dynamic proxy approach and
> code a generic interceptor class yourself. YMMV.
> 
> HTH,
> 
> --knut
> 
> On 5/9/05, David J. M. Karlsen <da...@davidkarlsen.com> wrote:
> 
>>Knut Wannheden wrote:
>>
>>Super! Exactly what I needed! Over to the next problem:
>>I only want to profile some of the methods called, my config:
>>
>>In my service-declaration:
>>
>><interceptor service-id="ProxyTimingInterceptor">
>>        <include method="*execute*"/>
>>        <exclude method="*"/>
>></interceptor>
>>
>>but still, all methods are going through the interceptor.
>>
>>Any ideas?
>>
>>
>>>David,
>>>
>>>In the interceptor factory implementation you get passed the
>>>InterceptorStack object, which declares a getServiceInterface()
>>>method. You should be able to pass that into the constructor of your
>>>interceptor. The Class returned by getServiceInterface() will be a
>>>synthesized interface if the service in question is a bean service.
>>
>>>>I'm writing an interceptor for timing of method-calls (based on jamon).
>>>>
>>>>I want to get the name of the implemented service-interface from the
>>>>delegate passed to the constructor. (Following the example at:
>>>>http://jakarta.apache.org/hivemind/hivemind-examples/logging.html)
>>>>
>>>>How could I get the name the easiest way possible? Is there a
>>>>helper-class somewhere? How am I assured to get the name of the
>>>>interface of the service (in all cases, the delegate is another class
>>>>depending on service-model, other interceptors and so on). I want to
>>>>avoid a lot of introspection and checking on Hivemind specific
>>>>service-models etc.).


-- 
David J. M. Karlsen - +47 90 68 22 43
http://www.davidkarlsen.com
http://mp3.davidkarlsen.com


---------------------------------------------------------------------
To unsubscribe, e-mail: hivemind-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: hivemind-dev-help@jakarta.apache.org


Re: interceptor: getting name of implemened interface

Posted by Knut Wannheden <kn...@gmail.com>.
David,

Yes all method calls will go through the interceptor you add. It is
thus up to the interceptor to decide whether it should actually do
something or just pass on to the delegate. For the interceptor to know
what to do the interceptor factory must pass the parameters (in your
case <include> and <exclude>) on (e.g. through the interceptor
constructor).

If you like you can also take a look at HiveMind's logging interceptor
LoggingInterceptorFactory. It uses Javassist to create an interceptor
class and an instance thereof on the fly. The <include> and <exclude>
method matching logic is encapsulated directly by this generated
class. You may of course also prefer the dynamic proxy approach and
code a generic interceptor class yourself. YMMV.

HTH,

--knut

On 5/9/05, David J. M. Karlsen <da...@davidkarlsen.com> wrote:
> Knut Wannheden wrote:
> 
> Super! Exactly what I needed! Over to the next problem:
> I only want to profile some of the methods called, my config:
> 
> In my service-declaration:
> 
> <interceptor service-id="ProxyTimingInterceptor">
>         <include method="*execute*"/>
>         <exclude method="*"/>
> </interceptor>
> 
> but still, all methods are going through the interceptor.
> 
> Any ideas?
> 
> > David,
> >
> > In the interceptor factory implementation you get passed the
> > InterceptorStack object, which declares a getServiceInterface()
> > method. You should be able to pass that into the constructor of your
> > interceptor. The Class returned by getServiceInterface() will be a
> > synthesized interface if the service in question is a bean service.
> 
> >>I'm writing an interceptor for timing of method-calls (based on jamon).
> >>
> >>I want to get the name of the implemented service-interface from the
> >>delegate passed to the constructor. (Following the example at:
> >>http://jakarta.apache.org/hivemind/hivemind-examples/logging.html)
> >>
> >>How could I get the name the easiest way possible? Is there a
> >>helper-class somewhere? How am I assured to get the name of the
> >>interface of the service (in all cases, the delegate is another class
> >>depending on service-model, other interceptors and so on). I want to
> >>avoid a lot of introspection and checking on Hivemind specific
> >>service-models etc.).
> 
> --
> David J. M. Karlsen - +47 90 68 22 43
> http://www.davidkarlsen.com
> http://mp3.davidkarlsen.com
>

---------------------------------------------------------------------
To unsubscribe, e-mail: hivemind-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: hivemind-dev-help@jakarta.apache.org


Re: interceptor: getting name of implemened interface

Posted by "David J. M. Karlsen" <da...@davidkarlsen.com>.
Knut Wannheden wrote:


Super! Exactly what I needed! Over to the next problem:
I only want to profile some of the methods called, my config:

In my service-declaration:

<interceptor service-id="ProxyTimingInterceptor">
	<include method="*execute*"/>
	<exclude method="*"/>
</interceptor>

but still, all methods are going through the interceptor.

Any ideas?

> David,
> 
> In the interceptor factory implementation you get passed the
> InterceptorStack object, which declares a getServiceInterface()
> method. You should be able to pass that into the constructor of your
> interceptor. The Class returned by getServiceInterface() will be a
> synthesized interface if the service in question is a bean service.

>>I'm writing an interceptor for timing of method-calls (based on jamon).
>>
>>I want to get the name of the implemented service-interface from the
>>delegate passed to the constructor. (Following the example at:
>>http://jakarta.apache.org/hivemind/hivemind-examples/logging.html)
>>
>>How could I get the name the easiest way possible? Is there a
>>helper-class somewhere? How am I assured to get the name of the
>>interface of the service (in all cases, the delegate is another class
>>depending on service-model, other interceptors and so on). I want to
>>avoid a lot of introspection and checking on Hivemind specific
>>service-models etc.).


-- 
David J. M. Karlsen - +47 90 68 22 43
http://www.davidkarlsen.com
http://mp3.davidkarlsen.com

---------------------------------------------------------------------
To unsubscribe, e-mail: hivemind-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: hivemind-dev-help@jakarta.apache.org


Re: interceptor: getting name of implemened interface

Posted by Knut Wannheden <kn...@gmail.com>.
David,

In the interceptor factory implementation you get passed the
InterceptorStack object, which declares a getServiceInterface()
method. You should be able to pass that into the constructor of your
interceptor. The Class returned by getServiceInterface() will be a
synthesized interface if the service in question is a bean service.

--knut 

On 5/9/05, David J. M. Karlsen <da...@davidkarlsen.com> wrote:
> Hi!
> 
> I'm writing an interceptor for timing of method-calls (based on jamon).
> 
> I want to get the name of the implemented service-interface from the
> delegate passed to the constructor. (Following the example at:
> http://jakarta.apache.org/hivemind/hivemind-examples/logging.html)
> 
> How could I get the name the easiest way possible? Is there a
> helper-class somewhere? How am I assured to get the name of the
> interface of the service (in all cases, the delegate is another class
> depending on service-model, other interceptors and so on). I want to
> avoid a lot of introspection and checking on Hivemind specific
> service-models etc.).
> 
> Kind regards,
> David K.
> 
> --
> David J. M. Karlsen - +47 90 68 22 43
> http://www.davidkarlsen.com
> http://mp3.davidkarlsen.com
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: hivemind-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: hivemind-dev-help@jakarta.apache.org
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: hivemind-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: hivemind-dev-help@jakarta.apache.org