directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alex Karasulu <aok...@bellsouth.net>
Subject Re: Q: LookupFilter doesn't receive useful info
Date Mon, 13 Dec 2004 22:20:54 GMT
Mark,

I don't know if you are overriding the original filter service.  What 
you're doing can interfer with normal operation and you really need to 
know more about Eve's internals before attempting this.  I cannot really 
give you accurate advice unless I'm knee deep into what you are trying 
to do.  For example are you creating a new filter service in addition to 
or in place of the existing one?  So this is non-trivial. 

I recommend we take baby steps and make sure things work for the trivial 
use cases you have.  Once this 0.8.0 release is out I can help devise a 
general view/filtering mechanism in 0.9 where we can avoid stepping on 
our own toes.  Does this sound reasonable?

Alex


Mark Swanson wrote:

>>>I have successfully inserted my own SWLookupFilter into eve.
>>>      
>>>
>>This last sentence I still don't understand.   Where is this
>>LookupFilter code from?  Is this code yours?  Is this a filter you're
>>writing for your custom interceptors?
>>    
>>
>
>Oh. _my own_ SWLookupFilter. Yes, I wrote it. :-)
>
>I changed EveContextFactory like this:
>
>~line 480
>        FilterService filterService = new FilterServiceImpl();
>        SWLookupFilter swLookupFilter = new SWLookupFilter();
>        SWSearchResultFilter swSearchResultFilter = new 
>SWSearchResultFilter();
>        filterService.addLookupFilter(swLookupFilter);
>        filterService.addSearchResultFilter(swSearchResultFilter);
>        interceptor = (Interceptor)filterService;
>
>So by tapping into the FilterService interceptor, I was hoping to do the 
>dynamic rewriting the query and result here. If this is the wrong spot lemme 
>know.
>
>  
>
>>>SWLookupFilter.filter(LdapContext ctx, Name dn, Attributes entry) is
>>>called and I print out "dn" and "entry". I get the following:
>>>
>>>dn: empty
>>>entry:
>>>1. Apache Software Foundation
>>>2. ou=system
>>>3. dc=home2,dc=mark
>>>4. cn=schema,ou=system
>>>
>>>The problem/question is this: how is it possible for SWLookupFilter to do
>>>any sort of filtering or query rewriting when SWLookupFilter isn't
>>>presented with the query or baseDN? perhaps the baseDN is available in
>>>the LdapContext but looking at the API doesn't reveal it (to me at
>>>least).
>>>      
>>>
>>Well I'm going to presume u are trying to write an interceptor to filter
>>entries on a return for schedule world.  There really is nothing in this
>>trail that says anything like that but this is the only thing I can
>>think of after scratching my head here for 5 minutes.
>>    
>>
>
>Close, sorry for not giving enough info.
>
>  
>
>>Also note that btw a base search on the empty string DN is valid in
>>LDAP.  That's a search on the root DSE.  Now this might come into the
>>server if you are hitting it with a client that reads schema info.  I
>>recommend this...whip out ethereal and get it to show you what's being
>>sent by the client to be absolutely sure of what's happening.
>>    
>>
>
>I doubt it's empty as I'm explicitly specifying it. I'll whip out ethereal in 
>a minute...
>
>  
>
>>You can send that to me too.  Also if you like send the filter code.
>>I'll take a look at it.  BTW just to be sure ... this is your custom dev
>>code and not any bug that needs to be fixed for 0.8.0 right?
>>    
>>
>
>Yep.
>
>public class SWLookupFilter implements LookupFilter {
>
>    public SWLookupFilter() {
>        System.out.println("DEBUG: SWLookupFilter ctor.");
>    }
>
>    /*public void filter(LdapContext ctx, Name dn, Attributes entry)
>        throws NamingException {
>        filter(ctx, dn, entry);
>    }*/
>
>
>    public void filter(LdapContext ctx, Name dn, Attributes entry, String[] 
>ids)
>        throws NamingException {
>        filter(ctx, dn, entry);
>    }
>
>    public void filter(LdapContext ctx, Name dn, Attributes entry)
>        throws NamingException {
>        Name principalDn = ((EveContext)ctx).getPrincipal().getDn();
>        System.out.println("DEBUG: SWLookupFilter.filter() principalDn:" +
>            principalDn);
>        System.out.println("DEBUG: SWLookupFilter.filter() Name:" +
>            dn.getClass().getName());
>        System.out.println("DEBUG: SWLookupFilter.filter() dn components:");
>        int count = dn.size();
>        for (int i=0; i < count; ++i) {
>            String component = dn.get(i);
>            System.out.println("DEBUG: SWLookupFilter.filter() dn component:" 
>+
>                component);
>            if (component.startsWith("mozilla")) {
>                dn.remove(i);
>                dn.add(i, "super");
>            }
>        }
>
>        NamingEnumeration ne = entry.getAll();
>        for (; ne.hasMore(); ) {
>            Attribute attribute = (Attribute)ne.nextElement();
>            System.out.println("DEBUG: SWLookupFilter.filter() attributes:");
>            int size = attribute.size();
>            for (int i=0; i < size; ++i) {
>                Object o = attribute.get(i);
>                System.out.println("o:" + o.toString() + ", class:" +
>                    o.getClass().getName());
>            }
>        }
>    }
>}
>
>
>  
>


Mime
View raw message