james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ber...@apache.org
Subject svn commit: r562874 - in /james/server/sandbox/spring-integration/spring-deployment/src/main: config/ java/org/apache/james/container/spring/adaptor/ java/org/apache/james/container/spring/configuration/ java/org/apache/james/container/spring/examples/
Date Sun, 05 Aug 2007 14:28:51 GMT
Author: berndf
Date: Sun Aug  5 07:28:50 2007
New Revision: 562874

URL: http://svn.apache.org/viewvc?view=rev&rev=562874
Log:
introduce configuration interception facility

Added:
    james/server/sandbox/spring-integration/spring-deployment/src/main/java/org/apache/james/container/spring/configuration/
    james/server/sandbox/spring-integration/spring-deployment/src/main/java/org/apache/james/container/spring/configuration/ConfigurationInterceptor.java
    james/server/sandbox/spring-integration/spring-deployment/src/main/java/org/apache/james/container/spring/examples/
Modified:
    james/server/sandbox/spring-integration/spring-deployment/src/main/config/beans-base-config.xml
    james/server/sandbox/spring-integration/spring-deployment/src/main/config/james-config.xml
    james/server/sandbox/spring-integration/spring-deployment/src/main/java/org/apache/james/container/spring/adaptor/AvalonConfigurationFileProvider.java
    james/server/sandbox/spring-integration/spring-deployment/src/main/java/org/apache/james/container/spring/adaptor/ConfigurationProvider.java

Modified: james/server/sandbox/spring-integration/spring-deployment/src/main/config/beans-base-config.xml
URL: http://svn.apache.org/viewvc/james/server/sandbox/spring-integration/spring-deployment/src/main/config/beans-base-config.xml?view=diff&rev=562874&r1=562873&r2=562874
==============================================================================
--- james/server/sandbox/spring-integration/spring-deployment/src/main/config/beans-base-config.xml
(original)
+++ james/server/sandbox/spring-integration/spring-deployment/src/main/config/beans-base-config.xml
Sun Aug  5 07:28:50 2007
@@ -35,8 +35,19 @@
         <property name="logWorker" ref="logWorker" />
     </bean>
 
+    <!-- 
+         maps the default standard ports for SMTP, POP3, IMAP, NNTP to non-privileged ports
in the
+         9000's range
+    -->
+    <bean id="exampleConfigurationInterceptor" class="org.apache.james.container.spring.examples.configuration.UnprivilegedPortConfigurationInterceptor"
/>
+    
     <bean id="configurationProvider" class="org.apache.james.container.spring.adaptor.AvalonConfigurationFileProvider"
>
         <property name="configurationPath" value="src/main/config/james-config.xml" />
+        <property name="configurationInterceptors">
+            <list>
+                <!--<ref bean="exampleConfigurationInterceptor" />-->
+            </list>
+        </property>
     </bean>
 
     <bean id="avalonContext" class="org.apache.james.container.spring.adaptor.AvalonContext"
>

Modified: james/server/sandbox/spring-integration/spring-deployment/src/main/config/james-config.xml
URL: http://svn.apache.org/viewvc/james/server/sandbox/spring-integration/spring-deployment/src/main/config/james-config.xml?view=diff&rev=562874&r1=562873&r2=562874
==============================================================================
--- james/server/sandbox/spring-integration/spring-deployment/src/main/config/james-config.xml
(original)
+++ james/server/sandbox/spring-integration/spring-deployment/src/main/config/james-config.xml
Sun Aug  5 07:28:50 2007
@@ -187,7 +187,7 @@
    <imapserver enabled="true">
       <!-- port 993 is the well-known/IANA registered port for IMAPs ie over SSL/TLS -->
       <!-- port 143 is the well-known/IANA registered port for Standard IMAP4 -->
-      <port>10143</port>
+      <port>143</port>
       <handler>
        <!-- RFC 3501 requires a minimum timeout of 30 minutes -->
        <connectiontimeout>1800000</connectiontimeout>         
@@ -940,7 +940,7 @@
    <pop3server enabled="true">
       <!-- port 995 is the well-known/IANA registered port for POP3S  ie over SSL/TLS
-->
       <!-- port 110 is the well-known/IANA registered port for Standard POP3 -->
-      <port>10110</port>
+      <port>110</port>
 
       <!-- Uncomment this if you want to bind to a specific inetaddress -->
       <!--
@@ -967,7 +967,7 @@
     <!-- but does not free as many resources as removing them would -->
    <smtpserver enabled="true">
       <!-- port 25 is the well-known/IANA registered port for SMTP -->
-      <port>10025</port>
+      <port>25</port>
 
       <!-- Uncomment this if you want to bind to a specific inetaddress -->
       <!-- Please NOTE: you should add this IP also to your RemoteAddrNotInNetwork -->
@@ -1067,7 +1067,7 @@
         service.  -->
       <!-- port 563 is the well-known/IANA registered port for NNTP over SSL/TLS -->
       <!-- port 119 is the well-known/IANA registered port for Standard NNTP -->
-      <port>10119</port>
+      <port>119</port>
 
       <!-- Uncomment this if you want to bind to a specific inetaddress -->
       <!--

Modified: james/server/sandbox/spring-integration/spring-deployment/src/main/java/org/apache/james/container/spring/adaptor/AvalonConfigurationFileProvider.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/spring-integration/spring-deployment/src/main/java/org/apache/james/container/spring/adaptor/AvalonConfigurationFileProvider.java?view=diff&rev=562874&r1=562873&r2=562874
==============================================================================
--- james/server/sandbox/spring-integration/spring-deployment/src/main/java/org/apache/james/container/spring/adaptor/AvalonConfigurationFileProvider.java
(original)
+++ james/server/sandbox/spring-integration/spring-deployment/src/main/java/org/apache/james/container/spring/adaptor/AvalonConfigurationFileProvider.java
Sun Aug  5 07:28:50 2007
@@ -20,8 +20,12 @@
 
 import org.apache.avalon.framework.configuration.Configuration;
 import org.apache.avalon.phoenix.tools.configuration.ConfigurationBuilder;
+import org.apache.james.container.spring.configuration.ConfigurationInterceptor;
 import org.xml.sax.InputSource;
 
+import java.util.List;
+import java.util.Iterator;
+
 /**
  * loads the well-known classic James configuration file
  *
@@ -30,6 +34,8 @@
 public class AvalonConfigurationFileProvider implements ConfigurationProvider {
 
     private String absoluteFilePath;
+    private List configurationInterceptors;
+    private Iterator interceptorsIterator;
 
     public void setConfigurationPath(String absoluteFilePath) {
         this.absoluteFilePath = absoluteFilePath;
@@ -38,10 +44,10 @@
 
     public Configuration getConfiguration() {
         InputSource inputSource = new InputSource(absoluteFilePath);
+        Configuration configuration;
         try
         {
-            Configuration configuration = ConfigurationBuilder.build(inputSource, null, null);
-            return configuration;
+            configuration = ConfigurationBuilder.build(inputSource, null, null);
         }
         catch( final Exception e )
         {
@@ -49,5 +55,19 @@
             throw new RuntimeException("failed loading configuration ", e);
         }
 
+        // apply all interceptors
+        if (configuration != null && configurationInterceptors != null) {
+            interceptorsIterator = configurationInterceptors.iterator();
+            while (interceptorsIterator.hasNext()) {
+                ConfigurationInterceptor configurationInterceptor = (ConfigurationInterceptor)
interceptorsIterator.next();
+                configuration = configurationInterceptor.intercept(configuration);
+            }
+        }
+        
+        return configuration;
+    }
+
+    public void setConfigurationInterceptors(List configurationInterceptors) {
+        this.configurationInterceptors = configurationInterceptors;
     }
 }

Modified: james/server/sandbox/spring-integration/spring-deployment/src/main/java/org/apache/james/container/spring/adaptor/ConfigurationProvider.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/spring-integration/spring-deployment/src/main/java/org/apache/james/container/spring/adaptor/ConfigurationProvider.java?view=diff&rev=562874&r1=562873&r2=562874
==============================================================================
--- james/server/sandbox/spring-integration/spring-deployment/src/main/java/org/apache/james/container/spring/adaptor/ConfigurationProvider.java
(original)
+++ james/server/sandbox/spring-integration/spring-deployment/src/main/java/org/apache/james/container/spring/adaptor/ConfigurationProvider.java
Sun Aug  5 07:28:50 2007
@@ -20,6 +20,8 @@
 
 import org.apache.avalon.framework.configuration.Configuration;
 
+import java.util.List;
+
 /**
  * interface for providing a Avalon configuration to replace the default (legacy) mechanism
implemented by
  * AvalonConfigurationFileProvider
@@ -27,5 +29,7 @@
 public interface ConfigurationProvider {
 
     Configuration getConfiguration();
+
+    void setConfigurationInterceptors(List configurationInterceptors);
 
 }

Added: james/server/sandbox/spring-integration/spring-deployment/src/main/java/org/apache/james/container/spring/configuration/ConfigurationInterceptor.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/spring-integration/spring-deployment/src/main/java/org/apache/james/container/spring/configuration/ConfigurationInterceptor.java?view=auto&rev=562874
==============================================================================
--- james/server/sandbox/spring-integration/spring-deployment/src/main/java/org/apache/james/container/spring/configuration/ConfigurationInterceptor.java
(added)
+++ james/server/sandbox/spring-integration/spring-deployment/src/main/java/org/apache/james/container/spring/configuration/ConfigurationInterceptor.java
Sun Aug  5 07:28:50 2007
@@ -0,0 +1,17 @@
+package org.apache.james.container.spring.configuration;
+
+import org.apache.avalon.framework.configuration.Configuration;
+
+/**
+ * interface for modifying configurations
+ */
+public interface ConfigurationInterceptor {
+
+    /**
+     * gets a configuration, inspects and eventually changes it.
+     * @param configuration
+     * @return changed configuration
+     */
+    Configuration intercept(Configuration configuration);
+}
+



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


Mime
View raw message