From 0e16488ca8898de80b8e169d03a78c64a9e26816 Mon Sep 17 00:00:00 2001
From: lbsa71
Date: Fri, 28 Mar 2008 15:05:06 +0000
Subject: * Introduced base abstract provider class for GridData
---
OpenSim/Framework/Data.DB4o/DB4oGridData.cs | 24 ++++++++++++------------
OpenSim/Framework/Data.MSSQL/MSSQLGridData.cs | 24 ++++++++++++------------
OpenSim/Framework/Data.MySQL/MySQLGridData.cs | 24 ++++++++++++------------
OpenSim/Framework/Data.SQLite/SQLiteGridData.cs | 24 ++++++++++++------------
OpenSim/Framework/Data/GridDataBase.cs | 14 +++++++++++++-
5 files changed, 61 insertions(+), 49 deletions(-)
(limited to 'OpenSim')
diff --git a/OpenSim/Framework/Data.DB4o/DB4oGridData.cs b/OpenSim/Framework/Data.DB4o/DB4oGridData.cs
index 9320ef9..31b13e3 100644
--- a/OpenSim/Framework/Data.DB4o/DB4oGridData.cs
+++ b/OpenSim/Framework/Data.DB4o/DB4oGridData.cs
@@ -34,7 +34,7 @@ namespace OpenSim.Framework.Data.DB4o
///
/// A grid server storage mechanism employing the DB4o database system
///
- internal class DB4oGridData : IGridData
+ internal class DB4oGridData : GridDataBase
{
///
/// The database manager object
@@ -44,7 +44,7 @@ namespace OpenSim.Framework.Data.DB4o
///
/// Called when the plugin is first loaded (as constructors are not called)
///
- public void Initialise()
+ override public void Initialise()
{
manager = new DB4oGridManager("gridserver.yap");
}
@@ -57,7 +57,7 @@ namespace OpenSim.Framework.Data.DB4o
/// maximum X coordinate
/// maximum Y coordinate
/// An array of region profiles
- public RegionProfileData[] GetProfilesInRange(uint a, uint b, uint c, uint d)
+ override public RegionProfileData[] GetProfilesInRange(uint a, uint b, uint c, uint d)
{
return null;
}
@@ -67,7 +67,7 @@ namespace OpenSim.Framework.Data.DB4o
///
/// The handle to search for
/// A region profile
- public RegionProfileData GetProfileByHandle(ulong handle)
+ override public RegionProfileData GetProfileByHandle(ulong handle)
{
lock (manager.simProfiles)
{
@@ -87,7 +87,7 @@ namespace OpenSim.Framework.Data.DB4o
///
/// The region ID code
/// A region profile
- public RegionProfileData GetProfileByLLUUID(LLUUID uuid)
+ override public RegionProfileData GetProfileByLLUUID(LLUUID uuid)
{
lock (manager.simProfiles)
{
@@ -98,7 +98,7 @@ namespace OpenSim.Framework.Data.DB4o
"). Total Registered Regions: " + manager.simProfiles.Count);
}
- public RegionProfileData GetProfileByString(string regionName)
+ override public RegionProfileData GetProfileByString(string regionName)
{
throw new Exception("GetProfileByString Not supported in DB4oGridData");
//return null;
@@ -109,7 +109,7 @@ namespace OpenSim.Framework.Data.DB4o
///
/// The profile to add
/// A dataresponse enum indicating success
- public DataResponse AddProfile(RegionProfileData profile)
+ override public DataResponse AddProfile(RegionProfileData profile)
{
lock (manager.simProfiles)
{
@@ -131,7 +131,7 @@ namespace OpenSim.Framework.Data.DB4o
/// The location the region is logging into (unused in Db4o)
/// The shared secret
/// Authenticated?
- public bool AuthenticateSim(LLUUID uuid, ulong handle, string key)
+ override public bool AuthenticateSim(LLUUID uuid, ulong handle, string key)
{
if (manager.simProfiles[uuid].regionRecvKey == key)
return true;
@@ -141,7 +141,7 @@ namespace OpenSim.Framework.Data.DB4o
///
/// Shuts down the database
///
- public void Close()
+ override public void Close()
{
manager = null;
}
@@ -160,7 +160,7 @@ namespace OpenSim.Framework.Data.DB4o
/// Returns the providers name
///
/// The name of the storage system
- public string getName()
+ override public string getName()
{
return "DB4o Grid Provider";
}
@@ -169,12 +169,12 @@ namespace OpenSim.Framework.Data.DB4o
/// Returns the providers version
///
/// The version of the storage system
- public string getVersion()
+ override public string getVersion()
{
return "0.1";
}
- public ReservationData GetReservationAtPoint(uint x, uint y)
+ override public ReservationData GetReservationAtPoint(uint x, uint y)
{
return null;
}
diff --git a/OpenSim/Framework/Data.MSSQL/MSSQLGridData.cs b/OpenSim/Framework/Data.MSSQL/MSSQLGridData.cs
index 5a0f3f5..9bd8acc 100644
--- a/OpenSim/Framework/Data.MSSQL/MSSQLGridData.cs
+++ b/OpenSim/Framework/Data.MSSQL/MSSQLGridData.cs
@@ -38,7 +38,7 @@ namespace OpenSim.Framework.Data.MSSQL
///
/// A grid data interface for Microsoft SQL Server
///
- public class MSSQLGridData : IGridData
+ public class MSSQLGridData : GridDataBase
{
private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
@@ -52,7 +52,7 @@ namespace OpenSim.Framework.Data.MSSQL
///
/// Initialises the Grid Interface
///
- public void Initialise()
+ override public void Initialise()
{
IniFile iniFile = new IniFile("mssql_connection.ini");
@@ -94,7 +94,7 @@ namespace OpenSim.Framework.Data.MSSQL
///
/// Shuts down the grid interface
///
- public void Close()
+ override public void Close()
{
database.Close();
}
@@ -103,7 +103,7 @@ namespace OpenSim.Framework.Data.MSSQL
/// Returns the storage system name
///
/// A string containing the storage system name
- public string getName()
+ override public string getName()
{
return "Sql OpenGridData";
}
@@ -112,7 +112,7 @@ namespace OpenSim.Framework.Data.MSSQL
/// Returns the storage system version
///
/// A string containing the storage system version
- public string getVersion()
+ override public string getVersion()
{
return "0.1";
}
@@ -125,7 +125,7 @@ namespace OpenSim.Framework.Data.MSSQL
/// maximum X coordinate
/// maximum Y coordinate
/// An array of region profiles
- public RegionProfileData[] GetProfilesInRange(uint a, uint b, uint c, uint d)
+ override public RegionProfileData[] GetProfilesInRange(uint a, uint b, uint c, uint d)
{
return null;
}
@@ -135,7 +135,7 @@ namespace OpenSim.Framework.Data.MSSQL
///
/// Region location handle
/// Sim profile
- public RegionProfileData GetProfileByHandle(ulong handle)
+ override public RegionProfileData GetProfileByHandle(ulong handle)
{
IDataReader reader = null;
try
@@ -166,7 +166,7 @@ namespace OpenSim.Framework.Data.MSSQL
///
/// The region UUID
/// The sim profile
- public RegionProfileData GetProfileByLLUUID(LLUUID uuid)
+ override public RegionProfileData GetProfileByLLUUID(LLUUID uuid)
{
Dictionary param = new Dictionary();
param["uuid"] = uuid.ToString();
@@ -185,7 +185,7 @@ namespace OpenSim.Framework.Data.MSSQL
///
/// The region name search query
/// The sim profile
- public RegionProfileData GetProfileByString(string regionName)
+ override public RegionProfileData GetProfileByString(string regionName)
{
if (regionName.Length > 2)
{
@@ -226,7 +226,7 @@ namespace OpenSim.Framework.Data.MSSQL
///
/// The profile to add
/// A dataresponse enum indicating success
- public DataResponse AddProfile(RegionProfileData profile)
+ override public DataResponse AddProfile(RegionProfileData profile)
{
try
{
@@ -327,7 +327,7 @@ namespace OpenSim.Framework.Data.MSSQL
/// The attempted regionHandle of the challenger
/// The secret
/// Whether the secret and regionhandle match the database entry for UUID
- public bool AuthenticateSim(LLUUID uuid, ulong handle, string authkey)
+ override public bool AuthenticateSim(LLUUID uuid, ulong handle, string authkey)
{
bool throwHissyFit = false; // Should be true by 1.0
@@ -358,7 +358,7 @@ namespace OpenSim.Framework.Data.MSSQL
return false;
}
- public ReservationData GetReservationAtPoint(uint x, uint y)
+ override public ReservationData GetReservationAtPoint(uint x, uint y)
{
return null;
}
diff --git a/OpenSim/Framework/Data.MySQL/MySQLGridData.cs b/OpenSim/Framework/Data.MySQL/MySQLGridData.cs
index 0cba9f0..61ab067 100644
--- a/OpenSim/Framework/Data.MySQL/MySQLGridData.cs
+++ b/OpenSim/Framework/Data.MySQL/MySQLGridData.cs
@@ -39,7 +39,7 @@ namespace OpenSim.Framework.Data.MySQL
///
/// A MySQL Interface for the Grid Server
///
- public class MySQLGridData : IGridData
+ public class MySQLGridData : GridDataBase
{
private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
@@ -51,7 +51,7 @@ namespace OpenSim.Framework.Data.MySQL
///
/// Initialises the Grid Interface
///
- public void Initialise()
+ override public void Initialise()
{
IniFile GridDataMySqlFile = new IniFile("mysql_connection.ini");
string settingHostname = GridDataMySqlFile.ParseFileReadValue("hostname");
@@ -113,7 +113,7 @@ namespace OpenSim.Framework.Data.MySQL
///
/// Shuts down the grid interface
///
- public void Close()
+ override public void Close()
{
database.Close();
}
@@ -122,7 +122,7 @@ namespace OpenSim.Framework.Data.MySQL
/// Returns the plugin name
///
/// Plugin name
- public string getName()
+ override public string getName()
{
return "MySql OpenGridData";
}
@@ -131,7 +131,7 @@ namespace OpenSim.Framework.Data.MySQL
/// Returns the plugin version
///
/// Plugin version
- public string getVersion()
+ override public string getVersion()
{
return "0.1";
}
@@ -144,7 +144,7 @@ namespace OpenSim.Framework.Data.MySQL
/// Maximum X coordinate
/// Maximum Y coordinate
///
- public RegionProfileData[] GetProfilesInRange(uint xmin, uint ymin, uint xmax, uint ymax)
+ override public RegionProfileData[] GetProfilesInRange(uint xmin, uint ymin, uint xmax, uint ymax)
{
try
{
@@ -189,7 +189,7 @@ namespace OpenSim.Framework.Data.MySQL
///
/// Region location handle
/// Sim profile
- public RegionProfileData GetProfileByHandle(ulong handle)
+ override public RegionProfileData GetProfileByHandle(ulong handle)
{
try
{
@@ -221,7 +221,7 @@ namespace OpenSim.Framework.Data.MySQL
///
/// The region UUID
/// The sim profile
- public RegionProfileData GetProfileByLLUUID(LLUUID uuid)
+ override public RegionProfileData GetProfileByLLUUID(LLUUID uuid)
{
try
{
@@ -253,7 +253,7 @@ namespace OpenSim.Framework.Data.MySQL
///
/// The region name search query
/// The sim profile
- public RegionProfileData GetProfileByString(string regionName)
+ override public RegionProfileData GetProfileByString(string regionName)
{
if (regionName.Length > 2)
{
@@ -294,7 +294,7 @@ namespace OpenSim.Framework.Data.MySQL
///
/// The profile to add
/// Successful?
- public DataResponse AddProfile(RegionProfileData profile)
+ override public DataResponse AddProfile(RegionProfileData profile)
{
lock (database)
{
@@ -337,7 +337,7 @@ namespace OpenSim.Framework.Data.MySQL
/// The attempted regionHandle of the challenger
/// The secret
/// Whether the secret and regionhandle match the database entry for UUID
- public bool AuthenticateSim(LLUUID uuid, ulong handle, string authkey)
+ override public bool AuthenticateSim(LLUUID uuid, ulong handle, string authkey)
{
bool throwHissyFit = false; // Should be true by 1.0
@@ -369,7 +369,7 @@ namespace OpenSim.Framework.Data.MySQL
return false;
}
- public ReservationData GetReservationAtPoint(uint x, uint y)
+ override public ReservationData GetReservationAtPoint(uint x, uint y)
{
try
{
diff --git a/OpenSim/Framework/Data.SQLite/SQLiteGridData.cs b/OpenSim/Framework/Data.SQLite/SQLiteGridData.cs
index 397ef82..94e8e50 100644
--- a/OpenSim/Framework/Data.SQLite/SQLiteGridData.cs
+++ b/OpenSim/Framework/Data.SQLite/SQLiteGridData.cs
@@ -37,7 +37,7 @@ namespace OpenSim.Framework.Data.SQLite
///
/// A Grid Interface to the SQLite database
///
- public class SQLiteGridData : IGridData
+ public class SQLiteGridData : GridDataBase
{
///
/// A database manager
@@ -47,7 +47,7 @@ namespace OpenSim.Framework.Data.SQLite
///
/// Initialises the Grid Interface
///
- public void Initialise()
+ override public void Initialise()
{
database = new SQLiteManager("localhost", "db", "user", "password", "false");
}
@@ -55,7 +55,7 @@ namespace OpenSim.Framework.Data.SQLite
///
/// Shuts down the grid interface
///
- public void Close()
+ override public void Close()
{
database.Close();
}
@@ -64,7 +64,7 @@ namespace OpenSim.Framework.Data.SQLite
/// Returns the name of this grid interface
///
/// A string containing the grid interface
- public string getName()
+ override public string getName()
{
return "SQLite OpenGridData";
}
@@ -73,7 +73,7 @@ namespace OpenSim.Framework.Data.SQLite
/// Returns the version of this grid interface
///
/// A string containing the version
- public string getVersion()
+ override public string getVersion()
{
return "0.1";
}
@@ -86,7 +86,7 @@ namespace OpenSim.Framework.Data.SQLite
/// maximum X coordinate
/// maximum Y coordinate
/// An array of region profiles
- public RegionProfileData[] GetProfilesInRange(uint a, uint b, uint c, uint d)
+ override public RegionProfileData[] GetProfilesInRange(uint a, uint b, uint c, uint d)
{
return null;
}
@@ -96,7 +96,7 @@ namespace OpenSim.Framework.Data.SQLite
///
/// Region location handle
/// Sim profile
- public RegionProfileData GetProfileByHandle(ulong handle)
+ override public RegionProfileData GetProfileByHandle(ulong handle)
{
Dictionary param = new Dictionary();
param["handle"] = handle.ToString();
@@ -116,7 +116,7 @@ namespace OpenSim.Framework.Data.SQLite
///
/// The region name search query
/// The sim profile
- public RegionProfileData GetProfileByString(string regionName)
+ override public RegionProfileData GetProfileByString(string regionName)
{
if (regionName.Length > 2)
{
@@ -145,7 +145,7 @@ namespace OpenSim.Framework.Data.SQLite
///
/// The region UUID
/// The sim profile
- public RegionProfileData GetProfileByLLUUID(LLUUID uuid)
+ override public RegionProfileData GetProfileByLLUUID(LLUUID uuid)
{
Dictionary param = new Dictionary();
param["uuid"] = uuid.ToString();
@@ -175,7 +175,7 @@ namespace OpenSim.Framework.Data.SQLite
///
/// The profile to add
/// A dataresponse enum indicating success
- public DataResponse AddProfile(RegionProfileData profile)
+ override public DataResponse AddProfile(RegionProfileData profile)
{
if (database.insertRow(profile))
{
@@ -194,7 +194,7 @@ namespace OpenSim.Framework.Data.SQLite
/// The attempted regionHandle of the challenger
/// The secret
/// Whether the secret and regionhandle match the database entry for UUID
- public bool AuthenticateSim(LLUUID uuid, ulong handle, string authkey)
+ override public bool AuthenticateSim(LLUUID uuid, ulong handle, string authkey)
{
bool throwHissyFit = false; // Should be true by 1.0
@@ -226,7 +226,7 @@ namespace OpenSim.Framework.Data.SQLite
return false;
}
- public ReservationData GetReservationAtPoint(uint x, uint y)
+ override public ReservationData GetReservationAtPoint(uint x, uint y)
{
return null;
}
diff --git a/OpenSim/Framework/Data/GridDataBase.cs b/OpenSim/Framework/Data/GridDataBase.cs
index e7333b4..32a729a 100644
--- a/OpenSim/Framework/Data/GridDataBase.cs
+++ b/OpenSim/Framework/Data/GridDataBase.cs
@@ -1,10 +1,22 @@
using System;
using System.Collections.Generic;
using System.Text;
+using libsecondlife;
namespace OpenSim.Framework.Data
{
- public abstract class GridDataBase
+ public abstract class GridDataBase : IGridData
{
+ public abstract RegionProfileData GetProfileByHandle(ulong regionHandle);
+ public abstract RegionProfileData GetProfileByLLUUID(LLUUID UUID);
+ public abstract RegionProfileData GetProfileByString(string regionName);
+ public abstract RegionProfileData[] GetProfilesInRange(uint Xmin, uint Ymin, uint Xmax, uint Ymax);
+ public abstract bool AuthenticateSim(LLUUID UUID, ulong regionHandle, string simrecvkey);
+ public abstract void Initialise();
+ public abstract void Close();
+ public abstract string getName();
+ public abstract string getVersion();
+ public abstract DataResponse AddProfile(RegionProfileData profile);
+ public abstract ReservationData GetReservationAtPoint(uint x, uint y);
}
}
--
cgit v1.1