aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules
diff options
context:
space:
mode:
authorTeravus Ovares (Dan Olivares)2009-08-15 13:10:21 -0400
committerTeravus Ovares (Dan Olivares)2009-08-15 13:10:21 -0400
commit30ce56e7219b3d2ed16acb322cecec781c3776c5 (patch)
tree3ab732fc9c8775a3fab0a705b4496ea21c1ab128 /OpenSim/Region/CoreModules
parent* part one of adding physics combining (diff)
parent* whoops, missing a / (diff)
downloadopensim-SC_OLD-30ce56e7219b3d2ed16acb322cecec781c3776c5.zip
opensim-SC_OLD-30ce56e7219b3d2ed16acb322cecec781c3776c5.tar.gz
opensim-SC_OLD-30ce56e7219b3d2ed16acb322cecec781c3776c5.tar.bz2
opensim-SC_OLD-30ce56e7219b3d2ed16acb322cecec781c3776c5.tar.xz
Merge branch 'master' of ssh://MyConnection/var/git/opensim
Diffstat (limited to 'OpenSim/Region/CoreModules')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs55
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Profiles/AvatarProfilesModule.cs9
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/BaseInventoryConnector.cs206
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs52
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs75
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs52
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs52
7 files changed, 369 insertions, 132 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
index 28b4d64..470a386 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
@@ -74,7 +74,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
74 /// <summary> 74 /// <summary>
75 /// Test saving a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet). 75 /// Test saving a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet).
76 /// </summary> 76 /// </summary>
77 //[Test] 77 [Test]
78 public void TestSaveIarV0_1() 78 public void TestSaveIarV0_1()
79 { 79 {
80 TestHelper.InMethod(); 80 TestHelper.InMethod();
@@ -82,7 +82,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
82 82
83 InventoryArchiverModule archiverModule = new InventoryArchiverModule(); 83 InventoryArchiverModule archiverModule = new InventoryArchiverModule();
84 84
85 Scene scene = SceneSetupHelpers.SetupScene(""); 85 Scene scene = SceneSetupHelpers.SetupScene("Inventory");
86 SceneSetupHelpers.SetupSceneModules(scene, archiverModule); 86 SceneSetupHelpers.SetupSceneModules(scene, archiverModule);
87 CommunicationsManager cm = scene.CommsManager; 87 CommunicationsManager cm = scene.CommsManager;
88 88
@@ -222,7 +222,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
222 /// Test loading a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet) where 222 /// Test loading a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet) where
223 /// an account exists with the creator name. 223 /// an account exists with the creator name.
224 /// </summary> 224 /// </summary>
225 //[Test] 225 [Test]
226 public void TestLoadIarV0_1ExistingUsers() 226 public void TestLoadIarV0_1ExistingUsers()
227 { 227 {
228 TestHelper.InMethod(); 228 TestHelper.InMethod();
@@ -262,7 +262,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
262 InventoryArchiverModule archiverModule = new InventoryArchiverModule(); 262 InventoryArchiverModule archiverModule = new InventoryArchiverModule();
263 263
264 // Annoyingly, we have to set up a scene even though inventory loading has nothing to do with a scene 264 // Annoyingly, we have to set up a scene even though inventory loading has nothing to do with a scene
265 Scene scene = SceneSetupHelpers.SetupScene(); 265 Scene scene = SceneSetupHelpers.SetupScene("inventory");
266 IUserAdminService userAdminService = scene.CommsManager.UserAdminService; 266 IUserAdminService userAdminService = scene.CommsManager.UserAdminService;
267 267
268 SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule); 268 SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule);
@@ -276,16 +276,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
276 276
277 CachedUserInfo userInfo 277 CachedUserInfo userInfo
278 = scene.CommsManager.UserProfileCacheService.GetUserDetails(userFirstName, userLastName); 278 = scene.CommsManager.UserProfileCacheService.GetUserDetails(userFirstName, userLastName);
279 //userInfo.FetchInventory(); 279
280 /*
281 for (int i = 0 ; i < 50 ; i++)
282 {
283 if (userInfo.HasReceivedInventory == true)
284 break;
285 Thread.Sleep(200);
286 }
287 Assert.That(userInfo.HasReceivedInventory, Is.True, "FetchInventory timed out (10 seconds)");
288 */
289 InventoryItemBase foundItem = userInfo.RootFolder.FindItemByPath(itemName); 280 InventoryItemBase foundItem = userInfo.RootFolder.FindItemByPath(itemName);
290 Assert.That(foundItem, Is.Not.Null, "Didn't find loaded item"); 281 Assert.That(foundItem, Is.Not.Null, "Didn't find loaded item");
291 Assert.That( 282 Assert.That(
@@ -395,17 +386,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
395 userInfo = UserProfileTestUtils.CreateUserWithInventory(commsManager, InventoryReceived); 386 userInfo = UserProfileTestUtils.CreateUserWithInventory(commsManager, InventoryReceived);
396 Monitor.Wait(this, 60000); 387 Monitor.Wait(this, 60000);
397 } 388 }
398
399 //userInfo.FetchInventory();
400 /*
401 for (int i = 0 ; i < 50 ; i++)
402 {
403 if (userInfo.HasReceivedInventory == true)
404 break;
405 Thread.Sleep(200);
406 }
407 Assert.That(userInfo.HasReceivedInventory, Is.True, "FetchInventory timed out (10 seconds)");
408 */
409 389
410 Console.WriteLine("userInfo.RootFolder 1: {0}", userInfo.RootFolder); 390 Console.WriteLine("userInfo.RootFolder 1: {0}", userInfo.RootFolder);
411 391
@@ -429,22 +409,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
429 409
430 Console.WriteLine("userInfo.RootFolder 2: {0}", userInfo.RootFolder); 410 Console.WriteLine("userInfo.RootFolder 2: {0}", userInfo.RootFolder);
431 411
432 try 412 new InventoryArchiveReadRequest(userInfo, null, (Stream)null, null, null)
433 { 413 .ReplicateArchivePathToUserInventory(
434 new InventoryArchiveReadRequest(userInfo, null, (Stream)null, null, null) 414 itemArchivePath, false, userInfo.RootFolder, foldersCreated, nodesLoaded);
435 .ReplicateArchivePathToUserInventory(itemArchivePath, false, userInfo.RootFolder, foldersCreated, nodesLoaded); 415
436 416 Console.WriteLine("userInfo.RootFolder 3: {0}", userInfo.RootFolder);
437 Console.WriteLine("userInfo.RootFolder 3: {0}", userInfo.RootFolder); 417 InventoryFolderImpl folder1 = userInfo.RootFolder.FindFolderByPath("a");
438 InventoryFolderImpl folder1 = userInfo.RootFolder.FindFolderByPath("a"); 418 Assert.That(folder1, Is.Not.Null, "Could not find folder a");
439 Assert.That(folder1, Is.Not.Null, "Could not find folder a"); 419 InventoryFolderImpl folder2 = folder1.FindFolderByPath("b");
440 InventoryFolderImpl folder2 = folder1.FindFolderByPath("b"); 420 Assert.That(folder2, Is.Not.Null, "Could not find folder b");
441 Assert.That(folder2, Is.Not.Null, "Could not find folder b");
442 }
443 catch (NullReferenceException e)
444 {
445 // Non fatal for now until we resolve the race condition
446 Console.WriteLine("Test failed with {0}", e);
447 }
448 } 421 }
449 } 422 }
450} 423}
diff --git a/OpenSim/Region/CoreModules/Avatar/Profiles/AvatarProfilesModule.cs b/OpenSim/Region/CoreModules/Avatar/Profiles/AvatarProfilesModule.cs
index d3324e4..0f58788 100644
--- a/OpenSim/Region/CoreModules/Avatar/Profiles/AvatarProfilesModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Profiles/AvatarProfilesModule.cs
@@ -26,6 +26,7 @@
26 */ 26 */
27 27
28using System; 28using System;
29using System.Collections;
29using System.Globalization; 30using System.Globalization;
30using System.Reflection; 31using System.Reflection;
31using log4net; 32using log4net;
@@ -41,6 +42,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Profiles
41 { 42 {
42 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 43 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
43 private Scene m_scene; 44 private Scene m_scene;
45 private IProfileModule m_profileModule = null;
44 46
45 public AvatarProfilesModule() 47 public AvatarProfilesModule()
46 { 48 {
@@ -56,6 +58,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Profiles
56 58
57 public void PostInitialise() 59 public void PostInitialise()
58 { 60 {
61 m_profileModule = m_scene.RequestModuleInterface<IProfileModule>();
59 } 62 }
60 63
61 public void Close() 64 public void Close()
@@ -108,6 +111,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Profiles
108 charterMember = Utils.StringToBytes(profile.CustomType); 111 charterMember = Utils.StringToBytes(profile.CustomType);
109 } 112 }
110 113
114 if (m_profileModule != null)
115 {
116 Hashtable profileData = m_profileModule.GetProfileData(remoteClient.AgentId);
117 if (profileData["ProfileUrl"] != null)
118 profile.ProfileUrl = profileData["ProfileUrl"].ToString();
119 }
111 remoteClient.SendAvatarProperties(profile.ID, profile.AboutText, 120 remoteClient.SendAvatarProperties(profile.ID, profile.AboutText,
112 Util.ToDateTime(profile.Created).ToString("M/d/yyyy", CultureInfo.InvariantCulture), 121 Util.ToDateTime(profile.Created).ToString("M/d/yyyy", CultureInfo.InvariantCulture),
113 charterMember, profile.FirstLifeAboutText, (uint)(profile.UserFlags & 0xff), 122 charterMember, profile.FirstLifeAboutText, (uint)(profile.UserFlags & 0xff),
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/BaseInventoryConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/BaseInventoryConnector.cs
new file mode 100644
index 0000000..375faf5
--- /dev/null
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/BaseInventoryConnector.cs
@@ -0,0 +1,206 @@
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 OpenSimulator 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
28using System;
29using System.Collections.Generic;
30
31using OpenMetaverse;
32using Nini.Config;
33using log4net;
34
35using OpenSim.Framework;
36using OpenSim.Services.Interfaces;
37
38
39namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
40{
41 public abstract class BaseInventoryConnector : IInventoryService
42 {
43 protected InventoryCache m_cache;
44
45 protected virtual void Init(IConfigSource source)
46 {
47 m_cache = new InventoryCache();
48 m_cache.Init(source, this);
49 }
50
51 /// <summary>
52 /// Create the entire inventory for a given user
53 /// </summary>
54 /// <param name="user"></param>
55 /// <returns></returns>
56 public abstract bool CreateUserInventory(UUID user);
57
58 /// <summary>
59 /// Gets the skeleton of the inventory -- folders only
60 /// </summary>
61 /// <param name="userId"></param>
62 /// <returns></returns>
63 public abstract List<InventoryFolderBase> GetInventorySkeleton(UUID userId);
64
65 /// <summary>
66 /// Synchronous inventory fetch.
67 /// </summary>
68 /// <param name="userID"></param>
69 /// <returns></returns>
70 public abstract InventoryCollection GetUserInventory(UUID userID);
71
72 /// <summary>
73 /// Request the inventory for a user. This is an asynchronous operation that will call the callback when the
74 /// inventory has been received
75 /// </summary>
76 /// <param name="userID"></param>
77 /// <param name="callback"></param>
78 public abstract void GetUserInventory(UUID userID, InventoryReceiptCallback callback);
79
80 /// <summary>
81 /// Retrieve the root inventory folder for the given user.
82 /// </summary>
83 /// <param name="userID"></param>
84 /// <returns>null if no root folder was found</returns>
85 public abstract InventoryFolderBase GetRootFolder(UUID userID);
86
87 public abstract Dictionary<AssetType, InventoryFolderBase> GetSystemFolders(UUID userID);
88
89 /// <summary>
90 /// Gets the user folder for the given folder-type
91 /// </summary>
92 /// <param name="userID"></param>
93 /// <param name="type"></param>
94 /// <returns></returns>
95 public InventoryFolderBase GetFolderForType(UUID userID, AssetType type)
96 {
97 return m_cache.GetFolderForType(userID, type);
98 }
99
100 /// <summary>
101 /// Gets everything (folders and items) inside a folder
102 /// </summary>
103 /// <param name="userId"></param>
104 /// <param name="folderID"></param>
105 /// <returns></returns>
106 public abstract InventoryCollection GetFolderContent(UUID userID, UUID folderID);
107
108 /// <summary>
109 /// Gets the items inside a folder
110 /// </summary>
111 /// <param name="userID"></param>
112 /// <param name="folderID"></param>
113 /// <returns></returns>
114 public abstract List<InventoryItemBase> GetFolderItems(UUID userID, UUID folderID);
115
116 /// <summary>
117 /// Add a new folder to the user's inventory
118 /// </summary>
119 /// <param name="folder"></param>
120 /// <returns>true if the folder was successfully added</returns>
121 public abstract bool AddFolder(InventoryFolderBase folder);
122
123 /// <summary>
124 /// Update a folder in the user's inventory
125 /// </summary>
126 /// <param name="folder"></param>
127 /// <returns>true if the folder was successfully updated</returns>
128 public abstract bool UpdateFolder(InventoryFolderBase folder);
129
130 /// <summary>
131 /// Move an inventory folder to a new location
132 /// </summary>
133 /// <param name="folder">A folder containing the details of the new location</param>
134 /// <returns>true if the folder was successfully moved</returns>
135 public abstract bool MoveFolder(InventoryFolderBase folder);
136
137 /// <summary>
138 /// Purge an inventory folder of all its items and subfolders.
139 /// </summary>
140 /// <param name="folder"></param>
141 /// <returns>true if the folder was successfully purged</returns>
142 public abstract bool PurgeFolder(InventoryFolderBase folder);
143
144 /// <summary>
145 /// Add a new item to the user's inventory.
146 /// If the given item has to parent folder, it tries to find the most
147 /// suitable folder for it.
148 /// </summary>
149 /// <param name="item"></param>
150 /// <returns>true if the item was successfully added</returns>
151 public bool AddItem(InventoryItemBase item)
152 {
153 if (item.Folder == UUID.Zero)
154 {
155 InventoryFolderBase f = GetFolderForType(item.Owner, (AssetType)item.AssetType);
156 if (f != null)
157 item.Folder = f.ID;
158 else
159 {
160 f = GetRootFolder(item.Owner);
161 if (f != null)
162 item.Folder = f.ID;
163 else
164 return false;
165 }
166 }
167
168 return AddItemPlain(item);
169 }
170
171 protected abstract bool AddItemPlain(InventoryItemBase item);
172
173 /// <summary>
174 /// Update an item in the user's inventory
175 /// </summary>
176 /// <param name="item"></param>
177 /// <returns>true if the item was successfully updated</returns>
178 public abstract bool UpdateItem(InventoryItemBase item);
179
180 /// <summary>
181 /// Delete an item from the user's inventory
182 /// </summary>
183 /// <param name="item"></param>
184 /// <returns>true if the item was successfully deleted</returns>
185 public abstract bool DeleteItem(InventoryItemBase item);
186
187 public abstract InventoryItemBase QueryItem(InventoryItemBase item);
188
189 public abstract InventoryFolderBase QueryFolder(InventoryFolderBase folder);
190
191 /// <summary>
192 /// Does the given user have an inventory structure?
193 /// </summary>
194 /// <param name="userID"></param>
195 /// <returns></returns>
196 public abstract bool HasInventoryForUser(UUID userID);
197
198 /// <summary>
199 /// Get the active gestures of the agent.
200 /// </summary>
201 /// <param name="userId"></param>
202 /// <returns></returns>
203 public abstract List<InventoryItemBase> GetActiveGestures(UUID userId);
204
205 }
206}
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs
index d4168fe..62b9bed 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs
@@ -41,7 +41,7 @@ using OpenMetaverse;
41 41
42namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory 42namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
43{ 43{
44 public class HGInventoryBroker : InventoryCache, ISharedRegionModule, IInventoryService 44 public class HGInventoryBroker : BaseInventoryConnector, ISharedRegionModule, IInventoryService
45 { 45 {
46 private static readonly ILog m_log = 46 private static readonly ILog m_log =
47 LogManager.GetLogger( 47 LogManager.GetLogger(
@@ -138,7 +138,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
138 { 138 {
139 } 139 }
140 140
141 public override void AddRegion(Scene scene) 141 public void AddRegion(Scene scene)
142 { 142 {
143 if (!m_Enabled) 143 if (!m_Enabled)
144 return; 144 return;
@@ -156,12 +156,15 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
156 } 156 }
157 157
158 scene.RegisterModuleInterface<IInventoryService>(this); 158 scene.RegisterModuleInterface<IInventoryService>(this);
159 base.AddRegion(scene); 159 m_cache.AddRegion(scene);
160 } 160 }
161 161
162 public override void RemoveRegion(Scene scene) 162 public void RemoveRegion(Scene scene)
163 { 163 {
164 base.RemoveRegion(scene); 164 if (!m_Enabled)
165 return;
166
167 m_cache.RemoveRegion(scene);
165 } 168 }
166 169
167 public void RegionLoaded(Scene scene) 170 public void RegionLoaded(Scene scene)
@@ -175,17 +178,17 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
175 178
176 #region IInventoryService 179 #region IInventoryService
177 180
178 public bool CreateUserInventory(UUID userID) 181 public override bool CreateUserInventory(UUID userID)
179 { 182 {
180 return m_GridService.CreateUserInventory(userID); 183 return m_GridService.CreateUserInventory(userID);
181 } 184 }
182 185
183 public List<InventoryFolderBase> GetInventorySkeleton(UUID userId) 186 public override List<InventoryFolderBase> GetInventorySkeleton(UUID userId)
184 { 187 {
185 return m_GridService.GetInventorySkeleton(userId); 188 return m_GridService.GetInventorySkeleton(userId);
186 } 189 }
187 190
188 public InventoryCollection GetUserInventory(UUID userID) 191 public override InventoryCollection GetUserInventory(UUID userID)
189 { 192 {
190 if (IsLocalGridUser(userID)) 193 if (IsLocalGridUser(userID))
191 return m_GridService.GetUserInventory(userID); 194 return m_GridService.GetUserInventory(userID);
@@ -193,7 +196,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
193 return null; 196 return null;
194 } 197 }
195 198
196 public void GetUserInventory(UUID userID, InventoryReceiptCallback callback) 199 public override void GetUserInventory(UUID userID, InventoryReceiptCallback callback)
197 { 200 {
198 if (IsLocalGridUser(userID)) 201 if (IsLocalGridUser(userID))
199 m_GridService.GetUserInventory(userID, callback); 202 m_GridService.GetUserInventory(userID, callback);
@@ -220,7 +223,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
220 // } 223 // }
221 //} 224 //}
222 225
223 public InventoryCollection GetFolderContent(UUID userID, UUID folderID) 226 public override InventoryCollection GetFolderContent(UUID userID, UUID folderID)
224 { 227 {
225 if (IsLocalGridUser(userID)) 228 if (IsLocalGridUser(userID))
226 return m_GridService.GetFolderContent(userID, folderID); 229 return m_GridService.GetFolderContent(userID, folderID);
@@ -271,12 +274,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
271 return new Dictionary<AssetType, InventoryFolderBase>(); 274 return new Dictionary<AssetType, InventoryFolderBase>();
272 } 275 }
273 276
274 public List<InventoryItemBase> GetFolderItems(UUID userID, UUID folderID) 277 public override List<InventoryItemBase> GetFolderItems(UUID userID, UUID folderID)
275 { 278 {
276 return new List<InventoryItemBase>(); 279 return new List<InventoryItemBase>();
277 } 280 }
278 281
279 public bool AddFolder(InventoryFolderBase folder) 282 public override bool AddFolder(InventoryFolderBase folder)
280 { 283 {
281 if (folder == null) 284 if (folder == null)
282 return false; 285 return false;
@@ -291,7 +294,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
291 } 294 }
292 } 295 }
293 296
294 public bool UpdateFolder(InventoryFolderBase folder) 297 public override bool UpdateFolder(InventoryFolderBase folder)
295 { 298 {
296 if (folder == null) 299 if (folder == null)
297 return false; 300 return false;
@@ -306,7 +309,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
306 } 309 }
307 } 310 }
308 311
309 public bool MoveFolder(InventoryFolderBase folder) 312 public override bool MoveFolder(InventoryFolderBase folder)
310 { 313 {
311 if (folder == null) 314 if (folder == null)
312 return false; 315 return false;
@@ -321,7 +324,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
321 } 324 }
322 } 325 }
323 326
324 public bool PurgeFolder(InventoryFolderBase folder) 327 public override bool PurgeFolder(InventoryFolderBase folder)
325 { 328 {
326 if (folder == null) 329 if (folder == null)
327 return false; 330 return false;
@@ -336,7 +339,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
336 } 339 }
337 } 340 }
338 341
339 public bool AddItem(InventoryItemBase item) 342 // public bool AddItem(InventoryItemBase item) inherited
343 // Uses AddItemPlain
344
345 protected override bool AddItemPlain(InventoryItemBase item)
340 { 346 {
341 if (item == null) 347 if (item == null)
342 return false; 348 return false;
@@ -351,7 +357,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
351 } 357 }
352 } 358 }
353 359
354 public bool UpdateItem(InventoryItemBase item) 360 public override bool UpdateItem(InventoryItemBase item)
355 { 361 {
356 if (item == null) 362 if (item == null)
357 return false; 363 return false;
@@ -366,7 +372,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
366 } 372 }
367 } 373 }
368 374
369 public bool DeleteItem(InventoryItemBase item) 375 public override bool DeleteItem(InventoryItemBase item)
370 { 376 {
371 if (item == null) 377 if (item == null)
372 return false; 378 return false;
@@ -381,7 +387,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
381 } 387 }
382 } 388 }
383 389
384 public InventoryItemBase QueryItem(InventoryItemBase item) 390 public override InventoryItemBase QueryItem(InventoryItemBase item)
385 { 391 {
386 if (item == null) 392 if (item == null)
387 return null; 393 return null;
@@ -396,7 +402,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
396 } 402 }
397 } 403 }
398 404
399 public InventoryFolderBase QueryFolder(InventoryFolderBase folder) 405 public override InventoryFolderBase QueryFolder(InventoryFolderBase folder)
400 { 406 {
401 if (folder == null) 407 if (folder == null)
402 return null; 408 return null;
@@ -411,17 +417,17 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
411 } 417 }
412 } 418 }
413 419
414 public bool HasInventoryForUser(UUID userID) 420 public override bool HasInventoryForUser(UUID userID)
415 { 421 {
416 return false; 422 return false;
417 } 423 }
418 424
419 public InventoryFolderBase GetRootFolder(UUID userID) 425 public override InventoryFolderBase GetRootFolder(UUID userID)
420 { 426 {
421 return null; 427 return null;
422 } 428 }
423 429
424 public List<InventoryItemBase> GetActiveGestures(UUID userId) 430 public override List<InventoryItemBase> GetActiveGestures(UUID userId)
425 { 431 {
426 return new List<InventoryItemBase>(); 432 return new List<InventoryItemBase>();
427 } 433 }
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs
index b4785f4..c16e92e 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs
@@ -1,4 +1,31 @@
1using System; 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 OpenSimulator 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
28using System;
2using System.Collections.Generic; 29using System.Collections.Generic;
3using System.Reflection; 30using System.Reflection;
4 31
@@ -12,21 +39,23 @@ using log4net;
12 39
13namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory 40namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
14{ 41{
15 public abstract class InventoryCache 42 public class InventoryCache
16 { 43 {
17 private static readonly ILog m_log = 44 private static readonly ILog m_log =
18 LogManager.GetLogger( 45 LogManager.GetLogger(
19 MethodBase.GetCurrentMethod().DeclaringType); 46 MethodBase.GetCurrentMethod().DeclaringType);
20 47
48 protected BaseInventoryConnector m_Connector;
21 protected List<Scene> m_Scenes; 49 protected List<Scene> m_Scenes;
22 50
23 // The cache proper 51 // The cache proper
24 protected Dictionary<UUID, Dictionary<AssetType, InventoryFolderBase>> m_InventoryCache; 52 protected Dictionary<UUID, Dictionary<AssetType, InventoryFolderBase>> m_InventoryCache;
25 53
26 protected virtual void Init(IConfigSource source) 54 public virtual void Init(IConfigSource source, BaseInventoryConnector connector)
27 { 55 {
28 m_Scenes = new List<Scene>(); 56 m_Scenes = new List<Scene>();
29 m_InventoryCache = new Dictionary<UUID, Dictionary<AssetType, InventoryFolderBase>>(); 57 m_InventoryCache = new Dictionary<UUID, Dictionary<AssetType, InventoryFolderBase>>();
58 m_Connector = connector;
30 } 59 }
31 60
32 public virtual void AddRegion(Scene scene) 61 public virtual void AddRegion(Scene scene)
@@ -59,9 +88,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
59 } 88 }
60 89
61 // If not, go get them and place them in the cache 90 // If not, go get them and place them in the cache
62 Dictionary<AssetType, InventoryFolderBase> folders = GetSystemFolders(presence.UUID); 91 Dictionary<AssetType, InventoryFolderBase> folders = m_Connector.GetSystemFolders(presence.UUID);
63 m_log.DebugFormat("[INVENTORY CACHE]: OnMakeRootAgent, fetched system folders for {0} {1}: count {2}", 92 m_log.DebugFormat("[INVENTORY CACHE]: OnMakeRootAgent in {0}, fetched system folders for {1} {2}: count {3}",
64 presence.Firstname, presence.Lastname, folders.Count); 93 presence.Scene.RegionInfo.RegionName, presence.Firstname, presence.Lastname, folders.Count);
65 if (folders.Count > 0) 94 if (folders.Count > 0)
66 lock (m_InventoryCache) 95 lock (m_InventoryCache)
67 m_InventoryCache.Add(presence.UUID, folders); 96 m_InventoryCache.Add(presence.UUID, folders);
@@ -69,28 +98,32 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
69 98
70 void OnClientClosed(UUID clientID, Scene scene) 99 void OnClientClosed(UUID clientID, Scene scene)
71 { 100 {
72 ScenePresence sp = null; 101 if (m_InventoryCache.ContainsKey(clientID)) // if it's still in cache
73 foreach (Scene s in m_Scenes)
74 { 102 {
75 s.TryGetAvatar(clientID, out sp); 103 ScenePresence sp = null;
76 if ((sp != null) && !sp.IsChildAgent) 104 foreach (Scene s in m_Scenes)
77 { 105 {
78 m_log.DebugFormat("[INVENTORY CACHE]: OnClientClosed in {0}, but user {1} still in sim. Keeping system folders in cache", 106 s.TryGetAvatar(clientID, out sp);
79 scene.RegionInfo.RegionName, clientID); 107 if ((sp != null) && !sp.IsChildAgent && (s != scene))
80 return; 108 {
109 m_log.DebugFormat("[INVENTORY CACHE]: OnClientClosed in {0}, but user {1} still in sim. Keeping system folders in cache",
110 scene.RegionInfo.RegionName, clientID);
111 return;
112 }
81 } 113 }
82 }
83 114
84 m_log.DebugFormat("[INVENTORY CACHE]: OnClientClosed in {0}, user {1} out of sim. Dropping system folders", 115 // Drop system folders
85 scene.RegionInfo.RegionName, clientID); 116 lock (m_InventoryCache)
86 // Drop system folders 117 if (m_InventoryCache.ContainsKey(clientID))
87 lock (m_InventoryCache) 118 {
88 if (m_InventoryCache.ContainsKey(clientID)) 119 m_log.DebugFormat("[INVENTORY CACHE]: OnClientClosed in {0}, user {1} out of sim. Dropping system folders",
89 m_InventoryCache.Remove(clientID); 120 scene.RegionInfo.RegionName, clientID);
90 121
122 m_InventoryCache.Remove(clientID);
123 }
124 }
91 } 125 }
92 126
93 public abstract Dictionary<AssetType, InventoryFolderBase> GetSystemFolders(UUID userID);
94 127
95 public InventoryFolderBase GetFolderForType(UUID userID, AssetType type) 128 public InventoryFolderBase GetFolderForType(UUID userID, AssetType type)
96 { 129 {
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs
index 98e30ce..6efe903 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs
@@ -41,7 +41,7 @@ using OpenMetaverse;
41 41
42namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory 42namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
43{ 43{
44 public class LocalInventoryServicesConnector : InventoryCache, ISharedRegionModule, IInventoryService 44 public class LocalInventoryServicesConnector : BaseInventoryConnector, ISharedRegionModule, IInventoryService
45 { 45 {
46 private static readonly ILog m_log = 46 private static readonly ILog m_log =
47 LogManager.GetLogger( 47 LogManager.GetLogger(
@@ -124,7 +124,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
124 { 124 {
125 } 125 }
126 126
127 public override void AddRegion(Scene scene) 127 public void AddRegion(Scene scene)
128 { 128 {
129 if (!m_Enabled) 129 if (!m_Enabled)
130 return; 130 return;
@@ -141,12 +141,15 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
141// "[INVENTORY CONNECTOR]: Registering IInventoryService to scene {0}", scene.RegionInfo.RegionName); 141// "[INVENTORY CONNECTOR]: Registering IInventoryService to scene {0}", scene.RegionInfo.RegionName);
142 142
143 scene.RegisterModuleInterface<IInventoryService>(this); 143 scene.RegisterModuleInterface<IInventoryService>(this);
144 base.AddRegion(scene); 144 m_cache.AddRegion(scene);
145 } 145 }
146 146
147 public override void RemoveRegion(Scene scene) 147 public void RemoveRegion(Scene scene)
148 { 148 {
149 base.RemoveRegion(scene); 149 if (!m_Enabled)
150 return;
151
152 m_cache.RemoveRegion(scene);
150 } 153 }
151 154
152 public void RegionLoaded(Scene scene) 155 public void RegionLoaded(Scene scene)
@@ -160,22 +163,22 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
160 163
161 #region IInventoryService 164 #region IInventoryService
162 165
163 public bool CreateUserInventory(UUID user) 166 public override bool CreateUserInventory(UUID user)
164 { 167 {
165 return m_InventoryService.CreateUserInventory(user); 168 return m_InventoryService.CreateUserInventory(user);
166 } 169 }
167 170
168 public List<InventoryFolderBase> GetInventorySkeleton(UUID userId) 171 public override List<InventoryFolderBase> GetInventorySkeleton(UUID userId)
169 { 172 {
170 return m_InventoryService.GetInventorySkeleton(userId); 173 return m_InventoryService.GetInventorySkeleton(userId);
171 } 174 }
172 175
173 public InventoryCollection GetUserInventory(UUID id) 176 public override InventoryCollection GetUserInventory(UUID id)
174 { 177 {
175 return m_InventoryService.GetUserInventory(id); 178 return m_InventoryService.GetUserInventory(id);
176 } 179 }
177 180
178 public void GetUserInventory(UUID userID, InventoryReceiptCallback callback) 181 public override void GetUserInventory(UUID userID, InventoryReceiptCallback callback)
179 { 182 {
180 m_InventoryService.GetUserInventory(userID, callback); 183 m_InventoryService.GetUserInventory(userID, callback);
181 } 184 }
@@ -207,13 +210,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
207 return new Dictionary<AssetType, InventoryFolderBase>(); 210 return new Dictionary<AssetType, InventoryFolderBase>();
208 } 211 }
209 212
210 public InventoryCollection GetFolderContent(UUID userID, UUID folderID) 213 public override InventoryCollection GetFolderContent(UUID userID, UUID folderID)
211 { 214 {
212 return m_InventoryService.GetFolderContent(userID, folderID); 215 return m_InventoryService.GetFolderContent(userID, folderID);
213 } 216 }
214 217
215 218
216 public List<InventoryItemBase> GetFolderItems(UUID userID, UUID folderID) 219 public override List<InventoryItemBase> GetFolderItems(UUID userID, UUID folderID)
217 { 220 {
218 return m_InventoryService.GetFolderItems(userID, folderID); 221 return m_InventoryService.GetFolderItems(userID, folderID);
219 } 222 }
@@ -223,7 +226,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
223 /// </summary> 226 /// </summary>
224 /// <param name="folder"></param> 227 /// <param name="folder"></param>
225 /// <returns>true if the folder was successfully added</returns> 228 /// <returns>true if the folder was successfully added</returns>
226 public bool AddFolder(InventoryFolderBase folder) 229 public override bool AddFolder(InventoryFolderBase folder)
227 { 230 {
228 return m_InventoryService.AddFolder(folder); 231 return m_InventoryService.AddFolder(folder);
229 } 232 }
@@ -233,7 +236,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
233 /// </summary> 236 /// </summary>
234 /// <param name="folder"></param> 237 /// <param name="folder"></param>
235 /// <returns>true if the folder was successfully updated</returns> 238 /// <returns>true if the folder was successfully updated</returns>
236 public bool UpdateFolder(InventoryFolderBase folder) 239 public override bool UpdateFolder(InventoryFolderBase folder)
237 { 240 {
238 return m_InventoryService.UpdateFolder(folder); 241 return m_InventoryService.UpdateFolder(folder);
239 } 242 }
@@ -243,7 +246,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
243 /// </summary> 246 /// </summary>
244 /// <param name="folder">A folder containing the details of the new location</param> 247 /// <param name="folder">A folder containing the details of the new location</param>
245 /// <returns>true if the folder was successfully moved</returns> 248 /// <returns>true if the folder was successfully moved</returns>
246 public bool MoveFolder(InventoryFolderBase folder) 249 public override bool MoveFolder(InventoryFolderBase folder)
247 { 250 {
248 return m_InventoryService.MoveFolder(folder); 251 return m_InventoryService.MoveFolder(folder);
249 } 252 }
@@ -253,17 +256,18 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
253 /// </summary> 256 /// </summary>
254 /// <param name="folder"></param> 257 /// <param name="folder"></param>
255 /// <returns>true if the folder was successfully purged</returns> 258 /// <returns>true if the folder was successfully purged</returns>
256 public bool PurgeFolder(InventoryFolderBase folder) 259 public override bool PurgeFolder(InventoryFolderBase folder)
257 { 260 {
258 return m_InventoryService.PurgeFolder(folder); 261 return m_InventoryService.PurgeFolder(folder);
259 } 262 }
260 263
261 /// <summary> 264 /// <summary>
262 /// Add a new item to the user's inventory 265 /// Add a new item to the user's inventory, plain
266 /// Called by base class AddItem
263 /// </summary> 267 /// </summary>
264 /// <param name="item"></param> 268 /// <param name="item"></param>
265 /// <returns>true if the item was successfully added</returns> 269 /// <returns>true if the item was successfully added</returns>
266 public bool AddItem(InventoryItemBase item) 270 protected override bool AddItemPlain(InventoryItemBase item)
267 { 271 {
268 return m_InventoryService.AddItem(item); 272 return m_InventoryService.AddItem(item);
269 } 273 }
@@ -273,7 +277,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
273 /// </summary> 277 /// </summary>
274 /// <param name="item"></param> 278 /// <param name="item"></param>
275 /// <returns>true if the item was successfully updated</returns> 279 /// <returns>true if the item was successfully updated</returns>
276 public bool UpdateItem(InventoryItemBase item) 280 public override bool UpdateItem(InventoryItemBase item)
277 { 281 {
278 return m_InventoryService.UpdateItem(item); 282 return m_InventoryService.UpdateItem(item);
279 } 283 }
@@ -283,17 +287,17 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
283 /// </summary> 287 /// </summary>
284 /// <param name="item"></param> 288 /// <param name="item"></param>
285 /// <returns>true if the item was successfully deleted</returns> 289 /// <returns>true if the item was successfully deleted</returns>
286 public bool DeleteItem(InventoryItemBase item) 290 public override bool DeleteItem(InventoryItemBase item)
287 { 291 {
288 return m_InventoryService.DeleteItem(item); 292 return m_InventoryService.DeleteItem(item);
289 } 293 }
290 294
291 public InventoryItemBase QueryItem(InventoryItemBase item) 295 public override InventoryItemBase QueryItem(InventoryItemBase item)
292 { 296 {
293 return m_InventoryService.QueryItem(item); 297 return m_InventoryService.QueryItem(item);
294 } 298 }
295 299
296 public InventoryFolderBase QueryFolder(InventoryFolderBase folder) 300 public override InventoryFolderBase QueryFolder(InventoryFolderBase folder)
297 { 301 {
298 return m_InventoryService.QueryFolder(folder); 302 return m_InventoryService.QueryFolder(folder);
299 } 303 }
@@ -303,7 +307,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
303 /// </summary> 307 /// </summary>
304 /// <param name="userID"></param> 308 /// <param name="userID"></param>
305 /// <returns></returns> 309 /// <returns></returns>
306 public bool HasInventoryForUser(UUID userID) 310 public override bool HasInventoryForUser(UUID userID)
307 { 311 {
308 return m_InventoryService.HasInventoryForUser(userID); 312 return m_InventoryService.HasInventoryForUser(userID);
309 } 313 }
@@ -313,12 +317,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
313 /// </summary> 317 /// </summary>
314 /// <param name="userID"></param> 318 /// <param name="userID"></param>
315 /// <returns>null if no root folder was found</returns> 319 /// <returns>null if no root folder was found</returns>
316 public InventoryFolderBase GetRootFolder(UUID userID) 320 public override InventoryFolderBase GetRootFolder(UUID userID)
317 { 321 {
318 return m_InventoryService.GetRootFolder(userID); 322 return m_InventoryService.GetRootFolder(userID);
319 } 323 }
320 324
321 public List<InventoryItemBase> GetActiveGestures(UUID userId) 325 public override List<InventoryItemBase> GetActiveGestures(UUID userId)
322 { 326 {
323 return m_InventoryService.GetActiveGestures(userId); 327 return m_InventoryService.GetActiveGestures(userId);
324 } 328 }
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs
index dceda38..f87aab9 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs
@@ -40,7 +40,7 @@ using OpenMetaverse;
40 40
41namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory 41namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
42{ 42{
43 public class RemoteInventoryServicesConnector : InventoryCache, ISharedRegionModule, IInventoryService 43 public class RemoteInventoryServicesConnector : BaseInventoryConnector, ISharedRegionModule, IInventoryService
44 { 44 {
45 private static readonly ILog m_log = 45 private static readonly ILog m_log =
46 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 46 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@@ -102,7 +102,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
102 { 102 {
103 } 103 }
104 104
105 public override void AddRegion(Scene scene) 105 public void AddRegion(Scene scene)
106 { 106 {
107 if (!m_Enabled) 107 if (!m_Enabled)
108 return; 108 return;
@@ -117,12 +117,15 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
117 } 117 }
118 118
119 scene.RegisterModuleInterface<IInventoryService>(this); 119 scene.RegisterModuleInterface<IInventoryService>(this);
120 base.AddRegion(scene); 120 m_cache.AddRegion(scene);
121 } 121 }
122 122
123 public override void RemoveRegion(Scene scene) 123 public void RemoveRegion(Scene scene)
124 { 124 {
125 base.RemoveRegion(scene); 125 if (!m_Enabled)
126 return;
127
128 m_cache.RemoveRegion(scene);
126 } 129 }
127 130
128 public void RegionLoaded(Scene scene) 131 public void RegionLoaded(Scene scene)
@@ -138,22 +141,22 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
138 141
139 #region IInventoryService 142 #region IInventoryService
140 143
141 public bool CreateUserInventory(UUID user) 144 public override bool CreateUserInventory(UUID user)
142 { 145 {
143 return false; 146 return false;
144 } 147 }
145 148
146 public List<InventoryFolderBase> GetInventorySkeleton(UUID userId) 149 public override List<InventoryFolderBase> GetInventorySkeleton(UUID userId)
147 { 150 {
148 return new List<InventoryFolderBase>(); 151 return new List<InventoryFolderBase>();
149 } 152 }
150 153
151 public InventoryCollection GetUserInventory(UUID userID) 154 public override InventoryCollection GetUserInventory(UUID userID)
152 { 155 {
153 return null; 156 return null;
154 } 157 }
155 158
156 public void GetUserInventory(UUID userID, InventoryReceiptCallback callback) 159 public override void GetUserInventory(UUID userID, InventoryReceiptCallback callback)
157 { 160 {
158 UUID sessionID = GetSessionID(userID); 161 UUID sessionID = GetSessionID(userID);
159 try 162 try
@@ -180,7 +183,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
180 return m_RemoteConnector.GetSystemFolders(userID.ToString(), sessionID); 183 return m_RemoteConnector.GetSystemFolders(userID.ToString(), sessionID);
181 } 184 }
182 185
183 public InventoryCollection GetFolderContent(UUID userID, UUID folderID) 186 public override InventoryCollection GetFolderContent(UUID userID, UUID folderID)
184 { 187 {
185 UUID sessionID = GetSessionID(userID); 188 UUID sessionID = GetSessionID(userID);
186 try 189 try
@@ -199,12 +202,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
199 return nullCollection; 202 return nullCollection;
200 } 203 }
201 204
202 public List<InventoryItemBase> GetFolderItems(UUID userID, UUID folderID) 205 public override List<InventoryItemBase> GetFolderItems(UUID userID, UUID folderID)
203 { 206 {
204 return new List<InventoryItemBase>(); 207 return new List<InventoryItemBase>();
205 } 208 }
206 209
207 public bool AddFolder(InventoryFolderBase folder) 210 public override bool AddFolder(InventoryFolderBase folder)
208 { 211 {
209 if (folder == null) 212 if (folder == null)
210 return false; 213 return false;
@@ -213,7 +216,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
213 return m_RemoteConnector.AddFolder(folder.Owner.ToString(), folder, sessionID); 216 return m_RemoteConnector.AddFolder(folder.Owner.ToString(), folder, sessionID);
214 } 217 }
215 218
216 public bool UpdateFolder(InventoryFolderBase folder) 219 public override bool UpdateFolder(InventoryFolderBase folder)
217 { 220 {
218 if (folder == null) 221 if (folder == null)
219 return false; 222 return false;
@@ -222,7 +225,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
222 return m_RemoteConnector.UpdateFolder(folder.Owner.ToString(), folder, sessionID); 225 return m_RemoteConnector.UpdateFolder(folder.Owner.ToString(), folder, sessionID);
223 } 226 }
224 227
225 public bool MoveFolder(InventoryFolderBase folder) 228 public override bool MoveFolder(InventoryFolderBase folder)
226 { 229 {
227 if (folder == null) 230 if (folder == null)
228 return false; 231 return false;
@@ -231,7 +234,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
231 return m_RemoteConnector.MoveFolder(folder.Owner.ToString(), folder, sessionID); 234 return m_RemoteConnector.MoveFolder(folder.Owner.ToString(), folder, sessionID);
232 } 235 }
233 236
234 public bool PurgeFolder(InventoryFolderBase folder) 237 public override bool PurgeFolder(InventoryFolderBase folder)
235 { 238 {
236 if (folder == null) 239 if (folder == null)
237 return false; 240 return false;
@@ -240,7 +243,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
240 return m_RemoteConnector.PurgeFolder(folder.Owner.ToString(), folder, sessionID); 243 return m_RemoteConnector.PurgeFolder(folder.Owner.ToString(), folder, sessionID);
241 } 244 }
242 245
243 public bool AddItem(InventoryItemBase item) 246 // public bool AddItem(InventoryItemBase item) inherited
247 // Uses AddItemPlain
248
249 protected override bool AddItemPlain(InventoryItemBase item)
244 { 250 {
245 if (item == null) 251 if (item == null)
246 return false; 252 return false;
@@ -249,7 +255,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
249 return m_RemoteConnector.AddItem(item.Owner.ToString(), item, sessionID); 255 return m_RemoteConnector.AddItem(item.Owner.ToString(), item, sessionID);
250 } 256 }
251 257
252 public bool UpdateItem(InventoryItemBase item) 258 public override bool UpdateItem(InventoryItemBase item)
253 { 259 {
254 if (item == null) 260 if (item == null)
255 return false; 261 return false;
@@ -258,7 +264,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
258 return m_RemoteConnector.UpdateItem(item.Owner.ToString(), item, sessionID); 264 return m_RemoteConnector.UpdateItem(item.Owner.ToString(), item, sessionID);
259 } 265 }
260 266
261 public bool DeleteItem(InventoryItemBase item) 267 public override bool DeleteItem(InventoryItemBase item)
262 { 268 {
263 if (item == null) 269 if (item == null)
264 return false; 270 return false;
@@ -267,7 +273,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
267 return m_RemoteConnector.DeleteItem(item.Owner.ToString(), item, sessionID); 273 return m_RemoteConnector.DeleteItem(item.Owner.ToString(), item, sessionID);
268 } 274 }
269 275
270 public InventoryItemBase QueryItem(InventoryItemBase item) 276 public override InventoryItemBase QueryItem(InventoryItemBase item)
271 { 277 {
272 if (item == null) 278 if (item == null)
273 return null; 279 return null;
@@ -276,7 +282,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
276 return m_RemoteConnector.QueryItem(item.Owner.ToString(), item, sessionID); 282 return m_RemoteConnector.QueryItem(item.Owner.ToString(), item, sessionID);
277 } 283 }
278 284
279 public InventoryFolderBase QueryFolder(InventoryFolderBase folder) 285 public override InventoryFolderBase QueryFolder(InventoryFolderBase folder)
280 { 286 {
281 if (folder == null) 287 if (folder == null)
282 return null; 288 return null;
@@ -285,17 +291,17 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
285 return m_RemoteConnector.QueryFolder(folder.Owner.ToString(), folder, sessionID); 291 return m_RemoteConnector.QueryFolder(folder.Owner.ToString(), folder, sessionID);
286 } 292 }
287 293
288 public bool HasInventoryForUser(UUID userID) 294 public override bool HasInventoryForUser(UUID userID)
289 { 295 {
290 return false; 296 return false;
291 } 297 }
292 298
293 public InventoryFolderBase GetRootFolder(UUID userID) 299 public override InventoryFolderBase GetRootFolder(UUID userID)
294 { 300 {
295 return null; 301 return null;
296 } 302 }
297 303
298 public List<InventoryItemBase> GetActiveGestures(UUID userId) 304 public override List<InventoryItemBase> GetActiveGestures(UUID userId)
299 { 305 {
300 return new List<InventoryItemBase>(); 306 return new List<InventoryItemBase>();
301 } 307 }