aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services/InventoryService
diff options
context:
space:
mode:
authordiva2009-06-10 13:18:32 +0000
committerdiva2009-06-10 13:18:32 +0000
commit0f367bd7bbc5d22d4834e1eb0f1671381485143e (patch)
treeeeb4290f1146601f8fd97dc164e0a7f247a2fafb /OpenSim/Services/InventoryService
parentFrom: Alan Webb <alan_webb@us.ibm.com> (diff)
downloadopensim-SC-0f367bd7bbc5d22d4834e1eb0f1671381485143e.zip
opensim-SC-0f367bd7bbc5d22d4834e1eb0f1671381485143e.tar.gz
opensim-SC-0f367bd7bbc5d22d4834e1eb0f1671381485143e.tar.bz2
opensim-SC-0f367bd7bbc5d22d4834e1eb0f1671381485143e.tar.xz
Heart surgery no.2: the inventory service hooks.
Several improvements in the connectors themselves. Several improvements in configurations. Needed to add a hack in IUserService and UserManagerBase, to be removed when that service is refactored.
Diffstat (limited to 'OpenSim/Services/InventoryService')
-rw-r--r--OpenSim/Services/InventoryService/HGInventoryService.cs100
-rw-r--r--OpenSim/Services/InventoryService/InventoryService.cs41
-rw-r--r--OpenSim/Services/InventoryService/InventoryServiceBase.cs40
3 files changed, 132 insertions, 49 deletions
diff --git a/OpenSim/Services/InventoryService/HGInventoryService.cs b/OpenSim/Services/InventoryService/HGInventoryService.cs
index e5e40c6..0db80d0 100644
--- a/OpenSim/Services/InventoryService/HGInventoryService.cs
+++ b/OpenSim/Services/InventoryService/HGInventoryService.cs
@@ -109,6 +109,7 @@ namespace OpenSim.Services.InventoryService
109 109
110 public void GetUserInventory(string id, UUID sessionID, InventoryReceiptCallback callback) 110 public void GetUserInventory(string id, UUID sessionID, InventoryReceiptCallback callback)
111 { 111 {
112 m_log.Debug("[HGInventory]: GetUserInventory " + id);
112 string url = string.Empty; 113 string url = string.Empty;
113 string userID = string.Empty; 114 string userID = string.Empty;
114 115
@@ -120,57 +121,120 @@ namespace OpenSim.Services.InventoryService
120 121
121 } 122 }
122 123
123 public bool AddFolder(string userID, InventoryFolderBase folder, UUID sessionID) 124 public bool AddFolder(string id, InventoryFolderBase folder, UUID sessionID)
124 { 125 {
125 // TODO 126 string url = string.Empty;
127 string userID = string.Empty;
128
129 if (StringToUrlAndUserID(id, out url, out userID))
130 {
131 ISessionAuthInventoryService connector = GetConnector(url);
132 return connector.AddFolder(userID, folder, sessionID);
133 }
126 return false; 134 return false;
127 } 135 }
128 136
129 public bool UpdateFolder(string userID, InventoryFolderBase folder, UUID sessionID) 137 public bool UpdateFolder(string id, InventoryFolderBase folder, UUID sessionID)
130 { 138 {
131 // TODO 139 string url = string.Empty;
140 string userID = string.Empty;
141
142 if (StringToUrlAndUserID(id, out url, out userID))
143 {
144 ISessionAuthInventoryService connector = GetConnector(url);
145 return connector.UpdateFolder(userID, folder, sessionID);
146 }
132 return false; 147 return false;
133 } 148 }
134 149
135 public bool MoveFolder(string userID, InventoryFolderBase folder, UUID sessionID) 150 public bool MoveFolder(string id, InventoryFolderBase folder, UUID sessionID)
136 { 151 {
137 // TODO 152 string url = string.Empty;
153 string userID = string.Empty;
154
155 if (StringToUrlAndUserID(id, out url, out userID))
156 {
157 ISessionAuthInventoryService connector = GetConnector(url);
158 return connector.MoveFolder(userID, folder, sessionID);
159 }
138 return false; 160 return false;
139 } 161 }
140 162
141 public bool PurgeFolder(string userID, InventoryFolderBase folder, UUID sessionID) 163 public bool PurgeFolder(string id, InventoryFolderBase folder, UUID sessionID)
142 { 164 {
143 // TODO 165 string url = string.Empty;
166 string userID = string.Empty;
167
168 if (StringToUrlAndUserID(id, out url, out userID))
169 {
170 ISessionAuthInventoryService connector = GetConnector(url);
171 return connector.PurgeFolder(userID, folder, sessionID);
172 }
144 return false; 173 return false;
145 } 174 }
146 175
147 public bool AddItem(string userID, InventoryItemBase item, UUID sessionID) 176 public bool AddItem(string id, InventoryItemBase item, UUID sessionID)
148 { 177 {
149 // TODO 178 string url = string.Empty;
179 string userID = string.Empty;
180
181 if (StringToUrlAndUserID(id, out url, out userID))
182 {
183 ISessionAuthInventoryService connector = GetConnector(url);
184 return connector.AddItem(userID, item, sessionID);
185 }
150 return false; 186 return false;
151 } 187 }
152 188
153 public bool UpdateItem(string userID, InventoryItemBase item, UUID sessionID) 189 public bool UpdateItem(string id, InventoryItemBase item, UUID sessionID)
154 { 190 {
155 // TODO 191 string url = string.Empty;
192 string userID = string.Empty;
193
194 if (StringToUrlAndUserID(id, out url, out userID))
195 {
196 ISessionAuthInventoryService connector = GetConnector(url);
197 return connector.UpdateItem(userID, item, sessionID);
198 }
156 return false; 199 return false;
157 } 200 }
158 201
159 public bool DeleteItem(string userID, InventoryItemBase item, UUID sessionID) 202 public bool DeleteItem(string id, InventoryItemBase item, UUID sessionID)
160 { 203 {
161 // TODO 204 string url = string.Empty;
205 string userID = string.Empty;
206
207 if (StringToUrlAndUserID(id, out url, out userID))
208 {
209 ISessionAuthInventoryService connector = GetConnector(url);
210 return connector.UpdateItem(userID, item, sessionID);
211 }
162 return false; 212 return false;
163 } 213 }
164 214
165 public InventoryItemBase QueryItem(string userID, InventoryItemBase item, UUID sessionID) 215 public InventoryItemBase QueryItem(string id, InventoryItemBase item, UUID sessionID)
166 { 216 {
167 // TODO 217 string url = string.Empty;
218 string userID = string.Empty;
219
220 if (StringToUrlAndUserID(id, out url, out userID))
221 {
222 ISessionAuthInventoryService connector = GetConnector(url);
223 return connector.QueryItem(userID, item, sessionID);
224 }
168 return null; 225 return null;
169 } 226 }
170 227
171 public InventoryFolderBase QueryFolder(string userID, InventoryFolderBase folder, UUID sessionID) 228 public InventoryFolderBase QueryFolder(string id, InventoryFolderBase folder, UUID sessionID)
172 { 229 {
173 // TODO 230 string url = string.Empty;
231 string userID = string.Empty;
232
233 if (StringToUrlAndUserID(id, out url, out userID))
234 {
235 ISessionAuthInventoryService connector = GetConnector(url);
236 return connector.QueryFolder(userID, folder, sessionID);
237 }
174 return null; 238 return null;
175 } 239 }
176 240
diff --git a/OpenSim/Services/InventoryService/InventoryService.cs b/OpenSim/Services/InventoryService/InventoryService.cs
index f2a7b41..9dbd591 100644
--- a/OpenSim/Services/InventoryService/InventoryService.cs
+++ b/OpenSim/Services/InventoryService/InventoryService.cs
@@ -46,6 +46,7 @@ namespace OpenSim.Services.InventoryService
46 46
47 public InventoryService(IConfigSource config) : base(config) 47 public InventoryService(IConfigSource config) : base(config)
48 { 48 {
49 m_log.Debug("[INVENTORY SERVICE]: Initialized.");
49 } 50 }
50 51
51 #region IInventoryServices methods 52 #region IInventoryServices methods
@@ -57,7 +58,7 @@ namespace OpenSim.Services.InventoryService
57 58
58 public List<InventoryFolderBase> GetInventorySkeleton(UUID userId) 59 public List<InventoryFolderBase> GetInventorySkeleton(UUID userId)
59 { 60 {
60// m_log.DebugFormat("[AGENT INVENTORY]: Getting inventory skeleton for {0}", userId); 61 m_log.DebugFormat("[INVENTORY SERVICE]: Getting inventory skeleton for {0}", userId);
61 62
62 InventoryFolderBase rootFolder = RequestRootFolder(userId); 63 InventoryFolderBase rootFolder = RequestRootFolder(userId);
63 64
@@ -79,7 +80,7 @@ namespace OpenSim.Services.InventoryService
79 80
80// foreach (InventoryFolderBase folder in userFolders) 81// foreach (InventoryFolderBase folder in userFolders)
81// { 82// {
82// m_log.DebugFormat("[AGENT INVENTORY]: Got folder {0} {1}", folder.name, folder.folderID); 83// m_log.DebugFormat("[INVENTORY SERVICE]: Got folder {0} {1}", folder.name, folder.folderID);
83// } 84// }
84 85
85 return userFolders; 86 return userFolders;
@@ -113,7 +114,7 @@ namespace OpenSim.Services.InventoryService
113 if (null != existingRootFolder) 114 if (null != existingRootFolder)
114 { 115 {
115 m_log.WarnFormat( 116 m_log.WarnFormat(
116 "[AGENT INVENTORY]: Did not create a new inventory for user {0} since they already have " 117 "[INVENTORY SERVICE]: Did not create a new inventory for user {0} since they already have "
117 + "a root inventory folder with id {1}", 118 + "a root inventory folder with id {1}",
118 user, existingRootFolder.ID); 119 user, existingRootFolder.ID);
119 } 120 }
@@ -138,7 +139,7 @@ namespace OpenSim.Services.InventoryService
138 /// <returns>The user's inventory. If an inventory cannot be found then an empty collection is returned.</returns> 139 /// <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 public InventoryCollection GetUserInventory(UUID userID)
140 { 141 {
141 m_log.InfoFormat("[LOCAL INVENTORY SERVICE]: Processing request for inventory of {0}", userID); 142 m_log.InfoFormat("[INVENTORY SERVICE]: Processing request for inventory of {0}", userID);
142 143
143 // Uncomment me to simulate a slow responding inventory server 144 // Uncomment me to simulate a slow responding inventory server
144 //Thread.Sleep(16000); 145 //Thread.Sleep(16000);
@@ -149,7 +150,7 @@ namespace OpenSim.Services.InventoryService
149 150
150 if (null == allFolders) 151 if (null == allFolders)
151 { 152 {
152 m_log.WarnFormat("[LOCAL INVENTORY SERVICE]: No inventory found for user {0}", userID); 153 m_log.WarnFormat("[INVENTORY SERVICE]: No inventory found for user {0}", userID);
153 154
154 return invCollection; 155 return invCollection;
155 } 156 }
@@ -172,16 +173,16 @@ namespace OpenSim.Services.InventoryService
172 173
173 // foreach (InventoryFolderBase folder in invCollection.Folders) 174 // foreach (InventoryFolderBase folder in invCollection.Folders)
174 // { 175 // {
175 // m_log.DebugFormat("[GRID AGENT INVENTORY]: Sending back folder {0} {1}", folder.Name, folder.ID); 176 // m_log.DebugFormat("[GRID INVENTORY SERVICE]: Sending back folder {0} {1}", folder.Name, folder.ID);
176 // } 177 // }
177 // 178 //
178 // foreach (InventoryItemBase item in invCollection.Items) 179 // foreach (InventoryItemBase item in invCollection.Items)
179 // { 180 // {
180 // m_log.DebugFormat("[GRID AGENT INVENTORY]: Sending back item {0} {1}, folder {2}", item.Name, item.ID, item.Folder); 181 // m_log.DebugFormat("[GRID INVENTORY SERVICE]: Sending back item {0} {1}, folder {2}", item.Name, item.ID, item.Folder);
181 // } 182 // }
182 183
183 m_log.InfoFormat( 184 m_log.InfoFormat(
184 "[LOCAL INVENTORY SERVICE]: Sending back inventory response to user {0} containing {1} folders and {2} items", 185 "[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 invCollection.UserID, invCollection.Folders.Count, invCollection.Items.Count);
186 187
187 return invCollection; 188 return invCollection;
@@ -194,7 +195,7 @@ namespace OpenSim.Services.InventoryService
194 /// <param name="callback"></param> 195 /// <param name="callback"></param>
195 public void GetUserInventory(UUID userID, InventoryReceiptCallback callback) 196 public void GetUserInventory(UUID userID, InventoryReceiptCallback callback)
196 { 197 {
197 m_log.InfoFormat("[LOCAL INVENTORY SERVICE]: Requesting inventory for user {0}", userID); 198 m_log.InfoFormat("[INVENTORY SERVICE]: Requesting inventory for user {0}", userID);
198 199
199 List<InventoryFolderImpl> folders = new List<InventoryFolderImpl>(); 200 List<InventoryFolderImpl> folders = new List<InventoryFolderImpl>();
200 List<InventoryItemBase> items = new List<InventoryItemBase>(); 201 List<InventoryItemBase> items = new List<InventoryItemBase>();
@@ -231,15 +232,15 @@ namespace OpenSim.Services.InventoryService
231 } 232 }
232 233
233 m_log.InfoFormat( 234 m_log.InfoFormat(
234 "[LOCAL INVENTORY SERVICE]: Received inventory response for user {0} containing {1} folders and {2} items", 235 "[INVENTORY SERVICE]: Received inventory response for user {0} containing {1} folders and {2} items",
235 userID, folders.Count, items.Count); 236 userID, folders.Count, items.Count);
236 } 237 }
237 else 238 else
238 { 239 {
239 m_log.WarnFormat("[LOCAL INVENTORY SERVICE]: User {0} inventory not available", userID); 240 m_log.WarnFormat("[INVENTORY SERVICE]: User {0} inventory not available", userID);
240 } 241 }
241 242
242 callback(folders, items); 243 callback.BeginInvoke(folders, items, null, null);
243 } 244 }
244 245
245 public List<InventoryItemBase> GetActiveGestures(UUID userId) 246 public List<InventoryItemBase> GetActiveGestures(UUID userId)
@@ -287,7 +288,7 @@ namespace OpenSim.Services.InventoryService
287 public virtual bool AddFolder(InventoryFolderBase folder) 288 public virtual bool AddFolder(InventoryFolderBase folder)
288 { 289 {
289 m_log.DebugFormat( 290 m_log.DebugFormat(
290 "[AGENT INVENTORY]: Adding folder {0} {1} to folder {2}", folder.Name, folder.ID, folder.ParentID); 291 "[INVENTORY SERVICE]: Adding folder {0} {1} to folder {2}", folder.Name, folder.ID, folder.ParentID);
291 292
292 foreach (IInventoryDataPlugin plugin in m_plugins) 293 foreach (IInventoryDataPlugin plugin in m_plugins)
293 { 294 {
@@ -302,7 +303,7 @@ namespace OpenSim.Services.InventoryService
302 public virtual bool UpdateFolder(InventoryFolderBase folder) 303 public virtual bool UpdateFolder(InventoryFolderBase folder)
303 { 304 {
304 m_log.DebugFormat( 305 m_log.DebugFormat(
305 "[AGENT INVENTORY]: Updating folder {0} {1} to folder {2}", folder.Name, folder.ID, folder.ParentID); 306 "[INVENTORY SERVICE]: Updating folder {0} {1} to folder {2}", folder.Name, folder.ID, folder.ParentID);
306 307
307 foreach (IInventoryDataPlugin plugin in m_plugins) 308 foreach (IInventoryDataPlugin plugin in m_plugins)
308 { 309 {
@@ -317,7 +318,7 @@ namespace OpenSim.Services.InventoryService
317 public virtual bool MoveFolder(InventoryFolderBase folder) 318 public virtual bool MoveFolder(InventoryFolderBase folder)
318 { 319 {
319 m_log.DebugFormat( 320 m_log.DebugFormat(
320 "[AGENT INVENTORY]: Moving folder {0} {1} to folder {2}", folder.Name, folder.ID, folder.ParentID); 321 "[INVENTORY SERVICE]: Moving folder {0} {1} to folder {2}", folder.Name, folder.ID, folder.ParentID);
321 322
322 foreach (IInventoryDataPlugin plugin in m_plugins) 323 foreach (IInventoryDataPlugin plugin in m_plugins)
323 { 324 {
@@ -332,7 +333,7 @@ namespace OpenSim.Services.InventoryService
332 public virtual bool AddItem(InventoryItemBase item) 333 public virtual bool AddItem(InventoryItemBase item)
333 { 334 {
334 m_log.DebugFormat( 335 m_log.DebugFormat(
335 "[AGENT INVENTORY]: Adding item {0} {1} to folder {2}", item.Name, item.ID, item.Folder); 336 "[INVENTORY SERVICE]: Adding item {0} {1} to folder {2}", item.Name, item.ID, item.Folder);
336 337
337 foreach (IInventoryDataPlugin plugin in m_plugins) 338 foreach (IInventoryDataPlugin plugin in m_plugins)
338 { 339 {
@@ -347,7 +348,7 @@ namespace OpenSim.Services.InventoryService
347 public virtual bool UpdateItem(InventoryItemBase item) 348 public virtual bool UpdateItem(InventoryItemBase item)
348 { 349 {
349 m_log.InfoFormat( 350 m_log.InfoFormat(
350 "[AGENT INVENTORY]: Updating item {0} {1} in folder {2}", item.Name, item.ID, item.Folder); 351 "[INVENTORY SERVICE]: Updating item {0} {1} in folder {2}", item.Name, item.ID, item.Folder);
351 352
352 foreach (IInventoryDataPlugin plugin in m_plugins) 353 foreach (IInventoryDataPlugin plugin in m_plugins)
353 { 354 {
@@ -362,7 +363,7 @@ namespace OpenSim.Services.InventoryService
362 public virtual bool DeleteItem(InventoryItemBase item) 363 public virtual bool DeleteItem(InventoryItemBase item)
363 { 364 {
364 m_log.InfoFormat( 365 m_log.InfoFormat(
365 "[AGENT INVENTORY]: Deleting item {0} {1} from folder {2}", item.Name, item.ID, item.Folder); 366 "[INVENTORY SERVICE]: Deleting item {0} {1} from folder {2}", item.Name, item.ID, item.Folder);
366 367
367 foreach (IInventoryDataPlugin plugin in m_plugins) 368 foreach (IInventoryDataPlugin plugin in m_plugins)
368 { 369 {
@@ -407,13 +408,13 @@ namespace OpenSim.Services.InventoryService
407 public virtual bool PurgeFolder(InventoryFolderBase folder) 408 public virtual bool PurgeFolder(InventoryFolderBase folder)
408 { 409 {
409 m_log.DebugFormat( 410 m_log.DebugFormat(
410 "[AGENT INVENTORY]: Purging folder {0} {1} of its contents", folder.Name, folder.ID); 411 "[INVENTORY SERVICE]: Purging folder {0} {1} of its contents", folder.Name, folder.ID);
411 412
412 List<InventoryFolderBase> subFolders = RequestSubFolders(folder.ID); 413 List<InventoryFolderBase> subFolders = RequestSubFolders(folder.ID);
413 414
414 foreach (InventoryFolderBase subFolder in subFolders) 415 foreach (InventoryFolderBase subFolder in subFolders)
415 { 416 {
416// m_log.DebugFormat("[AGENT INVENTORY]: Deleting folder {0} {1}", subFolder.Name, subFolder.ID); 417// m_log.DebugFormat("[INVENTORY SERVICE]: Deleting folder {0} {1}", subFolder.Name, subFolder.ID);
417 418
418 foreach (IInventoryDataPlugin plugin in m_plugins) 419 foreach (IInventoryDataPlugin plugin in m_plugins)
419 { 420 {
diff --git a/OpenSim/Services/InventoryService/InventoryServiceBase.cs b/OpenSim/Services/InventoryService/InventoryServiceBase.cs
index 179d541..4526c34 100644
--- a/OpenSim/Services/InventoryService/InventoryServiceBase.cs
+++ b/OpenSim/Services/InventoryService/InventoryServiceBase.cs
@@ -44,19 +44,37 @@ namespace OpenSim.Services.InventoryService
44 44
45 public InventoryServiceBase(IConfigSource config) : base(config) 45 public InventoryServiceBase(IConfigSource config) : base(config)
46 { 46 {
47 IConfig assetConfig = config.Configs["InventoryService"]; 47 string dllName = String.Empty;
48 if (assetConfig == null) 48 string connString = String.Empty;
49
50 //
51 // Try reading the [DatabaseService] section first, if it exists
52 //
53 IConfig dbConfig = config.Configs["DatabaseService"];
54 if (dbConfig != null)
55 {
56 dllName = dbConfig.GetString("StorageProvider", String.Empty);
57 connString = dbConfig.GetString("ConnectionString", String.Empty);
58 }
59 else
60 Console.WriteLine("------ dbConfig = null!");
61
62 //
63 // Try reading the more specific [InventoryService] section, if it exists
64 //
65 IConfig inventoryConfig = config.Configs["InventoryService"];
66 if (inventoryConfig != null)
67 {
68 dllName = inventoryConfig.GetString("StorageProvider", dllName);
69 connString = inventoryConfig.GetString("ConnectionString", connString);
70 }
71
72 //
73 // We tried, but this doesn't exist. We can't proceed.
74 //
75 if (dllName.Equals(String.Empty))
49 throw new Exception("No InventoryService configuration"); 76 throw new Exception("No InventoryService configuration");
50 77
51 string dllName = assetConfig.GetString("StorageProvider",
52 String.Empty);
53
54 if (dllName == String.Empty)
55 throw new Exception("No StorageProvider configured");
56
57 string connString = assetConfig.GetString("ConnectionString",
58 String.Empty);
59
60 m_Database = LoadPlugin<IInventoryDataPlugin>(dllName); 78 m_Database = LoadPlugin<IInventoryDataPlugin>(dllName);
61 if (m_Database == null) 79 if (m_Database == null)
62 throw new Exception("Could not find a storage interface in the given module"); 80 throw new Exception("Could not find a storage interface in the given module");