Add OpenSim & Simple inventory storage plugins and Null metrics plugin.

0.6.3-post-fixes
Mike Mazur 2009-02-16 02:26:27 +00:00
parent 3f3dfd7ac1
commit 74a2bd237a
10 changed files with 117 additions and 53 deletions

View File

@ -50,7 +50,7 @@ namespace OpenSim.Grid.AssetInventoryServer
public IniConfigSource ConfigFile;
public IAssetStorageProvider StorageProvider;
public IInventoryProvider InventoryProvider;
public IInventoryStorageProvider InventoryProvider;
public IAuthenticationProvider AuthenticationProvider;
public IAuthorizationProvider AuthorizationProvider;
public IMetricsProvider MetricsProvider;
@ -107,7 +107,8 @@ namespace OpenSim.Grid.AssetInventoryServer
}
StorageProvider = LoadAssetInventoryServerPlugin("/OpenSim/AssetInventoryServer/StorageProvider", "OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim.dll") as IAssetStorageProvider;
MetricsProvider = LoadAssetInventoryServerPlugin("/OpenSim/AssetInventoryServer/MetricsProvider", "") as IMetricsProvider;
InventoryProvider = LoadAssetInventoryServerPlugin("/OpenSim/AssetInventoryServer/InventoryProvider", "OpenSim.Grid.AssetInventoryServer.Plugins.Simple.dll") as IInventoryStorageProvider;
MetricsProvider = LoadAssetInventoryServerPlugin("/OpenSim/AssetInventoryServer/MetricsProvider", String.Empty) as IMetricsProvider;
try
{
@ -120,7 +121,7 @@ namespace OpenSim.Grid.AssetInventoryServer
return false;
}
frontend = LoadAssetInventoryServerPlugin("/OpenSim/AssetInventoryServer/Frontend", "");
frontend = LoadAssetInventoryServerPlugin("/OpenSim/AssetInventoryServer/Frontend", String.Empty);
return true;
}

View File

@ -83,7 +83,7 @@ namespace OpenSim.Grid.AssetInventoryServer
int ForEach(Action<Metadata> action, int start, int count);
}
public interface IInventoryProvider
public interface IInventoryStorageProvider : IAssetInventoryServerPlugin
{
BackendResponse TryFetchItem(Uri owner, UUID itemID, out InventoryItem item);
BackendResponse TryFetchFolder(Uri owner, UUID folderID, out InventoryFolder folder);

View File

@ -32,11 +32,11 @@ using OpenMetaverse;
namespace OpenSim.Grid.AssetInventoryServer.Plugins
{
public class NullMetrics : IMetricsProvider
public class NullMetricsPlugin : IMetricsProvider
{
AssetInventoryServer server;
public NullMetrics()
public NullMetricsPlugin()
{
}

View File

@ -36,43 +36,25 @@ using ExtensionLoader;
using ExtensionLoader.Config;
using OpenMetaverse;
using OpenMetaverse.StructuredData;
using OpenSim.Framework;
using OpenSim.Grid.AssetInventoryServer.Extensions;
using OpenSim.Data;
namespace OpenSim.Grid.AssetInventoryServer.Extensions
namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
{
public class OpenSimMySQLInventory : IExtension<AssetInventoryServer>, IInventoryProvider
public class OpenSimInventoryStoragePlugin : IInventoryStorageProvider
{
const string EXTENSION_NAME = "OpenSimMySQLInventory"; // Used in metrics reporting
const string EXTENSION_NAME = "OpenSimInventoryStorage"; // Used in metrics reporting
AssetInventoryServer server;
private AssetInventoryServer server;
private IInventoryDataPlugin m_inventoryProvider;
public OpenSimMySQLInventory()
public OpenSimInventoryStoragePlugin()
{
}
#region Required Interfaces
public void Start(AssetInventoryServer server)
{
this.server = server;
using (MySqlConnection dbConnection = new MySqlConnection(DBConnString.GetConnectionString(server.ConfigFile)))
{
try
{
dbConnection.Open();
Logger.Log.Info("Connected to MySQL inventory backend: " + dbConnection.ServerVersion);
}
catch (MySqlException ex)
{
Logger.Log.Error("Connection to MySQL inventory backend failed: " + ex.Message);
}
}
}
public void Stop()
{
}
public BackendResponse TryFetchItem(Uri owner, UUID itemID, out InventoryItem item)
{
item = null;
@ -800,5 +782,54 @@ namespace OpenSim.Grid.AssetInventoryServer.Extensions
}
#endregion Required Interfaces
#region IPlugin implementation
public void Initialise(AssetInventoryServer server)
{
this.server = server;
try
{
m_inventoryProvider = DataPluginFactory.LoadInventoryDataPlugin("OpenSim.Data.MySQL.dll", server.ConfigFile.Configs["MySQL"].GetString("database_connect", null));
if (m_inventoryProvider == null)
{
Logger.Log.Error("[INVENTORY]: Failed to load a database plugin, server halting.");
Environment.Exit(-1);
}
else
Logger.Log.InfoFormat("[INVENTORY]: Loaded storage backend: {0}", Version);
}
catch (Exception e)
{
Logger.Log.WarnFormat("[INVENTORY]: Failure loading data plugin: {0}", e.ToString());
}
}
public void Stop()
{
}
public void Initialise()
{
Logger.Log.InfoFormat("[INVENTORY]: {0} cannot be default-initialized!", Name);
throw new PluginNotInitialisedException(Name);
}
public void Dispose()
{
}
public string Version
{
get { return m_inventoryProvider.Version; }
}
public string Name
{
get { return "AssetInventoryServer OpenSim inventory storage provider"; }
}
#endregion IPlugin implementation
}
}

View File

@ -15,6 +15,9 @@
<Extension path="/OpenSim/AssetInventoryServer/StorageProvider">
<Plugin id="OpenSimAssetStorage" provider="OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim.dll" type="OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim.OpenSimAssetStoragePlugin" />
</Extension>
<Extension path="/OpenSim/AssetInventoryServer/InventoryProvider">
<Plugin id="OpenSimInventoryStorage" provider="OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim.dll" type="OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim.OpenSimInventoryStoragePlugin" />
</Extension>
<Extension path="/OpenSim/AssetInventoryServer/Frontend">
<Plugin id="OpenSimAssetFrontend" provider="OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim.dll" type="OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim.OpenSimAssetFrontendPlugin" />
</Extension>

View File

@ -8,6 +8,6 @@
</Dependencies>
<Extension path="/OpenSim/AssetInventoryServer/MetricsProvider">
<Plugin id="OpenSimMetrics" provider="OpenSim.Grid.AssetInventoryServer.Plugins.dll" type="OpenSim.Grid.AssetInventoryServer.Plugins.NullMetrics" />
<Plugin id="AssetInventoryMetrics" provider="OpenSim.Grid.AssetInventoryServer.Plugins.dll" type="OpenSim.Grid.AssetInventoryServer.Plugins.NullMetricsPlugin" />
</Extension>
</Addin>

View File

@ -10,4 +10,7 @@
<Extension path="/OpenSim/AssetInventoryServer/StorageProvider">
<Plugin id="SimpleAssetStorage" provider="OpenSim.Grid.AssetInventoryServer.Plugins.Simple.dll" type="OpenSim.Grid.AssetInventoryServer.Plugins.Simple.SimpleAssetStoragePlugin" />
</Extension>
<Extension path="/OpenSim/AssetInventoryServer/InventoryProvider">
<Plugin id="SimpleInventoryStorage" provider="OpenSim.Grid.AssetInventoryServer.Plugins.Simple.dll" type="OpenSim.Grid.AssetInventoryServer.Plugins.Simple.SimpleInventoryStoragePlugin" />
</Extension>
</Addin>

View File

@ -35,12 +35,13 @@ using System.Text;
using ExtensionLoader;
using OpenMetaverse;
using OpenMetaverse.StructuredData;
using OpenSim.Framework;
namespace OpenSim.Grid.AssetInventoryServer.Extensions
namespace OpenSim.Grid.AssetInventoryServer.Plugins.Simple
{
public class SimpleInventory : IExtension<AssetInventoryServer>, IInventoryProvider
public class SimpleInventoryStoragePlugin : IInventoryStorageProvider
{
const string EXTENSION_NAME = "SimpleInventory"; // Used for metrics reporting
const string EXTENSION_NAME = "SimpleInventoryStorage"; // Used for metrics reporting
const string DEFAULT_INVENTORY_DIR = "SimpleInventory";
AssetInventoryServer server;
@ -49,26 +50,12 @@ namespace OpenSim.Grid.AssetInventoryServer.Extensions
Utils.InventoryItemSerializer itemSerializer = new Utils.InventoryItemSerializer();
Utils.InventoryFolderSerializer folderSerializer = new Utils.InventoryFolderSerializer();
public SimpleInventory()
public SimpleInventoryStoragePlugin()
{
}
#region Required Interfaces
public void Start(AssetInventoryServer server)
{
this.server = server;
LoadFiles(DEFAULT_INVENTORY_DIR);
Logger.Log.InfoFormat("Initialized the inventory index with data for {0} avatars",
inventories.Count);
}
public void Stop()
{
}
public BackendResponse TryFetchItem(Uri owner, UUID itemID, out InventoryItem item)
{
item = null;
@ -598,5 +585,43 @@ namespace OpenSim.Grid.AssetInventoryServer.Extensions
Logger.Log.ErrorFormat("Failed loading inventory from {0}: {1}", folder, ex.Message);
}
}
#region IPlugin implementation
public void Initialise(AssetInventoryServer server)
{
this.server = server;
LoadFiles(DEFAULT_INVENTORY_DIR);
Logger.Log.InfoFormat("Initialized the inventory index with data for {0} avatars",
inventories.Count);
}
/// <summary>
/// <para>Initialises asset interface</para>
/// </summary>
public void Initialise()
{
Logger.Log.InfoFormat("[ASSET]: {0} cannot be default-initialized!", Name);
throw new PluginNotInitialisedException(Name);
}
public void Dispose()
{
}
public string Version
{
// TODO: this should be something meaningful and not hardcoded?
get { return "0.1"; }
}
public string Name
{
get { return "AssetInventoryServer Simple inventory storage provider"; }
}
#endregion IPlugin implementation
}
}

View File

@ -10,7 +10,7 @@
<ExtensionNode name="Plugin" type="OpenSim.Framework.PluginExtensionNode" objectType="OpenSim.Grid.AssetInventoryServer.IAssetStorageProvider" />
</ExtensionPoint>
<ExtensionPoint path="/OpenSim/AssetInventoryServer/InventoryProvider">
<ExtensionNode name="Plugin" type="OpenSim.Framework.PluginExtensionNode" objectType="OpenSim.Grid.AssetInventoryServer.IInventoryProvider" />
<ExtensionNode name="Plugin" type="OpenSim.Framework.PluginExtensionNode" objectType="OpenSim.Grid.AssetInventoryServer.IInventoryStorageProvider" />
</ExtensionPoint>
<ExtensionPoint path="/OpenSim/AssetInventoryServer/AuthenticationProvider">
<ExtensionNode name="Plugin" type="OpenSim.Framework.PluginExtensionNode" objectType="OpenSim.Grid.AssetInventoryServer.IAuthenticationProvider" />

View File

@ -824,6 +824,7 @@
<Reference name="OpenSim.Framework" />
<Reference name="OpenSim.Data" />
<Reference name="OpenSim.Grid.AssetInventoryServer" />
<Reference name="OpenMetaverse"/>
<Reference name="OpenMetaverseTypes"/>
<Reference name="OpenMetaverse.StructuredData2" />
<Reference name="HttpServer2"/>