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: [RANT] Stupid configuration and all those idiotic XML
Date Sat, 05 Jan 2008 23:52:58 GMT
You are running into problems because you are trying to do something  
that is extremely tricky with a circular dependency between  
components.  I.e., an extremely bad idea in a component oriented  
project and probably in any project.

Circular dependency:
ds needs partitions before it's completely initialized
partitions need server entry before they are completely initialized,  
ready to go into the ds
server entry comes from ds.

Asking any component system to handle this kind of circular  
dependency is ridiculous IMO, and any code you write to do it is  
going to be impossible for the naive user to understand and likely to  
be prone to very subtle bugs that everyone will spend weeks trying to  
diagnose.

I suspect if you construct a bootstrap server entry factory component  
that can be used by the partitions used by ds a lot of the problems  
will go away.

You can also do things like having a server entry data object that is  
injected into the partition and the partition can figure out how to  
turn it into a server entry.

 From what I've heard on IRC I think I'd recommend:

1. a Registries bean that starts up with the bootstrap registries.

2. partitions get a ref to the registries bean and get a server entry  
data object (using a property editor).  They construct the  
ServerEntry themselves.

3. ds gets a reference to the registries bean; it uses the bootstrap  
registries as needed and can tell the registries bean to replace the  
registries with the correct ones when it knows what they are.

You might be able to replace (2) with some kind of factory bean  
arrangement but unless you can find some really simple spring syntax  
to make it work I don't think its worth the trouble.

One nice thing about spring is that the xml makes it pretty clear how  
the components are hooked up together and just about everyone  
understands how to use it.  Writing your own component framework (or,  
IMO, even putting the configuration data in the DIT) will make it  
much harder for non-insiders to quickly see how the server is put  
together and harder to customize it.

thanks
david jencks



On Jan 5, 2008, at 3:23 PM, Emmanuel Lecharny wrote:

> <rant>
> Now, I'm really pissed off !
>
> I have spent a full day and almost last night to get something  
> supposely simple to get working. No way.
>
> I may be totally stupid, but considering the committer status is  
> being meritocratic, I guess that users will be totally fooled by  
> the current configuration we have.
>
> I just can't stand to loose my time to try to setup a f***ing xml  
> file to understand what I basically want to do : initialize a  
> bloody java structure with a list of elements. Period.  
> Prerequisite : having some access to preset data...
>
> I'm just lost in hundred of stack traces more stupid than the  
> previous hundred ones, and it seems to be a maze without exit.
>
> WTF for X sake do we have to write such a piece of garbage :
>
>  <spring:bean id="systemContextEntry"
>     
> class="org.springframework.beans.factory.config.MethodInvokingFactoryB 
> ean">
>    <spring:property name="targetObject"><spring:ref  
> local='directoryService'/></spring:property>
>    <spring:property name="targetMethod"><spring:value>newEntry</ 
> spring:value></spring:property>
>      <spring:property name="arguments">
>      <spring:list>
>        <spring:value xmlns="http://www.springframework.org/schema/ 
> beans">
>          ou=system
>        </spring:value>
>        <spring:value xmlns="http://www.springframework.org/schema/ 
> beans">
>          objectClass: top
>          objectClass: organizationalUnit
>          objectClass: extensibleObject
>          ou: system
>        </spring:value>
>      </spring:list>
>    </spring:property>
>  </spring:bean>
>
> just to call a bloody method with two arguments, to get this as a  
> result :
>
>           _                     _          ____  ____           /  
> \   _ __   __ _  ___| |__   ___|  _ \/ ___|         / _ \ | '_ \ /  
> _` |/ __| '_ \ / _ \ | | \___ \         / ___ \| |_) | (_| | (__| |  
> | |  __/ |_| |___) |       /_/   \_\ .__/ \__,_|\___|_| |_|\___| 
> ____/|____/                |_|
> Exception in thread "main"  
> org.springframework.beans.factory.BeanCreationException: Error  
> creating bean with name 'MainADS' defined in URL [file:/home/ 
> elecharny/apacheds/bigbang/installers/apacheds-noarch/server.xml]:  
> Cannot resolve reference to bean 'directoryService' while setting  
> constructor argument; nested exception is  
> org.springframework.beans.factory.BeanCreationException: Error  
> creating bean with name 'directoryService' defined in URL [file:/ 
> home/elecharny/apacheds/bigbang/installers/apacheds-noarch/ 
> server.xml]: Cannot create inner bean '(inner bean)' of type  
> [org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmPartit 
> ion] while setting bean property 'systemPartition'; nested  
> exception is  
> org.springframework.beans.factory.BeanCreationException: Error  
> creating bean with name '(inner bean)' defined in URL [file:/home/ 
> elecharny/apacheds/bigbang/installers/apacheds-noarch/server.xml]:  
> Initialization of bean failed; nested exception is  
> org.springframework.beans.TypeMismatchException: Failed to convert  
> property value of type [java.lang.String] to required type  
> [org.apache.directory.server.core.entry.ServerEntry] for property  
> 'contextEntry'; nested exception is  
> java.lang.IllegalArgumentException: Cannot convert value of type  
> [java.lang.String] to required type  
> [org.apache.directory.server.core.entry.ServerEntry] for property  
> 'contextEntry': no matching editors or conversion strategy found
> Caused by: org.springframework.beans.factory.BeanCreationException:  
> Error creating bean with name 'directoryService' defined in URL  
> [file:/home/elecharny/apacheds/bigbang/installers/apacheds-noarch/ 
> server.xml]: Cannot create inner bean '(inner bean)' of type  
> [org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmPartit 
> ion] while setting bean property 'systemPartition'; nested  
> exception is  
> org.springframework.beans.factory.BeanCreationException: Error  
> creating bean with name '(inner bean)' defined in URL [file:/home/ 
> elecharny/apacheds/bigbang/installers/apacheds-noarch/server.xml]:  
> Initialization of bean failed; nested exception is  
> org.springframework.beans.TypeMismatchException: Failed to convert  
> property value of type [java.lang.String] to required type  
> [org.apache.directory.server.core.entry.ServerEntry] for property  
> 'contextEntry'; nested exception is  
> java.lang.IllegalArgumentException: Cannot convert value of type  
> [java.lang.String] to required type  
> [org.apache.directory.server.core.entry.ServerEntry] for property  
> 'contextEntry': no matching editors or conversion strategy found
> Caused by: org.springframework.beans.factory.BeanCreationException:  
> Error creating bean with name '(inner bean)' defined in URL [file:/ 
> home/elecharny/apacheds/bigbang/installers/apacheds-noarch/ 
> server.xml]: Initialization of bean failed; nested exception is  
> org.springframework.beans.TypeMismatchException: Failed to convert  
> property value of type [java.lang.String] to required type  
> [org.apache.directory.server.core.entry.ServerEntry] for property  
> 'contextEntry'; nested exception is  
> java.lang.IllegalArgumentException: Cannot convert value of type  
> [java.lang.String] to required type  
> [org.apache.directory.server.core.entry.ServerEntry] for property  
> 'contextEntry': no matching editors or conversion strategy found
> Caused by: org.springframework.beans.TypeMismatchException: Failed  
> to convert property value of type [java.lang.String] to required  
> type [org.apache.directory.server.core.entry.ServerEntry] for  
> property 'contextEntry'; nested exception is  
> java.lang.IllegalArgumentException: Cannot convert value of type  
> [java.lang.String] to required type  
> [org.apache.directory.server.core.entry.ServerEntry] for property  
> 'contextEntry': no matching editors or conversion strategy found
> Caused by: java.lang.IllegalArgumentException: Cannot convert value  
> of type [java.lang.String] to required type  
> [org.apache.directory.server.core.entry.ServerEntry] for property  
> 'contextEntry': no matching editors or conversion strategy found
>    at  
> org.springframework.beans.TypeConverterDelegate.convertIfNecessary 
> (TypeConverterDelegate.java:231)
>    at  
> org.springframework.beans.TypeConverterDelegate.convertIfNecessary 
> (TypeConverterDelegate.java:138)
>    at org.springframework.beans.BeanWrapperImpl.convertForProperty 
> (BeanWrapperImpl.java:380)
>    at  
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanF 
> actory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java: 
> 1105)
>    at  
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanF 
> actory.populateBean(AbstractAutowireCapableBeanFactory.java:861)
>    at  
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanF 
> actory.createBean(AbstractAutowireCapableBeanFactory.java:421)
>    at  
> org.springframework.beans.factory.support.BeanDefinitionValueResolver. 
> resolveInnerBean(BeanDefinitionValueResolver.java:215)
>    at  
> org.springframework.beans.factory.support.BeanDefinitionValueResolver. 
> resolveValueIfNecessary(BeanDefinitionValueResolver.java:127)
>    at  
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanF 
> actory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java: 
> 1099)
>    at  
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanF 
> actory.populateBean(AbstractAutowireCapableBeanFactory.java:861)
>    at  
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanF 
> actory.createBean(AbstractAutowireCapableBeanFactory.java:421)
>    at org.springframework.beans.factory.support.AbstractBeanFactory 
> $1.getObject(AbstractBeanFactory.java:251)
>    at  
> org.springframework.beans.factory.support.DefaultSingletonBeanRegistry 
> .getSingleton(DefaultSingletonBeanRegistry.java:156)
>    at  
> org.springframework.beans.factory.support.AbstractBeanFactory.getBean( 
> AbstractBeanFactory.java:248)
>    at  
> org.springframework.beans.factory.support.AbstractBeanFactory.getBean( 
> AbstractBeanFactory.java:160)
>    at  
> org.springframework.beans.factory.support.BeanDefinitionValueResolver. 
> resolveReference(BeanDefinitionValueResolver.java:261)
>    at  
> org.springframework.beans.factory.support.BeanDefinitionValueResolver. 
> resolveValueIfNecessary(BeanDefinitionValueResolver.java:109)
>    at  
> org.springframework.beans.factory.support.ConstructorResolver.resolveC 
> onstructorArguments(ConstructorResolver.java:389)
>    at  
> org.springframework.beans.factory.support.ConstructorResolver.autowire 
> Constructor(ConstructorResolver.java:120)
>    at  
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanF 
> actory.autowireConstructor(AbstractAutowireCapableBeanFactory.java: 
> 799)
>    at  
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanF 
> actory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:717)
>    at  
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanF 
> actory.createBean(AbstractAutowireCapableBeanFactory.java:384)
>    at org.springframework.beans.factory.support.AbstractBeanFactory 
> $1.getObject(AbstractBeanFactory.java:251)
>    at  
> org.springframework.beans.factory.support.DefaultSingletonBeanRegistry 
> .getSingleton(DefaultSingletonBeanRegistry.java:156)
>    at  
> org.springframework.beans.factory.support.AbstractBeanFactory.getBean( 
> AbstractBeanFactory.java:248)
>    at  
> org.springframework.beans.factory.support.AbstractBeanFactory.getBean( 
> AbstractBeanFactory.java:160)
>    at  
> org.springframework.beans.factory.support.DefaultListableBeanFactory.p 
> reInstantiateSingletons(DefaultListableBeanFactory.java:287)
>    at  
> org.springframework.context.support.AbstractApplicationContext.refresh 
> (AbstractApplicationContext.java:352)
>    at  
> org.apache.xbean.spring.context.FileSystemXmlApplicationContext.<init> 
> (FileSystemXmlApplicationContext.java:149)
>    at  
> org.apache.xbean.spring.context.FileSystemXmlApplicationContext.<init> 
> (FileSystemXmlApplicationContext.java:48)
>    at org.apache.directory.server.Service.init(Service.java:60)
>    at org.apache.directory.server.UberjarMain.main(UberjarMain.java: 
> 56)
>
>
> Is it *supposed* to help ??? How many insanity like this will we  
> support before we can work on real stuff, like how to write a  
> serious LDAP server? Do we have to whip ourselves, crawl on  
> sandpaper, walk on fire just to be allowed to bring some line of  
> not totally meaningless code, or is there a way to get rid of all  
> those shitty buzzwords called IOC, XML, XSD, Spring, Xbean and any  
> of such over rated and over abused so called 'technologies' ?
>
> WE ARE LOOSING OUR TIME WITH ALL THOSE USELESS CRAPS !!! KISS, damn !
>
> </rant>
>
> yes, I'm just pissed off ;(
>
> -- 
> --
> cordialement, regards,
> Emmanuel L├ęcharny
> www.iktek.com
> directory.apache.org
>
>


Mime
View raw message