directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Jencks <david_jen...@yahoo.com>
Subject Re: Simplified server configuration with xbean-spring
Date Tue, 03 Jul 2007 00:44:00 GMT

On Jul 2, 2007, at 8:32 PM, Aron Sogor wrote:

> I am no Spring expert but how would it work for 3rd party integration.
> When I want to insert my own "private" Mutable****Configuration?
> How would I register those classes...
> It would seem to make more difficult.

With xbean-spring you can still use standard spring configuration: I  
left 2 beans unconverted in the server.xml below to show this. In  
fact the original server.xml still works as well, I converted it a  
bean at a time and ran everything I could figure out to make sure it  
stayed working.  You can also "annotate" your source code and run the  
maven plugin on them to generate a schema (in a different namespace)  
and use that to configure your bean with xbean-spring.  I don't this  
as being more difficult, but as supplying more options.

thanks
david jencks

>
> Aron
> 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.PropertiesFactoryBea 
>>> n">
>>>     <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.CustomEditorConfigur 
>>> er">
>>>     <property name="customEditors">
>>>       <map>
>>>         <entry key="javax.naming.directory.Attributes">
>>>           <bean  
>>> class="org.apache.directory.server.core.configuration.AttributesProp 
>>> ertyEditor"/>
>>>         </entry>
>>>       </map>
>>>     </property>
>>>   </bean>
>>> </beans>
>>>
>>>
>>> Comments?
>>>
>>> thanks
>>> david jencks
>>>
>>>
>>
>>
>


Mime
View raw message