Using DirXML to Log Changes Made by ... DirXML
Novell Cool Solutions: Trench
By Mark van Reijn
Digg This -
Posted: 30 Jul 2002
The project I am currently working on covers user and password synchronization for a large Dutch university using DirXML 1.1. Since there are so many drivers involved (7, up to 10) the project team decided that a logging facility of some sort would be necessary in order to keep track of which driver was doing what.
When I looked at the dirxml.log that is normally generated, I saw that it did not meet any of our demands regarding logging information. We wanted a rotating logfile, in a format we could specify ourselves, logging only the actions we cared to see.
I realized that the only form of customizable text output through DirXML was via the delimited text file driver. OK, fine, but now how to set it up in a way we could use it?
The answer is of course: the new (in 1.1) XdsCommandProcessor extension!
I have set it up as follows:
- Created an attribute in NDS for User Objects called "changeLog".
- Set up the text file driver Subscriber so that it is only notified of changes to the "changeLog" attribute.
- Changed the field names in the text file driver to match mine.
Course of action of an add event:
- A regular driver (ie. NT Domain) processes an event for a user object.
- After performing a certain action we want to know about, the driver writes back an attribute ("changelog") to the user object in eDirectory. The attribute contains information about the performed action.
- The textfile driver is notified of the change on the attribute, writes the data from the changelog attribute to a file, and deletes the attribute from the user object. Now every driver can log any action we want!
The big trick behind this is the template which writes the attribute back to eDirectory. This template is integrated in my Command Transformation stylesheet on the Subscriber side. See the file called "CommandTransform.xsl".
After this, the Text Driver picks up the modify to the "changeLog" attribute. I have set up an Event Transformation stylesheet to process the change. In this stylesheet the attribute gets converted into an add to the textfile. Also, the value is removed from the originating user object, again using the XdsCommandProcessor extension. See the file "EventTransform.xsl".
Voila! As you can see, it's not all that hard. Now you can log anything from DirXML using the beautiful features of... DirXML! If you want logging from the Publisher side, the src-dn is not available. In that case, you can use either the association or the dest-dn attribute, depending on the event. Also, in that case $srcCommandProcessor becomes $destCommandProcessor.
I can provide a more detailed setup, maybe even provide the export of the driver settings etc. Just let me know. Sure hope this helps people create even better DirXML solutions. DirXML is a great product, combined with eDirectory this HAS to take the world by storm!
To download the stylesheets Mark created for this solution, go here http://www.novell.com/coolsolutions/tools/1463.html
You can contact Mark with questions at email@example.com.
Novell Cool Solutions (corporate web communities) are produced by WebWise Solutions. www.webwiseone.com