aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs1046
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectors/Inventory/LocalInventoryServiceConnector.cs546
2 files changed, 796 insertions, 796 deletions
diff --git a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs
index 99282a3..9540bd4 100644
--- a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs
+++ b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs
@@ -1,523 +1,523 @@
1/* 1/*
2Copyright (c) Contributors, http://osflotsam.org/ 2Copyright (c) Contributors, http://osflotsam.org/
3See CONTRIBUTORS.TXT for a full list of copyright holders. 3See CONTRIBUTORS.TXT for a full list of copyright holders.
4 4
5Redistribution and use in source and binary forms, with or without 5Redistribution and use in source and binary forms, with or without
6modification, are permitted provided that the following conditions are met: 6modification, are permitted provided that the following conditions are met:
7 * Redistributions of source code must retain the above copyright 7 * Redistributions of source code must retain the above copyright
8 notice, this list of conditions and the following disclaimer. 8 notice, this list of conditions and the following disclaimer.
9 * Redistributions in binary form must reproduce the above copyright 9 * Redistributions in binary form must reproduce the above copyright
10 notice, this list of conditions and the following disclaimer in the 10 notice, this list of conditions and the following disclaimer in the
11 documentation and/or other materials provided with the distribution. 11 documentation and/or other materials provided with the distribution.
12 * Neither the name of the Flotsam Project nor the 12 * Neither the name of the Flotsam Project nor the
13 names of its contributors may be used to endorse or promote products 13 names of its contributors may be used to endorse or promote products
14 derived from this software without specific prior written permission. 14 derived from this software without specific prior written permission.
15 15
16THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR 16THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
17IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 21DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
22GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 23INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
24IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 24IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
25OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 25OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
26ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ 26ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
27 27
28// Uncomment to make asset Get requests for existing 28// Uncomment to make asset Get requests for existing
29// #define WAIT_ON_INPROGRESS_REQUESTS 29// #define WAIT_ON_INPROGRESS_REQUESTS
30 30
31using System; 31using System;
32using System.IO; 32using System.IO;
33using System.Collections.Generic; 33using System.Collections.Generic;
34using System.Reflection; 34using System.Reflection;
35using System.Runtime.Serialization; 35using System.Runtime.Serialization;
36using System.Runtime.Serialization.Formatters.Binary; 36using System.Runtime.Serialization.Formatters.Binary;
37using System.Threading; 37using System.Threading;
38using System.Timers; 38using System.Timers;
39 39
40using log4net; 40using log4net;
41using Nini.Config; 41using Nini.Config;
42using Mono.Addins; 42using Mono.Addins;
43using OpenMetaverse; 43using OpenMetaverse;
44 44
45using OpenSim.Framework; 45using OpenSim.Framework;
46using OpenSim.Region.Framework.Interfaces; 46using OpenSim.Region.Framework.Interfaces;
47using OpenSim.Region.Framework.Scenes; 47using OpenSim.Region.Framework.Scenes;
48using OpenSim.Services.Interfaces; 48using OpenSim.Services.Interfaces;
49 49
50 50
51[assembly: Addin("FlotsamAssetCache", "1.1")] 51[assembly: Addin("FlotsamAssetCache", "1.1")]
52[assembly: AddinDependency("OpenSim", "0.5")] 52[assembly: AddinDependency("OpenSim", "0.5")]
53 53
54namespace Flotsam.RegionModules.AssetCache 54namespace Flotsam.RegionModules.AssetCache
55{ 55{
56 /// <summary> 56 /// <summary>
57 /// OpenSim.ini Options: 57 /// OpenSim.ini Options:
58 /// ------- 58 /// -------
59 /// [Modules] 59 /// [Modules]
60 /// AssetCaching = "FlotsamAssetCache" 60 /// AssetCaching = "FlotsamAssetCache"
61 /// 61 ///
62 /// [AssetCache] 62 /// [AssetCache]
63 /// ; cache directory can be shared by multiple instances 63 /// ; cache directory can be shared by multiple instances
64 /// CacheDirectory = /directory/writable/by/OpenSim/instance 64 /// CacheDirectory = /directory/writable/by/OpenSim/instance
65 /// 65 ///
66 /// ; Log level 66 /// ; Log level
67 /// ; 0 - (Error) Errors only 67 /// ; 0 - (Error) Errors only
68 /// ; 1 - (Info) Hit Rate Stats + Level 0 68 /// ; 1 - (Info) Hit Rate Stats + Level 0
69 /// ; 2 - (Debug) Cache Activity (Reads/Writes) + Level 1 69 /// ; 2 - (Debug) Cache Activity (Reads/Writes) + Level 1
70 /// ; 70 /// ;
71 /// LogLevel = 1 71 /// LogLevel = 1
72 /// 72 ///
73 /// ; How often should hit rates be displayed (given in AssetRequests) 73 /// ; How often should hit rates be displayed (given in AssetRequests)
74 /// ; 0 to disable 74 /// ; 0 to disable
75 /// HitRateDisplay = 100 75 /// HitRateDisplay = 100
76 /// 76 ///
77 /// ; Set to false for disk cache only. 77 /// ; Set to false for disk cache only.
78 /// MemoryCacheEnabled = true 78 /// MemoryCacheEnabled = true
79 /// 79 ///
80 /// ; How long {in hours} to keep assets cached in memory, .5 == 30 minutes 80 /// ; How long {in hours} to keep assets cached in memory, .5 == 30 minutes
81 /// MemoryCacheTimeout = 2 81 /// MemoryCacheTimeout = 2
82 /// 82 ///
83 /// ; How long {in hours} to keep assets cached on disk, .5 == 30 minutes 83 /// ; How long {in hours} to keep assets cached on disk, .5 == 30 minutes
84 /// ; Specify 0 if you do not want your disk cache to expire 84 /// ; Specify 0 if you do not want your disk cache to expire
85 /// FileCacheTimeout = 0 85 /// FileCacheTimeout = 0
86 /// 86 ///
87 /// ; How often {in hours} should the disk be checked for expired filed 87 /// ; How often {in hours} should the disk be checked for expired filed
88 /// ; Specify 0 to disable expiration checking 88 /// ; Specify 0 to disable expiration checking
89 /// FileCleanupTimer = .166 ;roughly every 10 minutes 89 /// FileCleanupTimer = .166 ;roughly every 10 minutes
90 /// 90 ///
91 /// ; If WAIT_ON_INPROGRESS_REQUESTS has been defined then this specifies how 91 /// ; If WAIT_ON_INPROGRESS_REQUESTS has been defined then this specifies how
92 /// ; long (in miliseconds) to block a request thread while trying to complete 92 /// ; long (in miliseconds) to block a request thread while trying to complete
93 /// ; writing to disk. 93 /// ; writing to disk.
94 /// WaitOnInprogressTimeout = 3000 94 /// WaitOnInprogressTimeout = 3000
95 /// ------- 95 /// -------
96 /// </summary> 96 /// </summary>
97 97
98 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] 98 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
99 public class FlotsamAssetCache : ISharedRegionModule, IImprovedAssetCache 99 public class FlotsamAssetCache : ISharedRegionModule, IImprovedAssetCache
100 { 100 {
101 private static readonly ILog m_log = 101 private static readonly ILog m_log =
102 LogManager.GetLogger( 102 LogManager.GetLogger(
103 MethodBase.GetCurrentMethod().DeclaringType); 103 MethodBase.GetCurrentMethod().DeclaringType);
104 104
105 private bool m_Enabled = false; 105 private bool m_Enabled = false;
106 106
107 private const string m_ModuleName = "FlotsamAssetCache"; 107 private const string m_ModuleName = "FlotsamAssetCache";
108 private const string m_DefaultCacheDirectory = m_ModuleName; 108 private const string m_DefaultCacheDirectory = m_ModuleName;
109 private string m_CacheDirectory = m_DefaultCacheDirectory; 109 private string m_CacheDirectory = m_DefaultCacheDirectory;
110 110
111 111
112 private List<char> m_InvalidChars = new List<char>(); 112 private List<char> m_InvalidChars = new List<char>();
113 113
114 private int m_LogLevel = 1; 114 private int m_LogLevel = 1;
115 private ulong m_HitRateDisplay = 1; // How often to display hit statistics, given in requests 115 private ulong m_HitRateDisplay = 1; // How often to display hit statistics, given in requests
116 116
117 private static ulong m_Requests = 0; 117 private static ulong m_Requests = 0;
118 private static ulong m_RequestsForInprogress = 0; 118 private static ulong m_RequestsForInprogress = 0;
119 private static ulong m_DiskHits = 0; 119 private static ulong m_DiskHits = 0;
120 private static ulong m_MemoryHits = 0; 120 private static ulong m_MemoryHits = 0;
121 private static double m_HitRateMemory = 0.0; 121 private static double m_HitRateMemory = 0.0;
122 private static double m_HitRateFile = 0.0; 122 private static double m_HitRateFile = 0.0;
123 123
124#if WAIT_ON_INPROGRESS_REQUESTS 124#if WAIT_ON_INPROGRESS_REQUESTS
125 private Dictionary<string, ManualResetEvent> m_CurrentlyWriting = new Dictionary<string, ManualResetEvent>(); 125 private Dictionary<string, ManualResetEvent> m_CurrentlyWriting = new Dictionary<string, ManualResetEvent>();
126 private int m_WaitOnInprogressTimeout = 3000; 126 private int m_WaitOnInprogressTimeout = 3000;
127#else 127#else
128 private List<string> m_CurrentlyWriting = new List<string>(); 128 private List<string> m_CurrentlyWriting = new List<string>();
129#endif 129#endif
130 130
131 private ExpiringCache<string, AssetBase> m_MemoryCache = new ExpiringCache<string, AssetBase>(); 131 private ExpiringCache<string, AssetBase> m_MemoryCache = new ExpiringCache<string, AssetBase>();
132 private bool m_MemoryCacheEnabled = true; 132 private bool m_MemoryCacheEnabled = true;
133 133
134 // Expiration is expressed in hours. 134 // Expiration is expressed in hours.
135 private const double m_DefaultMemoryExpiration = 1.0; 135 private const double m_DefaultMemoryExpiration = 1.0;
136 private const double m_DefaultFileExpiration = 48; 136 private const double m_DefaultFileExpiration = 48;
137 private TimeSpan m_MemoryExpiration = TimeSpan.Zero; 137 private TimeSpan m_MemoryExpiration = TimeSpan.Zero;
138 private TimeSpan m_FileExpiration = TimeSpan.Zero; 138 private TimeSpan m_FileExpiration = TimeSpan.Zero;
139 private TimeSpan m_FileExpirationCleanupTimer = TimeSpan.Zero; 139 private TimeSpan m_FileExpirationCleanupTimer = TimeSpan.Zero;
140 140
141 private System.Timers.Timer m_CachCleanTimer = new System.Timers.Timer(); 141 private System.Timers.Timer m_CachCleanTimer = new System.Timers.Timer();
142 142
143 public FlotsamAssetCache() 143 public FlotsamAssetCache()
144 { 144 {
145 m_InvalidChars.AddRange(Path.GetInvalidPathChars()); 145 m_InvalidChars.AddRange(Path.GetInvalidPathChars());
146 m_InvalidChars.AddRange(Path.GetInvalidFileNameChars()); 146 m_InvalidChars.AddRange(Path.GetInvalidFileNameChars());
147 } 147 }
148 148
149 public string Name 149 public string Name
150 { 150 {
151 get { return m_ModuleName; } 151 get { return m_ModuleName; }
152 } 152 }
153 153
154 public void Initialise(IConfigSource source) 154 public void Initialise(IConfigSource source)
155 { 155 {
156 IConfig moduleConfig = source.Configs["Modules"]; 156 IConfig moduleConfig = source.Configs["Modules"];
157 157
158 if (moduleConfig != null) 158 if (moduleConfig != null)
159 { 159 {
160 string name = moduleConfig.GetString("AssetCaching", this.Name); 160 string name = moduleConfig.GetString("AssetCaching", this.Name);
161 161
162 if (name == Name) 162 if (name == Name)
163 { 163 {
164 IConfig assetConfig = source.Configs["AssetCache"]; 164 IConfig assetConfig = source.Configs["AssetCache"];
165 if (assetConfig == null) 165 if (assetConfig == null)
166 { 166 {
167 m_log.Error("[ASSET CACHE]: AssetCache missing from OpenSim.ini"); 167 m_log.Error("[ASSET CACHE]: AssetCache missing from OpenSim.ini");
168 return; 168 return;
169 } 169 }
170 170
171 m_Enabled = true; 171 m_Enabled = true;
172 172
173 m_log.InfoFormat("[ASSET CACHE]: {0} enabled", this.Name); 173 m_log.InfoFormat("[ASSET CACHE]: {0} enabled", this.Name);
174 174
175 m_CacheDirectory = assetConfig.GetString("CacheDirectory", m_DefaultCacheDirectory); 175 m_CacheDirectory = assetConfig.GetString("CacheDirectory", m_DefaultCacheDirectory);
176 m_log.InfoFormat("[ASSET CACHE]: Cache Directory", m_DefaultCacheDirectory); 176 m_log.InfoFormat("[ASSET CACHE]: Cache Directory", m_DefaultCacheDirectory);
177 177
178 m_MemoryCacheEnabled = assetConfig.GetBoolean("MemoryCacheEnabled", true); 178 m_MemoryCacheEnabled = assetConfig.GetBoolean("MemoryCacheEnabled", true);
179 m_MemoryExpiration = TimeSpan.FromHours(assetConfig.GetDouble("MemoryCacheTimeout", m_DefaultMemoryExpiration)); 179 m_MemoryExpiration = TimeSpan.FromHours(assetConfig.GetDouble("MemoryCacheTimeout", m_DefaultMemoryExpiration));
180 180
181#if WAIT_ON_INPROGRESS_REQUESTS 181#if WAIT_ON_INPROGRESS_REQUESTS
182 m_WaitOnInprogressTimeout = assetConfig.GetInt("WaitOnInprogressTimeout", 3000); 182 m_WaitOnInprogressTimeout = assetConfig.GetInt("WaitOnInprogressTimeout", 3000);
183#endif 183#endif
184 184
185 m_HitRateDisplay = (ulong)assetConfig.GetInt("HitRateDisplay", 1); 185 m_HitRateDisplay = (ulong)assetConfig.GetInt("HitRateDisplay", 1);
186 186
187 m_FileExpiration = TimeSpan.FromHours(assetConfig.GetDouble("FileCacheTimeout", m_DefaultFileExpiration)); 187 m_FileExpiration = TimeSpan.FromHours(assetConfig.GetDouble("FileCacheTimeout", m_DefaultFileExpiration));
188 m_FileExpirationCleanupTimer = TimeSpan.FromHours(assetConfig.GetDouble("FileCleanupTimer", m_DefaultFileExpiration)); 188 m_FileExpirationCleanupTimer = TimeSpan.FromHours(assetConfig.GetDouble("FileCleanupTimer", m_DefaultFileExpiration));
189 if ((m_FileExpiration > TimeSpan.Zero) && (m_FileExpirationCleanupTimer > TimeSpan.Zero)) 189 if ((m_FileExpiration > TimeSpan.Zero) && (m_FileExpirationCleanupTimer > TimeSpan.Zero))
190 { 190 {
191 m_CachCleanTimer.Interval = m_FileExpirationCleanupTimer.TotalMilliseconds; 191 m_CachCleanTimer.Interval = m_FileExpirationCleanupTimer.TotalMilliseconds;
192 m_CachCleanTimer.AutoReset = true; 192 m_CachCleanTimer.AutoReset = true;
193 m_CachCleanTimer.Elapsed += CleanupExpiredFiles; 193 m_CachCleanTimer.Elapsed += CleanupExpiredFiles;
194 m_CachCleanTimer.Enabled = true; 194 m_CachCleanTimer.Enabled = true;
195 m_CachCleanTimer.Start(); 195 m_CachCleanTimer.Start();
196 } 196 }
197 else 197 else
198 { 198 {
199 m_CachCleanTimer.Enabled = false; 199 m_CachCleanTimer.Enabled = false;
200 } 200 }
201 } 201 }
202 } 202 }
203 } 203 }
204 204
205 public void PostInitialise() 205 public void PostInitialise()
206 { 206 {
207 } 207 }
208 208
209 public void Close() 209 public void Close()
210 { 210 {
211 } 211 }
212 212
213 public void AddRegion(Scene scene) 213 public void AddRegion(Scene scene)
214 { 214 {
215 if (m_Enabled) 215 if (m_Enabled)
216 scene.RegisterModuleInterface<IImprovedAssetCache>(this); 216 scene.RegisterModuleInterface<IImprovedAssetCache>(this);
217 } 217 }
218 218
219 public void RemoveRegion(Scene scene) 219 public void RemoveRegion(Scene scene)
220 { 220 {
221 } 221 }
222 222
223 public void RegionLoaded(Scene scene) 223 public void RegionLoaded(Scene scene)
224 { 224 {
225 } 225 }
226 226
227 //////////////////////////////////////////////////////////// 227 ////////////////////////////////////////////////////////////
228 // IImprovedAssetCache 228 // IImprovedAssetCache
229 // 229 //
230 230
231 private void UpdateMemoryCache(string key, AssetBase asset) 231 private void UpdateMemoryCache(string key, AssetBase asset)
232 { 232 {
233 if( m_MemoryCacheEnabled ) 233 if( m_MemoryCacheEnabled )
234 { 234 {
235 if (m_MemoryExpiration > TimeSpan.Zero) 235 if (m_MemoryExpiration > TimeSpan.Zero)
236 { 236 {
237 m_MemoryCache.AddOrUpdate(key, asset, m_MemoryExpiration); 237 m_MemoryCache.AddOrUpdate(key, asset, m_MemoryExpiration);
238 } 238 }
239 else 239 else
240 { 240 {
241 m_MemoryCache.AddOrUpdate(key, asset, DateTime.MaxValue); 241 m_MemoryCache.AddOrUpdate(key, asset, DateTime.MaxValue);
242 } 242 }
243 } 243 }
244 } 244 }
245 245
246 public void Cache(AssetBase asset) 246 public void Cache(AssetBase asset)
247 { 247 {
248 // TODO: Spawn this off to some seperate thread to do the actual writing 248 // TODO: Spawn this off to some seperate thread to do the actual writing
249 if (asset != null) 249 if (asset != null)
250 { 250 {
251 UpdateMemoryCache(asset.ID, asset); 251 UpdateMemoryCache(asset.ID, asset);
252 252
253 string filename = GetFileName(asset.ID); 253 string filename = GetFileName(asset.ID);
254 254
255 try 255 try
256 { 256 {
257 // If the file is already cached, don't cache it, just touch it so access time is updated 257 // If the file is already cached, don't cache it, just touch it so access time is updated
258 if (File.Exists(filename)) 258 if (File.Exists(filename))
259 { 259 {
260 File.SetLastAccessTime(filename, DateTime.Now); 260 File.SetLastAccessTime(filename, DateTime.Now);
261 } else { 261 } else {
262 262
263 // Once we start writing, make sure we flag that we're writing 263 // Once we start writing, make sure we flag that we're writing
264 // that object to the cache so that we don't try to write the 264 // that object to the cache so that we don't try to write the
265 // same file multiple times. 265 // same file multiple times.
266 lock (m_CurrentlyWriting) 266 lock (m_CurrentlyWriting)
267 { 267 {
268#if WAIT_ON_INPROGRESS_REQUESTS 268#if WAIT_ON_INPROGRESS_REQUESTS
269 if (m_CurrentlyWriting.ContainsKey(filename)) 269 if (m_CurrentlyWriting.ContainsKey(filename))
270 { 270 {
271 return; 271 return;
272 } 272 }
273 else 273 else
274 { 274 {
275 m_CurrentlyWriting.Add(filename, new ManualResetEvent(false)); 275 m_CurrentlyWriting.Add(filename, new ManualResetEvent(false));
276 } 276 }
277 277
278#else 278#else
279 if (m_CurrentlyWriting.Contains(filename)) 279 if (m_CurrentlyWriting.Contains(filename))
280 { 280 {
281 return; 281 return;
282 } 282 }
283 else 283 else
284 { 284 {
285 m_CurrentlyWriting.Add(filename); 285 m_CurrentlyWriting.Add(filename);
286 } 286 }
287#endif 287#endif
288 288
289 } 289 }
290 290
291 ThreadPool.QueueUserWorkItem( 291 ThreadPool.QueueUserWorkItem(
292 delegate 292 delegate
293 { 293 {
294 WriteFileCache(filename, asset); 294 WriteFileCache(filename, asset);
295 } 295 }
296 ); 296 );
297 } 297 }
298 } 298 }
299 catch (Exception e) 299 catch (Exception e)
300 { 300 {
301 LogException(e); 301 LogException(e);
302 } 302 }
303 } 303 }
304 } 304 }
305 305
306 public AssetBase Get(string id) 306 public AssetBase Get(string id)
307 { 307 {
308 m_Requests++; 308 m_Requests++;
309 309
310 AssetBase asset = null; 310 AssetBase asset = null;
311 311
312 if (m_MemoryCacheEnabled && m_MemoryCache.TryGetValue(id, out asset)) 312 if (m_MemoryCacheEnabled && m_MemoryCache.TryGetValue(id, out asset))
313 { 313 {
314 m_MemoryHits++; 314 m_MemoryHits++;
315 } 315 }
316 else 316 else
317 { 317 {
318 string filename = GetFileName(id); 318 string filename = GetFileName(id);
319 if (File.Exists(filename)) 319 if (File.Exists(filename))
320 { 320 {
321 try 321 try
322 { 322 {
323 FileStream stream = File.Open(filename, FileMode.Open); 323 FileStream stream = File.Open(filename, FileMode.Open);
324 BinaryFormatter bformatter = new BinaryFormatter(); 324 BinaryFormatter bformatter = new BinaryFormatter();
325 325
326 asset = (AssetBase)bformatter.Deserialize(stream); 326 asset = (AssetBase)bformatter.Deserialize(stream);
327 stream.Close(); 327 stream.Close();
328 328
329 UpdateMemoryCache(id, asset); 329 UpdateMemoryCache(id, asset);
330 330
331 m_DiskHits++; 331 m_DiskHits++;
332 } 332 }
333 catch (System.Runtime.Serialization.SerializationException e) 333 catch (System.Runtime.Serialization.SerializationException e)
334 { 334 {
335 LogException(e); 335 LogException(e);
336 336
337 // If there was a problem deserializing the asset, the asset may 337 // If there was a problem deserializing the asset, the asset may
338 // either be corrupted OR was serialized under an old format 338 // either be corrupted OR was serialized under an old format
339 // {different version of AssetBase} -- we should attempt to 339 // {different version of AssetBase} -- we should attempt to
340 // delete it and re-cache 340 // delete it and re-cache
341 File.Delete(filename); 341 File.Delete(filename);
342 } 342 }
343 catch (Exception e) 343 catch (Exception e)
344 { 344 {
345 LogException(e); 345 LogException(e);
346 } 346 }
347 } 347 }
348 348
349 349
350#if WAIT_ON_INPROGRESS_REQUESTS 350#if WAIT_ON_INPROGRESS_REQUESTS
351 // Check if we're already downloading this asset. If so, try to wait for it to 351 // Check if we're already downloading this asset. If so, try to wait for it to
352 // download. 352 // download.
353 if (m_WaitOnInprogressTimeout > 0) 353 if (m_WaitOnInprogressTimeout > 0)
354 { 354 {
355 m_RequestsForInprogress++; 355 m_RequestsForInprogress++;
356 356
357 ManualResetEvent waitEvent; 357 ManualResetEvent waitEvent;
358 if (m_CurrentlyWriting.TryGetValue(filename, out waitEvent)) 358 if (m_CurrentlyWriting.TryGetValue(filename, out waitEvent))
359 { 359 {
360 waitEvent.WaitOne(m_WaitOnInprogressTimeout); 360 waitEvent.WaitOne(m_WaitOnInprogressTimeout);
361 return Get(id); 361 return Get(id);
362 } 362 }
363 } 363 }
364#else 364#else
365 // Track how often we have the problem that an asset is requested while 365 // Track how often we have the problem that an asset is requested while
366 // it is still being downloaded by a previous request. 366 // it is still being downloaded by a previous request.
367 if (m_CurrentlyWriting.Contains(filename)) 367 if (m_CurrentlyWriting.Contains(filename))
368 { 368 {
369 m_RequestsForInprogress++; 369 m_RequestsForInprogress++;
370 } 370 }
371#endif 371#endif
372 } 372 }
373 373
374 if (((m_LogLevel >= 1)) && (m_HitRateDisplay != 0) && (m_Requests % m_HitRateDisplay == 0)) 374 if (((m_LogLevel >= 1)) && (m_HitRateDisplay != 0) && (m_Requests % m_HitRateDisplay == 0))
375 { 375 {
376 m_HitRateFile = (double)m_DiskHits / m_Requests * 100.0; 376 m_HitRateFile = (double)m_DiskHits / m_Requests * 100.0;
377 377
378 m_log.InfoFormat("[ASSET CACHE]: Cache Get :: {0} :: {1}", id, asset == null ? "Miss" : "Hit"); 378 m_log.InfoFormat("[ASSET CACHE]: Cache Get :: {0} :: {1}", id, asset == null ? "Miss" : "Hit");
379 m_log.InfoFormat("[ASSET CACHE]: File Hit Rate {0}% for {1} requests", m_HitRateFile.ToString("0.00"), m_Requests); 379 m_log.InfoFormat("[ASSET CACHE]: File Hit Rate {0}% for {1} requests", m_HitRateFile.ToString("0.00"), m_Requests);
380 380
381 if (m_MemoryCacheEnabled) 381 if (m_MemoryCacheEnabled)
382 { 382 {
383 m_HitRateMemory = (double)m_MemoryHits / m_Requests * 100.0; 383 m_HitRateMemory = (double)m_MemoryHits / m_Requests * 100.0;
384 m_log.InfoFormat("[ASSET CACHE]: Memory Hit Rate {0}% for {1} requests", m_HitRateMemory.ToString("0.00"), m_Requests); 384 m_log.InfoFormat("[ASSET CACHE]: Memory Hit Rate {0}% for {1} requests", m_HitRateMemory.ToString("0.00"), m_Requests);
385 } 385 }
386 386
387 m_log.InfoFormat("[ASSET CACHE]: {0} unnessesary requests due to requests for assets that are currently downloading.", m_RequestsForInprogress); 387 m_log.InfoFormat("[ASSET CACHE]: {0} unnessesary requests due to requests for assets that are currently downloading.", m_RequestsForInprogress);
388 388
389 } 389 }
390 390
391 return asset; 391 return asset;
392 } 392 }
393 393
394 public void Expire(string id) 394 public void Expire(string id)
395 { 395 {
396 if (m_LogLevel >= 2) 396 if (m_LogLevel >= 2)
397 m_log.DebugFormat("[ASSET CACHE]: Expiring Asset {0}.", id); 397 m_log.DebugFormat("[ASSET CACHE]: Expiring Asset {0}.", id);
398 398
399 try 399 try
400 { 400 {
401 string filename = GetFileName(id); 401 string filename = GetFileName(id);
402 if (File.Exists(filename)) 402 if (File.Exists(filename))
403 { 403 {
404 File.Delete(filename); 404 File.Delete(filename);
405 } 405 }
406 406
407 if( m_MemoryCacheEnabled ) 407 if( m_MemoryCacheEnabled )
408 m_MemoryCache.Remove(id); 408 m_MemoryCache.Remove(id);
409 } 409 }
410 catch (Exception e) 410 catch (Exception e)
411 { 411 {
412 LogException(e); 412 LogException(e);
413 } 413 }
414 } 414 }
415 415
416 public void Clear() 416 public void Clear()
417 { 417 {
418 if (m_LogLevel >= 2) 418 if (m_LogLevel >= 2)
419 m_log.Debug("[ASSET CACHE]: Clearing Cache."); 419 m_log.Debug("[ASSET CACHE]: Clearing Cache.");
420 420
421 foreach (string dir in Directory.GetDirectories(m_CacheDirectory)) 421 foreach (string dir in Directory.GetDirectories(m_CacheDirectory))
422 { 422 {
423 Directory.Delete(dir); 423 Directory.Delete(dir);
424 } 424 }
425 425
426 if( m_MemoryCacheEnabled ) 426 if( m_MemoryCacheEnabled )
427 m_MemoryCache.Clear(); 427 m_MemoryCache.Clear();
428 } 428 }
429 429
430 private void CleanupExpiredFiles(object source, ElapsedEventArgs e) 430 private void CleanupExpiredFiles(object source, ElapsedEventArgs e)
431 { 431 {
432 if (m_LogLevel >= 2) 432 if (m_LogLevel >= 2)
433 m_log.DebugFormat("[ASSET CACHE]: Checking for expired files older then {0}.", m_FileExpiration.ToString()); 433 m_log.DebugFormat("[ASSET CACHE]: Checking for expired files older then {0}.", m_FileExpiration.ToString());
434 434
435 foreach (string dir in Directory.GetDirectories(m_CacheDirectory)) 435 foreach (string dir in Directory.GetDirectories(m_CacheDirectory))
436 { 436 {
437 foreach (string file in Directory.GetFiles(dir)) 437 foreach (string file in Directory.GetFiles(dir))
438 { 438 {
439 if (DateTime.Now - File.GetLastAccessTime(file) > m_FileExpiration) 439 if (DateTime.Now - File.GetLastAccessTime(file) > m_FileExpiration)
440 { 440 {
441 File.Delete(file); 441 File.Delete(file);
442 } 442 }
443 } 443 }
444 } 444 }
445 } 445 }
446 446
447 private string GetFileName(string id) 447 private string GetFileName(string id)
448 { 448 {
449 // Would it be faster to just hash the darn thing? 449 // Would it be faster to just hash the darn thing?
450 foreach (char c in m_InvalidChars) 450 foreach (char c in m_InvalidChars)
451 { 451 {
452 id = id.Replace(c, '_'); 452 id = id.Replace(c, '_');
453 } 453 }
454 454
455 string p = id.Substring(id.Length - 4); 455 string p = id.Substring(id.Length - 4);
456 p = Path.Combine(p, id); 456 p = Path.Combine(p, id);
457 return Path.Combine(m_CacheDirectory, p); 457 return Path.Combine(m_CacheDirectory, p);
458 } 458 }
459 459
460 private void WriteFileCache(string filename, AssetBase asset) 460 private void WriteFileCache(string filename, AssetBase asset)
461 { 461 {
462 try 462 try
463 { 463 {
464 // Make sure the target cache directory exists 464 // Make sure the target cache directory exists
465 string directory = Path.GetDirectoryName(filename); 465 string directory = Path.GetDirectoryName(filename);
466 if (!Directory.Exists(directory)) 466 if (!Directory.Exists(directory))
467 { 467 {
468 Directory.CreateDirectory(directory); 468 Directory.CreateDirectory(directory);
469 } 469 }
470 470
471 // Write file first to a temp name, so that it doesn't look 471 // Write file first to a temp name, so that it doesn't look
472 // like it's already cached while it's still writing. 472 // like it's already cached while it's still writing.
473 string tempname = Path.Combine(directory, Path.GetRandomFileName()); 473 string tempname = Path.Combine(directory, Path.GetRandomFileName());
474 Stream stream = File.Open(tempname, FileMode.Create); 474 Stream stream = File.Open(tempname, FileMode.Create);
475 BinaryFormatter bformatter = new BinaryFormatter(); 475 BinaryFormatter bformatter = new BinaryFormatter();
476 bformatter.Serialize(stream, asset); 476 bformatter.Serialize(stream, asset);
477 stream.Close(); 477 stream.Close();
478 478
479 // Now that it's written, rename it so that it can be found. 479 // Now that it's written, rename it so that it can be found.
480 File.Move(tempname, filename); 480 File.Move(tempname, filename);
481 481
482 if (m_LogLevel >= 2) 482 if (m_LogLevel >= 2)
483 m_log.DebugFormat("[ASSET CACHE]: Cache Stored :: {0}", asset.ID); 483 m_log.DebugFormat("[ASSET CACHE]: Cache Stored :: {0}", asset.ID);
484 } 484 }
485 catch (Exception e) 485 catch (Exception e)
486 { 486 {
487 LogException(e); 487 LogException(e);
488 } 488 }
489 finally 489 finally
490 { 490 {
491 // Even if the write fails with an exception, we need to make sure 491 // Even if the write fails with an exception, we need to make sure
492 // that we release the lock on that file, otherwise it'll never get 492 // that we release the lock on that file, otherwise it'll never get
493 // cached 493 // cached
494 lock (m_CurrentlyWriting) 494 lock (m_CurrentlyWriting)
495 { 495 {
496#if WAIT_ON_INPROGRESS_REQUESTS 496#if WAIT_ON_INPROGRESS_REQUESTS
497 ManualResetEvent waitEvent; 497 ManualResetEvent waitEvent;
498 if (m_CurrentlyWriting.TryGetValue(filename, out waitEvent)) 498 if (m_CurrentlyWriting.TryGetValue(filename, out waitEvent))
499 { 499 {
500 m_CurrentlyWriting.Remove(filename); 500 m_CurrentlyWriting.Remove(filename);
501 waitEvent.Set(); 501 waitEvent.Set();
502 } 502 }
503#else 503#else
504 if (m_CurrentlyWriting.Contains(filename)) 504 if (m_CurrentlyWriting.Contains(filename))
505 { 505 {
506 m_CurrentlyWriting.Remove(filename); 506 m_CurrentlyWriting.Remove(filename);
507 } 507 }
508#endif 508#endif
509 } 509 }
510 510
511 } 511 }
512 } 512 }
513 513
514 private static void LogException(Exception e) 514 private static void LogException(Exception e)
515 { 515 {
516 string[] text = e.ToString().Split(new char[] { '\n' }); 516 string[] text = e.ToString().Split(new char[] { '\n' });
517 foreach (string t in text) 517 foreach (string t in text)
518 { 518 {
519 m_log.ErrorFormat("[ASSET CACHE]: {0} ", t); 519 m_log.ErrorFormat("[ASSET CACHE]: {0} ", t);
520 } 520 }
521 } 521 }
522 } 522 }
523} 523}
diff --git a/OpenSim/Region/CoreModules/ServiceConnectors/Inventory/LocalInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectors/Inventory/LocalInventoryServiceConnector.cs
index c89f295..6b72e9b 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectors/Inventory/LocalInventoryServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectors/Inventory/LocalInventoryServiceConnector.cs
@@ -1,273 +1,273 @@
1/* 1/*
2 * Copyright (c) Contributors, http://opensimulator.org/ 2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders. 3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright 7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright 9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution. 11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the 12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products 13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission. 14 * derived from this software without specific prior written permission.
15 * 15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY 16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 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 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 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 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. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28using log4net; 28using log4net;
29using Nini.Config; 29using Nini.Config;
30using System; 30using System;
31using System.Collections.Generic; 31using System.Collections.Generic;
32using System.Reflection; 32using System.Reflection;
33using OpenSim.Framework; 33using OpenSim.Framework;
34using OpenSim.Data; 34using OpenSim.Data;
35using OpenSim.Server.Base; 35using OpenSim.Server.Base;
36using OpenSim.Region.Framework.Interfaces; 36using OpenSim.Region.Framework.Interfaces;
37using OpenSim.Region.Framework.Scenes; 37using OpenSim.Region.Framework.Scenes;
38using OpenSim.Services.Interfaces; 38using OpenSim.Services.Interfaces;
39using OpenMetaverse; 39using OpenMetaverse;
40 40
41namespace OpenSim.Region.CoreModules.ServiceConnectors.Inventory 41namespace OpenSim.Region.CoreModules.ServiceConnectors.Inventory
42{ 42{
43 public class LocalInventoryServicesConnector : 43 public class LocalInventoryServicesConnector :
44 ISharedRegionModule, IInventoryService 44 ISharedRegionModule, IInventoryService
45 { 45 {
46 private static readonly ILog m_log = 46 private static readonly ILog m_log =
47 LogManager.GetLogger( 47 LogManager.GetLogger(
48 MethodBase.GetCurrentMethod().DeclaringType); 48 MethodBase.GetCurrentMethod().DeclaringType);
49 49
50 private IInventoryService m_InventoryService; 50 private IInventoryService m_InventoryService;
51 51
52 private bool m_Enabled = false; 52 private bool m_Enabled = false;
53 53
54 public string Name 54 public string Name
55 { 55 {
56 get { return "LocalInventoryServicesConnector"; } 56 get { return "LocalInventoryServicesConnector"; }
57 } 57 }
58 58
59 public void Initialise(IConfigSource source) 59 public void Initialise(IConfigSource source)
60 { 60 {
61 IConfig moduleConfig = source.Configs["Modules"]; 61 IConfig moduleConfig = source.Configs["Modules"];
62 if (moduleConfig != null) 62 if (moduleConfig != null)
63 { 63 {
64 string name = moduleConfig.GetString("InventoryServices", ""); 64 string name = moduleConfig.GetString("InventoryServices", "");
65 if (name == Name) 65 if (name == Name)
66 { 66 {
67 IConfig assetConfig = source.Configs["InventoryService"]; 67 IConfig assetConfig = source.Configs["InventoryService"];
68 if (assetConfig == null) 68 if (assetConfig == null)
69 { 69 {
70 m_log.Error("[INVENTORY CONNECTOR]: InventoryService missing from OpenSim.ini"); 70 m_log.Error("[INVENTORY CONNECTOR]: InventoryService missing from OpenSim.ini");
71 return; 71 return;
72 } 72 }
73 73
74 string serviceDll = assetConfig.GetString("LocalServiceModule", 74 string serviceDll = assetConfig.GetString("LocalServiceModule",
75 String.Empty); 75 String.Empty);
76 76
77 if (serviceDll == String.Empty) 77 if (serviceDll == String.Empty)
78 { 78 {
79 m_log.Error("[INVENTORY CONNECTOR]: No LocalServiceModule named in section InventoryService"); 79 m_log.Error("[INVENTORY CONNECTOR]: No LocalServiceModule named in section InventoryService");
80 return; 80 return;
81 } 81 }
82 82
83 Object[] args = new Object[] { source }; 83 Object[] args = new Object[] { source };
84 m_InventoryService = 84 m_InventoryService =
85 ServerUtils.LoadPlugin<IInventoryService>(serviceDll, 85 ServerUtils.LoadPlugin<IInventoryService>(serviceDll,
86 args); 86 args);
87 87
88 if (m_InventoryService == null) 88 if (m_InventoryService == null)
89 { 89 {
90 m_log.Error("[INVENTORY CONNECTOR]: Can't load asset service"); 90 m_log.Error("[INVENTORY CONNECTOR]: Can't load asset service");
91 return; 91 return;
92 } 92 }
93 93
94 //List<IInventoryDataPlugin> plugins 94 //List<IInventoryDataPlugin> plugins
95 // = DataPluginFactory.LoadDataPlugins<IInventoryDataPlugin>( 95 // = DataPluginFactory.LoadDataPlugins<IInventoryDataPlugin>(
96 // configSettings.StandaloneInventoryPlugin, 96 // configSettings.StandaloneInventoryPlugin,
97 // configSettings.StandaloneInventorySource); 97 // configSettings.StandaloneInventorySource);
98 98
99 //foreach (IInventoryDataPlugin plugin in plugins) 99 //foreach (IInventoryDataPlugin plugin in plugins)
100 //{ 100 //{
101 // // Using the OSP wrapper plugin for database plugins should be made configurable at some point 101 // // Using the OSP wrapper plugin for database plugins should be made configurable at some point
102 // m_InventoryService.AddPlugin(new OspInventoryWrapperPlugin(plugin, this)); 102 // m_InventoryService.AddPlugin(new OspInventoryWrapperPlugin(plugin, this));
103 //} 103 //}
104 104
105 m_Enabled = true; 105 m_Enabled = true;
106 m_log.Info("[INVENTORY CONNECTOR]: Local asset connector enabled"); 106 m_log.Info("[INVENTORY CONNECTOR]: Local asset connector enabled");
107 } 107 }
108 } 108 }
109 } 109 }
110 110
111 public void PostInitialise() 111 public void PostInitialise()
112 { 112 {
113 } 113 }
114 114
115 public void Close() 115 public void Close()
116 { 116 {
117 } 117 }
118 118
119 public void AddRegion(Scene scene) 119 public void AddRegion(Scene scene)
120 { 120 {
121 if (!m_Enabled) 121 if (!m_Enabled)
122 return; 122 return;
123 123
124 scene.RegisterModuleInterface<IInventoryService>(this); 124 scene.RegisterModuleInterface<IInventoryService>(this);
125 } 125 }
126 126
127 public void RemoveRegion(Scene scene) 127 public void RemoveRegion(Scene scene)
128 { 128 {
129 } 129 }
130 130
131 public void RegionLoaded(Scene scene) 131 public void RegionLoaded(Scene scene)
132 { 132 {
133 if (!m_Enabled) 133 if (!m_Enabled)
134 return; 134 return;
135 135
136 m_log.InfoFormat("[INVENTORY CONNECTOR]: Enabled local assets for region {0}", scene.RegionInfo.RegionName); 136 m_log.InfoFormat("[INVENTORY CONNECTOR]: Enabled local assets for region {0}", scene.RegionInfo.RegionName);
137 137
138 } 138 }
139 139
140 #region IInventoryService 140 #region IInventoryService
141 141
142 public bool CreateUserInventory(UUID user) 142 public bool CreateUserInventory(UUID user)
143 { 143 {
144 return m_InventoryService.CreateUserInventory(user); 144 return m_InventoryService.CreateUserInventory(user);
145 } 145 }
146 146
147 public List<InventoryFolderBase> GetInventorySkeleton(UUID userId) 147 public List<InventoryFolderBase> GetInventorySkeleton(UUID userId)
148 { 148 {
149 return m_InventoryService.GetInventorySkeleton(userId); 149 return m_InventoryService.GetInventorySkeleton(userId);
150 } 150 }
151 151
152 public InventoryCollection GetUserInventory(UUID id) 152 public InventoryCollection GetUserInventory(UUID id)
153 { 153 {
154 return m_InventoryService.GetUserInventory(id); 154 return m_InventoryService.GetUserInventory(id);
155 } 155 }
156 156
157 public void GetUserInventory(UUID userID, InventoryReceiptCallback callback) 157 public void GetUserInventory(UUID userID, InventoryReceiptCallback callback)
158 { 158 {
159 m_InventoryService.GetUserInventory(userID, callback); 159 m_InventoryService.GetUserInventory(userID, callback);
160 } 160 }
161 161
162 public List<InventoryItemBase> GetFolderItems(UUID folderID) 162 public List<InventoryItemBase> GetFolderItems(UUID folderID)
163 { 163 {
164 return m_InventoryService.GetFolderItems(folderID); 164 return m_InventoryService.GetFolderItems(folderID);
165 } 165 }
166 166
167 /// <summary> 167 /// <summary>
168 /// Add a new folder to the user's inventory 168 /// Add a new folder to the user's inventory
169 /// </summary> 169 /// </summary>
170 /// <param name="folder"></param> 170 /// <param name="folder"></param>
171 /// <returns>true if the folder was successfully added</returns> 171 /// <returns>true if the folder was successfully added</returns>
172 public bool AddFolder(InventoryFolderBase folder) 172 public bool AddFolder(InventoryFolderBase folder)
173 { 173 {
174 return m_InventoryService.AddFolder(folder); 174 return m_InventoryService.AddFolder(folder);
175 } 175 }
176 176
177 /// <summary> 177 /// <summary>
178 /// Update a folder in the user's inventory 178 /// Update a folder in the user's inventory
179 /// </summary> 179 /// </summary>
180 /// <param name="folder"></param> 180 /// <param name="folder"></param>
181 /// <returns>true if the folder was successfully updated</returns> 181 /// <returns>true if the folder was successfully updated</returns>
182 public bool UpdateFolder(InventoryFolderBase folder) 182 public bool UpdateFolder(InventoryFolderBase folder)
183 { 183 {
184 return m_InventoryService.UpdateFolder(folder); 184 return m_InventoryService.UpdateFolder(folder);
185 } 185 }
186 186
187 /// <summary> 187 /// <summary>
188 /// Move an inventory folder to a new location 188 /// Move an inventory folder to a new location
189 /// </summary> 189 /// </summary>
190 /// <param name="folder">A folder containing the details of the new location</param> 190 /// <param name="folder">A folder containing the details of the new location</param>
191 /// <returns>true if the folder was successfully moved</returns> 191 /// <returns>true if the folder was successfully moved</returns>
192 public bool MoveFolder(InventoryFolderBase folder) 192 public bool MoveFolder(InventoryFolderBase folder)
193 { 193 {
194 return m_InventoryService.MoveFolder(folder); 194 return m_InventoryService.MoveFolder(folder);
195 } 195 }
196 196
197 /// <summary> 197 /// <summary>
198 /// Purge an inventory folder of all its items and subfolders. 198 /// Purge an inventory folder of all its items and subfolders.
199 /// </summary> 199 /// </summary>
200 /// <param name="folder"></param> 200 /// <param name="folder"></param>
201 /// <returns>true if the folder was successfully purged</returns> 201 /// <returns>true if the folder was successfully purged</returns>
202 public bool PurgeFolder(InventoryFolderBase folder) 202 public bool PurgeFolder(InventoryFolderBase folder)
203 { 203 {
204 return m_InventoryService.PurgeFolder(folder); 204 return m_InventoryService.PurgeFolder(folder);
205 } 205 }
206 206
207 /// <summary> 207 /// <summary>
208 /// Add a new item to the user's inventory 208 /// Add a new item to the user's inventory
209 /// </summary> 209 /// </summary>
210 /// <param name="item"></param> 210 /// <param name="item"></param>
211 /// <returns>true if the item was successfully added</returns> 211 /// <returns>true if the item was successfully added</returns>
212 public bool AddItem(InventoryItemBase item) 212 public bool AddItem(InventoryItemBase item)
213 { 213 {
214 return m_InventoryService.AddItem(item); 214 return m_InventoryService.AddItem(item);
215 } 215 }
216 216
217 /// <summary> 217 /// <summary>
218 /// Update an item in the user's inventory 218 /// Update an item in the user's inventory
219 /// </summary> 219 /// </summary>
220 /// <param name="item"></param> 220 /// <param name="item"></param>
221 /// <returns>true if the item was successfully updated</returns> 221 /// <returns>true if the item was successfully updated</returns>
222 public bool UpdateItem(InventoryItemBase item) 222 public bool UpdateItem(InventoryItemBase item)
223 { 223 {
224 return m_InventoryService.UpdateItem(item); 224 return m_InventoryService.UpdateItem(item);
225 } 225 }
226 226
227 /// <summary> 227 /// <summary>
228 /// Delete an item from the user's inventory 228 /// Delete an item from the user's inventory
229 /// </summary> 229 /// </summary>
230 /// <param name="item"></param> 230 /// <param name="item"></param>
231 /// <returns>true if the item was successfully deleted</returns> 231 /// <returns>true if the item was successfully deleted</returns>
232 public bool DeleteItem(InventoryItemBase item) 232 public bool DeleteItem(InventoryItemBase item)
233 { 233 {
234 return m_InventoryService.DeleteItem(item); 234 return m_InventoryService.DeleteItem(item);
235 } 235 }
236 236
237 public InventoryItemBase QueryItem(InventoryItemBase item) 237 public InventoryItemBase QueryItem(InventoryItemBase item)
238 { 238 {
239 return m_InventoryService.QueryItem(item); 239 return m_InventoryService.QueryItem(item);
240 } 240 }
241 241
242 public InventoryFolderBase QueryFolder(InventoryFolderBase folder) 242 public InventoryFolderBase QueryFolder(InventoryFolderBase folder)
243 { 243 {
244 return m_InventoryService.QueryFolder(folder); 244 return m_InventoryService.QueryFolder(folder);
245 } 245 }
246 246
247 /// <summary> 247 /// <summary>
248 /// Does the given user have an inventory structure? 248 /// Does the given user have an inventory structure?
249 /// </summary> 249 /// </summary>
250 /// <param name="userID"></param> 250 /// <param name="userID"></param>
251 /// <returns></returns> 251 /// <returns></returns>
252 public bool HasInventoryForUser(UUID userID) 252 public bool HasInventoryForUser(UUID userID)
253 { 253 {
254 return m_InventoryService.HasInventoryForUser(userID); 254 return m_InventoryService.HasInventoryForUser(userID);
255 } 255 }
256 256
257 /// <summary> 257 /// <summary>
258 /// Retrieve the root inventory folder for the given user. 258 /// Retrieve the root inventory folder for the given user.
259 /// </summary> 259 /// </summary>
260 /// <param name="userID"></param> 260 /// <param name="userID"></param>
261 /// <returns>null if no root folder was found</returns> 261 /// <returns>null if no root folder was found</returns>
262 public InventoryFolderBase RequestRootFolder(UUID userID) 262 public InventoryFolderBase RequestRootFolder(UUID userID)
263 { 263 {
264 return m_InventoryService.RequestRootFolder(userID); 264 return m_InventoryService.RequestRootFolder(userID);
265 } 265 }
266 266
267 public List<InventoryItemBase> GetActiveGestures(UUID userId) 267 public List<InventoryItemBase> GetActiveGestures(UUID userId)
268 { 268 {
269 return m_InventoryService.GetActiveGestures(userId); 269 return m_InventoryService.GetActiveGestures(userId);
270 } 270 }
271 #endregion IInventoryService 271 #endregion IInventoryService
272 } 272 }
273} 273}