aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Services/InventoryService/InventoryService.cs102
-rw-r--r--OpenSim/Services/InventoryService/InventoryServiceBase.cs41
2 files changed, 28 insertions, 115 deletions
diff --git a/OpenSim/Services/InventoryService/InventoryService.cs b/OpenSim/Services/InventoryService/InventoryService.cs
index 9dbd591..1190b38 100644
--- a/OpenSim/Services/InventoryService/InventoryService.cs
+++ b/OpenSim/Services/InventoryService/InventoryService.cs
@@ -72,16 +72,10 @@ namespace OpenSim.Services.InventoryService
72 72
73 userFolders.Add(rootFolder); 73 userFolders.Add(rootFolder);
74 74
75 foreach (IInventoryDataPlugin plugin in m_plugins) 75 IList<InventoryFolderBase> folders = m_Database.getFolderHierarchy(rootFolder.ID);
76 { 76 userFolders.AddRange(folders);
77 IList<InventoryFolderBase> folders = plugin.getFolderHierarchy(rootFolder.ID);
78 userFolders.AddRange(folders);
79 }
80 77
81// foreach (InventoryFolderBase folder in userFolders) 78// m_log.DebugFormat("[INVENTORY SERVICE]: Got folder {0} {1}", folder.name, folder.folderID);
82// {
83// m_log.DebugFormat("[INVENTORY SERVICE]: Got folder {0} {1}", folder.name, folder.folderID);
84// }
85 79
86 return userFolders; 80 return userFolders;
87 } 81 }
@@ -94,15 +88,12 @@ namespace OpenSim.Services.InventoryService
94 // See IInventoryServices 88 // See IInventoryServices
95 public virtual InventoryFolderBase RequestRootFolder(UUID userID) 89 public virtual InventoryFolderBase RequestRootFolder(UUID userID)
96 { 90 {
97 // Retrieve the first root folder we get from the list of plugins. 91 // Retrieve the first root folder we get from the DB.
98 foreach (IInventoryDataPlugin plugin in m_plugins) 92 InventoryFolderBase rootFolder = m_Database.getUserRootFolder(userID);
99 { 93 if (rootFolder != null)
100 InventoryFolderBase rootFolder = plugin.getUserRootFolder(userID); 94 return rootFolder;
101 if (rootFolder != null)
102 return rootFolder;
103 }
104 95
105 // Return nothing if no plugin was able to supply a root folder 96 // Return nothing if the plugin was unable to supply a root folder
106 return null; 97 return null;
107 } 98 }
108 99
@@ -246,10 +237,7 @@ namespace OpenSim.Services.InventoryService
246 public List<InventoryItemBase> GetActiveGestures(UUID userId) 237 public List<InventoryItemBase> GetActiveGestures(UUID userId)
247 { 238 {
248 List<InventoryItemBase> activeGestures = new List<InventoryItemBase>(); 239 List<InventoryItemBase> activeGestures = new List<InventoryItemBase>();
249 foreach (IInventoryDataPlugin plugin in m_plugins) 240 activeGestures.AddRange(m_Database.fetchActiveGestures(userId));
250 {
251 activeGestures.AddRange(plugin.fetchActiveGestures(userId));
252 }
253 241
254 return activeGestures; 242 return activeGestures;
255 } 243 }
@@ -262,10 +250,7 @@ namespace OpenSim.Services.InventoryService
262 { 250 {
263 List<InventoryFolderBase> inventoryList = new List<InventoryFolderBase>(); 251 List<InventoryFolderBase> inventoryList = new List<InventoryFolderBase>();
264 252
265 foreach (IInventoryDataPlugin plugin in m_plugins) 253 inventoryList.AddRange(m_Database.getInventoryFolders(parentFolderID));
266 {
267 inventoryList.AddRange(plugin.getInventoryFolders(parentFolderID));
268 }
269 254
270 return inventoryList; 255 return inventoryList;
271 } 256 }
@@ -274,10 +259,7 @@ namespace OpenSim.Services.InventoryService
274 { 259 {
275 List<InventoryItemBase> itemsList = new List<InventoryItemBase>(); 260 List<InventoryItemBase> itemsList = new List<InventoryItemBase>();
276 261
277 foreach (IInventoryDataPlugin plugin in m_plugins) 262 itemsList.AddRange(m_Database.getInventoryInFolder(folderID));
278 {
279 itemsList.AddRange(plugin.getInventoryInFolder(folderID));
280 }
281 263
282 return itemsList; 264 return itemsList;
283 } 265 }
@@ -290,10 +272,7 @@ namespace OpenSim.Services.InventoryService
290 m_log.DebugFormat( 272 m_log.DebugFormat(
291 "[INVENTORY SERVICE]: Adding folder {0} {1} to folder {2}", folder.Name, folder.ID, folder.ParentID); 273 "[INVENTORY SERVICE]: Adding folder {0} {1} to folder {2}", folder.Name, folder.ID, folder.ParentID);
292 274
293 foreach (IInventoryDataPlugin plugin in m_plugins) 275 m_Database.addInventoryFolder(folder);
294 {
295 plugin.addInventoryFolder(folder);
296 }
297 276
298 // FIXME: Should return false on failure 277 // FIXME: Should return false on failure
299 return true; 278 return true;
@@ -305,10 +284,7 @@ namespace OpenSim.Services.InventoryService
305 m_log.DebugFormat( 284 m_log.DebugFormat(
306 "[INVENTORY SERVICE]: Updating folder {0} {1} to folder {2}", folder.Name, folder.ID, folder.ParentID); 285 "[INVENTORY SERVICE]: Updating folder {0} {1} to folder {2}", folder.Name, folder.ID, folder.ParentID);
307 286
308 foreach (IInventoryDataPlugin plugin in m_plugins) 287 m_Database.updateInventoryFolder(folder);
309 {
310 plugin.updateInventoryFolder(folder);
311 }
312 288
313 // FIXME: Should return false on failure 289 // FIXME: Should return false on failure
314 return true; 290 return true;
@@ -320,10 +296,7 @@ namespace OpenSim.Services.InventoryService
320 m_log.DebugFormat( 296 m_log.DebugFormat(
321 "[INVENTORY SERVICE]: Moving folder {0} {1} to folder {2}", folder.Name, folder.ID, folder.ParentID); 297 "[INVENTORY SERVICE]: Moving folder {0} {1} to folder {2}", folder.Name, folder.ID, folder.ParentID);
322 298
323 foreach (IInventoryDataPlugin plugin in m_plugins) 299 m_Database.moveInventoryFolder(folder);
324 {
325 plugin.moveInventoryFolder(folder);
326 }
327 300
328 // FIXME: Should return false on failure 301 // FIXME: Should return false on failure
329 return true; 302 return true;
@@ -335,10 +308,7 @@ namespace OpenSim.Services.InventoryService
335 m_log.DebugFormat( 308 m_log.DebugFormat(
336 "[INVENTORY SERVICE]: Adding item {0} {1} to folder {2}", item.Name, item.ID, item.Folder); 309 "[INVENTORY SERVICE]: Adding item {0} {1} to folder {2}", item.Name, item.ID, item.Folder);
337 310
338 foreach (IInventoryDataPlugin plugin in m_plugins) 311 m_Database.addInventoryItem(item);
339 {
340 plugin.addInventoryItem(item);
341 }
342 312
343 // FIXME: Should return false on failure 313 // FIXME: Should return false on failure
344 return true; 314 return true;
@@ -350,10 +320,7 @@ namespace OpenSim.Services.InventoryService
350 m_log.InfoFormat( 320 m_log.InfoFormat(
351 "[INVENTORY SERVICE]: Updating item {0} {1} in folder {2}", item.Name, item.ID, item.Folder); 321 "[INVENTORY SERVICE]: Updating item {0} {1} in folder {2}", item.Name, item.ID, item.Folder);
352 322
353 foreach (IInventoryDataPlugin plugin in m_plugins) 323 m_Database.updateInventoryItem(item);
354 {
355 plugin.updateInventoryItem(item);
356 }
357 324
358 // FIXME: Should return false on failure 325 // FIXME: Should return false on failure
359 return true; 326 return true;
@@ -365,10 +332,7 @@ namespace OpenSim.Services.InventoryService
365 m_log.InfoFormat( 332 m_log.InfoFormat(
366 "[INVENTORY SERVICE]: Deleting item {0} {1} from folder {2}", item.Name, item.ID, item.Folder); 333 "[INVENTORY SERVICE]: Deleting item {0} {1} from folder {2}", item.Name, item.ID, item.Folder);
367 334
368 foreach (IInventoryDataPlugin plugin in m_plugins) 335 m_Database.deleteInventoryItem(item.ID);
369 {
370 plugin.deleteInventoryItem(item.ID);
371 }
372 336
373 // FIXME: Should return false on failure 337 // FIXME: Should return false on failure
374 return true; 338 return true;
@@ -376,24 +340,18 @@ namespace OpenSim.Services.InventoryService
376 340
377 public virtual InventoryItemBase QueryItem(InventoryItemBase item) 341 public virtual InventoryItemBase QueryItem(InventoryItemBase item)
378 { 342 {
379 foreach (IInventoryDataPlugin plugin in m_plugins) 343 InventoryItemBase result = m_Database.queryInventoryItem(item.ID);
380 { 344 if (result != null)
381 InventoryItemBase result = plugin.queryInventoryItem(item.ID); 345 return result;
382 if (result != null)
383 return result;
384 }
385 346
386 return null; 347 return null;
387 } 348 }
388 349
389 public virtual InventoryFolderBase QueryFolder(InventoryFolderBase item) 350 public virtual InventoryFolderBase QueryFolder(InventoryFolderBase item)
390 { 351 {
391 foreach (IInventoryDataPlugin plugin in m_plugins) 352 InventoryFolderBase result = m_Database.queryInventoryFolder(item.ID);
392 { 353 if (result != null)
393 InventoryFolderBase result = plugin.queryInventoryFolder(item.ID); 354 return result;
394 if (result != null)
395 return result;
396 }
397 355
398 return null; 356 return null;
399 } 357 }
@@ -416,10 +374,7 @@ namespace OpenSim.Services.InventoryService
416 { 374 {
417// m_log.DebugFormat("[INVENTORY SERVICE]: Deleting folder {0} {1}", subFolder.Name, subFolder.ID); 375// m_log.DebugFormat("[INVENTORY SERVICE]: Deleting folder {0} {1}", subFolder.Name, subFolder.ID);
418 376
419 foreach (IInventoryDataPlugin plugin in m_plugins) 377 m_Database.deleteInventoryFolder(subFolder.ID);
420 {
421 plugin.deleteInventoryFolder(subFolder.ID);
422 }
423 } 378 }
424 379
425 List<InventoryItemBase> items = GetFolderItems(folder.ID); 380 List<InventoryItemBase> items = GetFolderItems(folder.ID);
@@ -443,12 +398,9 @@ namespace OpenSim.Services.InventoryService
443 398
444 public InventoryItemBase GetInventoryItem(UUID itemID) 399 public InventoryItemBase GetInventoryItem(UUID itemID)
445 { 400 {
446 foreach (IInventoryDataPlugin plugin in m_plugins) 401 InventoryItemBase item = m_Database.getInventoryItem(itemID);
447 { 402 if (item != null)
448 InventoryItemBase item = plugin.getInventoryItem(itemID); 403 return item;
449 if (item != null)
450 return item;
451 }
452 404
453 return null; 405 return null;
454 } 406 }
diff --git a/OpenSim/Services/InventoryService/InventoryServiceBase.cs b/OpenSim/Services/InventoryService/InventoryServiceBase.cs
index 4526c34..456e455 100644
--- a/OpenSim/Services/InventoryService/InventoryServiceBase.cs
+++ b/OpenSim/Services/InventoryService/InventoryServiceBase.cs
@@ -40,8 +40,6 @@ namespace OpenSim.Services.InventoryService
40 { 40 {
41 protected IInventoryDataPlugin m_Database = null; 41 protected IInventoryDataPlugin m_Database = null;
42 42
43 protected List<IInventoryDataPlugin> m_plugins = new List<IInventoryDataPlugin>();
44
45 public InventoryServiceBase(IConfigSource config) : base(config) 43 public InventoryServiceBase(IConfigSource config) : base(config)
46 { 44 {
47 string dllName = String.Empty; 45 string dllName = String.Empty;
@@ -56,8 +54,6 @@ namespace OpenSim.Services.InventoryService
56 dllName = dbConfig.GetString("StorageProvider", String.Empty); 54 dllName = dbConfig.GetString("StorageProvider", String.Empty);
57 connString = dbConfig.GetString("ConnectionString", String.Empty); 55 connString = dbConfig.GetString("ConnectionString", String.Empty);
58 } 56 }
59 else
60 Console.WriteLine("------ dbConfig = null!");
61 57
62 // 58 //
63 // Try reading the more specific [InventoryService] section, if it exists 59 // Try reading the more specific [InventoryService] section, if it exists
@@ -79,43 +75,8 @@ namespace OpenSim.Services.InventoryService
79 if (m_Database == null) 75 if (m_Database == null)
80 throw new Exception("Could not find a storage interface in the given module"); 76 throw new Exception("Could not find a storage interface in the given module");
81 77
82 //m_Database.Initialise(connString); 78 m_Database.Initialise(connString);
83 List<IInventoryDataPlugin> plugins
84 = DataPluginFactory.LoadDataPlugins<IInventoryDataPlugin>(dllName, connString);
85
86 foreach (IInventoryDataPlugin plugin in plugins)
87 AddPlugin(plugin);
88
89 }
90
91 #region Plugin methods
92
93 /// <summary>
94 /// Add a new inventory data plugin - plugins will be requested in the order they were added.
95 /// </summary>
96 /// <param name="plugin">The plugin that will provide data</param>
97 public void AddPlugin(IInventoryDataPlugin plugin)
98 {
99 m_plugins.Add(plugin);
100 }
101
102 /// <summary>
103 /// Adds a list of inventory data plugins, as described by `provider'
104 /// and `connect', to `m_plugins'.
105 /// </summary>
106 /// <param name="provider">
107 /// The filename of the inventory server plugin DLL.
108 /// </param>
109 /// <param name="connect">
110 /// The connection string for the storage backend.
111 /// </param>
112 public void AddPlugins(string provider, string connect)
113 {
114 m_plugins.AddRange(DataPluginFactory.LoadDataPlugins<IInventoryDataPlugin>(provider, connect));
115 } 79 }
116 80
117 #endregion
118
119
120 } 81 }
121} 82}