directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ole Ersoy <ole.er...@gmail.com>
Subject Re: Simplified server configuration with xbean-spring
Date Tue, 03 Jul 2007 00:20:26 GMT
Hi David,

I thought it was very cool.  The more semantic meaning, the better.  Two thumbs way up here
:-)

Cheers,
- Ole

 

David Jencks wrote:
> So does the deafening silence that greeted this mean everyone is so awed 
> by this that they are left speechless? :-)
> 
> Seriously, does anyone have any comments on this?  Does everyone prefer 
> the untyped spring style?
> 
> On a related note, I've seen a lot of Mutable****Configuration classes 
> in various spots and AFAICT their only purpose is to support springs 
> troubles with constructor dependency injection.  I think there's a way 
> to use xbean-spring to make the xml style as below fit into constructor 
> dependency injection.  Any interest in this, or does everyone prefer 
> what's happening now?
> 
> thanks
> david jencks
> 
> 
> On Jun 28, 2007, at 4:17 PM, David Jencks wrote:
> 
>> A while back there was some discussion of whether server.xml could be 
>> made to be more semantically meaningful with less generic cruft, and I 
>> suggested looking into xbean-spring.  So, I spent a bit of time on it 
>> and implemented this.  See 
>> https://issues.apache.org/jira/browse/DIRSERVER-984
>>
>> This was pretty easy to do, after fixing some problems in xbean.  
>> Basically all I did was add some javadoc "annotations" to tell xbean 
>> which classes to look at and what type collections contain, and change 
>> to the xbean application context from the plain spring one.
>>
>> xbean generates a schema for the configurable objects so you can 
>> consult the schema to see what can be configured.  As you can see, you 
>> can mix regular spring configuration and the xbean style in the same 
>> server.xml.
>>
>> There's a lot more customization possible, I basically did the minimum 
>> possible to get  it to work.  Pretty much anything can have a 
>> different name.  The main ugliness I see is the handling of properties 
>> that are lists (or sets) of strings.
>>
>> So, at the risk of posting too large a message,  here's the shiny new 
>> server.xml (I removed some commented out bits) :
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>>
>> <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"
>>         "http://www.springframework.org/dtd/spring-beans.dtd">
>>
>> <beans>
>> <!-- bean I didn't convert -->
>>   <bean id="environment" 
>> class="org.springframework.beans.factory.config.PropertiesFactoryBean">
>>     <property name="properties">
>>       <props>
>>         <!-- JNDI security properties used to get initial 
>> contexts.         -->
>>         <prop key="java.naming.security.authentication">simple</prop>
>>         <prop 
>> key="java.naming.security.principal">uid=admin,ou=system</prop>
>>         <prop key="java.naming.security.credentials">secret</prop>
>>       </props>
>>     </property>
>>   </bean>
>>
>>
>>   <mutableServerStartupConfiguration id="configuration" 
>> xmlns="http://apacheds.org/config/1.0"
>>                                      workingDirectory="example.com"
>>                                      synchPeriodMillis="5000"
>>                                      maxThreads="8"
>>                                      allowAnonymousAccess="false"
>>                                      accessControlEnabled="false"
>>                                      denormalizeOpAttrsEnabled="false"
>>           >
>>     <ntpConfiguration>
>>       <ntpConfiguration
>>               enabled="false"
>>               ipPort="123">
>>       </ntpConfiguration>
>>     </ntpConfiguration>
>>
>>     <dnsConfiguration>
>>       <dnsConfiguration
>>               enabled="false"
>>               ipPort="53">
>>       </dnsConfiguration>
>>     </dnsConfiguration>
>>
>>     <changePasswordConfiguration>
>>       <changePasswordConfiguration
>>               enabled="false"
>>               ipPort="464">
>>       </changePasswordConfiguration>
>>     </changePasswordConfiguration>
>>
>>     <kdcConfiguration>
>>       <kdcConfiguration
>>               enabled="false"
>>               ipPort="88">
>>       </kdcConfiguration>
>>     </kdcConfiguration>
>>
>>     <ldapConfiguration>
>>       <ldapConfiguration id="ldapConfiguration"
>>               ipPort="10389"
>>               allowAnonymousAccess="false"
>>               saslHost="ldap.example.com"
>>               saslPrincipal="ldap/ldap.example.com@EXAMPLE.COM"
>>               searchBaseDn="ou=users,ou=system"
>>               maxTimeLimit="15000"
>>               maxSizeLimit="1000">
>>
>>         <!-- The list of supported authentication 
>> mechanisms.                   -->
>>         <supportedMechanisms>
>>           <value 
>> xmlns="http://www.springframework.org/schema/beans">SIMPLE</value>
>>           <value 
>> xmlns="http://www.springframework.org/schema/beans">CRAM-MD5</value>
>>           <value 
>> xmlns="http://www.springframework.org/schema/beans">DIGEST-MD5</value>
>>           <!--<value 
>> xmlns="http://www.springframework.org/schema/beans">GSSAPI</value>-->
>>         </supportedMechanisms>
>>
>>         <!-- The desired quality-of-protection, used by DIGEST-MD5 and 
>> GSSAPI.  -->
>>         <saslQop>
>>           <value 
>> xmlns="http://www.springframework.org/schema/beans">auth</value>
>>           <value 
>> xmlns="http://www.springframework.org/schema/beans">auth-int</value>
>>           <value 
>> xmlns="http://www.springframework.org/schema/beans">auth-conf</value>
>>         </saslQop>
>>
>>         <!-- The realms serviced by this SASL host, used by DIGEST-MD5 
>> and GSSAPI. -->
>>         <saslRealms>
>>           <value 
>> xmlns="http://www.springframework.org/schema/beans">example.com</value>
>>           <value 
>> xmlns="http://www.springframework.org/schema/beans">apache.org</value>
>>         </saslRealms>
>>
>>         <!-- the collection of extended operation handlers to 
>> install           -->
>>         <extendedOperationHandlers>
>>           <gracefulShutdownHandler/>
>>           <launchDiagnosticUiHandler/>
>>         </extendedOperationHandlers>
>>       </ldapConfiguration>
>>     </ldapConfiguration>
>>
>>     <ldapsConfiguration>
>>       <ldapConfiguration id="ldapsConfiguration"
>>                          enabled="false"
>>                          ipPort="636"
>>                          enableLdaps="true">
>>       </ldapConfiguration>
>>     </ldapsConfiguration>
>>
>>     <systemPartitionConfiguration>
>>       <!-- use the following partitionConfiguration to override 
>> defaults for  -->
>>       <!-- the system 
>> partition                                               -->
>>       <mutableBTreePartitionConfiguration 
>> id="systemPartitionConfiguration"
>>         name="system"
>>         cacheSize="100"
>>         suffix="ou=system"
>>         optimizerEnabled="true"
>>         synchOnWrite="true">
>>         <indexedAttributes>
>>             <mutableIndexConfiguration
>>               attributeId="1.3.6.1.4.1.18060.0.4.1.2.1"
>>               cacheSize="100"/>
>>             <mutableIndexConfiguration
>>               attributeId="1.3.6.1.4.1.18060.0.4.1.2.2"
>>               cacheSize="100"/>
>>             <mutableIndexConfiguration
>>               attributeId="1.3.6.1.4.1.18060.0.4.1.2.3"
>>               cacheSize="100"/>
>>             <mutableIndexConfiguration
>>               attributeId="1.3.6.1.4.1.18060.0.4.1.2.4"
>>               cacheSize="100"/>
>>             <mutableIndexConfiguration
>>               attributeId="1.3.6.1.4.1.18060.0.4.1.2.5"
>>               cacheSize="10"/>
>>             <mutableIndexConfiguration
>>               attributeId="1.3.6.1.4.1.18060.0.4.1.2.6"
>>               cacheSize="10"/>
>>             <mutableIndexConfiguration
>>               attributeId="1.3.6.1.4.1.18060.0.4.1.2.7"
>>               cacheSize="10"/>
>>             <mutableIndexConfiguration
>>               attributeId="ou"
>>               cacheSize="100"/>
>>             <mutableIndexConfiguration
>>               attributeId="uid"
>>               cacheSize="100"/>
>>             <mutableIndexConfiguration
>>               attributeId="objectClass"
>>               cacheSize="100"/>
>>         </indexedAttributes>
>>         <contextEntry>
>>           <value xmlns="http://www.springframework.org/schema/beans">
>>             objectClass: top
>>             objectClass: organizationalUnit
>>             objectClass: extensibleObject
>>             ou: system
>>           </value>
>>         </contextEntry>
>>       </mutableBTreePartitionConfiguration>
>>     </systemPartitionConfiguration>
>>
>>     <partitionConfigurations>
>>       <mutableBTreePartitionConfiguration 
>> id="examplePartitionConfiguration"
>>         name="example"
>>         cacheSize="100"
>>         suffix="dc=example,dc=com"
>>         optimizerEnabled="true"
>>         synchOnWrite="true">
>>         <indexedAttributes>
>>             <mutableIndexConfiguration
>>               attributeId="1.3.6.1.4.1.18060.0.4.1.2.1"
>>               cacheSize="100"/>
>>             <mutableIndexConfiguration
>>               attributeId="1.3.6.1.4.1.18060.0.4.1.2.2"
>>               cacheSize="100"/>
>>             <mutableIndexConfiguration
>>               attributeId="1.3.6.1.4.1.18060.0.4.1.2.3"
>>               cacheSize="100"/>
>>             <mutableIndexConfiguration
>>               attributeId="1.3.6.1.4.1.18060.0.4.1.2.4"
>>               cacheSize="100"/>
>>             <mutableIndexConfiguration
>>               attributeId="1.3.6.1.4.1.18060.0.4.1.2.5"
>>               cacheSize="10"/>
>>             <mutableIndexConfiguration
>>               attributeId="1.3.6.1.4.1.18060.0.4.1.2.6"
>>               cacheSize="10"/>
>>             <mutableIndexConfiguration
>>               attributeId="1.3.6.1.4.1.18060.0.4.1.2.7"
>>               cacheSize="10"/>
>>             <mutableIndexConfiguration
>>               attributeId="dc"
>>               cacheSize="100"/>
>>             <mutableIndexConfiguration
>>               attributeId="ou"
>>               cacheSize="100"/>
>>             <mutableIndexConfiguration
>>               attributeId="krb5PrincipalName"
>>               cacheSize="100"/>
>>             <mutableIndexConfiguration
>>               attributeId="uid"
>>               cacheSize="100"/>
>>             <mutableIndexConfiguration
>>               attributeId="objectClass"
>>               cacheSize="100"/>
>>         </indexedAttributes>
>>         <contextEntry>
>>           <value xmlns="http://www.springframework.org/schema/beans">
>>             objectClass: top
>>             objectClass: domain
>>             objectClass: extensibleObject
>>             dc: example
>>           </value>
>>         </contextEntry>
>>       </mutableBTreePartitionConfiguration>
>>     </partitionConfigurations>
>>
>>     <interceptorConfigurations>
>>       <mutableInterceptorConfiguration
>>               name="normalizationService">
>>         <interceptor>
>>           <normalizationService/>
>>         </interceptor>
>>       </mutableInterceptorConfiguration>
>>       <mutableInterceptorConfiguration
>>               name="authenticationService">
>>         <interceptor>
>>           <authenticationService/>
>>         </interceptor>
>>       </mutableInterceptorConfiguration>
>>       <mutableInterceptorConfiguration
>>               name="referralService">
>>         <interceptor>
>>           <referralService/>
>>         </interceptor>
>>       </mutableInterceptorConfiguration>
>>       <mutableInterceptorConfiguration
>>               name="authorizationService">
>>         <interceptor>
>>           <authorizationService/>
>>         </interceptor>
>>       </mutableInterceptorConfiguration>
>>       <mutableInterceptorConfiguration
>>               name="defaultAuthorizationService">
>>         <interceptor>
>>           <defaultAuthorizationService/>
>>         </interceptor>
>>       </mutableInterceptorConfiguration>
>>       <mutableInterceptorConfiguration
>>               name="exceptionService">
>>         <interceptor>
>>           <exceptionService/>
>>         </interceptor>
>>       </mutableInterceptorConfiguration>
>>       <mutableInterceptorConfiguration
>>               name="operationalAttributeService">
>>         <interceptor>
>>           <operationalAttributeService/>
>>         </interceptor>
>>       </mutableInterceptorConfiguration>
>>       <mutableInterceptorConfiguration
>>               name="schemaService">
>>         <interceptor>
>>           <schemaService/>
>>         </interceptor>
>>       </mutableInterceptorConfiguration>
>>       <mutableInterceptorConfiguration
>>               name="subentryService">
>>         <interceptor>
>>           <subentryService/>
>>         </interceptor>
>>       </mutableInterceptorConfiguration>
>>       <mutableInterceptorConfiguration
>>               name="collectiveAttributeService">
>>         <interceptor>
>>           <collectiveAttributeService/>
>>         </interceptor>
>>       </mutableInterceptorConfiguration>
>>       <mutableInterceptorConfiguration
>>               name="eventService">
>>         <interceptor>
>>           <eventService/>
>>         </interceptor>
>>       </mutableInterceptorConfiguration>
>>       <mutableInterceptorConfiguration
>>               name="triggerService">
>>         <interceptor>
>>           <triggerService/>
>>         </interceptor>
>>       </mutableInterceptorConfiguration>
>>
>>     </interceptorConfigurations>
>>   </mutableServerStartupConfiguration>
>>
>>
>> <!-- another bean I didn't convert -->
>>   <bean 
>> class="org.springframework.beans.factory.config.CustomEditorConfigurer">
>>     <property name="customEditors">
>>       <map>
>>         <entry key="javax.naming.directory.Attributes">
>>           <bean 
>> class="org.apache.directory.server.core.configuration.AttributesPropertyEditor"/>

>>
>>         </entry>
>>       </map>
>>     </property>
>>   </bean>
>> </beans>
>>
>>
>> Comments?
>>
>> thanks
>> david jencks
>>
>>
> 
> 

Mime
View raw message