/** * Sets up default properties(<tt>factoryConfiguration</tt> and <tt>configuration</tt>) and * calls {@link #doInit()} where you have to put your initialization code in. * {@link #isInitialized()} will return <tt>true</tt> if {@link #doInit()} returns * without any errors. {@link #destroy()} is called automatically as a clean-up process * if {@link #doInit()} throws an exception. */ public final void init( DirectoryServiceConfiguration factoryCfg, PartitionConfiguration cfg ) throws NamingException { if ( initialized ) { // Already initialized. return; } this.factoryCfg = factoryCfg; this.cfg = cfg; try { doInit(); initialized = true; } finally { if ( !initialized ) { destroy(); } } }