- 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");
|
||||||
|
|
|
@ -53,12 +53,12 @@ namespace OpenSim.Grid.GridServer
|
||||||
private List<MessageServerInfo> _MessageServers = new List<MessageServerInfo>();
|
private List<MessageServerInfo> _MessageServers = new List<MessageServerInfo>();
|
||||||
|
|
||||||
public GridConfig Config;
|
public GridConfig Config;
|
||||||
|
|
||||||
/// <value>
|
/// <value>
|
||||||
/// Used to notify old regions as to which OpenSim version to upgrade to
|
/// Used to notify old regions as to which OpenSim version to upgrade to
|
||||||
/// </value>
|
/// </value>
|
||||||
private string m_opensimVersion;
|
private string m_opensimVersion;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Constructor
|
/// Constructor
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -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>
|
||||||
|
@ -389,8 +382,8 @@ namespace OpenSim.Grid.GridServer
|
||||||
m_log.Debug("[LOGIN PRELUDE]: Invalid login parameters, sending back error response.");
|
m_log.Debug("[LOGIN PRELUDE]: Invalid login parameters, sending back error response.");
|
||||||
return ErrorResponse("Wrong format in login parameters. Please verify parameters." + e.ToString());
|
return ErrorResponse("Wrong format in login parameters. Please verify parameters." + e.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
m_log.InfoFormat("[LOGIN BEGIN]: Received login request from simulator: {0}", sim.regionName);
|
m_log.InfoFormat("[LOGIN BEGIN]: Received login request from simulator: {0}", sim.regionName);
|
||||||
|
|
||||||
if (!Config.AllowRegionRegistration)
|
if (!Config.AllowRegionRegistration)
|
||||||
{
|
{
|
||||||
|
@ -399,12 +392,12 @@ namespace OpenSim.Grid.GridServer
|
||||||
sim.regionName);
|
sim.regionName);
|
||||||
|
|
||||||
return ErrorResponse("This grid is currently not accepting region registrations.");
|
return ErrorResponse("This grid is currently not accepting region registrations.");
|
||||||
}
|
}
|
||||||
|
|
||||||
int majorInterfaceVersion = 0;
|
int majorInterfaceVersion = 0;
|
||||||
if (requestData.ContainsKey("major_interface_version"))
|
if (requestData.ContainsKey("major_interface_version"))
|
||||||
int.TryParse((string)requestData["major_interface_version"], out majorInterfaceVersion);
|
int.TryParse((string)requestData["major_interface_version"], out majorInterfaceVersion);
|
||||||
|
|
||||||
if (majorInterfaceVersion != VersionInfo.MajorInterfaceVersion)
|
if (majorInterfaceVersion != VersionInfo.MajorInterfaceVersion)
|
||||||
{
|
{
|
||||||
return ErrorResponse(
|
return ErrorResponse(
|
||||||
|
|
|
@ -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