Jérôme Baumgarten wrote:
I understand that to do simple proxying all I need to do is to
implement my own ContextPartition. But this is only the first step of
what I plan to do.
Jerome if you want to build a simple proxy there is an easier way.
You can just use the front end of the server and inject your own
handlers. Here's the code base below. This code is tiny and easy to
understand by just reading it. You'll see that you can substitute the
handlers we use for your own.
http://svn.apache.org/viewcvs.cgi/directory/protocol-providers/ldap/trunk/
Here's the main provider class:
http://svn.apache.org/viewcvs.cgi/directory/protocol-providers/ldap/trunk/src/main/java/org/apache/ldap/server/protocol/LdapProtocolProvider.java?rev=201512&view=markup
If you look at the code you'll notice that you can replace the handlers
used by adding them to the JNDI environment. The property key is the
fully qualified class name of the request data type. The property value
is the fully qualified class name of the MessageHandler implementation
class that processes the request. So for example if I add this property:
<prop
key="org.apache.ldap.common.message.AddRequest">com.mycompany.MyProxyingAddHandler</prop>
Then the frontend will use a single instance of your
MyProxyingAddHandler to process AddRequests. FYI I think I got paranoid
and added the following too (Note the Impl in key name):
<prop
key="org.apache.ldap.common.message.AddRequestImpl">com.mycompany.MyProxyingAddHandler</prop>
<snip-all/>
I hope this helps,
Alex