You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by no...@apache.org on 2010/01/31 16:58:26 UTC

svn commit: r905063 - in /james/server/trunk/spring-deployment/src/main: config/james/james-config.xml java/org/apache/james/container/spring/lifecycle/SpringConfigurationProvider.java

Author: norman
Date: Sun Jan 31 15:58:25 2010
New Revision: 905063

URL: http://svn.apache.org/viewvc?rev=905063&view=rev
Log:
more work on config per component / service (JAMES-539)

Modified:
    james/server/trunk/spring-deployment/src/main/config/james/james-config.xml
    james/server/trunk/spring-deployment/src/main/java/org/apache/james/container/spring/lifecycle/SpringConfigurationProvider.java

Modified: james/server/trunk/spring-deployment/src/main/config/james/james-config.xml
URL: http://svn.apache.org/viewvc/james/server/trunk/spring-deployment/src/main/config/james/james-config.xml?rev=905063&r1=905062&r2=905063&view=diff
==============================================================================
--- james/server/trunk/spring-deployment/src/main/config/james/james-config.xml (original)
+++ james/server/trunk/spring-deployment/src/main/config/james/james-config.xml Sun Jan 31 15:58:25 2010
@@ -19,21 +19,7 @@
  -->
 <!DOCTYPE config [
 <!ENTITY listserverConfig SYSTEM "../conf/james-listmanager.xml">
-<!ENTITY fetchmailConfig SYSTEM "../conf/fetchmail.xml">
 <!ENTITY jmsConfig SYSTEM "../conf/jms.xml">
-<!ENTITY smtpserverConfig SYSTEM "../conf/smtpserver.xml">
-<!ENTITY pop3serverConfig SYSTEM "../conf/pop3server.xml">
-<!ENTITY imapserverConfig SYSTEM "../conf/imapserver.xml">
-<!ENTITY remotemanagerConfig SYSTEM "../conf/remotemanager.xml">
-<!ENTITY usersstoreConfig SYSTEM "../conf/users-store.xml">
-<!ENTITY virtualusertablestoreConfig SYSTEM "../conf/virtualusertable-store.xml">
-<!ENTITY JamesConfig SYSTEM "../conf/James.xml">
-<!ENTITY mailstoreConfig SYSTEM "../conf/mailstore.xml">
-<!ENTITY spoolmanagerConfig SYSTEM "../conf/spoolmanager.xml">
-<!ENTITY dnsserverConfig SYSTEM "../conf/dnsserver.xml">
-<!ENTITY domainlistConfig SYSTEM "../conf/domainlist.xml">
-
-
 ]>
 
 <!--  Configuration file for the ASF James server -->
@@ -55,7 +41,6 @@
 <!-- $Revision: 885240 $ Committed on $Date: 2009-11-29 16:15:13 +0100 (So, 29 Nov 2009) $ by: $Author: norman $ -->
 
 <config>
-   &JamesConfig;
    
    <!-- This is an example configuration for FetchMail, a JavaMail based gateway  -->
    <!-- service that pulls messages from other sources, and inserts them into the -->
@@ -65,7 +50,6 @@
    <!-- Fetchmail is a functionally richer replacement for FetchPOP.              -->
    <!-- CHECKME: FetchMail is disabled by default, and must be configured to use. -->
    <!-- Edit the file referred to by fetchmailConfig to enable and configure.     -->
-   &fetchmailConfig;
    
    <!-- Example configuration for JMS interoperation -->
    <!--&jmsConfig;-->
@@ -83,11 +67,6 @@
       <!-- Crytographic mailets -->
       <matcherpackage>org.apache.james.mailet.crypto.matchers</matcherpackage>
    </matcherpackages>
-
-    &spoolmanagerConfig;
-    &dnsserverConfig;
-    &domainlistConfig;
-  
       
    <!-- Uncommment this block to enable the BayesianAnalyserManagement. -->
    <!-- This is needed by the RemoteManager to enable the BayesianAnaylyzerManagement commands --> 
@@ -95,15 +74,6 @@
       <repositoryPath> db://maildb </repositoryPath>
       <sqlFile>file://conf/sqlResources.xml</sqlFile>
    </bayesiananalyzermanagement>
-    
-
-   &remotemanagerConfig;
-   &smtpserverConfig;
-   &pop3serverConfig;
-   &imapserverConfig;
- 
-   
-    
  
 
    <!-- Spool repository configuration -->
@@ -123,11 +93,4 @@
    <!-- TEMPORARY DEFAULT: dbfile using Derby  -->
    <spoolrepository destinationURL="dbfile://maildb/spool/spool" type="SPOOL"/>
    <!-- TEMPORARY DEFAULT: dbfile using Derby  -->
-
-   &mailstoreConfig;
-    
-   &usersstoreConfig;
-   
-   &virtualusertablestoreConfig;
-
 </config>

Modified: james/server/trunk/spring-deployment/src/main/java/org/apache/james/container/spring/lifecycle/SpringConfigurationProvider.java
URL: http://svn.apache.org/viewvc/james/server/trunk/spring-deployment/src/main/java/org/apache/james/container/spring/lifecycle/SpringConfigurationProvider.java?rev=905063&r1=905062&r2=905063&view=diff
==============================================================================
--- james/server/trunk/spring-deployment/src/main/java/org/apache/james/container/spring/lifecycle/SpringConfigurationProvider.java (original)
+++ james/server/trunk/spring-deployment/src/main/java/org/apache/james/container/spring/lifecycle/SpringConfigurationProvider.java Sun Jan 31 15:58:25 2010
@@ -18,6 +18,8 @@
  ****************************************************************/
 package org.apache.james.container.spring.lifecycle;
 
+import java.io.IOException;
+
 import org.apache.commons.configuration.ConfigurationException;
 import org.apache.commons.configuration.HierarchicalConfiguration;
 import org.apache.commons.configuration.XMLConfiguration;
@@ -48,6 +50,14 @@
 	 */
 	public HierarchicalConfiguration getConfigurationForComponent(String name)
 			throws ConfigurationException {
+	    Resource resource = loader.getResource("classpath:" + name + ".xml");
+	    if (resource.exists()) {
+	        try {
+                return getConfig(resource);
+            } catch (IOException e) {
+                throw new ConfigurationException("Unable to read config for component " + name, e);
+            }
+	    }
 		return config.configurationAt(name);
 	}
 
@@ -68,14 +78,19 @@
                     + configFile);
         }
         try {
-            config = new XMLConfiguration();
-            config.setDelimiterParsingDisabled(true);
-            config.load(resource.getFile());
+            config = getConfig(resource);
             
         } catch (Exception e1) {
             throw new RuntimeException("could not open configuration file "
                     + configFile, e1);
         }
     }
+    
+    private XMLConfiguration getConfig(Resource r) throws ConfigurationException, IOException {
+        XMLConfiguration config = new XMLConfiguration();
+        config.setDelimiterParsingDisabled(true);
+        config.load(r.getFile());
+        return config;
+    }
 
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org