directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Emmanuel Lécharny <elecha...@apache.org>
Subject [ADS 2.0] OSGi, interceptors
Date Thu, 13 Oct 2011 11:20:19 GMT
Hi,

Göktük asked if there is a way to transform Interceptors to be bundles 
instead of being statically loaded in core.

I tried to play around the idea yesterday in the train, and I faced some 
interesting challenges.

o First, many interecptors are doing calls to the chain again, but with 
a restricted set of interceptors. For instance, in the 
SchemaInterceptor, we go through the chain again when modifying the 
schema itself. In order to speedup the operation, we declare a BYPASS 
sets of interceptors (I'm not sure it's a good idea, but right now, this 
is how we proceed). At the end, this BYPASS set is declared this way :

     private static final Collection<String> BYPASS;

     static
     {
         Set<String> c = new HashSet<String>();
         c.add( AuthenticationInterceptor.class.getName() );
         c.add( AciAuthorizationInterceptor.class.getName() );
         c.add( DefaultAuthorizationInterceptor.class.getName() );
         c.add( ExceptionInterceptor.class.getName() );
         c.add( SchemaInterceptor.class.getName() );
         BYPASS = Collections.unmodifiableCollection( c );
     }

As we can see, it creates a static dependency on interceptors. It might 
be a better idea to use logical names instead of class names, and let 
the OSGi container retrieve the classes itself.

o Second, we have places in core were we call the interceptors, like in 
DefaultDirectoryService :

     public boolean isPwdPolicyEnabled()
     {
         AuthenticationInterceptor authenticationInterceptor = 
(AuthenticationInterceptor)getInterceptor( 
AuthenticationInterceptor.class.getName() );
         if ( authenticationInterceptor == null )
         {
             return false;
         }

         PpolicyConfigContainer pwdPolicyContainer = 
authenticationInterceptor.getPwdPolicyContainer();

         return ( ( pwdPolicyContainer != null )
&& ( ( pwdPolicyContainer.getDefaultPolicy() != null )
                 || ( pwdPolicyContainer.hasCustomConfigs() ) ) );
     }

I'm quite sure we should do that in anothr way...



Right, now, I'm experimenting, moving each interceptors into a dedicated 
project (under apacheds/interceptors/authn, ...) to see what are the 
impacts. I'll come back with some more informations when I'll have a 
clear vision about the impacts.

Tahnks !

-- 
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com


Mime
View raw message