add some wiring to have GetUserAccounts for multiple IDs on a single request to grid services. Unfinished, untested
parent
b64f25e631
commit
7c1b2a5dde
|
@ -182,6 +182,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts
|
||||||
return UserAccountService.GetUserAccount(scopeID, Email);
|
return UserAccountService.GetUserAccount(scopeID, Email);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<UserAccount> GetUserAccounts(UUID scopeID, List<string> IDs, out bool suported)
|
||||||
|
{
|
||||||
|
return UserAccountService.GetUserAccounts(scopeID, IDs, out suported);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public List<UserAccount> GetUserAccountsWhere(UUID scopeID, string query)
|
public List<UserAccount> GetUserAccountsWhere(UUID scopeID, string query)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -26,6 +26,8 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
using Nini.Config;
|
using Nini.Config;
|
||||||
using log4net;
|
using log4net;
|
||||||
using Mono.Addins;
|
using Mono.Addins;
|
||||||
|
@ -158,6 +160,39 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts
|
||||||
return account;
|
return account;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override List<UserAccount> GetUserAccounts(UUID scopeID, List<string> IDs, out bool suported)
|
||||||
|
{
|
||||||
|
suported = true;
|
||||||
|
List<UserAccount> accs = new List<UserAccount>();
|
||||||
|
List<string> missing = new List<string>();
|
||||||
|
|
||||||
|
UUID uuid = UUID.Zero;;
|
||||||
|
UserAccount account;
|
||||||
|
bool inCache = false;
|
||||||
|
|
||||||
|
foreach(string id in IDs)
|
||||||
|
{
|
||||||
|
if(UUID.TryParse(id, out uuid))
|
||||||
|
{
|
||||||
|
account = m_Cache.Get(uuid, out inCache);
|
||||||
|
if (inCache)
|
||||||
|
accs.Add(account);
|
||||||
|
else
|
||||||
|
missing.Add(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(missing.Count > 0)
|
||||||
|
{
|
||||||
|
List<UserAccount> ext = base.GetUserAccounts(scopeID, missing, out suported);
|
||||||
|
if(suported && ext != null)
|
||||||
|
accs.AddRange(ext);
|
||||||
|
}
|
||||||
|
|
||||||
|
return accs;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public override bool StoreUserAccount(UserAccount data)
|
public override bool StoreUserAccount(UserAccount data)
|
||||||
{
|
{
|
||||||
// This remote connector refuses to serve this method
|
// This remote connector refuses to serve this method
|
||||||
|
|
|
@ -201,6 +201,12 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<UserAccount> GetUserAccounts(UUID scopeID, List<string> IDs, out bool suported)
|
||||||
|
{
|
||||||
|
suported = false;
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
public bool StoreUserAccount(UserAccount data)
|
public bool StoreUserAccount(UserAccount data)
|
||||||
{
|
{
|
||||||
// m_log.InfoFormat("[SIMIAN ACCOUNT CONNECTOR]: Storing user account for " + data.Name);
|
// m_log.InfoFormat("[SIMIAN ACCOUNT CONNECTOR]: Storing user account for " + data.Name);
|
||||||
|
|
|
@ -191,6 +191,78 @@ namespace OpenSim.Services.Connectors
|
||||||
return accounts;
|
return accounts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public virtual List<UserAccount> GetUserAccounts(UUID scopeID, List<string> IDs, out bool suported)
|
||||||
|
{
|
||||||
|
suported = true;
|
||||||
|
Dictionary<string, object> sendData = new Dictionary<string, object>();
|
||||||
|
//sendData["SCOPEID"] = scopeID.ToString();
|
||||||
|
sendData["VERSIONMIN"] = ProtocolVersions.ClientProtocolVersionMin.ToString();
|
||||||
|
sendData["VERSIONMAX"] = ProtocolVersions.ClientProtocolVersionMax.ToString();
|
||||||
|
sendData["METHOD"] = "getmultiaccounts";
|
||||||
|
|
||||||
|
sendData["ScopeID"] = scopeID.ToString();
|
||||||
|
sendData["IDS"] = new List<string>(IDs);
|
||||||
|
|
||||||
|
string reply = string.Empty;
|
||||||
|
string reqString = ServerUtils.BuildQueryString(sendData);
|
||||||
|
string uri = m_ServerURI + "/accounts";
|
||||||
|
// m_log.DebugFormat("[ACCOUNTS CONNECTOR]: queryString = {0}", reqString);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
reply = SynchronousRestFormsRequester.MakeRequest("POST",
|
||||||
|
uri,
|
||||||
|
reqString,
|
||||||
|
m_Auth);
|
||||||
|
if (reply == null || (reply != null && reply == string.Empty))
|
||||||
|
{
|
||||||
|
m_log.DebugFormat("[ACCOUNT CONNECTOR]: GetMultiUserAccounts received null or empty reply");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
m_log.DebugFormat("[ACCOUNT CONNECTOR]: Exception when contacting user accounts server at {0}: {1}", uri, e.Message);
|
||||||
|
}
|
||||||
|
|
||||||
|
List<UserAccount> accounts = new List<UserAccount>();
|
||||||
|
|
||||||
|
Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
|
||||||
|
|
||||||
|
if (replyData != null)
|
||||||
|
{
|
||||||
|
if (replyData.ContainsKey("result"))
|
||||||
|
{
|
||||||
|
if(replyData["result"].ToString() == "null")
|
||||||
|
return accounts;
|
||||||
|
|
||||||
|
if(replyData["result"].ToString() == "Failure")
|
||||||
|
{
|
||||||
|
suported = false;
|
||||||
|
return accounts;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Dictionary<string, object>.ValueCollection accountList = replyData.Values;
|
||||||
|
//m_log.DebugFormat("[ACCOUNTS CONNECTOR]: GetAgents returned {0} elements", pinfosList.Count);
|
||||||
|
foreach (object acc in accountList)
|
||||||
|
{
|
||||||
|
if (acc is Dictionary<string, object>)
|
||||||
|
{
|
||||||
|
UserAccount pinfo = new UserAccount((Dictionary<string, object>)acc);
|
||||||
|
accounts.Add(pinfo);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
m_log.DebugFormat("[ACCOUNT CONNECTOR]: GetMultiUserAccounts received invalid response type {0}",
|
||||||
|
acc.GetType());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
m_log.DebugFormat("[ACCOUNTS CONNECTOR]: GetMultiUserAccounts received null response");
|
||||||
|
|
||||||
|
return accounts;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public void InvalidateCache(UUID userID)
|
public void InvalidateCache(UUID userID)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -100,6 +100,12 @@ namespace OpenSim.Services.HypergridService
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<UserAccount> GetUserAccounts(UUID scopeID, List<string> IDs, out bool suported)
|
||||||
|
{
|
||||||
|
suported = false;
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
public void InvalidateCache(UUID userID)
|
public void InvalidateCache(UUID userID)
|
||||||
{
|
{
|
||||||
m_UUIDCache.Remove(userID);
|
m_UUIDCache.Remove(userID);
|
||||||
|
|
|
@ -187,6 +187,7 @@ namespace OpenSim.Services.Interfaces
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
List<UserAccount> GetUserAccounts(UUID scopeID, string query);
|
List<UserAccount> GetUserAccounts(UUID scopeID, string query);
|
||||||
List<UserAccount> GetUserAccountsWhere(UUID scopeID, string where);
|
List<UserAccount> GetUserAccountsWhere(UUID scopeID, string where);
|
||||||
|
List<UserAccount> GetUserAccounts(UUID scopeID, List<string> IDs, out bool suported);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Store the data given, wich replaces the stored data, therefore must be complete.
|
/// Store the data given, wich replaces the stored data, therefore must be complete.
|
||||||
|
|
|
@ -265,6 +265,19 @@ namespace OpenSim.Services.UserAccountService
|
||||||
return MakeUserAccount(d[0]);
|
return MakeUserAccount(d[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<UserAccount> GetUserAccounts(UUID scopeID, List<string> IDs, out bool suported)
|
||||||
|
{
|
||||||
|
suported = true;
|
||||||
|
List<UserAccount> accs = new List<UserAccount>();
|
||||||
|
UUID uuid = UUID.Zero;
|
||||||
|
foreach(string id in IDs)
|
||||||
|
{
|
||||||
|
if (UUID.TryParse(id, out uuid) && uuid != UUID.Zero)
|
||||||
|
accs.Add(GetUserAccount(scopeID, uuid));
|
||||||
|
}
|
||||||
|
return accs;
|
||||||
|
}
|
||||||
|
|
||||||
public void InvalidateCache(UUID userID)
|
public void InvalidateCache(UUID userID)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue