directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ole Ersoy <ole.er...@gmail.com>
Subject [DAS] Unique IDs for Model Instances (Was Initial Context?)
Date Thu, 19 Apr 2007 05:18:47 GMT
I think I got it.

Here's the challenge:

We have a DN like this:

DN: cn=accounts, cn=users, cn=example, ou=com

That corresponds to a model namespace like this:

http://example.com/users/accounts

So under the RDN cn=accounts there are several model
instances stored.

What should the RDN for each of these instances be?

Here's what I'm thinking the process is:

For each model instance we generate a surrogate key.

We do that by getting the total number of children that
the context cn=accounts, cn=users, cn=example, ou=com
has, and then add 1.  So if there are 14 children, the
new child gets a surrogate key assigned to it which is
15.

Then we write the surrogate key, along with a descriptive human
readable/identifiable string (Like "Alex Karasulu") taken from one of 
the root object's attributes a file designated
by the DAS's configuration.  This is so that if the server
crashes (Hardware - never ADS), we'll know because we did
not write a completion flag into the file, and next time we run
the DAS it can recover.


Then we create the subcontext like this (dirContext is
cn=accounts, cn=users, cn=example, ou=com):

dirContext.createSubcontext("cn=15", attributes);

Originally I was was thinking generate a surrogate key using a hash,
but I think this is better.

So I'm going to go for it, unless anyone has a better idea.

Cheers,
- Ole




Mime
View raw message