james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nor...@apache.org
Subject svn commit: r1006120 - /james/server/trunk/mail-library/src/main/java/org/apache/james/mailstore/JamesMailStore.java
Date Sat, 09 Oct 2010 09:12:41 GMT
Author: norman
Date: Sat Oct  9 09:12:41 2010
New Revision: 1006120

URL: http://svn.apache.org/viewvc?rev=1006120&view=rev
Log:
cleanup

Modified:
    james/server/trunk/mail-library/src/main/java/org/apache/james/mailstore/JamesMailStore.java

Modified: james/server/trunk/mail-library/src/main/java/org/apache/james/mailstore/JamesMailStore.java
URL: http://svn.apache.org/viewvc/james/server/trunk/mail-library/src/main/java/org/apache/james/mailstore/JamesMailStore.java?rev=1006120&r1=1006119&r2=1006120&view=diff
==============================================================================
--- james/server/trunk/mail-library/src/main/java/org/apache/james/mailstore/JamesMailStore.java
(original)
+++ james/server/trunk/mail-library/src/main/java/org/apache/james/mailstore/JamesMailStore.java
Sat Oct  9 09:12:41 2010
@@ -35,6 +35,7 @@ import org.apache.commons.configuration.
 import org.apache.commons.logging.Log;
 import org.apache.james.lifecycle.Configurable;
 import org.apache.james.lifecycle.LogEnabled;
+import org.apache.james.mailrepository.MailRepository;
 import org.apache.james.mailstore.MailStore;
 import org.apache.james.services.InstanceFactory;
 
@@ -45,16 +46,9 @@ import org.apache.james.services.Instanc
  */
 public class JamesMailStore implements MailStore, LogEnabled, Configurable {
 
-    // Prefix for repository names
-    private static final String REPOSITORY_NAME = "Repository";
-
-    // Static variable used to name individual repositories.  Should only
-    // be accessed when a lock on the AvalonMailStore.class is held
-    private static long id;
 
     // map of [destinationURL + type]->Repository
-    @SuppressWarnings("unchecked")
-    private Map repositories;
+    private Map<String, MailRepository> repositories;
 
     // map of [protocol(destinationURL) + type ]->classname of repository;
     private Map<String,String> classes;
@@ -71,9 +65,6 @@ public class JamesMailStore implements M
 
     private InstanceFactory factory;
 
-	//private LoaderService loader;
-
-
     public void setLog(Log logger) {
         this.logger = logger;
     }
@@ -191,7 +182,6 @@ public class JamesMailStore implements M
      *                            Configuration or retrieving the 
      *                            MailRepository
      */
-    @SuppressWarnings("unchecked")
     public synchronized Object select(HierarchicalConfiguration repConf) throws StoreException
{
  
         String destination = null;
@@ -207,7 +197,7 @@ public class JamesMailStore implements M
 
         String type = repConf.getString("[@type]");
         String repID = destination + type;
-        Object reply = repositories.get(repID);
+        MailRepository reply = repositories.get(repID);
         StringBuffer logBuffer = null;
         if (reply != null) {
             if (getLogger().isDebugEnabled()) {
@@ -252,7 +242,7 @@ public class JamesMailStore implements M
             }
 
             try {               
-                reply = factory.newInstance(Thread.currentThread().getContextClassLoader().loadClass(repClass),
logger, config);
+                reply = (MailRepository) factory.newInstance(Thread.currentThread().getContextClassLoader().loadClass(repClass),
logger, config);
 
                 repositories.put(repID, reply);
                 if (getLogger().isInfoEnabled()) {
@@ -275,18 +265,4 @@ public class JamesMailStore implements M
         }
         
     }
-
-    /**
-     * <p>Returns a new name for a repository.</p>
-     *
-     * <p>Synchronized on the AvalonMailStore.class object to ensure
-     * against duplication of the repository name</p>
-     *
-     * @return a new repository name
-     */
-    public static final String getName() {
-        synchronized (JamesMailStore.class) {
-            return REPOSITORY_NAME + id++;
-        }
-    }
 }



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