aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/BaseInventoryConnector.cs179
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs52
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs9
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs52
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs52
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs31
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs6
7 files changed, 304 insertions, 77 deletions
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/BaseInventoryConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/BaseInventoryConnector.cs
new file mode 100644
index 0000000..f2b736c
--- /dev/null
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/BaseInventoryConnector.cs
@@ -0,0 +1,179 @@
1using System;
2using System.Collections.Generic;
3
4using OpenMetaverse;
5using Nini.Config;
6using log4net;
7
8using OpenSim.Framework;
9using OpenSim.Services.Interfaces;
10
11
12namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
13{
14 public abstract class BaseInventoryConnector : IInventoryService
15 {
16 protected InventoryCache m_cache;
17
18 protected virtual void Init(IConfigSource source)
19 {
20 m_cache = new InventoryCache();
21 m_cache.Init(source, this);
22 }
23
24 /// <summary>
25 /// Create the entire inventory for a given user
26 /// </summary>
27 /// <param name="user"></param>
28 /// <returns></returns>
29 public abstract bool CreateUserInventory(UUID user);
30
31 /// <summary>
32 /// Gets the skeleton of the inventory -- folders only
33 /// </summary>
34 /// <param name="userId"></param>
35 /// <returns></returns>
36 public abstract List<InventoryFolderBase> GetInventorySkeleton(UUID userId);
37
38 /// <summary>
39 /// Synchronous inventory fetch.
40 /// </summary>
41 /// <param name="userID"></param>
42 /// <returns></returns>
43 public abstract InventoryCollection GetUserInventory(UUID userID);
44
45 /// <summary>
46 /// Request the inventory for a user. This is an asynchronous operation that will call the callback when the
47 /// inventory has been received
48 /// </summary>
49 /// <param name="userID"></param>
50 /// <param name="callback"></param>
51 public abstract void GetUserInventory(UUID userID, InventoryReceiptCallback callback);
52
53 /// <summary>
54 /// Retrieve the root inventory folder for the given user.
55 /// </summary>
56 /// <param name="userID"></param>
57 /// <returns>null if no root folder was found</returns>
58 public abstract InventoryFolderBase GetRootFolder(UUID userID);
59
60 public abstract Dictionary<AssetType, InventoryFolderBase> GetSystemFolders(UUID userID);
61
62 /// <summary>
63 /// Gets the user folder for the given folder-type
64 /// </summary>
65 /// <param name="userID"></param>
66 /// <param name="type"></param>
67 /// <returns></returns>
68 public InventoryFolderBase GetFolderForType(UUID userID, AssetType type)
69 {
70 return m_cache.GetFolderForType(userID, type);
71 }
72
73 /// <summary>
74 /// Gets everything (folders and items) inside a folder
75 /// </summary>
76 /// <param name="userId"></param>
77 /// <param name="folderID"></param>
78 /// <returns></returns>
79 public abstract InventoryCollection GetFolderContent(UUID userID, UUID folderID);
80
81 /// <summary>
82 /// Gets the items inside a folder
83 /// </summary>
84 /// <param name="userID"></param>
85 /// <param name="folderID"></param>
86 /// <returns></returns>
87 public abstract List<InventoryItemBase> GetFolderItems(UUID userID, UUID folderID);
88
89 /// <summary>
90 /// Add a new folder to the user's inventory
91 /// </summary>
92 /// <param name="folder"></param>
93 /// <returns>true if the folder was successfully added</returns>
94 public abstract bool AddFolder(InventoryFolderBase folder);
95
96 /// <summary>
97 /// Update a folder in the user's inventory
98 /// </summary>
99 /// <param name="folder"></param>
100 /// <returns>true if the folder was successfully updated</returns>
101 public abstract bool UpdateFolder(InventoryFolderBase folder);
102
103 /// <summary>
104 /// Move an inventory folder to a new location
105 /// </summary>
106 /// <param name="folder">A folder containing the details of the new location</param>
107 /// <returns>true if the folder was successfully moved</returns>
108 public abstract bool MoveFolder(InventoryFolderBase folder);
109
110 /// <summary>
111 /// Purge an inventory folder of all its items and subfolders.
112 /// </summary>
113 /// <param name="folder"></param>
114 /// <returns>true if the folder was successfully purged</returns>
115 public abstract bool PurgeFolder(InventoryFolderBase folder);
116
117 /// <summary>
118 /// Add a new item to the user's inventory.
119 /// If the given item has to parent folder, it tries to find the most
120 /// suitable folder for it.
121 /// </summary>
122 /// <param name="item"></param>
123 /// <returns>true if the item was successfully added</returns>
124 public bool AddItem(InventoryItemBase item)
125 {
126 if (item.Folder == UUID.Zero)
127 {
128 InventoryFolderBase f = GetFolderForType(item.Owner, (AssetType)item.AssetType);
129 if (f != null)
130 item.Folder = f.ID;
131 else
132 {
133 f = GetRootFolder(item.Owner);
134 if (f != null)
135 item.Folder = f.ID;
136 else
137 return false;
138 }
139 }
140
141 return AddItemPlain(item);
142 }
143
144 protected abstract bool AddItemPlain(InventoryItemBase item);
145
146 /// <summary>
147 /// Update an item in the user's inventory
148 /// </summary>
149 /// <param name="item"></param>
150 /// <returns>true if the item was successfully updated</returns>
151 public abstract bool UpdateItem(InventoryItemBase item);
152
153 /// <summary>
154 /// Delete an item from the user's inventory
155 /// </summary>
156 /// <param name="item"></param>
157 /// <returns>true if the item was successfully deleted</returns>
158 public abstract bool DeleteItem(InventoryItemBase item);
159
160 public abstract InventoryItemBase QueryItem(InventoryItemBase item);
161
162 public abstract InventoryFolderBase QueryFolder(InventoryFolderBase folder);
163
164 /// <summary>
165 /// Does the given user have an inventory structure?
166 /// </summary>
167 /// <param name="userID"></param>
168 /// <returns></returns>
169 public abstract bool HasInventoryForUser(UUID userID);
170
171 /// <summary>
172 /// Get the active gestures of the agent.
173 /// </summary>
174 /// <param name="userId"></param>
175 /// <returns></returns>
176 public abstract List<InventoryItemBase> GetActiveGestures(UUID userId);
177
178 }
179}
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 3afaba5..551a7eb 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs
@@ -12,21 +12,23 @@ using log4net;
12 12
13namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory 13namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
14{ 14{
15 public abstract class InventoryCache 15 public class InventoryCache
16 { 16 {
17 private static readonly ILog m_log = 17 private static readonly ILog m_log =
18 LogManager.GetLogger( 18 LogManager.GetLogger(
19 MethodBase.GetCurrentMethod().DeclaringType); 19 MethodBase.GetCurrentMethod().DeclaringType);
20 20
21 protected BaseInventoryConnector m_Connector;
21 protected List<Scene> m_Scenes; 22 protected List<Scene> m_Scenes;
22 23
23 // The cache proper 24 // The cache proper
24 protected Dictionary<UUID, Dictionary<AssetType, InventoryFolderBase>> m_InventoryCache; 25 protected Dictionary<UUID, Dictionary<AssetType, InventoryFolderBase>> m_InventoryCache;
25 26
26 protected virtual void Init(IConfigSource source) 27 public virtual void Init(IConfigSource source, BaseInventoryConnector connector)
27 { 28 {
28 m_Scenes = new List<Scene>(); 29 m_Scenes = new List<Scene>();
29 m_InventoryCache = new Dictionary<UUID, Dictionary<AssetType, InventoryFolderBase>>(); 30 m_InventoryCache = new Dictionary<UUID, Dictionary<AssetType, InventoryFolderBase>>();
31 m_Connector = connector;
30 } 32 }
31 33
32 public virtual void AddRegion(Scene scene) 34 public virtual void AddRegion(Scene scene)
@@ -59,7 +61,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
59 } 61 }
60 62
61 // If not, go get them and place them in the cache 63 // If not, go get them and place them in the cache
62 Dictionary<AssetType, InventoryFolderBase> folders = GetSystemFolders(presence.UUID); 64 Dictionary<AssetType, InventoryFolderBase> folders = m_Connector.GetSystemFolders(presence.UUID);
63 m_log.DebugFormat("[INVENTORY CACHE]: OnMakeRootAgent in {0}, fetched system folders for {1} {2}: count {3}", 65 m_log.DebugFormat("[INVENTORY CACHE]: OnMakeRootAgent in {0}, fetched system folders for {1} {2}: count {3}",
64 presence.Scene.RegionInfo.RegionName, presence.Firstname, presence.Lastname, folders.Count); 66 presence.Scene.RegionInfo.RegionName, presence.Firstname, presence.Lastname, folders.Count);
65 if (folders.Count > 0) 67 if (folders.Count > 0)
@@ -95,7 +97,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
95 } 97 }
96 } 98 }
97 99
98 public abstract Dictionary<AssetType, InventoryFolderBase> GetSystemFolders(UUID userID);
99 100
100 public InventoryFolderBase GetFolderForType(UUID userID, AssetType type) 101 public InventoryFolderBase GetFolderForType(UUID userID, AssetType type)
101 { 102 {
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 }
diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
index 9251aa6..113918d 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
@@ -622,8 +622,26 @@ namespace OpenSim.Region.Framework.Scenes
622 "[AGENT INVENTORY]: Failed to move folder {0} to {1} for user {2}", 622 "[AGENT INVENTORY]: Failed to move folder {0} to {1} for user {2}",
623 folderID, parentID, remoteClient.Name); 623 folderID, parentID, remoteClient.Name);
624 } 624 }
625 }
626
627 public void HandleMoveInventoryFolder2(IClientAPI remoteClient, UUID folderID, UUID parentID)
628 {
629 InventoryFolderBase folder = new InventoryFolderBase(folderID);
630 folder = InventoryService.QueryFolder(folder);
631 if (folder != null)
632 {
633 folder.ParentID = parentID;
634 if (!InventoryService.MoveFolder(folder))
635 m_log.WarnFormat("[AGENT INVENTORY]: could not move folder {0}", folderID);
636 else
637 m_log.DebugFormat("[AGENT INVENTORY]: folder {0} moved to parent {1}", folderID, parentID);
638 }
639 else
640 {
641 m_log.WarnFormat("[AGENT INVENTORY]: request to move folder {0} but folder not found", folderID);
642 }
625 } 643 }
626 644
627 /// <summary> 645 /// <summary>
628 /// This should delete all the items and folders in the given directory. 646 /// This should delete all the items and folders in the given directory.
629 /// </summary> 647 /// </summary>
@@ -647,6 +665,17 @@ namespace OpenSim.Region.Framework.Scenes
647 "[AGENT INVENTORY]: Failed to purge folder for user {0} {1}", 665 "[AGENT INVENTORY]: Failed to purge folder for user {0} {1}",
648 remoteClient.Name, remoteClient.AgentId); 666 remoteClient.Name, remoteClient.AgentId);
649 } 667 }
668 }
669
670 public void HandlePurgeInventoryDescendents2(IClientAPI remoteClient, UUID folderID)
671 {
672 InventoryFolderBase folder = new InventoryFolderBase(folderID);
673
674 if (InventoryService.PurgeFolder(folder))
675 m_log.DebugFormat("[AGENT INVENTORY]: folder {0} purged successfully", folderID);
676 else
677 m_log.WarnFormat("[AGENT INVENTORY]: could not purge folder {0}", folderID);
650 } 678 }
679
651 } 680 }
652} 681}
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 7f1936e..919075c 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -2019,12 +2019,13 @@ namespace OpenSim.Region.Framework.Scenes
2019 client.OnUpdatePrimFlags += m_sceneGraph.UpdatePrimFlags; 2019 client.OnUpdatePrimFlags += m_sceneGraph.UpdatePrimFlags;
2020 client.OnRequestObjectPropertiesFamily += m_sceneGraph.RequestObjectPropertiesFamily; 2020 client.OnRequestObjectPropertiesFamily += m_sceneGraph.RequestObjectPropertiesFamily;
2021 client.OnObjectPermissions += HandleObjectPermissionsUpdate; 2021 client.OnObjectPermissions += HandleObjectPermissionsUpdate;
2022
2022 client.OnCreateNewInventoryItem += CreateNewInventoryItem; 2023 client.OnCreateNewInventoryItem += CreateNewInventoryItem;
2023 client.OnCreateNewInventoryFolder += HandleCreateInventoryFolder; 2024 client.OnCreateNewInventoryFolder += HandleCreateInventoryFolder;
2024 client.OnUpdateInventoryFolder += HandleUpdateInventoryFolder; 2025 client.OnUpdateInventoryFolder += HandleUpdateInventoryFolder;
2025 client.OnMoveInventoryFolder += HandleMoveInventoryFolder; 2026 client.OnMoveInventoryFolder += HandleMoveInventoryFolder; // 2; //!!
2026 client.OnFetchInventoryDescendents += HandleFetchInventoryDescendents; 2027 client.OnFetchInventoryDescendents += HandleFetchInventoryDescendents;
2027 client.OnPurgeInventoryDescendents += HandlePurgeInventoryDescendents; 2028 client.OnPurgeInventoryDescendents += HandlePurgeInventoryDescendents; // 2; //!!
2028 client.OnFetchInventory += HandleFetchInventory; 2029 client.OnFetchInventory += HandleFetchInventory;
2029 client.OnUpdateInventoryItem += UpdateInventoryItemAsset; 2030 client.OnUpdateInventoryItem += UpdateInventoryItemAsset;
2030 client.OnCopyInventoryItem += CopyInventoryItem; 2031 client.OnCopyInventoryItem += CopyInventoryItem;
@@ -2036,6 +2037,7 @@ namespace OpenSim.Region.Framework.Scenes
2036 client.OnRemoveTaskItem += RemoveTaskInventory; 2037 client.OnRemoveTaskItem += RemoveTaskInventory;
2037 client.OnUpdateTaskInventory += UpdateTaskInventory; 2038 client.OnUpdateTaskInventory += UpdateTaskInventory;
2038 client.OnMoveTaskItem += ClientMoveTaskInventoryItem; 2039 client.OnMoveTaskItem += ClientMoveTaskInventoryItem;
2040
2039 client.OnGrabObject += ProcessObjectGrab; 2041 client.OnGrabObject += ProcessObjectGrab;
2040 client.OnDeGrabObject += ProcessObjectDeGrab; 2042 client.OnDeGrabObject += ProcessObjectDeGrab;
2041 client.OnMoneyTransferRequest += ProcessMoneyTransferRequest; 2043 client.OnMoneyTransferRequest += ProcessMoneyTransferRequest;