Apache Directory Project - [CiDIT] Here's how simple it could be

This is Interesting: Free IT Magazines  
Home > Archive > Apache Directory Project > July 2007 > [CiDIT] Here's how simple it could be





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author [CiDIT] Here's how simple it could be
Ole Ersoy

2007-07-29, 7:11 pm

Hey Guys,

Here's a tiny segment of code that shows how simple it could be to store the xml configuration file in the DIT using the DAS. This comes from the DAS which stores some of it's own configuration in the DIT.

LdapDASHelper.readDasMeta(
dasMetaDataGraph,
context,
metaDataObjectToRelativeDNCache );

This method first tries to read the configuration DataGraph (server.xml in DIT). If it does not exist (First time server is started), it creates an instance of the model and writes it to the DIT. The model of server.xml contains all the server.xml defau
lts, so now all the defaults are stored in the DIT. Later, when needing to change configuration values, the root object bean is gotten from the dasMetaDataGraph like this:

Configuration configuration = dasMetaDataGraph.getRootDataObject();

The configuration object represent the root element of the configuration file, and is generated from the XML Schema that contains the structure of the server.xml file.

When changing the configuration, just turn on change logging on the DataGraph and when done, turn it off. Then use the DAS to write the changes. And that's it. So it would be something like this:

dasMetaDataGraph.turnOnChangeLogging();

Make changes to Configuration and objects contained by configuration.

Then turn off change logging:
dasMetaDataGraph.turnOffChangeLogging();

And update the DIT:

LdapDASHelper.update(
dasMetaDataGraph,
context);

And finito.

Cheers,
- Ole


Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com