Comments inline ...
On 7/8/10 2:15 PM, Peter Popov wrote:
Thanks Emmanuel, I did, and there's even an LDAP proxy project going on in
there as we speak, but it's not complete yet and being that it's part of the
Google Summer of Code competition, I'm not sure I can either reuse it or
contribute to it. I did look into it for tips though but they hadn't gotten
to the proxying part last time I checked. It is actually that part that
bothers me.ok. It's not that complicated all
I have an acceptor with a filter chain and event handlers, and I instantiate
a connector once an acceptor has a session going, hoping that in
handleMessage() I could just broadcast() to the connector. However I have to
do the same for responses, only in the opposite direction (from connector to
acceptor). I also have to maintain some kind of session table to match each
acceptor IoSession to the appropriate connector one. The logic gets
convoluted quite quickly and I'm already in deep spaghetti trying to handle
all those cases (and nowhere close to *actually* handling them). It gets
even tricker because both the acceptor and connector have to demux as well
as mux. In short, I am quite utterly lost.
I can understand :)
Writing a LDAP proxy is not simple.
First, you have to deal with the binary messages. Trust me, this is the
easy part :)
Then, you have to manage sessions. It not that complicated. The
architecture of a proxy looks like :
[clients] <---> [server | client] <---> [LDAP Server]
As the proxy is a combinaison of a server and a client, you already have
a session associated with each external client. Thus, you don't have to
create a dedicated map to handle that, it's already existing and is
managed by MINA.
Now, the problem is partly solved if you use the LdapConnection object
on the Proxy client's side, as the demux is already handled.
For the server part of the proxy, the best is to dissassemble the Ldap
server code to just keep the top level layer (ie, LdapProcotol handler).
As a side note, does broadcast() bypass the message dispatch mechanism? If I
broadcast() a message, it's not going to end up in the message handlers,
right?
Not sure that I understand what you mean by broadcast() ?
--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com