[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: LDAPI support in JLDAP



Hi Marc,

Thanks for your suggestions. I tried to create a subclass of
LDAPConnection but I was getting a lot of problems accessing
non-public methos/classes belonging to com.novell.java package.
But it gave me a different idea, I finally got it to work
using a custom socket factory.

First I create an LDAPIUrl to parse LDAPI URL:

  LDAPIUrl url = new LDAPIUrl("ldapi://%2ftmp%2ftest");

Then I create a LDAPISocketFactory and pass it to LDAPConnection:

  LDAPISocketFactory factory = new LDAPISocketFactory();
  LDAPConnection connection = new LDAPConnection(factory);

To establish the connection I use the hostname parameter of the
connect() function to pass the LDAPI path:

  connection.connect(url.getPath(), 0);

The socket factory will use the path to create the Unix domain
socket and ignore the port:

  public Socket createSocket(String path, int port) {

      AFUNIXSocket socket = AFUNIXSocket.newInstance();
      socket.connect(new AFUNIXSocketAddress(new File(path)));

      return socket;
  }

So thanks a lot and never mind about the proposal. :)

--
Endi S. Dewata


----- "Marc Boorshtein" <mboorshtein@gmail.com> wrote:

> Endi,
> 
> A few years ago I was able to add DSMLv2 and SPMLv1 support to JLDAP
> by creating subclasses of the LDAPConnection class.  This worked well
> without requiring changes to the rest of the JLDAP source code.  I
> used JLDAP as the core for the SQL Directory Browser, which supports
> both SPML and DSMLv2.  I think the same strategy would work with
> LDAPI?
> 
> Marc
> 
> 
> On Thu, Dec 3, 2009 at 6:26 PM, Endi Sukma Dewata <edewata@redhat.com>
> wrote:
> > Hello,
> >
> > Let me introduce myself, I'm working on the IPA & Samba integration
> > effort and I'm building a Java-based synchronization tool that
> > communicates with LDAP servers using the JLDAP library. Here is
> some
> > background about the project:
> > http://www.freeipa.org/page/IPAv3_development_status
> >
> > The LDAP servers used here is the 389 DS (formerly known as Fedora
> > DS). When it's used as Samba private backend, the DS is configured
> > only to listen to LDAPI protocol. I'm trying to use the JLDAP
> library,
> > but currently it doesn't seem to support LDAPI. I think it's
> natural
> > to add LDAPI support into JLDAP because OpenLDAP also supports
> LDAPI.
> > Is there already a plan to add this feature?
> >
> > I've been doing some investigation and it seems that it can be
> added
> > without too much effort because there's an existing library called
> > junixsocket which can provide access to Unix Domain Sockets from
> Java:
> > http://code.google.com/p/junixsocket/
> >
> > Here is a proposal of the changes need to be made to JLDAP in order
> > to support LDAPI:
> > http://www.freeipa.org/page/OpenLDAP_LDAPI_Support_in_JLDAP
> >
> > My questions are:
> > 1. Who is currently maintaining the JLDAP module?
> > 2. Is it ok to modify the IETF API slightly as described in the
> >   proposal?
> > 3. Is it ok to include junixsocket in JLDAP? Alternatively we could
> >   design a pluggable interface so other people can add new protocol
> >   schemes into JLDAP.
> >
> > Please let me know if you have any comments, questions, or
> > suggestions. Thank you very much.
> >
> > --
> > Endi S. Dewata
> >