aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorMelanie2012-01-16 02:19:19 +0100
committerMelanie2012-01-16 23:09:24 +0000
commite13a17cc0c8514bc673d5ba39c86d23451278389 (patch)
tree5db52b401e5abd91316ca17d79aabdb3ae704fde /OpenSim
parentComment out noisy log lines I accidentally included in the nant build target ... (diff)
downloadopensim-SC_OLD-e13a17cc0c8514bc673d5ba39c86d23451278389.zip
opensim-SC_OLD-e13a17cc0c8514bc673d5ba39c86d23451278389.tar.gz
opensim-SC_OLD-e13a17cc0c8514bc673d5ba39c86d23451278389.tar.bz2
opensim-SC_OLD-e13a17cc0c8514bc673d5ba39c86d23451278389.tar.xz
Allow retrival of multiple user records in one operation, analog to presence
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/GridUser/LocalGridUserServiceConnector.cs4
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/GridUser/RemoteGridUserServiceConnector.cs5
-rw-r--r--OpenSim/Server/Handlers/GridUser/GridUserServerPostHandler.cs42
-rw-r--r--OpenSim/Services/Connectors/GridUser/GridUserServiceConnector.cs60
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs4
-rw-r--r--OpenSim/Services/Interfaces/IGridUserService.cs3
-rw-r--r--OpenSim/Services/UserAccountService/GridUserService.cs12
7 files changed, 128 insertions, 2 deletions
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/GridUser/LocalGridUserServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/GridUser/LocalGridUserServiceConnector.cs
index 985acec..90fe69e 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/GridUser/LocalGridUserServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/GridUser/LocalGridUserServiceConnector.cs
@@ -171,6 +171,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.GridUser
171 { 171 {
172 return m_GridUserService.GetGridUserInfo(userID); 172 return m_GridUserService.GetGridUserInfo(userID);
173 } 173 }
174 public GridUserInfo[] GetGridUserInfo(string[] userID)
175 {
176 return m_GridUserService.GetGridUserInfo(userID);
177 }
174 178
175 #endregion 179 #endregion
176 180
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/GridUser/RemoteGridUserServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/GridUser/RemoteGridUserServiceConnector.cs
index 95b3591..badb552 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/GridUser/RemoteGridUserServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/GridUser/RemoteGridUserServiceConnector.cs
@@ -147,6 +147,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.GridUser
147 return m_RemoteConnector.GetGridUserInfo(userID); 147 return m_RemoteConnector.GetGridUserInfo(userID);
148 } 148 }
149 149
150 public GridUserInfo[] GetGridUserInfo(string[] userID)
151 {
152 return m_RemoteConnector.GetGridUserInfo(userID);
153 }
154
150 #endregion 155 #endregion
151 156
152 } 157 }
diff --git a/OpenSim/Server/Handlers/GridUser/GridUserServerPostHandler.cs b/OpenSim/Server/Handlers/GridUser/GridUserServerPostHandler.cs
index 4c0d52e..bf21255 100644
--- a/OpenSim/Server/Handlers/GridUser/GridUserServerPostHandler.cs
+++ b/OpenSim/Server/Handlers/GridUser/GridUserServerPostHandler.cs
@@ -88,6 +88,8 @@ namespace OpenSim.Server.Handlers.GridUser
88 return SetPosition(request); 88 return SetPosition(request);
89 case "getgriduserinfo": 89 case "getgriduserinfo":
90 return GetGridUserInfo(request); 90 return GetGridUserInfo(request);
91 case "getgriduserinfos":
92 return GetGridUserInfos(request);
91 } 93 }
92 m_log.DebugFormat("[GRID USER HANDLER]: unknown method request: {0}", method); 94 m_log.DebugFormat("[GRID USER HANDLER]: unknown method request: {0}", method);
93 } 95 }
@@ -193,6 +195,46 @@ namespace OpenSim.Server.Handlers.GridUser
193 195
194 } 196 }
195 197
198 byte[] GetGridUserInfos(Dictionary<string, object> request)
199 {
200
201 string[] userIDs;
202
203 if (!request.ContainsKey("AgentIDs"))
204 {
205 m_log.DebugFormat("[GRID USER HANDLER]: GetGridUserInfos called without required uuids argument");
206 return FailureResult();
207 }
208
209 if (!(request["AgentIDs"] is List<string>))
210 {
211 m_log.DebugFormat("[GRID USER HANDLER]: GetGridUserInfos input argument was of unexpected type {0}", request["uuids"].GetType().ToString());
212 return FailureResult();
213 }
214
215 userIDs = ((List<string>)request["AgentIDs"]).ToArray();
216
217 GridUserInfo[] pinfos = m_GridUserService.GetGridUserInfo(userIDs);
218
219 Dictionary<string, object> result = new Dictionary<string, object>();
220 if ((pinfos == null) || ((pinfos != null) && (pinfos.Length == 0)))
221 result["result"] = "null";
222 else
223 {
224 int i = 0;
225 foreach (GridUserInfo pinfo in pinfos)
226 {
227 Dictionary<string, object> rinfoDict = pinfo.ToKeyValuePairs();
228 result["griduser" + i] = rinfoDict;
229 i++;
230 }
231 }
232
233 string xmlString = ServerUtils.BuildXmlResponse(result);
234 UTF8Encoding encoding = new UTF8Encoding();
235 return encoding.GetBytes(xmlString);
236 }
237
196 private bool UnpackArgs(Dictionary<string, object> request, out string user, out UUID region, out Vector3 position, out Vector3 lookAt) 238 private bool UnpackArgs(Dictionary<string, object> request, out string user, out UUID region, out Vector3 position, out Vector3 lookAt)
197 { 239 {
198 user = string.Empty; 240 user = string.Empty;
diff --git a/OpenSim/Services/Connectors/GridUser/GridUserServiceConnector.cs b/OpenSim/Services/Connectors/GridUser/GridUserServiceConnector.cs
index 738cc06..aa98b5d 100644
--- a/OpenSim/Services/Connectors/GridUser/GridUserServiceConnector.cs
+++ b/OpenSim/Services/Connectors/GridUser/GridUserServiceConnector.cs
@@ -223,5 +223,65 @@ namespace OpenSim.Services.Connectors
223 223
224 } 224 }
225 225
226 public GridUserInfo[] GetGridUserInfo(string[] userIDs)
227 {
228 Dictionary<string, object> sendData = new Dictionary<string, object>();
229 //sendData["SCOPEID"] = scopeID.ToString();
230 sendData["VERSIONMIN"] = ProtocolVersions.ClientProtocolVersionMin.ToString();
231 sendData["VERSIONMAX"] = ProtocolVersions.ClientProtocolVersionMax.ToString();
232 sendData["METHOD"] = "getgriduserinfos";
233
234 sendData["AgentIDs"] = new List<string>(userIDs);
235
236 string reply = string.Empty;
237 string reqString = ServerUtils.BuildQueryString(sendData);
238 //m_log.DebugFormat("[PRESENCE CONNECTOR]: queryString = {0}", reqString);
239 try
240 {
241 reply = SynchronousRestFormsRequester.MakeRequest("POST",
242 m_ServerURI + "/griduser",
243 reqString);
244 if (reply == null || (reply != null && reply == string.Empty))
245 {
246 m_log.DebugFormat("[GRID USER CONNECTOR]: GetGridUserInfo received null or empty reply");
247 return null;
248 }
249 }
250 catch (Exception e)
251 {
252 m_log.DebugFormat("[GRID USER CONNECTOR]: Exception when contacting grid user server: {0}", e.Message);
253 }
254
255 List<GridUserInfo> rinfos = new List<GridUserInfo>();
256
257 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
258
259 if (replyData != null)
260 {
261 if (replyData.ContainsKey("result") &&
262 (replyData["result"].ToString() == "null" || replyData["result"].ToString() == "Failure"))
263 {
264 return new GridUserInfo[0];
265 }
266
267 Dictionary<string, object>.ValueCollection pinfosList = replyData.Values;
268 //m_log.DebugFormat("[PRESENCE CONNECTOR]: GetAgents returned {0} elements", pinfosList.Count);
269 foreach (object griduser in pinfosList)
270 {
271 if (griduser is Dictionary<string, object>)
272 {
273 GridUserInfo pinfo = new GridUserInfo((Dictionary<string, object>)griduser);
274 rinfos.Add(pinfo);
275 }
276 else
277 m_log.DebugFormat("[GRID USER CONNECTOR]: GetGridUserInfo received invalid response type {0}",
278 griduser.GetType());
279 }
280 }
281 else
282 m_log.DebugFormat("[GRID USER CONNECTOR]: GetGridUserInfo received null response");
283
284 return rinfos.ToArray();
285 }
226 } 286 }
227} 287}
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs
index 678f738..ca1b64f 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs
@@ -472,6 +472,10 @@ namespace OpenSim.Services.Connectors.SimianGrid
472 return false; 472 return false;
473 } 473 }
474 474
475 public GridUserInfo[] GetGridUserInfo(string[] userIDs)
476 {
477 return new GridUserInfo[0];
478 }
475 #endregion Helpers 479 #endregion Helpers
476 } 480 }
477} 481}
diff --git a/OpenSim/Services/Interfaces/IGridUserService.cs b/OpenSim/Services/Interfaces/IGridUserService.cs
index 6613ae7..0a52bfa 100644
--- a/OpenSim/Services/Interfaces/IGridUserService.cs
+++ b/OpenSim/Services/Interfaces/IGridUserService.cs
@@ -131,5 +131,6 @@ namespace OpenSim.Services.Interfaces
131 bool SetLastPosition(string userID, UUID sessionID, UUID regionID, Vector3 lastPosition, Vector3 lastLookAt); 131 bool SetLastPosition(string userID, UUID sessionID, UUID regionID, Vector3 lastPosition, Vector3 lastLookAt);
132 132
133 GridUserInfo GetGridUserInfo(string userID); 133 GridUserInfo GetGridUserInfo(string userID);
134 GridUserInfo[] GetGridUserInfo(string[] userID);
134 } 135 }
135} \ No newline at end of file 136}
diff --git a/OpenSim/Services/UserAccountService/GridUserService.cs b/OpenSim/Services/UserAccountService/GridUserService.cs
index 9b18915..ac3d8fd 100644
--- a/OpenSim/Services/UserAccountService/GridUserService.cs
+++ b/OpenSim/Services/UserAccountService/GridUserService.cs
@@ -73,6 +73,16 @@ namespace OpenSim.Services.UserAccountService
73 return info; 73 return info;
74 } 74 }
75 75
76 public GridUserInfo[] GetGridUserInfo(string[] userIDs)
77 {
78 List<GridUserInfo> ret = new List<GridUserInfo>();
79
80 foreach (string id in userIDs)
81 ret.Add(GetGridUserInfo(id));
82
83 return ret.ToArray();
84 }
85
76 public GridUserInfo LoggedIn(string userID) 86 public GridUserInfo LoggedIn(string userID)
77 { 87 {
78 m_log.DebugFormat("[GRID USER SERVICE]: User {0} is online", userID); 88 m_log.DebugFormat("[GRID USER SERVICE]: User {0} is online", userID);
@@ -156,4 +166,4 @@ namespace OpenSim.Services.UserAccountService
156 return m_Database.Store(d); 166 return m_Database.Store(d);
157 } 167 }
158 } 168 }
159} \ No newline at end of file 169}