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 ba...@apache.org on 2006/10/06 19:47:44 UTC

svn commit: r453705 - in /james/server/trunk/src: conf/ java/org/apache/james/ java/org/apache/james/context/ java/org/apache/james/core/ java/org/apache/james/mailrepository/ java/org/apache/james/mailrepository/filepair/ java/org/apache/james/mailrep...

Author: bago
Date: Fri Oct  6 10:47:43 2006
New Revision: 453705

URL: http://svn.apache.org/viewvc?view=rev&rev=453705
Log:
Removed Context/Contextualizable from all the codebase introducing a simple FileSystem service as the substitute (JAMES-654)

Added:
    james/server/trunk/src/java/org/apache/james/context/AvalonFileSystem.java   (with props)
    james/server/trunk/src/java/org/apache/james/context/AvalonFileSystem.xinfo
    james/server/trunk/src/java/org/apache/james/services/FileSystem.java   (with props)
Modified:
    james/server/trunk/src/conf/james-assembly.xml
    james/server/trunk/src/java/org/apache/james/James.java
    james/server/trunk/src/java/org/apache/james/James.xinfo
    james/server/trunk/src/java/org/apache/james/core/AvalonMailStore.java
    james/server/trunk/src/java/org/apache/james/core/AvalonMailStore.xinfo
    james/server/trunk/src/java/org/apache/james/core/AvalonUsersStore.java
    james/server/trunk/src/java/org/apache/james/core/AvalonUsersStore.xinfo
    james/server/trunk/src/java/org/apache/james/mailrepository/JDBCMailRepository.java
    james/server/trunk/src/java/org/apache/james/mailrepository/filepair/AbstractFileRepository.java
    james/server/trunk/src/java/org/apache/james/mailrepository/javamail/AbstractJavamailStoreMailRepository.java
    james/server/trunk/src/java/org/apache/james/management/BayesianAnalyzerManagement.java
    james/server/trunk/src/java/org/apache/james/management/BayesianAnalyzerManagement.xinfo
    james/server/trunk/src/java/org/apache/james/nntpserver/repository/NNTPRepositoryImpl.java
    james/server/trunk/src/java/org/apache/james/nntpserver/repository/NNTPRepositoryImpl.xinfo
    james/server/trunk/src/java/org/apache/james/nntpserver/repository/NNTPSpooler.java
    james/server/trunk/src/java/org/apache/james/remotemanager/RemoteManager.java
    james/server/trunk/src/java/org/apache/james/smtpserver/SMTPHandlerChain.java
    james/server/trunk/src/java/org/apache/james/smtpserver/SMTPServer.java
    james/server/trunk/src/java/org/apache/james/smtpserver/SMTPServer.xinfo
    james/server/trunk/src/java/org/apache/james/smtpserver/core/filter/fastfail/GreylistHandler.java
    james/server/trunk/src/java/org/apache/james/transport/JamesMailetLoader.xinfo
    james/server/trunk/src/java/org/apache/james/transport/JamesMatcherLoader.xinfo
    james/server/trunk/src/java/org/apache/james/transport/Loader.java
    james/server/trunk/src/java/org/apache/james/userrepository/AbstractJdbcUsersRepository.java
    james/server/trunk/src/test/org/apache/james/JamesTest.java
    james/server/trunk/src/test/org/apache/james/mailrepository/AvalonMailRepositoryTest.java
    james/server/trunk/src/test/org/apache/james/services/MailServerTestAllImplementations.java

Modified: james/server/trunk/src/conf/james-assembly.xml
URL: http://svn.apache.org/viewvc/james/server/trunk/src/conf/james-assembly.xml?view=diff&rev=453705&r1=453704&r2=453705
==============================================================================
--- james/server/trunk/src/conf/james-assembly.xml (original)
+++ james/server/trunk/src/conf/james-assembly.xml Fri Oct  6 10:47:43 2006
@@ -29,6 +29,7 @@
     <provide name="users-store" role="org.apache.james.services.UsersStore"/>
     <provide name="localusersrepository" role="org.apache.james.services.UsersRepository"/>
     <provide name="spoolrepository" role="org.apache.james.services.SpoolRepository"/>
+    <provide name="filesystem" role="org.apache.james.services.FileSystem" />
     <provide name="sockets"
              role="org.apache.avalon.cornerstone.services.sockets.SocketManager"/>
     <provide name="scheduler"
@@ -46,10 +47,12 @@
 
   <block name="matcherpackages" class="org.apache.james.transport.JamesMatcherLoader" >
     <provide name="James" role="org.apache.mailet.MailetContext"/>
+    <provide name="filesystem" role="org.apache.james.services.FileSystem" />
   </block>
 
   <block name="mailetpackages" class="org.apache.james.transport.JamesMailetLoader" >
     <provide name="James" role="org.apache.mailet.MailetContext"/>
+    <provide name="filesystem" role="org.apache.james.services.FileSystem" />
   </block>
 
   <block name="dnsserver" class="org.apache.james.dnsserver.DNSServer" />
@@ -62,6 +65,7 @@
   <block name="bayesiananalyzermanagement" class="org.apache.james.management.BayesianAnalyzerManagement" >
       <provide name="database-connections"
              role="org.apache.avalon.cornerstone.services.datasources.DataSourceSelector" />
+    <provide name="filesystem" role="org.apache.james.services.FileSystem" />
   </block>
 
   <block name="remotemanager" class="org.apache.james.remotemanager.RemoteManager" >
@@ -115,6 +119,7 @@
              role="org.apache.avalon.cornerstone.services.threads.ThreadManager" />
     <provide name="database-connections"
              role="org.apache.avalon.cornerstone.services.datasources.DataSourceSelector" />
+    <provide name="filesystem" role="org.apache.james.services.FileSystem" />
   </block>
 
   <!-- NNTP Server -->
@@ -132,7 +137,9 @@
   </block>
 
   <!-- NNTP Repository -->
-  <block name="nntp-repository" class="org.apache.james.nntpserver.repository.NNTPRepositoryImpl" />
+  <block name="nntp-repository" class="org.apache.james.nntpserver.repository.NNTPRepositoryImpl">
+    <provide name="filesystem" role="org.apache.james.services.FileSystem" />
+  </block>
 
   <!-- FetchMail Service -->
   <block name="fetchmail" class="org.apache.james.fetchmail.FetchScheduler" >
@@ -147,6 +154,7 @@
   <block name="mailstore" class="org.apache.james.core.AvalonMailStore" >
     <provide name="database-connections"
              role="org.apache.avalon.cornerstone.services.datasources.DataSourceSelector" />
+    <provide name="filesystem" role="org.apache.james.services.FileSystem" />
   </block>
   
   <!-- The main SpoolRepository -->
@@ -162,12 +170,17 @@
              role="org.apache.avalon.cornerstone.services.store.Store"/>
     <provide name="database-connections"
              role="org.apache.avalon.cornerstone.services.datasources.DataSourceSelector" />
+    <provide name="filesystem" role="org.apache.james.services.FileSystem" />
   </block>
 
   <!-- This is needed to link the smtpserver to the local user repository -->
   <block name="localusersrepository" class="org.apache.james.core.LocalUsersRepository">
     <provide name="users-store"
              role="org.apache.james.services.UsersStore"/>
+  </block>
+
+  <!-- The context FileSystem implementation -->
+  <block name="filesystem" class="org.apache.james.context.AvalonFileSystem">
   </block>
   
   <!-- Configuration for Cornerstone Blocks only after here

Modified: james/server/trunk/src/java/org/apache/james/James.java
URL: http://svn.apache.org/viewvc/james/server/trunk/src/java/org/apache/james/James.java?view=diff&rev=453705&r1=453704&r2=453705
==============================================================================
--- james/server/trunk/src/java/org/apache/james/James.java (original)
+++ james/server/trunk/src/java/org/apache/james/James.java Fri Oct  6 10:47:43 2006
@@ -28,8 +28,6 @@
 import org.apache.avalon.framework.configuration.ConfigurationException;
 import org.apache.avalon.framework.configuration.DefaultConfiguration;
 import org.apache.avalon.framework.container.ContainerUtil;
-import org.apache.avalon.framework.context.Context;
-import org.apache.avalon.framework.context.Contextualizable;
 import org.apache.avalon.framework.logger.AbstractLogEnabled;
 import org.apache.avalon.framework.logger.Logger;
 import org.apache.avalon.framework.service.DefaultServiceManager;
@@ -38,11 +36,11 @@
 import org.apache.avalon.framework.service.Serviceable;
 import org.apache.commons.collections.ReferenceMap;
 
-import org.apache.james.context.AvalonContextUtilities;
 import org.apache.james.core.MailHeaders;
 import org.apache.james.core.MailImpl;
 import org.apache.james.core.MailetConfigImpl;
 import org.apache.james.services.DNSServer;
+import org.apache.james.services.FileSystem;
 import org.apache.james.services.MailRepository;
 import org.apache.james.services.MailServer;
 import org.apache.james.services.SpoolRepository;
@@ -90,7 +88,7 @@
  */
 public class James
     extends AbstractLogEnabled
-    implements Contextualizable, Serviceable, Configurable, Initializable, MailServer, MailetContext {
+    implements Serviceable, Configurable, Initializable, MailServer, MailetContext {
 
     /**
      * The software name and version
@@ -168,29 +166,29 @@
     private Hashtable attributes = new Hashtable();
 
     /**
-     * The Avalon context used by the instance
-     */
-    protected Context           myContext;
-
-    /**
      * Currently used by storeMail to avoid code duplication (we moved store logic to that mailet).
      * TODO We should remove this and its initialization when we remove storeMail method.
      */
     protected Mailet localDeliveryMailet;
-    
-    /**
-     * @see org.apache.avalon.framework.context.Contextualizable#contextualize(Context)
-     */
-    public void contextualize(final Context context) {
-        this.myContext = context;
-    }
+
+    private FileSystem fileSystem;
 
     /**
      * @see org.apache.avalon.framework.service.Serviceable#service(ServiceManager)
      */
-    public void service(ServiceManager comp) {
+    public void service(ServiceManager comp) throws ServiceException {
         compMgr = new DefaultServiceManager(comp);
         mailboxes = new ReferenceMap();
+        setFileSystem((FileSystem) comp.lookup(FileSystem.ROLE));
+    }
+
+    /**
+     * Sets the fileSystem service
+     * 
+     * @param system the new service
+     */
+    private void setFileSystem(FileSystem system) {
+        this.fileSystem = system;
     }
 
     /**
@@ -238,7 +236,7 @@
         attributes.put(Constants.AVALON_COMPONENT_MANAGER, compMgr);
 
         //Temporary get out to allow complex mailet config files to stop blocking sergei sozonoff's work on bouce processing
-        java.io.File configDir = AvalonContextUtilities.getFile(myContext, "file://conf/");
+        java.io.File configDir = fileSystem.getFile("file://conf/");
         attributes.put("confDir", configDir.getCanonicalPath());
 
         initializeLocalDeliveryMailet();

Modified: james/server/trunk/src/java/org/apache/james/James.xinfo
URL: http://svn.apache.org/viewvc/james/server/trunk/src/java/org/apache/james/James.xinfo?view=diff&rev=453705&r1=453704&r2=453705
==============================================================================
--- james/server/trunk/src/java/org/apache/james/James.xinfo (original)
+++ james/server/trunk/src/java/org/apache/james/James.xinfo Fri Oct  6 10:47:43 2006
@@ -39,7 +39,9 @@
     <dependency>
       <service name="org.apache.avalon.cornerstone.services.datasources.DataSourceSelector" version="1.0"/>
     </dependency>
-
+    <dependency>
+      <service name="org.apache.james.services.FileSystem" version="1.0"/>
+    </dependency>
   </dependencies>
 
 

Added: james/server/trunk/src/java/org/apache/james/context/AvalonFileSystem.java
URL: http://svn.apache.org/viewvc/james/server/trunk/src/java/org/apache/james/context/AvalonFileSystem.java?view=auto&rev=453705
==============================================================================
--- james/server/trunk/src/java/org/apache/james/context/AvalonFileSystem.java (added)
+++ james/server/trunk/src/java/org/apache/james/context/AvalonFileSystem.java Fri Oct  6 10:47:43 2006
@@ -0,0 +1,77 @@
+/****************************************************************
+ * 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.context;
+
+import org.apache.avalon.framework.context.Context;
+import org.apache.avalon.framework.context.ContextException;
+import org.apache.avalon.framework.context.Contextualizable;
+import org.apache.james.services.FileSystem;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+
+/**
+ * Avalon implementation of the FileSystem service
+ * 
+ * @since 2.4
+ */
+public class AvalonFileSystem implements FileSystem, Contextualizable {
+
+    /**
+     * Avalon context used by this implementation
+     */
+    private Context context;
+
+    /**
+     * @see org.apache.james.services.FileSystem#getFile(java.lang.String)
+     */
+    public File getFile(String fileURL) throws FileNotFoundException {
+        try {
+            return AvalonContextUtilities.getFile(context, fileURL);
+        } catch (ContextException e) {
+            throw new FileNotFoundException("Context exception: "+e.getMessage());
+        } catch (Exception e) {
+            throw new FileNotFoundException(e.getMessage());
+        }
+    }
+    
+    /**
+     * @see org.apache.james.services.FileSystem#getBasedir()
+     */
+    public File getBasedir() throws FileNotFoundException {
+        try {
+            return (File) context.get( "urn:avalon:home" );
+        } catch (ContextException e) {
+            try {
+                return ((File) context.get( AvalonContextConstants.APPLICATION_HOME) );
+            } catch (ContextException e2) {
+                throw new FileNotFoundException(e2.getMessage());
+            }
+        }
+    }
+
+    /**
+     * @see org.apache.avalon.framework.context.Contextualizable#contextualize(org.apache.avalon.framework.context.Context)
+     */
+    public void contextualize(Context context) throws ContextException {
+        this.context = context;
+    }
+
+}

Propchange: james/server/trunk/src/java/org/apache/james/context/AvalonFileSystem.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: james/server/trunk/src/java/org/apache/james/context/AvalonFileSystem.xinfo
URL: http://svn.apache.org/viewvc/james/server/trunk/src/java/org/apache/james/context/AvalonFileSystem.xinfo?view=auto&rev=453705
==============================================================================
--- james/server/trunk/src/java/org/apache/james/context/AvalonFileSystem.xinfo (added)
+++ james/server/trunk/src/java/org/apache/james/context/AvalonFileSystem.xinfo Fri Oct  6 10:47:43 2006
@@ -0,0 +1,15 @@
+<?xml version="1.0"?>
+
+<blockinfo>
+
+  <!-- section to describe block -->
+  <block>
+    <version>1.0</version>
+  </block>
+
+  <!-- services that are offered by this block -->
+  <services>
+    <service name="org.apache.james.services.FileSystem" version="1.0" />
+  </services>
+
+</blockinfo>

Modified: james/server/trunk/src/java/org/apache/james/core/AvalonMailStore.java
URL: http://svn.apache.org/viewvc/james/server/trunk/src/java/org/apache/james/core/AvalonMailStore.java?view=diff&rev=453705&r1=453704&r2=453705
==============================================================================
--- james/server/trunk/src/java/org/apache/james/core/AvalonMailStore.java (original)
+++ james/server/trunk/src/java/org/apache/james/core/AvalonMailStore.java Fri Oct  6 10:47:43 2006
@@ -32,9 +32,6 @@
 import org.apache.avalon.framework.configuration.ConfigurationException;
 import org.apache.avalon.framework.configuration.DefaultConfiguration;
 import org.apache.avalon.framework.container.ContainerUtil;
-import org.apache.avalon.framework.context.Context;
-import org.apache.avalon.framework.context.ContextException;
-import org.apache.avalon.framework.context.Contextualizable;
 import org.apache.avalon.framework.logger.AbstractLogEnabled;
 import org.apache.commons.collections.ReferenceMap;
 
@@ -48,7 +45,7 @@
  */
 public class AvalonMailStore
     extends AbstractLogEnabled
-    implements Contextualizable, Serviceable, Configurable, Initializable, Store {
+    implements Serviceable, Configurable, Initializable, Store {
 
     // Prefix for repository names
     private static final String REPOSITORY_NAME = "Repository";
@@ -67,11 +64,6 @@
     private Map defaultConfigs;
 
     /**
-     * The Avalon context used by the instance
-     */
-    protected Context                context;
-
-    /**
      * The Avalon configuration used by the instance
      */
     protected Configuration          configuration;
@@ -82,14 +74,6 @@
     protected ServiceManager       m_manager;
 
     /**
-     * @see org.apache.avalon.framework.context.Contextualizable#contextualize(Context)
-     */
-    public void contextualize(final Context context)
-            throws ContextException {
-        this.context = context;
-    }
-
-    /**
      * @see org.apache.avalon.framework.service.Serviceable#service(ServiceManager)
      */
     public void service( final ServiceManager manager )
@@ -276,7 +260,6 @@
                 try {
                     reply = Thread.currentThread().getContextClassLoader().loadClass(repClass).newInstance();
                     ContainerUtil.enableLogging(reply,getLogger());
-                    ContainerUtil.contextualize(reply,context);
                     ContainerUtil.service(reply,m_manager);
 
                     ContainerUtil.configure(reply,config);

Modified: james/server/trunk/src/java/org/apache/james/core/AvalonMailStore.xinfo
URL: http://svn.apache.org/viewvc/james/server/trunk/src/java/org/apache/james/core/AvalonMailStore.xinfo?view=diff&rev=453705&r1=453704&r2=453705
==============================================================================
--- james/server/trunk/src/java/org/apache/james/core/AvalonMailStore.xinfo (original)
+++ james/server/trunk/src/java/org/apache/james/core/AvalonMailStore.xinfo Fri Oct  6 10:47:43 2006
@@ -16,6 +16,9 @@
     <dependency>
       <service name="org.apache.avalon.cornerstone.services.datasources.DataSourceSelector" version="1.0"/>
     </dependency>
+    <dependency>
+      <service name="org.apache.james.services.FileSystem" version="1.0"/>
+    </dependency>
   </dependencies>
 
 </blockinfo>

Modified: james/server/trunk/src/java/org/apache/james/core/AvalonUsersStore.java
URL: http://svn.apache.org/viewvc/james/server/trunk/src/java/org/apache/james/core/AvalonUsersStore.java?view=diff&rev=453705&r1=453704&r2=453705
==============================================================================
--- james/server/trunk/src/java/org/apache/james/core/AvalonUsersStore.java (original)
+++ james/server/trunk/src/java/org/apache/james/core/AvalonUsersStore.java Fri Oct  6 10:47:43 2006
@@ -26,9 +26,6 @@
 import org.apache.avalon.framework.configuration.Configuration;
 import org.apache.avalon.framework.configuration.ConfigurationException;
 import org.apache.avalon.framework.container.ContainerUtil;
-import org.apache.avalon.framework.context.Context;
-import org.apache.avalon.framework.context.ContextException;
-import org.apache.avalon.framework.context.Contextualizable;
 import org.apache.avalon.framework.logger.AbstractLogEnabled;
 import org.apache.avalon.framework.service.ServiceException;
 import org.apache.avalon.framework.service.ServiceManager;
@@ -45,7 +42,7 @@
  */
 public class AvalonUsersStore
     extends AbstractLogEnabled
-    implements Contextualizable, Serviceable, Configurable, Initializable, UsersStore {
+    implements Serviceable, Configurable, Initializable, UsersStore {
 
     /**
      * A mapping of respository identifiers to actual repositories
@@ -54,11 +51,6 @@
     private HashMap repositories;
 
     /**
-     * The Avalon context used by the instance
-     */
-    protected Context                context;
-
-    /**
      * The Avalon configuration used by the instance
      */
     protected Configuration          configuration;
@@ -69,14 +61,6 @@
     protected ServiceManager       manager;
 
     /**
-     * @see org.apache.avalon.framework.context.Contextualizable#contextualize(Context)
-     */
-    public void contextualize(final Context context)
-            throws ContextException {
-        this.context = context;
-    }
-
-    /**
      * @see org.apache.avalon.framework.service.Serviceable#service(ServiceManager)
      */
     public void service( final ServiceManager manager )
@@ -121,7 +105,6 @@
 
             setupLogger(rep);
 
-            ContainerUtil.contextualize(rep,context);
             ContainerUtil.service(rep,manager);
 
             ContainerUtil.configure(rep,repConf);

Modified: james/server/trunk/src/java/org/apache/james/core/AvalonUsersStore.xinfo
URL: http://svn.apache.org/viewvc/james/server/trunk/src/java/org/apache/james/core/AvalonUsersStore.xinfo?view=diff&rev=453705&r1=453704&r2=453705
==============================================================================
--- james/server/trunk/src/java/org/apache/james/core/AvalonUsersStore.xinfo (original)
+++ james/server/trunk/src/java/org/apache/james/core/AvalonUsersStore.xinfo Fri Oct  6 10:47:43 2006
@@ -19,6 +19,9 @@
     <dependency>
       <service name="org.apache.avalon.cornerstone.services.datasources.DataSourceSelector" version="1.0"/>
     </dependency>
+    <dependency>
+      <service name="org.apache.james.services.FileSystem" version="1.0"/>
+    </dependency>
   </dependencies>
 
 </blockinfo>

Modified: james/server/trunk/src/java/org/apache/james/mailrepository/JDBCMailRepository.java
URL: http://svn.apache.org/viewvc/james/server/trunk/src/java/org/apache/james/mailrepository/JDBCMailRepository.java?view=diff&rev=453705&r1=453704&r2=453705
==============================================================================
--- james/server/trunk/src/java/org/apache/james/mailrepository/JDBCMailRepository.java (original)
+++ james/server/trunk/src/java/org/apache/james/mailrepository/JDBCMailRepository.java Fri Oct  6 10:47:43 2006
@@ -29,13 +29,10 @@
 import org.apache.avalon.framework.configuration.Configuration;
 import org.apache.avalon.framework.configuration.ConfigurationException;
 import org.apache.avalon.framework.configuration.DefaultConfiguration;
-import org.apache.avalon.framework.context.Context;
-import org.apache.avalon.framework.context.ContextException;
-import org.apache.avalon.framework.context.Contextualizable;
-import org.apache.james.context.AvalonContextUtilities;
 import org.apache.james.core.MailImpl;
 import org.apache.james.core.MimeMessageCopyOnWriteProxy;
 import org.apache.james.core.MimeMessageWrapper;
+import org.apache.james.services.FileSystem;
 import org.apache.james.util.JDBCUtil;
 import org.apache.james.util.SqlResources;
 import org.apache.mailet.Mail;
@@ -83,13 +80,7 @@
  * @version CVS $Revision$ $Date$
  */
 public class JDBCMailRepository
-    extends AbstractMailRepository
-    implements Contextualizable {
-
-    /**
-     * The Avalon context used by the instance
-     */
-    protected Context context;
+    extends AbstractMailRepository {
 
     /**
      * The table name parsed from the destination URL
@@ -146,19 +137,13 @@
      */
     private int inMemorySizeLimit;
 
+    private FileSystem fileSystem;
+
     public void setDatasources(DataSourceSelector datasources) {
         this.datasources = datasources;
     }
 
     /**
-     * @see org.apache.avalon.framework.context.Contextualizable#contextualize(Context)
-     */
-    public void contextualize(final Context context)
-            throws ContextException {
-        this.context = context;
-    }
-
-    /**
      * @see org.apache.avalon.framework.service.Serviceable#service(ServiceManager)
      */
     public void service( final ServiceManager componentManager )
@@ -175,6 +160,11 @@
         // Get the DataSourceSelector service
         DataSourceSelector datasources = (DataSourceSelector)componentManager.lookup( DataSourceSelector.ROLE );
         setDatasources(datasources);
+        setFileSystem((FileSystem) componentManager.lookup(FileSystem.ROLE));
+    }
+
+    private void setFileSystem(FileSystem fileSystem) {
+        this.fileSystem = fileSystem;
     }
 
     /**
@@ -317,7 +307,7 @@
 
             File sqlFile = null;
             try {
-                sqlFile = AvalonContextUtilities.getFile(context, sqlFileName);
+                sqlFile = fileSystem.getFile(sqlFileName);
                 sqlFileName = null;
             } catch (Exception e) {
                 getLogger().fatalError(e.getMessage(), e);

Modified: james/server/trunk/src/java/org/apache/james/mailrepository/filepair/AbstractFileRepository.java
URL: http://svn.apache.org/viewvc/james/server/trunk/src/java/org/apache/james/mailrepository/filepair/AbstractFileRepository.java?view=diff&rev=453705&r1=453704&r2=453705
==============================================================================
--- james/server/trunk/src/java/org/apache/james/mailrepository/filepair/AbstractFileRepository.java (original)
+++ james/server/trunk/src/java/org/apache/james/mailrepository/filepair/AbstractFileRepository.java Fri Oct  6 10:47:43 2006
@@ -26,17 +26,16 @@
 import org.apache.avalon.framework.configuration.Configurable;
 import org.apache.avalon.framework.configuration.Configuration;
 import org.apache.avalon.framework.configuration.ConfigurationException;
-import org.apache.avalon.framework.context.Context;
-import org.apache.avalon.framework.context.ContextException;
-import org.apache.avalon.framework.context.Contextualizable;
 import org.apache.avalon.framework.logger.AbstractLogEnabled;
 import org.apache.avalon.framework.service.ServiceException;
 import org.apache.avalon.framework.service.ServiceManager;
 import org.apache.avalon.framework.service.Serviceable;
+import org.apache.james.services.FileSystem;
 import org.apache.james.util.io.ExtensionFileFilter;
 
 import java.io.File;
 import java.io.FileInputStream;
+import java.io.FileNotFoundException;
 import java.io.FileOutputStream;
 import java.io.FilenameFilter;
 import java.io.IOException;
@@ -51,7 +50,7 @@
  */
 public abstract class AbstractFileRepository
     extends AbstractLogEnabled
-    implements Repository, Contextualizable, Serviceable, Configurable, Initializable
+    implements Repository, Serviceable, Configurable, Initializable
 {
     protected static final boolean DEBUG = false;
 
@@ -74,27 +73,17 @@
     protected abstract String getExtensionDecorator();
 
     /**
-     * @see org.apache.avalon.framework.context.Contextualizable#contextualize(Context)
-     */
-    public void contextualize( final Context context ) throws ContextException
-    {
-        try
-        {
-            m_baseDirectory = (File) context.get( "urn:avalon:home" );
-        }
-        catch( ContextException ce )
-        {
-            m_baseDirectory = (File) context.get( "app.home" );
-        }
-    }
-
-    /**
      * @see org.apache.avalon.framework.service.Serviceable#service(ServiceManager)
      */
     public void service( final ServiceManager serviceManager )
         throws ServiceException
     {
         m_serviceManager = serviceManager;
+        try {
+            m_baseDirectory = ((FileSystem) serviceManager.lookup(FileSystem.ROLE)).getBasedir();
+        } catch (FileNotFoundException e) {
+            throw new ServiceException(FileSystem.ROLE, "Cannot find the base directory of the application", e);
+        }
     }
 
     /**

Modified: james/server/trunk/src/java/org/apache/james/mailrepository/javamail/AbstractJavamailStoreMailRepository.java
URL: http://svn.apache.org/viewvc/james/server/trunk/src/java/org/apache/james/mailrepository/javamail/AbstractJavamailStoreMailRepository.java?view=diff&rev=453705&r1=453704&r2=453705
==============================================================================
--- james/server/trunk/src/java/org/apache/james/mailrepository/javamail/AbstractJavamailStoreMailRepository.java (original)
+++ james/server/trunk/src/java/org/apache/james/mailrepository/javamail/AbstractJavamailStoreMailRepository.java Fri Oct  6 10:47:43 2006
@@ -20,6 +20,7 @@
 package org.apache.james.mailrepository.javamail;
 
 import java.io.File;
+import java.io.FileNotFoundException;
 import java.net.MalformedURLException;
 import java.util.Collection;
 import java.util.Iterator;
@@ -37,12 +38,12 @@
 import org.apache.avalon.framework.configuration.Configurable;
 import org.apache.avalon.framework.configuration.Configuration;
 import org.apache.avalon.framework.configuration.ConfigurationException;
-import org.apache.avalon.framework.context.Context;
-import org.apache.avalon.framework.context.ContextException;
-import org.apache.avalon.framework.context.Contextualizable;
 import org.apache.avalon.framework.logger.AbstractLogEnabled;
 import org.apache.avalon.framework.logger.Logger;
-import org.apache.james.context.AvalonContextConstants;
+import org.apache.avalon.framework.service.ServiceException;
+import org.apache.avalon.framework.service.ServiceManager;
+import org.apache.avalon.framework.service.Serviceable;
+import org.apache.james.services.FileSystem;
 import org.apache.james.services.MailRepository;
 import org.apache.mailet.Mail;
 
@@ -56,7 +57,7 @@
 
 public abstract class AbstractJavamailStoreMailRepository extends
         AbstractLogEnabled implements MailRepository, StoreGateKeeperAware, FolderAdapterFactory, Configurable,
-        Initializable,Contextualizable {
+        Initializable,Serviceable {
 
     /**
      * Whether 'deep debugging' is turned on.
@@ -102,16 +103,22 @@
     private FolderGateKeeper folderGateKeeper;
 
     /**
-     * The Context
-     */
-    private Context context;
-    
-    /**
      * The directory james is running in
      */
     private File home;
 
     /**
+     * @see org.apache.avalon.framework.service.Serviceable#service(ServiceManager)
+     */
+    public void service(ServiceManager serviceManager) throws ServiceException {
+        try {
+            home = ((FileSystem) serviceManager.lookup(FileSystem.ROLE)).getBasedir();
+        } catch (FileNotFoundException e) {
+            throw new ServiceException(FileSystem.ROLE, "Cannot find the base directory of the application", e);
+        }
+    }
+
+    /**
      * builds destination from attributes destinationURL and postfix.
      * at the moment james does not hand over additional parameters like postfix.
      * 
@@ -195,14 +202,6 @@
      */
     public void initialize() throws Exception {
         log.debug("JavaMailStoreMailRepository initialized");
-    }
-    
-    /**
-     * @see org.apache.avalon.framework.context.Contextualizable#contextualize(Context)
-     */
-    public void contextualize(Context context) throws ContextException {
-        this.context = context;
-        home = (File)context.get(AvalonContextConstants.APPLICATION_HOME);
     }
     
     private String getDirAsUrl(String dir) throws MalformedURLException {

Modified: james/server/trunk/src/java/org/apache/james/management/BayesianAnalyzerManagement.java
URL: http://svn.apache.org/viewvc/james/server/trunk/src/java/org/apache/james/management/BayesianAnalyzerManagement.java?view=diff&rev=453705&r1=453704&r2=453705
==============================================================================
--- james/server/trunk/src/java/org/apache/james/management/BayesianAnalyzerManagement.java (original)
+++ james/server/trunk/src/java/org/apache/james/management/BayesianAnalyzerManagement.java Fri Oct  6 10:47:43 2006
@@ -43,14 +43,11 @@
 import org.apache.avalon.framework.configuration.Configurable;
 import org.apache.avalon.framework.configuration.Configuration;
 import org.apache.avalon.framework.configuration.ConfigurationException;
-import org.apache.avalon.framework.context.Context;
-import org.apache.avalon.framework.context.ContextException;
-import org.apache.avalon.framework.context.Contextualizable;
 import org.apache.avalon.framework.service.ServiceException;
 import org.apache.avalon.framework.service.ServiceManager;
 import org.apache.avalon.framework.service.Serviceable;
-import org.apache.james.context.AvalonContextUtilities;
 import org.apache.james.services.BayesianAnalyzerManagementService;
+import org.apache.james.services.FileSystem;
 import org.apache.james.util.JDBCBayesianAnalyzer;
 
 import com.thoughtworks.xstream.XStream;
@@ -59,15 +56,15 @@
 /**
  * Management for BayesianAnalyzer
  */
-public class BayesianAnalyzerManagement implements BayesianAnalyzerManagementService, Serviceable, Initializable, Contextualizable, Configurable, BayesianAnalyzerManagementMBean {
+public class BayesianAnalyzerManagement implements BayesianAnalyzerManagementService, Serviceable, Initializable, Configurable, BayesianAnalyzerManagementMBean {
 
     private final static String HAM = "HAM";
     private final static String SPAM = "SPAM";
     private DataSourceSelector selector;
     private DataSourceComponent component;
     private String repos;
-    private Context context;
     private String sqlFileUrl = "file://conf/sqlResources.xml";
+    private FileSystem fileSystem;
     
     /**
      * @see org.apache.avalon.framework.service.Serviceable#service(ServiceManager)
@@ -75,6 +72,16 @@
     public void service(ServiceManager arg0) throws ServiceException {
         DataSourceSelector selector = (DataSourceSelector) arg0.lookup(DataSourceSelector.ROLE);
         setDataSourceSelector(selector);
+        setFileSystem((FileSystem) arg0.lookup(FileSystem.ROLE));
+    }
+
+    /**
+     * Sets the file system service
+     * 
+     * @param system new service
+     */
+    private void setFileSystem(FileSystem system) {
+        this.fileSystem = system;
     }
 
     /**
@@ -83,16 +90,9 @@
     public void initialize() throws Exception {
         if (repos != null) {
             setDataSourceComponent((DataSourceComponent) selector.select(repos));
-            File sqlFile = AvalonContextUtilities.getFile(context, sqlFileUrl);
+            File sqlFile = fileSystem.getFile(sqlFileUrl);
             analyzer.initSqlQueries(component.getConnection(), sqlFile.getAbsolutePath());
         }
-    }
-
-    /**
-     * @see org.apache.avalon.framework.context.Contextualizable#contextualize(Context)
-     */
-    public void contextualize(Context arg0) throws ContextException {
-        this.context = arg0;
     }
 
     /**

Modified: james/server/trunk/src/java/org/apache/james/management/BayesianAnalyzerManagement.xinfo
URL: http://svn.apache.org/viewvc/james/server/trunk/src/java/org/apache/james/management/BayesianAnalyzerManagement.xinfo?view=diff&rev=453705&r1=453704&r2=453705
==============================================================================
--- james/server/trunk/src/java/org/apache/james/management/BayesianAnalyzerManagement.xinfo (original)
+++ james/server/trunk/src/java/org/apache/james/management/BayesianAnalyzerManagement.xinfo Fri Oct  6 10:47:43 2006
@@ -20,5 +20,8 @@
     <dependency>
       <service name="org.apache.avalon.cornerstone.services.datasources.DataSourceSelector" version="1.0"/>
     </dependency>
+    <dependency>
+      <service name="org.apache.james.services.FileSystem" version="1.0"/>
+    </dependency>
   </dependencies>
 </blockinfo>

Modified: james/server/trunk/src/java/org/apache/james/nntpserver/repository/NNTPRepositoryImpl.java
URL: http://svn.apache.org/viewvc/james/server/trunk/src/java/org/apache/james/nntpserver/repository/NNTPRepositoryImpl.java?view=diff&rev=453705&r1=453704&r2=453705
==============================================================================
--- james/server/trunk/src/java/org/apache/james/nntpserver/repository/NNTPRepositoryImpl.java (original)
+++ james/server/trunk/src/java/org/apache/james/nntpserver/repository/NNTPRepositoryImpl.java Fri Oct  6 10:47:43 2006
@@ -26,13 +26,13 @@
 import org.apache.avalon.framework.configuration.Configuration;
 import org.apache.avalon.framework.configuration.ConfigurationException;
 import org.apache.avalon.framework.container.ContainerUtil;
-import org.apache.avalon.framework.context.Context;
-import org.apache.avalon.framework.context.ContextException;
-import org.apache.avalon.framework.context.Contextualizable;
 import org.apache.avalon.framework.logger.AbstractLogEnabled;
-import org.apache.james.context.AvalonContextUtilities;
+import org.apache.avalon.framework.service.ServiceException;
+import org.apache.avalon.framework.service.ServiceManager;
+import org.apache.avalon.framework.service.Serviceable;
 import org.apache.james.nntpserver.DateSinceFileFilter;
 import org.apache.james.nntpserver.NNTPException;
+import org.apache.james.services.FileSystem;
 import org.apache.james.util.io.AndFileFilter;
 import org.apache.james.util.io.DirectoryFileFilter;
 import org.apache.oro.io.GlobFilenameFilter;
@@ -52,12 +52,7 @@
  * NNTP Repository implementation.
  */
 public class NNTPRepositoryImpl extends AbstractLogEnabled 
-    implements NNTPRepository, Contextualizable, Configurable, Initializable {
-
-    /**
-     * The context employed by this repository
-     */
-    private Context context;
+    implements NNTPRepository, Serviceable, Configurable, Initializable {
 
     /**
      * The configuration employed by this repository
@@ -140,12 +135,14 @@
     private HashMap repositoryGroups = new HashMap();
 
     /**
-     * @see org.apache.avalon.framework.context.Contextualizable#contextualize(Context)
+     * The service manager
      */
-    public void contextualize(Context context)
-            throws ContextException {
-        this.context = context;
-    }
+    private ServiceManager serviceManager;
+
+    /**
+     * The fileSystem service
+     */
+    private FileSystem fileSystem;
 
     /**
      * @see org.apache.avalon.framework.configuration.Configurable#configure(Configuration)
@@ -201,9 +198,9 @@
         File articleIDPath = null;
 
         try {
-            rootPath = AvalonContextUtilities.getFile(context, rootPathString);
-            tempPath = AvalonContextUtilities.getFile(context, tempPathString);
-            articleIDPath = AvalonContextUtilities.getFile(context, articleIdPathString);
+            rootPath = fileSystem.getFile(rootPathString);
+            tempPath = fileSystem.getFile(tempPathString);
+            articleIDPath = fileSystem.getFile(articleIdPathString);
         } catch (Exception e) {
             getLogger().fatalError(e.getMessage(), e);
             throw e;
@@ -291,7 +288,6 @@
                 try {
                     groupToReturn = new NNTPGroupImpl(groupFile);
                     ContainerUtil.enableLogging(groupToReturn, getLogger());
-                    ContainerUtil.contextualize(groupToReturn, context);
                     ContainerUtil.initialize(groupToReturn);
                     repositoryGroups.put(groupName, groupToReturn);
                 } catch (Exception e) {
@@ -439,6 +435,22 @@
                 }
             };
     }
+    
+    /**
+     * @see org.apache.avalon.framework.service.Serviceable#service(org.apache.avalon.framework.service.ServiceManager)
+     */
+    public void service(ServiceManager serviceManager) throws ServiceException {
+        this.serviceManager = serviceManager;
+        setFileSystem((FileSystem) serviceManager.lookup(FileSystem.ROLE));
+    }
+
+    /**
+     * Setter for the FileSystem dependency
+     * @param system filesystem service
+     */
+    private void setFileSystem(FileSystem system) {
+        this.fileSystem = system;
+    }
 
     /**
      * @see org.apache.james.nntpserver.repository.NNTPRepository#getOverviewFormat()
@@ -464,9 +476,8 @@
         }
         try {
             Object obj = Thread.currentThread().getContextClassLoader().loadClass(className).newInstance();
-            // TODO: Need to support service
             ContainerUtil.enableLogging(obj, getLogger());
-            ContainerUtil.contextualize(obj, context);
+            ContainerUtil.service(obj, serviceManager);
             ContainerUtil.configure(obj, spoolerConfiguration.getChild("configuration"));
             ContainerUtil.initialize(obj);
             return (NNTPSpooler)obj;

Modified: james/server/trunk/src/java/org/apache/james/nntpserver/repository/NNTPRepositoryImpl.xinfo
URL: http://svn.apache.org/viewvc/james/server/trunk/src/java/org/apache/james/nntpserver/repository/NNTPRepositoryImpl.xinfo?view=diff&rev=453705&r1=453704&r2=453705
==============================================================================
--- james/server/trunk/src/java/org/apache/james/nntpserver/repository/NNTPRepositoryImpl.xinfo (original)
+++ james/server/trunk/src/java/org/apache/james/nntpserver/repository/NNTPRepositoryImpl.xinfo Fri Oct  6 10:47:43 2006
@@ -11,5 +11,11 @@
   <services>
     <service name="org.apache.james.nntpserver.repository.NNTPRepository" version="1.0"/>
   </services>
+  
+  <dependencies>
+    <dependency>
+      <service name="org.apache.james.services.FileSystem" version="1.0"/>
+    </dependency>
+  </dependencies>
 
 </blockinfo>

Modified: james/server/trunk/src/java/org/apache/james/nntpserver/repository/NNTPSpooler.java
URL: http://svn.apache.org/viewvc/james/server/trunk/src/java/org/apache/james/nntpserver/repository/NNTPSpooler.java?view=diff&rev=453705&r1=453704&r2=453705
==============================================================================
--- james/server/trunk/src/java/org/apache/james/nntpserver/repository/NNTPSpooler.java (original)
+++ james/server/trunk/src/java/org/apache/james/nntpserver/repository/NNTPSpooler.java Fri Oct  6 10:47:43 2006
@@ -26,11 +26,11 @@
 import org.apache.avalon.framework.configuration.Configuration;
 import org.apache.avalon.framework.configuration.ConfigurationException;
 import org.apache.avalon.framework.container.ContainerUtil;
-import org.apache.avalon.framework.context.Context;
-import org.apache.avalon.framework.context.ContextException;
-import org.apache.avalon.framework.context.Contextualizable;
 import org.apache.avalon.framework.logger.AbstractLogEnabled;
-import org.apache.james.context.AvalonContextUtilities;
+import org.apache.avalon.framework.service.ServiceException;
+import org.apache.avalon.framework.service.ServiceManager;
+import org.apache.avalon.framework.service.Serviceable;
+import org.apache.james.services.FileSystem;
 import org.apache.james.util.Lock;
 import org.apache.james.util.io.IOUtil;
 
@@ -50,12 +50,7 @@
  *
  */
 class NNTPSpooler extends AbstractLogEnabled
-        implements Contextualizable, Configurable, Initializable {
-
-    /**
-     * The spooler context
-     */
-    private Context context;
+        implements Serviceable, Configurable, Initializable {
 
     /**
      * The array of spooler runnables, each associated with a Worker thread
@@ -78,11 +73,16 @@
     private int threadIdleTime = 0;
 
     /**
-     * @see org.apache.avalon.framework.context.Contextualizable#contextualize(Context)
+     * The filesystem service
+     */
+    private FileSystem fileSystem;
+
+    /**
+     * @see org.apache.avalon.framework.service.Serviceable#service(org.apache.avalon.framework.service.ServiceManager)
      */
-    public void contextualize(final Context context)
-            throws ContextException {
-        this.context = context;
+    public void service(final ServiceManager serviceManager)
+            throws ServiceException {
+        setFileSystem((FileSystem) serviceManager.lookup(FileSystem.ROLE));
     }
 
     /**
@@ -102,7 +102,7 @@
         //System.out.println(getClass().getName()+": init");
 
         try {
-            spoolPath = AvalonContextUtilities.getFile(context, spoolPathString);
+            spoolPath = fileSystem.getFile(spoolPathString);
             if ( spoolPath.exists() == false ) {
                 spoolPath.mkdirs();
             } else if (!(spoolPath.isDirectory())) {
@@ -219,7 +219,7 @@
         public void run() {
             getLogger().debug(Thread.currentThread().getName() + " is the NNTP spooler thread.");
             try {
-                while ( Thread.currentThread().interrupted() == false ) {
+                while ( Thread.interrupted() == false ) {
                     String[] list = spoolPath.list();
                     if (list.length > 0) getLogger().debug("Files to process: "+list.length);
                     for ( int i = 0 ; i < list.length ; i++ ) {
@@ -240,13 +240,13 @@
                     list = null; // release the array;
                     // this is good for other non idle threads
                     try {
-                        Thread.currentThread().sleep(threadIdleTime);
+                        Thread.sleep(threadIdleTime);
                     } catch(InterruptedException ex) {
                         // Ignore and continue
                     }
                 }
             } finally {
-                Thread.currentThread().interrupted();
+                Thread.interrupted();
             }
         }
 
@@ -343,4 +343,13 @@
             }
         }
     } // class SpoolerRunnable
+
+    /**
+     * Setter for the fileSystem service
+     * 
+     * @param fileSystem fs
+     */
+    public void setFileSystem(FileSystem fileSystem) {
+        this.fileSystem = fileSystem;
+    }
 }

Modified: james/server/trunk/src/java/org/apache/james/remotemanager/RemoteManager.java
URL: http://svn.apache.org/viewvc/james/server/trunk/src/java/org/apache/james/remotemanager/RemoteManager.java?view=diff&rev=453705&r1=453704&r2=453705
==============================================================================
--- james/server/trunk/src/java/org/apache/james/remotemanager/RemoteManager.java (original)
+++ james/server/trunk/src/java/org/apache/james/remotemanager/RemoteManager.java Fri Oct  6 10:47:43 2006
@@ -24,7 +24,6 @@
 import org.apache.avalon.cornerstone.services.store.Store;
 import org.apache.avalon.framework.configuration.Configuration;
 import org.apache.avalon.framework.configuration.ConfigurationException;
-import org.apache.avalon.framework.context.Contextualizable;
 import org.apache.avalon.framework.service.ServiceException;
 import org.apache.avalon.framework.service.ServiceManager;
 import org.apache.james.core.AbstractJamesService;
@@ -45,7 +44,7 @@
  * @version 1.0.0, 24/04/1999
  */
 public class RemoteManager
-    extends AbstractJamesService implements RemoteManagerMBean, Contextualizable {
+    extends AbstractJamesService implements RemoteManagerMBean {
 
     /**
      * A HashMap of (user id, passwords) for James administrators

Added: james/server/trunk/src/java/org/apache/james/services/FileSystem.java
URL: http://svn.apache.org/viewvc/james/server/trunk/src/java/org/apache/james/services/FileSystem.java?view=auto&rev=453705
==============================================================================
--- james/server/trunk/src/java/org/apache/james/services/FileSystem.java (added)
+++ james/server/trunk/src/java/org/apache/james/services/FileSystem.java Fri Oct  6 10:47:43 2006
@@ -0,0 +1,49 @@
+/****************************************************************
+ * 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.services;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+
+/**
+ * This service is used by components that wants to lookup a File resource
+ * from the application folder.
+ * 
+ * @since James 2.4
+ */
+public interface FileSystem {
+
+    String ROLE = "org.apache.james.services.FileSystem";
+
+    /**
+     * Used to retrieve a specific file in the application context 
+     * 
+     * @param fileURL file
+     * @return the File found
+     * @throws FileNotFoundException if the file cannot be found/read
+     */
+    public File getFile(String fileURL) throws FileNotFoundException;
+
+    /**
+     * Return the base folder used by the application 
+     */
+    public File getBasedir() throws FileNotFoundException;
+
+}

Propchange: james/server/trunk/src/java/org/apache/james/services/FileSystem.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: james/server/trunk/src/java/org/apache/james/smtpserver/SMTPHandlerChain.java
URL: http://svn.apache.org/viewvc/james/server/trunk/src/java/org/apache/james/smtpserver/SMTPHandlerChain.java?view=diff&rev=453705&r1=453704&r2=453705
==============================================================================
--- james/server/trunk/src/java/org/apache/james/smtpserver/SMTPHandlerChain.java (original)
+++ james/server/trunk/src/java/org/apache/james/smtpserver/SMTPHandlerChain.java Fri Oct  6 10:47:43 2006
@@ -27,9 +27,6 @@
 import org.apache.avalon.framework.configuration.ConfigurationException;
 import org.apache.avalon.framework.configuration.DefaultConfiguration;
 import org.apache.avalon.framework.container.ContainerUtil;
-import org.apache.avalon.framework.context.Context;
-import org.apache.avalon.framework.context.ContextException;
-import org.apache.avalon.framework.context.Contextualizable;
 import org.apache.avalon.framework.logger.AbstractLogEnabled;
 import org.apache.avalon.framework.service.ServiceException;
 import org.apache.avalon.framework.service.ServiceManager;
@@ -53,7 +50,7 @@
   * The SMTPHandlerChain is per service object providing access
   * ConnectHandlers, Commandhandlers and message handlers
   */
-public class SMTPHandlerChain extends AbstractLogEnabled implements Configurable, Serviceable, Contextualizable, Initializable {
+public class SMTPHandlerChain extends AbstractLogEnabled implements Configurable, Serviceable, Initializable {
 
     private HashMap commandHandlerMap = new HashMap();
     private ArrayList messageHandlers = new ArrayList();
@@ -61,19 +58,12 @@
 
     private final CommandHandler unknownHandler = new UnknownCmdHandler();
     private ServiceManager serviceManager;
-    private Context context;
     
     private final static String[] mandatoryCommands = { "MAIL" , "RCPT", "DATA"};
 
     public void service(ServiceManager arg0) throws ServiceException {
         serviceManager = arg0;
     }
-    
-    public void contextualize(Context arg0) throws ContextException {
-        context = arg0;
-    }
-
-
 
     /**
      * loads the various handlers from the configuration
@@ -210,8 +200,6 @@
             // enable logging
             ContainerUtil.enableLogging(handler, getLogger());
 
-            ContainerUtil.contextualize(handler, context);
-
             // servicing the handler
             ContainerUtil.service(handler, serviceManager);
 
@@ -304,13 +292,6 @@
             throw new ConfigurationException("Failed to add Commandhandler: "
                     + className, ex);
         } catch (ServiceException e) {
-            if (getLogger().isErrorEnabled()) {
-                getLogger().error(
-                        "Failed to service Commandhandler: " + className, e);
-            }
-            throw new ConfigurationException("Failed to add Commandhandler: "
-                    + className, e);
-        } catch (ContextException e) {
             if (getLogger().isErrorEnabled()) {
                 getLogger().error(
                         "Failed to service Commandhandler: " + className, e);

Modified: james/server/trunk/src/java/org/apache/james/smtpserver/SMTPServer.java
URL: http://svn.apache.org/viewvc/james/server/trunk/src/java/org/apache/james/smtpserver/SMTPServer.java?view=diff&rev=453705&r1=453704&r2=453705
==============================================================================
--- james/server/trunk/src/java/org/apache/james/smtpserver/SMTPServer.java (original)
+++ james/server/trunk/src/java/org/apache/james/smtpserver/SMTPServer.java Fri Oct  6 10:47:43 2006
@@ -24,9 +24,6 @@
 import org.apache.avalon.framework.configuration.Configuration;
 import org.apache.avalon.framework.configuration.ConfigurationException;
 import org.apache.avalon.framework.container.ContainerUtil;
-import org.apache.avalon.framework.context.Context;
-import org.apache.avalon.framework.context.ContextException;
-import org.apache.avalon.framework.context.Contextualizable;
 import org.apache.avalon.framework.service.ServiceException;
 import org.apache.avalon.framework.service.ServiceManager;
 import org.apache.james.Constants;
@@ -48,7 +45,7 @@
  * IMPORTANT: SMTPServer extends AbstractJamesService.  If you implement ANY
  * lifecycle methods, you MUST call super.<method> as well.
  */
-public class SMTPServer extends AbstractJamesService implements SMTPServerMBean, Contextualizable {
+public class SMTPServer extends AbstractJamesService implements SMTPServerMBean {
 
 
     /**
@@ -251,23 +248,6 @@
     public void initialize() throws Exception {
         super.initialize();
         ContainerUtil.initialize(handlerChain);
-    }
-
-    /**
-     * @see org.apache.avalon.cornerstone.services.connection.AbstractHandlerFactory#contextualize(org.apache.avalon.framework.context.Context)
-     */
-    public void contextualize(final Context context) {
-        super.contextualize(context);
-        try {
-            ContainerUtil.contextualize(handlerChain, context);
-        } catch (ContextException e) {
-
-            // This is just a hack.. the overridden contextualize method not
-            // support
-            // of throw an exception. But we need it
-            throw new IllegalStateException(e.getMessage());
-        }
-
     }
 
     /**

Modified: james/server/trunk/src/java/org/apache/james/smtpserver/SMTPServer.xinfo
URL: http://svn.apache.org/viewvc/james/server/trunk/src/java/org/apache/james/smtpserver/SMTPServer.xinfo?view=diff&rev=453705&r1=453704&r2=453705
==============================================================================
--- james/server/trunk/src/java/org/apache/james/smtpserver/SMTPServer.xinfo (original)
+++ james/server/trunk/src/java/org/apache/james/smtpserver/SMTPServer.xinfo Fri Oct  6 10:47:43 2006
@@ -37,5 +37,8 @@
     <dependency>
       <service name="org.apache.avalon.cornerstone.services.datasources.DataSourceSelector" version="1.0"/>
     </dependency>
+    <dependency>
+      <service name="org.apache.james.services.FileSystem" version="1.0"/>
+    </dependency>
   </dependencies>
 </blockinfo>

Modified: james/server/trunk/src/java/org/apache/james/smtpserver/core/filter/fastfail/GreylistHandler.java
URL: http://svn.apache.org/viewvc/james/server/trunk/src/java/org/apache/james/smtpserver/core/filter/fastfail/GreylistHandler.java?view=diff&rev=453705&r1=453704&r2=453705
==============================================================================
--- james/server/trunk/src/java/org/apache/james/smtpserver/core/filter/fastfail/GreylistHandler.java (original)
+++ james/server/trunk/src/java/org/apache/james/smtpserver/core/filter/fastfail/GreylistHandler.java Fri Oct  6 10:47:43 2006
@@ -39,16 +39,13 @@
 import org.apache.avalon.framework.configuration.Configurable;
 import org.apache.avalon.framework.configuration.Configuration;
 import org.apache.avalon.framework.configuration.ConfigurationException;
-import org.apache.avalon.framework.context.Context;
-import org.apache.avalon.framework.context.ContextException;
-import org.apache.avalon.framework.context.Contextualizable;
 import org.apache.avalon.framework.logger.AbstractLogEnabled;
 import org.apache.avalon.framework.service.ServiceException;
 import org.apache.avalon.framework.service.ServiceManager;
 import org.apache.avalon.framework.service.Serviceable;
 
-import org.apache.james.context.AvalonContextUtilities;
 import org.apache.james.services.DNSServer;
+import org.apache.james.services.FileSystem;
 import org.apache.james.smtpserver.CommandHandler;
 import org.apache.james.smtpserver.SMTPSession;
 import org.apache.james.util.JDBCUtil;
@@ -62,13 +59,14 @@
  * GreylistHandler which can be used to activate Greylisting
  */
 public class GreylistHandler extends AbstractLogEnabled implements
-    CommandHandler, Configurable, Serviceable, Contextualizable,
-    Initializable {
+    CommandHandler, Configurable, Serviceable, Initializable {
 
     private DataSourceSelector datasources = null;
 
     private DataSourceComponent datasource = null;
 
+    private FileSystem fileSystem = null;
+
     // 1 hour
     private long tempBlockTime = 3600000;
 
@@ -112,8 +110,6 @@
 
     private NetMatcher wNetworks;
 
-    private Context context;
-
     /**
      * @see org.apache.avalon.framework.configuration.Configurable#configure(Configuration)
      */
@@ -193,13 +189,7 @@
     public void service(ServiceManager serviceMan) throws ServiceException {
         setDataSources((DataSourceSelector) serviceMan.lookup(DataSourceSelector.ROLE));
         setDnsServer((DNSServer) serviceMan.lookup(DNSServer.ROLE));
-    }
-
-    /**
-     * @see org.apache.avalon.framework.context.Contextualizable#contextualize(Context)
-     */
-    public void contextualize(final Context context) throws ContextException {
-        this.context = context;
+        setFileSystem((FileSystem) serviceMan.lookup(FileSystem.ROLE));
     }
 
     /**
@@ -243,6 +233,16 @@
     }
 
     /**
+     * Sets the filesystem service
+     * 
+     * @param system The filesystem service
+     */
+    private void setFileSystem(FileSystem system) {
+        this.fileSystem = system;
+    }
+
+
+    /**
      * Set the datasource
      * 
      * @param datasource
@@ -599,7 +599,7 @@
             File sqlFile = null;
     
             try {
-                sqlFile = AvalonContextUtilities.getFile(context, sqlFileUrl);
+                sqlFile = fileSystem.getFile(sqlFileUrl);
                 sqlFileUrl = null;
             } catch (Exception e) {
                 getLogger().fatalError(e.getMessage(), e);

Modified: james/server/trunk/src/java/org/apache/james/transport/JamesMailetLoader.xinfo
URL: http://svn.apache.org/viewvc/james/server/trunk/src/java/org/apache/james/transport/JamesMailetLoader.xinfo?view=diff&rev=453705&r1=453704&r2=453705
==============================================================================
--- james/server/trunk/src/java/org/apache/james/transport/JamesMailetLoader.xinfo (original)
+++ james/server/trunk/src/java/org/apache/james/transport/JamesMailetLoader.xinfo Fri Oct  6 10:47:43 2006
@@ -16,6 +16,9 @@
     <dependency>
       <service name="org.apache.mailet.MailetContext" version="1.0"/>
     </dependency>
+    <dependency>
+      <service name="org.apache.james.services.FileSystem" version="1.0"/>
+    </dependency>
   </dependencies>  
 
 </blockinfo>

Modified: james/server/trunk/src/java/org/apache/james/transport/JamesMatcherLoader.xinfo
URL: http://svn.apache.org/viewvc/james/server/trunk/src/java/org/apache/james/transport/JamesMatcherLoader.xinfo?view=diff&rev=453705&r1=453704&r2=453705
==============================================================================
--- james/server/trunk/src/java/org/apache/james/transport/JamesMatcherLoader.xinfo (original)
+++ james/server/trunk/src/java/org/apache/james/transport/JamesMatcherLoader.xinfo Fri Oct  6 10:47:43 2006
@@ -16,6 +16,9 @@
     <dependency>
       <service name="org.apache.mailet.MailetContext" version="1.0"/>
     </dependency>
+    <dependency>
+      <service name="org.apache.james.services.FileSystem" version="1.0"/>
+    </dependency>
   </dependencies>  
 
 </blockinfo>

Modified: james/server/trunk/src/java/org/apache/james/transport/Loader.java
URL: http://svn.apache.org/viewvc/james/server/trunk/src/java/org/apache/james/transport/Loader.java?view=diff&rev=453705&r1=453704&r2=453705
==============================================================================
--- james/server/trunk/src/java/org/apache/james/transport/Loader.java (original)
+++ james/server/trunk/src/java/org/apache/james/transport/Loader.java Fri Oct  6 10:47:43 2006
@@ -19,7 +19,8 @@
 
 
 package org.apache.james.transport;
-import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
 import java.util.Collection;
 import java.util.Iterator;
 import java.util.Vector;
@@ -28,15 +29,13 @@
 import org.apache.avalon.framework.configuration.Configurable;
 import org.apache.avalon.framework.configuration.Configuration;
 import org.apache.avalon.framework.configuration.ConfigurationException;
-import org.apache.avalon.framework.context.Context;
-import org.apache.avalon.framework.context.ContextException;
-import org.apache.avalon.framework.context.Contextualizable;
 import org.apache.avalon.framework.logger.AbstractLogEnabled;
 import org.apache.avalon.framework.logger.Logger;
 import org.apache.avalon.framework.service.DefaultServiceManager;
 import org.apache.avalon.framework.service.ServiceException;
 import org.apache.avalon.framework.service.ServiceManager;
 import org.apache.avalon.framework.service.Serviceable;
+import org.apache.james.services.FileSystem;
 import org.apache.mailet.Mail;
 import org.apache.mailet.MailAddress;
 import org.apache.mailet.MailetContext;
@@ -48,7 +47,7 @@
  *
  * $Id$
  */
-public abstract class Loader extends AbstractLogEnabled implements Contextualizable, Serviceable, Configurable, Initializable {
+public abstract class Loader extends AbstractLogEnabled implements Serviceable, Configurable, Initializable {
 
     protected String baseDirectory = null;
     protected final String MAILET_PACKAGE = "mailetpackage";
@@ -77,22 +76,6 @@
         this.mailetContext = mailetContext;
     }
 
-    /**
-     * @see org.apache.avalon.framework.context.Contextualizable#contextualize(Context)
-     */
-    public void contextualize(final Context context) throws ContextException 
-    {
-        try 
-        {
-            baseDirectory = ((File)context.get( "app.home") ).getCanonicalPath();
-        } 
-        catch (Throwable e) 
-        {
-            getLogger().error( "can't get base directory for mailet loader" );
-            throw new ContextException("can't contextualise mailet loader " + e.getMessage(), e);
-        }
-    }
-
     protected void getPackages(Configuration conf, String packageType)
         throws ConfigurationException {
         packages = new Vector();
@@ -113,6 +96,13 @@
      */
     public void service(ServiceManager sm) throws ServiceException {
         serviceManager = new DefaultServiceManager(sm);
+        try {
+            baseDirectory = ((FileSystem) serviceManager.lookup(FileSystem.ROLE)).getBasedir().getCanonicalPath();
+        } catch (FileNotFoundException e) {
+            throw new ServiceException(FileSystem.ROLE, "Cannot find the base directory of the application", e);
+        } catch (IOException e) {
+            throw new ServiceException(FileSystem.ROLE, "Cannot find the base directory of the application", e);
+        }
     }
 
     /**

Modified: james/server/trunk/src/java/org/apache/james/userrepository/AbstractJdbcUsersRepository.java
URL: http://svn.apache.org/viewvc/james/server/trunk/src/java/org/apache/james/userrepository/AbstractJdbcUsersRepository.java?view=diff&rev=453705&r1=453704&r2=453705
==============================================================================
--- james/server/trunk/src/java/org/apache/james/userrepository/AbstractJdbcUsersRepository.java (original)
+++ james/server/trunk/src/java/org/apache/james/userrepository/AbstractJdbcUsersRepository.java Fri Oct  6 10:47:43 2006
@@ -42,15 +42,12 @@
 import org.apache.avalon.framework.configuration.Configurable;
 import org.apache.avalon.framework.configuration.Configuration;
 import org.apache.avalon.framework.configuration.ConfigurationException;
-import org.apache.avalon.framework.context.Context;
-import org.apache.avalon.framework.context.ContextException;
-import org.apache.avalon.framework.context.Contextualizable;
 import org.apache.avalon.framework.service.Serviceable;
 import org.apache.avalon.framework.service.ServiceManager;
 import org.apache.avalon.framework.service.ServiceException;
-import org.apache.james.context.AvalonContextUtilities;
 import org.apache.james.util.JDBCUtil;
 import org.apache.james.util.SqlResources;
+import org.apache.james.services.FileSystem;
 import org.apache.james.services.User;
 
 /**
@@ -76,12 +73,8 @@
  *
  */
 public abstract class AbstractJdbcUsersRepository extends AbstractUsersRepository
-    implements Contextualizable, Serviceable, Configurable, Initializable
+    implements Serviceable, Configurable, Initializable
 {
-    /**
-     * The Avalon context used by the instance
-     */
-    protected Context context;
 
     protected Map m_sqlParameters;
 
@@ -108,6 +101,8 @@
     // The JDBCUtil helper class
     private JDBCUtil theJDBCUtil;
 
+    private FileSystem fileSystem;
+
     /**
      * Set the DataSourceSelector
      * @param datasources the DataSourceSelector
@@ -117,14 +112,6 @@
     }
 
     /**
-     * @see org.apache.avalon.framework.context.Contextualizable#contextualize(Context)
-     */
-    public void contextualize(final Context context)
-            throws ContextException {
-        this.context = context;
-    }
-
-    /**
      * @see org.apache.avalon.framework.service.Serviceable#service(ServiceManager) 
      */
     public void service( final ServiceManager componentManager )
@@ -141,6 +128,16 @@
         }
 
         setDatasources((DataSourceSelector)componentManager.lookup( DataSourceSelector.ROLE ));
+        setFileSystem((FileSystem) componentManager.lookup(FileSystem.ROLE));
+    }
+
+    /**
+     * Sets the filesystem service
+     * 
+     * @param system the new service
+     */
+    private void setFileSystem(FileSystem system) {
+        this.fileSystem = system;
     }
 
     /**
@@ -276,7 +273,7 @@
             File sqlFile = null;
 
             try {
-                sqlFile = AvalonContextUtilities.getFile(context, m_sqlFileName);
+                sqlFile = fileSystem.getFile(m_sqlFileName);
             } catch (Exception e) {
                 getLogger().fatalError(e.getMessage(), e);
                 throw e;

Modified: james/server/trunk/src/test/org/apache/james/JamesTest.java
URL: http://svn.apache.org/viewvc/james/server/trunk/src/test/org/apache/james/JamesTest.java?view=diff&rev=453705&r1=453704&r2=453705
==============================================================================
--- james/server/trunk/src/test/org/apache/james/JamesTest.java (original)
+++ james/server/trunk/src/test/org/apache/james/JamesTest.java Fri Oct  6 10:47:43 2006
@@ -23,8 +23,10 @@
 
 import org.apache.avalon.cornerstone.services.store.Store;
 import org.apache.avalon.framework.container.ContainerUtil;
+import org.apache.avalon.framework.service.ServiceException;
 import org.apache.james.services.AbstractDNSServer;
 import org.apache.james.services.DNSServer;
+import org.apache.james.services.FileSystem;
 import org.apache.james.services.MailServer;
 import org.apache.james.services.MailServerTestAllImplementations;
 import org.apache.james.services.UsersRepository;
@@ -38,6 +40,7 @@
 import org.apache.james.userrepository.MockUsersRepository;
 
 import java.io.File;
+import java.io.FileNotFoundException;
 import java.net.InetAddress;
 
 public class JamesTest extends MailServerTestAllImplementations {
@@ -45,7 +48,7 @@
     private File tempContextFile = null;
     private InMemorySpoolRepository mockMailRepository;
 
-    public MailServer createMailServer() {
+    public MailServer createMailServer() throws ServiceException {
         James james = new James();
         james.service(setUpServiceManager());
         MockLogger mockLogger = new MockLogger();
@@ -84,6 +87,17 @@
         MockUsersRepository mockUsersRepository = new MockUsersRepository();
         serviceManager.put(UsersRepository.ROLE, mockUsersRepository);
         serviceManager.put(UsersStore.ROLE, new MockUsersStore(mockUsersRepository));
+        serviceManager.put(FileSystem.ROLE, new FileSystem() {
+
+            public File getBasedir() throws FileNotFoundException {
+                return new File(".");
+            }
+
+            public File getFile(String fileURL) throws FileNotFoundException {
+                return new File("./conf/");
+            }
+            
+        });
         MockStore mockStore = new MockStore();
         mockMailRepository = new InMemorySpoolRepository();
         mockStore.add(EXISTING_USER_NAME, mockMailRepository);

Modified: james/server/trunk/src/test/org/apache/james/mailrepository/AvalonMailRepositoryTest.java
URL: http://svn.apache.org/viewvc/james/server/trunk/src/test/org/apache/james/mailrepository/AvalonMailRepositoryTest.java?view=diff&rev=453705&r1=453704&r2=453705
==============================================================================
--- james/server/trunk/src/test/org/apache/james/mailrepository/AvalonMailRepositoryTest.java (original)
+++ james/server/trunk/src/test/org/apache/james/mailrepository/AvalonMailRepositoryTest.java Fri Oct  6 10:47:43 2006
@@ -22,12 +22,13 @@
 
 import org.apache.avalon.framework.configuration.DefaultConfiguration;
 import org.apache.avalon.framework.container.ContainerUtil;
+import org.apache.avalon.framework.service.DefaultServiceManager;
 import org.apache.james.core.MailImpl;
 import org.apache.james.core.MimeMessageCopyOnWriteProxy;
 import org.apache.james.core.MimeMessageInputStreamSource;
 import org.apache.james.mailrepository.filepair.File_Persistent_Object_Repository;
 import org.apache.james.mailrepository.filepair.File_Persistent_Stream_Repository;
-import org.apache.james.test.mock.avalon.MockContext;
+import org.apache.james.services.FileSystem;
 import org.apache.james.test.mock.avalon.MockLogger;
 import org.apache.james.test.mock.avalon.MockStore;
 import org.apache.mailet.Mail;
@@ -38,6 +39,7 @@
 import javax.mail.util.SharedByteArrayInputStream;
 
 import java.io.File;
+import java.io.FileNotFoundException;
 import java.util.ArrayList;
 import java.util.Collection;
 
@@ -54,11 +56,22 @@
      * http://issues.apache.org/jira/browse/JAMES-559
      */
     public void testJames559() throws Exception {
+        DefaultServiceManager serviceManager = new DefaultServiceManager();
+        serviceManager.put(FileSystem.ROLE, new FileSystem() {
+
+            public File getBasedir() throws FileNotFoundException {
+                return new File(".");
+            }
+
+            public File getFile(String fileURL) throws FileNotFoundException {
+                throw new UnsupportedOperationException();
+            }
+            
+        });
         AvalonMailRepository mr = new AvalonMailRepository();
         MockStore mockStore = new MockStore();
         File_Persistent_Stream_Repository file_Persistent_Stream_Repository = new File_Persistent_Stream_Repository();
-        MockContext mockContext = new MockContext(new File("."));
-        file_Persistent_Stream_Repository.contextualize(mockContext);
+        file_Persistent_Stream_Repository.service(serviceManager);
         file_Persistent_Stream_Repository.enableLogging(new MockLogger());
         DefaultConfiguration defaultConfiguration2 = new DefaultConfiguration("conf");
         defaultConfiguration2.setAttribute("destinationURL", "file://var/mr");
@@ -66,7 +79,7 @@
         file_Persistent_Stream_Repository.initialize();
         mockStore.add("STREAM.mr", file_Persistent_Stream_Repository);
         File_Persistent_Object_Repository file_Persistent_Object_Repository = new File_Persistent_Object_Repository();
-        file_Persistent_Object_Repository.contextualize(mockContext);
+        file_Persistent_Object_Repository.service(serviceManager);
         file_Persistent_Object_Repository.enableLogging(new MockLogger());
         DefaultConfiguration defaultConfiguration22 = new DefaultConfiguration("conf");
         defaultConfiguration22.setAttribute("destinationURL", "file://var/mr");
@@ -120,11 +133,22 @@
      * http://issues.apache.org/jira/browse/JAMES-559
      */
     public void testJames559WithoutSaveChanges() throws Exception {
+        DefaultServiceManager serviceManager = new DefaultServiceManager();
+        serviceManager.put(FileSystem.ROLE, new FileSystem() {
+
+            public File getBasedir() throws FileNotFoundException {
+                return new File(".");
+            }
+
+            public File getFile(String fileURL) throws FileNotFoundException {
+                throw new UnsupportedOperationException();
+            }
+            
+        });
         AvalonMailRepository mr = new AvalonMailRepository();
         MockStore mockStore = new MockStore();
         File_Persistent_Stream_Repository file_Persistent_Stream_Repository = new File_Persistent_Stream_Repository();
-        MockContext mockContext = new MockContext(new File("."));
-        file_Persistent_Stream_Repository.contextualize(mockContext);
+        file_Persistent_Stream_Repository.service(serviceManager);
         file_Persistent_Stream_Repository.enableLogging(new MockLogger());
         DefaultConfiguration defaultConfiguration2 = new DefaultConfiguration("conf");
         defaultConfiguration2.setAttribute("destinationURL", "file://var/mr");
@@ -132,7 +156,7 @@
         file_Persistent_Stream_Repository.initialize();
         mockStore.add("STREAM.mr", file_Persistent_Stream_Repository);
         File_Persistent_Object_Repository file_Persistent_Object_Repository = new File_Persistent_Object_Repository();
-        file_Persistent_Object_Repository.contextualize(mockContext);
+        file_Persistent_Object_Repository.service(serviceManager);
         file_Persistent_Object_Repository.enableLogging(new MockLogger());
         DefaultConfiguration defaultConfiguration22 = new DefaultConfiguration("conf");
         defaultConfiguration22.setAttribute("destinationURL", "file://var/mr");

Modified: james/server/trunk/src/test/org/apache/james/services/MailServerTestAllImplementations.java
URL: http://svn.apache.org/viewvc/james/server/trunk/src/test/org/apache/james/services/MailServerTestAllImplementations.java?view=diff&rev=453705&r1=453704&r2=453705
==============================================================================
--- james/server/trunk/src/test/org/apache/james/services/MailServerTestAllImplementations.java (original)
+++ james/server/trunk/src/test/org/apache/james/services/MailServerTestAllImplementations.java Fri Oct  6 10:47:43 2006
@@ -21,6 +21,8 @@
 
 package org.apache.james.services;
 
+import org.apache.avalon.framework.service.ServiceException;
+
 import junit.framework.TestCase;
 
 /**
@@ -30,7 +32,7 @@
     
     protected static final String EXISTING_USER_NAME = "testExistingUserName";
 
-    abstract public MailServer createMailServer();
+    abstract public MailServer createMailServer() throws ServiceException;
     abstract public boolean allowsPasswordlessUser();
 
     /**
@@ -41,7 +43,7 @@
     abstract public boolean canTestUserExists();
     abstract public boolean isUserExisting(MailServer mailServerImpl, String username);
     
-    public void testId() {
+    public void testId() throws ServiceException {
         MailServer mailServer = createMailServer();
         
         String id = mailServer.getId();
@@ -49,7 +51,7 @@
         assertFalse("mail id not empty", "".equals(id));
     }
     
-    public void testIdIncrement() {
+    public void testIdIncrement() throws ServiceException {
         MailServer mailServer = createMailServer();
         
         String id1 = mailServer.getId();
@@ -57,7 +59,7 @@
         assertFalse("next id is different", id1.equals(id2));
     }
     
-    public void testAddUser() {
+    public void testAddUser() throws ServiceException {
         
         // addUser acts on field localUsers for class org.apache.james.James 
         // thus, it is unrelated to getUserInbox() for the only known implementation of MailServer
@@ -97,7 +99,7 @@
         
     }
 
-    public void testGetNonexistingUserInbox() {
+    public void testGetNonexistingUserInbox() throws ServiceException {
 
         MailServer mailServer = createMailServer();
 
@@ -108,7 +110,7 @@
         assertEquals("test user does not exist", null, userInbox);
     }
     
-    public void testGetExisitingUserInbox() {
+    public void testGetExisitingUserInbox() throws ServiceException {
         MailServer mailServer = createMailServer();
 
         MailRepository userInbox = mailServer.getUserInbox(EXISTING_USER_NAME);



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