directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alex Karasulu <aok...@bellsouth.net>
Subject Re: Adding a Custom Partition Context
Date Tue, 01 Nov 2005 21:24:49 GMT
Lyndon Washington wrote:

...

> I have added my own CustomPartiton which extends 
> AbstractContextPartition.  I have some configuration settings specific 
> to my partition, so I have also created a new 
> ContextPartitionConfiguration which extends 
> MutableContextPartitionConfiguration.
>
Ok can you state your specific goal with the custom partition so I have 
more of an understanding of what you're trying to do?

> Unfortunately, in my CustomPartition.doInit() method I attempt to test 
> if the configuration that is returned from 
> AbstractContextPartition.getConfiguration() is an instance of my new 
> configuration, and if it is I want to use the new configuration 
> settings to configure the custom partition.  The implementation within 
> DefaultContextPartitionNexus.addContextPartition() creates a new 
> MutableContextPartitionConfiguration and copies the known values from 
> the config that was passed into that method, thus by the time my code 
> is called it is never an instance of my new configuration class.

Ok I see.

> Is this done to alleviate some known issue, or is it just an 
> oversight.  If it is an oversight, I can fix my local sandbox with a 
> 'short sighted' implementation.  If this is deliberately implemented 
> this way, how are you supposed to use a new type of 
> ContextPartitionConfiguration?

In the server.xml you can set the bean class for the configuration 
object's class to use your own configuration class.  Here's where you'd 
make the change:

...

  <bean id="examplePartitionConfiguration" 
class="org.apache.ldap.server.configu
ration.MutableDirectoryPartitionConfiguration">
    <property name="name"><value>example</value></property>
    <property name="suffix"><value>dc=example,dc=com</value></property>
    <property name="indexedAttributes">
      <set>
        <value>dc</value>
        <value>ou</value>
        <value>objectClass</value>
        <value>krb5PrincipalName</value>
        <value>uid</value>
      </set>
    </property>
    <property name="contextEntry">
      <value>
        objectClass: top
        objectClass: domain
        objectClass: extensibleObject
        dc: example
      </value>
    </property>
  </bean>

...

So if your configuration class is com.example.MyParititionConfig then it 
would look like so:

...

  <bean id="examplePartitionConfiguration" 
class="com.example.MyPartitionConfig">
    <property name="name"><value>example</value></property>
    <property name="suffix"><value>dc=example,dc=com</value></property>
    <property name="indexedAttributes">
      <set>
        <value>dc</value>
        <value>ou</value>
        <value>objectClass</value>
        <value>krb5PrincipalName</value>
        <value>uid</value>
      </set>
    </property>
    <property name="contextEntry">
      <value>
        objectClass: top
        objectClass: domain
        objectClass: extensibleObject
        dc: example
      </value>
    </property>
  </bean>

...

Give that a try and let us know how it goes.

Cheers,
Alex


Mime
View raw message