directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jaka Jaksic" <jaka.jak...@telemach.net>
Subject RE: How to separate LDAP protocol handler?
Date Sat, 20 May 2006 23:32:22 GMT
Sorry for posting twice. I didn't want to rush anyone, I just thought that
my first post didn't get to the list, since it didn't appear in the archive
even the next day.

Thanks for your reply, Emmanuel. After reading your mail, I immediately
found what I was looking for, I don't know how it escaped me the first
time...

> 1. LdapProtocolHandler creates the handlers in a static block and 
> places them in an unmodifiable map, which prevents handlers from being
replaced.

This is false. Only the default handlers are static, but they aren't used if
proper environment properties are set.

So to use the LdapProtocolProvider with custom directory implementation, all
I needed to do is this:

	...
	Hashtable env = ...
	// map search request types to my own handler
	env.put(SearchRequest.class.getName(),
MySearchHandler.class.getName());
	env.put(SearchRequestImpl.class.getName(),
MySearchHandler.class.getName());
	LdapProtocolProvider protocolProvider = new
LdapProtocolProvider(env);
	...

I think this should be documented better, as it is very useful. I can
provide a Hello World LDAP example if anyone is interested.


Regards,
Jaka


-----Original Message-----
From: Emmanuel Lecharny [mailto:elecharny@gmail.com] 
Sent: Friday, May 19, 2006 5:34 PM
To: Apache Directory Developers List
Subject: Re: How to separate LDAP protocol handler?

Hi !

we have already saw your first post, sorry that nobody replied, but a lot of
ADS developpers are at JavaOne currently...

You will have to wait a few days :(

However, for what you are doing, may be the best would be just to erase the
content of each handlers (Bind, Search) and to map your own
logic inside. Just keep   the objects that you receive which contains
the request values.

Modifying the Map does not really make sense as the handlers are tightly
related to Ldap operations.

Do you need to use a LdapContext at all?

Emmanuel


On 5/17/06, Jaka Jaksic <jaka.jaksic@asolsme.com> wrote:
> Hi!
>
>
> We've been trying, with no luck, to accomplish something that should 
> be quite simple. What we want to do is to create a tiny LDAP server 
> serving simple read-only content (a list of users) from our database. 
> According to ApacheDS homepage, that should be easily doable by using 
> only the LDAP protocol provider, which is supposed to be nicely 
> separable from the rest of the product. However, everything seems to 
> be very tightly coupled, to the point where I find this seemingly 
> simple task pretty much impossible to do (at least without nasty hacking).
>
> I'm pretty sure we're missing something here, but we couldn't find any 
> useful documentation on this topic, and also the link to Alex's 
> presentation on ApacheCon04 (which is supposed explain the 
> architecture and integration in greater detail) doesn't work.
>
> Here's what we found out about the code so far, which I think prevents 
> the protocol handler from being used separately:
>
> 1. LdapProtocolHandler creates the handlers in a static block and 
> places them in an unmodifiable map, which prevents handlers from being
replaced.
>
> 2. SearchHandler seems to depend on ServerLdapContext (ctx = ( 
> ServerLdapContext ) unknown), which prevents using another LdapContext 
> implementation.
>
> 3. DefaultDirectoryService and DefaultDirectoryServiceConfiguration 
> are package private and rewriting them from scratch seems like a lot 
> of unnecessary work.
>
> All we would really need is to just plug in our own LdapContext or 
> SearchHandler and remove the underlying directory implementation. Or 
> something which would provide the same effect.
>
> I'll be very grateful for any kind of advice!
>
>
> Thanks and regards,
> Jaka
>


Mime
View raw message