diff options
author | Mic Bowman | 2013-07-31 11:27:35 -0700 |
---|---|---|
committer | Mic Bowman | 2013-07-31 11:27:35 -0700 |
commit | 64f2dc778ad7a080ba89a1077da538c011c7c934 (patch) | |
tree | 963b456d229b7b986b8f8a6ce251e52774de474d /OpenSim/Services/Connectors/SimianGrid | |
parent | Avoid another null ref opportunity. (diff) | |
download | opensim-SC_OLD-64f2dc778ad7a080ba89a1077da538c011c7c934.zip opensim-SC_OLD-64f2dc778ad7a080ba89a1077da538c011c7c934.tar.gz opensim-SC_OLD-64f2dc778ad7a080ba89a1077da538c011c7c934.tar.bz2 opensim-SC_OLD-64f2dc778ad7a080ba89a1077da538c011c7c934.tar.xz |
A pretty major restructuring of the simian method invocations in order to
service access capabilities. In conjunction with the corresponding Simian
updates, this enables explicit per-simulator capability-based access to
grid services. That enables grid owners to add or revoke access to the grid
on a simulator by simulator basis.
Diffstat (limited to 'OpenSim/Services/Connectors/SimianGrid')
11 files changed, 578 insertions, 282 deletions
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs index 74b980c..6f8d9ed 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs | |||
@@ -27,6 +27,7 @@ | |||
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Collections.Specialized; | ||
30 | using System.IO; | 31 | using System.IO; |
31 | using System.Net; | 32 | using System.Net; |
32 | using System.Reflection; | 33 | using System.Reflection; |
@@ -122,7 +123,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
122 | m_Enabled = true; | 123 | m_Enabled = true; |
123 | } | 124 | } |
124 | 125 | ||
125 | #region IAssetService | 126 | #region IAssetService |
126 | 127 | ||
127 | public AssetBase Get(string id) | 128 | public AssetBase Get(string id) |
128 | { | 129 | { |
@@ -140,8 +141,9 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
140 | return asset; | 141 | return asset; |
141 | } | 142 | } |
142 | 143 | ||
143 | return GetRemote(id); | 144 | return SimianGetOperation(id); |
144 | } | 145 | } |
146 | |||
145 | 147 | ||
146 | public AssetBase GetCached(string id) | 148 | public AssetBase GetCached(string id) |
147 | { | 149 | { |
@@ -164,8 +166,6 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
164 | throw new InvalidOperationException(); | 166 | throw new InvalidOperationException(); |
165 | } | 167 | } |
166 | 168 | ||
167 | AssetMetadata metadata = null; | ||
168 | |||
169 | // Cache fetch | 169 | // Cache fetch |
170 | if (m_cache != null) | 170 | if (m_cache != null) |
171 | { | 171 | { |
@@ -174,50 +174,18 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
174 | return asset.Metadata; | 174 | return asset.Metadata; |
175 | } | 175 | } |
176 | 176 | ||
177 | Uri url; | 177 | // return GetRemoteMetadata(id); |
178 | 178 | return SimianGetMetadataOperation(id); | |
179 | // Determine if id is an absolute URL or a grid-relative UUID | ||
180 | if (!Uri.TryCreate(id, UriKind.Absolute, out url)) | ||
181 | url = new Uri(m_serverUrl + id); | ||
182 | |||
183 | try | ||
184 | { | ||
185 | HttpWebRequest request = UntrustedHttpWebRequest.Create(url); | ||
186 | request.Method = "HEAD"; | ||
187 | |||
188 | using (WebResponse response = request.GetResponse()) | ||
189 | { | ||
190 | using (Stream responseStream = response.GetResponseStream()) | ||
191 | { | ||
192 | // Create the metadata object | ||
193 | metadata = new AssetMetadata(); | ||
194 | metadata.ContentType = response.ContentType; | ||
195 | metadata.ID = id; | ||
196 | |||
197 | UUID uuid; | ||
198 | if (UUID.TryParse(id, out uuid)) | ||
199 | metadata.FullID = uuid; | ||
200 | |||
201 | string lastModifiedStr = response.Headers.Get("Last-Modified"); | ||
202 | if (!String.IsNullOrEmpty(lastModifiedStr)) | ||
203 | { | ||
204 | DateTime lastModified; | ||
205 | if (DateTime.TryParse(lastModifiedStr, out lastModified)) | ||
206 | metadata.CreationDate = lastModified; | ||
207 | } | ||
208 | } | ||
209 | } | ||
210 | } | ||
211 | catch (Exception ex) | ||
212 | { | ||
213 | m_log.Warn("[SIMIAN ASSET CONNECTOR]: Asset HEAD from " + url + " failed: " + ex.Message); | ||
214 | } | ||
215 | |||
216 | return metadata; | ||
217 | } | 179 | } |
218 | 180 | ||
219 | public byte[] GetData(string id) | 181 | public byte[] GetData(string id) |
220 | { | 182 | { |
183 | if (String.IsNullOrEmpty(m_serverUrl)) | ||
184 | { | ||
185 | m_log.Error("[SIMIAN ASSET CONNECTOR]: No AssetServerURI configured"); | ||
186 | throw new InvalidOperationException(); | ||
187 | } | ||
188 | |||
221 | AssetBase asset = Get(id); | 189 | AssetBase asset = Get(id); |
222 | 190 | ||
223 | if (asset != null) | 191 | if (asset != null) |
@@ -255,7 +223,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
255 | Util.FireAndForget( | 223 | Util.FireAndForget( |
256 | delegate(object o) | 224 | delegate(object o) |
257 | { | 225 | { |
258 | AssetBase asset = GetRemote(id); | 226 | AssetBase asset = SimianGetOperation(id); |
259 | handler(id, sender, asset); | 227 | handler(id, sender, asset); |
260 | } | 228 | } |
261 | ); | 229 | ); |
@@ -278,7 +246,6 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
278 | } | 246 | } |
279 | 247 | ||
280 | bool storedInCache = false; | 248 | bool storedInCache = false; |
281 | string errorMessage = null; | ||
282 | 249 | ||
283 | // AssetID handling | 250 | // AssetID handling |
284 | if (String.IsNullOrEmpty(asset.ID) || asset.ID == ZeroID) | 251 | if (String.IsNullOrEmpty(asset.ID) || asset.ID == ZeroID) |
@@ -307,83 +274,9 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
307 | return asset.ID; | 274 | return asset.ID; |
308 | } | 275 | } |
309 | 276 | ||
310 | // Distinguish public and private assets | 277 | return SimianStoreOperation(asset); |
311 | bool isPublic = true; | ||
312 | switch ((AssetType)asset.Type) | ||
313 | { | ||
314 | case AssetType.CallingCard: | ||
315 | case AssetType.Gesture: | ||
316 | case AssetType.LSLBytecode: | ||
317 | case AssetType.LSLText: | ||
318 | isPublic = false; | ||
319 | break; | ||
320 | } | ||
321 | |||
322 | // Make sure ContentType is set | ||
323 | if (String.IsNullOrEmpty(asset.Metadata.ContentType)) | ||
324 | asset.Metadata.ContentType = SLUtil.SLAssetTypeToContentType(asset.Type); | ||
325 | |||
326 | // Build the remote storage request | ||
327 | List<MultipartForm.Element> postParameters = new List<MultipartForm.Element>() | ||
328 | { | ||
329 | new MultipartForm.Parameter("AssetID", asset.FullID.ToString()), | ||
330 | new MultipartForm.Parameter("CreatorID", asset.Metadata.CreatorID), | ||
331 | new MultipartForm.Parameter("Temporary", asset.Temporary ? "1" : "0"), | ||
332 | new MultipartForm.Parameter("Public", isPublic ? "1" : "0"), | ||
333 | new MultipartForm.File("Asset", asset.Name, asset.Metadata.ContentType, asset.Data) | ||
334 | }; | ||
335 | |||
336 | // Make the remote storage request | ||
337 | try | ||
338 | { | ||
339 | // Simian does not require the asset ID to be in the URL because it's in the post data. | ||
340 | // By appending it to the URL also, we allow caching proxies (squid) to invalidate asset URLs | ||
341 | HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(m_serverUrl + asset.FullID.ToString()); | ||
342 | |||
343 | using (HttpWebResponse response = MultipartForm.Post(request, postParameters)) | ||
344 | { | ||
345 | using (Stream responseStream = response.GetResponseStream()) | ||
346 | { | ||
347 | string responseStr = null; | ||
348 | |||
349 | try | ||
350 | { | ||
351 | responseStr = responseStream.GetStreamString(); | ||
352 | OSD responseOSD = OSDParser.Deserialize(responseStr); | ||
353 | if (responseOSD.Type == OSDType.Map) | ||
354 | { | ||
355 | OSDMap responseMap = (OSDMap)responseOSD; | ||
356 | if (responseMap["Success"].AsBoolean()) | ||
357 | return asset.ID; | ||
358 | else | ||
359 | errorMessage = "Upload failed: " + responseMap["Message"].AsString(); | ||
360 | } | ||
361 | else | ||
362 | { | ||
363 | errorMessage = "Response format was invalid:\n" + responseStr; | ||
364 | } | ||
365 | } | ||
366 | catch (Exception ex) | ||
367 | { | ||
368 | if (!String.IsNullOrEmpty(responseStr)) | ||
369 | errorMessage = "Failed to parse the response:\n" + responseStr; | ||
370 | else | ||
371 | errorMessage = "Failed to retrieve the response: " + ex.Message; | ||
372 | } | ||
373 | } | ||
374 | } | ||
375 | } | ||
376 | catch (WebException ex) | ||
377 | { | ||
378 | errorMessage = ex.Message; | ||
379 | } | ||
380 | |||
381 | m_log.WarnFormat("[SIMIAN ASSET CONNECTOR]: Failed to store asset \"{0}\" ({1}, {2}): {3}", | ||
382 | asset.Name, asset.ID, asset.Metadata.ContentType, errorMessage); | ||
383 | |||
384 | return null; | ||
385 | } | 278 | } |
386 | 279 | ||
387 | /// <summary> | 280 | /// <summary> |
388 | /// Update an asset's content | 281 | /// Update an asset's content |
389 | /// </summary> | 282 | /// </summary> |
@@ -393,11 +286,17 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
393 | /// <returns></returns> | 286 | /// <returns></returns> |
394 | public bool UpdateContent(string id, byte[] data) | 287 | public bool UpdateContent(string id, byte[] data) |
395 | { | 288 | { |
289 | if (String.IsNullOrEmpty(m_serverUrl)) | ||
290 | { | ||
291 | m_log.Error("[SIMIAN ASSET CONNECTOR]: No AssetServerURI configured"); | ||
292 | throw new InvalidOperationException(); | ||
293 | } | ||
294 | |||
396 | AssetBase asset = Get(id); | 295 | AssetBase asset = Get(id); |
397 | 296 | ||
398 | if (asset == null) | 297 | if (asset == null) |
399 | { | 298 | { |
400 | m_log.Warn("[SIMIAN ASSET CONNECTOR]: Failed to fetch asset " + id + " for updating"); | 299 | m_log.WarnFormat("[SIMIAN ASSET CONNECTOR]: Failed to fetch asset {0} for updating", id); |
401 | return false; | 300 | return false; |
402 | } | 301 | } |
403 | 302 | ||
@@ -420,83 +319,347 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
420 | throw new InvalidOperationException(); | 319 | throw new InvalidOperationException(); |
421 | } | 320 | } |
422 | 321 | ||
423 | //string errorMessage = String.Empty; | ||
424 | string url = m_serverUrl + id; | ||
425 | |||
426 | if (m_cache != null) | 322 | if (m_cache != null) |
427 | m_cache.Expire(id); | 323 | m_cache.Expire(id); |
428 | 324 | ||
325 | return SimianDeleteOperation(id); | ||
326 | } | ||
327 | |||
328 | #endregion IAssetService | ||
329 | |||
330 | #region SimianOperations | ||
331 | /// <summary> | ||
332 | /// Invokes the xRemoveAsset operation on the simian server to delete an asset | ||
333 | /// </summary> | ||
334 | /// <param name="id"></param> | ||
335 | /// <returns></returns> | ||
336 | private bool SimianDeleteOperation(string id) | ||
337 | { | ||
429 | try | 338 | try |
430 | { | 339 | { |
431 | HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(url); | 340 | NameValueCollection requestArgs = new NameValueCollection |
432 | request.Method = "DELETE"; | 341 | { |
342 | { "RequestMethod", "xRemoveAsset" }, | ||
343 | { "AssetID", id } | ||
344 | }; | ||
433 | 345 | ||
434 | using (HttpWebResponse response = (HttpWebResponse)request.GetResponse()) | 346 | OSDMap response = SimianGrid.PostToService(m_serverUrl,requestArgs); |
347 | if (! response["Success"].AsBoolean()) | ||
435 | { | 348 | { |
436 | if (response.StatusCode != HttpStatusCode.NoContent) | 349 | m_log.WarnFormat("[SIMIAN ASSET CONNECTOR]: failed to delete asset; {0}",response["Message"].AsString()); |
437 | { | 350 | return false; |
438 | m_log.Warn("[SIMIAN ASSET CONNECTOR]: Unexpected response when deleting asset " + url + ": " + | ||
439 | response.StatusCode + " (" + response.StatusDescription + ")"); | ||
440 | } | ||
441 | } | 351 | } |
442 | 352 | ||
443 | return true; | 353 | return true; |
354 | |||
444 | } | 355 | } |
445 | catch (Exception ex) | 356 | catch (Exception ex) |
446 | { | 357 | { |
447 | m_log.Warn("[SIMIAN ASSET CONNECTOR]: Failed to delete asset " + id + " from the asset service: " + ex.Message); | 358 | m_log.WarnFormat("[SIMIAN ASSET CONNECTOR]: failed to delete asset {0}; {1}", id, ex.Message); |
448 | return false; | ||
449 | } | 359 | } |
450 | } | ||
451 | 360 | ||
452 | #endregion IAssetService | 361 | return false; |
362 | } | ||
453 | 363 | ||
454 | private AssetBase GetRemote(string id) | 364 | /// <summary> |
365 | /// Invokes the xAddAsset operation on the simian server to create or update an asset | ||
366 | /// </summary> | ||
367 | /// <param name="id"></param> | ||
368 | /// <returns></returns> | ||
369 | private string SimianStoreOperation(AssetBase asset) | ||
455 | { | 370 | { |
456 | AssetBase asset = null; | 371 | try |
457 | Uri url; | 372 | { |
373 | NameValueCollection requestArgs = new NameValueCollection | ||
374 | { | ||
375 | { "RequestMethod", "xAddAsset" }, | ||
376 | { "ContentType", asset.Metadata.ContentType }, | ||
377 | { "EncodedData", Convert.ToBase64String(asset.Data) }, | ||
378 | { "AssetID", asset.FullID.ToString() }, | ||
379 | { "CreatorID", asset.Metadata.CreatorID }, | ||
380 | { "Temporary", asset.Temporary ? "1" : "0" }, | ||
381 | { "Name", asset.Name } | ||
382 | }; | ||
383 | |||
384 | OSDMap response = SimianGrid.PostToService(m_serverUrl,requestArgs); | ||
385 | if (! response["Success"].AsBoolean()) | ||
386 | { | ||
387 | m_log.WarnFormat("[SIMIAN ASSET CONNECTOR] failed to store asset; {0}",response["Message"].AsString()); | ||
388 | return null; | ||
389 | } | ||
458 | 390 | ||
459 | // Determine if id is an absolute URL or a grid-relative UUID | 391 | // asset.ID is always set before calling this function |
460 | if (!Uri.TryCreate(id, UriKind.Absolute, out url)) | 392 | return asset.ID; |
461 | url = new Uri(m_serverUrl + id); | 393 | |
394 | } | ||
395 | catch (Exception ex) | ||
396 | { | ||
397 | m_log.ErrorFormat("[SIMIAN ASSET CONNECTOR] failed to store asset; {0}",ex.Message); | ||
398 | } | ||
399 | |||
400 | return null; | ||
401 | } | ||
462 | 402 | ||
463 | try | 403 | /// <summary> |
404 | /// Invokes the xGetAsset operation on the simian server to get data associated with an asset | ||
405 | /// </summary> | ||
406 | /// <param name="id"></param> | ||
407 | /// <returns></returns> | ||
408 | private AssetBase SimianGetOperation(string id) | ||
409 | { | ||
410 | try | ||
464 | { | 411 | { |
465 | HttpWebRequest request = UntrustedHttpWebRequest.Create(url); | 412 | NameValueCollection requestArgs = new NameValueCollection |
413 | { | ||
414 | { "RequestMethod", "xGetAsset" }, | ||
415 | { "ID", id } | ||
416 | }; | ||
466 | 417 | ||
467 | using (WebResponse response = request.GetResponse()) | 418 | OSDMap response = SimianGrid.PostToService(m_serverUrl,requestArgs); |
419 | if (! response["Success"].AsBoolean()) | ||
468 | { | 420 | { |
469 | using (Stream responseStream = response.GetResponseStream()) | 421 | m_log.WarnFormat("[SIMIAN ASSET CONNECTOR] Failed to get asset; {0}",response["Message"].AsString()); |
470 | { | 422 | return null; |
471 | string creatorID = response.Headers.GetOne("X-Asset-Creator-Id") ?? String.Empty; | ||
472 | |||
473 | // Create the asset object | ||
474 | asset = new AssetBase(id, String.Empty, SLUtil.ContentTypeToSLAssetType(response.ContentType), creatorID); | ||
475 | |||
476 | UUID assetID; | ||
477 | if (UUID.TryParse(id, out assetID)) | ||
478 | asset.FullID = assetID; | ||
479 | |||
480 | // Grab the asset data from the response stream | ||
481 | using (MemoryStream stream = new MemoryStream()) | ||
482 | { | ||
483 | responseStream.CopyStream(stream, Int32.MaxValue); | ||
484 | asset.Data = stream.ToArray(); | ||
485 | } | ||
486 | } | ||
487 | } | 423 | } |
424 | |||
425 | AssetBase asset = new AssetBase(); | ||
488 | 426 | ||
489 | // Cache store | 427 | asset.ID = id; |
490 | if (m_cache != null && asset != null) | 428 | asset.Name = String.Empty; |
491 | m_cache.Cache(asset); | 429 | asset.Metadata.ContentType = response["ContentType"].AsString(); // this will also set the asset Type property |
430 | asset.CreatorID = response["CreatorID"].AsString(); | ||
431 | asset.Data = System.Convert.FromBase64String(response["EncodedData"].AsString()); | ||
432 | asset.Local = false; | ||
433 | asset.Temporary = response["Temporary"]; | ||
492 | 434 | ||
493 | return asset; | 435 | return asset; |
494 | } | 436 | } |
495 | catch (Exception ex) | 437 | catch (Exception ex) |
496 | { | 438 | { |
497 | m_log.Warn("[SIMIAN ASSET CONNECTOR]: Asset GET from " + url + " failed: " + ex.Message); | 439 | m_log.WarnFormat("[SIMIAN ASSET CONNECTOR]: failed to retrieve asset {0}; {1}", id, ex.Message); |
498 | return null; | ||
499 | } | 440 | } |
441 | |||
442 | return null; | ||
443 | } | ||
444 | |||
445 | /// <summary> | ||
446 | /// Invokes the xGetAssetMetadata operation on the simian server to retrieve metadata for an asset | ||
447 | /// This operation is generally used to determine if an asset exists in the database | ||
448 | /// </summary> | ||
449 | /// <param name="id"></param> | ||
450 | /// <returns></returns> | ||
451 | private AssetMetadata SimianGetMetadataOperation(string id) | ||
452 | { | ||
453 | try | ||
454 | { | ||
455 | NameValueCollection requestArgs = new NameValueCollection | ||
456 | { | ||
457 | { "RequestMethod", "xGetAssetMetadata" }, | ||
458 | { "ID", id } | ||
459 | }; | ||
460 | |||
461 | OSDMap response = SimianGrid.PostToService(m_serverUrl,requestArgs); | ||
462 | if (! response["Success"].AsBoolean()) | ||
463 | { | ||
464 | // this is not really an error, this call is used to test existence | ||
465 | // m_log.DebugFormat("[SIMIAN ASSET CONNECTOR] Failed to get asset metadata; {0}",response["Message"].AsString()); | ||
466 | return null; | ||
467 | } | ||
468 | |||
469 | AssetMetadata metadata = new AssetMetadata(); | ||
470 | metadata.ID = id; | ||
471 | metadata.ContentType = response["ContentType"].AsString(); | ||
472 | metadata.CreatorID = response["CreatorID"].AsString(); | ||
473 | metadata.Local = false; | ||
474 | metadata.Temporary = response["Temporary"]; | ||
475 | |||
476 | string lastModifiedStr = response["Last-Modified"].AsString(); | ||
477 | if (! String.IsNullOrEmpty(lastModifiedStr)) | ||
478 | { | ||
479 | DateTime lastModified; | ||
480 | if (DateTime.TryParse(lastModifiedStr, out lastModified)) | ||
481 | metadata.CreationDate = lastModified; | ||
482 | } | ||
483 | |||
484 | return metadata; | ||
485 | } | ||
486 | catch (Exception ex) | ||
487 | { | ||
488 | m_log.WarnFormat("[SIMIAN ASSET CONNECTOR]: Failed to get asset metadata; {0}", ex.Message); | ||
489 | } | ||
490 | |||
491 | return null; | ||
500 | } | 492 | } |
493 | #endregion | ||
494 | |||
495 | // private AssetMetadata GetRemoteMetadata(string id) | ||
496 | // { | ||
497 | // Uri url; | ||
498 | // AssetMetadata metadata = null; | ||
499 | |||
500 | // // Determine if id is an absolute URL or a grid-relative UUID | ||
501 | // if (!Uri.TryCreate(id, UriKind.Absolute, out url)) | ||
502 | // url = new Uri(m_serverUrl + id); | ||
503 | |||
504 | // try | ||
505 | // { | ||
506 | // HttpWebRequest request = UntrustedHttpWebRequest.Create(url); | ||
507 | // request.Method = "HEAD"; | ||
508 | |||
509 | // using (WebResponse response = request.GetResponse()) | ||
510 | // { | ||
511 | // using (Stream responseStream = response.GetResponseStream()) | ||
512 | // { | ||
513 | // // Create the metadata object | ||
514 | // metadata = new AssetMetadata(); | ||
515 | // metadata.ContentType = response.ContentType; | ||
516 | // metadata.ID = id; | ||
517 | |||
518 | // UUID uuid; | ||
519 | // if (UUID.TryParse(id, out uuid)) | ||
520 | // metadata.FullID = uuid; | ||
521 | |||
522 | // string lastModifiedStr = response.Headers.Get("Last-Modified"); | ||
523 | // if (!String.IsNullOrEmpty(lastModifiedStr)) | ||
524 | // { | ||
525 | // DateTime lastModified; | ||
526 | // if (DateTime.TryParse(lastModifiedStr, out lastModified)) | ||
527 | // metadata.CreationDate = lastModified; | ||
528 | // } | ||
529 | // } | ||
530 | // } | ||
531 | // } | ||
532 | // catch (Exception ex) | ||
533 | // { | ||
534 | // m_log.Warn("[SIMIAN ASSET CONNECTOR]: Asset HEAD from " + url + " failed: " + ex.Message); | ||
535 | // } | ||
536 | |||
537 | // return metadata; | ||
538 | // } | ||
539 | |||
540 | // private AssetBase GetRemote(string id) | ||
541 | // { | ||
542 | // AssetBase asset = null; | ||
543 | // Uri url; | ||
544 | |||
545 | // // Determine if id is an absolute URL or a grid-relative UUID | ||
546 | // if (!Uri.TryCreate(id, UriKind.Absolute, out url)) | ||
547 | // url = new Uri(m_serverUrl + id); | ||
548 | |||
549 | // try | ||
550 | // { | ||
551 | // HttpWebRequest request = UntrustedHttpWebRequest.Create(url); | ||
552 | |||
553 | // using (WebResponse response = request.GetResponse()) | ||
554 | // { | ||
555 | // using (Stream responseStream = response.GetResponseStream()) | ||
556 | // { | ||
557 | // string creatorID = response.Headers.GetOne("X-Asset-Creator-Id") ?? String.Empty; | ||
558 | |||
559 | // // Create the asset object | ||
560 | // asset = new AssetBase(id, String.Empty, SLUtil.ContentTypeToSLAssetType(response.ContentType), creatorID); | ||
561 | |||
562 | // UUID assetID; | ||
563 | // if (UUID.TryParse(id, out assetID)) | ||
564 | // asset.FullID = assetID; | ||
565 | |||
566 | // // Grab the asset data from the response stream | ||
567 | // using (MemoryStream stream = new MemoryStream()) | ||
568 | // { | ||
569 | // responseStream.CopyStream(stream, Int32.MaxValue); | ||
570 | // asset.Data = stream.ToArray(); | ||
571 | // } | ||
572 | // } | ||
573 | // } | ||
574 | |||
575 | // // Cache store | ||
576 | // if (m_cache != null && asset != null) | ||
577 | // m_cache.Cache(asset); | ||
578 | |||
579 | // return asset; | ||
580 | // } | ||
581 | // catch (Exception ex) | ||
582 | // { | ||
583 | // m_log.Warn("[SIMIAN ASSET CONNECTOR]: Asset GET from " + url + " failed: " + ex.Message); | ||
584 | // return null; | ||
585 | // } | ||
586 | // } | ||
587 | |||
588 | // private string StoreRemote(AssetBase asset) | ||
589 | // { | ||
590 | // // Distinguish public and private assets | ||
591 | // bool isPublic = true; | ||
592 | // switch ((AssetType)asset.Type) | ||
593 | // { | ||
594 | // case AssetType.CallingCard: | ||
595 | // case AssetType.Gesture: | ||
596 | // case AssetType.LSLBytecode: | ||
597 | // case AssetType.LSLText: | ||
598 | // isPublic = false; | ||
599 | // break; | ||
600 | // } | ||
601 | |||
602 | // string errorMessage = null; | ||
603 | |||
604 | // // Build the remote storage request | ||
605 | // List<MultipartForm.Element> postParameters = new List<MultipartForm.Element>() | ||
606 | // { | ||
607 | // new MultipartForm.Parameter("AssetID", asset.FullID.ToString()), | ||
608 | // new MultipartForm.Parameter("CreatorID", asset.Metadata.CreatorID), | ||
609 | // new MultipartForm.Parameter("Temporary", asset.Temporary ? "1" : "0"), | ||
610 | // new MultipartForm.Parameter("Public", isPublic ? "1" : "0"), | ||
611 | // new MultipartForm.File("Asset", asset.Name, asset.Metadata.ContentType, asset.Data) | ||
612 | // }; | ||
613 | |||
614 | // // Make the remote storage request | ||
615 | // try | ||
616 | // { | ||
617 | // // Simian does not require the asset ID to be in the URL because it's in the post data. | ||
618 | // // By appending it to the URL also, we allow caching proxies (squid) to invalidate asset URLs | ||
619 | // HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(m_serverUrl + asset.FullID.ToString()); | ||
620 | |||
621 | // using (HttpWebResponse response = MultipartForm.Post(request, postParameters)) | ||
622 | // { | ||
623 | // using (Stream responseStream = response.GetResponseStream()) | ||
624 | // { | ||
625 | // string responseStr = null; | ||
626 | |||
627 | // try | ||
628 | // { | ||
629 | // responseStr = responseStream.GetStreamString(); | ||
630 | // OSD responseOSD = OSDParser.Deserialize(responseStr); | ||
631 | // if (responseOSD.Type == OSDType.Map) | ||
632 | // { | ||
633 | // OSDMap responseMap = (OSDMap)responseOSD; | ||
634 | // if (responseMap["Success"].AsBoolean()) | ||
635 | // return asset.ID; | ||
636 | // else | ||
637 | // errorMessage = "Upload failed: " + responseMap["Message"].AsString(); | ||
638 | // } | ||
639 | // else | ||
640 | // { | ||
641 | // errorMessage = "Response format was invalid:\n" + responseStr; | ||
642 | // } | ||
643 | // } | ||
644 | // catch (Exception ex) | ||
645 | // { | ||
646 | // if (!String.IsNullOrEmpty(responseStr)) | ||
647 | // errorMessage = "Failed to parse the response:\n" + responseStr; | ||
648 | // else | ||
649 | // errorMessage = "Failed to retrieve the response: " + ex.Message; | ||
650 | // } | ||
651 | // } | ||
652 | // } | ||
653 | // } | ||
654 | // catch (WebException ex) | ||
655 | // { | ||
656 | // errorMessage = ex.Message; | ||
657 | // } | ||
658 | |||
659 | // m_log.WarnFormat("[SIMIAN ASSET CONNECTOR]: Failed to store asset \"{0}\" ({1}, {2}): {3}", | ||
660 | // asset.Name, asset.ID, asset.Metadata.ContentType, errorMessage); | ||
661 | |||
662 | // return null; | ||
663 | // } | ||
501 | } | 664 | } |
502 | } | 665 | } |
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianAuthenticationServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianAuthenticationServiceConnector.cs index 6603f6e..3bd11d9 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianAuthenticationServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianAuthenticationServiceConnector.cs | |||
@@ -110,7 +110,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
110 | { "UserID", principalID.ToString() } | 110 | { "UserID", principalID.ToString() } |
111 | }; | 111 | }; |
112 | 112 | ||
113 | OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs); | 113 | OSDMap response = SimianGrid.PostToService(m_serverUrl, requestArgs); |
114 | if (response["Success"].AsBoolean() && response["Identities"] is OSDArray) | 114 | if (response["Success"].AsBoolean() && response["Identities"] is OSDArray) |
115 | { | 115 | { |
116 | bool md5hashFound = false; | 116 | bool md5hashFound = false; |
@@ -153,7 +153,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
153 | { "SessionID", token } | 153 | { "SessionID", token } |
154 | }; | 154 | }; |
155 | 155 | ||
156 | OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs); | 156 | OSDMap response = SimianGrid.PostToService(m_serverUrl, requestArgs); |
157 | if (response["Success"].AsBoolean()) | 157 | if (response["Success"].AsBoolean()) |
158 | { | 158 | { |
159 | return true; | 159 | return true; |
@@ -175,7 +175,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
175 | { "UserID", principalID.ToString() } | 175 | { "UserID", principalID.ToString() } |
176 | }; | 176 | }; |
177 | 177 | ||
178 | OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs); | 178 | OSDMap response = SimianGrid.PostToService(m_serverUrl, requestArgs); |
179 | if (response["Success"].AsBoolean()) | 179 | if (response["Success"].AsBoolean()) |
180 | { | 180 | { |
181 | return true; | 181 | return true; |
@@ -198,7 +198,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
198 | { "UserID", principalID.ToString() } | 198 | { "UserID", principalID.ToString() } |
199 | }; | 199 | }; |
200 | 200 | ||
201 | OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs); | 201 | OSDMap response = SimianGrid.PostToService(m_serverUrl, requestArgs); |
202 | if (response["Success"].AsBoolean() && response["User"] is OSDMap) | 202 | if (response["Success"].AsBoolean() && response["User"] is OSDMap) |
203 | { | 203 | { |
204 | OSDMap userMap = (OSDMap)response["User"]; | 204 | OSDMap userMap = (OSDMap)response["User"]; |
@@ -218,7 +218,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
218 | { "UserID", principalID.ToString() } | 218 | { "UserID", principalID.ToString() } |
219 | }; | 219 | }; |
220 | 220 | ||
221 | response = WebUtil.PostToService(m_serverUrl, requestArgs); | 221 | response = SimianGrid.PostToService(m_serverUrl, requestArgs); |
222 | bool success = response["Success"].AsBoolean(); | 222 | bool success = response["Success"].AsBoolean(); |
223 | 223 | ||
224 | if (!success) | 224 | if (!success) |
@@ -297,7 +297,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
297 | { "UserID", userID.ToString() } | 297 | { "UserID", userID.ToString() } |
298 | }; | 298 | }; |
299 | 299 | ||
300 | OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs); | 300 | OSDMap response = SimianGrid.PostToService(m_serverUrl, requestArgs); |
301 | if (response["Success"].AsBoolean()) | 301 | if (response["Success"].AsBoolean()) |
302 | return response["SessionID"].AsUUID().ToString(); | 302 | return response["SessionID"].AsUUID().ToString(); |
303 | else | 303 | else |
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs index 841bfa0..a397740 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs | |||
@@ -122,7 +122,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
122 | { "UserID", userID.ToString() } | 122 | { "UserID", userID.ToString() } |
123 | }; | 123 | }; |
124 | 124 | ||
125 | OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs); | 125 | OSDMap response = SimianGrid.PostToService(m_serverUrl, requestArgs); |
126 | if (response["Success"].AsBoolean()) | 126 | if (response["Success"].AsBoolean()) |
127 | { | 127 | { |
128 | OSDMap map = null; | 128 | OSDMap map = null; |
@@ -168,7 +168,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
168 | { "LLPackedAppearance", OSDParser.SerializeJsonString(map) } | 168 | { "LLPackedAppearance", OSDParser.SerializeJsonString(map) } |
169 | }; | 169 | }; |
170 | 170 | ||
171 | OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs); | 171 | OSDMap response = SimianGrid.PostToService(m_serverUrl, requestArgs); |
172 | bool success = response["Success"].AsBoolean(); | 172 | bool success = response["Success"].AsBoolean(); |
173 | 173 | ||
174 | if (! success) | 174 | if (! success) |
@@ -189,7 +189,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
189 | { "UserID", userID.ToString() } | 189 | { "UserID", userID.ToString() } |
190 | }; | 190 | }; |
191 | 191 | ||
192 | OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs); | 192 | OSDMap response = SimianGrid.PostToService(m_serverUrl, requestArgs); |
193 | if (response["Success"].AsBoolean()) | 193 | if (response["Success"].AsBoolean()) |
194 | { | 194 | { |
195 | OSDMap map = null; | 195 | OSDMap map = null; |
@@ -306,7 +306,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
306 | { "LLAttachments", OSDParser.SerializeJsonString(items) } | 306 | { "LLAttachments", OSDParser.SerializeJsonString(items) } |
307 | }; | 307 | }; |
308 | 308 | ||
309 | OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs); | 309 | OSDMap response = SimianGrid.PostToService(m_serverUrl, requestArgs); |
310 | bool success = response["Success"].AsBoolean(); | 310 | bool success = response["Success"].AsBoolean(); |
311 | 311 | ||
312 | if (!success) | 312 | if (!success) |
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianFriendsServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianFriendsServiceConnector.cs index 7422d94..9a8164c 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianFriendsServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianFriendsServiceConnector.cs | |||
@@ -153,7 +153,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
153 | { "Value", flags.ToString() } | 153 | { "Value", flags.ToString() } |
154 | }; | 154 | }; |
155 | 155 | ||
156 | OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs); | 156 | OSDMap response = SimianGrid.PostToService(m_serverUrl, requestArgs); |
157 | bool success = response["Success"].AsBoolean(); | 157 | bool success = response["Success"].AsBoolean(); |
158 | 158 | ||
159 | if (!success) | 159 | if (!success) |
@@ -180,7 +180,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
180 | { "Key", friend } | 180 | { "Key", friend } |
181 | }; | 181 | }; |
182 | 182 | ||
183 | OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs); | 183 | OSDMap response = SimianGrid.PostToService(m_serverUrl, requestArgs); |
184 | bool success = response["Success"].AsBoolean(); | 184 | bool success = response["Success"].AsBoolean(); |
185 | 185 | ||
186 | if (!success) | 186 | if (!success) |
@@ -200,7 +200,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
200 | { "Type", "Friend" } | 200 | { "Type", "Friend" } |
201 | }; | 201 | }; |
202 | 202 | ||
203 | OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs); | 203 | OSDMap response = SimianGrid.PostToService(m_serverUrl, requestArgs); |
204 | if (response["Success"].AsBoolean() && response["Entries"] is OSDArray) | 204 | if (response["Success"].AsBoolean() && response["Entries"] is OSDArray) |
205 | { | 205 | { |
206 | return (OSDArray)response["Entries"]; | 206 | return (OSDArray)response["Entries"]; |
@@ -221,7 +221,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
221 | { "Type", "Friend" } | 221 | { "Type", "Friend" } |
222 | }; | 222 | }; |
223 | 223 | ||
224 | OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs); | 224 | OSDMap response = SimianGrid.PostToService(m_serverUrl, requestArgs); |
225 | if (response["Success"].AsBoolean() && response["Entries"] is OSDArray) | 225 | if (response["Success"].AsBoolean() && response["Entries"] is OSDArray) |
226 | { | 226 | { |
227 | return (OSDArray)response["Entries"]; | 227 | return (OSDArray)response["Entries"]; |
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianGrid.cs b/OpenSim/Services/Connectors/SimianGrid/SimianGrid.cs index 847319c..a4dd36c 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianGrid.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianGrid.cs | |||
@@ -26,8 +26,122 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | ||
30 | using System.Collections.Specialized; | ||
31 | using System.Reflection; | ||
32 | |||
33 | using log4net; | ||
29 | using Mono.Addins; | 34 | using Mono.Addins; |
30 | using Nini.Config; | 35 | using Nini.Config; |
31 | 36 | ||
37 | using OpenSim.Framework; | ||
38 | using OpenSim.Region.Framework.Interfaces; | ||
39 | using OpenSim.Region.Framework.Scenes; | ||
40 | using OpenSim.Services.Interfaces; | ||
41 | using OpenMetaverse; | ||
42 | using OpenMetaverse.StructuredData; | ||
43 | |||
32 | [assembly: Addin("SimianGrid", "1.0")] | 44 | [assembly: Addin("SimianGrid", "1.0")] |
33 | [assembly: AddinDependency("OpenSim", "0.5")] | 45 | [assembly: AddinDependency("OpenSim", "0.5")] |
46 | |||
47 | namespace OpenSim.Services.Connectors.SimianGrid | ||
48 | { | ||
49 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "SimianExternalCapsModule")] | ||
50 | public class SimianGrid : ISharedRegionModule | ||
51 | { | ||
52 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
53 | |||
54 | private IConfig m_config = null; | ||
55 | private bool m_enabled = true; | ||
56 | |||
57 | private String m_simianURL; | ||
58 | |||
59 | #region IRegionModule Members | ||
60 | |||
61 | public string Name | ||
62 | { | ||
63 | get { return this.GetType().Name; } | ||
64 | } | ||
65 | |||
66 | |||
67 | public void Initialise(IConfigSource config) | ||
68 | { | ||
69 | try | ||
70 | { | ||
71 | m_config = config.Configs["SimianGrid"]; | ||
72 | |||
73 | if (m_config != null) | ||
74 | { | ||
75 | m_simianURL = m_config.GetString("SimianServiceURL"); | ||
76 | if (String.IsNullOrEmpty(m_simianURL)) | ||
77 | m_log.ErrorFormat("[SimianGrid] service URL is not defined"); | ||
78 | |||
79 | InitialiseSimCap(); | ||
80 | SimulatorCapability = SimulatorCapability.Trim(); | ||
81 | m_log.WarnFormat("[SimianExternalCaps] using {0} as simulator capability",SimulatorCapability); | ||
82 | } | ||
83 | } | ||
84 | catch (Exception e) | ||
85 | { | ||
86 | m_log.ErrorFormat("[SimianExternalCaps] initialization error: {0}",e.Message); | ||
87 | return; | ||
88 | } | ||
89 | } | ||
90 | |||
91 | public void PostInitialise() { } | ||
92 | public void Close() { } | ||
93 | public void AddRegion(Scene scene) { } | ||
94 | public void RemoveRegion(Scene scene) { } | ||
95 | public void RegionLoaded(Scene scene) { } | ||
96 | |||
97 | public Type ReplaceableInterface | ||
98 | { | ||
99 | get { return null; } | ||
100 | } | ||
101 | |||
102 | ///<summary> | ||
103 | /// Try a variety of methods for finding the simian simulator capability; first check the | ||
104 | /// configuration itself, then look for a file that contains the cap, then finally look | ||
105 | /// for an environment variable that contains it. | ||
106 | ///</summary> | ||
107 | private void InitialiseSimCap() | ||
108 | { | ||
109 | if (m_config.Contains("SimulatorCapability")) | ||
110 | { | ||
111 | SimulatorCapability = m_config.GetString("SimulatorCapability"); | ||
112 | return; | ||
113 | } | ||
114 | |||
115 | if (m_config.Contains("SimulatorCapabilityFile")) | ||
116 | { | ||
117 | String filename = m_config.GetString("SimulatorCapabilityFile"); | ||
118 | if (System.IO.File.Exists(filename)) | ||
119 | { | ||
120 | SimulatorCapability = System.IO.File.ReadAllText(filename); | ||
121 | return; | ||
122 | } | ||
123 | } | ||
124 | |||
125 | if (m_config.Contains("SimulatorCapabilityVariable")) | ||
126 | { | ||
127 | String envname = m_config.GetString("SimulatorCapabilityVariable"); | ||
128 | String envvalue = System.Environment.GetEnvironmentVariable(envname); | ||
129 | if (envvalue != null) | ||
130 | { | ||
131 | SimulatorCapability = envvalue; | ||
132 | return; | ||
133 | } | ||
134 | } | ||
135 | |||
136 | m_log.WarnFormat("[SimianExternalCaps] no method specified for simulator capability"); | ||
137 | } | ||
138 | |||
139 | #endregion | ||
140 | public static String SimulatorCapability = UUID.Zero.ToString(); | ||
141 | public static OSDMap PostToService(string url, NameValueCollection data) | ||
142 | { | ||
143 | data["cap"] = SimulatorCapability; | ||
144 | return WebUtil.PostToService(url, data); | ||
145 | } | ||
146 | } | ||
147 | } | ||
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianGridMaptileModule.cs b/OpenSim/Services/Connectors/SimianGrid/SimianGridMaptileModule.cs index 93fdae3..b999509 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianGridMaptileModule.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianGridMaptileModule.cs | |||
@@ -27,6 +27,7 @@ | |||
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Collections.Specialized; | ||
30 | using System.Reflection; | 31 | using System.Reflection; |
31 | using System.Net; | 32 | using System.Net; |
32 | using System.IO; | 33 | using System.IO; |
@@ -43,7 +44,8 @@ using OpenSim.Region.Framework.Scenes; | |||
43 | using OpenMetaverse; | 44 | using OpenMetaverse; |
44 | using OpenMetaverse.StructuredData; | 45 | using OpenMetaverse.StructuredData; |
45 | 46 | ||
46 | namespace OpenSim.Region.OptionalModules.Simian | 47 | //namespace OpenSim.Region.OptionalModules.Simian |
48 | namespace OpenSim.Services.Connectors.SimianGrid | ||
47 | { | 49 | { |
48 | /// <summary> | 50 | /// <summary> |
49 | /// </summary> | 51 | /// </summary> |
@@ -196,67 +198,84 @@ namespace OpenSim.Region.OptionalModules.Simian | |||
196 | } | 198 | } |
197 | } | 199 | } |
198 | 200 | ||
199 | List<MultipartForm.Element> postParameters = new List<MultipartForm.Element>() | 201 | NameValueCollection requestArgs = new NameValueCollection |
202 | { | ||
203 | { "RequestMethod", "xAddMapTile" }, | ||
204 | { "X", scene.RegionInfo.RegionLocX.ToString() }, | ||
205 | { "Y", scene.RegionInfo.RegionLocY.ToString() }, | ||
206 | { "ContentType", "image/png" }, | ||
207 | { "EncodedData", System.Convert.ToBase64String(pngData) } | ||
208 | }; | ||
209 | |||
210 | OSDMap response = SimianGrid.PostToService(m_serverUrl,requestArgs); | ||
211 | if (! response["Success"].AsBoolean()) | ||
200 | { | 212 | { |
201 | new MultipartForm.Parameter("X", scene.RegionInfo.RegionLocX.ToString()), | 213 | m_log.WarnFormat("[SIMIAN MAPTILE] failed to store map tile; {0}",response["Message"].AsString()); |
202 | new MultipartForm.Parameter("Y", scene.RegionInfo.RegionLocY.ToString()), | 214 | return; |
203 | new MultipartForm.File("Tile", "tile.png", "image/png", pngData) | 215 | } |
204 | }; | ||
205 | 216 | ||
206 | string errorMessage = null; | 217 | // List<MultipartForm.Element> postParameters = new List<MultipartForm.Element>() |
207 | int tickstart = Util.EnvironmentTickCount(); | 218 | // { |
219 | // new MultipartForm.Parameter("X", scene.RegionInfo.RegionLocX.ToString()), | ||
220 | // new MultipartForm.Parameter("Y", scene.RegionInfo.RegionLocY.ToString()), | ||
221 | // new MultipartForm.File("Tile", "tile.png", "image/png", pngData) | ||
222 | // }; | ||
208 | 223 | ||
209 | // Make the remote storage request | 224 | // string errorMessage = null; |
210 | try | 225 | // int tickstart = Util.EnvironmentTickCount(); |
211 | { | ||
212 | HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(m_serverUrl); | ||
213 | request.Timeout = 20000; | ||
214 | request.ReadWriteTimeout = 5000; | ||
215 | 226 | ||
216 | using (HttpWebResponse response = MultipartForm.Post(request, postParameters)) | 227 | // // Make the remote storage request |
217 | { | 228 | // try |
218 | using (Stream responseStream = response.GetResponseStream()) | 229 | // { |
219 | { | 230 | // HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(m_serverUrl); |
220 | string responseStr = responseStream.GetStreamString(); | 231 | // request.Timeout = 20000; |
221 | OSD responseOSD = OSDParser.Deserialize(responseStr); | 232 | // request.ReadWriteTimeout = 5000; |
222 | if (responseOSD.Type == OSDType.Map) | ||
223 | { | ||
224 | OSDMap responseMap = (OSDMap)responseOSD; | ||
225 | if (responseMap["Success"].AsBoolean()) | ||
226 | return; | ||
227 | 233 | ||
228 | errorMessage = "Upload failed: " + responseMap["Message"].AsString(); | 234 | // using (HttpWebResponse response = MultipartForm.Post(request, postParameters)) |
229 | } | 235 | // { |
230 | else | 236 | // using (Stream responseStream = response.GetResponseStream()) |
231 | { | 237 | // { |
232 | errorMessage = "Response format was invalid:\n" + responseStr; | 238 | // string responseStr = responseStream.GetStreamString(); |
233 | } | 239 | // OSD responseOSD = OSDParser.Deserialize(responseStr); |
234 | } | 240 | // if (responseOSD.Type == OSDType.Map) |
235 | } | 241 | // { |
236 | } | 242 | // OSDMap responseMap = (OSDMap)responseOSD; |
237 | catch (WebException we) | 243 | // if (responseMap["Success"].AsBoolean()) |
238 | { | 244 | // return; |
239 | errorMessage = we.Message; | 245 | |
240 | if (we.Status == WebExceptionStatus.ProtocolError) | 246 | // errorMessage = "Upload failed: " + responseMap["Message"].AsString(); |
241 | { | 247 | // } |
242 | HttpWebResponse webResponse = (HttpWebResponse)we.Response; | 248 | // else |
243 | errorMessage = String.Format("[{0}] {1}", | 249 | // { |
244 | webResponse.StatusCode,webResponse.StatusDescription); | 250 | // errorMessage = "Response format was invalid:\n" + responseStr; |
245 | } | 251 | // } |
246 | } | 252 | // } |
247 | catch (Exception ex) | 253 | // } |
248 | { | 254 | // } |
249 | errorMessage = ex.Message; | 255 | // catch (WebException we) |
250 | } | 256 | // { |
251 | finally | 257 | // errorMessage = we.Message; |
252 | { | 258 | // if (we.Status == WebExceptionStatus.ProtocolError) |
253 | // This just dumps a warning for any operation that takes more than 100 ms | 259 | // { |
254 | int tickdiff = Util.EnvironmentTickCountSubtract(tickstart); | 260 | // HttpWebResponse webResponse = (HttpWebResponse)we.Response; |
255 | m_log.DebugFormat("[SIMIAN MAPTILE]: map tile uploaded in {0}ms",tickdiff); | 261 | // errorMessage = String.Format("[{0}] {1}", |
256 | } | 262 | // webResponse.StatusCode,webResponse.StatusDescription); |
263 | // } | ||
264 | // } | ||
265 | // catch (Exception ex) | ||
266 | // { | ||
267 | // errorMessage = ex.Message; | ||
268 | // } | ||
269 | // finally | ||
270 | // { | ||
271 | // // This just dumps a warning for any operation that takes more than 100 ms | ||
272 | // int tickdiff = Util.EnvironmentTickCountSubtract(tickstart); | ||
273 | // m_log.DebugFormat("[SIMIAN MAPTILE]: map tile uploaded in {0}ms",tickdiff); | ||
274 | // } | ||
275 | |||
276 | // m_log.WarnFormat("[SIMIAN MAPTILE]: Failed to store {0} byte tile for {1}: {2}", | ||
277 | // pngData.Length, scene.RegionInfo.RegionName, errorMessage); | ||
257 | 278 | ||
258 | m_log.WarnFormat("[SIMIAN MAPTILE]: Failed to store {0} byte tile for {1}: {2}", | ||
259 | pngData.Length, scene.RegionInfo.RegionName, errorMessage); | ||
260 | } | 279 | } |
261 | } | 280 | } |
262 | } \ No newline at end of file | 281 | } \ No newline at end of file |
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs index 038a4bf..bcc1e4a 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs | |||
@@ -129,7 +129,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
129 | { "ExtraData", OSDParser.SerializeJsonString(extraData) } | 129 | { "ExtraData", OSDParser.SerializeJsonString(extraData) } |
130 | }; | 130 | }; |
131 | 131 | ||
132 | OSDMap response = WebUtil.PostToService(m_ServerURI, requestArgs); | 132 | OSDMap response = SimianGrid.PostToService(m_ServerURI, requestArgs); |
133 | if (response["Success"].AsBoolean()) | 133 | if (response["Success"].AsBoolean()) |
134 | return String.Empty; | 134 | return String.Empty; |
135 | else | 135 | else |
@@ -145,7 +145,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
145 | { "Enabled", "0" } | 145 | { "Enabled", "0" } |
146 | }; | 146 | }; |
147 | 147 | ||
148 | OSDMap response = WebUtil.PostToService(m_ServerURI, requestArgs); | 148 | OSDMap response = SimianGrid.PostToService(m_ServerURI, requestArgs); |
149 | bool success = response["Success"].AsBoolean(); | 149 | bool success = response["Success"].AsBoolean(); |
150 | 150 | ||
151 | if (!success) | 151 | if (!success) |
@@ -192,7 +192,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
192 | 192 | ||
193 | // m_log.DebugFormat("[SIMIAN GRID CONNECTOR] request region with uuid {0}",regionID.ToString()); | 193 | // m_log.DebugFormat("[SIMIAN GRID CONNECTOR] request region with uuid {0}",regionID.ToString()); |
194 | 194 | ||
195 | OSDMap response = WebUtil.PostToService(m_ServerURI, requestArgs); | 195 | OSDMap response = SimianGrid.PostToService(m_ServerURI, requestArgs); |
196 | if (response["Success"].AsBoolean()) | 196 | if (response["Success"].AsBoolean()) |
197 | { | 197 | { |
198 | // m_log.DebugFormat("[SIMIAN GRID CONNECTOR] uuid request successful {0}",response["Name"].AsString()); | 198 | // m_log.DebugFormat("[SIMIAN GRID CONNECTOR] uuid request successful {0}",response["Name"].AsString()); |
@@ -220,7 +220,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
220 | 220 | ||
221 | // m_log.DebugFormat("[SIMIAN GRID CONNECTOR] request grid at {0}",position.ToString()); | 221 | // m_log.DebugFormat("[SIMIAN GRID CONNECTOR] request grid at {0}",position.ToString()); |
222 | 222 | ||
223 | OSDMap response = WebUtil.PostToService(m_ServerURI, requestArgs); | 223 | OSDMap response = SimianGrid.PostToService(m_ServerURI, requestArgs); |
224 | if (response["Success"].AsBoolean()) | 224 | if (response["Success"].AsBoolean()) |
225 | { | 225 | { |
226 | // m_log.DebugFormat("[SIMIAN GRID CONNECTOR] position request successful {0}",response["Name"].AsString()); | 226 | // m_log.DebugFormat("[SIMIAN GRID CONNECTOR] position request successful {0}",response["Name"].AsString()); |
@@ -261,7 +261,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
261 | 261 | ||
262 | // m_log.DebugFormat("[SIMIAN GRID CONNECTOR] request regions with name {0}",name); | 262 | // m_log.DebugFormat("[SIMIAN GRID CONNECTOR] request regions with name {0}",name); |
263 | 263 | ||
264 | OSDMap response = WebUtil.PostToService(m_ServerURI, requestArgs); | 264 | OSDMap response = SimianGrid.PostToService(m_ServerURI, requestArgs); |
265 | if (response["Success"].AsBoolean()) | 265 | if (response["Success"].AsBoolean()) |
266 | { | 266 | { |
267 | // m_log.DebugFormat("[SIMIAN GRID CONNECTOR] found regions with name {0}",name); | 267 | // m_log.DebugFormat("[SIMIAN GRID CONNECTOR] found regions with name {0}",name); |
@@ -299,7 +299,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
299 | //m_log.DebugFormat("[SIMIAN GRID CONNECTOR] request regions by range {0} to {1}",minPosition.ToString(),maxPosition.ToString()); | 299 | //m_log.DebugFormat("[SIMIAN GRID CONNECTOR] request regions by range {0} to {1}",minPosition.ToString(),maxPosition.ToString()); |
300 | 300 | ||
301 | 301 | ||
302 | OSDMap response = WebUtil.PostToService(m_ServerURI, requestArgs); | 302 | OSDMap response = SimianGrid.PostToService(m_ServerURI, requestArgs); |
303 | if (response["Success"].AsBoolean()) | 303 | if (response["Success"].AsBoolean()) |
304 | { | 304 | { |
305 | OSDArray array = response["Scenes"] as OSDArray; | 305 | OSDArray array = response["Scenes"] as OSDArray; |
@@ -350,7 +350,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
350 | { "Enabled", "1" } | 350 | { "Enabled", "1" } |
351 | }; | 351 | }; |
352 | 352 | ||
353 | OSDMap response = WebUtil.PostToService(m_ServerURI, requestArgs); | 353 | OSDMap response = SimianGrid.PostToService(m_ServerURI, requestArgs); |
354 | if (response["Success"].AsBoolean()) | 354 | if (response["Success"].AsBoolean()) |
355 | { | 355 | { |
356 | // m_log.DebugFormat("[SIMIAN GRID CONNECTOR] found regions with name {0}",name); | 356 | // m_log.DebugFormat("[SIMIAN GRID CONNECTOR] found regions with name {0}",name); |
@@ -380,7 +380,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
380 | 380 | ||
381 | m_log.DebugFormat("[SIMIAN GRID CONNECTOR] request region flags for {0}",regionID.ToString()); | 381 | m_log.DebugFormat("[SIMIAN GRID CONNECTOR] request region flags for {0}",regionID.ToString()); |
382 | 382 | ||
383 | OSDMap response = WebUtil.PostToService(m_ServerURI, requestArgs); | 383 | OSDMap response = SimianGrid.PostToService(m_ServerURI, requestArgs); |
384 | if (response["Success"].AsBoolean()) | 384 | if (response["Success"].AsBoolean()) |
385 | { | 385 | { |
386 | OSDMap extraData = response["ExtraData"] as OSDMap; | 386 | OSDMap extraData = response["ExtraData"] as OSDMap; |
@@ -410,7 +410,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
410 | if (onlyEnabled) | 410 | if (onlyEnabled) |
411 | requestArgs["Enabled"] = "1"; | 411 | requestArgs["Enabled"] = "1"; |
412 | 412 | ||
413 | OSDMap response = WebUtil.PostToService(m_ServerURI, requestArgs); | 413 | OSDMap response = SimianGrid.PostToService(m_ServerURI, requestArgs); |
414 | if (response["Success"].AsBoolean()) | 414 | if (response["Success"].AsBoolean()) |
415 | { | 415 | { |
416 | return ResponseToGridRegion(response); | 416 | return ResponseToGridRegion(response); |
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs index 36325ce..97eaabe 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs | |||
@@ -156,7 +156,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
156 | { "OwnerID", userID.ToString() } | 156 | { "OwnerID", userID.ToString() } |
157 | }; | 157 | }; |
158 | 158 | ||
159 | OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs); | 159 | OSDMap response = SimianGrid.PostToService(m_serverUrl, requestArgs); |
160 | bool success = response["Success"].AsBoolean(); | 160 | bool success = response["Success"].AsBoolean(); |
161 | 161 | ||
162 | if (!success) | 162 | if (!success) |
@@ -182,7 +182,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
182 | { "ChildrenOnly", "0" } | 182 | { "ChildrenOnly", "0" } |
183 | }; | 183 | }; |
184 | 184 | ||
185 | OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs); | 185 | OSDMap response = SimianGrid.PostToService(m_serverUrl, requestArgs); |
186 | if (response["Success"].AsBoolean() && response["Items"] is OSDArray) | 186 | if (response["Success"].AsBoolean() && response["Items"] is OSDArray) |
187 | { | 187 | { |
188 | OSDArray items = (OSDArray)response["Items"]; | 188 | OSDArray items = (OSDArray)response["Items"]; |
@@ -244,7 +244,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
244 | { "ChildrenOnly", "1" } | 244 | { "ChildrenOnly", "1" } |
245 | }; | 245 | }; |
246 | 246 | ||
247 | OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs); | 247 | OSDMap response = SimianGrid.PostToService(m_serverUrl, requestArgs); |
248 | if (response["Success"].AsBoolean() && response["Items"] is OSDArray) | 248 | if (response["Success"].AsBoolean() && response["Items"] is OSDArray) |
249 | { | 249 | { |
250 | OSDArray items = (OSDArray)response["Items"]; | 250 | OSDArray items = (OSDArray)response["Items"]; |
@@ -274,7 +274,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
274 | { "OwnerID", userID.ToString() } | 274 | { "OwnerID", userID.ToString() } |
275 | }; | 275 | }; |
276 | 276 | ||
277 | OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs); | 277 | OSDMap response = SimianGrid.PostToService(m_serverUrl, requestArgs); |
278 | if (response["Success"].AsBoolean() && response["Folder"] is OSDMap) | 278 | if (response["Success"].AsBoolean() && response["Folder"] is OSDMap) |
279 | { | 279 | { |
280 | OSDMap folder = (OSDMap)response["Folder"]; | 280 | OSDMap folder = (OSDMap)response["Folder"]; |
@@ -312,7 +312,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
312 | { "ChildrenOnly", "1" } | 312 | { "ChildrenOnly", "1" } |
313 | }; | 313 | }; |
314 | 314 | ||
315 | OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs); | 315 | OSDMap response = SimianGrid.PostToService(m_serverUrl, requestArgs); |
316 | if (response["Success"].AsBoolean() && response["Items"] is OSDArray) | 316 | if (response["Success"].AsBoolean() && response["Items"] is OSDArray) |
317 | { | 317 | { |
318 | List<InventoryItemBase> items = GetItemsFromResponse((OSDArray)response["Items"]); | 318 | List<InventoryItemBase> items = GetItemsFromResponse((OSDArray)response["Items"]); |
@@ -349,7 +349,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
349 | { "ChildrenOnly", "1" } | 349 | { "ChildrenOnly", "1" } |
350 | }; | 350 | }; |
351 | 351 | ||
352 | OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs); | 352 | OSDMap response = SimianGrid.PostToService(m_serverUrl, requestArgs); |
353 | if (response["Success"].AsBoolean() && response["Items"] is OSDArray) | 353 | if (response["Success"].AsBoolean() && response["Items"] is OSDArray) |
354 | { | 354 | { |
355 | OSDArray items = (OSDArray)response["Items"]; | 355 | OSDArray items = (OSDArray)response["Items"]; |
@@ -383,7 +383,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
383 | { "ChildrenOnly", "1" } | 383 | { "ChildrenOnly", "1" } |
384 | }; | 384 | }; |
385 | 385 | ||
386 | OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs); | 386 | OSDMap response = SimianGrid.PostToService(m_serverUrl, requestArgs); |
387 | if (response["Success"].AsBoolean() && response["Items"] is OSDArray) | 387 | if (response["Success"].AsBoolean() && response["Items"] is OSDArray) |
388 | { | 388 | { |
389 | OSDArray items = (OSDArray)response["Items"]; | 389 | OSDArray items = (OSDArray)response["Items"]; |
@@ -423,7 +423,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
423 | { "ChildrenOnly", "1" } | 423 | { "ChildrenOnly", "1" } |
424 | }; | 424 | }; |
425 | 425 | ||
426 | OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs); | 426 | OSDMap response = SimianGrid.PostToService(m_serverUrl, requestArgs); |
427 | if (response["Success"].AsBoolean() && response["Items"] is OSDArray) | 427 | if (response["Success"].AsBoolean() && response["Items"] is OSDArray) |
428 | { | 428 | { |
429 | OSDArray items = (OSDArray)response["Items"]; | 429 | OSDArray items = (OSDArray)response["Items"]; |
@@ -454,7 +454,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
454 | { "ContentType", SLUtil.SLAssetTypeToContentType(folder.Type) } | 454 | { "ContentType", SLUtil.SLAssetTypeToContentType(folder.Type) } |
455 | }; | 455 | }; |
456 | 456 | ||
457 | OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs); | 457 | OSDMap response = SimianGrid.PostToService(m_serverUrl, requestArgs); |
458 | bool success = response["Success"].AsBoolean(); | 458 | bool success = response["Success"].AsBoolean(); |
459 | 459 | ||
460 | if (!success) | 460 | if (!success) |
@@ -518,7 +518,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
518 | { "ItemID", itemID.ToString() } | 518 | { "ItemID", itemID.ToString() } |
519 | }; | 519 | }; |
520 | 520 | ||
521 | OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs); | 521 | OSDMap response = SimianGrid.PostToService(m_serverUrl, requestArgs); |
522 | bool success = response["Success"].AsBoolean(); | 522 | bool success = response["Success"].AsBoolean(); |
523 | 523 | ||
524 | if (!success) | 524 | if (!success) |
@@ -546,7 +546,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
546 | { "FolderID", folder.ID.ToString() } | 546 | { "FolderID", folder.ID.ToString() } |
547 | }; | 547 | }; |
548 | 548 | ||
549 | OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs); | 549 | OSDMap response = SimianGrid.PostToService(m_serverUrl, requestArgs); |
550 | bool success = response["Success"].AsBoolean(); | 550 | bool success = response["Success"].AsBoolean(); |
551 | 551 | ||
552 | if (!success) | 552 | if (!success) |
@@ -623,7 +623,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
623 | { "ExtraData", OSDParser.SerializeJsonString(extraData) } | 623 | { "ExtraData", OSDParser.SerializeJsonString(extraData) } |
624 | }; | 624 | }; |
625 | 625 | ||
626 | OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs); | 626 | OSDMap response = SimianGrid.PostToService(m_serverUrl, requestArgs); |
627 | bool success = response["Success"].AsBoolean(); | 627 | bool success = response["Success"].AsBoolean(); |
628 | 628 | ||
629 | if (!success) | 629 | if (!success) |
@@ -847,7 +847,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
847 | { "Items", String.Join(",", itemIDs) } | 847 | { "Items", String.Join(",", itemIDs) } |
848 | }; | 848 | }; |
849 | 849 | ||
850 | OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs); | 850 | OSDMap response = SimianGrid.PostToService(m_serverUrl, requestArgs); |
851 | bool success = response["Success"].AsBoolean(); | 851 | bool success = response["Success"].AsBoolean(); |
852 | 852 | ||
853 | if (!success) | 853 | if (!success) |
@@ -885,7 +885,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
885 | { "UserID", userID.ToString() } | 885 | { "UserID", userID.ToString() } |
886 | }; | 886 | }; |
887 | 887 | ||
888 | OSDMap response = WebUtil.PostToService(m_userServerUrl, requestArgs); | 888 | OSDMap response = SimianGrid.PostToService(m_userServerUrl, requestArgs); |
889 | if (response["Success"].AsBoolean()) | 889 | if (response["Success"].AsBoolean()) |
890 | { | 890 | { |
891 | OSDMap user = response["User"] as OSDMap; | 891 | OSDMap user = response["User"] as OSDMap; |
@@ -916,7 +916,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
916 | { "Gestures", OSDParser.SerializeJsonString(gestures) } | 916 | { "Gestures", OSDParser.SerializeJsonString(gestures) } |
917 | }; | 917 | }; |
918 | 918 | ||
919 | OSDMap response = WebUtil.PostToService(m_userServerUrl, requestArgs); | 919 | OSDMap response = SimianGrid.PostToService(m_userServerUrl, requestArgs); |
920 | if (!response["Success"].AsBoolean()) | 920 | if (!response["Success"].AsBoolean()) |
921 | { | 921 | { |
922 | m_log.Warn("[SIMIAN INVENTORY CONNECTOR]: Failed to save active gestures for " + userID + ": " + | 922 | m_log.Warn("[SIMIAN INVENTORY CONNECTOR]: Failed to save active gestures for " + userID + ": " + |
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs index 01163aa..211b775 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs | |||
@@ -149,7 +149,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
149 | requestArgs["SecureSessionID"] = secureSessionID.ToString(); | 149 | requestArgs["SecureSessionID"] = secureSessionID.ToString(); |
150 | } | 150 | } |
151 | 151 | ||
152 | OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs); | 152 | OSDMap response = SimianGrid.PostToService(m_serverUrl, requestArgs); |
153 | bool success = response["Success"].AsBoolean(); | 153 | bool success = response["Success"].AsBoolean(); |
154 | 154 | ||
155 | if (!success) | 155 | if (!success) |
@@ -168,7 +168,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
168 | { "SessionID", sessionID.ToString() } | 168 | { "SessionID", sessionID.ToString() } |
169 | }; | 169 | }; |
170 | 170 | ||
171 | OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs); | 171 | OSDMap response = SimianGrid.PostToService(m_serverUrl, requestArgs); |
172 | bool success = response["Success"].AsBoolean(); | 172 | bool success = response["Success"].AsBoolean(); |
173 | 173 | ||
174 | if (!success) | 174 | if (!success) |
@@ -187,7 +187,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
187 | { "SceneID", regionID.ToString() } | 187 | { "SceneID", regionID.ToString() } |
188 | }; | 188 | }; |
189 | 189 | ||
190 | OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs); | 190 | OSDMap response = SimianGrid.PostToService(m_serverUrl, requestArgs); |
191 | bool success = response["Success"].AsBoolean(); | 191 | bool success = response["Success"].AsBoolean(); |
192 | 192 | ||
193 | if (!success) | 193 | if (!success) |
@@ -232,7 +232,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
232 | { "UserIDList", String.Join(",",userIDs) } | 232 | { "UserIDList", String.Join(",",userIDs) } |
233 | }; | 233 | }; |
234 | 234 | ||
235 | OSDMap sessionListResponse = WebUtil.PostToService(m_serverUrl, requestArgs); | 235 | OSDMap sessionListResponse = SimianGrid.PostToService(m_serverUrl, requestArgs); |
236 | if (! sessionListResponse["Success"].AsBoolean()) | 236 | if (! sessionListResponse["Success"].AsBoolean()) |
237 | { | 237 | { |
238 | m_log.WarnFormat("[SIMIAN PRESENCE CONNECTOR]: Failed to retrieve sessions: {0}",sessionListResponse["Message"].AsString()); | 238 | m_log.WarnFormat("[SIMIAN PRESENCE CONNECTOR]: Failed to retrieve sessions: {0}",sessionListResponse["Message"].AsString()); |
@@ -275,7 +275,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
275 | { "LastLocation", SerializeLocation(regionID, lastPosition, lastLookAt) } | 275 | { "LastLocation", SerializeLocation(regionID, lastPosition, lastLookAt) } |
276 | }; | 276 | }; |
277 | 277 | ||
278 | OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs); | 278 | OSDMap response = SimianGrid.PostToService(m_serverUrl, requestArgs); |
279 | bool success = response["Success"].AsBoolean(); | 279 | bool success = response["Success"].AsBoolean(); |
280 | 280 | ||
281 | if (!success) | 281 | if (!success) |
@@ -295,7 +295,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
295 | { "HomeLocation", SerializeLocation(regionID, position, lookAt) } | 295 | { "HomeLocation", SerializeLocation(regionID, position, lookAt) } |
296 | }; | 296 | }; |
297 | 297 | ||
298 | OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs); | 298 | OSDMap response = SimianGrid.PostToService(m_serverUrl, requestArgs); |
299 | bool success = response["Success"].AsBoolean(); | 299 | bool success = response["Success"].AsBoolean(); |
300 | 300 | ||
301 | if (!success) | 301 | if (!success) |
@@ -340,7 +340,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
340 | { "UserID", userID.ToString() } | 340 | { "UserID", userID.ToString() } |
341 | }; | 341 | }; |
342 | 342 | ||
343 | OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs); | 343 | OSDMap response = SimianGrid.PostToService(m_serverUrl, requestArgs); |
344 | if (response["Success"].AsBoolean() && response["User"] is OSDMap) | 344 | if (response["Success"].AsBoolean() && response["User"] is OSDMap) |
345 | return response; | 345 | return response; |
346 | 346 | ||
@@ -356,7 +356,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
356 | { "SessionID", sessionID.ToString() } | 356 | { "SessionID", sessionID.ToString() } |
357 | }; | 357 | }; |
358 | 358 | ||
359 | OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs); | 359 | OSDMap response = SimianGrid.PostToService(m_serverUrl, requestArgs); |
360 | if (response["Success"].AsBoolean()) | 360 | if (response["Success"].AsBoolean()) |
361 | return response; | 361 | return response; |
362 | 362 | ||
@@ -376,7 +376,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
376 | { "SceneLookAt", lastLookAt.ToString() } | 376 | { "SceneLookAt", lastLookAt.ToString() } |
377 | }; | 377 | }; |
378 | 378 | ||
379 | OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs); | 379 | OSDMap response = SimianGrid.PostToService(m_serverUrl, requestArgs); |
380 | bool success = response["Success"].AsBoolean(); | 380 | bool success = response["Success"].AsBoolean(); |
381 | 381 | ||
382 | if (!success) | 382 | if (!success) |
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianProfiles.cs b/OpenSim/Services/Connectors/SimianGrid/SimianProfiles.cs index bd8069f..684a0db 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianProfiles.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianProfiles.cs | |||
@@ -392,7 +392,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
392 | { "UserID", client.AgentId.ToString() } | 392 | { "UserID", client.AgentId.ToString() } |
393 | }; | 393 | }; |
394 | 394 | ||
395 | OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs); | 395 | OSDMap response = SimianGrid.PostToService(m_serverUrl, requestArgs); |
396 | string email = response["Email"].AsString(); | 396 | string email = response["Email"].AsString(); |
397 | 397 | ||
398 | if (!response["Success"].AsBoolean()) | 398 | if (!response["Success"].AsBoolean()) |
@@ -443,7 +443,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
443 | { key, OSDParser.SerializeJsonString(value) } | 443 | { key, OSDParser.SerializeJsonString(value) } |
444 | }; | 444 | }; |
445 | 445 | ||
446 | OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs); | 446 | OSDMap response = SimianGrid.PostToService(m_serverUrl, requestArgs); |
447 | bool success = response["Success"].AsBoolean(); | 447 | bool success = response["Success"].AsBoolean(); |
448 | 448 | ||
449 | if (!success) | 449 | if (!success) |
@@ -462,7 +462,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
462 | { "UserID", userID.ToString() } | 462 | { "UserID", userID.ToString() } |
463 | }; | 463 | }; |
464 | 464 | ||
465 | OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs); | 465 | OSDMap response = SimianGrid.PostToService(m_serverUrl, requestArgs); |
466 | if (response["Success"].AsBoolean() && response["User"] is OSDMap) | 466 | if (response["Success"].AsBoolean() && response["User"] is OSDMap) |
467 | { | 467 | { |
468 | return (OSDMap)response["User"]; | 468 | return (OSDMap)response["User"]; |
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs index 6e32b3a..7e36c69 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs | |||
@@ -165,7 +165,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
165 | { "NameQuery", query } | 165 | { "NameQuery", query } |
166 | }; | 166 | }; |
167 | 167 | ||
168 | OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs); | 168 | OSDMap response = SimianGrid.PostToService(m_serverUrl, requestArgs); |
169 | if (response["Success"].AsBoolean()) | 169 | if (response["Success"].AsBoolean()) |
170 | { | 170 | { |
171 | OSDArray array = response["Users"] as OSDArray; | 171 | OSDArray array = response["Users"] as OSDArray; |
@@ -204,7 +204,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
204 | { "AccessLevel", data.UserLevel.ToString() } | 204 | { "AccessLevel", data.UserLevel.ToString() } |
205 | }; | 205 | }; |
206 | 206 | ||
207 | OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs); | 207 | OSDMap response = SimianGrid.PostToService(m_serverUrl, requestArgs); |
208 | 208 | ||
209 | if (response["Success"].AsBoolean()) | 209 | if (response["Success"].AsBoolean()) |
210 | { | 210 | { |
@@ -219,7 +219,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
219 | { "UserTitle", data.UserTitle } | 219 | { "UserTitle", data.UserTitle } |
220 | }; | 220 | }; |
221 | 221 | ||
222 | response = WebUtil.PostToService(m_serverUrl, requestArgs); | 222 | response = SimianGrid.PostToService(m_serverUrl, requestArgs); |
223 | bool success = response["Success"].AsBoolean(); | 223 | bool success = response["Success"].AsBoolean(); |
224 | 224 | ||
225 | if (success) | 225 | if (success) |
@@ -252,7 +252,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
252 | string lookupValue = (requestArgs.Count > 1) ? requestArgs[1] : "(Unknown)"; | 252 | string lookupValue = (requestArgs.Count > 1) ? requestArgs[1] : "(Unknown)"; |
253 | // m_log.DebugFormat("[SIMIAN ACCOUNT CONNECTOR]: Looking up user account with query: " + lookupValue); | 253 | // m_log.DebugFormat("[SIMIAN ACCOUNT CONNECTOR]: Looking up user account with query: " + lookupValue); |
254 | 254 | ||
255 | OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs); | 255 | OSDMap response = SimianGrid.PostToService(m_serverUrl, requestArgs); |
256 | if (response["Success"].AsBoolean()) | 256 | if (response["Success"].AsBoolean()) |
257 | { | 257 | { |
258 | OSDMap user = response["User"] as OSDMap; | 258 | OSDMap user = response["User"] as OSDMap; |