avalon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Donald <pe...@apache.org>
Subject Re: [proposal] custom component lookup
Date Fri, 21 Jun 2002 04:31:37 GMT
At 08:54 PM 6/20/2002 -0700, you wrote:
>Peter Donald wrote:
>ok, I actually forgot to put in a sentence/disclaimer at the end
>mentioning that it might possibly be more of an implementation thing than
>a framework thing...

;)

>but I also was wondering if there is any container extension mechanism
>that is shared by the Avalon containers - or if there are plans for
>anything like that?

It would be neat to have a generic interceptor architecture. For a 
buisness-esque type layer you could have interceptor interface such as

interface Interceptor
{
   Object invoke( InterceptorContext ctx, Object[] args ) throws Exception;
}

interface InterceptorContext
{
   ComponentMetaData getCaller();
   ComponentMetaData getCallee();
   DependencyMetaData getCalledInterface();
   String getMethodSignature();

   Object invokeNext( Object[] args ) throws Exception;
}

Possible impls...

class MyAuthorizingInterceptor implements Interceptor
{
   Object invoke( InterceptorContext ctx, Object[] args ) throws Exception
   {
      if( !isAuthorized( ctx.getCaller() ) ) throw SecurityException("...");
      return ctx.invokeNext( args );
   }
}

class MyTimingInterceptor implements Interceptor
{
   Object invoke( InterceptorContext ctx, Object[] args ) throws Exception
   {
      final long key = startTimer();

      try { return ctx.invokeNext( args ); }
      finally
      {
       final long time = endTimer( key );
       reportTime( time );
      }
   }
}

This would be particular useful to people who are using Avalon for Buisness 
level prgramming (in contrast to System-level programming).

However I don't know of any plans to implement this unless you want to 
volunteer ;)



Cheers,

Peter Donald
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"Faced with the choice between changing one's mind,
and proving that there is no need to do so - almost
everyone gets busy on the proof."
              - John Kenneth Galbraith
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


--
To unsubscribe, e-mail:   <mailto:avalon-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:avalon-dev-help@jakarta.apache.org>


Mime
View raw message