aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorUbitUmarov2016-08-13 05:22:29 +0100
committerUbitUmarov2016-08-13 05:22:29 +0100
commit7c1b2a5dde3b61dae4cca6bff7d2fe560be96fae (patch)
tree09a79ea66f619af6295e20b8c92b397cd90ebafc
parent add a missing cast to ulong in RegionGridLocToHandle (mantis: 7994) (diff)
downloadopensim-SC_OLD-7c1b2a5dde3b61dae4cca6bff7d2fe560be96fae.zip
opensim-SC_OLD-7c1b2a5dde3b61dae4cca6bff7d2fe560be96fae.tar.gz
opensim-SC_OLD-7c1b2a5dde3b61dae4cca6bff7d2fe560be96fae.tar.bz2
opensim-SC_OLD-7c1b2a5dde3b61dae4cca6bff7d2fe560be96fae.tar.xz
add some wiring to have GetUserAccounts for multiple IDs on a single request to grid services. Unfinished, untested
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/LocalUserAccountServiceConnector.cs6
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/RemoteUserAccountServiceConnector.cs35
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs6
-rw-r--r--OpenSim/Services/Connectors/UserAccounts/UserAccountServicesConnector.cs72
-rw-r--r--OpenSim/Services/HypergridService/UserAccountCache.cs6
-rw-r--r--OpenSim/Services/Interfaces/IUserAccountService.cs1
-rw-r--r--OpenSim/Services/UserAccountService/UserAccountService.cs13
7 files changed, 139 insertions, 0 deletions
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/LocalUserAccountServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/LocalUserAccountServiceConnector.cs
index cf9a7b4..1002b85 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/LocalUserAccountServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/LocalUserAccountServiceConnector.cs
@@ -182,6 +182,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts
182 return UserAccountService.GetUserAccount(scopeID, Email); 182 return UserAccountService.GetUserAccount(scopeID, Email);
183 } 183 }
184 184
185 public List<UserAccount> GetUserAccounts(UUID scopeID, List<string> IDs, out bool suported)
186 {
187 return UserAccountService.GetUserAccounts(scopeID, IDs, out suported);
188 }
189
190
185 public List<UserAccount> GetUserAccountsWhere(UUID scopeID, string query) 191 public List<UserAccount> GetUserAccountsWhere(UUID scopeID, string query)
186 { 192 {
187 return null; 193 return null;
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/RemoteUserAccountServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/RemoteUserAccountServiceConnector.cs
index afbba30..fb5fae1 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/RemoteUserAccountServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/RemoteUserAccountServiceConnector.cs
@@ -26,6 +26,8 @@
26 */ 26 */
27 27
28using System; 28using System;
29using System.Collections;
30using System.Collections.Generic;
29using Nini.Config; 31using Nini.Config;
30using log4net; 32using log4net;
31using Mono.Addins; 33using Mono.Addins;
@@ -158,6 +160,39 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts
158 return account; 160 return account;
159 } 161 }
160 162
163 public override List<UserAccount> GetUserAccounts(UUID scopeID, List<string> IDs, out bool suported)
164 {
165 suported = true;
166 List<UserAccount> accs = new List<UserAccount>();
167 List<string> missing = new List<string>();
168
169 UUID uuid = UUID.Zero;;
170 UserAccount account;
171 bool inCache = false;
172
173 foreach(string id in IDs)
174 {
175 if(UUID.TryParse(id, out uuid))
176 {
177 account = m_Cache.Get(uuid, out inCache);
178 if (inCache)
179 accs.Add(account);
180 else
181 missing.Add(id);
182 }
183 }
184
185 if(missing.Count > 0)
186 {
187 List<UserAccount> ext = base.GetUserAccounts(scopeID, missing, out suported);
188 if(suported && ext != null)
189 accs.AddRange(ext);
190 }
191
192 return accs;
193 }
194
195
161 public override bool StoreUserAccount(UserAccount data) 196 public override bool StoreUserAccount(UserAccount data)
162 { 197 {
163 // This remote connector refuses to serve this method 198 // This remote connector refuses to serve this method
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs
index 563a1e7..1ef5ad2 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs
@@ -201,6 +201,12 @@ namespace OpenSim.Services.Connectors.SimianGrid
201 return null; 201 return null;
202 } 202 }
203 203
204 public List<UserAccount> GetUserAccounts(UUID scopeID, List<string> IDs, out bool suported)
205 {
206 suported = false;
207 return null;
208 }
209
204 public bool StoreUserAccount(UserAccount data) 210 public bool StoreUserAccount(UserAccount data)
205 { 211 {
206// m_log.InfoFormat("[SIMIAN ACCOUNT CONNECTOR]: Storing user account for " + data.Name); 212// m_log.InfoFormat("[SIMIAN ACCOUNT CONNECTOR]: Storing user account for " + data.Name);
diff --git a/OpenSim/Services/Connectors/UserAccounts/UserAccountServicesConnector.cs b/OpenSim/Services/Connectors/UserAccounts/UserAccountServicesConnector.cs
index 3de0a20..e625143 100644
--- a/OpenSim/Services/Connectors/UserAccounts/UserAccountServicesConnector.cs
+++ b/OpenSim/Services/Connectors/UserAccounts/UserAccountServicesConnector.cs
@@ -191,6 +191,78 @@ namespace OpenSim.Services.Connectors
191 return accounts; 191 return accounts;
192 } 192 }
193 193
194 public virtual List<UserAccount> GetUserAccounts(UUID scopeID, List<string> IDs, out bool suported)
195 {
196 suported = true;
197 Dictionary<string, object> sendData = new Dictionary<string, object>();
198 //sendData["SCOPEID"] = scopeID.ToString();
199 sendData["VERSIONMIN"] = ProtocolVersions.ClientProtocolVersionMin.ToString();
200 sendData["VERSIONMAX"] = ProtocolVersions.ClientProtocolVersionMax.ToString();
201 sendData["METHOD"] = "getmultiaccounts";
202
203 sendData["ScopeID"] = scopeID.ToString();
204 sendData["IDS"] = new List<string>(IDs);
205
206 string reply = string.Empty;
207 string reqString = ServerUtils.BuildQueryString(sendData);
208 string uri = m_ServerURI + "/accounts";
209 // m_log.DebugFormat("[ACCOUNTS CONNECTOR]: queryString = {0}", reqString);
210 try
211 {
212 reply = SynchronousRestFormsRequester.MakeRequest("POST",
213 uri,
214 reqString,
215 m_Auth);
216 if (reply == null || (reply != null && reply == string.Empty))
217 {
218 m_log.DebugFormat("[ACCOUNT CONNECTOR]: GetMultiUserAccounts received null or empty reply");
219 return null;
220 }
221 }
222 catch (Exception e)
223 {
224 m_log.DebugFormat("[ACCOUNT CONNECTOR]: Exception when contacting user accounts server at {0}: {1}", uri, e.Message);
225 }
226
227 List<UserAccount> accounts = new List<UserAccount>();
228
229 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
230
231 if (replyData != null)
232 {
233 if (replyData.ContainsKey("result"))
234 {
235 if(replyData["result"].ToString() == "null")
236 return accounts;
237
238 if(replyData["result"].ToString() == "Failure")
239 {
240 suported = false;
241 return accounts;
242 }
243 }
244
245 Dictionary<string, object>.ValueCollection accountList = replyData.Values;
246 //m_log.DebugFormat("[ACCOUNTS CONNECTOR]: GetAgents returned {0} elements", pinfosList.Count);
247 foreach (object acc in accountList)
248 {
249 if (acc is Dictionary<string, object>)
250 {
251 UserAccount pinfo = new UserAccount((Dictionary<string, object>)acc);
252 accounts.Add(pinfo);
253 }
254 else
255 m_log.DebugFormat("[ACCOUNT CONNECTOR]: GetMultiUserAccounts received invalid response type {0}",
256 acc.GetType());
257 }
258 }
259 else
260 m_log.DebugFormat("[ACCOUNTS CONNECTOR]: GetMultiUserAccounts received null response");
261
262 return accounts;
263 }
264
265
194 public void InvalidateCache(UUID userID) 266 public void InvalidateCache(UUID userID)
195 { 267 {
196 } 268 }
diff --git a/OpenSim/Services/HypergridService/UserAccountCache.cs b/OpenSim/Services/HypergridService/UserAccountCache.cs
index 6c3c655..618bd97 100644
--- a/OpenSim/Services/HypergridService/UserAccountCache.cs
+++ b/OpenSim/Services/HypergridService/UserAccountCache.cs
@@ -100,6 +100,12 @@ namespace OpenSim.Services.HypergridService
100 return null; 100 return null;
101 } 101 }
102 102
103 public List<UserAccount> GetUserAccounts(UUID scopeID, List<string> IDs, out bool suported)
104 {
105 suported = false;
106 return null;
107 }
108
103 public void InvalidateCache(UUID userID) 109 public void InvalidateCache(UUID userID)
104 { 110 {
105 m_UUIDCache.Remove(userID); 111 m_UUIDCache.Remove(userID);
diff --git a/OpenSim/Services/Interfaces/IUserAccountService.cs b/OpenSim/Services/Interfaces/IUserAccountService.cs
index 1814699..1914040 100644
--- a/OpenSim/Services/Interfaces/IUserAccountService.cs
+++ b/OpenSim/Services/Interfaces/IUserAccountService.cs
@@ -187,6 +187,7 @@ namespace OpenSim.Services.Interfaces
187 /// <returns></returns> 187 /// <returns></returns>
188 List<UserAccount> GetUserAccounts(UUID scopeID, string query); 188 List<UserAccount> GetUserAccounts(UUID scopeID, string query);
189 List<UserAccount> GetUserAccountsWhere(UUID scopeID, string where); 189 List<UserAccount> GetUserAccountsWhere(UUID scopeID, string where);
190 List<UserAccount> GetUserAccounts(UUID scopeID, List<string> IDs, out bool suported);
190 191
191 /// <summary> 192 /// <summary>
192 /// Store the data given, wich replaces the stored data, therefore must be complete. 193 /// Store the data given, wich replaces the stored data, therefore must be complete.
diff --git a/OpenSim/Services/UserAccountService/UserAccountService.cs b/OpenSim/Services/UserAccountService/UserAccountService.cs
index 6010f0c..fbe5e3b 100644
--- a/OpenSim/Services/UserAccountService/UserAccountService.cs
+++ b/OpenSim/Services/UserAccountService/UserAccountService.cs
@@ -265,6 +265,19 @@ namespace OpenSim.Services.UserAccountService
265 return MakeUserAccount(d[0]); 265 return MakeUserAccount(d[0]);
266 } 266 }
267 267
268 public List<UserAccount> GetUserAccounts(UUID scopeID, List<string> IDs, out bool suported)
269 {
270 suported = true;
271 List<UserAccount> accs = new List<UserAccount>();
272 UUID uuid = UUID.Zero;
273 foreach(string id in IDs)
274 {
275 if (UUID.TryParse(id, out uuid) && uuid != UUID.Zero)
276 accs.Add(GetUserAccount(scopeID, uuid));
277 }
278 return accs;
279 }
280
268 public void InvalidateCache(UUID userID) 281 public void InvalidateCache(UUID userID)
269 { 282 {
270 } 283 }