Changed the inventory service so that is uses exactly one DB plugin, not many. The composition of plugins can be done at the service and connector levels.
This fixes the unit tests that were failing yesterday, but I'm not committing those yet, because I'm seeing 2 of those tests having pass and fail outcomes randomly which suggests that the tests are buggy.0.6.6-post-fixes
parent
156604e28e
commit
57c4b69916
|
@ -72,16 +72,10 @@ namespace OpenSim.Services.InventoryService
|
|||
|
||||
userFolders.Add(rootFolder);
|
||||
|
||||
foreach (IInventoryDataPlugin plugin in m_plugins)
|
||||
{
|
||||
IList<InventoryFolderBase> folders = plugin.getFolderHierarchy(rootFolder.ID);
|
||||
IList<InventoryFolderBase> folders = m_Database.getFolderHierarchy(rootFolder.ID);
|
||||
userFolders.AddRange(folders);
|
||||
}
|
||||
|
||||
// foreach (InventoryFolderBase folder in userFolders)
|
||||
// {
|
||||
// m_log.DebugFormat("[INVENTORY SERVICE]: Got folder {0} {1}", folder.name, folder.folderID);
|
||||
// }
|
||||
|
||||
return userFolders;
|
||||
}
|
||||
|
@ -94,15 +88,12 @@ namespace OpenSim.Services.InventoryService
|
|||
// See IInventoryServices
|
||||
public virtual InventoryFolderBase RequestRootFolder(UUID userID)
|
||||
{
|
||||
// Retrieve the first root folder we get from the list of plugins.
|
||||
foreach (IInventoryDataPlugin plugin in m_plugins)
|
||||
{
|
||||
InventoryFolderBase rootFolder = plugin.getUserRootFolder(userID);
|
||||
// Retrieve the first root folder we get from the DB.
|
||||
InventoryFolderBase rootFolder = m_Database.getUserRootFolder(userID);
|
||||
if (rootFolder != null)
|
||||
return rootFolder;
|
||||
}
|
||||
|
||||
// Return nothing if no plugin was able to supply a root folder
|
||||
// Return nothing if the plugin was unable to supply a root folder
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -246,10 +237,7 @@ namespace OpenSim.Services.InventoryService
|
|||
public List<InventoryItemBase> GetActiveGestures(UUID userId)
|
||||
{
|
||||
List<InventoryItemBase> activeGestures = new List<InventoryItemBase>();
|
||||
foreach (IInventoryDataPlugin plugin in m_plugins)
|
||||
{
|
||||
activeGestures.AddRange(plugin.fetchActiveGestures(userId));
|
||||
}
|
||||
activeGestures.AddRange(m_Database.fetchActiveGestures(userId));
|
||||
|
||||
return activeGestures;
|
||||
}
|
||||
|
@ -262,10 +250,7 @@ namespace OpenSim.Services.InventoryService
|
|||
{
|
||||
List<InventoryFolderBase> inventoryList = new List<InventoryFolderBase>();
|
||||
|
||||
foreach (IInventoryDataPlugin plugin in m_plugins)
|
||||
{
|
||||
inventoryList.AddRange(plugin.getInventoryFolders(parentFolderID));
|
||||
}
|
||||
inventoryList.AddRange(m_Database.getInventoryFolders(parentFolderID));
|
||||
|
||||
return inventoryList;
|
||||
}
|
||||
|
@ -274,10 +259,7 @@ namespace OpenSim.Services.InventoryService
|
|||
{
|
||||
List<InventoryItemBase> itemsList = new List<InventoryItemBase>();
|
||||
|
||||
foreach (IInventoryDataPlugin plugin in m_plugins)
|
||||
{
|
||||
itemsList.AddRange(plugin.getInventoryInFolder(folderID));
|
||||
}
|
||||
itemsList.AddRange(m_Database.getInventoryInFolder(folderID));
|
||||
|
||||
return itemsList;
|
||||
}
|
||||
|
@ -290,10 +272,7 @@ namespace OpenSim.Services.InventoryService
|
|||
m_log.DebugFormat(
|
||||
"[INVENTORY SERVICE]: Adding folder {0} {1} to folder {2}", folder.Name, folder.ID, folder.ParentID);
|
||||
|
||||
foreach (IInventoryDataPlugin plugin in m_plugins)
|
||||
{
|
||||
plugin.addInventoryFolder(folder);
|
||||
}
|
||||
m_Database.addInventoryFolder(folder);
|
||||
|
||||
// FIXME: Should return false on failure
|
||||
return true;
|
||||
|
@ -305,10 +284,7 @@ namespace OpenSim.Services.InventoryService
|
|||
m_log.DebugFormat(
|
||||
"[INVENTORY SERVICE]: Updating folder {0} {1} to folder {2}", folder.Name, folder.ID, folder.ParentID);
|
||||
|
||||
foreach (IInventoryDataPlugin plugin in m_plugins)
|
||||
{
|
||||
plugin.updateInventoryFolder(folder);
|
||||
}
|
||||
m_Database.updateInventoryFolder(folder);
|
||||
|
||||
// FIXME: Should return false on failure
|
||||
return true;
|
||||
|
@ -320,10 +296,7 @@ namespace OpenSim.Services.InventoryService
|
|||
m_log.DebugFormat(
|
||||
"[INVENTORY SERVICE]: Moving folder {0} {1} to folder {2}", folder.Name, folder.ID, folder.ParentID);
|
||||
|
||||
foreach (IInventoryDataPlugin plugin in m_plugins)
|
||||
{
|
||||
plugin.moveInventoryFolder(folder);
|
||||
}
|
||||
m_Database.moveInventoryFolder(folder);
|
||||
|
||||
// FIXME: Should return false on failure
|
||||
return true;
|
||||
|
@ -335,10 +308,7 @@ namespace OpenSim.Services.InventoryService
|
|||
m_log.DebugFormat(
|
||||
"[INVENTORY SERVICE]: Adding item {0} {1} to folder {2}", item.Name, item.ID, item.Folder);
|
||||
|
||||
foreach (IInventoryDataPlugin plugin in m_plugins)
|
||||
{
|
||||
plugin.addInventoryItem(item);
|
||||
}
|
||||
m_Database.addInventoryItem(item);
|
||||
|
||||
// FIXME: Should return false on failure
|
||||
return true;
|
||||
|
@ -350,10 +320,7 @@ namespace OpenSim.Services.InventoryService
|
|||
m_log.InfoFormat(
|
||||
"[INVENTORY SERVICE]: Updating item {0} {1} in folder {2}", item.Name, item.ID, item.Folder);
|
||||
|
||||
foreach (IInventoryDataPlugin plugin in m_plugins)
|
||||
{
|
||||
plugin.updateInventoryItem(item);
|
||||
}
|
||||
m_Database.updateInventoryItem(item);
|
||||
|
||||
// FIXME: Should return false on failure
|
||||
return true;
|
||||
|
@ -365,10 +332,7 @@ namespace OpenSim.Services.InventoryService
|
|||
m_log.InfoFormat(
|
||||
"[INVENTORY SERVICE]: Deleting item {0} {1} from folder {2}", item.Name, item.ID, item.Folder);
|
||||
|
||||
foreach (IInventoryDataPlugin plugin in m_plugins)
|
||||
{
|
||||
plugin.deleteInventoryItem(item.ID);
|
||||
}
|
||||
m_Database.deleteInventoryItem(item.ID);
|
||||
|
||||
// FIXME: Should return false on failure
|
||||
return true;
|
||||
|
@ -376,24 +340,18 @@ namespace OpenSim.Services.InventoryService
|
|||
|
||||
public virtual InventoryItemBase QueryItem(InventoryItemBase item)
|
||||
{
|
||||
foreach (IInventoryDataPlugin plugin in m_plugins)
|
||||
{
|
||||
InventoryItemBase result = plugin.queryInventoryItem(item.ID);
|
||||
InventoryItemBase result = m_Database.queryInventoryItem(item.ID);
|
||||
if (result != null)
|
||||
return result;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public virtual InventoryFolderBase QueryFolder(InventoryFolderBase item)
|
||||
{
|
||||
foreach (IInventoryDataPlugin plugin in m_plugins)
|
||||
{
|
||||
InventoryFolderBase result = plugin.queryInventoryFolder(item.ID);
|
||||
InventoryFolderBase result = m_Database.queryInventoryFolder(item.ID);
|
||||
if (result != null)
|
||||
return result;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
@ -416,10 +374,7 @@ namespace OpenSim.Services.InventoryService
|
|||
{
|
||||
// m_log.DebugFormat("[INVENTORY SERVICE]: Deleting folder {0} {1}", subFolder.Name, subFolder.ID);
|
||||
|
||||
foreach (IInventoryDataPlugin plugin in m_plugins)
|
||||
{
|
||||
plugin.deleteInventoryFolder(subFolder.ID);
|
||||
}
|
||||
m_Database.deleteInventoryFolder(subFolder.ID);
|
||||
}
|
||||
|
||||
List<InventoryItemBase> items = GetFolderItems(folder.ID);
|
||||
|
@ -443,12 +398,9 @@ namespace OpenSim.Services.InventoryService
|
|||
|
||||
public InventoryItemBase GetInventoryItem(UUID itemID)
|
||||
{
|
||||
foreach (IInventoryDataPlugin plugin in m_plugins)
|
||||
{
|
||||
InventoryItemBase item = plugin.getInventoryItem(itemID);
|
||||
InventoryItemBase item = m_Database.getInventoryItem(itemID);
|
||||
if (item != null)
|
||||
return item;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -40,8 +40,6 @@ namespace OpenSim.Services.InventoryService
|
|||
{
|
||||
protected IInventoryDataPlugin m_Database = null;
|
||||
|
||||
protected List<IInventoryDataPlugin> m_plugins = new List<IInventoryDataPlugin>();
|
||||
|
||||
public InventoryServiceBase(IConfigSource config) : base(config)
|
||||
{
|
||||
string dllName = String.Empty;
|
||||
|
@ -56,8 +54,6 @@ namespace OpenSim.Services.InventoryService
|
|||
dllName = dbConfig.GetString("StorageProvider", String.Empty);
|
||||
connString = dbConfig.GetString("ConnectionString", String.Empty);
|
||||
}
|
||||
else
|
||||
Console.WriteLine("------ dbConfig = null!");
|
||||
|
||||
//
|
||||
// Try reading the more specific [InventoryService] section, if it exists
|
||||
|
@ -79,43 +75,8 @@ namespace OpenSim.Services.InventoryService
|
|||
if (m_Database == null)
|
||||
throw new Exception("Could not find a storage interface in the given module");
|
||||
|
||||
//m_Database.Initialise(connString);
|
||||
List<IInventoryDataPlugin> plugins
|
||||
= DataPluginFactory.LoadDataPlugins<IInventoryDataPlugin>(dllName, connString);
|
||||
|
||||
foreach (IInventoryDataPlugin plugin in plugins)
|
||||
AddPlugin(plugin);
|
||||
|
||||
m_Database.Initialise(connString);
|
||||
}
|
||||
|
||||
#region Plugin methods
|
||||
|
||||
/// <summary>
|
||||
/// Add a new inventory data plugin - plugins will be requested in the order they were added.
|
||||
/// </summary>
|
||||
/// <param name="plugin">The plugin that will provide data</param>
|
||||
public void AddPlugin(IInventoryDataPlugin plugin)
|
||||
{
|
||||
m_plugins.Add(plugin);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds a list of inventory data plugins, as described by `provider'
|
||||
/// and `connect', to `m_plugins'.
|
||||
/// </summary>
|
||||
/// <param name="provider">
|
||||
/// The filename of the inventory server plugin DLL.
|
||||
/// </param>
|
||||
/// <param name="connect">
|
||||
/// The connection string for the storage backend.
|
||||
/// </param>
|
||||
public void AddPlugins(string provider, string connect)
|
||||
{
|
||||
m_plugins.AddRange(DataPluginFactory.LoadDataPlugins<IInventoryDataPlugin>(provider, connect));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue