On Wed, Sep 9, 2009 at 2:05 AM, Emmanuel Lecharny <elecharny@apache.org> wrote:

I was working on the DirectoryService startup process yesturday. This is called by the DirectoryServiceFactory, and when you launch the integration tests, you get a NPE.

The reason we get it is because at some point, we don't have a working directory to look at for the schema.

In order to fix this, we just have to inject the SchemaPartition working directory, and we will be set. The question is now to determinate how we will inject this property.

The SchemaPartition does not need a workingDirectory property necessarily.  Just add the workingDirectory property to the LdifPartition or whatever is wrapped by the SchemaPartition.

The schema partition is initialized only once : if its working directory is empty. In this case, we extract all the existing schema files from a jar, into a directory. Otherwise, we just read this directory, and load the registries. The problem is that we must have a pointer to this working directory, and we don't have any atm.

Question is do we make the SchemaPartition unzip the schema files (only done for LdifPartition at this point) or do we have the Partition which is wrapped handle this?  The OraclePartition if used as the wrapped Partition will not need this I think.
Questions :
1) how do we set the working directory ?

Set it programmatically on the LdifPartition.
2) when do we set it, assuming that it may be a part of the configuration ?

After instantiation of the LdifPartition, then call SchemaPartition.setWrappedPartition( ldifPartition) so the SchemaPartition has the reference to the LdifPartition. 

3) shouldn't it be a static definition ?


Right now, all the partitions are stored into the DirectoryService working directory (default to 'server-work'), under a subdirectory using the partition Id (ie, "schema" here for the schema partition). That sounds good to me atm.

wdyt ?

That's because tests default to setting the workingDirectory property of the DS to this server-work directory.  When they do that the Partitions have a base to create their own work directories for their data.

Alex Karasulu
My Blog :: http://www.jroller.com/akarasulu/
Apache Directory Server :: http://directory.apache.org
Apache MINA :: http://mina.apache.org