* Renamed methods on IUserData

afrisby
lbsa71 2007-09-24 01:31:00 +00:00
parent ce071417d4
commit 47256cebda
7 changed files with 92 additions and 84 deletions

View File

@ -55,7 +55,7 @@ namespace OpenSim.Framework.Data.DB4o
/// </summary>
/// <param name="uuid">The users UUID</param>
/// <returns>A user profile</returns>
public UserProfileData getUserByUUID(LLUUID uuid)
public UserProfileData GetUserByUUID(LLUUID uuid)
{
if(manager.userProfiles.ContainsKey(uuid))
return manager.userProfiles[uuid];
@ -67,9 +67,9 @@ namespace OpenSim.Framework.Data.DB4o
/// </summary>
/// <param name="name">The users account name</param>
/// <returns>A matching users profile</returns>
public UserProfileData getUserByName(string name)
public UserProfileData GetUserByName(string name)
{
return getUserByName(name.Split(' ')[0], name.Split(' ')[1]);
return GetUserByName(name.Split(' ')[0], name.Split(' ')[1]);
}
/// <summary>
@ -78,7 +78,7 @@ namespace OpenSim.Framework.Data.DB4o
/// <param name="fname">The first part of the users account name</param>
/// <param name="lname">The second part of the users account name</param>
/// <returns>A matching users profile</returns>
public UserProfileData getUserByName(string fname, string lname)
public UserProfileData GetUserByName(string fname, string lname)
{
foreach (UserProfileData profile in manager.userProfiles.Values)
{
@ -93,11 +93,11 @@ namespace OpenSim.Framework.Data.DB4o
/// </summary>
/// <param name="uuid">The users account ID</param>
/// <returns>A matching users profile</returns>
public UserAgentData getAgentByUUID(LLUUID uuid)
public UserAgentData GetAgentByUUID(LLUUID uuid)
{
try
{
return getUserByUUID(uuid).currentAgent;
return GetUserByUUID(uuid).currentAgent;
}
catch (Exception)
{
@ -110,9 +110,9 @@ namespace OpenSim.Framework.Data.DB4o
/// </summary>
/// <param name="name">The account name</param>
/// <returns>The users session agent</returns>
public UserAgentData getAgentByName(string name)
public UserAgentData GetAgentByName(string name)
{
return getAgentByName(name.Split(' ')[0], name.Split(' ')[1]);
return GetAgentByName(name.Split(' ')[0], name.Split(' ')[1]);
}
/// <summary>
@ -121,11 +121,11 @@ namespace OpenSim.Framework.Data.DB4o
/// <param name="fname">The first part of the users account name</param>
/// <param name="lname">The second part of the users account name</param>
/// <returns>A user agent</returns>
public UserAgentData getAgentByName(string fname, string lname)
public UserAgentData GetAgentByName(string fname, string lname)
{
try
{
return getUserByName(fname,lname).currentAgent;
return GetUserByName(fname,lname).currentAgent;
}
catch (Exception)
{
@ -137,7 +137,7 @@ namespace OpenSim.Framework.Data.DB4o
/// Creates a new user profile
/// </summary>
/// <param name="user">The profile to add to the database</param>
public void addNewUserProfile(UserProfileData user)
public void AddNewUserProfile(UserProfileData user)
{
try
{
@ -154,7 +154,7 @@ namespace OpenSim.Framework.Data.DB4o
/// </summary>
/// <param name="user">The profile to add to the database</param>
/// <returns>True on success, false on error</returns>
public bool updateUserProfile(UserProfileData user)
public bool UpdateUserProfile(UserProfileData user)
{
try {
return manager.UpdateRecord(user);
@ -170,7 +170,7 @@ namespace OpenSim.Framework.Data.DB4o
/// Creates a new user agent
/// </summary>
/// <param name="agent">The agent to add to the database</param>
public void addNewUserAgent(UserAgentData agent)
public void AddNewUserAgent(UserAgentData agent)
{
// Do nothing. yet.
}
@ -182,7 +182,7 @@ namespace OpenSim.Framework.Data.DB4o
/// <param name="to">End account</param>
/// <param name="amount">The amount to move</param>
/// <returns>Success?</returns>
public bool moneyTransferRequest(LLUUID from, LLUUID to, uint amount)
public bool MoneyTransferRequest(LLUUID from, LLUUID to, uint amount)
{
return true;
}
@ -195,7 +195,7 @@ namespace OpenSim.Framework.Data.DB4o
/// <param name="to">Recievers account</param>
/// <param name="item">Inventory item</param>
/// <returns>Success?</returns>
public bool inventoryTransferRequest(LLUUID from, LLUUID to, LLUUID item)
public bool InventoryTransferRequest(LLUUID from, LLUUID to, LLUUID item)
{
return true;
}
@ -213,7 +213,7 @@ namespace OpenSim.Framework.Data.DB4o
/// Returns the version of the storage provider
/// </summary>
/// <returns>Storage provider version</returns>
public string getVersion()
public string GetVersion()
{
return "0.1";
}

View File

@ -65,9 +65,9 @@ namespace OpenSim.Framework.Data.MySQL
/// </summary>
/// <param name="name">The account name of the user</param>
/// <returns>A user profile</returns>
public UserProfileData getUserByName(string name)
public UserProfileData GetUserByName(string name)
{
return getUserByName(name.Split(' ')[0], name.Split(' ')[1]);
return GetUserByName(name.Split(' ')[0], name.Split(' ')[1]);
}
/// <summary>
@ -76,7 +76,7 @@ namespace OpenSim.Framework.Data.MySQL
/// <param name="user">The first part of the account name</param>
/// <param name="last">The second part of the account name</param>
/// <returns>A user profile</returns>
public UserProfileData getUserByName(string user, string last)
public UserProfileData GetUserByName(string user, string last)
{
try
{
@ -110,7 +110,7 @@ namespace OpenSim.Framework.Data.MySQL
/// </summary>
/// <param name="uuid">The account ID</param>
/// <returns>The users profile</returns>
public UserProfileData getUserByUUID(LLUUID uuid)
public UserProfileData GetUserByUUID(LLUUID uuid)
{
try
{
@ -143,9 +143,9 @@ namespace OpenSim.Framework.Data.MySQL
/// </summary>
/// <param name="name">The account name</param>
/// <returns>The users session</returns>
public UserAgentData getAgentByName(string name)
public UserAgentData GetAgentByName(string name)
{
return getAgentByName(name.Split(' ')[0], name.Split(' ')[1]);
return GetAgentByName(name.Split(' ')[0], name.Split(' ')[1]);
}
/// <summary>
@ -154,10 +154,10 @@ namespace OpenSim.Framework.Data.MySQL
/// <param name="user">First part of the users account name</param>
/// <param name="last">Second part of the users account name</param>
/// <returns>The users session</returns>
public UserAgentData getAgentByName(string user, string last)
public UserAgentData GetAgentByName(string user, string last)
{
UserProfileData profile = getUserByName(user, last);
return getAgentByUUID(profile.UUID);
UserProfileData profile = GetUserByName(user, last);
return GetAgentByUUID(profile.UUID);
}
/// <summary>
@ -165,7 +165,7 @@ namespace OpenSim.Framework.Data.MySQL
/// </summary>
/// <param name="uuid">The accounts UUID</param>
/// <returns>The users session</returns>
public UserAgentData getAgentByUUID(LLUUID uuid)
public UserAgentData GetAgentByUUID(LLUUID uuid)
{
try
{
@ -197,7 +197,7 @@ namespace OpenSim.Framework.Data.MySQL
/// Creates a new users profile
/// </summary>
/// <param name="user">The user profile to create</param>
public void addNewUserProfile(UserProfileData user)
public void AddNewUserProfile(UserProfileData user)
{
try
{
@ -220,13 +220,13 @@ namespace OpenSim.Framework.Data.MySQL
/// Creates a new agent
/// </summary>
/// <param name="agent">The agent to create</param>
public void addNewUserAgent(UserAgentData agent)
public void AddNewUserAgent(UserAgentData agent)
{
// Do nothing.
}
public bool updateUserProfile(UserProfileData user)
public bool UpdateUserProfile(UserProfileData user)
{
return true;
// TODO: implement
@ -239,7 +239,7 @@ namespace OpenSim.Framework.Data.MySQL
/// <param name="to">The recievers account ID</param>
/// <param name="amount">The amount to transfer</param>
/// <returns>Success?</returns>
public bool moneyTransferRequest(LLUUID from, LLUUID to, uint amount)
public bool MoneyTransferRequest(LLUUID from, LLUUID to, uint amount)
{
return false;
}
@ -252,7 +252,7 @@ namespace OpenSim.Framework.Data.MySQL
/// <param name="to">The recievers account ID</param>
/// <param name="item">The item to transfer</param>
/// <returns>Success?</returns>
public bool inventoryTransferRequest(LLUUID from, LLUUID to, LLUUID item)
public bool InventoryTransferRequest(LLUUID from, LLUUID to, LLUUID item)
{
return false;
}
@ -270,7 +270,7 @@ namespace OpenSim.Framework.Data.MySQL
/// Database provider version
/// </summary>
/// <returns>provider version</returns>
public string getVersion()
public string GetVersion()
{
return "0.1";
}

View File

@ -76,7 +76,7 @@ namespace OpenSim.Framework.Data.SQLite
/// </summary>
/// <param name="uuid">The users UUID</param>
/// <returns>A user profile</returns>
public UserProfileData getUserByUUID(LLUUID uuid)
public UserProfileData GetUserByUUID(LLUUID uuid)
{
lock (ds) {
DataRow row = ds.Tables["users"].Rows.Find(uuid);
@ -98,9 +98,9 @@ namespace OpenSim.Framework.Data.SQLite
/// </summary>
/// <param name="name">The users account name</param>
/// <returns>A matching users profile</returns>
public UserProfileData getUserByName(string name)
public UserProfileData GetUserByName(string name)
{
return getUserByName(name.Split(' ')[0], name.Split(' ')[1]);
return GetUserByName(name.Split(' ')[0], name.Split(' ')[1]);
}
/// <summary>
@ -109,7 +109,7 @@ namespace OpenSim.Framework.Data.SQLite
/// <param name="fname">The first part of the users account name</param>
/// <param name="lname">The second part of the users account name</param>
/// <returns>A matching users profile</returns>
public UserProfileData getUserByName(string fname, string lname)
public UserProfileData GetUserByName(string fname, string lname)
{
string select = "surname = '" + lname + "' and username = '" + fname + "'";
lock (ds) {
@ -132,11 +132,11 @@ namespace OpenSim.Framework.Data.SQLite
/// </summary>
/// <param name="uuid">The users account ID</param>
/// <returns>A matching users profile</returns>
public UserAgentData getAgentByUUID(LLUUID uuid)
public UserAgentData GetAgentByUUID(LLUUID uuid)
{
try
{
return getUserByUUID(uuid).currentAgent;
return GetUserByUUID(uuid).currentAgent;
}
catch (Exception)
{
@ -149,9 +149,9 @@ namespace OpenSim.Framework.Data.SQLite
/// </summary>
/// <param name="name">The account name</param>
/// <returns>The users session agent</returns>
public UserAgentData getAgentByName(string name)
public UserAgentData GetAgentByName(string name)
{
return getAgentByName(name.Split(' ')[0], name.Split(' ')[1]);
return GetAgentByName(name.Split(' ')[0], name.Split(' ')[1]);
}
/// <summary>
@ -160,11 +160,11 @@ namespace OpenSim.Framework.Data.SQLite
/// <param name="fname">The first part of the users account name</param>
/// <param name="lname">The second part of the users account name</param>
/// <returns>A user agent</returns>
public UserAgentData getAgentByName(string fname, string lname)
public UserAgentData GetAgentByName(string fname, string lname)
{
try
{
return getUserByName(fname,lname).currentAgent;
return GetUserByName(fname,lname).currentAgent;
}
catch (Exception)
{
@ -176,7 +176,7 @@ namespace OpenSim.Framework.Data.SQLite
/// Creates a new user profile
/// </summary>
/// <param name="user">The profile to add to the database</param>
public void addNewUserProfile(UserProfileData user)
public void AddNewUserProfile(UserProfileData user)
{
DataTable users = ds.Tables["users"];
lock (ds) {
@ -217,10 +217,10 @@ namespace OpenSim.Framework.Data.SQLite
/// </summary>
/// <param name="user">The profile to add to the database</param>
/// <returns>True on success, false on error</returns>
public bool updateUserProfile(UserProfileData user)
public bool UpdateUserProfile(UserProfileData user)
{
try {
addNewUserProfile(user);
AddNewUserProfile(user);
return true;
} catch (Exception) {
return false;
@ -231,7 +231,7 @@ namespace OpenSim.Framework.Data.SQLite
/// Creates a new user agent
/// </summary>
/// <param name="agent">The agent to add to the database</param>
public void addNewUserAgent(UserAgentData agent)
public void AddNewUserAgent(UserAgentData agent)
{
// Do nothing. yet.
}
@ -243,7 +243,7 @@ namespace OpenSim.Framework.Data.SQLite
/// <param name="to">End account</param>
/// <param name="amount">The amount to move</param>
/// <returns>Success?</returns>
public bool moneyTransferRequest(LLUUID from, LLUUID to, uint amount)
public bool MoneyTransferRequest(LLUUID from, LLUUID to, uint amount)
{
return true;
}
@ -256,7 +256,7 @@ namespace OpenSim.Framework.Data.SQLite
/// <param name="to">Recievers account</param>
/// <param name="item">Inventory item</param>
/// <returns>Success?</returns>
public bool inventoryTransferRequest(LLUUID from, LLUUID to, LLUUID item)
public bool InventoryTransferRequest(LLUUID from, LLUUID to, LLUUID item)
{
return true;
}
@ -274,7 +274,7 @@ namespace OpenSim.Framework.Data.SQLite
/// Returns the version of the storage provider
/// </summary>
/// <returns>Storage provider version</returns>
public string getVersion()
public string GetVersion()
{
return "0.1";
}

View File

@ -39,14 +39,14 @@ namespace OpenSim.Framework.Data
/// </summary>
/// <param name="user">The accounts UUID</param>
/// <returns>The user data profile</returns>
UserProfileData getUserByUUID(LLUUID user);
UserProfileData GetUserByUUID(LLUUID user);
/// <summary>
/// Returns a users profile by searching their username
/// </summary>
/// <param name="name">The users username</param>
/// <returns>The user data profile</returns>
UserProfileData getUserByName(string name);
UserProfileData GetUserByName(string name);
/// <summary>
/// Returns a users profile by searching their username parts
@ -54,21 +54,21 @@ namespace OpenSim.Framework.Data
/// <param name="fname">Account firstname</param>
/// <param name="lname">Account lastname</param>
/// <returns>The user data profile</returns>
UserProfileData getUserByName(string fname, string lname);
UserProfileData GetUserByName(string fname, string lname);
/// <summary>
/// Returns the current agent for a user searching by it's UUID
/// </summary>
/// <param name="user">The users UUID</param>
/// <returns>The current agent session</returns>
UserAgentData getAgentByUUID(LLUUID user);
UserAgentData GetAgentByUUID(LLUUID user);
/// <summary>
/// Returns the current session agent for a user searching by username
/// </summary>
/// <param name="name">The users account name</param>
/// <returns>The current agent session</returns>
UserAgentData getAgentByName(string name);
UserAgentData GetAgentByName(string name);
/// <summary>
/// Returns the current session agent for a user searching by username parts
@ -76,25 +76,25 @@ namespace OpenSim.Framework.Data
/// <param name="fname">The users first account name</param>
/// <param name="lname">The users account surname</param>
/// <returns>The current agent session</returns>
UserAgentData getAgentByName(string fname, string lname);
UserAgentData GetAgentByName(string fname, string lname);
/// <summary>
/// Adds a new User profile to the database
/// </summary>
/// <param name="user">UserProfile to add</param>
void addNewUserProfile(UserProfileData user);
void AddNewUserProfile(UserProfileData user);
/// <summary>
/// Updates an existing user profile
/// </summary>
/// <param name="user">UserProfile to update</param>
bool updateUserProfile(UserProfileData user);
bool UpdateUserProfile(UserProfileData user);
/// <summary>
/// Adds a new agent to the database
/// </summary>
/// <param name="agent">The agent to add</param>
void addNewUserAgent(UserAgentData agent);
void AddNewUserAgent(UserAgentData agent);
/// <summary>
/// Attempts to move currency units between accounts (NOT RELIABLE / TRUSTWORTHY. DONT TRY RUN YOUR OWN CURRENCY EXCHANGE WITH REAL VALUES)
@ -103,7 +103,7 @@ namespace OpenSim.Framework.Data
/// <param name="to">The account to transfer to</param>
/// <param name="amount">The amount to transfer</param>
/// <returns>Successful?</returns>
bool moneyTransferRequest(LLUUID from, LLUUID to, uint amount);
bool MoneyTransferRequest(LLUUID from, LLUUID to, uint amount);
/// <summary>
/// Attempts to move inventory between accounts, if inventory is copyable it will be copied into the target account.
@ -112,13 +112,13 @@ namespace OpenSim.Framework.Data
/// <param name="to">User to transfer to</param>
/// <param name="inventory">Specified inventory item</param>
/// <returns>Successful?</returns>
bool inventoryTransferRequest(LLUUID from, LLUUID to, LLUUID inventory);
bool InventoryTransferRequest(LLUUID from, LLUUID to, LLUUID inventory);
/// <summary>
/// Returns the plugin version
/// </summary>
/// <returns>Plugin version in MAJOR.MINOR.REVISION.BUILD format</returns>
string getVersion();
string GetVersion();
/// <summary>
/// Returns the plugin name

View File

@ -68,8 +68,7 @@ namespace OpenSim.Framework.UserManagement
{
IUserData plug = (IUserData)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
plug.Initialise();
this._plugins.Add(plug.getName(), plug);
MainLog.Instance.Verbose( "Userstorage: Added IUserData Interface");
AddPlugin(plug);
}
typeInterface = null;
@ -79,6 +78,12 @@ namespace OpenSim.Framework.UserManagement
pluginAssembly = null;
}
private void AddPlugin(IUserData plug)
{
this._plugins.Add(plug.getName(), plug);
MainLog.Instance.Verbose( "Userstorage: Added IUserData Interface");
}
#region Get UserProfile
/// <summary>
/// Loads a user profile from a database by UUID
@ -91,7 +96,7 @@ namespace OpenSim.Framework.UserManagement
{
try
{
UserProfileData profile = plugin.Value.getUserByUUID(uuid);
UserProfileData profile = plugin.Value.GetUserByUUID(uuid);
profile.currentAgent = getUserAgent(profile.UUID);
return profile;
}
@ -116,7 +121,7 @@ namespace OpenSim.Framework.UserManagement
{
try
{
UserProfileData profile = plugin.Value.getUserByName(name);
UserProfileData profile = plugin.Value.GetUserByName(name);
profile.currentAgent = getUserAgent(profile.UUID);
return profile;
}
@ -142,7 +147,7 @@ namespace OpenSim.Framework.UserManagement
{
try
{
UserProfileData profile = plugin.Value.getUserByName(fname,lname);
UserProfileData profile = plugin.Value.GetUserByName(fname,lname);
profile.currentAgent = getUserAgent(profile.UUID);
@ -168,7 +173,7 @@ namespace OpenSim.Framework.UserManagement
foreach (KeyValuePair<string, IUserData> plugin in _plugins)
{
try {
plugin.Value.updateUserProfile(data);
plugin.Value.UpdateUserProfile(data);
return true;
} catch (Exception e) {
MainLog.Instance.Verbose( "Unable to set user via " + plugin.Key + "(" + e.ToString() + ")");
@ -192,7 +197,7 @@ namespace OpenSim.Framework.UserManagement
{
try
{
return plugin.Value.getAgentByUUID(uuid);
return plugin.Value.GetAgentByUUID(uuid);
}
catch (Exception e)
{
@ -214,7 +219,7 @@ namespace OpenSim.Framework.UserManagement
{
try
{
return plugin.Value.getAgentByName(name);
return plugin.Value.GetAgentByName(name);
}
catch (Exception e)
{
@ -246,7 +251,7 @@ namespace OpenSim.Framework.UserManagement
{
try
{
return plugin.Value.getAgentByName(fname,lname);
return plugin.Value.GetAgentByName(fname,lname);
}
catch (Exception e)
{
@ -360,7 +365,7 @@ namespace OpenSim.Framework.UserManagement
{
try
{
plugin.Value.addNewUserProfile(user);
plugin.Value.AddNewUserProfile(user);
}
catch (Exception e)

View File

@ -44,8 +44,14 @@ namespace OpenSim.Region.Communications.Local
public LocalUserServices UserServices;
public LocalLoginService LoginServices;
public LocalInventoryService InvenServices;
// public CAPSService CapsServices;
private readonly LocalSettings m_settings;
protected LocalSettings m_settings;
protected CommunicationsLocal(NetworkServersInfo serversInfo, BaseHttpServer httpServer, AssetCache assetCache )
: base(serversInfo, httpServer, assetCache)
{
}
public CommunicationsLocal(NetworkServersInfo serversInfo, BaseHttpServer httpServer, AssetCache assetCache, LocalSettings settings)
: base(serversInfo, httpServer, assetCache)

View File

@ -1,10 +1,8 @@
using System;
using libsecondlife;
using OpenSim.Framework.Communications;
using OpenSim.Framework.Data;
using OpenSim.Framework.Types;
using OpenSim.Framework.UserManagement;
using OpenSim.Framework.Utilities;
namespace OpenSim.Region.Communications.Local
{
@ -13,7 +11,7 @@ namespace OpenSim.Region.Communications.Local
private readonly CommunicationsLocal m_parent;
private readonly NetworkServersInfo m_serversInfo;
private readonly uint m_defaultHomeX ;
private readonly uint m_defaultHomeX;
private readonly uint m_defaultHomeY;
@ -22,8 +20,8 @@ namespace OpenSim.Region.Communications.Local
m_parent = parent;
m_serversInfo = serversInfo;
m_defaultHomeX = this.m_serversInfo.DefaultHomeLocX;
m_defaultHomeY = this.m_serversInfo.DefaultHomeLocY;
m_defaultHomeX = m_serversInfo.DefaultHomeLocX;
m_defaultHomeY = m_serversInfo.DefaultHomeLocY;
}
public UserProfileData SetupMasterUser(string firstName, string lastName)
@ -33,17 +31,16 @@ namespace OpenSim.Region.Communications.Local
public UserProfileData SetupMasterUser(string firstName, string lastName, string password)
{
UserProfileData profile = base.GetUserProfile(firstName, lastName);
UserProfileData profile = GetUserProfile(firstName, lastName);
if (profile != null)
{
return profile;
}
Console.WriteLine("Unknown Master User. Sandbox Mode: Creating Account");
this.AddUserProfile(firstName, lastName, password, m_defaultHomeX, m_defaultHomeY);
AddUserProfile(firstName, lastName, password, m_defaultHomeX, m_defaultHomeY);
profile = base.GetUserProfile(firstName, lastName);
profile = GetUserProfile(firstName, lastName);
if (profile == null)
{
@ -51,10 +48,10 @@ namespace OpenSim.Region.Communications.Local
}
else
{
m_parent.InvenServices.CreateNewUserInventory(profile.UUID);
m_parent.InvenServices.CreateNewUserInventory(profile.UUID);
}
return profile;
}
}
}
}