From 2270b252656146d9d74b84665a7ace6c3139db30 Mon Sep 17 00:00:00 2001 From: Mike Mazur Date: Thu, 31 Jul 2008 09:24:28 +0000 Subject: Thanks, sempuki, for a patch that moves all Grid Server's plugins to PluginLoader. Fix issue 1871. --- OpenSim/Data/AssetDataBase.cs | 2 +- OpenSim/Data/MSSQL/MSSQLAssetData.cs | 2 +- OpenSim/Data/MSSQL/MSSQLInventoryData.cs | 20 ++++++++----- OpenSim/Data/MSSQL/MSSQLUserData.cs | 8 ++++++ OpenSim/Data/MySQL/MySQLAssetData.cs | 2 +- OpenSim/Data/MySQL/MySQLGridData.cs | 2 +- OpenSim/Data/MySQL/MySQLInventoryData.cs | 20 ++++++++----- OpenSim/Data/MySQL/MySQLUserData.cs | 23 ++++++++++----- OpenSim/Data/NHibernate/NHibernateInventoryData.cs | 33 ++++++++++++++-------- OpenSim/Data/NHibernate/NHibernateUserData.cs | 8 +++++- OpenSim/Data/SQLite/SQLiteInventoryStore.cs | 33 ++++++++++++++-------- OpenSim/Data/SQLite/SQLiteUserData.cs | 8 ++++++ OpenSim/Data/UserDataBase.cs | 9 ++++-- 13 files changed, 117 insertions(+), 53 deletions(-) (limited to 'OpenSim/Data') diff --git a/OpenSim/Data/AssetDataBase.cs b/OpenSim/Data/AssetDataBase.cs index 6e9e085..690abd0 100644 --- a/OpenSim/Data/AssetDataBase.cs +++ b/OpenSim/Data/AssetDataBase.cs @@ -30,7 +30,7 @@ using OpenSim.Framework; namespace OpenSim.Data { - public abstract class AssetDataBase : IAssetProvider + public abstract class AssetDataBase : IAssetProviderPlugin { public abstract AssetBase FetchAsset(LLUUID uuid); public abstract void CreateAsset(AssetBase asset); diff --git a/OpenSim/Data/MSSQL/MSSQLAssetData.cs b/OpenSim/Data/MSSQL/MSSQLAssetData.cs index e0e20df..443907f 100644 --- a/OpenSim/Data/MSSQL/MSSQLAssetData.cs +++ b/OpenSim/Data/MSSQL/MSSQLAssetData.cs @@ -45,7 +45,7 @@ namespace OpenSim.Data.MSSQL private MSSQLManager database; - #region IAssetProvider Members + #region IAssetProviderPlugin Members /// /// Migration method diff --git a/OpenSim/Data/MSSQL/MSSQLInventoryData.cs b/OpenSim/Data/MSSQL/MSSQLInventoryData.cs index 4a8d6e9..9e60b16 100644 --- a/OpenSim/Data/MSSQL/MSSQLInventoryData.cs +++ b/OpenSim/Data/MSSQL/MSSQLInventoryData.cs @@ -39,7 +39,7 @@ namespace OpenSim.Data.MSSQL /// /// A MSSQL interface for the inventory server /// - public class MSSQLInventoryData : IInventoryData + public class MSSQLInventoryData : IInventoryDataPlugin { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -59,6 +59,12 @@ namespace OpenSim.Data.MSSQL /// private MSSQLManager database; + public void Initialise() + { + m_log.Info("[MSSQLInventoryData]: " + Name + " cannot be default-initialized!"); + throw new PluginNotInitialisedException (Name); + } + /// /// Loads and initialises the MSSQL inventory storage interface /// @@ -134,15 +140,15 @@ namespace OpenSim.Data.MSSQL /// The name of this DB provider /// /// A string containing the name of the DB provider - public string getName() + public string Name { - return "MSSQL Inventory Data Interface"; + get { return "MSSQL Inventory Data Interface"; } } /// /// Closes this DB provider /// - public void Close() + public void Dispose() { // Do nothing. } @@ -151,9 +157,9 @@ namespace OpenSim.Data.MSSQL /// Returns the version of this DB provider /// /// A string containing the DB provider - public string getVersion() + public string Version { - return database.getVersion(); + get { return database.getVersion(); } } /// @@ -681,7 +687,7 @@ namespace OpenSim.Data.MSSQL folders.Add(f); } - // See IInventoryData + // See IInventoryDataPlugin public List getFolderHierarchy(LLUUID parentID) { List folders = new List(); diff --git a/OpenSim/Data/MSSQL/MSSQLUserData.cs b/OpenSim/Data/MSSQL/MSSQLUserData.cs index 0593c62..0703aab 100644 --- a/OpenSim/Data/MSSQL/MSSQLUserData.cs +++ b/OpenSim/Data/MSSQL/MSSQLUserData.cs @@ -52,6 +52,12 @@ namespace OpenSim.Data.MSSQL private string m_usersTableName; private string m_userFriendsTableName; + public override void Initialise() + { + m_log.Info("[MSSQLUserData]: " + Name + " cannot be default-initialized!"); + throw new PluginNotInitialisedException (Name); + } + /// /// Loads and initialises the MSSQL storage plugin /// @@ -93,6 +99,8 @@ namespace OpenSim.Data.MSSQL TestTables(); } + + public override void Dispose () {} /// /// diff --git a/OpenSim/Data/MySQL/MySQLAssetData.cs b/OpenSim/Data/MySQL/MySQLAssetData.cs index 9284ba9..cec736a 100644 --- a/OpenSim/Data/MySQL/MySQLAssetData.cs +++ b/OpenSim/Data/MySQL/MySQLAssetData.cs @@ -112,7 +112,7 @@ namespace OpenSim.Data.MySQL override public void Dispose() { } - #region IAssetProvider Members + #region IAssetProviderPlugin Members /// /// diff --git a/OpenSim/Data/MySQL/MySQLGridData.cs b/OpenSim/Data/MySQL/MySQLGridData.cs index fee457a..4cddbe5 100644 --- a/OpenSim/Data/MySQL/MySQLGridData.cs +++ b/OpenSim/Data/MySQL/MySQLGridData.cs @@ -51,7 +51,7 @@ namespace OpenSim.Data.MySQL override public void Initialise() { - m_log.Info("[MySQLLogData]: " + Name + " cannot be default-initialized!"); + m_log.Info("[MySQLGridData]: " + Name + " cannot be default-initialized!"); throw new PluginNotInitialisedException (Name); } diff --git a/OpenSim/Data/MySQL/MySQLInventoryData.cs b/OpenSim/Data/MySQL/MySQLInventoryData.cs index 5bde40a..0fb49c1 100644 --- a/OpenSim/Data/MySQL/MySQLInventoryData.cs +++ b/OpenSim/Data/MySQL/MySQLInventoryData.cs @@ -38,7 +38,7 @@ namespace OpenSim.Data.MySQL /// /// A MySQL interface for the inventory server /// - public class MySQLInventoryData : IInventoryData + public class MySQLInventoryData : IInventoryDataPlugin { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -48,6 +48,12 @@ namespace OpenSim.Data.MySQL /// private MySQLManager database; + public void Initialise() + { + m_log.Info("[MySQLInventoryData]: " + Name + " cannot be default-initialized!"); + throw new PluginNotInitialisedException (Name); + } + /// /// Initialises Inventory interface /// @@ -183,16 +189,16 @@ namespace OpenSim.Data.MySQL /// The name of this DB provider /// /// Name of DB provider - public string getName() + public string Name { - return "MySQL Inventory Data Interface"; + get { return "MySQL Inventory Data Interface"; } } /// /// Closes this DB provider /// /// do nothing - public void Close() + public void Dispose() { // Do nothing. } @@ -201,9 +207,9 @@ namespace OpenSim.Data.MySQL /// Returns the version of this DB provider /// /// A string containing the DB provider version - public string getVersion() + public string Version { - return database.getVersion(); + get { return database.getVersion(); } } /// @@ -692,7 +698,7 @@ namespace OpenSim.Data.MySQL /// - /// See IInventoryData + /// See IInventoryDataPlugin /// /// /// diff --git a/OpenSim/Data/MySQL/MySQLUserData.cs b/OpenSim/Data/MySQL/MySQLUserData.cs index 11d9c26..d8830de 100644 --- a/OpenSim/Data/MySQL/MySQLUserData.cs +++ b/OpenSim/Data/MySQL/MySQLUserData.cs @@ -55,6 +55,12 @@ namespace OpenSim.Data.MySQL private string m_appearanceTableName = "avatarappearance"; private string m_connectString; + public override void Initialise() + { + m_log.Info("[MySQLUserData]: " + Name + " cannot be default-initialized!"); + throw new PluginNotInitialisedException (Name); + } + /// /// Initialise User Interface /// Loads and initialises the MySQL storage plugin @@ -120,6 +126,9 @@ namespace OpenSim.Data.MySQL m.Update(); } + public override void Dispose () { } + + #region Test and initialization code /// @@ -252,7 +261,7 @@ namespace OpenSim.Data.MySQL UserProfileData row = database.readUserRow(reader); - reader.Close(); + reader.Dispose(); result.Dispose(); return row; } @@ -398,7 +407,7 @@ namespace OpenSim.Data.MySQL Lfli.Add(fli); } - reader.Close(); + reader.Dispose(); result.Dispose(); } } @@ -450,7 +459,7 @@ namespace OpenSim.Data.MySQL user.lastName = (string) reader["lastname"]; returnlist.Add(user); } - reader.Close(); + reader.Dispose(); result.Dispose(); } } @@ -484,7 +493,7 @@ namespace OpenSim.Data.MySQL user.lastName = (string) reader["lastname"]; returnlist.Add(user); } - reader.Close(); + reader.Dispose(); result.Dispose(); } } @@ -517,7 +526,7 @@ namespace OpenSim.Data.MySQL UserProfileData row = database.readUserRow(reader); - reader.Close(); + reader.Dispose(); result.Dispose(); return row; @@ -603,7 +612,7 @@ namespace OpenSim.Data.MySQL UserAgentData row = database.readAgentRow(reader); - reader.Close(); + reader.Dispose(); result.Dispose(); return row; @@ -725,7 +734,7 @@ namespace OpenSim.Data.MySQL AvatarAppearance appearance = database.readAppearanceRow(reader); - reader.Close(); + reader.Dispose(); result.Dispose(); return appearance; diff --git a/OpenSim/Data/NHibernate/NHibernateInventoryData.cs b/OpenSim/Data/NHibernate/NHibernateInventoryData.cs index 153d2d5..657a7b2 100644 --- a/OpenSim/Data/NHibernate/NHibernateInventoryData.cs +++ b/OpenSim/Data/NHibernate/NHibernateInventoryData.cs @@ -42,7 +42,7 @@ using Environment=NHibernate.Cfg.Environment; namespace OpenSim.Data.NHibernate { - public class NHibernateInventoryData: IInventoryData + public class NHibernateInventoryData: IInventoryDataPlugin { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -50,6 +50,12 @@ namespace OpenSim.Data.NHibernate private ISessionFactory factory; private ISession session; + public void Initialise() + { + m_log.Info("[NHibernateInventoryData]: " + Name + " cannot be default-initialized!"); + throw new PluginNotInitialisedException (Name); + } + /// /// Initialises the interface /// @@ -257,7 +263,7 @@ namespace OpenSim.Data.NHibernate /// /// Closes the interface /// - public void Close() + public void Dispose() { } @@ -265,25 +271,28 @@ namespace OpenSim.Data.NHibernate /// The plugin being loaded /// /// A string containing the plugin name - public string getName() + public string Name { - return "NHibernate Inventory Data Interface"; + get { return "NHibernate Inventory Data Interface"; } } /// /// The plugins version /// /// A string containing the plugin version - public string getVersion() + public string Version { - Module module = GetType().Module; - // string dllName = module.Assembly.ManifestModule.Name; - Version dllVersion = module.Assembly.GetName().Version; + get + { + Module module = GetType().Module; + // string dllName = module.Assembly.ManifestModule.Name; + Version dllVersion = module.Assembly.GetName().Version; - return - string.Format("{0}.{1}.{2}.{3}", dllVersion.Major, dllVersion.Minor, dllVersion.Build, - dllVersion.Revision); + return + string.Format("{0}.{1}.{2}.{3}", dllVersion.Major, dllVersion.Minor, dllVersion.Build, + dllVersion.Revision); + } } // Move seems to be just update @@ -369,7 +378,7 @@ namespace OpenSim.Data.NHibernate return folders; } - // See IInventoryData + // See IInventoryDataPlugin public List getFolderHierarchy(LLUUID parentID) { List folders = new List(); diff --git a/OpenSim/Data/NHibernate/NHibernateUserData.cs b/OpenSim/Data/NHibernate/NHibernateUserData.cs index 9d9aec9..bceae7c 100644 --- a/OpenSim/Data/NHibernate/NHibernateUserData.cs +++ b/OpenSim/Data/NHibernate/NHibernateUserData.cs @@ -53,6 +53,12 @@ namespace OpenSim.Data.NHibernate private ISessionFactory factory; private ISession session; + public override void Initialise() + { + m_log.Info("[NHibernateUserData]: " + Name + " cannot be default-initialized!"); + throw new PluginNotInitialisedException (Name); + } + public override void Initialise(string connect) { char[] split = {';'}; @@ -320,7 +326,7 @@ namespace OpenSim.Data.NHibernate get { return "0.1"; } } - public void Dispose() + public override void Dispose() { } diff --git a/OpenSim/Data/SQLite/SQLiteInventoryStore.cs b/OpenSim/Data/SQLite/SQLiteInventoryStore.cs index 99560a0..ef4ef99 100644 --- a/OpenSim/Data/SQLite/SQLiteInventoryStore.cs +++ b/OpenSim/Data/SQLite/SQLiteInventoryStore.cs @@ -39,7 +39,7 @@ namespace OpenSim.Data.SQLite /// /// An Inventory Interface to the SQLite database /// - public class SQLiteInventoryStore : SQLiteUtil, IInventoryData + public class SQLiteInventoryStore : SQLiteUtil, IInventoryDataPlugin { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -50,6 +50,12 @@ namespace OpenSim.Data.SQLite private SqliteDataAdapter invItemsDa; private SqliteDataAdapter invFoldersDa; + public void Initialise() + { + m_log.Info("[SQLiteInventoryData]: " + Name + " cannot be default-initialized!"); + throw new PluginNotInitialisedException (Name); + } + /// /// /// Initialises Inventory interface @@ -277,7 +283,7 @@ namespace OpenSim.Data.SQLite /// /// Closes the inventory interface /// - public void Close() + public void Dispose() { } @@ -285,25 +291,28 @@ namespace OpenSim.Data.SQLite /// The name of this DB provider /// /// Name of DB provider - public string getName() + public string Name { - return "SQLite Inventory Data Interface"; + get { return "SQLite Inventory Data Interface"; } } /// /// Returns the version of this DB provider /// /// A string containing the DB provider version - public string getVersion() + public string Version { - Module module = GetType().Module; - // string dllName = module.Assembly.ManifestModule.Name; - Version dllVersion = module.Assembly.GetName().Version; + get + { + Module module = GetType().Module; + // string dllName = module.Assembly.ManifestModule.Name; + Version dllVersion = module.Assembly.GetName().Version; - return - string.Format("{0}.{1}.{2}.{3}", dllVersion.Major, dllVersion.Minor, dllVersion.Build, - dllVersion.Revision); + return + string.Format("{0}.{1}.{2}.{3}", dllVersion.Major, dllVersion.Minor, dllVersion.Build, + dllVersion.Revision); + } } /// @@ -399,7 +408,7 @@ namespace OpenSim.Data.SQLite } /// - /// See IInventoryData + /// See IInventoryDataPlugin /// /// /// diff --git a/OpenSim/Data/SQLite/SQLiteUserData.cs b/OpenSim/Data/SQLite/SQLiteUserData.cs index c7673bd..2d3687c 100644 --- a/OpenSim/Data/SQLite/SQLiteUserData.cs +++ b/OpenSim/Data/SQLite/SQLiteUserData.cs @@ -65,6 +65,12 @@ namespace OpenSim.Data.SQLite private SqliteDataAdapter daf; SqliteConnection g_conn; + public override void Initialise() + { + m_log.Info("[SQLiteUserData]: " + Name + " cannot be default-initialized!"); + throw new PluginNotInitialisedException (Name); + } + /// /// /// Initialises User Interface @@ -124,6 +130,8 @@ namespace OpenSim.Data.SQLite return; } + public override void Dispose () {} + /// /// see IUserData, /// Get user data profile by UUID diff --git a/OpenSim/Data/UserDataBase.cs b/OpenSim/Data/UserDataBase.cs index eb21aee..e4e39d6 100644 --- a/OpenSim/Data/UserDataBase.cs +++ b/OpenSim/Data/UserDataBase.cs @@ -55,9 +55,6 @@ namespace OpenSim.Data public abstract List GetUserFriendList(LLUUID friendlistowner); public abstract bool MoneyTransferRequest(LLUUID from, LLUUID to, uint amount); public abstract bool InventoryTransferRequest(LLUUID from, LLUUID to, LLUUID inventory); - public abstract string Version {get;} - public abstract string Name {get;} - public abstract void Initialise(string connect); public abstract List GeneratePickerResults(LLUUID queryID, string query); public abstract AvatarAppearance GetUserAppearance(LLUUID user); public abstract void UpdateUserAppearance(LLUUID user, AvatarAppearance appearance); @@ -78,5 +75,11 @@ namespace OpenSim.Data public abstract void AddAttachment(LLUUID user, LLUUID item); public abstract void RemoveAttachment(LLUUID user, LLUUID item); public abstract List GetAttachments(LLUUID user); + + public abstract string Version {get;} + public abstract string Name {get;} + public abstract void Initialise(string connect); + public abstract void Initialise(); + public abstract void Dispose(); } } -- cgit v1.1