[Ape] LDAP for APE

Shane Hathaway shane at hathawaymix.org
Tue Sep 7 22:09:00 EDT 2004


On Tuesday 07 September 2004 13:42 pm, Steven Lee wrote:
> It appears that I need to create OpenLDAPConnector class.  But
> python-ldap already has a class that returns ldap connection object,
> so I am wondering if I need to create one or just wrapper/interface to
> python-ldap class.  I was hoping to get a good example from sql
> mapper, but I can't seem to be able to find "DBAPIConnector", which is
> suppose to be from apelib.sql.dbapi.  Where can I find DBAPIConnector
> class spec?  What needs to be in the connector class?

In Ape 1.0, DBAPIConnector has been replaced with database-specific connector 
classes.  If you take another look at the examples in component.xml, you'll 
see the connection-class attribute now points to PostgreSQLConnection or 
MySQLConnection instead of DBAPIConnector.

The connection class needs to implement two interfaces: 
apelib.core.interfaces.ITPCConnection and the interface expected by the 
gateways.  Ape has two sets of gateways, one set for relational storage and 
one set for filesystem storage.  The relational set expects the connection to 
implement apelib.sql.interfaces.IRDBMSConnection; the filesystem set expects 
the connection to implement apelib.fs.interfaces.IFSReader and IFSWriter.

It's up to you to decide whether LDAP storage should look like a filesystem, 
like a relational database, or something else entirely.  If you use an 
existing set of gateways, you'll make progress quickly, but you'll have to 
make a wrapper around the existing LDAP class so that the connection 
implements the interfaces expected by the gateways.  Someone else made Ape 
work with Subversion (I really need to look at that) and had a lot of success 
by deciding that it should look like a filesystem.

Personally, I don't know what LDAP looks like when it's used as an arbitrary 
database.  Here are some characteristics to think about.

Filesystem:
- There are no types, so everything has to be encoded as a byte sequence
- There are no true primary keys because you can't address a filesystem node 
by ID, so a mapping of OID to path is required
- Directories and files are mutually exclusive: you can't put a byte sequence 
in a directory, and you can't put files inside a file
- Works independently of languages, platforms, and libraries

Relational database:
- There are types, but they are limited
- OIDs map easily to primary keys
- Before you can store anything, you have to define a schema
- Depends on libraries, platforms, and sometimes languages

Which does LDAP look like?  Perhaps it's even a combination.

Shane


More information about the Ape mailing list