Author: norman
Date: Fri Dec 17 08:24:17 2010
New Revision: 1050311

URL: http://svn.apache.org/viewvc?rev=1050311&view=rev
Log:
Get rid of InstanceFactory when loading UsersRepository, VirtualUserTable and 
DomainList. This is done a BeanFactoryPostProcessor which parse the 
configuration file for each of these and register a bean for it in the spring 
context. Something similar should be done when loading Mailets/Matchers and 
CommandHandler/LineHandler/ConnectHandler/Hook implementations

Added:
    
james/server/trunk/container-spring/src/main/java/org/apache/james/container/spring/JamesLoaderBeanFactoryPostProcessor.java
Removed:
    
james/server/trunk/domainlist-library/src/main/java/org/apache/james/domainlist/lib/JamesDomainList.java
    
james/server/trunk/user-library/src/main/java/org/apache/james/user/lib/JamesUsersRepository.java
    
james/server/trunk/user-library/src/main/java/org/apache/james/vut/lib/JamesVirtualUserTable.java
Modified:
    james/server/trunk/container-spring/src/main/config/examples/domainlist.xml
    
james/server/trunk/container-spring/src/main/config/examples/usersrepository.xml
    
james/server/trunk/container-spring/src/main/config/examples/virtualusertable.xml
    
james/server/trunk/container-spring/src/main/config/james/context/james-server-context.xml
    james/server/trunk/container-spring/src/main/config/james/domainlist.xml
    
james/server/trunk/container-spring/src/main/config/james/usersrepository.xml
    
james/server/trunk/container-spring/src/main/config/james/virtualusertable.xml
    james/server/trunk/domainlist-jdbc/pom.xml
    james/server/trunk/domainlist-library/pom.xml
    james/server/trunk/mailets/pom.xml
    james/server/trunk/user-jdbc/pom.xml
    james/server/trunk/user-library/pom.xml

Modified: 
james/server/trunk/container-spring/src/main/config/examples/domainlist.xml
URL: 
http://svn.apache.org/viewvc/james/server/trunk/container-spring/src/main/config/examples/domainlist.xml?rev=1050311&r1=1050310&r2=1050311&view=diff
==============================================================================
--- james/server/trunk/container-spring/src/main/config/examples/domainlist.xml 
(original)
+++ james/server/trunk/container-spring/src/main/config/examples/domainlist.xml 
Fri Dec 17 08:24:17 2010
@@ -36,36 +36,34 @@
 <!-- -->
 <!-- Warning: If you are using fetchmail it is important to include the -->
 <!-- fetched domains in the server name list to prevent looping.       -->    
-<domainlists>
 
-  <!-- XML based DomainList implementation -->
-  <domainlist class="org.apache.james.domainlist.xml.XMLDomainList">
-    <domainnames>
-      <domainname>localhost</domainname>
-    </domainnames>
-    <autodetect>true</autodetect>
-    <autodetectIP>true</autodetectIP>
-    <defaultDomain>localhost</defaultDomain>
-  </domainlist>
+<!-- XML based DomainList implementation -->
+<domainlist class="org.apache.james.domainlist.xml.XMLDomainList">
+  <domainnames>
+    <domainname>localhost</domainname>
+  </domainnames>
+  <autodetect>true</autodetect>
+  <autodetectIP>true</autodetectIP>
+  <defaultDomain>localhost</defaultDomain>
+</domainlist>
   
-  <!-- JPA implementation for DomainList -->
-  <!-- 
-  <domainlist class="org.apache.james.domainlist.jpa.JPADomainList">
-    <autodetect>true</autodetect>
-    <autodetectIP>true</autodetectIP>
-    <defaultDomain>localhost</defaultDomain>
-  </domainlist>
-  -->
-  
-  <!-- JDBC implementation for DomainList. This is deprecated and should not 
be used. -->
-  <!-- Use JPADomainList if you need a db backend DomainList -->
-  <!-- 
-  <domainlist class="org.apache.james.domainlist.jdbc.JDBCDomainList">
-    <repositoryPath>db://maildb/domain</repositoryPath>
-    <sqlFile>file://conf/sqlResources.xml</sqlFile>
-    <autodetect>true</autodetect>
-    <autodetectIP>true</autodetectIP>
-    <defaultDomain>localhost</defaultDomain>
-  </domainlist>  
-  -->
-</domainlists>
+<!-- JPA implementation for DomainList -->
+<!-- 
+<domainlist class="org.apache.james.domainlist.jpa.JPADomainList">
+  <autodetect>true</autodetect>
+  <autodetectIP>true</autodetectIP>
+  <defaultDomain>localhost</defaultDomain>
+</domainlist>
+-->
+
+<!-- JDBC implementation for DomainList. This is deprecated and should not be 
used. -->
+<!-- Use JPADomainList if you need a db backend DomainList -->
+<!-- 
+<domainlist class="org.apache.james.domainlist.jdbc.JDBCDomainList">
+  <repositoryPath>db://maildb/domain</repositoryPath>
+  <sqlFile>file://conf/sqlResources.xml</sqlFile>
+  <autodetect>true</autodetect>
+  <autodetectIP>true</autodetectIP>
+  <defaultDomain>localhost</defaultDomain>
+</domainlist>  
+-->

Modified: 
james/server/trunk/container-spring/src/main/config/examples/usersrepository.xml
URL: 
http://svn.apache.org/viewvc/james/server/trunk/container-spring/src/main/config/examples/usersrepository.xml?rev=1050311&r1=1050310&r2=1050311&view=diff
==============================================================================
--- 
james/server/trunk/container-spring/src/main/config/examples/usersrepository.xml
 (original)
+++ 
james/server/trunk/container-spring/src/main/config/examples/usersrepository.xml
 Fri Dec 17 08:24:17 2010
@@ -18,79 +18,60 @@
   under the License.                                           
  -->
 
-<usersrepository>
+<!-- Configure User Repositories here. -->
 
-    <!-- Configure User Repositories here. -->
-
-    <!-- -->
-    <!-- User repositories are required for the following purposes: -->
-    <!--    - storing James user information and authentication data. -->
-    <!-- Note: One user repository is required for James: -->
-    <!--   LocalUsers - the users for whom you are providing POP3, IMAP, or 
SMTP service -->
-    <!-- -->
-
-    
-    <!-- Read-Only LDAP based UsersRepository -->
-    <!--
-    <repository name="LocalUsers" 
class="org.apache.james.user.ldap.ReadOnlyUsersLDAPRepository" 
ldapHost="ldap://myldapserver:389"; 
-       principal="uid=ldapUser,ou=system" credentials="password" 
userBase="ou=People,o=myorg.com,ou=system" userIdAttribute="uid"/>;
-    -->
+<!-- -->
+<!-- User repositories are required for the following purposes: -->
+<!--    - storing James user information and authentication data. -->
+<!-- -->
+
+ 
+<!-- Read-Only LDAP based UsersRepository -->
+<!--
+<repository name="LocalUsers" 
class="org.apache.james.user.ldap.ReadOnlyUsersLDAPRepository" 
ldapHost="ldap://myldapserver:389"; 
+    principal="uid=ldapUser,ou=system" credentials="password" 
userBase="ou=People,o=myorg.com,ou=system" userIdAttribute="uid"/>;
+-->
     
     
-    <!-- JPA based backend. Support password algorithm are:
-         MD5, SHA-256, SHA-512, NONE
-     -->
-    <repository name="LocalUsers" 
class="org.apache.james.user.jpa.JPAUsersRepository">
-        <algorithm>MD5</algorithm>
-        <enableVirtualHosting>false</enableVirtualHosting>     
-    </repository>
+<!-- JPA based backend. Support password algorithm are:
+  MD5, SHA-256, SHA-512, NONE
+-->
+<usersrepository name="LocalUsers" 
class="org.apache.james.user.jpa.JPAUsersRepository">
+  <algorithm>MD5</algorithm>
+  <enableVirtualHosting>false</enableVirtualHosting>     
+</usersrepository>
 
 
-    <!-- The UsersRepository implementations below are DEPRECATED and will get 
removed in the next release -->
-    <!-- They are just listed here for backward-compatibility-->
-    
-    <!-- File-based user repositories  Use these configurations to store user 
info in the filesystem  -->
-    <!-- The LocalUsers repository, for storing James' User info. -->
-    <!-- DEPRECATED: This implementation will get removed in the next release 
-->
-    <!--
-    <repository name="LocalUsers" 
class="org.apache.james.user.file.UsersFileRepository">
-        <destination URL="file://var/users/"/>
-        <ignoreCase>true</ignoreCase>
-        <enableAliases>true</enableAliases>
-        <enableForwarding>true</enableForwarding>
-        <enableVirtualHosting>false</enableVirtualHosting>     
-    </repository>
-    -->
-
-    <!-- Database backed user repositories -->
-    <!-- -->
-    <!-- Use these configurations to store user info in a database. -->
-    <!-- Note: The <data-source> element must refer to a connection configured 
-->
-    <!--       in the <database-connections> configuration section. -->
-    <!-- The LocalUsers repository, for storing James' User info. -->
-    <!-- DEPRECATED: This implementation will get removed in the next release 
-->
-    <!--             Use JPAUsersRepository if you want to store the Users in 
a database -->
-    <!-- 
-    <repository name="LocalUsers" 
class="org.apache.james.user.jdbc.JamesUsersJdbcRepository" 
destinationURL="db://maildb/users">
-        <sqlFile>file://conf/sqlResources.xml</sqlFile>
-        <ignoreCase>true</ignoreCase>
-        <enableAliases>true</enableAliases>
-        <enableForwarding>true</enableForwarding>
-        <enableVirtualHosting>false</enableVirtualHosting>     
-    </repository>
-    -->
-        
-    <!-- This is an example configuration including configuration for a list 
server. -->
-    <!-- CHECKME: before uncommenting this, edit the configuration file's 
contents   -->
-    <!-- -->
-    <!-- Mailing list repositories  -->
-    <!-- Add a user repository for each list -->
-    <!-- TODO: add more examples  -->    
-    <!-- DEPRECATED: This implementation will get removed in the next release 
-->
-    <!--       
-    <repository name="list-test" 
class="org.apache.james.user.file.UsersFileRepository">
-       <destination URL="file://var/lists/list-test/"/>
-    </repository>
-    -->
-    
+<!-- The UsersRepository implementations below are DEPRECATED and will get 
removed in the next release -->
+<!-- They are just listed here for backward-compatibility-->
+
+<!-- File-based user repositories  Use these configurations to store user info 
in the filesystem  -->
+<!-- The LocalUsers repository, for storing James' User info. -->
+<!-- DEPRECATED: This implementation will get removed in the next release -->
+<!--
+<usersrepository name="LocalUsers" 
class="org.apache.james.user.file.UsersFileRepository">
+  <destination URL="file://var/users/"/>
+  <ignoreCase>true</ignoreCase>
+  <enableAliases>true</enableAliases>
+  <enableForwarding>true</enableForwarding>
+  <enableVirtualHosting>false</enableVirtualHosting>     
+</usersrepository>
+-->
+
+<!-- Database backed user repositories -->
+<!-- -->
+<!-- Use these configurations to store user info in a database. -->
+<!-- Note: The <data-source> element must refer to a connection configured -->
+<!--       in the <database-connections> configuration section. -->
+<!-- The LocalUsers repository, for storing James' User info. -->
+<!-- DEPRECATED: This implementation will get removed in the next release -->
+<!--             Use JPAUsersRepository if you want to store the Users in a 
database -->
+<!-- 
+<usersrepository name="LocalUsers" 
class="org.apache.james.user.jdbc.JamesUsersJdbcRepository" 
destinationURL="db://maildb/users">
+  <sqlFile>file://conf/sqlResources.xml</sqlFile>
+  <ignoreCase>true</ignoreCase>
+  <enableAliases>true</enableAliases>
+  <enableForwarding>true</enableForwarding>
+  <enableVirtualHosting>false</enableVirtualHosting>     
 </usersrepository>
+-->

Modified: 
james/server/trunk/container-spring/src/main/config/examples/virtualusertable.xml
URL: 
http://svn.apache.org/viewvc/james/server/trunk/container-spring/src/main/config/examples/virtualusertable.xml?rev=1050311&r1=1050310&r2=1050311&view=diff
==============================================================================
--- 
james/server/trunk/container-spring/src/main/config/examples/virtualusertable.xml
 (original)
+++ 
james/server/trunk/container-spring/src/main/config/examples/virtualusertable.xml
 Fri Dec 17 08:24:17 2010
@@ -17,40 +17,35 @@
   specific language governing permissions and limitations      
   under the License.                                           
  -->
-<!-- The VirtualUserTable block -->
-<virtualusertable>
-    <!-- Configure VirtualUserTable here. -->
-    <!-- Only one table can be active -->
     
-    <!-- -->
-    <!-- If set recursiveMapping false only the first mapping will get 
processed. -->
-    <!-- Default true. -->
-    <!-- By setting the mappingLimit you can specify how much mapping will get 
processed -->
-    <!-- before a bounce will send. This avoid infinity loops. Default 10.  -->
-    <!--
-    <table  class="org.apache.james.vut.xml.XMLVirtualUserTable">
-        <recursiveMapping> true </recursiveMapping>
-        <mappingLimit> 10 </mappingLimit>
-         
-        <mapping> s...@domain=someuser </mapping>
-    </table>
-    -->
-
-    <!-- Database backed VirtualUsertable -->
-    <!-- -->
-    <!-- Use these configurations to store the VirtualUserTable in a database. 
-->
-    <!-- 
-    <table class="org.apache.james.vut.jdbc.JDBCVirtualUserTable" 
destinationURL="db://maildb/VirtualUserTable">
-        <recursiveMapping> true </recursiveMapping>
-        <mappingLimit> 10 </mappingLimit>
-        <sqlFile>file://conf/sqlResources.xml</sqlFile>
-    </table>
-    -->
+<!-- -->
+<!-- If set recursiveMapping false only the first mapping will get processed. 
-->
+<!-- Default true. -->
+<!-- By setting the mappingLimit you can specify how much mapping will get 
processed -->
+<!-- before a bounce will send. This avoid infinity loops. Default 10.  -->
+<!--
+<virtualusertable  class="org.apache.james.vut.xml.XMLVirtualUserTable">
+    <recursiveMapping> true </recursiveMapping>
+    <mappingLimit> 10 </mappingLimit>
     
-    <!-- The default table for storing James' VirtualUserTable mappings. -->
-    <table class="org.apache.james.vut.jpa.JPAVirtualUserTable">
-        <recursiveMapping> true </recursiveMapping>
-        <mappingLimit> 10 </mappingLimit>
-    </table>
+    <mapping> s...@domain=someuser </mapping>
+</virtualusertable>
+-->
 
+<!-- Database backed VirtualUsertable -->
+<!-- -->
+<!-- Use these configurations to store the VirtualUserTable in a database. -->
+<!-- 
+<virtualusertable class="org.apache.james.vut.jdbc.JDBCVirtualUserTable" 
destinationURL="db://maildb/VirtualUserTable">
+    <recursiveMapping> true </recursiveMapping>
+    <mappingLimit> 10 </mappingLimit>
+    <sqlFile>file://conf/sqlResources.xml</sqlFile>
 </virtualusertable>
+-->
+    
+<!-- The default table for storing James' VirtualUserTable mappings. -->
+<virtualusertable class="org.apache.james.vut.jpa.JPAVirtualUserTable">
+    <recursiveMapping> true </recursiveMapping>
+    <mappingLimit> 10 </mappingLimit>
+</virtualusertable>
+

Modified: 
james/server/trunk/container-spring/src/main/config/james/context/james-server-context.xml
URL: 
http://svn.apache.org/viewvc/james/server/trunk/container-spring/src/main/config/james/context/james-server-context.xml?rev=1050311&r1=1050310&r2=1050311&view=diff
==============================================================================
--- 
james/server/trunk/container-spring/src/main/config/james/context/james-server-context.xml
 (original)
+++ 
james/server/trunk/container-spring/src/main/config/james/context/james-server-context.xml
 Fri Dec 17 08:24:17 2010
@@ -214,16 +214,37 @@
     <bean id="imapEncoder" factory-bean="imapEncoderFactory"  
factory-method="buildImapEncoder"/>
     <bean id="imapEncoderFactory" 
class="org.apache.james.imap.encode.main.DefaultImapEncoderFactory"/>
 
-    <!-- 
-      Users
-     -->
-    <bean id="usersrepository" name="localusersrepository" 
class="org.apache.james.user.lib.JamesUsersRepository"/>
-    <bean id="virtualusertable" 
class="org.apache.james.vut.lib.JamesVirtualUserTable" />
 
-    <!-- 
-      Domain List
-     -->
-    <bean id="domainlist" 
class="org.apache.james.domainlist.lib.JamesDomainList" />
+    <!-- BeanFactoryPostProcessor which take care of register beans from james 
specific configuration files -->
+    <bean 
class="org.apache.james.container.spring.JamesLoaderBeanFactoryPostProcessor">
+        <property name="beans">
+          <map>
+            <!-- Users-->
+            <entry>
+              <key>
+                <value>usersrepository</value>
+              </key>
+              <value>localusersrepository</value>
+            </entry>
+            <entry>
+              <key>
+                <value>virtualusertable</value>
+              </key>
+              <!-- no alias needed -->
+              <value></value>
+            </entry>
+            
+            <!-- Domain List -->
+            <entry>
+              <key>
+                <value>domainlist</value>
+              </key>
+              <!-- no alias needed -->
+              <value></value>
+            </entry>
+          </map>
+        </property>
+    </bean>
 
     <!-- 
       MailStore

Modified: 
james/server/trunk/container-spring/src/main/config/james/domainlist.xml
URL: 
http://svn.apache.org/viewvc/james/server/trunk/container-spring/src/main/config/james/domainlist.xml?rev=1050311&r1=1050310&r2=1050311&view=diff
==============================================================================
--- james/server/trunk/container-spring/src/main/config/james/domainlist.xml 
(original)
+++ james/server/trunk/container-spring/src/main/config/james/domainlist.xml 
Fri Dec 17 08:24:17 2010
@@ -19,14 +19,12 @@
  -->
  
 <!-- See http://james.apache.org/server/3/config.html for usage -->
- 
-<domainlists>
-  <domainlist class="org.apache.james.domainlist.xml.XMLDomainList">
-    <domainnames>
-      <domainname>localhost</domainname>
-    </domainnames>
-    <autodetect>true</autodetect>
-    <autodetectIP>true</autodetectIP>
-    <defaultDomain>localhost</defaultDomain>
-  </domainlist>
-</domainlists>
+
+<domainlist class="org.apache.james.domainlist.xml.XMLDomainList">
+  <domainnames>
+    <domainname>localhost</domainname>
+  </domainnames>
+  <autodetect>true</autodetect>
+  <autodetectIP>true</autodetectIP>
+  <defaultDomain>localhost</defaultDomain>
+</domainlist>

Modified: 
james/server/trunk/container-spring/src/main/config/james/usersrepository.xml
URL: 
http://svn.apache.org/viewvc/james/server/trunk/container-spring/src/main/config/james/usersrepository.xml?rev=1050311&r1=1050310&r2=1050311&view=diff
==============================================================================
--- 
james/server/trunk/container-spring/src/main/config/james/usersrepository.xml 
(original)
+++ 
james/server/trunk/container-spring/src/main/config/james/usersrepository.xml 
Fri Dec 17 08:24:17 2010
@@ -19,10 +19,7 @@
  -->
 
 <!-- See http://james.apache.org/server/3/config.html for usage -->
-
-<usersrepository>
-  <repository name="LocalUsers" 
class="org.apache.james.user.jpa.JPAUsersRepository">
-    <enableVirtualHosting>false</enableVirtualHosting>     
-    <algorithm>MD5</algorithm>
-  </repository>
+<usersrepository name="LocalUsers" 
class="org.apache.james.user.jpa.JPAUsersRepository">
+  <enableVirtualHosting>false</enableVirtualHosting>
+  <algorithm>MD5</algorithm>
 </usersrepository>

Modified: 
james/server/trunk/container-spring/src/main/config/james/virtualusertable.xml
URL: 
http://svn.apache.org/viewvc/james/server/trunk/container-spring/src/main/config/james/virtualusertable.xml?rev=1050311&r1=1050310&r2=1050311&view=diff
==============================================================================
--- 
james/server/trunk/container-spring/src/main/config/james/virtualusertable.xml 
(original)
+++ 
james/server/trunk/container-spring/src/main/config/james/virtualusertable.xml 
Fri Dec 17 08:24:17 2010
@@ -19,10 +19,7 @@
  -->
 
 <!-- See http://james.apache.org/server/3/config.html for usage -->
-
-<virtualusertable>
-  <table class="org.apache.james.vut.jpa.JPAVirtualUserTable">
-      <recursiveMapping> true </recursiveMapping>
-      <mappingLimit> 10 </mappingLimit>
-  </table>
+<virtualusertable class="org.apache.james.vut.jpa.JPAVirtualUserTable">
+  <recursiveMapping> true </recursiveMapping>
+  <mappingLimit> 10 </mappingLimit>
 </virtualusertable>

Added: 
james/server/trunk/container-spring/src/main/java/org/apache/james/container/spring/JamesLoaderBeanFactoryPostProcessor.java
URL: 
http://svn.apache.org/viewvc/james/server/trunk/container-spring/src/main/java/org/apache/james/container/spring/JamesLoaderBeanFactoryPostProcessor.java?rev=1050311&view=auto
==============================================================================
--- 
james/server/trunk/container-spring/src/main/java/org/apache/james/container/spring/JamesLoaderBeanFactoryPostProcessor.java
 (added)
+++ 
james/server/trunk/container-spring/src/main/java/org/apache/james/container/spring/JamesLoaderBeanFactoryPostProcessor.java
 Fri Dec 17 08:24:17 2010
@@ -0,0 +1,95 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one   *
+ * or more contributor license agreements.  See the NOTICE file *
+ * distributed with this work for additional information        *
+ * regarding copyright ownership.  The ASF licenses this file   *
+ * to you under the Apache License, Version 2.0 (the            *
+ * "License"); you may not use this file except in compliance   *
+ * with the License.  You may obtain a copy of the License at   *
+ *                                                              *
+ *   http://www.apache.org/licenses/LICENSE-2.0                 *
+ *                                                              *
+ * Unless required by applicable law or agreed to in writing,   *
+ * software distributed under the License is distributed on an  *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
+ * KIND, either express or implied.  See the License for the    *
+ * specific language governing permissions and limitations      *
+ * under the License.                                           *
+ ****************************************************************/
+package org.apache.james.container.spring;
+
+import java.util.Iterator;
+import java.util.Map;
+
+import org.apache.commons.configuration.ConfigurationException;
+import org.apache.commons.configuration.HierarchicalConfiguration;
+import org.apache.james.container.spring.lifecycle.ConfigurationProvider;
+import org.springframework.beans.BeansException;
+import org.springframework.beans.FatalBeanException;
+import org.springframework.beans.factory.config.BeanDefinition;
+import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
+import 
org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
+import org.springframework.beans.factory.support.BeanDefinitionBuilder;
+import org.springframework.beans.factory.support.BeanDefinitionRegistry;
+
+/**
+ * {...@link BeanFactoryPostProcessor} which lookup the configuration file for 
the configured beans and register
+ * the right class with the given beanname for it. The class is lookup-ed via 
the class="" tag in the configuration file.
+ * The lookup of the configuration file is done via the {...@link 
ConfigurationProvider#getConfiguration(String)} method. Which 
+ * take the beanname as argument
+ * 
+ * It also support to register aliases for the beans. The value of the map 
entry is used as a comma-seperated list of aliases.
+ * If you don't need to register an alias just us an empty value.
+ *
+ */
+public class JamesLoaderBeanFactoryPostProcessor implements 
BeanFactoryPostProcessor {
+
+    private Map<String, String> beans;
+
+    public void setBeans(Map<String, String> beans) {
+        this.beans = beans;
+    }
+
+    /**
+     * Parse the configuration file and depending on it register the beans
+     */
+    public void postProcessBeanFactory(ConfigurableListableBeanFactory 
beanFactory) throws BeansException {
+        ConfigurationProvider confProvider = 
beanFactory.getBean(ConfigurationProvider.class);
+        Iterator<String> beanNames = beans.keySet().iterator();
+       
+        // loop over the beans
+        while (beanNames.hasNext()) {
+            String name = beanNames.next();
+
+            try {
+
+                HierarchicalConfiguration config = 
confProvider.getConfiguration(name);
+
+                // get the configuration for the class
+                String repClass = config.getString("[...@class]");
+
+                // create the definitation and register it
+                BeanDefinitionRegistry registry = (BeanDefinitionRegistry) 
beanFactory;
+                BeanDefinition def = 
BeanDefinitionBuilder.genericBeanDefinition(repClass).getBeanDefinition();
+                registry.registerBeanDefinition(name, def);
+
+                String aliases = beans.get(name);
+                String[] aliasArray = aliases.split(",");
+
+                // check if we need to register some aliases for this bean
+                if (aliasArray != null) {
+                    for (int i = 0; i < aliasArray.length; i++) {
+                        String alias = aliasArray[i].trim();
+                        if (alias.length() > 0) {
+                            registry.registerAlias(name, aliasArray[i]);
+                        }
+                    }
+                }
+
+            } catch (ConfigurationException e) {
+                throw new FatalBeanException("Unable to parse configuration 
for bean " + name, e);
+            }
+        }
+
+    }
+}

Modified: james/server/trunk/domainlist-jdbc/pom.xml
URL: 
http://svn.apache.org/viewvc/james/server/trunk/domainlist-jdbc/pom.xml?rev=1050311&r1=1050310&r2=1050311&view=diff
==============================================================================
--- james/server/trunk/domainlist-jdbc/pom.xml (original)
+++ james/server/trunk/domainlist-jdbc/pom.xml Fri Dec 17 08:24:17 2010
@@ -35,6 +35,10 @@
     </dependency>
     <dependency>
       <groupId>org.apache.james</groupId>
+      <artifactId>james-server-resolver-api</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.james</groupId>
       <artifactId>james-server-domainlist-library</artifactId>
     </dependency>
     <dependency>

Modified: james/server/trunk/domainlist-library/pom.xml
URL: 
http://svn.apache.org/viewvc/james/server/trunk/domainlist-library/pom.xml?rev=1050311&r1=1050310&r2=1050311&view=diff
==============================================================================
--- james/server/trunk/domainlist-library/pom.xml (original)
+++ james/server/trunk/domainlist-library/pom.xml Fri Dec 17 08:24:17 2010
@@ -76,10 +76,6 @@
       <artifactId>james-server-lifecycle-api</artifactId>
     </dependency>
     <dependency>
-      <groupId>org.apache.james</groupId>
-      <artifactId>james-server-resolver-api</artifactId>
-    </dependency>
-    <dependency>
       <groupId>javax.annotation</groupId>
       <artifactId>jsr250-api</artifactId>
     </dependency>

Modified: james/server/trunk/mailets/pom.xml
URL: 
http://svn.apache.org/viewvc/james/server/trunk/mailets/pom.xml?rev=1050311&r1=1050310&r2=1050311&view=diff
==============================================================================
--- james/server/trunk/mailets/pom.xml (original)
+++ james/server/trunk/mailets/pom.xml Fri Dec 17 08:24:17 2010
@@ -106,6 +106,10 @@
     </dependency>
     <dependency>
       <groupId>org.apache.james</groupId>
+      <artifactId>james-server-resolver-api</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.james</groupId>
       <artifactId>james-server-queue-api</artifactId>
     </dependency>
     <dependency>

Modified: james/server/trunk/user-jdbc/pom.xml
URL: 
http://svn.apache.org/viewvc/james/server/trunk/user-jdbc/pom.xml?rev=1050311&r1=1050310&r2=1050311&view=diff
==============================================================================
--- james/server/trunk/user-jdbc/pom.xml (original)
+++ james/server/trunk/user-jdbc/pom.xml Fri Dec 17 08:24:17 2010
@@ -39,6 +39,10 @@
     </dependency>
     <dependency>
       <groupId>org.apache.james</groupId>
+      <artifactId>james-server-resolver-api</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.james</groupId>
       <artifactId>james-server-user-api</artifactId>
     </dependency>
     <dependency>

Modified: james/server/trunk/user-library/pom.xml
URL: 
http://svn.apache.org/viewvc/james/server/trunk/user-library/pom.xml?rev=1050311&r1=1050310&r2=1050311&view=diff
==============================================================================
--- james/server/trunk/user-library/pom.xml (original)
+++ james/server/trunk/user-library/pom.xml Fri Dec 17 08:24:17 2010
@@ -34,10 +34,6 @@
     </dependency>
     <dependency>
       <groupId>org.apache.james</groupId>
-      <artifactId>james-server-resolver-api</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.james</groupId>
       <artifactId>james-server-util</artifactId>
     </dependency>
     <dependency>



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to