directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ole Ersoy <ole.er...@gmail.com>
Subject [CiDIT] Here's how simple it could be
Date Sun, 29 Jul 2007 19:51:44 GMT
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 defaults, 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


Mime
View raw message