From 47256cebda8f6519ab09fe66b64deb28f0702042 Mon Sep 17 00:00:00 2001 From: lbsa71 Date: Mon, 24 Sep 2007 01:31:00 +0000 Subject: [PATCH] * Renamed methods on IUserData --- OpenSim/Framework/Data.DB4o/DB4oUserData.cs | 32 ++++++++--------- OpenSim/Framework/Data.MySQL/MySQLUserData.cs | 32 ++++++++--------- .../Framework/Data.SQLite/SQLiteUserData.cs | 34 +++++++++---------- OpenSim/Framework/Data/UserData.cs | 24 ++++++------- .../Framework/UserManager/UserManagerBase.cs | 25 ++++++++------ .../Local/CommunicationsLocal.cs | 10 ++++-- .../Communications/Local/LocalUserServices.cs | 19 +++++------ 7 files changed, 92 insertions(+), 84 deletions(-) diff --git a/OpenSim/Framework/Data.DB4o/DB4oUserData.cs b/OpenSim/Framework/Data.DB4o/DB4oUserData.cs index 402cf241eb..2ab1488dde 100644 --- a/OpenSim/Framework/Data.DB4o/DB4oUserData.cs +++ b/OpenSim/Framework/Data.DB4o/DB4oUserData.cs @@ -55,7 +55,7 @@ namespace OpenSim.Framework.Data.DB4o /// /// The users UUID /// A user profile - 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 /// /// The users account name /// A matching users profile - 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]); } /// @@ -78,7 +78,7 @@ namespace OpenSim.Framework.Data.DB4o /// The first part of the users account name /// The second part of the users account name /// A matching users profile - 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 /// /// The users account ID /// A matching users profile - 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 /// /// The account name /// The users session agent - 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]); } /// @@ -121,11 +121,11 @@ namespace OpenSim.Framework.Data.DB4o /// The first part of the users account name /// The second part of the users account name /// A user agent - 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 /// /// The profile to add to the database - public void addNewUserProfile(UserProfileData user) + public void AddNewUserProfile(UserProfileData user) { try { @@ -154,7 +154,7 @@ namespace OpenSim.Framework.Data.DB4o /// /// The profile to add to the database /// True on success, false on error - 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 /// /// The agent to add to the database - public void addNewUserAgent(UserAgentData agent) + public void AddNewUserAgent(UserAgentData agent) { // Do nothing. yet. } @@ -182,7 +182,7 @@ namespace OpenSim.Framework.Data.DB4o /// End account /// The amount to move /// Success? - 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 /// Recievers account /// Inventory item /// Success? - 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 /// /// Storage provider version - public string getVersion() + public string GetVersion() { return "0.1"; } diff --git a/OpenSim/Framework/Data.MySQL/MySQLUserData.cs b/OpenSim/Framework/Data.MySQL/MySQLUserData.cs index 633bef78b8..e746717739 100644 --- a/OpenSim/Framework/Data.MySQL/MySQLUserData.cs +++ b/OpenSim/Framework/Data.MySQL/MySQLUserData.cs @@ -65,9 +65,9 @@ namespace OpenSim.Framework.Data.MySQL /// /// The account name of the user /// A user profile - 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]); } /// @@ -76,7 +76,7 @@ namespace OpenSim.Framework.Data.MySQL /// The first part of the account name /// The second part of the account name /// A user profile - public UserProfileData getUserByName(string user, string last) + public UserProfileData GetUserByName(string user, string last) { try { @@ -110,7 +110,7 @@ namespace OpenSim.Framework.Data.MySQL /// /// The account ID /// The users profile - public UserProfileData getUserByUUID(LLUUID uuid) + public UserProfileData GetUserByUUID(LLUUID uuid) { try { @@ -143,9 +143,9 @@ namespace OpenSim.Framework.Data.MySQL /// /// The account name /// The users session - 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]); } /// @@ -154,10 +154,10 @@ 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) + 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); } /// @@ -165,7 +165,7 @@ namespace OpenSim.Framework.Data.MySQL /// /// The accounts UUID /// The users session - 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 /// /// The user profile to create - public void addNewUserProfile(UserProfileData user) + public void AddNewUserProfile(UserProfileData user) { try { @@ -220,13 +220,13 @@ namespace OpenSim.Framework.Data.MySQL /// Creates a new agent /// /// The agent to create - 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 /// The recievers account ID /// The amount to transfer /// Success? - 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 /// The recievers account ID /// The item to transfer /// Success? - 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 /// /// provider version - public string getVersion() + public string GetVersion() { return "0.1"; } diff --git a/OpenSim/Framework/Data.SQLite/SQLiteUserData.cs b/OpenSim/Framework/Data.SQLite/SQLiteUserData.cs index 76be89cc87..3a13ecc49f 100644 --- a/OpenSim/Framework/Data.SQLite/SQLiteUserData.cs +++ b/OpenSim/Framework/Data.SQLite/SQLiteUserData.cs @@ -76,7 +76,7 @@ namespace OpenSim.Framework.Data.SQLite /// /// The users UUID /// A user profile - 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 /// /// The users account name /// A matching users profile - 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]); } /// @@ -109,7 +109,7 @@ namespace OpenSim.Framework.Data.SQLite /// The first part of the users account name /// The second part of the users account name /// A matching users profile - 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 /// /// The users account ID /// A matching users profile - 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 /// /// The account name /// The users session agent - 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]); } /// @@ -160,11 +160,11 @@ namespace OpenSim.Framework.Data.SQLite /// The first part of the users account name /// The second part of the users account name /// A user agent - 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 /// /// The profile to add to the database - 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 /// /// The profile to add to the database /// True on success, false on error - 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 /// /// The agent to add to the database - public void addNewUserAgent(UserAgentData agent) + public void AddNewUserAgent(UserAgentData agent) { // Do nothing. yet. } @@ -243,7 +243,7 @@ namespace OpenSim.Framework.Data.SQLite /// End account /// The amount to move /// Success? - 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 /// Recievers account /// Inventory item /// Success? - 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 /// /// Storage provider version - public string getVersion() + public string GetVersion() { return "0.1"; } diff --git a/OpenSim/Framework/Data/UserData.cs b/OpenSim/Framework/Data/UserData.cs index 6e743e7a69..13bdf17dfc 100644 --- a/OpenSim/Framework/Data/UserData.cs +++ b/OpenSim/Framework/Data/UserData.cs @@ -39,14 +39,14 @@ namespace OpenSim.Framework.Data /// /// The accounts UUID /// The user data profile - UserProfileData getUserByUUID(LLUUID user); + UserProfileData GetUserByUUID(LLUUID user); /// /// Returns a users profile by searching their username /// /// The users username /// The user data profile - UserProfileData getUserByName(string name); + UserProfileData GetUserByName(string name); /// /// Returns a users profile by searching their username parts @@ -54,21 +54,21 @@ namespace OpenSim.Framework.Data /// Account firstname /// Account lastname /// The user data profile - UserProfileData getUserByName(string fname, string lname); + UserProfileData GetUserByName(string fname, string lname); /// /// Returns the current agent for a user searching by it's UUID /// /// The users UUID /// The current agent session - UserAgentData getAgentByUUID(LLUUID user); + UserAgentData GetAgentByUUID(LLUUID user); /// /// Returns the current session agent for a user searching by username /// /// The users account name /// The current agent session - UserAgentData getAgentByName(string name); + UserAgentData GetAgentByName(string name); /// /// Returns the current session agent for a user searching by username parts @@ -76,25 +76,25 @@ namespace OpenSim.Framework.Data /// The users first account name /// The users account surname /// The current agent session - UserAgentData getAgentByName(string fname, string lname); + UserAgentData GetAgentByName(string fname, string lname); /// /// Adds a new User profile to the database /// /// UserProfile to add - void addNewUserProfile(UserProfileData user); + void AddNewUserProfile(UserProfileData user); /// /// Updates an existing user profile /// /// UserProfile to update - bool updateUserProfile(UserProfileData user); + bool UpdateUserProfile(UserProfileData user); /// /// Adds a new agent to the database /// /// The agent to add - void addNewUserAgent(UserAgentData agent); + void AddNewUserAgent(UserAgentData agent); /// /// 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 /// The account to transfer to /// The amount to transfer /// Successful? - bool moneyTransferRequest(LLUUID from, LLUUID to, uint amount); + bool MoneyTransferRequest(LLUUID from, LLUUID to, uint amount); /// /// 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 /// User to transfer to /// Specified inventory item /// Successful? - bool inventoryTransferRequest(LLUUID from, LLUUID to, LLUUID inventory); + bool InventoryTransferRequest(LLUUID from, LLUUID to, LLUUID inventory); /// /// Returns the plugin version /// /// Plugin version in MAJOR.MINOR.REVISION.BUILD format - string getVersion(); + string GetVersion(); /// /// Returns the plugin name diff --git a/OpenSim/Framework/UserManager/UserManagerBase.cs b/OpenSim/Framework/UserManager/UserManagerBase.cs index 82b3731c3f..e11204b14c 100644 --- a/OpenSim/Framework/UserManager/UserManagerBase.cs +++ b/OpenSim/Framework/UserManager/UserManagerBase.cs @@ -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 /// /// 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 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) diff --git a/OpenSim/Region/Communications/Local/CommunicationsLocal.cs b/OpenSim/Region/Communications/Local/CommunicationsLocal.cs index 0105b9d0ec..1f543103dc 100644 --- a/OpenSim/Region/Communications/Local/CommunicationsLocal.cs +++ b/OpenSim/Region/Communications/Local/CommunicationsLocal.cs @@ -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) diff --git a/OpenSim/Region/Communications/Local/LocalUserServices.cs b/OpenSim/Region/Communications/Local/LocalUserServices.cs index 612f654524..a7cefcb326 100644 --- a/OpenSim/Region/Communications/Local/LocalUserServices.cs +++ b/OpenSim/Region/Communications/Local/LocalUserServices.cs @@ -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; } } -} +} \ No newline at end of file