Browse code

Fix: we can't rely on mail/archive as this was removed

Thomas Cataldo authored on 10/01/2019 13:28:34
Showing 1 changed files
... ...
@@ -18,16 +18,13 @@
18 18
  */
19 19
 package net.bluemind.hsm.processor;
20 20
 
21
-import java.util.List;
22 21
 import java.util.Map;
23 22
 import java.util.concurrent.TimeUnit;
24 23
 
25 24
 import com.google.common.cache.Cache;
26 25
 import com.google.common.cache.CacheBuilder;
27 26
 
28
-import net.bluemind.config.InstallationId;
29 27
 import net.bluemind.core.api.fault.ServerFault;
30
-import net.bluemind.core.container.model.ItemValue;
31 28
 import net.bluemind.core.context.SecurityContext;
32 29
 import net.bluemind.core.rest.ServerSideServiceProvider;
33 30
 import net.bluemind.hsm.storage.HSMStorage;
... ...
@@ -36,9 +33,6 @@ import net.bluemind.imap.IMAPException;
36 33
 import net.bluemind.imap.StoreClient;
37 34
 import net.bluemind.node.api.INodeClient;
38 35
 import net.bluemind.node.api.NodeActivator;
39
-import net.bluemind.server.api.Assignment;
40
-import net.bluemind.server.api.IServer;
41
-import net.bluemind.server.api.Server;
42 36
 import net.bluemind.user.api.IUserSettings;
43 37
 
44 38
 public class HSMContext {
... ...
@@ -75,22 +69,9 @@ public class HSMContext {
75 69
 			lang = "en";
76 70
 		}
77 71
 
78
-		IServer serverService = ServerSideServiceProvider.getProvider(SecurityContext.SYSTEM).instance(IServer.class,
79
-				InstallationId.getIdentifier());
80
-
81
-		List<Assignment> assignments = serverService.getAssignments(context.getContainerUid());
82
-
83
-		INodeClient nc = null;
84
-		for (Assignment assignment : assignments) {
85
-			if ("mail/archive".equals(assignment.tag)) {
86
-				ItemValue<Server> server = serverService.getComplete(assignment.serverUid);
87
-				nc = NodeActivator.get(server.value.address());
88
-			}
89
-		}
90
-
91
-		if (nc == null) {
92
-			throw new ServerFault("Cannot find mail/archive host for domain " + context.getContainerUid());
93
-		}
72
+		// we have an NFS mount on the data backend & we rely on that for the archive
73
+		// partition.
74
+		INodeClient nc = NodeActivator.get(loginContext.dataLocation);
94 75
 
95 76
 		storage = HSMStorage.storage;
96 77
 		storage.open(nc);
... ...
@@ -131,6 +112,9 @@ public class HSMContext {
131 112
 	public static class HSMLoginContext {
132 113
 		public final String login;
133 114
 		public final String uid;
115
+		/**
116
+		 * this holds the server address, not its uid
117
+		 */
134 118
 		public final String dataLocation;
135 119
 
136 120
 		public HSMLoginContext(String login, String uid, String dataLocation) {