From 6a3455a98cb3b7c910dd2d8d09f69d1c3acf7d2d Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Tue, 12 Feb 2008 18:15:54 +0000 Subject: [PATCH] * Refactoring: Rename AssetTransactions.cs and AssetTransactionsManager and align classes with file names * Small amount of ndoc * This will probably require a prebuild and nant clean --- ...nsactions.cs => AgentAssetTransactions.cs} | 7 +++- ...er.cs => AgentAssetTransactionsManager.cs} | 37 +++++++++++++------ .../Communications/CommunicationsManager.cs | 8 ++-- .../Environment/Scenes/Scene.Inventory.cs | 2 +- 4 files changed, 36 insertions(+), 18 deletions(-) rename OpenSim/Framework/Communications/Cache/{AssetTransactions.cs => AgentAssetTransactions.cs} (98%) rename OpenSim/Framework/Communications/Cache/{AssetTransactionManager.cs => AgentAssetTransactionsManager.cs} (80%) diff --git a/OpenSim/Framework/Communications/Cache/AssetTransactions.cs b/OpenSim/Framework/Communications/Cache/AgentAssetTransactions.cs similarity index 98% rename from OpenSim/Framework/Communications/Cache/AssetTransactions.cs rename to OpenSim/Framework/Communications/Cache/AgentAssetTransactions.cs index 996e5ba2b1..e74a06b6c7 100644 --- a/OpenSim/Framework/Communications/Cache/AssetTransactions.cs +++ b/OpenSim/Framework/Communications/Cache/AgentAssetTransactions.cs @@ -35,6 +35,9 @@ using OpenSim.Region.Capabilities; namespace OpenSim.Framework.Communications.Cache { + /// + /// Manage asset transactions for a single agent. + /// public class AgentAssetTransactions { private static readonly log4net.ILog m_log @@ -45,11 +48,11 @@ namespace OpenSim.Framework.Communications.Cache public List NotecardUpdaters = new List(); public LLUUID UserID; public Dictionary XferUploaders = new Dictionary(); - public AssetTransactionManager Manager; + public AgentAssetTransactionsManager Manager; private bool m_dumpAssetsToFile; // Methods - public AgentAssetTransactions(LLUUID agentID, AssetTransactionManager manager, bool dumpAssetsToFile) + public AgentAssetTransactions(LLUUID agentID, AgentAssetTransactionsManager manager, bool dumpAssetsToFile) { UserID = agentID; Manager = manager; diff --git a/OpenSim/Framework/Communications/Cache/AssetTransactionManager.cs b/OpenSim/Framework/Communications/Cache/AgentAssetTransactionsManager.cs similarity index 80% rename from OpenSim/Framework/Communications/Cache/AssetTransactionManager.cs rename to OpenSim/Framework/Communications/Cache/AgentAssetTransactionsManager.cs index e4808a12d7..70471ccd0f 100644 --- a/OpenSim/Framework/Communications/Cache/AssetTransactionManager.cs +++ b/OpenSim/Framework/Communications/Cache/AgentAssetTransactionsManager.cs @@ -33,7 +33,10 @@ using libsecondlife; namespace OpenSim.Framework.Communications.Cache { - public class AssetTransactionManager + /// + /// Manage the collection of agent asset transaction collections. Each agent has its own transaction collection + /// + public class AgentAssetTransactionsManager { private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); @@ -41,19 +44,28 @@ namespace OpenSim.Framework.Communications.Cache // Fields public CommunicationsManager CommsManager; - public Dictionary AgentTransactions = + /// + /// Each agent has its own singleton collection of transactions + /// + private Dictionary AgentTransactions = new Dictionary(); + /// + /// Should we dump uploaded assets to the filesystem? + /// private bool m_dumpAssetsToFile; - public AssetTransactionManager(CommunicationsManager commsManager, bool dumpAssetsToFile) + public AgentAssetTransactionsManager(CommunicationsManager commsManager, bool dumpAssetsToFile) { CommsManager = commsManager; m_dumpAssetsToFile = dumpAssetsToFile; } - // Methods - public AgentAssetTransactions AddUser(LLUUID userID) + /// + /// Add a collection of asset transactions for the given user + /// + /// + public void AddUser(LLUUID userID) { lock (AgentTransactions) { @@ -61,13 +73,16 @@ namespace OpenSim.Framework.Communications.Cache { AgentAssetTransactions transactions = new AgentAssetTransactions(userID, this, m_dumpAssetsToFile); AgentTransactions.Add(userID, transactions); - return transactions; } } - return null; } - public AgentAssetTransactions GetUserTransActions(LLUUID userID) + /// + /// Get the collection of asset transactions for the given user. + /// + /// + /// + public AgentAssetTransactions GetUserTransactions(LLUUID userID) { if (AgentTransactions.ContainsKey(userID)) { @@ -80,7 +95,7 @@ namespace OpenSim.Framework.Communications.Cache uint callbackID, string description, string name, sbyte invType, sbyte type, byte wearableType, uint nextOwnerMask) { - AgentAssetTransactions transactions = GetUserTransActions(remoteClient.AgentId); + AgentAssetTransactions transactions = GetUserTransactions(remoteClient.AgentId); if (transactions != null) { transactions.RequestCreateInventoryItem(remoteClient, transactionID, folderID, callbackID, description, @@ -92,7 +107,7 @@ namespace OpenSim.Framework.Communications.Cache byte[] data, bool storeLocal, bool tempFile) { // Console.WriteLine("asset upload of " + assetID); - AgentAssetTransactions transactions = GetUserTransActions(remoteClient.AgentId); + AgentAssetTransactions transactions = GetUserTransactions(remoteClient.AgentId); if (transactions != null) { AgentAssetTransactions.AssetXferUploader uploader = transactions.RequestXferUploader(transaction); @@ -118,7 +133,7 @@ namespace OpenSim.Framework.Communications.Cache public void HandleXfer(IClientAPI remoteClient, ulong xferID, uint packetID, byte[] data) { - AgentAssetTransactions transactions = GetUserTransActions(remoteClient.AgentId); + AgentAssetTransactions transactions = GetUserTransactions(remoteClient.AgentId); if (transactions != null) { transactions.HandleXfer(xferID, packetID, data); diff --git a/OpenSim/Framework/Communications/CommunicationsManager.cs b/OpenSim/Framework/Communications/CommunicationsManager.cs index f6cfda7c8a..3e72d89a0a 100644 --- a/OpenSim/Framework/Communications/CommunicationsManager.cs +++ b/OpenSim/Framework/Communications/CommunicationsManager.cs @@ -73,9 +73,9 @@ namespace OpenSim.Framework.Communications get { return m_userProfileCacheService; } } - protected AssetTransactionManager m_transactionsManager; + protected AgentAssetTransactionsManager m_transactionsManager; - public AssetTransactionManager TransactionsManager + public AgentAssetTransactionsManager TransactionsManager { get { return m_transactionsManager; } } @@ -100,7 +100,7 @@ namespace OpenSim.Framework.Communications m_networkServersInfo = serversInfo; m_assetCache = assetCache; m_userProfileCacheService = new UserProfileCacheService(this); - m_transactionsManager = new AssetTransactionManager(this, dumpAssetsToFile); + m_transactionsManager = new AgentAssetTransactionsManager(this, dumpAssetsToFile); } public void doCreate(string[] cmmdParams) @@ -241,4 +241,4 @@ namespace OpenSim.Framework.Communications #endregion } -} \ No newline at end of file +} diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs index bed85aaef7..953dce72d5 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs @@ -266,7 +266,7 @@ namespace OpenSim.Region.Environment.Scenes else { AgentAssetTransactions transactions - = CommsManager.TransactionsManager.GetUserTransActions(remoteClient.AgentId); + = CommsManager.TransactionsManager.GetUserTransactions(remoteClient.AgentId); if (transactions != null) {