diff options
Diffstat (limited to 'OpenSim/Framework/Communications/Cache/AgentAssetTransactionsManager.cs')
-rw-r--r-- | OpenSim/Framework/Communications/Cache/AgentAssetTransactionsManager.cs | 205 |
1 files changed, 0 insertions, 205 deletions
diff --git a/OpenSim/Framework/Communications/Cache/AgentAssetTransactionsManager.cs b/OpenSim/Framework/Communications/Cache/AgentAssetTransactionsManager.cs deleted file mode 100644 index e9d042d..0000000 --- a/OpenSim/Framework/Communications/Cache/AgentAssetTransactionsManager.cs +++ /dev/null | |||
@@ -1,205 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | //moved to a module, left here until the module is found to have no problems | ||
29 | /* | ||
30 | using System; | ||
31 | using System.Collections.Generic; | ||
32 | |||
33 | using libsecondlife; | ||
34 | |||
35 | namespace OpenSim.Framework.Communications.Cache | ||
36 | { | ||
37 | /// <summary> | ||
38 | /// Provider handlers for processing asset transactions originating from the agent. This encompasses | ||
39 | /// clothing creation and update as well as asset uploads. | ||
40 | /// </summary> | ||
41 | public class AgentAssetTransactionsManager | ||
42 | { | ||
43 | private static readonly log4net.ILog m_log | ||
44 | = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); | ||
45 | |||
46 | // Fields | ||
47 | public CommunicationsManager CommsManager; | ||
48 | |||
49 | /// <summary> | ||
50 | /// Each agent has its own singleton collection of transactions | ||
51 | /// </summary> | ||
52 | private Dictionary<LLUUID, AgentAssetTransactions> AgentTransactions = | ||
53 | new Dictionary<LLUUID, AgentAssetTransactions>(); | ||
54 | |||
55 | /// <summary> | ||
56 | /// Should we dump uploaded assets to the filesystem? | ||
57 | /// </summary> | ||
58 | private bool m_dumpAssetsToFile; | ||
59 | |||
60 | public AgentAssetTransactionsManager(CommunicationsManager commsManager, bool dumpAssetsToFile) | ||
61 | { | ||
62 | CommsManager = commsManager; | ||
63 | m_dumpAssetsToFile = dumpAssetsToFile; | ||
64 | } | ||
65 | |||
66 | /// <summary> | ||
67 | /// Get the collection of asset transactions for the given user. If one does not already exist, it | ||
68 | /// is created. | ||
69 | /// </summary> | ||
70 | /// <param name="userID"></param> | ||
71 | /// <returns></returns> | ||
72 | private AgentAssetTransactions GetUserTransactions(LLUUID userID) | ||
73 | { | ||
74 | lock (AgentTransactions) | ||
75 | { | ||
76 | if (!AgentTransactions.ContainsKey(userID)) | ||
77 | { | ||
78 | AgentAssetTransactions transactions | ||
79 | = new AgentAssetTransactions(userID, this, m_dumpAssetsToFile); | ||
80 | AgentTransactions.Add(userID, transactions); | ||
81 | } | ||
82 | |||
83 | return AgentTransactions[userID]; | ||
84 | } | ||
85 | } | ||
86 | |||
87 | /// <summary> | ||
88 | /// Remove the given agent asset transactions. This should be called when a client is departing | ||
89 | /// from a scene (and hence won't be making any more transactions here). | ||
90 | /// </summary> | ||
91 | /// <param name="userID"></param> | ||
92 | public void RemoveAgentAssetTransactions(LLUUID userID) | ||
93 | { | ||
94 | m_log.DebugFormat("Removing agent asset transactions structure for agent {0}", userID); | ||
95 | |||
96 | lock (AgentTransactions) | ||
97 | { | ||
98 | AgentTransactions.Remove(userID); | ||
99 | } | ||
100 | } | ||
101 | |||
102 | /// <summary> | ||
103 | /// Create an inventory item from data that has been received through a transaction. | ||
104 | /// | ||
105 | /// This is called when new clothing or body parts are created. It may also be called in other | ||
106 | /// situations. | ||
107 | /// </summary> | ||
108 | /// <param name="remoteClient"></param> | ||
109 | /// <param name="transactionID"></param> | ||
110 | /// <param name="folderID"></param> | ||
111 | /// <param name="callbackID"></param> | ||
112 | /// <param name="description"></param> | ||
113 | /// <param name="name"></param> | ||
114 | /// <param name="invType"></param> | ||
115 | /// <param name="type"></param> | ||
116 | /// <param name="wearableType"></param> | ||
117 | /// <param name="nextOwnerMask"></param> | ||
118 | public void HandleItemCreationFromTransaction(IClientAPI remoteClient, LLUUID transactionID, LLUUID folderID, | ||
119 | uint callbackID, string description, string name, sbyte invType, | ||
120 | sbyte type, byte wearableType, uint nextOwnerMask) | ||
121 | { | ||
122 | m_log.DebugFormat( | ||
123 | "[TRANSACTIONS MANAGER] Called HandleItemCreationFromTransaction with item {0}", name); | ||
124 | |||
125 | AgentAssetTransactions transactions = GetUserTransactions(remoteClient.AgentId); | ||
126 | |||
127 | transactions.RequestCreateInventoryItem( | ||
128 | remoteClient, transactionID, folderID, callbackID, description, | ||
129 | name, invType, type, wearableType, nextOwnerMask); | ||
130 | } | ||
131 | |||
132 | /// <summary> | ||
133 | /// Update an inventory item with data that has been received through a transaction. | ||
134 | /// | ||
135 | /// This is called when clothing or body parts are updated (for instance, with new textures or | ||
136 | /// colours). It may also be called in other situations. | ||
137 | /// </summary> | ||
138 | /// <param name="remoteClient"></param> | ||
139 | /// <param name="transactionID"></param> | ||
140 | /// <param name="item"></param> | ||
141 | public void HandleItemUpdateFromTransaction(IClientAPI remoteClient, LLUUID transactionID, | ||
142 | InventoryItemBase item) | ||
143 | { | ||
144 | m_log.DebugFormat( | ||
145 | "[TRANSACTIONS MANAGER] Called HandleItemUpdateFromTransaction with item {0}", | ||
146 | item.inventoryName); | ||
147 | |||
148 | AgentAssetTransactions transactions | ||
149 | = CommsManager.TransactionsManager.GetUserTransactions(remoteClient.AgentId); | ||
150 | |||
151 | transactions.RequestUpdateInventoryItem(remoteClient, transactionID, item); | ||
152 | } | ||
153 | |||
154 | /// <summary> | ||
155 | /// Request that a client (agent) begin an asset transfer. | ||
156 | /// </summary> | ||
157 | /// <param name="remoteClient"></param> | ||
158 | /// <param name="assetID"></param> | ||
159 | /// <param name="transaction"></param> | ||
160 | /// <param name="type"></param> | ||
161 | /// <param name="data"></param></param> | ||
162 | /// <param name="tempFile"></param> | ||
163 | public void HandleUDPUploadRequest(IClientAPI remoteClient, LLUUID assetID, LLUUID transaction, sbyte type, | ||
164 | byte[] data, bool storeLocal, bool tempFile) | ||
165 | { | ||
166 | // Console.WriteLine("asset upload of " + assetID); | ||
167 | AgentAssetTransactions transactions = GetUserTransactions(remoteClient.AgentId); | ||
168 | |||
169 | AgentAssetTransactions.AssetXferUploader uploader = transactions.RequestXferUploader(transaction); | ||
170 | if (uploader != null) | ||
171 | { | ||
172 | // Upload has already compelted uploading... | ||
173 | |||
174 | if (uploader.Initialise(remoteClient, assetID, transaction, type, data, storeLocal, tempFile)) | ||
175 | { | ||
176 | //[commenting out as this removal breaks uploads] | ||
177 | /*lock (transactions.XferUploaders) | ||
178 | { | ||
179 | |||
180 | // XXX Weak ass way of doing this by directly manipulating this public dictionary, purely temporary | ||
181 | transactions.XferUploaders.Remove(uploader.TransactionID); | ||
182 | |||
183 | //m_log.InfoFormat("[ASSET TRANSACTIONS] Current uploaders: {0}", transactions.XferUploaders.Count); | ||
184 | }*/ | ||
185 | /* } | ||
186 | } | ||
187 | } | ||
188 | |||
189 | /// <summary> | ||
190 | /// Handle asset transfer data packets received in response to the asset upload request in | ||
191 | /// HandleUDPUploadRequest() | ||
192 | /// </summary> | ||
193 | /// <param name="remoteClient"></param> | ||
194 | /// <param name="xferID"></param> | ||
195 | /// <param name="packetID"></param> | ||
196 | /// <param name="data"></param> | ||
197 | public void HandleXfer(IClientAPI remoteClient, ulong xferID, uint packetID, byte[] data) | ||
198 | { | ||
199 | AgentAssetTransactions transactions = GetUserTransactions(remoteClient.AgentId); | ||
200 | |||
201 | transactions.HandleXfer(xferID, packetID, data); | ||
202 | } | ||
203 | } | ||
204 | } | ||
205 | */ | ||