From ca718b6f8d5a76f4f4dcb6625c01c3ec15371bd6 Mon Sep 17 00:00:00 2001
From: lbsa71
Date: Fri, 28 Mar 2008 19:58:45 +0000
Subject: * Introduced common abstract UserDataBase provider * Weeded out
multiple AvatarPickerAvatar classes
---
OpenSim/Framework/AvatarPickerAvatar.cs | 14 ++
OpenSim/Framework/Data.MSSQL/MSSQLUserData.cs | 42 +++---
OpenSim/Framework/Data.MySQL/MySQLUserData.cs | 42 +++---
OpenSim/Framework/Data.SQLite/SQLiteUserData.cs | 187 +++++++++++-------------
OpenSim/Framework/Data/GridData.cs | 13 +-
OpenSim/Framework/Data/UserDataBase.cs | 27 +++-
OpenSim/Framework/IUserData.cs | 11 --
OpenSim/Framework/UserProfileData.cs | 14 +-
8 files changed, 167 insertions(+), 183 deletions(-)
create mode 100644 OpenSim/Framework/AvatarPickerAvatar.cs
(limited to 'OpenSim/Framework')
diff --git a/OpenSim/Framework/AvatarPickerAvatar.cs b/OpenSim/Framework/AvatarPickerAvatar.cs
new file mode 100644
index 0000000..5f0de38
--- /dev/null
+++ b/OpenSim/Framework/AvatarPickerAvatar.cs
@@ -0,0 +1,14 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using libsecondlife;
+
+namespace OpenSim.Framework
+{
+ public class AvatarPickerAvatar
+ {
+ public LLUUID AvatarID;
+ public string firstName;
+ public string lastName;
+ }
+}
diff --git a/OpenSim/Framework/Data.MSSQL/MSSQLUserData.cs b/OpenSim/Framework/Data.MSSQL/MSSQLUserData.cs
index 979e349..be0417d 100644
--- a/OpenSim/Framework/Data.MSSQL/MSSQLUserData.cs
+++ b/OpenSim/Framework/Data.MSSQL/MSSQLUserData.cs
@@ -37,7 +37,7 @@ namespace OpenSim.Framework.Data.MSSQL
///
/// A database interface class to a user profile storage system
///
- public class MSSQLUserData : IUserData
+ public class MSSQLUserData : UserDataBase
{
private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
@@ -53,7 +53,7 @@ namespace OpenSim.Framework.Data.MSSQL
///
/// Loads and initialises the MySQL storage plugin
///
- public void Initialise()
+ override public void Initialise()
{
// Load from an INI file connection details
// TODO: move this to XML?
@@ -131,7 +131,7 @@ namespace OpenSim.Framework.Data.MSSQL
/// The first part of the account name
/// The second part of the account name
/// A user profile
- public UserProfileData GetUserByName(string user, string last)
+ override public UserProfileData GetUserByName(string user, string last)
{
try
{
@@ -163,7 +163,7 @@ namespace OpenSim.Framework.Data.MSSQL
#region User Friends List Data
- public void AddNewUserFriend(LLUUID friendlistowner, LLUUID friend, uint perms)
+ override public void AddNewUserFriend(LLUUID friendlistowner, LLUUID friend, uint perms)
{
int dtvalue = Util.UnixTimeSinceEpoch();
@@ -206,7 +206,7 @@ namespace OpenSim.Framework.Data.MSSQL
}
}
- public void RemoveUserFriend(LLUUID friendlistowner, LLUUID friend)
+ override public void RemoveUserFriend(LLUUID friendlistowner, LLUUID friend)
{
Dictionary param = new Dictionary();
param["@ownerID"] = friendlistowner.UUID.ToString();
@@ -239,7 +239,7 @@ namespace OpenSim.Framework.Data.MSSQL
}
}
- public void UpdateUserFriendPerms(LLUUID friendlistowner, LLUUID friend, uint perms)
+ override public void UpdateUserFriendPerms(LLUUID friendlistowner, LLUUID friend, uint perms)
{
Dictionary param = new Dictionary();
param["@ownerID"] = friendlistowner.UUID.ToString();
@@ -270,7 +270,7 @@ namespace OpenSim.Framework.Data.MSSQL
}
- public List GetUserFriendList(LLUUID friendlistowner)
+ override public List GetUserFriendList(LLUUID friendlistowner)
{
List Lfli = new List();
@@ -318,14 +318,14 @@ namespace OpenSim.Framework.Data.MSSQL
#endregion
- public void UpdateUserCurrentRegion(LLUUID avatarid, LLUUID regionuuid)
+ override public void UpdateUserCurrentRegion(LLUUID avatarid, LLUUID regionuuid)
{
m_log.Info("[USER]: Stub UpdateUserCUrrentRegion called");
}
- public List GeneratePickerResults(LLUUID queryID, string query)
+ override public List GeneratePickerResults(LLUUID queryID, string query)
{
List returnlist = new List();
string[] querysplit;
@@ -405,7 +405,7 @@ namespace OpenSim.Framework.Data.MSSQL
}
// See IUserData
- public UserProfileData GetUserByUUID(LLUUID uuid)
+ override public UserProfileData GetUserByUUID(LLUUID uuid)
{
try
{
@@ -438,7 +438,7 @@ namespace OpenSim.Framework.Data.MSSQL
///
/// The account name
/// The users session
- public UserAgentData GetAgentByName(string name)
+ override public UserAgentData GetAgentByName(string name)
{
return GetAgentByName(name.Split(' ')[0], name.Split(' ')[1]);
}
@@ -449,7 +449,7 @@ namespace OpenSim.Framework.Data.MSSQL
/// First part of the users account name
/// Second part of the users account name
/// The users session
- public UserAgentData GetAgentByName(string user, string last)
+ override public UserAgentData GetAgentByName(string user, string last)
{
UserProfileData profile = GetUserByName(user, last);
return GetAgentByUUID(profile.UUID);
@@ -460,7 +460,7 @@ namespace OpenSim.Framework.Data.MSSQL
///
/// The accounts UUID
/// The users session
- public UserAgentData GetAgentByUUID(LLUUID uuid)
+ override public UserAgentData GetAgentByUUID(LLUUID uuid)
{
try
{
@@ -487,7 +487,7 @@ namespace OpenSim.Framework.Data.MSSQL
return null;
}
}
- public void StoreWebLoginKey(LLUUID AgentID, LLUUID WebLoginKey)
+ override public void StoreWebLoginKey(LLUUID AgentID, LLUUID WebLoginKey)
{
UserProfileData user = GetUserByUUID(AgentID);
user.webLoginKey = WebLoginKey;
@@ -498,7 +498,7 @@ namespace OpenSim.Framework.Data.MSSQL
/// Creates a new users profile
///
/// The user profile to create
- public void AddNewUserProfile(UserProfileData user)
+ override public void AddNewUserProfile(UserProfileData user)
{
try
{
@@ -618,13 +618,13 @@ namespace OpenSim.Framework.Data.MSSQL
/// Creates a new agent
///
/// The agent to create
- public void AddNewUserAgent(UserAgentData agent)
+ override public void AddNewUserAgent(UserAgentData agent)
{
// Do nothing.
}
- public bool UpdateUserProfile(UserProfileData user)
+ override public bool UpdateUserProfile(UserProfileData user)
{
SqlCommand command = new SqlCommand("UPDATE " + m_usersTableName + " set UUID = @uuid, " +
"username = @username, " +
@@ -724,7 +724,7 @@ namespace OpenSim.Framework.Data.MSSQL
/// The receivers account ID
/// The amount to transfer
/// Success?
- public bool MoneyTransferRequest(LLUUID from, LLUUID to, uint amount)
+ override public bool MoneyTransferRequest(LLUUID from, LLUUID to, uint amount)
{
return false;
}
@@ -737,7 +737,7 @@ namespace OpenSim.Framework.Data.MSSQL
/// The receivers account ID
/// The item to transfer
/// Success?
- public bool InventoryTransferRequest(LLUUID from, LLUUID to, LLUUID item)
+ override public bool InventoryTransferRequest(LLUUID from, LLUUID to, LLUUID item)
{
return false;
}
@@ -746,7 +746,7 @@ namespace OpenSim.Framework.Data.MSSQL
/// Database provider name
///
/// Provider name
- public string getName()
+ override public string getName()
{
return "MSSQL Userdata Interface";
}
@@ -755,7 +755,7 @@ namespace OpenSim.Framework.Data.MSSQL
/// Database provider version
///
/// provider version
- public string GetVersion()
+ override public string GetVersion()
{
return database.getVersion();
}
diff --git a/OpenSim/Framework/Data.MySQL/MySQLUserData.cs b/OpenSim/Framework/Data.MySQL/MySQLUserData.cs
index 010e911..fd640ec 100644
--- a/OpenSim/Framework/Data.MySQL/MySQLUserData.cs
+++ b/OpenSim/Framework/Data.MySQL/MySQLUserData.cs
@@ -37,7 +37,7 @@ namespace OpenSim.Framework.Data.MySQL
///
/// A database interface class to a user profile storage system
///
- internal class MySQLUserData : IUserData
+ internal class MySQLUserData : UserDataBase
{
private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
@@ -53,7 +53,7 @@ namespace OpenSim.Framework.Data.MySQL
///
/// Loads and initialises the MySQL storage plugin
///
- public void Initialise()
+ override public void Initialise()
{
// Load from an INI file connection details
// TODO: move this to XML? Yes, PLEASE!
@@ -164,7 +164,7 @@ namespace OpenSim.Framework.Data.MySQL
#endregion
// see IUserData
- public UserProfileData GetUserByName(string user, string last)
+ override public UserProfileData GetUserByName(string user, string last)
{
try
{
@@ -195,7 +195,7 @@ namespace OpenSim.Framework.Data.MySQL
#region User Friends List Data
- public void AddNewUserFriend(LLUUID friendlistowner, LLUUID friend, uint perms)
+ override public void AddNewUserFriend(LLUUID friendlistowner, LLUUID friend, uint perms)
{
int dtvalue = Util.UnixTimeSinceEpoch();
@@ -236,7 +236,7 @@ namespace OpenSim.Framework.Data.MySQL
}
}
- public void RemoveUserFriend(LLUUID friendlistowner, LLUUID friend)
+ override public void RemoveUserFriend(LLUUID friendlistowner, LLUUID friend)
{
Dictionary param = new Dictionary();
param["?ownerID"] = friendlistowner.UUID.ToString();
@@ -267,7 +267,7 @@ namespace OpenSim.Framework.Data.MySQL
}
}
- public void UpdateUserFriendPerms(LLUUID friendlistowner, LLUUID friend, uint perms)
+ override public void UpdateUserFriendPerms(LLUUID friendlistowner, LLUUID friend, uint perms)
{
Dictionary param = new Dictionary();
param["?ownerID"] = friendlistowner.UUID.ToString();
@@ -295,7 +295,7 @@ namespace OpenSim.Framework.Data.MySQL
}
}
- public List GetUserFriendList(LLUUID friendlistowner)
+ override public List GetUserFriendList(LLUUID friendlistowner)
{
List Lfli = new List();
@@ -342,12 +342,12 @@ namespace OpenSim.Framework.Data.MySQL
#endregion
- public void UpdateUserCurrentRegion(LLUUID avatarid, LLUUID regionuuid)
+ override public void UpdateUserCurrentRegion(LLUUID avatarid, LLUUID regionuuid)
{
m_log.Info("[USER]: Stub UpdateUserCUrrentRegion called");
}
- public List GeneratePickerResults(LLUUID queryID, string query)
+ override public List GeneratePickerResults(LLUUID queryID, string query)
{
List returnlist = new List();
@@ -427,7 +427,7 @@ namespace OpenSim.Framework.Data.MySQL
}
// see IUserData
- public UserProfileData GetUserByUUID(LLUUID uuid)
+ override public UserProfileData GetUserByUUID(LLUUID uuid)
{
try
{
@@ -460,7 +460,7 @@ namespace OpenSim.Framework.Data.MySQL
///
/// The account name
/// The users session
- public UserAgentData GetAgentByName(string name)
+ override public UserAgentData GetAgentByName(string name)
{
return GetAgentByName(name.Split(' ')[0], name.Split(' ')[1]);
}
@@ -471,13 +471,13 @@ namespace OpenSim.Framework.Data.MySQL
/// First part of the users account name
/// Second part of the users account name
/// The users session
- public UserAgentData GetAgentByName(string user, string last)
+ override public UserAgentData GetAgentByName(string user, string last)
{
UserProfileData profile = GetUserByName(user, last);
return GetAgentByUUID(profile.UUID);
}
- public void StoreWebLoginKey(LLUUID AgentID, LLUUID WebLoginKey)
+ override public void StoreWebLoginKey(LLUUID AgentID, LLUUID WebLoginKey)
{
Dictionary param = new Dictionary();
param["?UUID"] = AgentID.UUID.ToString();
@@ -508,7 +508,7 @@ namespace OpenSim.Framework.Data.MySQL
///
/// The accounts UUID
/// The users session
- public UserAgentData GetAgentByUUID(LLUUID uuid)
+ override public UserAgentData GetAgentByUUID(LLUUID uuid)
{
try
{
@@ -540,7 +540,7 @@ namespace OpenSim.Framework.Data.MySQL
/// Creates a new users profile
///
/// The user profile to create
- public void AddNewUserProfile(UserProfileData user)
+ override public void AddNewUserProfile(UserProfileData user)
{
try
{
@@ -567,7 +567,7 @@ namespace OpenSim.Framework.Data.MySQL
/// Creates a new agent
///
/// The agent to create
- public void AddNewUserAgent(UserAgentData agent)
+ override public void AddNewUserAgent(UserAgentData agent)
{
try
{
@@ -587,7 +587,7 @@ namespace OpenSim.Framework.Data.MySQL
/// Updates a user profile stored in the DB
///
/// The profile data to use to update the DB
- public bool UpdateUserProfile(UserProfileData user)
+ override public bool UpdateUserProfile(UserProfileData user)
{
database.updateUserRow(user.UUID, user.username, user.surname, user.passwordHash, user.passwordSalt,
user.homeRegion, user.homeLocation.X, user.homeLocation.Y, user.homeLocation.Z, user.homeLookAt.X,
@@ -604,7 +604,7 @@ namespace OpenSim.Framework.Data.MySQL
/// The receivers account ID
/// The amount to transfer
/// Success?
- public bool MoneyTransferRequest(LLUUID from, LLUUID to, uint amount)
+ override public bool MoneyTransferRequest(LLUUID from, LLUUID to, uint amount)
{
return false;
}
@@ -617,7 +617,7 @@ namespace OpenSim.Framework.Data.MySQL
/// The receivers account ID
/// The item to transfer
/// Success?
- public bool InventoryTransferRequest(LLUUID from, LLUUID to, LLUUID item)
+ override public bool InventoryTransferRequest(LLUUID from, LLUUID to, LLUUID item)
{
return false;
}
@@ -626,7 +626,7 @@ namespace OpenSim.Framework.Data.MySQL
/// Database provider name
///
/// Provider name
- public string getName()
+ override public string getName()
{
return "MySQL Userdata Interface";
}
@@ -635,7 +635,7 @@ namespace OpenSim.Framework.Data.MySQL
/// Database provider version
///
/// provider version
- public string GetVersion()
+ override public string GetVersion()
{
return "0.1";
}
diff --git a/OpenSim/Framework/Data.SQLite/SQLiteUserData.cs b/OpenSim/Framework/Data.SQLite/SQLiteUserData.cs
index 4a582ac..2efd4aa 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 : SQLiteUtil, IUserData
+ public class SQLiteUserData : UserDataBase
{
private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
@@ -60,9 +60,9 @@ namespace OpenSim.Framework.Data.SQLite
private DataSet ds;
private SqliteDataAdapter da;
private SqliteDataAdapter daf;
- SqliteConnection g_conn;
+ SqliteConnection g_conn;
- public void Initialise()
+ override public void Initialise()
{
SqliteConnection conn = new SqliteConnection("URI=file:userprofiles.db,version=3");
TestTables(conn);
@@ -102,7 +102,7 @@ namespace OpenSim.Framework.Data.SQLite
}
// see IUserData
- public UserProfileData GetUserByUUID(LLUUID uuid)
+ override public UserProfileData GetUserByUUID(LLUUID uuid)
{
lock (ds)
{
@@ -125,7 +125,7 @@ namespace OpenSim.Framework.Data.SQLite
}
// see IUserData
- public UserProfileData GetUserByName(string fname, string lname)
+ override public UserProfileData GetUserByName(string fname, string lname)
{
string select = "surname = '" + lname + "' and username = '" + fname + "'";
lock (ds)
@@ -149,8 +149,8 @@ namespace OpenSim.Framework.Data.SQLite
}
#region User Friends List Data
-
- public void AddNewUserFriend(LLUUID friendlistowner, LLUUID friend, uint perms)
+
+ override public void AddNewUserFriend(LLUUID friendlistowner, LLUUID friend, uint perms)
{
string InsertFriends = "insert into userfriends(ownerID, friendID, friendPerms) values(:ownerID, :friendID, :perms)";
@@ -169,8 +169,8 @@ namespace OpenSim.Framework.Data.SQLite
cmd.ExecuteNonQuery();
}
}
-
- public void RemoveUserFriend(LLUUID friendlistowner, LLUUID friend)
+
+ override public void RemoveUserFriend(LLUUID friendlistowner, LLUUID friend)
{
string DeletePerms = "delete from friendlist where (ownerID=:ownerID and friendID=:friendID) or (ownerID=:friendID and friendID=:ownerID)";
using (SqliteCommand cmd = new SqliteCommand(DeletePerms, g_conn))
@@ -180,8 +180,8 @@ namespace OpenSim.Framework.Data.SQLite
cmd.ExecuteNonQuery();
}
}
-
- public void UpdateUserFriendPerms(LLUUID friendlistowner, LLUUID friend, uint perms)
+
+ override public void UpdateUserFriendPerms(LLUUID friendlistowner, LLUUID friend, uint perms)
{
string UpdatePerms = "update friendlist set perms=:perms where ownerID=:ownerID and friendID=:friendID";
using (SqliteCommand cmd = new SqliteCommand(UpdatePerms, g_conn))
@@ -193,7 +193,7 @@ namespace OpenSim.Framework.Data.SQLite
}
}
- public List GetUserFriendList(LLUUID friendlistowner)
+ override public List GetUserFriendList(LLUUID friendlistowner)
{
List returnlist = new List();
@@ -231,13 +231,13 @@ namespace OpenSim.Framework.Data.SQLite
#endregion
- public void UpdateUserCurrentRegion(LLUUID avatarid, LLUUID regionuuid)
+ override public void UpdateUserCurrentRegion(LLUUID avatarid, LLUUID regionuuid)
{
m_log.Info("[USER]: Stub UpdateUserCUrrentRegion called");
}
- public List GeneratePickerResults(LLUUID queryID, string query)
+ override public List GeneratePickerResults(LLUUID queryID, string query)
{
List returnlist = new List();
string[] querysplit;
@@ -292,7 +292,7 @@ namespace OpenSim.Framework.Data.SQLite
///
/// The user's account ID
/// A matching user profile
- public UserAgentData GetAgentByUUID(LLUUID uuid)
+ override public UserAgentData GetAgentByUUID(LLUUID uuid)
{
try
{
@@ -309,7 +309,7 @@ namespace OpenSim.Framework.Data.SQLite
///
/// The account name
/// The user's session agent
- public UserAgentData GetAgentByName(string name)
+ override public UserAgentData GetAgentByName(string name)
{
return GetAgentByName(name.Split(' ')[0], name.Split(' ')[1]);
}
@@ -320,7 +320,7 @@ namespace OpenSim.Framework.Data.SQLite
/// The first part of the user's account name
/// The second part of the user's account name
/// A user agent
- public UserAgentData GetAgentByName(string fname, string lname)
+ override public UserAgentData GetAgentByName(string fname, string lname)
{
try
{
@@ -333,7 +333,7 @@ namespace OpenSim.Framework.Data.SQLite
}
- public void StoreWebLoginKey(LLUUID AgentID, LLUUID WebLoginKey)
+ override public void StoreWebLoginKey(LLUUID AgentID, LLUUID WebLoginKey)
{
DataTable users = ds.Tables["users"];
lock (ds)
@@ -359,7 +359,7 @@ namespace OpenSim.Framework.Data.SQLite
/// Creates a new user profile
///
/// The profile to add to the database
- public void AddNewUserProfile(UserProfileData user)
+ override public void AddNewUserProfile(UserProfileData user)
{
DataTable users = ds.Tables["users"];
lock (ds)
@@ -425,7 +425,7 @@ namespace OpenSim.Framework.Data.SQLite
///
/// The profile to add to the database
/// True on success, false on error
- public bool UpdateUserProfile(UserProfileData user)
+ override public bool UpdateUserProfile(UserProfileData user)
{
try
{
@@ -442,7 +442,7 @@ namespace OpenSim.Framework.Data.SQLite
/// Creates a new user agent
///
/// The agent to add to the database
- public void AddNewUserAgent(UserAgentData agent)
+ override public void AddNewUserAgent(UserAgentData agent)
{
// Do nothing. yet.
}
@@ -454,7 +454,7 @@ namespace OpenSim.Framework.Data.SQLite
/// End account
/// The amount to move
/// Success?
- public bool MoneyTransferRequest(LLUUID from, LLUUID to, uint amount)
+ override public bool MoneyTransferRequest(LLUUID from, LLUUID to, uint amount)
{
return true;
}
@@ -467,7 +467,7 @@ namespace OpenSim.Framework.Data.SQLite
/// Receivers account
/// Inventory item
/// Success?
- public bool InventoryTransferRequest(LLUUID from, LLUUID to, LLUUID item)
+ override public bool InventoryTransferRequest(LLUUID from, LLUUID to, LLUUID item)
{
return true;
}
@@ -476,7 +476,7 @@ namespace OpenSim.Framework.Data.SQLite
/// Returns the name of the storage provider
///
/// Storage provider name
- public string getName()
+ override public string getName()
{
return "Sqlite Userdata";
}
@@ -485,7 +485,7 @@ namespace OpenSim.Framework.Data.SQLite
/// Returns the version of the storage provider
///
/// Storage provider version
- public string GetVersion()
+ override public string GetVersion()
{
return "0.1";
}
@@ -503,75 +503,75 @@ namespace OpenSim.Framework.Data.SQLite
*
**********************************************************************/
- private DataTable createUsersTable()
+ private static DataTable createUsersTable()
{
DataTable users = new DataTable("users");
- createCol(users, "UUID", typeof (String));
- createCol(users, "username", typeof (String));
- createCol(users, "surname", typeof (String));
- createCol(users, "passwordHash", typeof (String));
- createCol(users, "passwordSalt", typeof (String));
-
- createCol(users, "homeRegionX", typeof (Int32));
- createCol(users, "homeRegionY", typeof (Int32));
- createCol(users, "homeLocationX", typeof (Double));
- createCol(users, "homeLocationY", typeof (Double));
- createCol(users, "homeLocationZ", typeof (Double));
- createCol(users, "homeLookAtX", typeof (Double));
- createCol(users, "homeLookAtY", typeof (Double));
- createCol(users, "homeLookAtZ", typeof (Double));
- createCol(users, "created", typeof (Int32));
- createCol(users, "lastLogin", typeof (Int32));
- createCol(users, "rootInventoryFolderID", typeof (String));
- createCol(users, "userInventoryURI", typeof (String));
- createCol(users, "userAssetURI", typeof (String));
- createCol(users, "profileCanDoMask", typeof (Int32));
- createCol(users, "profileWantDoMask", typeof (Int32));
- createCol(users, "profileAboutText", typeof (String));
- createCol(users, "profileFirstText", typeof (String));
- createCol(users, "profileImage", typeof (String));
- createCol(users, "profileFirstImage", typeof (String));
- createCol(users, "webLoginKey", typeof(String));
+ SQLiteUtil.createCol(users, "UUID", typeof (String));
+ SQLiteUtil.createCol(users, "username", typeof (String));
+ SQLiteUtil.createCol(users, "surname", typeof (String));
+ SQLiteUtil.createCol(users, "passwordHash", typeof (String));
+ SQLiteUtil.createCol(users, "passwordSalt", typeof (String));
+
+ SQLiteUtil.createCol(users, "homeRegionX", typeof (Int32));
+ SQLiteUtil.createCol(users, "homeRegionY", typeof (Int32));
+ SQLiteUtil.createCol(users, "homeLocationX", typeof (Double));
+ SQLiteUtil.createCol(users, "homeLocationY", typeof (Double));
+ SQLiteUtil.createCol(users, "homeLocationZ", typeof (Double));
+ SQLiteUtil.createCol(users, "homeLookAtX", typeof (Double));
+ SQLiteUtil.createCol(users, "homeLookAtY", typeof (Double));
+ SQLiteUtil.createCol(users, "homeLookAtZ", typeof (Double));
+ SQLiteUtil.createCol(users, "created", typeof (Int32));
+ SQLiteUtil.createCol(users, "lastLogin", typeof (Int32));
+ SQLiteUtil.createCol(users, "rootInventoryFolderID", typeof (String));
+ SQLiteUtil.createCol(users, "userInventoryURI", typeof (String));
+ SQLiteUtil.createCol(users, "userAssetURI", typeof (String));
+ SQLiteUtil.createCol(users, "profileCanDoMask", typeof (Int32));
+ SQLiteUtil.createCol(users, "profileWantDoMask", typeof (Int32));
+ SQLiteUtil.createCol(users, "profileAboutText", typeof (String));
+ SQLiteUtil.createCol(users, "profileFirstText", typeof (String));
+ SQLiteUtil.createCol(users, "profileImage", typeof (String));
+ SQLiteUtil.createCol(users, "profileFirstImage", typeof (String));
+ SQLiteUtil.createCol(users, "webLoginKey", typeof(String));
// Add in contraints
users.PrimaryKey = new DataColumn[] {users.Columns["UUID"]};
return users;
}
- private DataTable createUserAgentsTable()
+ private static DataTable createUserAgentsTable()
{
DataTable ua = new DataTable("useragents");
// this is the UUID of the user
- createCol(ua, "UUID", typeof (String));
- createCol(ua, "agentIP", typeof (String));
- createCol(ua, "agentPort", typeof (Int32));
- createCol(ua, "agentOnline", typeof (Boolean));
- createCol(ua, "sessionID", typeof (String));
- createCol(ua, "secureSessionID", typeof (String));
- createCol(ua, "regionID", typeof (String));
- createCol(ua, "loginTime", typeof (Int32));
- createCol(ua, "logoutTime", typeof (Int32));
- createCol(ua, "currentRegion", typeof (String));
- createCol(ua, "currentHandle", typeof (String));
+ SQLiteUtil.createCol(ua, "UUID", typeof (String));
+ SQLiteUtil.createCol(ua, "agentIP", typeof (String));
+ SQLiteUtil.createCol(ua, "agentPort", typeof (Int32));
+ SQLiteUtil.createCol(ua, "agentOnline", typeof (Boolean));
+ SQLiteUtil.createCol(ua, "sessionID", typeof (String));
+ SQLiteUtil.createCol(ua, "secureSessionID", typeof (String));
+ SQLiteUtil.createCol(ua, "regionID", typeof (String));
+ SQLiteUtil.createCol(ua, "loginTime", typeof (Int32));
+ SQLiteUtil.createCol(ua, "logoutTime", typeof (Int32));
+ SQLiteUtil.createCol(ua, "currentRegion", typeof (String));
+ SQLiteUtil.createCol(ua, "currentHandle", typeof (String));
// vectors
- createCol(ua, "currentPosX", typeof (Double));
- createCol(ua, "currentPosY", typeof (Double));
- createCol(ua, "currentPosZ", typeof (Double));
+ SQLiteUtil.createCol(ua, "currentPosX", typeof (Double));
+ SQLiteUtil.createCol(ua, "currentPosY", typeof (Double));
+ SQLiteUtil.createCol(ua, "currentPosZ", typeof (Double));
// constraints
ua.PrimaryKey = new DataColumn[] {ua.Columns["UUID"]};
return ua;
}
- private DataTable createUserFriendsTable()
+ private static DataTable createUserFriendsTable()
{
DataTable ua = new DataTable("userfriends");
// table contains user <----> user relationship with perms
- createCol(ua, "ownerID", typeof(String));
- createCol(ua, "friendID", typeof(String));
- createCol(ua, "friendPerms", typeof(Int32));
- createCol(ua, "ownerPerms", typeof(Int32));
- createCol(ua, "datetimestamp", typeof(Int32));
+ SQLiteUtil.createCol(ua, "ownerID", typeof(String));
+ SQLiteUtil.createCol(ua, "friendID", typeof(String));
+ SQLiteUtil.createCol(ua, "friendPerms", typeof(Int32));
+ SQLiteUtil.createCol(ua, "ownerPerms", typeof(Int32));
+ SQLiteUtil.createCol(ua, "datetimestamp", typeof(Int32));
return ua;
}
@@ -583,8 +583,8 @@ namespace OpenSim.Framework.Data.SQLite
* These should be database independant
*
**********************************************************************/
-
- private UserProfileData buildUserProfile(DataRow row)
+
+ private static UserProfileData buildUserProfile(DataRow row)
{
// TODO: this doesn't work yet because something more
// interesting has to be done to actually get these values
@@ -624,21 +624,6 @@ namespace OpenSim.Framework.Data.SQLite
return user;
}
-// TODO: unused
-// private void fillFriendRow(DataRow row, LLUUID ownerID, LLUUID friendID, uint perms)
-// {
-// row["ownerID"] = ownerID.UUID.ToString();
-// row["friendID"] = friendID.UUID.ToString();
-// row["friendPerms"] = perms;
-// foreach (DataColumn col in ds.Tables["userfriends"].Columns)
-// {
-// if (row[col] == null)
-// {
-// row[col] = String.Empty;
-// }
-// }
-// }
-
private void fillUserRow(DataRow row, UserProfileData user)
{
row["UUID"] = Util.ToRawUuidString(user.UUID);
@@ -680,7 +665,7 @@ namespace OpenSim.Framework.Data.SQLite
}
}
- private UserAgentData buildUserAgent(DataRow row)
+ private static UserAgentData buildUserAgent(DataRow row)
{
UserAgentData ua = new UserAgentData();
@@ -703,7 +688,7 @@ namespace OpenSim.Framework.Data.SQLite
return ua;
}
- private void fillUserAgentRow(DataRow row, UserAgentData ua)
+ private static void fillUserAgentRow(DataRow row, UserAgentData ua)
{
row["UUID"] = ua.UUID;
row["agentIP"] = ua.agentIP;
@@ -733,29 +718,29 @@ namespace OpenSim.Framework.Data.SQLite
private void setupUserCommands(SqliteDataAdapter da, SqliteConnection conn)
{
- da.InsertCommand = createInsertCommand("users", ds.Tables["users"]);
+ da.InsertCommand = SQLiteUtil.createInsertCommand("users", ds.Tables["users"]);
da.InsertCommand.Connection = conn;
- da.UpdateCommand = createUpdateCommand("users", "UUID=:UUID", ds.Tables["users"]);
+ da.UpdateCommand = SQLiteUtil.createUpdateCommand("users", "UUID=:UUID", ds.Tables["users"]);
da.UpdateCommand.Connection = conn;
SqliteCommand delete = new SqliteCommand("delete from users where UUID = :UUID");
- delete.Parameters.Add(createSqliteParameter("UUID", typeof (String)));
+ delete.Parameters.Add(SQLiteUtil.createSqliteParameter("UUID", typeof(String)));
delete.Connection = conn;
da.DeleteCommand = delete;
}
private void setupUserFriendsCommands(SqliteDataAdapter daf, SqliteConnection conn)
{
- daf.InsertCommand = createInsertCommand("userfriends", ds.Tables["userfriends"]);
+ daf.InsertCommand = SQLiteUtil.createInsertCommand("userfriends", ds.Tables["userfriends"]);
daf.InsertCommand.Connection = conn;
- daf.UpdateCommand = createUpdateCommand("userfriends", "ownerID=:ownerID and friendID=:friendID", ds.Tables["userfriends"]);
+ daf.UpdateCommand = SQLiteUtil.createUpdateCommand("userfriends", "ownerID=:ownerID and friendID=:friendID", ds.Tables["userfriends"]);
daf.UpdateCommand.Connection = conn;
SqliteCommand delete = new SqliteCommand("delete from userfriends where ownerID=:ownerID and friendID=:friendID");
- delete.Parameters.Add(createSqliteParameter("ownerID", typeof(String)));
- delete.Parameters.Add(createSqliteParameter("friendID", typeof(String)));
+ delete.Parameters.Add(SQLiteUtil.createSqliteParameter("ownerID", typeof(String)));
+ delete.Parameters.Add(SQLiteUtil.createSqliteParameter("friendID", typeof(String)));
delete.Connection = conn;
daf.DeleteCommand = delete;
@@ -763,8 +748,8 @@ namespace OpenSim.Framework.Data.SQLite
private void InitDB(SqliteConnection conn)
{
- string createUsers = defineTable(createUsersTable());
- string createFriends = defineTable(createUserFriendsTable());
+ string createUsers = SQLiteUtil.defineTable(createUsersTable());
+ string createFriends = SQLiteUtil.defineTable(createUserFriendsTable());
SqliteCommand pcmd = new SqliteCommand(createUsers, conn);
SqliteCommand fcmd = new SqliteCommand(createFriends, conn);
diff --git a/OpenSim/Framework/Data/GridData.cs b/OpenSim/Framework/Data/GridData.cs
index 5eaa2c4..af51d0d 100644
--- a/OpenSim/Framework/Data/GridData.cs
+++ b/OpenSim/Framework/Data/GridData.cs
@@ -29,18 +29,7 @@ using System.Collections.Generic;
using libsecondlife;
namespace OpenSim.Framework.Data
-{
- public class AvatarPickerAvatar
- {
- public LLUUID AvatarID;
- public string firstName;
- public string lastName;
-
- public AvatarPickerAvatar()
- {
- }
- }
-
+{
public enum DataResponse
{
RESPONSE_OK,
diff --git a/OpenSim/Framework/Data/UserDataBase.cs b/OpenSim/Framework/Data/UserDataBase.cs
index a704ed4..7a74693 100644
--- a/OpenSim/Framework/Data/UserDataBase.cs
+++ b/OpenSim/Framework/Data/UserDataBase.cs
@@ -1,10 +1,29 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
+using System.Collections.Generic;
+using libsecondlife;
namespace OpenSim.Framework.Data
{
- public abstract class UserDataBase
+ public abstract class UserDataBase : IUserData
{
+ public abstract UserProfileData GetUserByUUID(LLUUID user);
+ public abstract UserProfileData GetUserByName(string fname, string lname);
+ public abstract UserAgentData GetAgentByUUID(LLUUID user);
+ public abstract UserAgentData GetAgentByName(string name);
+ public abstract UserAgentData GetAgentByName(string fname, string lname);
+ public abstract void StoreWebLoginKey(LLUUID agentID, LLUUID webLoginKey);
+ public abstract void AddNewUserProfile(UserProfileData user);
+ public abstract bool UpdateUserProfile(UserProfileData user);
+ public abstract void UpdateUserCurrentRegion(LLUUID avatarid, LLUUID regionuuid);
+ public abstract void AddNewUserAgent(UserAgentData agent);
+ public abstract void AddNewUserFriend(LLUUID friendlistowner, LLUUID friend, uint perms);
+ public abstract void RemoveUserFriend(LLUUID friendlistowner, LLUUID friend);
+ public abstract void UpdateUserFriendPerms(LLUUID friendlistowner, LLUUID friend, uint perms);
+ 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 GetVersion();
+ public abstract string getName();
+ public abstract void Initialise();
+ public abstract List GeneratePickerResults(LLUUID queryID, string query);
}
}
diff --git a/OpenSim/Framework/IUserData.cs b/OpenSim/Framework/IUserData.cs
index 4700b4b..9749135 100644
--- a/OpenSim/Framework/IUserData.cs
+++ b/OpenSim/Framework/IUserData.cs
@@ -174,15 +174,4 @@ namespace OpenSim.Framework
///
void Initialise();
}
-
- public class AvatarPickerAvatar
- {
- public LLUUID AvatarID;
- public string firstName;
- public string lastName;
-
- public AvatarPickerAvatar()
- {
- }
- }
}
diff --git a/OpenSim/Framework/UserProfileData.cs b/OpenSim/Framework/UserProfileData.cs
index 3959be3..c5d27a2 100644
--- a/OpenSim/Framework/UserProfileData.cs
+++ b/OpenSim/Framework/UserProfileData.cs
@@ -148,19 +148,7 @@ namespace OpenSim.Framework
///
public UserAgentData currentAgent;
}
-
- ///
- /// Minimal User Data required to service the AvatarPickerReply
- ///
- //public class AvatarPickerAvatar
- //{
- //public LLUUID AvatarID;
- //public string firstName;
- //public string lastName;
- //public AvatarPickerAvatar()
- //{
- //}
- //}
+
///
/// Information about a users session
///
--
cgit v1.1