aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorMelanie Thielker2009-03-21 17:46:58 +0000
committerMelanie Thielker2009-03-21 17:46:58 +0000
commit1121a214b9258487dae0d84dad1a0b495d2f80bd (patch)
tree10576cab4d44bbe39f4f759f8ffac68530e40055 /OpenSim
parentMove a check for null PhysActor in applyImpulse so that attachments can move ... (diff)
downloadopensim-SC_OLD-1121a214b9258487dae0d84dad1a0b495d2f80bd.zip
opensim-SC_OLD-1121a214b9258487dae0d84dad1a0b495d2f80bd.tar.gz
opensim-SC_OLD-1121a214b9258487dae0d84dad1a0b495d2f80bd.tar.bz2
opensim-SC_OLD-1121a214b9258487dae0d84dad1a0b495d2f80bd.tar.xz
Add a QueryItem method to the inventory subsystem. Currently implemented for
MySQL only, stubs for the others. This allows updating the cache with a single item from the database.
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Data/IInventoryData.cs6
-rw-r--r--OpenSim/Data/MSSQL/MSSQLInventoryData.cs5
-rw-r--r--OpenSim/Data/MySQL/MySQLInventoryData.cs5
-rw-r--r--OpenSim/Data/NHibernate/NHibernateInventoryData.cs5
-rw-r--r--OpenSim/Data/SQLite/SQLiteInventoryStore.cs5
-rw-r--r--OpenSim/Framework/Communications/Cache/CachedUserInfo.cs42
-rw-r--r--OpenSim/Framework/Communications/IInventoryServices.cs8
-rw-r--r--OpenSim/Framework/Communications/InventoryServiceBase.cs14
-rw-r--r--OpenSim/Grid/InventoryServer/Main.cs4
-rw-r--r--OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs16
-rw-r--r--OpenSim/Tests/Common/Mock/TestInventoryDataPlugin.cs5
11 files changed, 115 insertions, 0 deletions
diff --git a/OpenSim/Data/IInventoryData.cs b/OpenSim/Data/IInventoryData.cs
index 03b1cbe..84a857c 100644
--- a/OpenSim/Data/IInventoryData.cs
+++ b/OpenSim/Data/IInventoryData.cs
@@ -109,6 +109,12 @@ namespace OpenSim.Data
109 void deleteInventoryItem(UUID item); 109 void deleteInventoryItem(UUID item);
110 110
111 /// <summary> 111 /// <summary>
112 ///
113 /// </summary>
114 /// <param name="item"></param>
115 InventoryItemBase queryInventoryItem(UUID item);
116
117 /// <summary>
112 /// Adds a new folder specified by folder 118 /// Adds a new folder specified by folder
113 /// </summary> 119 /// </summary>
114 /// <param name="folder">The inventory folder</param> 120 /// <param name="folder">The inventory folder</param>
diff --git a/OpenSim/Data/MSSQL/MSSQLInventoryData.cs b/OpenSim/Data/MSSQL/MSSQLInventoryData.cs
index 348682c..3d25ed0 100644
--- a/OpenSim/Data/MSSQL/MSSQLInventoryData.cs
+++ b/OpenSim/Data/MSSQL/MSSQLInventoryData.cs
@@ -530,6 +530,11 @@ namespace OpenSim.Data.MSSQL
530 } 530 }
531 } 531 }
532 532
533 public InventoryItemBase queryInventoryItem(UUID itemID)
534 {
535 return null;
536 }
537
533 /// <summary> 538 /// <summary>
534 /// Returns all activated gesture-items in the inventory of the specified avatar. 539 /// Returns all activated gesture-items in the inventory of the specified avatar.
535 /// </summary> 540 /// </summary>
diff --git a/OpenSim/Data/MySQL/MySQLInventoryData.cs b/OpenSim/Data/MySQL/MySQLInventoryData.cs
index 7d29061..1a6f068 100644
--- a/OpenSim/Data/MySQL/MySQLInventoryData.cs
+++ b/OpenSim/Data/MySQL/MySQLInventoryData.cs
@@ -539,6 +539,11 @@ namespace OpenSim.Data.MySQL
539 } 539 }
540 } 540 }
541 541
542 public InventoryItemBase queryInventoryItem(UUID itemID)
543 {
544 return getInventoryItem(itemID);
545 }
546
542 /// <summary> 547 /// <summary>
543 /// Creates a new inventory folder 548 /// Creates a new inventory folder
544 /// </summary> 549 /// </summary>
diff --git a/OpenSim/Data/NHibernate/NHibernateInventoryData.cs b/OpenSim/Data/NHibernate/NHibernateInventoryData.cs
index 612ab59..74f6eae 100644
--- a/OpenSim/Data/NHibernate/NHibernateInventoryData.cs
+++ b/OpenSim/Data/NHibernate/NHibernateInventoryData.cs
@@ -177,6 +177,11 @@ namespace OpenSim.Data.NHibernate
177 177
178 } 178 }
179 179
180 public InventoryItemBase queryInventoryItem(UUID itemID)
181 {
182 return null;
183 }
184
180 /// <summary> 185 /// <summary>
181 /// Returns an inventory folder by its UUID 186 /// Returns an inventory folder by its UUID
182 /// </summary> 187 /// </summary>
diff --git a/OpenSim/Data/SQLite/SQLiteInventoryStore.cs b/OpenSim/Data/SQLite/SQLiteInventoryStore.cs
index 6391c6d..3be320f 100644
--- a/OpenSim/Data/SQLite/SQLiteInventoryStore.cs
+++ b/OpenSim/Data/SQLite/SQLiteInventoryStore.cs
@@ -618,6 +618,11 @@ namespace OpenSim.Data.SQLite
618 } 618 }
619 } 619 }
620 620
621 public InventoryItemBase queryInventoryItem(UUID itemID)
622 {
623 return null;
624 }
625
621 /// <summary> 626 /// <summary>
622 /// Delete all items in the specified folder 627 /// Delete all items in the specified folder
623 /// </summary> 628 /// </summary>
diff --git a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs
index c5bbd6a..57c3ece 100644
--- a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs
+++ b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs
@@ -36,6 +36,7 @@ namespace OpenSim.Framework.Communications.Cache
36 internal delegate void AddItemDelegate(InventoryItemBase itemInfo); 36 internal delegate void AddItemDelegate(InventoryItemBase itemInfo);
37 internal delegate void UpdateItemDelegate(InventoryItemBase itemInfo); 37 internal delegate void UpdateItemDelegate(InventoryItemBase itemInfo);
38 internal delegate void DeleteItemDelegate(UUID itemID); 38 internal delegate void DeleteItemDelegate(UUID itemID);
39 internal delegate void QueryItemDelegate(UUID itemID);
39 40
40 internal delegate void CreateFolderDelegate(string folderName, UUID folderID, ushort folderType, UUID parentID); 41 internal delegate void CreateFolderDelegate(string folderName, UUID folderID, ushort folderType, UUID parentID);
41 internal delegate void MoveFolderDelegate(UUID folderID, UUID parentID); 42 internal delegate void MoveFolderDelegate(UUID folderID, UUID parentID);
@@ -767,6 +768,47 @@ namespace OpenSim.Framework.Communications.Cache
767 768
768 return RootFolder.FindFolderForType(type); 769 return RootFolder.FindFolderForType(type);
769 } 770 }
771
772 // Load additional items that other regions have put into the database
773 // The item will be added tot he local cache. Returns true if the item
774 // was found and can be sent to the client
775 //
776 public bool QueryItem(UUID itemID)
777 {
778 if (m_hasReceivedInventory)
779 {
780 InventoryItemBase item = RootFolder.FindItem(itemID);
781
782 if (item != null)
783 {
784 // Item is in local cache, just update client
785 //
786 return true;
787 }
788
789 InventoryItemBase itemInfo = m_commsManager.InventoryService.QueryItem(item);
790 if (itemInfo != null)
791 {
792 InventoryFolderImpl folder = RootFolder.FindFolder(itemInfo.Folder);
793 ItemReceive(itemInfo, folder);
794 return true;
795 }
796
797 return false;
798 }
799 else
800 {
801 AddRequest(
802 new InventoryRequest(
803 Delegate.CreateDelegate(typeof(QueryItemDelegate), this, "QueryItem"),
804 new object[] { itemID }));
805
806 return true;
807 }
808
809 return false;
810 }
811
770 } 812 }
771 813
772 /// <summary> 814 /// <summary>
diff --git a/OpenSim/Framework/Communications/IInventoryServices.cs b/OpenSim/Framework/Communications/IInventoryServices.cs
index aead3be..fc9d8af 100644
--- a/OpenSim/Framework/Communications/IInventoryServices.cs
+++ b/OpenSim/Framework/Communications/IInventoryServices.cs
@@ -105,6 +105,14 @@ namespace OpenSim.Framework.Communications
105 bool DeleteItem(InventoryItemBase item); 105 bool DeleteItem(InventoryItemBase item);
106 106
107 /// <summary> 107 /// <summary>
108 /// Query the server for an item that may have been added by
109 /// another region
110 /// </summary>
111 /// <param name="item"></param>
112 /// <returns>true if the item was found in local cache</returns>
113 InventoryItemBase QueryItem(InventoryItemBase item);
114
115 /// <summary>
108 /// Does the given user have an inventory structure? 116 /// Does the given user have an inventory structure?
109 /// </summary> 117 /// </summary>
110 /// <param name="userID"></param> 118 /// <param name="userID"></param>
diff --git a/OpenSim/Framework/Communications/InventoryServiceBase.cs b/OpenSim/Framework/Communications/InventoryServiceBase.cs
index 8068080..cad7989 100644
--- a/OpenSim/Framework/Communications/InventoryServiceBase.cs
+++ b/OpenSim/Framework/Communications/InventoryServiceBase.cs
@@ -278,6 +278,20 @@ namespace OpenSim.Framework.Communications
278 return true; 278 return true;
279 } 279 }
280 280
281 public virtual InventoryItemBase QueryItem(InventoryItemBase item)
282 {
283 foreach (IInventoryDataPlugin plugin in m_plugins)
284 {
285 InventoryItemBase result = plugin.queryInventoryItem(item.ID);
286 if (result != null)
287 {
288 return result;
289 }
290 }
291
292 return null;
293 }
294
281 /// <summary> 295 /// <summary>
282 /// Purge a folder of all items items and subfolders. 296 /// Purge a folder of all items items and subfolders.
283 /// 297 ///
diff --git a/OpenSim/Grid/InventoryServer/Main.cs b/OpenSim/Grid/InventoryServer/Main.cs
index 8ca7c3d..70bfe60 100644
--- a/OpenSim/Grid/InventoryServer/Main.cs
+++ b/OpenSim/Grid/InventoryServer/Main.cs
@@ -127,6 +127,10 @@ namespace OpenSim.Grid.InventoryServer
127 new RestDeserialiseSecureHandler<InventoryItemBase, bool>( 127 new RestDeserialiseSecureHandler<InventoryItemBase, bool>(
128 "POST", "/DeleteItem/", m_inventoryService.DeleteItem, m_inventoryService.CheckAuthSession)); 128 "POST", "/DeleteItem/", m_inventoryService.DeleteItem, m_inventoryService.CheckAuthSession));
129 129
130 m_httpServer.AddStreamHandler(
131 new RestDeserialiseSecureHandler<InventoryItemBase, InventoryItemBase>(
132 "POST", "/QueryItem/", m_inventoryService.QueryItem, m_inventoryService.CheckAuthSession));
133
130 // WARNING: Root folders no longer just delivers the root and immediate child folders (e.g 134 // WARNING: Root folders no longer just delivers the root and immediate child folders (e.g
131 // system folders such as Objects, Textures), but it now returns the entire inventory skeleton. 135 // system folders such as Objects, Textures), but it now returns the entire inventory skeleton.
132 // It would have been better to rename this request, but complexities in the BaseHttpServer 136 // It would have been better to rename this request, but complexities in the BaseHttpServer
diff --git a/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs b/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs
index 49d5938..56566a8 100644
--- a/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs
+++ b/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs
@@ -296,6 +296,22 @@ namespace OpenSim.Region.Communications.OGS1
296 return false; 296 return false;
297 } 297 }
298 298
299 public InventoryItemBase QueryItem(InventoryItemBase item)
300 {
301 try
302 {
303 return SynchronousRestObjectPoster.BeginPostObject<InventoryItemBase, InventoryItemBase>(
304 "POST", _inventoryServerUrl + "/QueryItem/", item);
305 }
306 catch (WebException e)
307 {
308 m_log.ErrorFormat("[OGS1 INVENTORY SERVICE]: Query inventory item operation failed, {0} {1}",
309 e.Source, e.Message);
310 }
311
312 return null;
313 }
314
299 public bool HasInventoryForUser(UUID userID) 315 public bool HasInventoryForUser(UUID userID)
300 { 316 {
301 return false; 317 return false;
diff --git a/OpenSim/Tests/Common/Mock/TestInventoryDataPlugin.cs b/OpenSim/Tests/Common/Mock/TestInventoryDataPlugin.cs
index 59d923c..69b0917 100644
--- a/OpenSim/Tests/Common/Mock/TestInventoryDataPlugin.cs
+++ b/OpenSim/Tests/Common/Mock/TestInventoryDataPlugin.cs
@@ -115,6 +115,11 @@ namespace OpenSim.Tests.Common.Mock
115 public void updateInventoryItem(InventoryItemBase item) {} 115 public void updateInventoryItem(InventoryItemBase item) {}
116 public void deleteInventoryItem(UUID item) {} 116 public void deleteInventoryItem(UUID item) {}
117 117
118 public InventoryItemBase queryInventoryItem(UUID item)
119 {
120 return null;
121 }
122
118 public void addInventoryFolder(InventoryFolderBase folder) 123 public void addInventoryFolder(InventoryFolderBase folder)
119 { 124 {
120 m_folders[folder.ID] = folder; 125 m_folders[folder.ID] = folder;