aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authordiva2009-06-08 03:09:24 +0000
committerdiva2009-06-08 03:09:24 +0000
commit16d50032741925c34176da0cca153e7b7de6e325 (patch)
treea6dca99e7ce2537dbe45a2c759fd6941890f92dd /OpenSim
parentFirst draft of inventory service connectors, and service implementation. No h... (diff)
downloadopensim-SC-16d50032741925c34176da0cca153e7b7de6e325.zip
opensim-SC-16d50032741925c34176da0cca153e7b7de6e325.tar.gz
opensim-SC-16d50032741925c34176da0cca153e7b7de6e325.tar.bz2
opensim-SC-16d50032741925c34176da0cca153e7b7de6e325.tar.xz
Added more functions to IInventoryService. Unsure about whether all of these are really necessary.
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectors/Inventory/HGInventoryBroker.cs31
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectors/Inventory/LocalInventoryServiceConnector.cs27
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectors/Inventory/RemoteInventoryServiceConnector.cs25
-rw-r--r--OpenSim/Services/Interfaces/IInventoryService.cs35
-rw-r--r--OpenSim/Services/InventoryService/InventoryService.cs73
5 files changed, 185 insertions, 6 deletions
diff --git a/OpenSim/Region/CoreModules/ServiceConnectors/Inventory/HGInventoryBroker.cs b/OpenSim/Region/CoreModules/ServiceConnectors/Inventory/HGInventoryBroker.cs
index f4cd269..3a0011f 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectors/Inventory/HGInventoryBroker.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectors/Inventory/HGInventoryBroker.cs
@@ -159,6 +159,27 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Inventory
159 159
160 #region IInventoryService 160 #region IInventoryService
161 161
162 public bool CreateUserInventory(UUID userID)
163 {
164 if (IsLocalGridUser(userID))
165 return m_GridService.CreateUserInventory(userID);
166 else
167 return false;
168 }
169
170 public List<InventoryFolderBase> GetInventorySkeleton(UUID userId)
171 {
172 return new List<InventoryFolderBase>();
173 }
174
175 public InventoryCollection GetUserInventory(UUID userID)
176 {
177 if (IsLocalGridUser(userID))
178 return m_GridService.GetUserInventory(userID);
179 else
180 return null;
181 }
182
162 public void GetUserInventory(UUID userID, InventoryReceiptCallback callback) 183 public void GetUserInventory(UUID userID, InventoryReceiptCallback callback)
163 { 184 {
164 if (IsLocalGridUser(userID)) 185 if (IsLocalGridUser(userID))
@@ -171,6 +192,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Inventory
171 } 192 }
172 } 193 }
173 194
195 public List<InventoryItemBase> GetFolderItems(UUID folderID)
196 {
197 return new List<InventoryItemBase>();
198 }
199
174 public bool AddFolder(InventoryFolderBase folder) 200 public bool AddFolder(InventoryFolderBase folder)
175 { 201 {
176 if (folder == null) 202 if (folder == null)
@@ -316,6 +342,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Inventory
316 return null; 342 return null;
317 } 343 }
318 344
345 public List<InventoryItemBase> GetActiveGestures(UUID userId)
346 {
347 return new List<InventoryItemBase>();
348 }
349
319 #endregion 350 #endregion
320 351
321 private UUID GetSessionID(UUID userID) 352 private UUID GetSessionID(UUID userID)
diff --git a/OpenSim/Region/CoreModules/ServiceConnectors/Inventory/LocalInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectors/Inventory/LocalInventoryServiceConnector.cs
index 3db08eb..c89f295 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectors/Inventory/LocalInventoryServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectors/Inventory/LocalInventoryServiceConnector.cs
@@ -137,11 +137,33 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Inventory
137 137
138 } 138 }
139 139
140 #region IInventoryService
141
142 public bool CreateUserInventory(UUID user)
143 {
144 return m_InventoryService.CreateUserInventory(user);
145 }
146
147 public List<InventoryFolderBase> GetInventorySkeleton(UUID userId)
148 {
149 return m_InventoryService.GetInventorySkeleton(userId);
150 }
151
152 public InventoryCollection GetUserInventory(UUID id)
153 {
154 return m_InventoryService.GetUserInventory(id);
155 }
156
140 public void GetUserInventory(UUID userID, InventoryReceiptCallback callback) 157 public void GetUserInventory(UUID userID, InventoryReceiptCallback callback)
141 { 158 {
142 m_InventoryService.GetUserInventory(userID, callback); 159 m_InventoryService.GetUserInventory(userID, callback);
143 } 160 }
144 161
162 public List<InventoryItemBase> GetFolderItems(UUID folderID)
163 {
164 return m_InventoryService.GetFolderItems(folderID);
165 }
166
145 /// <summary> 167 /// <summary>
146 /// Add a new folder to the user's inventory 168 /// Add a new folder to the user's inventory
147 /// </summary> 169 /// </summary>
@@ -242,5 +264,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Inventory
242 return m_InventoryService.RequestRootFolder(userID); 264 return m_InventoryService.RequestRootFolder(userID);
243 } 265 }
244 266
267 public List<InventoryItemBase> GetActiveGestures(UUID userId)
268 {
269 return m_InventoryService.GetActiveGestures(userId);
270 }
271 #endregion IInventoryService
245 } 272 }
246} 273}
diff --git a/OpenSim/Region/CoreModules/ServiceConnectors/Inventory/RemoteInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectors/Inventory/RemoteInventoryServiceConnector.cs
index ddb6cff..b695fce 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectors/Inventory/RemoteInventoryServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectors/Inventory/RemoteInventoryServiceConnector.cs
@@ -122,6 +122,21 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Inventory
122 122
123 #region IInventoryService 123 #region IInventoryService
124 124
125 public bool CreateUserInventory(UUID user)
126 {
127 return false;
128 }
129
130 public List<InventoryFolderBase> GetInventorySkeleton(UUID userId)
131 {
132 return new List<InventoryFolderBase>();
133 }
134
135 public InventoryCollection GetUserInventory(UUID userID)
136 {
137 return null;
138 }
139
125 public void GetUserInventory(UUID userID, InventoryReceiptCallback callback) 140 public void GetUserInventory(UUID userID, InventoryReceiptCallback callback)
126 { 141 {
127 UUID sessionID = GetSessionID(userID); 142 UUID sessionID = GetSessionID(userID);
@@ -140,6 +155,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Inventory
140 155
141 } 156 }
142 157
158 public List<InventoryItemBase> GetFolderItems(UUID folderID)
159 {
160 return new List<InventoryItemBase>();
161 }
162
143 public bool AddFolder(InventoryFolderBase folder) 163 public bool AddFolder(InventoryFolderBase folder)
144 { 164 {
145 if (folder == null) 165 if (folder == null)
@@ -231,6 +251,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Inventory
231 return null; 251 return null;
232 } 252 }
233 253
254 public List<InventoryItemBase> GetActiveGestures(UUID userId)
255 {
256 return new List<InventoryItemBase>();
257 }
258
234 #endregion 259 #endregion
235 260
236 private UUID GetSessionID(UUID userID) 261 private UUID GetSessionID(UUID userID)
diff --git a/OpenSim/Services/Interfaces/IInventoryService.cs b/OpenSim/Services/Interfaces/IInventoryService.cs
index 9fe419f..8757744 100644
--- a/OpenSim/Services/Interfaces/IInventoryService.cs
+++ b/OpenSim/Services/Interfaces/IInventoryService.cs
@@ -41,6 +41,27 @@ namespace OpenSim.Services.Interfaces
41 public interface IInventoryService 41 public interface IInventoryService
42 { 42 {
43 /// <summary> 43 /// <summary>
44 /// Create the entire inventory for a given user
45 /// </summary>
46 /// <param name="user"></param>
47 /// <returns></returns>
48 bool CreateUserInventory(UUID user);
49
50 /// <summary>
51 /// Gets the skeleton of the inventory -- folders only
52 /// </summary>
53 /// <param name="userId"></param>
54 /// <returns></returns>
55 List<InventoryFolderBase> GetInventorySkeleton(UUID userId);
56
57 /// <summary>
58 /// Synchronous inventory fetch.
59 /// </summary>
60 /// <param name="userID"></param>
61 /// <returns></returns>
62 InventoryCollection GetUserInventory(UUID userID);
63
64 /// <summary>
44 /// Request the inventory for a user. This is an asynchronous operation that will call the callback when the 65 /// Request the inventory for a user. This is an asynchronous operation that will call the callback when the
45 /// inventory has been received 66 /// inventory has been received
46 /// </summary> 67 /// </summary>
@@ -49,6 +70,13 @@ namespace OpenSim.Services.Interfaces
49 void GetUserInventory(UUID userID, InventoryReceiptCallback callback); 70 void GetUserInventory(UUID userID, InventoryReceiptCallback callback);
50 71
51 /// <summary> 72 /// <summary>
73 /// Gets the items inside a folder
74 /// </summary>
75 /// <param name="folderID"></param>
76 /// <returns></returns>
77 List<InventoryItemBase> GetFolderItems(UUID folderID);
78
79 /// <summary>
52 /// Add a new folder to the user's inventory 80 /// Add a new folder to the user's inventory
53 /// </summary> 81 /// </summary>
54 /// <param name="folder"></param> 82 /// <param name="folder"></param>
@@ -114,5 +142,12 @@ namespace OpenSim.Services.Interfaces
114 /// <param name="userID"></param> 142 /// <param name="userID"></param>
115 /// <returns>null if no root folder was found</returns> 143 /// <returns>null if no root folder was found</returns>
116 InventoryFolderBase RequestRootFolder(UUID userID); 144 InventoryFolderBase RequestRootFolder(UUID userID);
145
146 /// <summary>
147 /// Get the active gestures of the agent.
148 /// </summary>
149 /// <param name="userId"></param>
150 /// <returns></returns>
151 List<InventoryItemBase> GetActiveGestures(UUID userId);
117 } 152 }
118} 153}
diff --git a/OpenSim/Services/InventoryService/InventoryService.cs b/OpenSim/Services/InventoryService/InventoryService.cs
index b4e2549..f2a7b41 100644
--- a/OpenSim/Services/InventoryService/InventoryService.cs
+++ b/OpenSim/Services/InventoryService/InventoryService.cs
@@ -85,7 +85,6 @@ namespace OpenSim.Services.InventoryService
85 return userFolders; 85 return userFolders;
86 } 86 }
87 87
88 // See IInventoryServices
89 public virtual bool HasInventoryForUser(UUID userID) 88 public virtual bool HasInventoryForUser(UUID userID)
90 { 89 {
91 return false; 90 return false;
@@ -107,7 +106,7 @@ namespace OpenSim.Services.InventoryService
107 } 106 }
108 107
109 // See IInventoryServices 108 // See IInventoryServices
110 public bool CreateNewUserInventory(UUID user) 109 public bool CreateUserInventory(UUID user)
111 { 110 {
112 InventoryFolderBase existingRootFolder = RequestRootFolder(user); 111 InventoryFolderBase existingRootFolder = RequestRootFolder(user);
113 112
@@ -131,6 +130,68 @@ namespace OpenSim.Services.InventoryService
131 } 130 }
132 131
133 // See IInventoryServices 132 // See IInventoryServices
133
134 /// <summary>
135 /// Return a user's entire inventory synchronously
136 /// </summary>
137 /// <param name="rawUserID"></param>
138 /// <returns>The user's inventory. If an inventory cannot be found then an empty collection is returned.</returns>
139 public InventoryCollection GetUserInventory(UUID userID)
140 {
141 m_log.InfoFormat("[LOCAL INVENTORY SERVICE]: Processing request for inventory of {0}", userID);
142
143 // Uncomment me to simulate a slow responding inventory server
144 //Thread.Sleep(16000);
145
146 InventoryCollection invCollection = new InventoryCollection();
147
148 List<InventoryFolderBase> allFolders = GetInventorySkeleton(userID);
149
150 if (null == allFolders)
151 {
152 m_log.WarnFormat("[LOCAL INVENTORY SERVICE]: No inventory found for user {0}", userID);
153
154 return invCollection;
155 }
156
157 List<InventoryItemBase> allItems = new List<InventoryItemBase>();
158
159 foreach (InventoryFolderBase folder in allFolders)
160 {
161 List<InventoryItemBase> items = GetFolderItems(folder.ID);
162
163 if (items != null)
164 {
165 allItems.InsertRange(0, items);
166 }
167 }
168
169 invCollection.UserID = userID;
170 invCollection.Folders = allFolders;
171 invCollection.Items = allItems;
172
173 // foreach (InventoryFolderBase folder in invCollection.Folders)
174 // {
175 // m_log.DebugFormat("[GRID AGENT INVENTORY]: Sending back folder {0} {1}", folder.Name, folder.ID);
176 // }
177 //
178 // foreach (InventoryItemBase item in invCollection.Items)
179 // {
180 // m_log.DebugFormat("[GRID AGENT INVENTORY]: Sending back item {0} {1}, folder {2}", item.Name, item.ID, item.Folder);
181 // }
182
183 m_log.InfoFormat(
184 "[LOCAL INVENTORY SERVICE]: Sending back inventory response to user {0} containing {1} folders and {2} items",
185 invCollection.UserID, invCollection.Folders.Count, invCollection.Items.Count);
186
187 return invCollection;
188 }
189
190 /// <summary>
191 /// Asynchronous inventory fetch.
192 /// </summary>
193 /// <param name="userID"></param>
194 /// <param name="callback"></param>
134 public void GetUserInventory(UUID userID, InventoryReceiptCallback callback) 195 public void GetUserInventory(UUID userID, InventoryReceiptCallback callback)
135 { 196 {
136 m_log.InfoFormat("[LOCAL INVENTORY SERVICE]: Requesting inventory for user {0}", userID); 197 m_log.InfoFormat("[LOCAL INVENTORY SERVICE]: Requesting inventory for user {0}", userID);
@@ -152,7 +213,7 @@ namespace OpenSim.Services.InventoryService
152 { 213 {
153 rootFolder = new InventoryFolderImpl(folder); 214 rootFolder = new InventoryFolderImpl(folder);
154 folders.Add(rootFolder); 215 folders.Add(rootFolder);
155 items.AddRange(RequestFolderItems(rootFolder.ID)); 216 items.AddRange(GetFolderItems(rootFolder.ID));
156 break; // Only 1 root folder per user 217 break; // Only 1 root folder per user
157 } 218 }
158 } 219 }
@@ -164,7 +225,7 @@ namespace OpenSim.Services.InventoryService
164 if (folder.ID != rootFolder.ID) 225 if (folder.ID != rootFolder.ID)
165 { 226 {
166 folders.Add(new InventoryFolderImpl(folder)); 227 folders.Add(new InventoryFolderImpl(folder));
167 items.AddRange(RequestFolderItems(folder.ID)); 228 items.AddRange(GetFolderItems(folder.ID));
168 } 229 }
169 } 230 }
170 } 231 }
@@ -208,7 +269,7 @@ namespace OpenSim.Services.InventoryService
208 return inventoryList; 269 return inventoryList;
209 } 270 }
210 271
211 public List<InventoryItemBase> RequestFolderItems(UUID folderID) 272 public List<InventoryItemBase> GetFolderItems(UUID folderID)
212 { 273 {
213 List<InventoryItemBase> itemsList = new List<InventoryItemBase>(); 274 List<InventoryItemBase> itemsList = new List<InventoryItemBase>();
214 275
@@ -360,7 +421,7 @@ namespace OpenSim.Services.InventoryService
360 } 421 }
361 } 422 }
362 423
363 List<InventoryItemBase> items = RequestFolderItems(folder.ID); 424 List<InventoryItemBase> items = GetFolderItems(folder.ID);
364 425
365 foreach (InventoryItemBase item in items) 426 foreach (InventoryItemBase item in items)
366 { 427 {