directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kiran Ayyagari <ayyagariki...@gmail.com>
Subject Re: Trying to write a simple partition example
Date Tue, 04 Nov 2008 05:31:13 GMT
hi Stefan,

    the partition impl requires few changes(at least to pass the test)
    which I have attached as a patch.

HTH
Kiran Ayyagari

Stefan Zoerner wrote:
> Hi all,
> 
> I try to write a very (!) simple example for a custom partition, in 
> order tom provide a starting point in the docs. Unfortunately I fail to 
> add my implementation to the DirectoryService, and I have no idea why.
> 
> This is how I add my partition ...
> 
> --8<--
> 
> directoryService = new DefaultDirectoryService();
> directoryService.setShutdownHookEnabled(true);
> 
> // Determine an appropriate working directory
> File workingDir = new File("work");
> directoryService.setWorkingDirectory(workingDir);
> 
> // Create a new partition
> EnvironmentPartition envPartition = new EnvironmentPartition();
> envPartition.setId("env");
> envPartition.setSuffix("ou=env");
> envPartition.init(directoryService);
> 
> directoryService.addPartition(envPartition);
> directoryService.startup();
> 
> -->8--
> 
> EnvironmentPartition is my implementation of the Partition interface. 
> Currently it does not make a lot, I was just trying to add it and start 
> the server. Adding is successful, but calling the startUp() method 
> causes an exception:
> 
> Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 2.688 
> sec <<< FAILURE!
> testAddPartition(org.apache.directory.samples.partition.env.EnvironmentPartitionTest)

>  Time elapsed: 2.64 sec  <<< ERROR!
> org.apache.directory.shared.ldap.exception.LdapNameNotFoundException: 
> ou=env
>     at 
> org.apache.directory.server.core.partition.DefaultPartitionNexus.getPartition(DefaultPartitionNexus.java:1097)

> 
>     at 
> org.apache.directory.server.core.partition.DefaultPartitionNexus.search(DefaultPartitionNexus.java:964)

> 
>     at 
> org.apache.directory.server.core.authz.TupleCache.initialize(TupleCache.java:138) 
> 
>     at 
> org.apache.directory.server.core.authz.TupleCache.<init>(TupleCache.java:111) 
> 
>     at 
> org.apache.directory.server.core.authz.AciAuthorizationInterceptor.init(AciAuthorizationInterceptor.java:210)

> 
>     at 
> org.apache.directory.server.core.interceptor.InterceptorChain.register0(InterceptorChain.java:439)

> 
>     at 
> org.apache.directory.server.core.interceptor.InterceptorChain.register(InterceptorChain.java:395)

> 
>     at 
> org.apache.directory.server.core.interceptor.InterceptorChain.init(InterceptorChain.java:255)

> 
>     at 
> org.apache.directory.server.core.DefaultDirectoryService.initialize(DefaultDirectoryService.java:1385)

> 
>     at 
> org.apache.directory.server.core.DefaultDirectoryService.startup(DefaultDirectoryService.java:840)

> 
>     at 
> org.apache.directory.samples.partition.env.EnvironmentPartitionTest.testAddPartition(EnvironmentPartitionTest.java:29)

> 
> 
> ---
> 
> Although it is totally clear to my, that my partition won't work (most 
> methost throw an OperationNotSupportedException), I thought about 
> starting by simply adding it and starting the server correctly.
> 
> I was able to determin that getUpSuffixDn() and getSuffixDn() have been 
> called fom my partition. I assume, that I
> 
> a) do not return valid values
> b) adding as described above is not sufficient
> 
> Does anybody have any idea. I have provided my code as a maven project 
> here:
> 
> https://svn.apache.org/repos/asf/directory/sandbox/szoerner/envpartition
> 
> Thanks in advance,
>     Stefan
> 
> 
> 
> 
> 

Mime
View raw message