diff --git a/OpenSim/Framework/Data.MSSQL/MSSQLAssetData.cs b/OpenSim/Framework/Data.MSSQL/MSSQLAssetData.cs index b8d57a73ee..059bb5eec5 100644 --- a/OpenSim/Framework/Data.MSSQL/MSSQLAssetData.cs +++ b/OpenSim/Framework/Data.MSSQL/MSSQLAssetData.cs @@ -34,7 +34,7 @@ using OpenSim.Framework.Console; namespace OpenSim.Framework.Data.MSSQL { - internal class MSSQLAssetData : IAssetProvider + internal class MSSQLAssetData : AssetDataBase { private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); @@ -66,7 +66,7 @@ namespace OpenSim.Framework.Data.MSSQL UpgradeAssetsTable(tableList["assets"]); } - public AssetBase FetchAsset(LLUUID assetID) + override public AssetBase FetchAsset(LLUUID assetID) { AssetBase asset = null; @@ -83,7 +83,7 @@ namespace OpenSim.Framework.Data.MSSQL return asset; } - public void CreateAsset(AssetBase asset) + override public void CreateAsset(AssetBase asset) { if (ExistsAsset((LLUUID) asset.FullID)) { @@ -129,7 +129,7 @@ namespace OpenSim.Framework.Data.MSSQL } - public void UpdateAsset(AssetBase asset) + override public void UpdateAsset(AssetBase asset) { SqlCommand command = new SqlCommand("UPDATE assets set id = @id, " + "name = @name, " + @@ -169,7 +169,7 @@ namespace OpenSim.Framework.Data.MSSQL } } - public bool ExistsAsset(LLUUID uuid) + override public bool ExistsAsset(LLUUID uuid) { if (FetchAsset(uuid) != null) { @@ -181,7 +181,7 @@ namespace OpenSim.Framework.Data.MSSQL /// /// All writes are immediately commited to the database, so this is a no-op /// - public void CommitAssets() + override public void CommitAssets() { } @@ -189,7 +189,7 @@ namespace OpenSim.Framework.Data.MSSQL #region IPlugin Members - public void Initialise() + override public void Initialise() { IniFile GridDataMySqlFile = new IniFile("mssql_connection.ini"); string settingDataSource = GridDataMySqlFile.ParseFileReadValue("data_source"); @@ -205,13 +205,13 @@ namespace OpenSim.Framework.Data.MSSQL TestTables(); } - public string Version + override public string Version { // get { return database.getVersion(); } get { return database.getVersion(); } } - public string Name + override public string Name { get { return "MSSQL Asset storage engine"; } } diff --git a/OpenSim/Framework/Data.MySQL/MySQLAssetData.cs b/OpenSim/Framework/Data.MySQL/MySQLAssetData.cs index b439582d2c..79994ae93c 100644 --- a/OpenSim/Framework/Data.MySQL/MySQLAssetData.cs +++ b/OpenSim/Framework/Data.MySQL/MySQLAssetData.cs @@ -34,7 +34,7 @@ using OpenSim.Framework.Console; namespace OpenSim.Framework.Data.MySQL { - internal class MySQLAssetData : IAssetProvider + internal class MySQLAssetData : AssetDataBase, IPlugin { private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); @@ -66,7 +66,7 @@ namespace OpenSim.Framework.Data.MySQL UpgradeAssetsTable(tableList["assets"]); } - public AssetBase FetchAsset(LLUUID assetID) + override public AssetBase FetchAsset(LLUUID assetID) { AssetBase asset = null; lock (_dbConnection) @@ -108,7 +108,7 @@ namespace OpenSim.Framework.Data.MySQL return asset; } - public void CreateAsset(AssetBase asset) + override public void CreateAsset(AssetBase asset) { lock (_dbConnection) { @@ -147,12 +147,12 @@ namespace OpenSim.Framework.Data.MySQL } } - public void UpdateAsset(AssetBase asset) + override public void UpdateAsset(AssetBase asset) { CreateAsset(asset); } - public bool ExistsAsset(LLUUID uuid) + override public bool ExistsAsset(LLUUID uuid) { throw new Exception("The method or operation is not implemented."); } @@ -160,7 +160,7 @@ namespace OpenSim.Framework.Data.MySQL /// /// All writes are immediately commited to the database, so this is a no-op /// - public void CommitAssets() + override public void CommitAssets() { } @@ -168,7 +168,7 @@ namespace OpenSim.Framework.Data.MySQL #region IPlugin Members - public void Initialise() + override public void Initialise() { IniFile GridDataMySqlFile = new IniFile("mysql_connection.ini"); string hostname = GridDataMySqlFile.ParseFileReadValue("hostname"); @@ -183,12 +183,12 @@ namespace OpenSim.Framework.Data.MySQL TestTables(); } - public string Version + override public string Version { get { return _dbConnection.getVersion(); } } - public string Name + override public string Name { get { return "MySQL Asset storage engine"; } } diff --git a/OpenSim/Framework/Data.SQLite/SQLiteAssetData.cs b/OpenSim/Framework/Data.SQLite/SQLiteAssetData.cs index 0703e54531..afa73b1589 100644 --- a/OpenSim/Framework/Data.SQLite/SQLiteAssetData.cs +++ b/OpenSim/Framework/Data.SQLite/SQLiteAssetData.cs @@ -37,7 +37,7 @@ namespace OpenSim.Framework.Data.SQLite /// /// A User storage interface for the DB4o database system /// - public class SQLiteAssetData : SQLiteBase, IAssetProvider + public class SQLiteAssetData : AssetDataBase { private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); @@ -63,7 +63,7 @@ namespace OpenSim.Framework.Data.SQLite return; } - public AssetBase FetchAsset(LLUUID uuid) + override public AssetBase FetchAsset(LLUUID uuid) { using (SqliteCommand cmd = new SqliteCommand(SelectAssetSQL, m_conn)) @@ -86,7 +86,7 @@ namespace OpenSim.Framework.Data.SQLite } } - public void CreateAsset(AssetBase asset) + override public void CreateAsset(AssetBase asset) { m_log.Info("[SQLITE]: Creating Asset " + Util.ToRawUuidString(asset.FullID)); if (ExistsAsset(asset.FullID)) @@ -111,7 +111,7 @@ namespace OpenSim.Framework.Data.SQLite } } - public void UpdateAsset(AssetBase asset) + override public void UpdateAsset(AssetBase asset) { LogAssetLoad(asset); @@ -144,7 +144,7 @@ namespace OpenSim.Framework.Data.SQLite asset.InvType, temporary, local, assetLength)); } - public bool ExistsAsset(LLUUID uuid) + override public bool ExistsAsset(LLUUID uuid) { using (SqliteCommand cmd = new SqliteCommand(SelectAssetSQL, m_conn)) { @@ -175,7 +175,7 @@ namespace OpenSim.Framework.Data.SQLite } } - public void CommitAssets() // force a sync to the database + override public void CommitAssets() // force a sync to the database { m_log.Info("[SQLITE]: Attempting commit"); // lock (ds) @@ -197,14 +197,14 @@ namespace OpenSim.Framework.Data.SQLite { DataTable assets = new DataTable("assets"); - createCol(assets, "UUID", typeof (String)); - createCol(assets, "Name", typeof (String)); - createCol(assets, "Description", typeof (String)); - createCol(assets, "Type", typeof (Int32)); - createCol(assets, "InvType", typeof (Int32)); - createCol(assets, "Local", typeof (Boolean)); - createCol(assets, "Temporary", typeof (Boolean)); - createCol(assets, "Data", typeof (Byte[])); + SQLiteUtil.createCol(assets, "UUID", typeof (String)); + SQLiteUtil.createCol(assets, "Name", typeof (String)); + SQLiteUtil.createCol(assets, "Description", typeof (String)); + SQLiteUtil.createCol(assets, "Type", typeof (Int32)); + SQLiteUtil.createCol(assets, "InvType", typeof (Int32)); + SQLiteUtil.createCol(assets, "Local", typeof (Boolean)); + SQLiteUtil.createCol(assets, "Temporary", typeof (Boolean)); + SQLiteUtil.createCol(assets, "Data", typeof (Byte[])); // Add in contraints assets.PrimaryKey = new DataColumn[] {assets.Columns["UUID"]}; return assets; @@ -248,7 +248,7 @@ namespace OpenSim.Framework.Data.SQLite private void InitDB(SqliteConnection conn) { - string createAssets = defineTable(createAssetsTable()); + string createAssets = SQLiteUtil.defineTable(createAssetsTable()); SqliteCommand pcmd = new SqliteCommand(createAssets, conn); pcmd.ExecuteNonQuery(); } @@ -272,7 +272,7 @@ namespace OpenSim.Framework.Data.SQLite #region IPlugin interface - public string Version + override public string Version { get { @@ -286,12 +286,12 @@ namespace OpenSim.Framework.Data.SQLite } } - public void Initialise() + override public void Initialise() { Initialise("AssetStorage.db", ""); } - public string Name + override public string Name { get { return "SQLite Asset storage engine"; } } diff --git a/OpenSim/Framework/Data.SQLite/SQLiteInventoryStore.cs b/OpenSim/Framework/Data.SQLite/SQLiteInventoryStore.cs index 97fdc96826..14a3e1a1dd 100644 --- a/OpenSim/Framework/Data.SQLite/SQLiteInventoryStore.cs +++ b/OpenSim/Framework/Data.SQLite/SQLiteInventoryStore.cs @@ -35,7 +35,7 @@ using OpenSim.Framework.Console; namespace OpenSim.Framework.Data.SQLite { - public class SQLiteInventoryStore : SQLiteBase, IInventoryData + public class SQLiteInventoryStore : SQLiteUtil, IInventoryData { private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); diff --git a/OpenSim/Framework/Data.SQLite/SQLiteManager.cs b/OpenSim/Framework/Data.SQLite/SQLiteManager.cs index bec0cd8ce6..b383b0d6b5 100644 --- a/OpenSim/Framework/Data.SQLite/SQLiteManager.cs +++ b/OpenSim/Framework/Data.SQLite/SQLiteManager.cs @@ -35,7 +35,7 @@ using OpenSim.Framework.Console; namespace OpenSim.Framework.Data.SQLite { - internal class SQLiteManager : SQLiteBase + internal class SQLiteManager : SQLiteUtil { private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); diff --git a/OpenSim/Framework/Data.SQLite/SQLiteUserData.cs b/OpenSim/Framework/Data.SQLite/SQLiteUserData.cs index 0b2df9d695..4a582ace8e 100644 --- a/OpenSim/Framework/Data.SQLite/SQLiteUserData.cs +++ b/OpenSim/Framework/Data.SQLite/SQLiteUserData.cs @@ -37,7 +37,7 @@ namespace OpenSim.Framework.Data.SQLite /// /// A User storage interface for the SQLite database system /// - public class SQLiteUserData : SQLiteBase, IUserData + public class SQLiteUserData : SQLiteUtil, IUserData { private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); diff --git a/OpenSim/Framework/Data.SQLite/SQLiteBase.cs b/OpenSim/Framework/Data.SQLite/SQLiteUtils.cs similarity index 93% rename from OpenSim/Framework/Data.SQLite/SQLiteBase.cs rename to OpenSim/Framework/Data.SQLite/SQLiteUtils.cs index 8997faa277..1334e53384 100644 --- a/OpenSim/Framework/Data.SQLite/SQLiteBase.cs +++ b/OpenSim/Framework/Data.SQLite/SQLiteUtils.cs @@ -34,17 +34,17 @@ namespace OpenSim.Framework.Data.SQLite /// /// A base class for methods needed by all SQLite database classes /// - public class SQLiteBase + public class SQLiteUtil { /*********************************************************************** * - * Database Definition Functions + * Database Definition Helper Functions * * This should be db agnostic as we define them in ADO.NET terms * **********************************************************************/ - protected static void createCol(DataTable dt, string name, Type type) + public static void createCol(DataTable dt, string name, Type type) { DataColumn col = new DataColumn(name, type); dt.Columns.Add(col); @@ -60,7 +60,7 @@ namespace OpenSim.Framework.Data.SQLite * **********************************************************************/ - protected static SqliteCommand createInsertCommand(string table, DataTable dt) + public static SqliteCommand createInsertCommand(string table, DataTable dt) { /** * This is subtle enough to deserve some commentary. @@ -95,7 +95,7 @@ namespace OpenSim.Framework.Data.SQLite return cmd; } - protected static SqliteCommand createUpdateCommand(string table, string pk, DataTable dt) + public static SqliteCommand createUpdateCommand(string table, string pk, DataTable dt) { string sql = "update " + table + " set "; string subsql = String.Empty; @@ -123,7 +123,7 @@ namespace OpenSim.Framework.Data.SQLite } - protected static string defineTable(DataTable dt) + public static string defineTable(DataTable dt) { string sql = "create table " + dt.TableName + "("; string subsql = String.Empty; @@ -168,7 +168,7 @@ namespace OpenSim.Framework.Data.SQLite /// for us. /// ///a built sqlite parameter - protected static SqliteParameter createSqliteParameter(string name, Type type) + public static SqliteParameter createSqliteParameter(string name, Type type) { SqliteParameter param = new SqliteParameter(); param.ParameterName = ":" + name; @@ -184,7 +184,7 @@ namespace OpenSim.Framework.Data.SQLite * **********************************************************************/ - protected static DbType dbtypeFromType(Type type) + public static DbType dbtypeFromType(Type type) { if (type == typeof (String)) { @@ -226,7 +226,7 @@ namespace OpenSim.Framework.Data.SQLite // this is something we'll need to implement for each db // slightly differently. - protected static string sqliteType(Type type) + public static string sqliteType(Type type) { if (type == typeof (String)) { diff --git a/OpenSim/Framework/Data/AssetDataBase.cs b/OpenSim/Framework/Data/AssetDataBase.cs new file mode 100644 index 0000000000..21623581f1 --- /dev/null +++ b/OpenSim/Framework/Data/AssetDataBase.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Text; +using libsecondlife; + +namespace OpenSim.Framework.Data +{ + public abstract class AssetDataBase : IAssetProvider + { + public abstract AssetBase FetchAsset(LLUUID uuid); + public abstract void CreateAsset(AssetBase asset); + public abstract void UpdateAsset(AssetBase asset); + public abstract bool ExistsAsset(LLUUID uuid); + public abstract void CommitAssets(); + + public abstract string Version { get; } + public abstract string Name { get; } + public abstract void Initialise(); + } +} diff --git a/OpenSim/Framework/Data/DataStoreBase.cs b/OpenSim/Framework/Data/DataStoreBase.cs new file mode 100644 index 0000000000..671d0f03a7 --- /dev/null +++ b/OpenSim/Framework/Data/DataStoreBase.cs @@ -0,0 +1,10 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace OpenSim.Framework.Data +{ + public abstract class DataStoreBase + { + } +} diff --git a/OpenSim/Framework/Data/GridDataBase.cs b/OpenSim/Framework/Data/GridDataBase.cs new file mode 100644 index 0000000000..e7333b4c3a --- /dev/null +++ b/OpenSim/Framework/Data/GridDataBase.cs @@ -0,0 +1,10 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace OpenSim.Framework.Data +{ + public abstract class GridDataBase + { + } +} diff --git a/OpenSim/Framework/Data/InventoryDataBase.cs b/OpenSim/Framework/Data/InventoryDataBase.cs new file mode 100644 index 0000000000..d88acff35a --- /dev/null +++ b/OpenSim/Framework/Data/InventoryDataBase.cs @@ -0,0 +1,10 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace OpenSim.Framework.Data +{ + public abstract class InventoryDataBase + { + } +} diff --git a/OpenSim/Framework/Data/UserDataBase.cs b/OpenSim/Framework/Data/UserDataBase.cs new file mode 100644 index 0000000000..a704ed41bb --- /dev/null +++ b/OpenSim/Framework/Data/UserDataBase.cs @@ -0,0 +1,10 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace OpenSim.Framework.Data +{ + public abstract class UserDataBase + { + } +}