Jérôme Baumgarten wrote:
Alex, I'm totaly new to ApacheDS and and I don't really see where to
go with your solution. I mean do I just need to do what you suggest
and launch the server (as explained on the web site) and it will do
the trick ?
No in this case you would create your own proxy server by using ApDS'
frontend code. You fire up mina, then register the LDAP protocol
provider with mina. Let me show you some code you can put into a main:
Hashtable env = new Hashtable();
... set all env properties you need ...
... setup mina registry ...
int port = 389;
Service service = new Service( "ldap", TransportType.SOCKET, new
InetSocketAddress( port ) );
minaRegistry.bind( service, new LdapProtocolProvider( env );
At this point the LDAP service is listening on port 389. When you get a
connection with request the request will be delivered to your handlers.
Your handler can do anything you like including delegate the request to
be processed by another LDAP server as a "Proxy".
HTH,
Alex
I believe that would only allow using ApacheDS as one (1)
proxy server, meaning that I can't use the same ApacheDS server to
proxy multiple LDAP servers or even use it jointly as an LDAP server.
Regards,
Jerome
On 8/16/05, Alex Karasulu <[EMAIL PROTECTED]> wrote:
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