* Introduced base abstract provider class for GridData
parent
ac27d9250d
commit
0e16488ca8
|
@ -34,7 +34,7 @@ namespace OpenSim.Framework.Data.DB4o
|
|||
/// <summary>
|
||||
/// A grid server storage mechanism employing the DB4o database system
|
||||
/// </summary>
|
||||
internal class DB4oGridData : IGridData
|
||||
internal class DB4oGridData : GridDataBase
|
||||
{
|
||||
/// <summary>
|
||||
/// The database manager object
|
||||
|
@ -44,7 +44,7 @@ namespace OpenSim.Framework.Data.DB4o
|
|||
/// <summary>
|
||||
/// Called when the plugin is first loaded (as constructors are not called)
|
||||
/// </summary>
|
||||
public void Initialise()
|
||||
override public void Initialise()
|
||||
{
|
||||
manager = new DB4oGridManager("gridserver.yap");
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ namespace OpenSim.Framework.Data.DB4o
|
|||
/// <param name="c">maximum X coordinate</param>
|
||||
/// <param name="d">maximum Y coordinate</param>
|
||||
/// <returns>An array of region profiles</returns>
|
||||
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
|
|||
/// </summary>
|
||||
/// <param name="handle">The handle to search for</param>
|
||||
/// <returns>A region profile</returns>
|
||||
public RegionProfileData GetProfileByHandle(ulong handle)
|
||||
override public RegionProfileData GetProfileByHandle(ulong handle)
|
||||
{
|
||||
lock (manager.simProfiles)
|
||||
{
|
||||
|
@ -87,7 +87,7 @@ namespace OpenSim.Framework.Data.DB4o
|
|||
/// </summary>
|
||||
/// <param name="uuid">The region ID code</param>
|
||||
/// <returns>A region profile</returns>
|
||||
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
|
|||
/// </summary>
|
||||
/// <param name="profile">The profile to add</param>
|
||||
/// <returns>A dataresponse enum indicating success</returns>
|
||||
public DataResponse AddProfile(RegionProfileData profile)
|
||||
override public DataResponse AddProfile(RegionProfileData profile)
|
||||
{
|
||||
lock (manager.simProfiles)
|
||||
{
|
||||
|
@ -131,7 +131,7 @@ namespace OpenSim.Framework.Data.DB4o
|
|||
/// <param name="handle">The location the region is logging into (unused in Db4o)</param>
|
||||
/// <param name="key">The shared secret</param>
|
||||
/// <returns>Authenticated?</returns>
|
||||
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
|
|||
/// <summary>
|
||||
/// Shuts down the database
|
||||
/// </summary>
|
||||
public void Close()
|
||||
override public void Close()
|
||||
{
|
||||
manager = null;
|
||||
}
|
||||
|
@ -160,7 +160,7 @@ namespace OpenSim.Framework.Data.DB4o
|
|||
/// Returns the providers name
|
||||
/// </summary>
|
||||
/// <returns>The name of the storage system</returns>
|
||||
public string getName()
|
||||
override public string getName()
|
||||
{
|
||||
return "DB4o Grid Provider";
|
||||
}
|
||||
|
@ -169,12 +169,12 @@ namespace OpenSim.Framework.Data.DB4o
|
|||
/// Returns the providers version
|
||||
/// </summary>
|
||||
/// <returns>The version of the storage system</returns>
|
||||
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;
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ namespace OpenSim.Framework.Data.MSSQL
|
|||
/// <summary>
|
||||
/// A grid data interface for Microsoft SQL Server
|
||||
/// </summary>
|
||||
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
|
|||
/// <summary>
|
||||
/// Initialises the Grid Interface
|
||||
/// </summary>
|
||||
public void Initialise()
|
||||
override public void Initialise()
|
||||
{
|
||||
IniFile iniFile = new IniFile("mssql_connection.ini");
|
||||
|
||||
|
@ -94,7 +94,7 @@ namespace OpenSim.Framework.Data.MSSQL
|
|||
/// <summary>
|
||||
/// Shuts down the grid interface
|
||||
/// </summary>
|
||||
public void Close()
|
||||
override public void Close()
|
||||
{
|
||||
database.Close();
|
||||
}
|
||||
|
@ -103,7 +103,7 @@ namespace OpenSim.Framework.Data.MSSQL
|
|||
/// Returns the storage system name
|
||||
/// </summary>
|
||||
/// <returns>A string containing the storage system name</returns>
|
||||
public string getName()
|
||||
override public string getName()
|
||||
{
|
||||
return "Sql OpenGridData";
|
||||
}
|
||||
|
@ -112,7 +112,7 @@ namespace OpenSim.Framework.Data.MSSQL
|
|||
/// Returns the storage system version
|
||||
/// </summary>
|
||||
/// <returns>A string containing the storage system version</returns>
|
||||
public string getVersion()
|
||||
override public string getVersion()
|
||||
{
|
||||
return "0.1";
|
||||
}
|
||||
|
@ -125,7 +125,7 @@ namespace OpenSim.Framework.Data.MSSQL
|
|||
/// <param name="c">maximum X coordinate</param>
|
||||
/// <param name="d">maximum Y coordinate</param>
|
||||
/// <returns>An array of region profiles</returns>
|
||||
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
|
|||
/// </summary>
|
||||
/// <param name="handle">Region location handle</param>
|
||||
/// <returns>Sim profile</returns>
|
||||
public RegionProfileData GetProfileByHandle(ulong handle)
|
||||
override public RegionProfileData GetProfileByHandle(ulong handle)
|
||||
{
|
||||
IDataReader reader = null;
|
||||
try
|
||||
|
@ -166,7 +166,7 @@ namespace OpenSim.Framework.Data.MSSQL
|
|||
/// </summary>
|
||||
/// <param name="uuid">The region UUID</param>
|
||||
/// <returns>The sim profile</returns>
|
||||
public RegionProfileData GetProfileByLLUUID(LLUUID uuid)
|
||||
override public RegionProfileData GetProfileByLLUUID(LLUUID uuid)
|
||||
{
|
||||
Dictionary<string, string> param = new Dictionary<string, string>();
|
||||
param["uuid"] = uuid.ToString();
|
||||
|
@ -185,7 +185,7 @@ namespace OpenSim.Framework.Data.MSSQL
|
|||
/// </summary>
|
||||
/// <param name="uuid">The region name search query</param>
|
||||
/// <returns>The sim profile</returns>
|
||||
public RegionProfileData GetProfileByString(string regionName)
|
||||
override public RegionProfileData GetProfileByString(string regionName)
|
||||
{
|
||||
if (regionName.Length > 2)
|
||||
{
|
||||
|
@ -226,7 +226,7 @@ namespace OpenSim.Framework.Data.MSSQL
|
|||
/// </summary>
|
||||
/// <param name="profile">The profile to add</param>
|
||||
/// <returns>A dataresponse enum indicating success</returns>
|
||||
public DataResponse AddProfile(RegionProfileData profile)
|
||||
override public DataResponse AddProfile(RegionProfileData profile)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -327,7 +327,7 @@ namespace OpenSim.Framework.Data.MSSQL
|
|||
/// <param name="handle">The attempted regionHandle of the challenger</param>
|
||||
/// <param name="authkey">The secret</param>
|
||||
/// <returns>Whether the secret and regionhandle match the database entry for UUID</returns>
|
||||
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;
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ namespace OpenSim.Framework.Data.MySQL
|
|||
/// <summary>
|
||||
/// A MySQL Interface for the Grid Server
|
||||
/// </summary>
|
||||
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
|
|||
/// <summary>
|
||||
/// Initialises the Grid Interface
|
||||
/// </summary>
|
||||
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
|
|||
/// <summary>
|
||||
/// Shuts down the grid interface
|
||||
/// </summary>
|
||||
public void Close()
|
||||
override public void Close()
|
||||
{
|
||||
database.Close();
|
||||
}
|
||||
|
@ -122,7 +122,7 @@ namespace OpenSim.Framework.Data.MySQL
|
|||
/// Returns the plugin name
|
||||
/// </summary>
|
||||
/// <returns>Plugin name</returns>
|
||||
public string getName()
|
||||
override public string getName()
|
||||
{
|
||||
return "MySql OpenGridData";
|
||||
}
|
||||
|
@ -131,7 +131,7 @@ namespace OpenSim.Framework.Data.MySQL
|
|||
/// Returns the plugin version
|
||||
/// </summary>
|
||||
/// <returns>Plugin version</returns>
|
||||
public string getVersion()
|
||||
override public string getVersion()
|
||||
{
|
||||
return "0.1";
|
||||
}
|
||||
|
@ -144,7 +144,7 @@ namespace OpenSim.Framework.Data.MySQL
|
|||
/// <param name="xmax">Maximum X coordinate</param>
|
||||
/// <param name="ymax">Maximum Y coordinate</param>
|
||||
/// <returns></returns>
|
||||
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
|
|||
/// </summary>
|
||||
/// <param name="handle">Region location handle</param>
|
||||
/// <returns>Sim profile</returns>
|
||||
public RegionProfileData GetProfileByHandle(ulong handle)
|
||||
override public RegionProfileData GetProfileByHandle(ulong handle)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -221,7 +221,7 @@ namespace OpenSim.Framework.Data.MySQL
|
|||
/// </summary>
|
||||
/// <param name="uuid">The region UUID</param>
|
||||
/// <returns>The sim profile</returns>
|
||||
public RegionProfileData GetProfileByLLUUID(LLUUID uuid)
|
||||
override public RegionProfileData GetProfileByLLUUID(LLUUID uuid)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -253,7 +253,7 @@ namespace OpenSim.Framework.Data.MySQL
|
|||
/// </summary>
|
||||
/// <param name="uuid">The region name search query</param>
|
||||
/// <returns>The sim profile</returns>
|
||||
public RegionProfileData GetProfileByString(string regionName)
|
||||
override public RegionProfileData GetProfileByString(string regionName)
|
||||
{
|
||||
if (regionName.Length > 2)
|
||||
{
|
||||
|
@ -294,7 +294,7 @@ namespace OpenSim.Framework.Data.MySQL
|
|||
/// </summary>
|
||||
/// <param name="profile">The profile to add</param>
|
||||
/// <returns>Successful?</returns>
|
||||
public DataResponse AddProfile(RegionProfileData profile)
|
||||
override public DataResponse AddProfile(RegionProfileData profile)
|
||||
{
|
||||
lock (database)
|
||||
{
|
||||
|
@ -337,7 +337,7 @@ namespace OpenSim.Framework.Data.MySQL
|
|||
/// <param name="handle">The attempted regionHandle of the challenger</param>
|
||||
/// <param name="authkey">The secret</param>
|
||||
/// <returns>Whether the secret and regionhandle match the database entry for UUID</returns>
|
||||
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
|
||||
{
|
||||
|
|
|
@ -37,7 +37,7 @@ namespace OpenSim.Framework.Data.SQLite
|
|||
/// <summary>
|
||||
/// A Grid Interface to the SQLite database
|
||||
/// </summary>
|
||||
public class SQLiteGridData : IGridData
|
||||
public class SQLiteGridData : GridDataBase
|
||||
{
|
||||
/// <summary>
|
||||
/// A database manager
|
||||
|
@ -47,7 +47,7 @@ namespace OpenSim.Framework.Data.SQLite
|
|||
/// <summary>
|
||||
/// Initialises the Grid Interface
|
||||
/// </summary>
|
||||
public void Initialise()
|
||||
override public void Initialise()
|
||||
{
|
||||
database = new SQLiteManager("localhost", "db", "user", "password", "false");
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ namespace OpenSim.Framework.Data.SQLite
|
|||
/// <summary>
|
||||
/// Shuts down the grid interface
|
||||
/// </summary>
|
||||
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
|
||||
/// </summary>
|
||||
/// <returns>A string containing the grid interface</returns>
|
||||
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
|
||||
/// </summary>
|
||||
/// <returns>A string containing the version</returns>
|
||||
public string getVersion()
|
||||
override public string getVersion()
|
||||
{
|
||||
return "0.1";
|
||||
}
|
||||
|
@ -86,7 +86,7 @@ namespace OpenSim.Framework.Data.SQLite
|
|||
/// <param name="c">maximum X coordinate</param>
|
||||
/// <param name="d">maximum Y coordinate</param>
|
||||
/// <returns>An array of region profiles</returns>
|
||||
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
|
|||
/// </summary>
|
||||
/// <param name="handle">Region location handle</param>
|
||||
/// <returns>Sim profile</returns>
|
||||
public RegionProfileData GetProfileByHandle(ulong handle)
|
||||
override public RegionProfileData GetProfileByHandle(ulong handle)
|
||||
{
|
||||
Dictionary<string, string> param = new Dictionary<string, string>();
|
||||
param["handle"] = handle.ToString();
|
||||
|
@ -116,7 +116,7 @@ namespace OpenSim.Framework.Data.SQLite
|
|||
/// </summary>
|
||||
/// <param name="regionName">The region name search query</param>
|
||||
/// <returns>The sim profile</returns>
|
||||
public RegionProfileData GetProfileByString(string regionName)
|
||||
override public RegionProfileData GetProfileByString(string regionName)
|
||||
{
|
||||
if (regionName.Length > 2)
|
||||
{
|
||||
|
@ -145,7 +145,7 @@ namespace OpenSim.Framework.Data.SQLite
|
|||
/// </summary>
|
||||
/// <param name="uuid">The region UUID</param>
|
||||
/// <returns>The sim profile</returns>
|
||||
public RegionProfileData GetProfileByLLUUID(LLUUID uuid)
|
||||
override public RegionProfileData GetProfileByLLUUID(LLUUID uuid)
|
||||
{
|
||||
Dictionary<string, string> param = new Dictionary<string, string>();
|
||||
param["uuid"] = uuid.ToString();
|
||||
|
@ -175,7 +175,7 @@ namespace OpenSim.Framework.Data.SQLite
|
|||
/// </summary>
|
||||
/// <param name="profile">The profile to add</param>
|
||||
/// <returns>A dataresponse enum indicating success</returns>
|
||||
public DataResponse AddProfile(RegionProfileData profile)
|
||||
override public DataResponse AddProfile(RegionProfileData profile)
|
||||
{
|
||||
if (database.insertRow(profile))
|
||||
{
|
||||
|
@ -194,7 +194,7 @@ namespace OpenSim.Framework.Data.SQLite
|
|||
/// <param name="handle">The attempted regionHandle of the challenger</param>
|
||||
/// <param name="authkey">The secret</param>
|
||||
/// <returns>Whether the secret and regionhandle match the database entry for UUID</returns>
|
||||
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;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue