james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nor...@apache.org
Subject svn commit: r1050467 - in /james/server/trunk/user-file: pom.xml src/main/java/org/apache/james/user/file/UsersFileRepository.java src/test/java/org/apache/james/user/file/UsersFileRepositoryTest.java
Date Fri, 17 Dec 2010 18:51:22 GMT
Author: norman
Date: Fri Dec 17 18:51:22 2010
New Revision: 1050467

URL: http://svn.apache.org/viewvc?rev=1050467&view=rev
Log:
File repository implementations are now instanced directly and not load via MailStore. This
also "fix" the dependency from users-file on mail-api which was just plain wrong..

Modified:
    james/server/trunk/user-file/pom.xml
    james/server/trunk/user-file/src/main/java/org/apache/james/user/file/UsersFileRepository.java
    james/server/trunk/user-file/src/test/java/org/apache/james/user/file/UsersFileRepositoryTest.java

Modified: james/server/trunk/user-file/pom.xml
URL: http://svn.apache.org/viewvc/james/server/trunk/user-file/pom.xml?rev=1050467&r1=1050466&r2=1050467&view=diff
==============================================================================
--- james/server/trunk/user-file/pom.xml (original)
+++ james/server/trunk/user-file/pom.xml Fri Dec 17 18:51:22 2010
@@ -35,15 +35,15 @@
     </dependency>
     <dependency>
       <groupId>org.apache.james</groupId>
-      <artifactId>james-server-repository-api</artifactId>
+      <artifactId>james-server-resolver-api</artifactId>
     </dependency>
     <dependency>
       <groupId>org.apache.james</groupId>
-      <artifactId>james-server-repository-file</artifactId>
+      <artifactId>james-server-repository-api</artifactId>
     </dependency>
     <dependency>
       <groupId>org.apache.james</groupId>
-      <artifactId>james-server-mail-api</artifactId>
+      <artifactId>james-server-repository-file</artifactId>
     </dependency>
     <dependency>
       <groupId>org.apache.james</groupId>
@@ -93,11 +93,5 @@
       <type>test-jar</type>
       <scope>test</scope>
     </dependency>
-    <dependency>
-      <groupId>org.apache.james</groupId>
-      <artifactId>james-server-mail-library</artifactId>
-      <type>test-jar</type>
-      <scope>test</scope>
-    </dependency>
   </dependencies>
 </project>

Modified: james/server/trunk/user-file/src/main/java/org/apache/james/user/file/UsersFileRepository.java
URL: http://svn.apache.org/viewvc/james/server/trunk/user-file/src/main/java/org/apache/james/user/file/UsersFileRepository.java?rev=1050467&r1=1050466&r2=1050467&view=diff
==============================================================================
--- james/server/trunk/user-file/src/main/java/org/apache/james/user/file/UsersFileRepository.java
(original)
+++ james/server/trunk/user-file/src/main/java/org/apache/james/user/file/UsersFileRepository.java
Fri Dec 17 18:51:22 2010
@@ -24,8 +24,8 @@ package org.apache.james.user.file;
 import org.apache.commons.configuration.ConfigurationException;
 import org.apache.commons.configuration.DefaultConfigurationBuilder;
 import org.apache.commons.configuration.HierarchicalConfiguration;
-import org.apache.james.mailstore.api.MailStore;
-import org.apache.james.repository.api.ObjectRepository;
+import org.apache.james.repository.file.FilePersistentObjectRepository;
+import org.apache.james.resolver.api.FileSystem;
 import org.apache.james.user.api.model.User;
 import org.apache.james.user.lib.AbstractJamesUsersRepository;
 import org.apache.james.user.lib.model.DefaultJamesUser;
@@ -58,8 +58,7 @@ public class UsersFileRepository
      */
     protected static boolean DEEP_DEBUG = false;
 
-    private MailStore store;
-    private ObjectRepository objectRepository;
+    private FilePersistentObjectRepository objectRepository;
     private static String urlSeparator = "/"; 
 
     /**
@@ -67,17 +66,14 @@ public class UsersFileRepository
      */
     private String destination;
 
-    /**
-     * Set the Store
-     * 
-     * @param store the Store
-     */
-    @Resource(name="mailstore")
-    public void setStore(MailStore store) {
-        this.store = store;
-    }
+    private FileSystem fs;
 
 
+    @Resource(name="filesystem")
+    public void setFileSystem(FileSystem fs) {
+        this.fs = fs;
+    }
+
     /**
      * @see org.apache.james.user.lib.AbstractJamesUsersRepository#doConfigure(org.apache.commons.configuration.HierarchicalConfiguration)
      */
@@ -101,10 +97,12 @@ public class UsersFileRepository
                 = new DefaultConfigurationBuilder();
 
             objectConfiguration.addProperty( "[@destinationURL]", destination );
-            objectConfiguration.addProperty( "[@type]", "OBJECT" );
-            objectConfiguration.addProperty( "[@model]", "SYNCHRONOUS" );
-
-            objectRepository = (ObjectRepository)store.select( objectConfiguration );
+            
+            objectRepository = new FilePersistentObjectRepository();
+            objectRepository.setLog(getLogger());
+            objectRepository.setFileSystem(fs);
+            objectRepository.configure(objectConfiguration);
+            objectRepository.init();
             if (getLogger().isDebugEnabled()) {
                 StringBuffer logBuffer =
                     new StringBuffer(192)

Modified: james/server/trunk/user-file/src/test/java/org/apache/james/user/file/UsersFileRepositoryTest.java
URL: http://svn.apache.org/viewvc/james/server/trunk/user-file/src/test/java/org/apache/james/user/file/UsersFileRepositoryTest.java?rev=1050467&r1=1050466&r2=1050467&view=diff
==============================================================================
--- james/server/trunk/user-file/src/test/java/org/apache/james/user/file/UsersFileRepositoryTest.java
(original)
+++ james/server/trunk/user-file/src/test/java/org/apache/james/user/file/UsersFileRepositoryTest.java
Fri Dec 17 18:51:22 2010
@@ -30,8 +30,6 @@ import java.util.Iterator;
 import org.apache.commons.configuration.DefaultConfigurationBuilder;
 import org.apache.commons.logging.impl.SimpleLog;
 import org.apache.james.lifecycle.api.LifecycleUtil;
-import org.apache.james.mailstore.mock.MockMailStore;
-import org.apache.james.repository.file.FilePersistentObjectRepository;
 import org.apache.james.resolver.api.FileSystem;
 import org.apache.james.user.api.UsersRepository;
 import org.apache.james.user.api.model.JamesUser;
@@ -52,9 +50,6 @@ public class UsersFileRepositoryTest ext
      * @throws Exception 
      */
     protected UsersRepository getUsersRepository() throws Exception {
-        
-        UsersFileRepository res = new UsersFileRepository();
-
         FileSystem fs = new FileSystem() {
 
             public File getBasedir() throws FileNotFoundException {
@@ -70,19 +65,15 @@ public class UsersFileRepositoryTest ext
             }
             
         };
-        MockMailStore mockStore = new MockMailStore();
-        FilePersistentObjectRepository filePersistentObjectRepository = new FilePersistentObjectRepository();
-        filePersistentObjectRepository.setFileSystem(fs);
-        filePersistentObjectRepository.setLog(new SimpleLog("MockLog"));
-        DefaultConfigurationBuilder defaultConfiguration22 = new DefaultConfigurationBuilder();
-        defaultConfiguration22.addProperty("[@destinationURL]", "file://target/var/users");
-        filePersistentObjectRepository.configure(defaultConfiguration22);
-        filePersistentObjectRepository.init();
         
-        mockStore.add("OBJECT.users", filePersistentObjectRepository);
-        res.setStore(mockStore);
         DefaultConfigurationBuilder configuration = new DefaultConfigurationBuilder("test");
         configuration.addProperty("destination.[@URL]", "file://target/var/users");
+        
+        UsersFileRepository res = new UsersFileRepository();
+
+        
+
+        res.setFileSystem(fs);
         res.setLog(new SimpleLog("MockLog"));
         res.configure(configuration);
         res.init();



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