aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services/Connectors
diff options
context:
space:
mode:
authorDiva Canto2010-04-30 11:39:02 -0700
committerDiva Canto2010-04-30 11:39:02 -0700
commit5fda81e6bbb80cbe904e69638f5f405aca78f111 (patch)
tree670c850e7481a05398f93ae37460771fbd74863f /OpenSim/Services/Connectors
parenttake out some debug logging in the sqlite db adaptor (diff)
downloadopensim-SC_OLD-5fda81e6bbb80cbe904e69638f5f405aca78f111.zip
opensim-SC_OLD-5fda81e6bbb80cbe904e69638f5f405aca78f111.tar.gz
opensim-SC_OLD-5fda81e6bbb80cbe904e69638f5f405aca78f111.tar.bz2
opensim-SC_OLD-5fda81e6bbb80cbe904e69638f5f405aca78f111.tar.xz
* XInventory fairly tested, including for HG. Almost ready to switch.
* Removed a few buglets and added better exception handling.
Diffstat (limited to 'OpenSim/Services/Connectors')
-rw-r--r--OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs119
-rw-r--r--OpenSim/Services/Connectors/Presence/PresenceServiceConnector.cs2
2 files changed, 55 insertions, 66 deletions
diff --git a/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs b/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs
index 52294da..e25e7eb 100644
--- a/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs
+++ b/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs
@@ -158,30 +158,31 @@ namespace OpenSim.Services.Connectors
158 158
159 public InventoryCollection GetFolderContent(UUID principalID, UUID folderID) 159 public InventoryCollection GetFolderContent(UUID principalID, UUID folderID)
160 { 160 {
161 Dictionary<string,object> ret = MakeRequest("GETFOLDERCONTENT",
162 new Dictionary<string,object> {
163 { "PRINCIPAL", principalID.ToString() },
164 { "FOLDER", folderID.ToString() }
165 });
166
167 if (ret == null)
168 return null;
169 if (ret.Count == 0)
170 return null;
171
172
173 InventoryCollection inventory = new InventoryCollection(); 161 InventoryCollection inventory = new InventoryCollection();
174 inventory.Folders = new List<InventoryFolderBase>();
175 inventory.Items = new List<InventoryItemBase>();
176 inventory.UserID = principalID;
177 162
178 Dictionary<string,object> folders =
179 (Dictionary<string,object>)ret["FOLDERS"];
180 Dictionary<string,object> items =
181 (Dictionary<string,object>)ret["ITEMS"];
182
183 try 163 try
184 { 164 {
165 Dictionary<string,object> ret = MakeRequest("GETFOLDERCONTENT",
166 new Dictionary<string,object> {
167 { "PRINCIPAL", principalID.ToString() },
168 { "FOLDER", folderID.ToString() }
169 });
170
171 if (ret == null)
172 return null;
173 if (ret.Count == 0)
174 return null;
175
176
177 inventory.Folders = new List<InventoryFolderBase>();
178 inventory.Items = new List<InventoryItemBase>();
179 inventory.UserID = principalID;
180
181 Dictionary<string,object> folders =
182 (Dictionary<string,object>)ret["FOLDERS"];
183 Dictionary<string,object> items =
184 (Dictionary<string,object>)ret["ITEMS"];
185
185 foreach (Object o in folders.Values) // getting the values directly, we don't care about the keys folder_i 186 foreach (Object o in folders.Values) // getting the values directly, we don't care about the keys folder_i
186 inventory.Folders.Add(BuildFolder((Dictionary<string, object>)o)); 187 inventory.Folders.Add(BuildFolder((Dictionary<string, object>)o));
187 foreach (Object o in items.Values) // getting the values directly, we don't care about the keys item_i 188 foreach (Object o in items.Values) // getting the values directly, we don't care about the keys item_i
@@ -189,7 +190,7 @@ namespace OpenSim.Services.Connectors
189 } 190 }
190 catch (Exception e) 191 catch (Exception e)
191 { 192 {
192 m_log.DebugFormat("[XINVENTORY CONNECTOR STUB]: Exception unwrapping content list: {0}", e.Message); 193 m_log.DebugFormat("[XINVENTORY CONNECTOR STUB]: Exception in GetFolderContent: {0}", e.Message);
193 } 194 }
194 195
195 return inventory; 196 return inventory;
@@ -408,32 +409,50 @@ namespace OpenSim.Services.Connectors
408 409
409 public InventoryItemBase GetItem(InventoryItemBase item) 410 public InventoryItemBase GetItem(InventoryItemBase item)
410 { 411 {
411 Dictionary<string,object> ret = MakeRequest("GETITEM", 412 try
412 new Dictionary<string,object> { 413 {
414 Dictionary<string, object> ret = MakeRequest("GETITEM",
415 new Dictionary<string, object> {
413 { "ID", item.ID.ToString() } 416 { "ID", item.ID.ToString() }
414 }); 417 });
415 418
416 if (ret == null) 419 if (ret == null)
417 return null; 420 return null;
418 if (ret.Count == 0) 421 if (ret.Count == 0)
419 return null; 422 return null;
423
424 return BuildItem((Dictionary<string, object>)ret["item"]);
425 }
426 catch (Exception e)
427 {
428 m_log.DebugFormat("[XINVENTORY CONNECTOR STUB]: Exception in GetItem: {0}", e.Message);
429 }
420 430
421 return BuildItem((Dictionary<string, object>)ret["item"]); 431 return null;
422 } 432 }
423 433
424 public InventoryFolderBase GetFolder(InventoryFolderBase folder) 434 public InventoryFolderBase GetFolder(InventoryFolderBase folder)
425 { 435 {
426 Dictionary<string,object> ret = MakeRequest("GETFOLDER", 436 try
427 new Dictionary<string,object> { 437 {
438 Dictionary<string, object> ret = MakeRequest("GETFOLDER",
439 new Dictionary<string, object> {
428 { "ID", folder.ID.ToString() } 440 { "ID", folder.ID.ToString() }
429 }); 441 });
430 442
431 if (ret == null) 443 if (ret == null)
432 return null; 444 return null;
433 if (ret.Count == 0) 445 if (ret.Count == 0)
434 return null; 446 return null;
435 447
436 return BuildFolder((Dictionary<string, object>)ret["folder"]); 448 return BuildFolder((Dictionary<string, object>)ret["folder"]);
449 }
450 catch (Exception e)
451 {
452 m_log.DebugFormat("[XINVENTORY CONNECTOR STUB]: Exception in GetFolder: {0}", e.Message);
453 }
454
455 return null;
437 } 456 }
438 457
439 public List<InventoryItemBase> GetActiveGestures(UUID principalID) 458 public List<InventoryItemBase> GetActiveGestures(UUID principalID)
@@ -468,36 +487,6 @@ namespace OpenSim.Services.Connectors
468 return int.Parse(ret["RESULT"].ToString()); 487 return int.Parse(ret["RESULT"].ToString());
469 } 488 }
470 489
471 public Dictionary<AssetType, InventoryFolderBase> GetSystemFolders(UUID userID)
472 {
473 Dictionary<string, object> ret = MakeRequest("GETSYSTEMFOLDERS",
474 new Dictionary<string, object> {
475 { "PRINCIPAL", userID.ToString() },
476 });
477
478 if (ret == null)
479 return new Dictionary<AssetType,InventoryFolderBase>();
480
481 Dictionary<AssetType, InventoryFolderBase> sfolders = new Dictionary<AssetType, InventoryFolderBase>();
482
483 try
484 {
485 Dictionary<string, object> folders = (Dictionary<string, object>)ret["FOLDERS"];
486
487 foreach (Object o in folders.Values) // getting the values directly, we don't care about the keys folder_i
488 {
489 InventoryFolderBase folder = BuildFolder((Dictionary<string, object>)o);
490 sfolders.Add((AssetType)folder.Type, folder);
491 }
492
493 }
494 catch (Exception e)
495 {
496 m_log.DebugFormat("[XINVENTORY CONNECTOR STUB]: exception {0}", e.Message);
497 }
498
499 return sfolders;
500 }
501 490
502 // These are either obsolete or unused 491 // These are either obsolete or unused
503 // 492 //
diff --git a/OpenSim/Services/Connectors/Presence/PresenceServiceConnector.cs b/OpenSim/Services/Connectors/Presence/PresenceServiceConnector.cs
index 4dadd9e..23621b7 100644
--- a/OpenSim/Services/Connectors/Presence/PresenceServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Presence/PresenceServiceConnector.cs
@@ -329,7 +329,7 @@ namespace OpenSim.Services.Connectors
329 reqString); 329 reqString);
330 if (reply == null || (reply != null && reply == string.Empty)) 330 if (reply == null || (reply != null && reply == string.Empty))
331 { 331 {
332 m_log.DebugFormat("[PRESENCE CONNECTOR]: GetAgent received null or empty reply"); 332 m_log.DebugFormat("[PRESENCE CONNECTOR]: GetAgents received null or empty reply");
333 return null; 333 return null;
334 } 334 }
335 } 335 }