- moved data plugin loading code from various places to
OpenSim/Data/DataPluginFactory.cs - removed dependencies on a few executable assemblies in bin/OpenSim.Data.addin.xml - trim trailing whitespace0.6.3-post-fixes
parent
d3eae4073e
commit
d259238c74
|
@ -0,0 +1,141 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* * Neither the name of the OpenSim Project nor the
|
||||||
|
* names of its contributors may be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||||
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using OpenSim.Framework;
|
||||||
|
|
||||||
|
namespace OpenSim.Data
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// A static class containing a series of methods for obtaining handles to
|
||||||
|
/// database storage objects.
|
||||||
|
/// </summary>
|
||||||
|
// Yeah, it's not really a factory, but maybe it'll morph into one?
|
||||||
|
public static class DataPluginFactory
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Returns a list of new inventory data plugins. Plugins will be
|
||||||
|
/// requested in the order they were added.
|
||||||
|
/// </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 static List<IInventoryDataPlugin> LoadInventoryDataPlugins(string provider, string connect)
|
||||||
|
{
|
||||||
|
PluginLoader<IInventoryDataPlugin> loader = new PluginLoader<IInventoryDataPlugin> (new InventoryDataInitialiser(connect));
|
||||||
|
|
||||||
|
// loader will try to load all providers (MySQL, MSSQL, etc)
|
||||||
|
// unless it is constrainted to the correct "Provider" entry in the addin.xml
|
||||||
|
loader.Add ("/OpenSim/InventoryData", new PluginProviderFilter(provider));
|
||||||
|
loader.Load();
|
||||||
|
|
||||||
|
return loader.Plugins;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns a list of new user data plugins. Plugins will be requested
|
||||||
|
/// in the order they were added.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="provider">
|
||||||
|
/// The filename of the user data plugin DLL.
|
||||||
|
/// </param>
|
||||||
|
/// <param name="connect">
|
||||||
|
/// The connection string for the storage backend.
|
||||||
|
/// </param>
|
||||||
|
public static List<IUserDataPlugin> LoadUserDataPlugins(string provider, string connect)
|
||||||
|
{
|
||||||
|
PluginLoader<IUserDataPlugin> loader = new PluginLoader<IUserDataPlugin>(new UserDataInitialiser(connect));
|
||||||
|
|
||||||
|
// loader will try to load all providers (MySQL, MSSQL, etc)
|
||||||
|
// unless it is constrainted to the correct "Provider" entry in the addin.xml
|
||||||
|
loader.Add("/OpenSim/UserData", new PluginProviderFilter(provider));
|
||||||
|
loader.Load();
|
||||||
|
|
||||||
|
return loader.Plugins;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns a list of new grid data plugins. Plugins will be requested
|
||||||
|
/// in the order they were added.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="provider">
|
||||||
|
/// The filename of the user data plugin DLL.
|
||||||
|
/// </param>
|
||||||
|
/// <param name="connect">
|
||||||
|
/// The connection string for the storage backend.
|
||||||
|
/// </param>
|
||||||
|
public static List<IGridDataPlugin> LoadGridDataPlugins(string provider, string connect)
|
||||||
|
{
|
||||||
|
PluginLoader<IGridDataPlugin> loader = new PluginLoader<IGridDataPlugin>(new GridDataInitialiser(connect));
|
||||||
|
|
||||||
|
// loader will try to load all providers (MySQL, MSSQL, etc)
|
||||||
|
// unless it is constrainted to the correct "Provider" entry in the addin.xml
|
||||||
|
loader.Add("/OpenSim/GridData", new PluginProviderFilter(provider));
|
||||||
|
loader.Load();
|
||||||
|
|
||||||
|
return loader.Plugins;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns a list of new log data plugins. Plugins will be requested
|
||||||
|
/// in the order they were added.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="provider">
|
||||||
|
/// The filename of the user data plugin DLL.
|
||||||
|
/// </param>
|
||||||
|
/// <param name="connect">
|
||||||
|
/// The connection string for the storage backend.
|
||||||
|
/// </param>
|
||||||
|
public static List<ILogDataPlugin> LoadLogDataPlugins(string provider, string connect)
|
||||||
|
{
|
||||||
|
PluginLoader<ILogDataPlugin> loader = new PluginLoader<ILogDataPlugin>(new LogDataInitialiser(connect));
|
||||||
|
|
||||||
|
// loader will try to load all providers (MySQL, MSSQL, etc)
|
||||||
|
// unless it is constrainted to the correct "Provider" entry in the addin.xml
|
||||||
|
loader.Add("/OpenSim/LogData", new PluginProviderFilter(provider));
|
||||||
|
loader.Load();
|
||||||
|
|
||||||
|
return loader.Plugins;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static IAssetDataPlugin LoadAssetDataPlugin(string provider, string connect)
|
||||||
|
{
|
||||||
|
PluginLoader<IAssetDataPlugin> loader = new PluginLoader<IAssetDataPlugin> (new AssetDataInitialiser (connect));
|
||||||
|
|
||||||
|
// loader will try to load all providers (MySQL, MSSQL, etc)
|
||||||
|
// unless it is constrainted to the correct "Provider" entry in the addin.xml
|
||||||
|
loader.Add ("/OpenSim/AssetData", new PluginProviderFilter (provider));
|
||||||
|
loader.Load();
|
||||||
|
|
||||||
|
return loader.Plugin;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -59,20 +59,18 @@ namespace OpenSim.Framework.Communications
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Adds a new inventory data plugin - plugins will be requested in the order they were loaded.
|
/// Adds a list of inventory data plugins, as described by `provider'
|
||||||
|
/// and `connect', to `m_plugins'.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="provider">The filename of the inventory server plugin DLL</param>
|
/// <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 AddPlugin(string provider, string connect)
|
public void AddPlugin(string provider, string connect)
|
||||||
{
|
{
|
||||||
PluginLoader<IInventoryDataPlugin> loader =
|
m_plugins.AddRange(DataPluginFactory.LoadInventoryDataPlugins(provider, connect));
|
||||||
new PluginLoader<IInventoryDataPlugin> (new InventoryDataInitialiser(connect));
|
|
||||||
|
|
||||||
// loader will try to load all providers (MySQL, MSSQL, etc)
|
|
||||||
// unless it is constrainted to the correct "Provider" entry in the addin.xml
|
|
||||||
loader.Add ("/OpenSim/InventoryData", new PluginProviderFilter(provider));
|
|
||||||
loader.Load();
|
|
||||||
|
|
||||||
m_plugins.AddRange(loader.Plugins);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
|
@ -74,21 +74,18 @@ namespace OpenSim.Framework.Communications
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Add a new user data plugin - plugins will be requested in the order they were added.
|
/// Adds a list of user data plugins, as described by `provider' and
|
||||||
|
/// `connect', to `_plugins'.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="provider">The filename to the user data plugin DLL</param>
|
/// <param name="provider">
|
||||||
/// <param name="connect"></param>
|
/// The filename of the inventory server plugin DLL.
|
||||||
|
/// </param>
|
||||||
|
/// <param name="connect">
|
||||||
|
/// The connection string for the storage backend.
|
||||||
|
/// </param>
|
||||||
public void AddPlugin(string provider, string connect)
|
public void AddPlugin(string provider, string connect)
|
||||||
{
|
{
|
||||||
PluginLoader<IUserDataPlugin> loader =
|
_plugins.AddRange(DataPluginFactory.LoadUserDataPlugins(provider, connect));
|
||||||
new PluginLoader<IUserDataPlugin>(new UserDataInitialiser(connect));
|
|
||||||
|
|
||||||
// loader will try to load all providers (MySQL, MSSQL, etc)
|
|
||||||
// unless it is constrainted to the correct "Provider" entry in the addin.xml
|
|
||||||
loader.Add("/OpenSim/UserData", new PluginProviderFilter(provider));
|
|
||||||
loader.Load();
|
|
||||||
|
|
||||||
_plugins.AddRange(loader.Plugins);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Get UserProfile
|
#region Get UserProfile
|
||||||
|
|
|
@ -112,24 +112,11 @@ namespace OpenSim.Grid.AssetServer
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IAssetDataPlugin LoadDatabasePlugin(string provider, string connect)
|
|
||||||
{
|
|
||||||
PluginLoader<IAssetDataPlugin> loader =
|
|
||||||
new PluginLoader<IAssetDataPlugin> (new AssetDataInitialiser (connect));
|
|
||||||
|
|
||||||
// loader will try to load all providers (MySQL, MSSQL, etc)
|
|
||||||
// unless it is constrainted to the correct "Provider" entry in the addin.xml
|
|
||||||
loader.Add ("/OpenSim/AssetData", new PluginProviderFilter (provider));
|
|
||||||
loader.Load();
|
|
||||||
|
|
||||||
return loader.Plugin;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setupDB(AssetConfig config)
|
public void setupDB(AssetConfig config)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
m_assetProvider = LoadDatabasePlugin(config.DatabaseProvider, config.DatabaseConnect);
|
m_assetProvider = DataPluginFactory.LoadAssetDataPlugin(config.DatabaseProvider, config.DatabaseConnect);
|
||||||
if (m_assetProvider == null)
|
if (m_assetProvider == null)
|
||||||
{
|
{
|
||||||
m_log.Error("[ASSET]: Failed to load a database plugin, server halting");
|
m_log.Error("[ASSET]: Failed to load a database plugin, server halting");
|
||||||
|
|
|
@ -71,27 +71,20 @@ namespace OpenSim.Grid.GridServer
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Adds a new grid server plugin - grid servers will be requested in the order they were loaded.
|
/// Adds a list of grid and log data plugins, as described by
|
||||||
|
/// `provider' and `connect', to `_plugins' and `_logplugins',
|
||||||
|
/// respectively.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="provider">The name of the grid server plugin DLL</param>
|
/// <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 AddPlugin(string provider, string connect)
|
public void AddPlugin(string provider, string connect)
|
||||||
{
|
{
|
||||||
PluginLoader<IGridDataPlugin> gridloader =
|
_plugins = DataPluginFactory.LoadGridDataPlugins(provider, connect);
|
||||||
new PluginLoader<IGridDataPlugin> (new GridDataInitialiser (connect));
|
_logplugins = DataPluginFactory.LoadLogDataPlugins(provider, connect);
|
||||||
|
|
||||||
PluginLoader<ILogDataPlugin> logloader =
|
|
||||||
new PluginLoader<ILogDataPlugin> (new LogDataInitialiser (connect));
|
|
||||||
|
|
||||||
// loader will try to load all providers (MySQL, MSSQL, etc)
|
|
||||||
// unless it is constrainted to the correct "Provider" entry in the addin.xml
|
|
||||||
gridloader.Add ("/OpenSim/GridData", new PluginProviderFilter (provider));
|
|
||||||
logloader.Add ("/OpenSim/LogData", new PluginProviderFilter (provider));
|
|
||||||
|
|
||||||
gridloader.Load();
|
|
||||||
logloader.Load();
|
|
||||||
|
|
||||||
_plugins = gridloader.Plugins;
|
|
||||||
_logplugins = logloader.Plugins;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -1,26 +1,21 @@
|
||||||
<Addin id="OpenSim.Data" isroot="true" version="0.5">
|
<Addin id="OpenSim.Data" isroot="true" version="0.5">
|
||||||
<Runtime>
|
<Runtime>
|
||||||
<Import assembly="OpenSim.Grid.UserServer.exe"/>
|
<Import assembly="OpenSim.Data.dll" />
|
||||||
<Import assembly="OpenSim.Grid.GridServer.exe"/>
|
<Import assembly="OpenSim.Framework.dll" />
|
||||||
<Import assembly="OpenSim.Grid.AssetServer.exe"/>
|
|
||||||
<Import assembly="OpenSim.Grid.InventoryServer.exe"/>
|
|
||||||
<Import assembly="OpenSim.Grid.MessagingServer.exe"/>
|
|
||||||
<Import assembly="OpenSim.Data.dll"/>
|
|
||||||
<Import assembly="OpenSim.Framework.dll"/>
|
|
||||||
</Runtime>
|
</Runtime>
|
||||||
<ExtensionPoint path = "/OpenSim/GridData">
|
<ExtensionPoint path = "/OpenSim/GridData">
|
||||||
<ExtensionNode name="Plugin" type="OpenSim.Framework.PluginExtensionNode" objectType="OpenSim.Data.IGridDataPlugin"/>
|
<ExtensionNode name="Plugin" type="OpenSim.Framework.PluginExtensionNode" objectType="OpenSim.Data.IGridDataPlugin" />
|
||||||
</ExtensionPoint>
|
</ExtensionPoint>
|
||||||
<ExtensionPoint path = "/OpenSim/LogData">
|
<ExtensionPoint path = "/OpenSim/LogData">
|
||||||
<ExtensionNode name="Plugin" type="OpenSim.Framework.PluginExtensionNode" objectType="OpenSim.Data.ILogDataPlugin"/>
|
<ExtensionNode name="Plugin" type="OpenSim.Framework.PluginExtensionNode" objectType="OpenSim.Data.ILogDataPlugin" />
|
||||||
</ExtensionPoint>
|
</ExtensionPoint>
|
||||||
<ExtensionPoint path = "/OpenSim/AssetData">
|
<ExtensionPoint path = "/OpenSim/AssetData">
|
||||||
<ExtensionNode name="Plugin" type="OpenSim.Framework.PluginExtensionNode" objectType="OpenSim.Data.IAssetDataPlugin"/>
|
<ExtensionNode name="Plugin" type="OpenSim.Framework.PluginExtensionNode" objectType="OpenSim.Data.IAssetDataPlugin" />
|
||||||
</ExtensionPoint>
|
</ExtensionPoint>
|
||||||
<ExtensionPoint path = "/OpenSim/InventoryData">
|
<ExtensionPoint path = "/OpenSim/InventoryData">
|
||||||
<ExtensionNode name="Plugin" type="OpenSim.Framework.PluginExtensionNode" objectType="OpenSim.Data.IInventoryDataPlugin"/>
|
<ExtensionNode name="Plugin" type="OpenSim.Framework.PluginExtensionNode" objectType="OpenSim.Data.IInventoryDataPlugin" />
|
||||||
</ExtensionPoint>
|
</ExtensionPoint>
|
||||||
<ExtensionPoint path = "/OpenSim/UserData">
|
<ExtensionPoint path = "/OpenSim/UserData">
|
||||||
<ExtensionNode name="Plugin" type="OpenSim.Framework.PluginExtensionNode" objectType="OpenSim.Data.IUserDataPlugin"/>
|
<ExtensionNode name="Plugin" type="OpenSim.Framework.PluginExtensionNode" objectType="OpenSim.Data.IUserDataPlugin" />
|
||||||
</ExtensionPoint>
|
</ExtensionPoint>
|
||||||
</Addin>
|
</Addin>
|
||||||
|
|
Loading…
Reference in New Issue