* 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
ThreadPoolClientBranch
Justin Clarke Casey 2008-02-12 18:15:54 +00:00
parent 49a6ac300f
commit 6a3455a98c
4 changed files with 36 additions and 18 deletions

View File

@ -35,6 +35,9 @@ using OpenSim.Region.Capabilities;
namespace OpenSim.Framework.Communications.Cache namespace OpenSim.Framework.Communications.Cache
{ {
/// <summary>
/// Manage asset transactions for a single agent.
/// </summary>
public class AgentAssetTransactions public class AgentAssetTransactions
{ {
private static readonly log4net.ILog m_log private static readonly log4net.ILog m_log
@ -45,11 +48,11 @@ namespace OpenSim.Framework.Communications.Cache
public List<NoteCardCapsUpdate> NotecardUpdaters = new List<NoteCardCapsUpdate>(); public List<NoteCardCapsUpdate> NotecardUpdaters = new List<NoteCardCapsUpdate>();
public LLUUID UserID; public LLUUID UserID;
public Dictionary<LLUUID, AssetXferUploader> XferUploaders = new Dictionary<LLUUID, AssetXferUploader>(); public Dictionary<LLUUID, AssetXferUploader> XferUploaders = new Dictionary<LLUUID, AssetXferUploader>();
public AssetTransactionManager Manager; public AgentAssetTransactionsManager Manager;
private bool m_dumpAssetsToFile; private bool m_dumpAssetsToFile;
// Methods // Methods
public AgentAssetTransactions(LLUUID agentID, AssetTransactionManager manager, bool dumpAssetsToFile) public AgentAssetTransactions(LLUUID agentID, AgentAssetTransactionsManager manager, bool dumpAssetsToFile)
{ {
UserID = agentID; UserID = agentID;
Manager = manager; Manager = manager;

View File

@ -33,7 +33,10 @@ using libsecondlife;
namespace OpenSim.Framework.Communications.Cache namespace OpenSim.Framework.Communications.Cache
{ {
public class AssetTransactionManager /// <summary>
/// Manage the collection of agent asset transaction collections. Each agent has its own transaction collection
/// </summary>
public class AgentAssetTransactionsManager
{ {
private static readonly log4net.ILog m_log private static readonly log4net.ILog m_log
= log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
@ -41,19 +44,28 @@ namespace OpenSim.Framework.Communications.Cache
// Fields // Fields
public CommunicationsManager CommsManager; public CommunicationsManager CommsManager;
public Dictionary<LLUUID, AgentAssetTransactions> AgentTransactions = /// <summary>
/// Each agent has its own singleton collection of transactions
/// </summary>
private Dictionary<LLUUID, AgentAssetTransactions> AgentTransactions =
new Dictionary<LLUUID, AgentAssetTransactions>(); new Dictionary<LLUUID, AgentAssetTransactions>();
/// <summary>
/// Should we dump uploaded assets to the filesystem?
/// </summary>
private bool m_dumpAssetsToFile; private bool m_dumpAssetsToFile;
public AssetTransactionManager(CommunicationsManager commsManager, bool dumpAssetsToFile) public AgentAssetTransactionsManager(CommunicationsManager commsManager, bool dumpAssetsToFile)
{ {
CommsManager = commsManager; CommsManager = commsManager;
m_dumpAssetsToFile = dumpAssetsToFile; m_dumpAssetsToFile = dumpAssetsToFile;
} }
// Methods /// <summary>
public AgentAssetTransactions AddUser(LLUUID userID) /// Add a collection of asset transactions for the given user
/// </summary>
/// <param name="userID"></param>
public void AddUser(LLUUID userID)
{ {
lock (AgentTransactions) lock (AgentTransactions)
{ {
@ -61,13 +73,16 @@ namespace OpenSim.Framework.Communications.Cache
{ {
AgentAssetTransactions transactions = new AgentAssetTransactions(userID, this, m_dumpAssetsToFile); AgentAssetTransactions transactions = new AgentAssetTransactions(userID, this, m_dumpAssetsToFile);
AgentTransactions.Add(userID, transactions); AgentTransactions.Add(userID, transactions);
return transactions;
} }
} }
return null;
} }
public AgentAssetTransactions GetUserTransActions(LLUUID userID) /// <summary>
/// Get the collection of asset transactions for the given user.
/// </summary>
/// <param name="userID"></param>
/// <returns></returns>
public AgentAssetTransactions GetUserTransactions(LLUUID userID)
{ {
if (AgentTransactions.ContainsKey(userID)) if (AgentTransactions.ContainsKey(userID))
{ {
@ -80,7 +95,7 @@ namespace OpenSim.Framework.Communications.Cache
uint callbackID, string description, string name, sbyte invType, uint callbackID, string description, string name, sbyte invType,
sbyte type, byte wearableType, uint nextOwnerMask) sbyte type, byte wearableType, uint nextOwnerMask)
{ {
AgentAssetTransactions transactions = GetUserTransActions(remoteClient.AgentId); AgentAssetTransactions transactions = GetUserTransactions(remoteClient.AgentId);
if (transactions != null) if (transactions != null)
{ {
transactions.RequestCreateInventoryItem(remoteClient, transactionID, folderID, callbackID, description, transactions.RequestCreateInventoryItem(remoteClient, transactionID, folderID, callbackID, description,
@ -92,7 +107,7 @@ namespace OpenSim.Framework.Communications.Cache
byte[] data, bool storeLocal, bool tempFile) byte[] data, bool storeLocal, bool tempFile)
{ {
// Console.WriteLine("asset upload of " + assetID); // Console.WriteLine("asset upload of " + assetID);
AgentAssetTransactions transactions = GetUserTransActions(remoteClient.AgentId); AgentAssetTransactions transactions = GetUserTransactions(remoteClient.AgentId);
if (transactions != null) if (transactions != null)
{ {
AgentAssetTransactions.AssetXferUploader uploader = transactions.RequestXferUploader(transaction); 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) public void HandleXfer(IClientAPI remoteClient, ulong xferID, uint packetID, byte[] data)
{ {
AgentAssetTransactions transactions = GetUserTransActions(remoteClient.AgentId); AgentAssetTransactions transactions = GetUserTransactions(remoteClient.AgentId);
if (transactions != null) if (transactions != null)
{ {
transactions.HandleXfer(xferID, packetID, data); transactions.HandleXfer(xferID, packetID, data);

View File

@ -73,9 +73,9 @@ namespace OpenSim.Framework.Communications
get { return m_userProfileCacheService; } get { return m_userProfileCacheService; }
} }
protected AssetTransactionManager m_transactionsManager; protected AgentAssetTransactionsManager m_transactionsManager;
public AssetTransactionManager TransactionsManager public AgentAssetTransactionsManager TransactionsManager
{ {
get { return m_transactionsManager; } get { return m_transactionsManager; }
} }
@ -100,7 +100,7 @@ namespace OpenSim.Framework.Communications
m_networkServersInfo = serversInfo; m_networkServersInfo = serversInfo;
m_assetCache = assetCache; m_assetCache = assetCache;
m_userProfileCacheService = new UserProfileCacheService(this); m_userProfileCacheService = new UserProfileCacheService(this);
m_transactionsManager = new AssetTransactionManager(this, dumpAssetsToFile); m_transactionsManager = new AgentAssetTransactionsManager(this, dumpAssetsToFile);
} }
public void doCreate(string[] cmmdParams) public void doCreate(string[] cmmdParams)

View File

@ -266,7 +266,7 @@ namespace OpenSim.Region.Environment.Scenes
else else
{ {
AgentAssetTransactions transactions AgentAssetTransactions transactions
= CommsManager.TransactionsManager.GetUserTransActions(remoteClient.AgentId); = CommsManager.TransactionsManager.GetUserTransactions(remoteClient.AgentId);
if (transactions != null) if (transactions != null)
{ {