james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nor...@apache.org
Subject svn commit: r832749 - in /james/server/trunk: nntpserver-function/src/main/java/org/apache/james/nntpserver/repository/ phoenix-deployment/src/conf/ smtpserver-function/src/main/resources/org/apache/james/smtpserver/
Date Wed, 04 Nov 2009 14:06:53 GMT
Author: norman
Date: Wed Nov  4 14:06:52 2009
New Revision: 832749

URL: http://svn.apache.org/viewvc?rev=832749&view=rev
Log:
Work on fixing startup when nntp is enabled

Modified:
    james/server/trunk/nntpserver-function/src/main/java/org/apache/james/nntpserver/repository/AvalonNNTPRepository.java
    james/server/trunk/nntpserver-function/src/main/java/org/apache/james/nntpserver/repository/NNTPRepositoryImpl.java
    james/server/trunk/nntpserver-function/src/main/java/org/apache/james/nntpserver/repository/NNTPSpooler.java
    james/server/trunk/phoenix-deployment/src/conf/james-assembly.xml
    james/server/trunk/phoenix-deployment/src/conf/james-config.xml
    james/server/trunk/smtpserver-function/src/main/resources/org/apache/james/smtpserver/AvalonSMTPServer.xinfo

Modified: james/server/trunk/nntpserver-function/src/main/java/org/apache/james/nntpserver/repository/AvalonNNTPRepository.java
URL: http://svn.apache.org/viewvc/james/server/trunk/nntpserver-function/src/main/java/org/apache/james/nntpserver/repository/AvalonNNTPRepository.java?rev=832749&r1=832748&r2=832749&view=diff
==============================================================================
--- james/server/trunk/nntpserver-function/src/main/java/org/apache/james/nntpserver/repository/AvalonNNTPRepository.java
(original)
+++ james/server/trunk/nntpserver-function/src/main/java/org/apache/james/nntpserver/repository/AvalonNNTPRepository.java
Wed Nov  4 14:06:52 2009
@@ -33,6 +33,7 @@
 import org.apache.avalon.framework.service.Serviceable;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.impl.AvalonLogger;
+import org.apache.james.api.kernel.LoaderService;
 import org.apache.james.bridge.GuiceInjected;
 import org.apache.james.services.FileSystem;
 import org.apache.james.util.ConfigurationAdapter;
@@ -40,6 +41,8 @@
 
 import com.google.inject.AbstractModule;
 import com.google.inject.Guice;
+import com.google.inject.Injector;
+import com.google.inject.Provider;
 import com.google.inject.name.Names;
 
 public class AvalonNNTPRepository implements NNTPRepository, GuiceInjected, Configurable,
Serviceable, LogEnabled, Initializable{
@@ -90,17 +93,35 @@
     }
 
     public void initialize() throws Exception {
-        repos = Guice.createInjector(new Jsr250Module(), new AbstractModule() {
-            
-            @Override
-            protected void configure() {
-                bind(org.apache.commons.configuration.HierarchicalConfiguration.class).annotatedWith(Names.named("org.apache.commons.configuration.Configuration")).toInstance(config);
-                bind(Log.class).annotatedWith(Names.named("org.apache.commons.logging.Log")).toInstance(logger);
-                bind(FileSystem.class).annotatedWith(Names.named("org.apache.james.services.FileSystem")).toInstance(fs);
-            }
-        }).getInstance(NNTPRepositoryImpl.class);
+        repos = Guice.createInjector(new Jsr250Module(), new NTTPRepositoryModule()).getInstance(NNTPRepositoryImpl.class);
     }
 
+    private class NTTPRepositoryModule extends AbstractModule {
+        
+        @Override
+        protected void configure() {
+            bind(org.apache.commons.configuration.HierarchicalConfiguration.class).annotatedWith(Names.named("org.apache.commons.configuration.Configuration")).toInstance(config);
+            bind(Log.class).annotatedWith(Names.named("org.apache.commons.logging.Log")).toInstance(logger);
+            bind(FileSystem.class).annotatedWith(Names.named("org.apache.james.services.FileSystem")).toInstance(fs);
+            bind(LoaderService.class).annotatedWith(Names.named("org.apache.james.LoaderService")).toProvider(new
Provider<LoaderService>() {
+
+                public LoaderService get() {
+                    return new NNTPLoaderService();
+                }
+                
+                // Mimic the loaderservice
+                class NNTPLoaderService implements LoaderService {
+                    Injector injector = Guice.createInjector(new NTTPRepositoryModule(),
new Jsr250Module());
+
+                    public <T> T load(Class<T> type) {
+                        return injector.getInstance(type);
+                    }
+                    
+                }
+                
+            });
+        }
+    }
     /**
      * @see org.apache.avalon.framework.configuration.Configurable#configure(org.apache.avalon.framework.configuration.Configuration)
      */

Modified: james/server/trunk/nntpserver-function/src/main/java/org/apache/james/nntpserver/repository/NNTPRepositoryImpl.java
URL: http://svn.apache.org/viewvc/james/server/trunk/nntpserver-function/src/main/java/org/apache/james/nntpserver/repository/NNTPRepositoryImpl.java?rev=832749&r1=832748&r2=832749&view=diff
==============================================================================
--- james/server/trunk/nntpserver-function/src/main/java/org/apache/james/nntpserver/repository/NNTPRepositoryImpl.java
(original)
+++ james/server/trunk/nntpserver-function/src/main/java/org/apache/james/nntpserver/repository/NNTPRepositoryImpl.java
Wed Nov  4 14:06:52 2009
@@ -472,7 +472,9 @@
         HierarchicalConfiguration spoolerConfiguration = configuration.configurationAt("spool");
         // Must be a subclass of org.apache.james.nntpserver.repository.NNTPSpooler
         className = spoolerConfiguration.getString("[@class]");
-
+        if (className == null) {
+        	className = NNTPSpooler.class.getName();
+        }
         try {
             Class<?> myClass = Thread.currentThread().getContextClassLoader().loadClass(className);
             Object obj = loader.load(myClass);

Modified: james/server/trunk/nntpserver-function/src/main/java/org/apache/james/nntpserver/repository/NNTPSpooler.java
URL: http://svn.apache.org/viewvc/james/server/trunk/nntpserver-function/src/main/java/org/apache/james/nntpserver/repository/NNTPSpooler.java?rev=832749&r1=832748&r2=832749&view=diff
==============================================================================
--- james/server/trunk/nntpserver-function/src/main/java/org/apache/james/nntpserver/repository/NNTPSpooler.java
(original)
+++ james/server/trunk/nntpserver-function/src/main/java/org/apache/james/nntpserver/repository/NNTPSpooler.java
Wed Nov  4 14:06:52 2009
@@ -30,6 +30,7 @@
 import org.apache.james.util.Lock;
 import org.apache.james.util.io.IOUtil;
 
+import javax.annotation.PostConstruct;
 import javax.annotation.Resource;
 import javax.mail.internet.MimeMessage;
 
@@ -75,13 +76,8 @@
 
     private Log logger;
 
-
-    /**
-     * @see org.apache.avalon.framework.activity.Initializable#initialize()
-     */
-    public void initialize() throws Exception {
-        //System.out.println(getClass().getName()+": init");
-
+    @PostConstruct
+    public void init() throws Exception {
         try {
             spoolPath = fileSystem.getFile(spoolPathString);
             if ( spoolPath.exists() == false ) {

Modified: james/server/trunk/phoenix-deployment/src/conf/james-assembly.xml
URL: http://svn.apache.org/viewvc/james/server/trunk/phoenix-deployment/src/conf/james-assembly.xml?rev=832749&r1=832748&r2=832749&view=diff
==============================================================================
--- james/server/trunk/phoenix-deployment/src/conf/james-assembly.xml (original)
+++ james/server/trunk/phoenix-deployment/src/conf/james-assembly.xml Wed Nov  4 14:06:52
2009
@@ -158,6 +158,7 @@
     <provide name="filesystem" role="org.apache.james.services.FileSystem" />
     <provide name="defaultvirtualusertable"
              role="org.apache.james.api.vut.VirtualUserTable" />
+    <provide name="virtualusertable-store" role="org.apache.james.api.vut.VirtualUserTableStore"/>
     <proxy disable='true'/>
   </block>
   

Modified: james/server/trunk/phoenix-deployment/src/conf/james-config.xml
URL: http://svn.apache.org/viewvc/james/server/trunk/phoenix-deployment/src/conf/james-config.xml?rev=832749&r1=832748&r2=832749&view=diff
==============================================================================
--- james/server/trunk/phoenix-deployment/src/conf/james-config.xml (original)
+++ james/server/trunk/phoenix-deployment/src/conf/james-config.xml Wed Nov  4 14:06:52 2009
@@ -1210,7 +1210,7 @@
          <newsgroup>org.apache.avalon.user</newsgroup>
       </newsgroups>
 
-      <spool>
+      <spool class="org.apache.james.nntpserver.repository.NNTPSpooler">
          <configuration>
             <spoolPath>file://var/nntp/spool</spoolPath>
             <!-- The number of threads that process spooler related tasks. -->

Modified: james/server/trunk/smtpserver-function/src/main/resources/org/apache/james/smtpserver/AvalonSMTPServer.xinfo
URL: http://svn.apache.org/viewvc/james/server/trunk/smtpserver-function/src/main/resources/org/apache/james/smtpserver/AvalonSMTPServer.xinfo?rev=832749&r1=832748&r2=832749&view=diff
==============================================================================
--- james/server/trunk/smtpserver-function/src/main/resources/org/apache/james/smtpserver/AvalonSMTPServer.xinfo
(original)
+++ james/server/trunk/smtpserver-function/src/main/resources/org/apache/james/smtpserver/AvalonSMTPServer.xinfo
Wed Nov  4 14:06:52 2009
@@ -65,6 +65,9 @@
     </dependency>
     <dependency>
       <service name="org.apache.james.services.FileSystem" version="1.0"/>
+    </dependency>    
+    <dependency>
+      <service name="org.apache.james.api.vut.VirtualUserTableStore" version="1.0"/>
     </dependency>
   </dependencies>
 </blockinfo>



---------------------------------------------------------------------
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