Thanks, sempuki, for a patch that moves all grid plugins to new PluginLoader (issue 1763).
parent
2558f8ac31
commit
e0e0db3660
|
@ -29,19 +29,21 @@ using libsecondlife;
|
||||||
|
|
||||||
namespace OpenSim.Data
|
namespace OpenSim.Data
|
||||||
{
|
{
|
||||||
public abstract class GridDataBase : IGridData
|
public abstract class GridDataBase : IGridDataPlugin
|
||||||
{
|
{
|
||||||
public abstract RegionProfileData GetProfileByHandle(ulong regionHandle);
|
public abstract RegionProfileData GetProfileByHandle(ulong regionHandle);
|
||||||
public abstract RegionProfileData GetProfileByLLUUID(LLUUID UUID);
|
public abstract RegionProfileData GetProfileByLLUUID(LLUUID UUID);
|
||||||
public abstract RegionProfileData GetProfileByString(string regionName);
|
public abstract RegionProfileData GetProfileByString(string regionName);
|
||||||
public abstract RegionProfileData[] GetProfilesInRange(uint Xmin, uint Ymin, uint Xmax, uint Ymax);
|
public abstract RegionProfileData[] GetProfilesInRange(uint Xmin, uint Ymin, uint Xmax, uint Ymax);
|
||||||
public abstract bool AuthenticateSim(LLUUID UUID, ulong regionHandle, string simrecvkey);
|
public abstract bool AuthenticateSim(LLUUID UUID, ulong regionHandle, string simrecvkey);
|
||||||
public abstract void Initialise(string connect);
|
|
||||||
public abstract void Close();
|
|
||||||
public abstract string getName();
|
|
||||||
public abstract string getVersion();
|
|
||||||
public abstract DataResponse AddProfile(RegionProfileData profile);
|
public abstract DataResponse AddProfile(RegionProfileData profile);
|
||||||
public abstract ReservationData GetReservationAtPoint(uint x, uint y);
|
public abstract ReservationData GetReservationAtPoint(uint x, uint y);
|
||||||
public abstract DataResponse UpdateProfile(RegionProfileData profile);
|
public abstract DataResponse UpdateProfile(RegionProfileData profile);
|
||||||
|
|
||||||
|
public abstract void Initialise();
|
||||||
|
public abstract void Initialise(string connect);
|
||||||
|
public abstract void Dispose();
|
||||||
|
public abstract string Name { get; }
|
||||||
|
public abstract string Version { get; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,10 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
using libsecondlife;
|
using libsecondlife;
|
||||||
|
using Mono.Addins;
|
||||||
|
using OpenSim.Framework;
|
||||||
|
|
||||||
|
[assembly : AddinRoot("OpenSim.Data", "0.5")]
|
||||||
|
|
||||||
namespace OpenSim.Data
|
namespace OpenSim.Data
|
||||||
{
|
{
|
||||||
|
@ -40,8 +44,14 @@ namespace OpenSim.Data
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A standard grid interface
|
/// A standard grid interface
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public interface IGridData
|
[TypeExtensionPoint("/OpenSim/GridDataStore")]
|
||||||
|
public interface IGridDataPlugin : IPlugin
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Initialises the interface
|
||||||
|
/// </summary>
|
||||||
|
void Initialise(string connect);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns a sim profile from a regionHandle
|
/// Returns a sim profile from a regionHandle
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -83,28 +93,6 @@ namespace OpenSim.Data
|
||||||
/// <returns>Whether the sim has been authenticated</returns>
|
/// <returns>Whether the sim has been authenticated</returns>
|
||||||
bool AuthenticateSim(LLUUID UUID, ulong regionHandle, string simrecvkey);
|
bool AuthenticateSim(LLUUID UUID, ulong regionHandle, string simrecvkey);
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Initialises the interface
|
|
||||||
/// </summary>
|
|
||||||
void Initialise(string connect);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Closes the interface
|
|
||||||
/// </summary>
|
|
||||||
void Close();
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The plugin being loaded
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>A string containing the plugin name</returns>
|
|
||||||
string getName();
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The plugins version
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>A string containing the plugin version</returns>
|
|
||||||
string getVersion();
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Adds a new profile to the database
|
/// Adds a new profile to the database
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -116,4 +104,15 @@ namespace OpenSim.Data
|
||||||
|
|
||||||
ReservationData GetReservationAtPoint(uint x, uint y);
|
ReservationData GetReservationAtPoint(uint x, uint y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class GridDataStoreInitialiser : PluginInitialiserBase
|
||||||
|
{
|
||||||
|
private string connect;
|
||||||
|
public GridDataStoreInitialiser (string s) { connect = s; }
|
||||||
|
public override void Initialise (IPlugin plugin)
|
||||||
|
{
|
||||||
|
IGridDataPlugin p = plugin as IGridDataPlugin;
|
||||||
|
p.Initialise (connect);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,9 @@
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
using Mono.Addins;
|
||||||
|
using OpenSim.Framework;
|
||||||
|
|
||||||
namespace OpenSim.Data
|
namespace OpenSim.Data
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -61,7 +64,8 @@ namespace OpenSim.Data
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// An interface to a LogData storage system
|
/// An interface to a LogData storage system
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public interface ILogData
|
[TypeExtensionPoint("/OpenSim/GridLogData")]
|
||||||
|
public interface ILogDataPlugin : IPlugin
|
||||||
{
|
{
|
||||||
void saveLog(string serverDaemon, string target, string methodCall, string arguments, int priority,
|
void saveLog(string serverDaemon, string target, string methodCall, string arguments, int priority,
|
||||||
string logMessage);
|
string logMessage);
|
||||||
|
@ -70,22 +74,16 @@ namespace OpenSim.Data
|
||||||
/// Initialises the interface
|
/// Initialises the interface
|
||||||
/// </summary>
|
/// </summary>
|
||||||
void Initialise(string connect);
|
void Initialise(string connect);
|
||||||
|
}
|
||||||
/// <summary>
|
|
||||||
/// Closes the interface
|
public class LogDataInitialiser : PluginInitialiserBase
|
||||||
/// </summary>
|
{
|
||||||
void Close();
|
private string connect;
|
||||||
|
public LogDataInitialiser (string s) { connect = s; }
|
||||||
/// <summary>
|
public override void Initialise (IPlugin plugin)
|
||||||
/// The plugin being loaded
|
{
|
||||||
/// </summary>
|
ILogDataPlugin p = plugin as ILogDataPlugin;
|
||||||
/// <returns>A string containing the plugin name</returns>
|
p.Initialise (connect);
|
||||||
string getName();
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The plugins version
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>A string containing the plugin version</returns>
|
|
||||||
string getVersion();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,12 +33,18 @@ using System.Security.Cryptography;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using libsecondlife;
|
using libsecondlife;
|
||||||
using log4net;
|
using log4net;
|
||||||
|
using Mono.Addins;
|
||||||
|
using OpenSim.Framework;
|
||||||
|
|
||||||
|
[assembly : Addin]
|
||||||
|
[assembly : AddinDependency("OpenSim.Data", "0.5")]
|
||||||
|
|
||||||
namespace OpenSim.Data.MSSQL
|
namespace OpenSim.Data.MSSQL
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A grid data interface for MSSQL Server
|
/// A grid data interface for MSSQL Server
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[Extension("/OpenSim/GridDataStore")]
|
||||||
public class MSSQLGridData : GridDataBase
|
public class MSSQLGridData : GridDataBase
|
||||||
{
|
{
|
||||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
@ -50,6 +56,12 @@ namespace OpenSim.Data.MSSQL
|
||||||
|
|
||||||
private string m_regionsTableName;
|
private string m_regionsTableName;
|
||||||
|
|
||||||
|
override public void Initialise()
|
||||||
|
{
|
||||||
|
m_log.Info("[MSSQLGridData]: " + Name + " cannot be default-initialized!");
|
||||||
|
throw new PluginNotInitialisedException (Name);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initialises the Grid Interface
|
/// Initialises the Grid Interface
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -101,7 +113,7 @@ namespace OpenSim.Data.MSSQL
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Shuts down the grid interface
|
/// Shuts down the grid interface
|
||||||
/// </summary>
|
/// </summary>
|
||||||
override public void Close()
|
override public void Dispose()
|
||||||
{
|
{
|
||||||
// nothing to close
|
// nothing to close
|
||||||
}
|
}
|
||||||
|
@ -110,18 +122,18 @@ namespace OpenSim.Data.MSSQL
|
||||||
/// The name of this DB provider.
|
/// The name of this DB provider.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>A string containing the storage system name</returns>
|
/// <returns>A string containing the storage system name</returns>
|
||||||
override public string getName()
|
override public string Name
|
||||||
{
|
{
|
||||||
return "Sql OpenGridData";
|
get { return "Sql OpenGridData"; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Database provider version.
|
/// Database provider version.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>A string containing the storage system version</returns>
|
/// <returns>A string containing the storage system version</returns>
|
||||||
override public string getVersion()
|
override public string Version
|
||||||
{
|
{
|
||||||
return "0.1";
|
get { return "0.1"; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -25,21 +25,39 @@
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Reflection;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
|
using log4net;
|
||||||
|
using Mono.Addins;
|
||||||
|
using OpenSim.Framework;
|
||||||
|
|
||||||
|
// Only one attribute per assembly. See: *GridData.cs
|
||||||
|
// [assembly : Addin]
|
||||||
|
// [assembly : AddinDependency("OpenSim.Data", "0.5")]
|
||||||
|
|
||||||
namespace OpenSim.Data.MSSQL
|
namespace OpenSim.Data.MSSQL
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// An interface to the log database for MSSQL
|
/// An interface to the log database for MSSQL
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal class MSSQLLogData : ILogData
|
[Extension("/OpenSim/GridLogData")]
|
||||||
|
internal class MSSQLLogData : ILogDataPlugin
|
||||||
{
|
{
|
||||||
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The database manager
|
/// The database manager
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public MSSQLManager database;
|
public MSSQLManager database;
|
||||||
|
|
||||||
|
public void Initialise()
|
||||||
|
{
|
||||||
|
m_log.Info("[MSSQLLogData]: " + Name + " cannot be default-initialized!");
|
||||||
|
throw new PluginNotInitialisedException (Name);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Artificial constructor called when the plugin is loaded
|
/// Artificial constructor called when the plugin is loaded
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -97,15 +115,15 @@ namespace OpenSim.Data.MSSQL
|
||||||
/// Returns the name of this DB provider
|
/// Returns the name of this DB provider
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>A string containing the DB provider name</returns>
|
/// <returns>A string containing the DB provider name</returns>
|
||||||
public string getName()
|
public string Name
|
||||||
{
|
{
|
||||||
return "MSSQL Logdata Interface";
|
get { return "MSSQL Logdata Interface"; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Closes the database provider
|
/// Closes the database provider
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void Close()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
// Do nothing.
|
// Do nothing.
|
||||||
}
|
}
|
||||||
|
@ -114,9 +132,9 @@ namespace OpenSim.Data.MSSQL
|
||||||
/// Returns the version of this DB provider
|
/// Returns the version of this DB provider
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>A string containing the provider version</returns>
|
/// <returns>A string containing the provider version</returns>
|
||||||
public string getVersion()
|
public string Version
|
||||||
{
|
{
|
||||||
return "0.1";
|
get { return "0.1"; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,6 +34,7 @@ using log4net;
|
||||||
using MySql.Data.MySqlClient;
|
using MySql.Data.MySqlClient;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
|
|
||||||
|
|
||||||
namespace OpenSim.Data.MySQL
|
namespace OpenSim.Data.MySQL
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -33,12 +33,18 @@ using System.Security.Cryptography;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using libsecondlife;
|
using libsecondlife;
|
||||||
using log4net;
|
using log4net;
|
||||||
|
using Mono.Addins;
|
||||||
|
using OpenSim.Framework;
|
||||||
|
|
||||||
|
[assembly : Addin]
|
||||||
|
[assembly : AddinDependency("OpenSim.Data", "0.5")]
|
||||||
|
|
||||||
namespace OpenSim.Data.MySQL
|
namespace OpenSim.Data.MySQL
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A MySQL Interface for the Grid Server
|
/// A MySQL Interface for the Grid Server
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[Extension("/OpenSim/GridDataStore")]
|
||||||
public class MySQLGridData : GridDataBase
|
public class MySQLGridData : GridDataBase
|
||||||
{
|
{
|
||||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
@ -48,6 +54,12 @@ namespace OpenSim.Data.MySQL
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private MySQLManager database;
|
private MySQLManager database;
|
||||||
|
|
||||||
|
override public void Initialise()
|
||||||
|
{
|
||||||
|
m_log.Info("[MySQLLogData]: " + Name + " cannot be default-initialized!");
|
||||||
|
throw new PluginNotInitialisedException (Name);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// <para>Initialises Grid interface</para>
|
/// <para>Initialises Grid interface</para>
|
||||||
/// <para>
|
/// <para>
|
||||||
|
@ -144,7 +156,7 @@ namespace OpenSim.Data.MySQL
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Shuts down the grid interface
|
/// Shuts down the grid interface
|
||||||
/// </summary>
|
/// </summary>
|
||||||
override public void Close()
|
override public void Dispose()
|
||||||
{
|
{
|
||||||
database.Close();
|
database.Close();
|
||||||
}
|
}
|
||||||
|
@ -153,18 +165,18 @@ namespace OpenSim.Data.MySQL
|
||||||
/// Returns the plugin name
|
/// Returns the plugin name
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>Plugin name</returns>
|
/// <returns>Plugin name</returns>
|
||||||
override public string getName()
|
override public string Name
|
||||||
{
|
{
|
||||||
return "MySql OpenGridData";
|
get { return "MySql OpenGridData"; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns the plugin version
|
/// Returns the plugin version
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>Plugin version</returns>
|
/// <returns>Plugin version</returns>
|
||||||
override public string getVersion()
|
override public string Version
|
||||||
{
|
{
|
||||||
return "0.1";
|
get { return "0.1"; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -28,20 +28,34 @@ using System;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using log4net;
|
using log4net;
|
||||||
|
using Mono.Addins;
|
||||||
|
using OpenSim.Framework;
|
||||||
|
|
||||||
|
// Only one attribute per assembly. See: *GridData.cs
|
||||||
|
// [assembly : Addin]
|
||||||
|
// [assembly : AddinDependency("OpenSim.Data", "0.5")]
|
||||||
|
|
||||||
namespace OpenSim.Data.MySQL
|
namespace OpenSim.Data.MySQL
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// An interface to the log database for MySQL
|
/// An interface to the log database for MySQL
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal class MySQLLogData : ILogData
|
[Extension("/OpenSim/GridLogData")]
|
||||||
|
internal class MySQLLogData : ILogDataPlugin
|
||||||
{
|
{
|
||||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The database manager
|
/// The database manager
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public MySQLManager database;
|
public MySQLManager database;
|
||||||
|
|
||||||
|
public void Initialise()
|
||||||
|
{
|
||||||
|
m_log.Info("[MySQLLogData]: " + Name + " cannot be default-initialized!");
|
||||||
|
throw new PluginNotInitialisedException (Name);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Artificial constructor called when the plugin is loaded
|
/// Artificial constructor called when the plugin is loaded
|
||||||
/// Uses the obsolete mysql_connection.ini if connect string is empty.
|
/// Uses the obsolete mysql_connection.ini if connect string is empty.
|
||||||
|
@ -128,16 +142,16 @@ namespace OpenSim.Data.MySQL
|
||||||
/// Returns the name of this DB provider
|
/// Returns the name of this DB provider
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>A string containing the DB provider name</returns>
|
/// <returns>A string containing the DB provider name</returns>
|
||||||
public string getName()
|
public string Name
|
||||||
{
|
{
|
||||||
return "MySQL Logdata Interface";
|
get { return "MySQL Logdata Interface";}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Closes the database provider
|
/// Closes the database provider
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <remarks>do nothing</remarks>
|
/// <remarks>do nothing</remarks>
|
||||||
public void Close()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
// Do nothing.
|
// Do nothing.
|
||||||
}
|
}
|
||||||
|
@ -146,9 +160,9 @@ namespace OpenSim.Data.MySQL
|
||||||
/// Returns the version of this DB provider
|
/// Returns the version of this DB provider
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>A string containing the provider version</returns>
|
/// <returns>A string containing the provider version</returns>
|
||||||
public string getVersion()
|
public string Version
|
||||||
{
|
{
|
||||||
return "0.1";
|
get { return "0.1"; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -227,7 +227,7 @@ namespace OpenSim.Data.MySQL
|
||||||
|
|
||||||
return
|
return
|
||||||
string.Format("{0}.{1}.{2}.{3}", dllVersion.Major, dllVersion.Minor, dllVersion.Build,
|
string.Format("{0}.{1}.{2}.{3}", dllVersion.Major, dllVersion.Minor, dllVersion.Build,
|
||||||
dllVersion.Revision);
|
dllVersion.Revision);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -28,23 +28,38 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
|
using System.Reflection;
|
||||||
using System.Security.Cryptography;
|
using System.Security.Cryptography;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using libsecondlife;
|
using libsecondlife;
|
||||||
|
using log4net;
|
||||||
|
using Mono.Addins;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
|
|
||||||
|
[assembly : Addin]
|
||||||
|
[assembly : AddinDependency("OpenSim.Data", "0.5")]
|
||||||
|
|
||||||
namespace OpenSim.Data.SQLite
|
namespace OpenSim.Data.SQLite
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A Grid Interface to the SQLite database
|
/// A Grid Interface to the SQLite database
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[Extension("/OpenSim/GridDataStore")]
|
||||||
public class SQLiteGridData : GridDataBase
|
public class SQLiteGridData : GridDataBase
|
||||||
{
|
{
|
||||||
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// SQLite database manager
|
/// SQLite database manager
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private SQLiteManager database;
|
private SQLiteManager database;
|
||||||
|
|
||||||
|
override public void Initialise()
|
||||||
|
{
|
||||||
|
m_log.Info("[SQLite]: " + Name + " cannot be default-initialized!");
|
||||||
|
throw new PluginNotInitialisedException (Name);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// <list type="bullet">
|
/// <list type="bullet">
|
||||||
/// <item>Initialises Inventory interface</item>
|
/// <item>Initialises Inventory interface</item>
|
||||||
|
@ -61,7 +76,7 @@ namespace OpenSim.Data.SQLite
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Shuts down the grid interface
|
/// Shuts down the grid interface
|
||||||
/// </summary>
|
/// </summary>
|
||||||
override public void Close()
|
override public void Dispose()
|
||||||
{
|
{
|
||||||
database.Close();
|
database.Close();
|
||||||
}
|
}
|
||||||
|
@ -70,18 +85,18 @@ namespace OpenSim.Data.SQLite
|
||||||
/// Returns the name of this grid interface
|
/// Returns the name of this grid interface
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>A string containing the grid interface</returns>
|
/// <returns>A string containing the grid interface</returns>
|
||||||
override public string getName()
|
override public string Name
|
||||||
{
|
{
|
||||||
return "SQLite OpenGridData";
|
get { return "SQLite OpenGridData"; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns the version of this grid interface
|
/// Returns the version of this grid interface
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>A string containing the version</returns>
|
/// <returns>A string containing the version</returns>
|
||||||
override public string getVersion()
|
override public string Version
|
||||||
{
|
{
|
||||||
return "0.1";
|
get { return "0.1"; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -32,6 +32,7 @@ using System.Reflection;
|
||||||
using log4net;
|
using log4net;
|
||||||
using Mono.Addins;
|
using Mono.Addins;
|
||||||
|
|
||||||
|
|
||||||
namespace OpenSim.Framework
|
namespace OpenSim.Framework
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -50,8 +51,17 @@ namespace OpenSim.Framework
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public interface IPluginConstraint
|
public interface IPluginConstraint
|
||||||
{
|
{
|
||||||
bool Fail (string extpoint);
|
|
||||||
string Message { get; }
|
string Message { get; }
|
||||||
|
bool Apply (string extpoint);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Classes wishing to select specific plugins from a range of possible options
|
||||||
|
/// must implement this class and pass it to PluginLoader Load()
|
||||||
|
/// </summary>
|
||||||
|
public interface IPluginFilter
|
||||||
|
{
|
||||||
|
bool Apply (ExtensionNode plugin);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -64,18 +74,22 @@ namespace OpenSim.Framework
|
||||||
private List<T> loaded = new List<T>();
|
private List<T> loaded = new List<T>();
|
||||||
private List<string> extpoints = new List<string>();
|
private List<string> extpoints = new List<string>();
|
||||||
private PluginInitialiserBase initialiser;
|
private PluginInitialiserBase initialiser;
|
||||||
|
|
||||||
private Dictionary<string,IPluginConstraint> constraints
|
private Dictionary<string,IPluginConstraint> constraints
|
||||||
= new Dictionary<string,IPluginConstraint>();
|
= new Dictionary<string,IPluginConstraint>();
|
||||||
|
|
||||||
|
private Dictionary<string,IPluginFilter> filters
|
||||||
|
= new Dictionary<string,IPluginFilter>();
|
||||||
|
|
||||||
private static readonly ILog log
|
private static readonly ILog log
|
||||||
= LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
= LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
public PluginInitialiserBase Initialiser
|
public PluginInitialiserBase Initialiser
|
||||||
{
|
{
|
||||||
set { initialiser = value; }
|
set { initialiser = value; }
|
||||||
get { return initialiser; }
|
get { return initialiser; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<T> Plugins
|
public List<T> Plugins
|
||||||
{
|
{
|
||||||
get { return loaded; }
|
get { return loaded; }
|
||||||
|
@ -84,25 +98,19 @@ namespace OpenSim.Framework
|
||||||
public PluginLoader ()
|
public PluginLoader ()
|
||||||
{
|
{
|
||||||
Initialiser = new PluginInitialiserBase();
|
Initialiser = new PluginInitialiserBase();
|
||||||
|
initialise_plugin_dir_ (".");
|
||||||
}
|
}
|
||||||
|
|
||||||
public PluginLoader (PluginInitialiserBase init)
|
public PluginLoader (PluginInitialiserBase init)
|
||||||
{
|
{
|
||||||
Initialiser = init;
|
Initialiser = init;
|
||||||
|
initialise_plugin_dir_ (".");
|
||||||
}
|
}
|
||||||
|
|
||||||
public PluginLoader (PluginInitialiserBase init, string dir)
|
public PluginLoader (PluginInitialiserBase init, string dir)
|
||||||
{
|
{
|
||||||
Initialiser = init;
|
Initialiser = init;
|
||||||
AddPluginDir (dir);
|
initialise_plugin_dir_ (dir);
|
||||||
}
|
|
||||||
|
|
||||||
public void AddPluginDir (string dir)
|
|
||||||
{
|
|
||||||
suppress_console_output_ (true);
|
|
||||||
AddinManager.Initialize (dir);
|
|
||||||
AddinManager.Registry.Update (null);
|
|
||||||
suppress_console_output_ (false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddExtensionPoint (string extpoint)
|
public void AddExtensionPoint (string extpoint)
|
||||||
|
@ -114,50 +122,88 @@ namespace OpenSim.Framework
|
||||||
{
|
{
|
||||||
constraints.Add (extpoint, cons);
|
constraints.Add (extpoint, cons);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Load (string extpoint, string dir)
|
public void AddFilter (string extpoint, IPluginFilter filter)
|
||||||
|
{
|
||||||
|
filters.Add (extpoint, filter);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Load (string extpoint)
|
||||||
{
|
{
|
||||||
AddPluginDir (dir);
|
|
||||||
AddExtensionPoint (extpoint);
|
AddExtensionPoint (extpoint);
|
||||||
Load();
|
Load();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Load ()
|
public void Load ()
|
||||||
{
|
{
|
||||||
suppress_console_output_ (true);
|
|
||||||
AddinManager.Registry.Update (null);
|
|
||||||
suppress_console_output_ (false);
|
|
||||||
|
|
||||||
foreach (string ext in extpoints)
|
foreach (string ext in extpoints)
|
||||||
{
|
{
|
||||||
|
log.Info("[PLUGINS]: Loading extension point " + ext);
|
||||||
|
|
||||||
if (constraints.ContainsKey (ext))
|
if (constraints.ContainsKey (ext))
|
||||||
{
|
{
|
||||||
IPluginConstraint cons = constraints [ext];
|
IPluginConstraint cons = constraints [ext];
|
||||||
if (cons.Fail (ext))
|
if (cons.Apply (ext))
|
||||||
throw new PluginConstraintViolatedException (cons.Message);
|
log.Error ("[PLUGINS]: " + ext + " failed constraint: " + cons.Message);
|
||||||
}
|
}
|
||||||
|
|
||||||
ExtensionNodeList ns = AddinManager.GetExtensionNodes (ext);
|
IPluginFilter filter = null;
|
||||||
foreach (TypeExtensionNode n in ns)
|
|
||||||
{
|
if (filters.ContainsKey (ext))
|
||||||
T p = (T) n.CreateInstance();
|
filter = filters [ext];
|
||||||
Initialiser.Initialise (p);
|
|
||||||
Plugins.Add (p);
|
|
||||||
|
|
||||||
log.Info("[PLUGINS]: Loading plugin " + n.Path);
|
foreach (TypeExtensionNode node in AddinManager.GetExtensionNodes (ext))
|
||||||
|
{
|
||||||
|
log.Info("[PLUGINS]: Trying plugin " + node.Path);
|
||||||
|
|
||||||
|
if ((filter != null) && (filter.Apply (node) == false))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
T plugin = (T) node.CreateInstance();
|
||||||
|
Initialiser.Initialise (plugin);
|
||||||
|
Plugins.Add (plugin);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Dispose ()
|
public void Dispose ()
|
||||||
{
|
{
|
||||||
foreach (T p in Plugins)
|
foreach (T plugin in Plugins)
|
||||||
p.Dispose ();
|
plugin.Dispose ();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ClearCache()
|
private void initialise_plugin_dir_ (string dir)
|
||||||
{
|
{
|
||||||
// The Mono addin manager (in Mono.Addins.dll version 0.2.0.0) occasionally seems to corrupt its addin cache
|
if (AddinManager.IsInitialized == true)
|
||||||
|
return;
|
||||||
|
|
||||||
|
log.Info("[PLUGINS]: Initialzing");
|
||||||
|
|
||||||
|
AddinManager.AddinLoadError += on_addinloaderror_;
|
||||||
|
AddinManager.AddinLoaded += on_addinloaded_;
|
||||||
|
|
||||||
|
clear_registry_();
|
||||||
|
|
||||||
|
suppress_console_output_ (true);
|
||||||
|
AddinManager.Initialize (dir);
|
||||||
|
AddinManager.Registry.Update (null);
|
||||||
|
suppress_console_output_ (false);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void on_addinloaded_(object sender, AddinEventArgs args)
|
||||||
|
{
|
||||||
|
log.Info ("[PLUGINS]: Plugin Loaded: " + args.AddinId);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void on_addinloaderror_(object sender, AddinErrorEventArgs args)
|
||||||
|
{
|
||||||
|
log.Error ("[PLUGINS]: Plugin Error: " + args.Message);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void clear_registry_ ()
|
||||||
|
{
|
||||||
|
// The Mono addin manager (in Mono.Addins.dll version 0.2.0.0)
|
||||||
|
// occasionally seems to corrupt its addin cache
|
||||||
// Hence, as a temporary solution we'll remove it before each startup
|
// Hence, as a temporary solution we'll remove it before each startup
|
||||||
if (Directory.Exists("addin-db-000"))
|
if (Directory.Exists("addin-db-000"))
|
||||||
Directory.Delete("addin-db-000", true);
|
Directory.Delete("addin-db-000", true);
|
||||||
|
@ -182,6 +228,9 @@ namespace OpenSim.Framework
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Constraint that bounds the number of plugins to be loaded.
|
||||||
|
/// </summary>
|
||||||
public class PluginCountConstraint : IPluginConstraint
|
public class PluginCountConstraint : IPluginConstraint
|
||||||
{
|
{
|
||||||
private int min;
|
private int min;
|
||||||
|
@ -208,45 +257,32 @@ namespace OpenSim.Framework
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Fail (string extpoint)
|
public bool Apply (string extpoint)
|
||||||
{
|
{
|
||||||
ExtensionNodeList ns = AddinManager.GetExtensionNodes (extpoint);
|
int count = AddinManager.GetExtensionNodes (extpoint).Count;
|
||||||
if ((ns.Count < min) || (ns.Count > max))
|
|
||||||
return true;
|
|
||||||
else
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public class PluginFilenameConstraint : IPluginConstraint
|
if ((count < min) || (count > max))
|
||||||
{
|
throw new PluginConstraintViolatedException (Message);
|
||||||
private string filename;
|
|
||||||
|
|
||||||
public PluginFilenameConstraint (string name)
|
|
||||||
{
|
|
||||||
filename = name;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public string Message
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return "The plugin must have the following name: " + filename;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool Fail (string extpoint)
|
|
||||||
{
|
|
||||||
ExtensionNodeList ns = AddinManager.GetExtensionNodes (extpoint);
|
|
||||||
if (ns.Count != 1)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
string[] path = ns[0].Path.Split('/');
|
|
||||||
if (path [path.Length-1] == filename)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Filters out which plugin to load based on its "Id", which is name given by the namespace or by Mono.Addins.
|
||||||
|
/// </summary>
|
||||||
|
public class PluginIdFilter : IPluginFilter
|
||||||
|
{
|
||||||
|
private string id;
|
||||||
|
|
||||||
|
public PluginIdFilter (string id)
|
||||||
|
{
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Apply (ExtensionNode plugin)
|
||||||
|
{
|
||||||
|
return (plugin.Id == id);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Text;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
@ -46,8 +47,8 @@ namespace OpenSim.Grid.GridServer
|
||||||
{
|
{
|
||||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
private Dictionary<string, IGridData> _plugins = new Dictionary<string, IGridData>();
|
private List<IGridDataPlugin> _plugins = new List<IGridDataPlugin>();
|
||||||
private Dictionary<string, ILogData> _logplugins = new Dictionary<string, ILogData>();
|
private List<ILogDataPlugin> _logplugins = new List<ILogDataPlugin>();
|
||||||
|
|
||||||
// This is here so that the grid server can hand out MessageServer settings to regions on registration
|
// This is here so that the grid server can hand out MessageServer settings to regions on registration
|
||||||
private List<MessageServerInfo> _MessageServers = new List<MessageServerInfo>();
|
private List<MessageServerInfo> _MessageServers = new List<MessageServerInfo>();
|
||||||
|
@ -57,42 +58,39 @@ 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 new grid server plugin - grid servers will be requested in the order they were loaded.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="FileName">The filename to the grid server plugin DLL</param>
|
/// <param name="provider">The name of the grid server plugin DLL</param>
|
||||||
public void AddPlugin(string FileName, string Connect)
|
public void AddPlugin(string provider, string connect)
|
||||||
{
|
{
|
||||||
m_log.Info("[DATA]: Attempting to load " + FileName);
|
// FIXME: convert "provider" DLL file name to Mono.Addins "id",
|
||||||
Assembly pluginAssembly = Assembly.LoadFrom(FileName);
|
// which unless it is changed in the source code, is the .NET namespace.
|
||||||
|
// In the future, the "provider" should be changed to "id" in the
|
||||||
|
// config files, and is independent of filenames or namespaces.
|
||||||
|
string[] s = provider.Split ('.');
|
||||||
|
int len = s.Length;
|
||||||
|
if ((len >= 2) && (s [len-1] == "dll"))
|
||||||
|
s [len-1] = s [len-2];
|
||||||
|
|
||||||
m_log.Info("[DATA]: Found " + pluginAssembly.GetTypes().Length + " interfaces.");
|
provider = String.Join (".", s);
|
||||||
foreach (Type pluginType in pluginAssembly.GetTypes())
|
|
||||||
{
|
|
||||||
if (!pluginType.IsAbstract)
|
|
||||||
{
|
|
||||||
// Regions go here
|
|
||||||
Type typeInterface = pluginType.GetInterface("IGridData", true);
|
|
||||||
|
|
||||||
if (typeInterface != null)
|
PluginLoader<IGridDataPlugin> gridloader =
|
||||||
{
|
new PluginLoader<IGridDataPlugin> (new GridDataStoreInitialiser (connect));
|
||||||
IGridData plug =
|
|
||||||
(IGridData)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
|
|
||||||
plug.Initialise(Connect);
|
|
||||||
_plugins.Add(plug.getName(), plug);
|
|
||||||
m_log.Info("[DATA]: Added IGridData Interface");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Logs go here
|
PluginLoader<ILogDataPlugin> logloader =
|
||||||
typeInterface = pluginType.GetInterface("ILogData", true);
|
new PluginLoader<ILogDataPlugin> (new LogDataInitialiser (connect));
|
||||||
|
|
||||||
if (typeInterface != null)
|
gridloader.AddExtensionPoint ("/OpenSim/GridDataStore");
|
||||||
{
|
logloader.AddExtensionPoint ("/OpenSim/GridLogData");
|
||||||
ILogData plug =
|
|
||||||
(ILogData)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
|
// loader will try to load all providers (MySQL, MSSQL, etc)
|
||||||
plug.Initialise(Connect);
|
// unless it is constrainted to the correct "id"
|
||||||
_logplugins.Add(plug.getName(), plug);
|
gridloader.AddFilter ("/OpenSim/GridDataStore", new PluginIdFilter (provider + "GridData"));
|
||||||
m_log.Info("[DATA]: Added ILogData Interface");
|
logloader.AddFilter ("/OpenSim/GridLogData", new PluginIdFilter (provider + "LogData"));
|
||||||
}
|
|
||||||
}
|
gridloader.Load();
|
||||||
}
|
logloader.Load();
|
||||||
|
|
||||||
|
_plugins = gridloader.Plugins;
|
||||||
|
_logplugins = logloader.Plugins;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -105,15 +103,15 @@ namespace OpenSim.Grid.GridServer
|
||||||
/// <param name="message">The message to log</param>
|
/// <param name="message">The message to log</param>
|
||||||
private void logToDB(string target, string method, string args, int priority, string message)
|
private void logToDB(string target, string method, string args, int priority, string message)
|
||||||
{
|
{
|
||||||
foreach (KeyValuePair<string, ILogData> kvp in _logplugins)
|
foreach (ILogDataPlugin plugin in _logplugins)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
kvp.Value.saveLog("Gridserver", target, method, args, priority, message);
|
plugin.saveLog("Gridserver", target, method, args, priority, message);
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
m_log.Warn("[storage]: Unable to write log via " + kvp.Key);
|
m_log.Warn("[storage]: Unable to write log via ");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -125,11 +123,11 @@ namespace OpenSim.Grid.GridServer
|
||||||
/// <returns>A SimProfileData for the region</returns>
|
/// <returns>A SimProfileData for the region</returns>
|
||||||
public RegionProfileData GetRegion(LLUUID uuid)
|
public RegionProfileData GetRegion(LLUUID uuid)
|
||||||
{
|
{
|
||||||
foreach (KeyValuePair<string, IGridData> kvp in _plugins)
|
foreach (IGridDataPlugin plugin in _plugins)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return kvp.Value.GetProfileByLLUUID(uuid);
|
return plugin.GetProfileByLLUUID(uuid);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
@ -146,15 +144,15 @@ namespace OpenSim.Grid.GridServer
|
||||||
/// <returns>A SimProfileData for the region</returns>
|
/// <returns>A SimProfileData for the region</returns>
|
||||||
public RegionProfileData GetRegion(ulong handle)
|
public RegionProfileData GetRegion(ulong handle)
|
||||||
{
|
{
|
||||||
foreach (KeyValuePair<string, IGridData> kvp in _plugins)
|
foreach (IGridDataPlugin plugin in _plugins)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return kvp.Value.GetProfileByHandle(handle);
|
return plugin.GetProfileByHandle(handle);
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
m_log.Warn("[storage]: Unable to find region " + handle.ToString() + " via " + kvp.Key);
|
m_log.Warn("[storage]: Unable to find region " + handle.ToString() + " via " + plugin.Name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
@ -167,15 +165,15 @@ namespace OpenSim.Grid.GridServer
|
||||||
/// <returns>A SimProfileData for the region</returns>
|
/// <returns>A SimProfileData for the region</returns>
|
||||||
public RegionProfileData GetRegion(string regionName)
|
public RegionProfileData GetRegion(string regionName)
|
||||||
{
|
{
|
||||||
foreach (KeyValuePair<string, IGridData> kvp in _plugins)
|
foreach (IGridDataPlugin plugin in _plugins)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return kvp.Value.GetProfileByString(regionName);
|
return plugin.GetProfileByString(regionName);
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
m_log.Warn("[storage]: Unable to find region " + regionName + " via " + kvp.Key);
|
m_log.Warn("[storage]: Unable to find region " + regionName + " via " + plugin.Name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
@ -185,11 +183,11 @@ namespace OpenSim.Grid.GridServer
|
||||||
{
|
{
|
||||||
Dictionary<ulong, RegionProfileData> regions = new Dictionary<ulong, RegionProfileData>();
|
Dictionary<ulong, RegionProfileData> regions = new Dictionary<ulong, RegionProfileData>();
|
||||||
|
|
||||||
foreach (KeyValuePair<string, IGridData> kvp in _plugins)
|
foreach (IGridDataPlugin plugin in _plugins)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
RegionProfileData[] neighbours = kvp.Value.GetProfilesInRange(xmin, ymin, xmax, ymax);
|
RegionProfileData[] neighbours = plugin.GetProfilesInRange(xmin, ymin, xmax, ymax);
|
||||||
foreach (RegionProfileData neighbour in neighbours)
|
foreach (RegionProfileData neighbour in neighbours)
|
||||||
{
|
{
|
||||||
regions[neighbour.regionHandle] = neighbour;
|
regions[neighbour.regionHandle] = neighbour;
|
||||||
|
@ -197,7 +195,7 @@ namespace OpenSim.Grid.GridServer
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
m_log.Warn("[storage]: Unable to query regionblock via " + kvp.Key);
|
m_log.Warn("[storage]: Unable to query regionblock via " + plugin.Name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -404,7 +402,7 @@ namespace OpenSim.Grid.GridServer
|
||||||
return e.XmlRpcErrorResponse;
|
return e.XmlRpcErrorResponse;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (KeyValuePair<string, IGridData> kvp in _plugins)
|
foreach (IGridDataPlugin plugin in _plugins)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -412,11 +410,11 @@ namespace OpenSim.Grid.GridServer
|
||||||
|
|
||||||
if (existingSim == null)
|
if (existingSim == null)
|
||||||
{
|
{
|
||||||
insertResponse = kvp.Value.AddProfile(sim);
|
insertResponse = plugin.AddProfile(sim);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
insertResponse = kvp.Value.UpdateProfile(sim);
|
insertResponse = plugin.UpdateProfile(sim);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (insertResponse)
|
switch (insertResponse)
|
||||||
|
@ -441,7 +439,7 @@ namespace OpenSim.Grid.GridServer
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
m_log.Warn("[LOGIN END]: " +
|
m_log.Warn("[LOGIN END]: " +
|
||||||
"Unable to login region " + sim.UUID.ToString() + " via " + kvp.Key);
|
"Unable to login region " + sim.UUID.ToString() + " via " + plugin.Name);
|
||||||
m_log.Warn("[LOGIN END]: " + e.ToString());
|
m_log.Warn("[LOGIN END]: " + e.ToString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -682,12 +680,12 @@ namespace OpenSim.Grid.GridServer
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (KeyValuePair<string, IGridData> kvp in _plugins)
|
foreach (IGridDataPlugin plugin in _plugins)
|
||||||
{
|
{
|
||||||
//OpenSim.Data.MySQL.MySQLGridData dbengine = new OpenSim.Data.MySQL.MySQLGridData();
|
//OpenSim.Data.MySQL.MySQLGridData dbengine = new OpenSim.Data.MySQL.MySQLGridData();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
MySQLGridData mysqldata = (MySQLGridData)(kvp.Value);
|
MySQLGridData mysqldata = (MySQLGridData)(plugin);
|
||||||
//DataResponse insertResponse = mysqldata.DeleteProfile(TheSim);
|
//DataResponse insertResponse = mysqldata.DeleteProfile(TheSim);
|
||||||
DataResponse insertResponse = mysqldata.DeleteProfile(uuid);
|
DataResponse insertResponse = mysqldata.DeleteProfile(uuid);
|
||||||
switch (insertResponse)
|
switch (insertResponse)
|
||||||
|
@ -1053,17 +1051,17 @@ namespace OpenSim.Grid.GridServer
|
||||||
m_log.Info("[DATA]: " +
|
m_log.Info("[DATA]: " +
|
||||||
"Updating / adding via " + _plugins.Count + " storage provider(s) registered.");
|
"Updating / adding via " + _plugins.Count + " storage provider(s) registered.");
|
||||||
|
|
||||||
foreach (KeyValuePair<string, IGridData> kvp in _plugins)
|
foreach (IGridDataPlugin plugin in _plugins)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
//Check reservations
|
//Check reservations
|
||||||
ReservationData reserveData =
|
ReservationData reserveData =
|
||||||
kvp.Value.GetReservationAtPoint(theSim.regionLocX, theSim.regionLocY);
|
plugin.GetReservationAtPoint(theSim.regionLocX, theSim.regionLocY);
|
||||||
if ((reserveData != null && reserveData.gridRecvKey == theSim.regionRecvKey) ||
|
if ((reserveData != null && reserveData.gridRecvKey == theSim.regionRecvKey) ||
|
||||||
(reserveData == null && authkeynode.InnerText != theSim.regionRecvKey))
|
(reserveData == null && authkeynode.InnerText != theSim.regionRecvKey))
|
||||||
{
|
{
|
||||||
kvp.Value.AddProfile(theSim);
|
plugin.AddProfile(theSim);
|
||||||
m_log.Info("[grid]: New sim added to grid (" + theSim.regionName + ")");
|
m_log.Info("[grid]: New sim added to grid (" + theSim.regionName + ")");
|
||||||
logToDB(theSim.UUID.ToString(), "RestSetSimMethod", String.Empty, 5,
|
logToDB(theSim.UUID.ToString(), "RestSetSimMethod", String.Empty, 5,
|
||||||
"Region successfully updated and connected to grid.");
|
"Region successfully updated and connected to grid.");
|
||||||
|
@ -1078,7 +1076,7 @@ namespace OpenSim.Grid.GridServer
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
m_log.Warn("[GRID]: GetRegionPlugin Handle " + kvp.Key + " unable to add new sim: " +
|
m_log.Warn("[GRID]: GetRegionPlugin Handle " + plugin.Name + " unable to add new sim: " +
|
||||||
e.ToString());
|
e.ToString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,6 @@ using System.IO;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Timers;
|
using System.Timers;
|
||||||
using log4net;
|
using log4net;
|
||||||
using Mono.Addins;
|
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using OpenSim.Framework.Console;
|
using OpenSim.Framework.Console;
|
||||||
using OpenSim.Framework.Servers;
|
using OpenSim.Framework.Servers;
|
||||||
|
@ -121,7 +120,7 @@ namespace OpenSim.Grid.GridServer
|
||||||
PluginLoader<IGridPlugin> loader =
|
PluginLoader<IGridPlugin> loader =
|
||||||
new PluginLoader<IGridPlugin> (new GridPluginInitialiser (this));
|
new PluginLoader<IGridPlugin> (new GridPluginInitialiser (this));
|
||||||
|
|
||||||
loader.Load ("/OpenSim/GridServer", ".");
|
loader.Load ("/OpenSim/GridServer");
|
||||||
m_plugins = loader.Plugins;
|
m_plugins = loader.Plugins;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
using Mono.Addins;
|
using Mono.Addins;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
|
|
||||||
[assembly : AddinRoot("OpenSim", "0.5")]
|
[assembly : AddinRoot("OpenSim.Grid.GridServer", "0.5")]
|
||||||
|
|
||||||
namespace OpenSim.Grid.GridServer
|
namespace OpenSim.Grid.GridServer
|
||||||
{
|
{
|
||||||
|
@ -37,7 +37,6 @@ namespace OpenSim.Grid.GridServer
|
||||||
public interface IGridPlugin : IPlugin
|
public interface IGridPlugin : IPlugin
|
||||||
{
|
{
|
||||||
void Initialise(GridServerBase gridServer);
|
void Initialise(GridServerBase gridServer);
|
||||||
void Close();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class GridPluginInitialiser : PluginInitialiserBase
|
public class GridPluginInitialiser : PluginInitialiserBase
|
||||||
|
|
|
@ -34,7 +34,6 @@ using System.Text;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using libsecondlife;
|
using libsecondlife;
|
||||||
using log4net;
|
using log4net;
|
||||||
using Mono.Addins;
|
|
||||||
using Nini.Config;
|
using Nini.Config;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using OpenSim.Framework.Communications.Cache;
|
using OpenSim.Framework.Communications.Cache;
|
||||||
|
@ -338,7 +337,7 @@ namespace OpenSim
|
||||||
PluginLoader<IApplicationPlugin> loader =
|
PluginLoader<IApplicationPlugin> loader =
|
||||||
new PluginLoader<IApplicationPlugin> (new ApplicationPluginInitialiser (this));
|
new PluginLoader<IApplicationPlugin> (new ApplicationPluginInitialiser (this));
|
||||||
|
|
||||||
loader.Load ("/OpenSim/Startup", ".");
|
loader.Load ("/OpenSim/Startup");
|
||||||
m_plugins = loader.Plugins;
|
m_plugins = loader.Plugins;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -218,6 +218,7 @@
|
||||||
<Reference name="OpenSim.Framework"/>
|
<Reference name="OpenSim.Framework"/>
|
||||||
<Reference name="OpenSim.Data.Base"/>
|
<Reference name="OpenSim.Data.Base"/>
|
||||||
<Reference name="log4net.dll"/>
|
<Reference name="log4net.dll"/>
|
||||||
|
<Reference name="Mono.Addins.dll" />
|
||||||
<Files>
|
<Files>
|
||||||
<Match pattern="*.cs" recurse="false"/>
|
<Match pattern="*.cs" recurse="false"/>
|
||||||
<Match pattern="Properties/*.cs" recurse="false"/>
|
<Match pattern="Properties/*.cs" recurse="false"/>
|
||||||
|
@ -1293,6 +1294,7 @@
|
||||||
<Reference name="OpenSim.Framework.Console"/>
|
<Reference name="OpenSim.Framework.Console"/>
|
||||||
<Reference name="OpenSim.Region.Environment"/>
|
<Reference name="OpenSim.Region.Environment"/>
|
||||||
<Reference name="log4net.dll"/>
|
<Reference name="log4net.dll"/>
|
||||||
|
<Reference name="Mono.Addins.dll" />
|
||||||
|
|
||||||
<Files>
|
<Files>
|
||||||
<Match pattern="*.cs" recurse="true"/>
|
<Match pattern="*.cs" recurse="true"/>
|
||||||
|
@ -1322,6 +1324,7 @@
|
||||||
<Reference name="OpenSim.Framework.Console"/>
|
<Reference name="OpenSim.Framework.Console"/>
|
||||||
<Reference name="libsecondlife.dll"/>
|
<Reference name="libsecondlife.dll"/>
|
||||||
<Reference name="log4net.dll"/>
|
<Reference name="log4net.dll"/>
|
||||||
|
<Reference name="Mono.Addins.dll" />
|
||||||
|
|
||||||
<Files>
|
<Files>
|
||||||
<Match pattern="*.cs" recurse="true"/>
|
<Match pattern="*.cs" recurse="true"/>
|
||||||
|
@ -1352,6 +1355,7 @@
|
||||||
<Reference name="OpenSim.Region.Environment"/>
|
<Reference name="OpenSim.Region.Environment"/>
|
||||||
<Reference name="libsecondlife.dll"/>
|
<Reference name="libsecondlife.dll"/>
|
||||||
<Reference name="Mono.Data.SqliteClient"/>
|
<Reference name="Mono.Data.SqliteClient"/>
|
||||||
|
<Reference name="Mono.Addins.dll" />
|
||||||
<Reference name="log4net.dll"/>
|
<Reference name="log4net.dll"/>
|
||||||
|
|
||||||
<Files>
|
<Files>
|
||||||
|
|
Loading…
Reference in New Issue