From e0e0db366061eae148364e3d5670f275b1ab25b7 Mon Sep 17 00:00:00 2001 From: Mike Mazur Date: Fri, 18 Jul 2008 04:51:41 +0000 Subject: Thanks, sempuki, for a patch that moves all grid plugins to new PluginLoader (issue 1763). --- OpenSim/Data/MySQL/MySQLAssetData.cs | 1 + OpenSim/Data/MySQL/MySQLGridData.cs | 22 +++++++++++++++++----- OpenSim/Data/MySQL/MySQLLogData.cs | 26 ++++++++++++++++++++------ OpenSim/Data/MySQL/MySQLManager.cs | 2 +- 4 files changed, 39 insertions(+), 12 deletions(-) (limited to 'OpenSim/Data/MySQL') diff --git a/OpenSim/Data/MySQL/MySQLAssetData.cs b/OpenSim/Data/MySQL/MySQLAssetData.cs index 6cb0b4c..9284ba9 100644 --- a/OpenSim/Data/MySQL/MySQLAssetData.cs +++ b/OpenSim/Data/MySQL/MySQLAssetData.cs @@ -34,6 +34,7 @@ using log4net; using MySql.Data.MySqlClient; using OpenSim.Framework; + namespace OpenSim.Data.MySQL { /// diff --git a/OpenSim/Data/MySQL/MySQLGridData.cs b/OpenSim/Data/MySQL/MySQLGridData.cs index bb71c99..8142c74 100644 --- a/OpenSim/Data/MySQL/MySQLGridData.cs +++ b/OpenSim/Data/MySQL/MySQLGridData.cs @@ -33,12 +33,18 @@ using System.Security.Cryptography; using System.Text; using libsecondlife; using log4net; +using Mono.Addins; +using OpenSim.Framework; + +[assembly : Addin] +[assembly : AddinDependency("OpenSim.Data", "0.5")] namespace OpenSim.Data.MySQL { /// /// A MySQL Interface for the Grid Server /// + [Extension("/OpenSim/GridDataStore")] public class MySQLGridData : GridDataBase { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -48,6 +54,12 @@ namespace OpenSim.Data.MySQL /// private MySQLManager database; + override public void Initialise() + { + m_log.Info("[MySQLLogData]: " + Name + " cannot be default-initialized!"); + throw new PluginNotInitialisedException (Name); + } + /// /// Initialises Grid interface /// @@ -144,7 +156,7 @@ namespace OpenSim.Data.MySQL /// /// Shuts down the grid interface /// - override public void Close() + override public void Dispose() { database.Close(); } @@ -153,18 +165,18 @@ namespace OpenSim.Data.MySQL /// Returns the plugin name /// /// Plugin name - override public string getName() + override public string Name { - return "MySql OpenGridData"; + get { return "MySql OpenGridData"; } } /// /// Returns the plugin version /// /// Plugin version - override public string getVersion() + override public string Version { - return "0.1"; + get { return "0.1"; } } /// diff --git a/OpenSim/Data/MySQL/MySQLLogData.cs b/OpenSim/Data/MySQL/MySQLLogData.cs index fee7f2f..f11aec5 100644 --- a/OpenSim/Data/MySQL/MySQLLogData.cs +++ b/OpenSim/Data/MySQL/MySQLLogData.cs @@ -28,20 +28,34 @@ using System; using System.Reflection; using System.Collections.Generic; 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 { /// /// An interface to the log database for MySQL /// - internal class MySQLLogData : ILogData + [Extension("/OpenSim/GridLogData")] + internal class MySQLLogData : ILogDataPlugin { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + /// /// The database manager /// public MySQLManager database; + public void Initialise() + { + m_log.Info("[MySQLLogData]: " + Name + " cannot be default-initialized!"); + throw new PluginNotInitialisedException (Name); + } + /// /// Artificial constructor called when the plugin is loaded /// 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 /// /// A string containing the DB provider name - public string getName() + public string Name { - return "MySQL Logdata Interface"; + get { return "MySQL Logdata Interface";} } /// /// Closes the database provider /// /// do nothing - public void Close() + public void Dispose() { // Do nothing. } @@ -146,9 +160,9 @@ namespace OpenSim.Data.MySQL /// Returns the version of this DB provider /// /// A string containing the provider version - public string getVersion() + public string Version { - return "0.1"; + get { return "0.1"; } } } } diff --git a/OpenSim/Data/MySQL/MySQLManager.cs b/OpenSim/Data/MySQL/MySQLManager.cs index cf4bce3..89d0672 100644 --- a/OpenSim/Data/MySQL/MySQLManager.cs +++ b/OpenSim/Data/MySQL/MySQLManager.cs @@ -227,7 +227,7 @@ namespace OpenSim.Data.MySQL return string.Format("{0}.{1}.{2}.{3}", dllVersion.Major, dllVersion.Minor, dllVersion.Build, - dllVersion.Revision); + dllVersion.Revision); } /// -- cgit v1.1