diff options
author | Diva Canto | 2009-08-11 10:30:03 -0700 |
---|---|---|
committer | Diva Canto | 2009-08-11 10:30:03 -0700 |
commit | 31419a70ce05e7db0c54f4c4ec827a0d1fe23402 (patch) | |
tree | 28687ede5c6f8fac8048ecce7a1a11ab30c7504f /OpenSim | |
parent | Added two new methods to IIventoryService -- GetFolderForType and GetFolderCo... (diff) | |
download | opensim-SC_OLD-31419a70ce05e7db0c54f4c4ec827a0d1fe23402.zip opensim-SC_OLD-31419a70ce05e7db0c54f4c4ec827a0d1fe23402.tar.gz opensim-SC_OLD-31419a70ce05e7db0c54f4c4ec827a0d1fe23402.tar.bz2 opensim-SC_OLD-31419a70ce05e7db0c54f4c4ec827a0d1fe23402.tar.xz |
System folders inventory cache added to OUT inventory modules. This tracks agents in and out of *sims* in order to fetch/drop their system folders from the cache. Also added region-side support for fetching the system folders from the inventory service. Nothing of this is called yet.
Diffstat (limited to 'OpenSim')
8 files changed, 233 insertions, 43 deletions
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs index f5e6824..1562172 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 | ||
42 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | 42 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory |
43 | { | 43 | { |
44 | public class HGInventoryBroker : ISharedRegionModule, IInventoryService | 44 | public class HGInventoryBroker : InventoryCache, ISharedRegionModule, IInventoryService |
45 | { | 45 | { |
46 | private static readonly ILog m_log = | 46 | private static readonly ILog m_log = |
47 | LogManager.GetLogger( | 47 | LogManager.GetLogger( |
@@ -122,6 +122,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
122 | 122 | ||
123 | m_LocalGridInventoryURI = inventoryConfig.GetString("InventoryServerURI", string.Empty); | 123 | m_LocalGridInventoryURI = inventoryConfig.GetString("InventoryServerURI", string.Empty); |
124 | 124 | ||
125 | Init(source); | ||
126 | |||
125 | m_Enabled = true; | 127 | m_Enabled = true; |
126 | m_log.Info("[HG INVENTORY CONNECTOR]: HG inventory broker enabled"); | 128 | m_log.Info("[HG INVENTORY CONNECTOR]: HG inventory broker enabled"); |
127 | } | 129 | } |
@@ -136,7 +138,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
136 | { | 138 | { |
137 | } | 139 | } |
138 | 140 | ||
139 | public void AddRegion(Scene scene) | 141 | public override void AddRegion(Scene scene) |
140 | { | 142 | { |
141 | if (!m_Enabled) | 143 | if (!m_Enabled) |
142 | return; | 144 | return; |
@@ -154,10 +156,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
154 | } | 156 | } |
155 | 157 | ||
156 | scene.RegisterModuleInterface<IInventoryService>(this); | 158 | scene.RegisterModuleInterface<IInventoryService>(this); |
159 | base.AddRegion(scene); | ||
157 | } | 160 | } |
158 | 161 | ||
159 | public void RemoveRegion(Scene scene) | 162 | public override void RemoveRegion(Scene scene) |
160 | { | 163 | { |
164 | base.RemoveRegion(scene); | ||
161 | } | 165 | } |
162 | 166 | ||
163 | public void RegionLoaded(Scene scene) | 167 | public void RegionLoaded(Scene scene) |
@@ -165,7 +169,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
165 | if (!m_Enabled) | 169 | if (!m_Enabled) |
166 | return; | 170 | return; |
167 | 171 | ||
168 | m_log.InfoFormat("[INVENTORY CONNECTOR]: Enabled HG inventory for region {0}", scene.RegionInfo.RegionName); | 172 | m_log.InfoFormat("[HG INVENTORY CONNECTOR]: Enabled HG inventory for region {0}", scene.RegionInfo.RegionName); |
169 | 173 | ||
170 | } | 174 | } |
171 | 175 | ||
@@ -201,32 +205,72 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
201 | } | 205 | } |
202 | } | 206 | } |
203 | 207 | ||
204 | public InventoryFolderBase GetFolderForType(UUID userID, AssetType type) | 208 | // Inherited. See base |
209 | //public override InventoryFolderBase GetFolderForType(UUID userID, AssetType type) | ||
210 | //{ | ||
211 | // if (IsLocalGridUser(userID)) | ||
212 | // return m_GridService.GetFolderForType(userID, type); | ||
213 | // else | ||
214 | // { | ||
215 | // UUID sessionID = GetSessionID(userID); | ||
216 | // string uri = GetUserInventoryURI(userID) + "/" + userID.ToString(); | ||
217 | // // !!!!!! | ||
218 | // return null; | ||
219 | // //return m_HGService.GetFolderForType(uri, sessionID, type); | ||
220 | // } | ||
221 | //} | ||
222 | |||
223 | public InventoryCollection GetFolderContent(UUID userID, UUID folderID) | ||
205 | { | 224 | { |
206 | if (IsLocalGridUser(userID)) | 225 | if (IsLocalGridUser(userID)) |
207 | return m_GridService.GetFolderForType(userID, type); | 226 | return m_GridService.GetFolderContent(userID, folderID); |
208 | else | 227 | else |
209 | { | 228 | { |
210 | UUID sessionID = GetSessionID(userID); | 229 | UUID sessionID = GetSessionID(userID); |
211 | string uri = GetUserInventoryURI(userID) + "/" + userID.ToString(); | 230 | string uri = GetUserInventoryURI(userID) + "/" + userID.ToString(); |
212 | // !!!!!! | 231 | return m_HGService.GetFolderContent(uri, folderID, sessionID); |
213 | return null; | ||
214 | //return m_HGService.GetFolderForType(uri, sessionID, type); | ||
215 | } | 232 | } |
216 | } | 233 | } |
217 | 234 | ||
218 | public InventoryCollection GetFolderContent(UUID userID, UUID folderID) | 235 | public override Dictionary<AssetType, InventoryFolderBase> GetSystemFolders(UUID userID) |
219 | { | 236 | { |
220 | if (IsLocalGridUser(userID)) | 237 | if (IsLocalGridUser(userID)) |
221 | return m_GridService.GetFolderContent(userID, folderID); | 238 | return GetSystemFoldersLocal(userID); |
222 | else | 239 | else |
223 | { | 240 | { |
224 | UUID sessionID = GetSessionID(userID); | 241 | UUID sessionID = GetSessionID(userID); |
225 | string uri = GetUserInventoryURI(userID) + "/" + userID.ToString(); | 242 | string uri = GetUserInventoryURI(userID) + "/" + userID.ToString(); |
226 | return m_HGService.GetFolderContent(uri, folderID, sessionID); | 243 | return m_HGService.GetSystemFolders(uri, sessionID); |
227 | } | 244 | } |
228 | } | 245 | } |
229 | 246 | ||
247 | private Dictionary<AssetType, InventoryFolderBase> GetSystemFoldersLocal(UUID userID) | ||
248 | { | ||
249 | InventoryFolderBase root = m_GridService.GetRootFolder(userID); | ||
250 | if (root != null) | ||
251 | { | ||
252 | InventoryCollection content = m_GridService.GetFolderContent(userID, root.ID); | ||
253 | if (content != null) | ||
254 | { | ||
255 | Dictionary<AssetType, InventoryFolderBase> folders = new Dictionary<AssetType, InventoryFolderBase>(); | ||
256 | m_log.DebugFormat("[HG INVENTORY CONNECTOR]: System folders count for {0}: {1}", userID, folders.Count); | ||
257 | foreach (InventoryFolderBase folder in content.Folders) | ||
258 | { | ||
259 | m_log.DebugFormat("[HG INVENTORY CONNECTOR]: scanning folder type {0}", (AssetType)folder.Type); | ||
260 | if (folder.Type != (short)AssetType.Folder) | ||
261 | folders[(AssetType)folder.Type] = folder; | ||
262 | } | ||
263 | return folders; | ||
264 | } | ||
265 | m_log.DebugFormat("[HG INVENTORY CONNECTOR]: Root folder content not found for {0}", userID); | ||
266 | |||
267 | } | ||
268 | |||
269 | m_log.DebugFormat("[HG INVENTORY CONNECTOR]: Root folder not found for {0}", userID); | ||
270 | |||
271 | return new Dictionary<AssetType, InventoryFolderBase>(); | ||
272 | } | ||
273 | |||
230 | public List<InventoryItemBase> GetFolderItems(UUID userID, UUID folderID) | 274 | public List<InventoryItemBase> GetFolderItems(UUID userID, UUID folderID) |
231 | { | 275 | { |
232 | return new List<InventoryItemBase>(); | 276 | return new List<InventoryItemBase>(); |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs new file mode 100644 index 0000000..57c2091 --- /dev/null +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs | |||
@@ -0,0 +1,108 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Reflection; | ||
4 | |||
5 | using OpenSim.Framework; | ||
6 | using OpenSim.Framework.Client; | ||
7 | using OpenSim.Region.Framework.Scenes; | ||
8 | |||
9 | using OpenMetaverse; | ||
10 | using Nini.Config; | ||
11 | using log4net; | ||
12 | |||
13 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | ||
14 | { | ||
15 | public abstract class InventoryCache | ||
16 | { | ||
17 | private static readonly ILog m_log = | ||
18 | LogManager.GetLogger( | ||
19 | MethodBase.GetCurrentMethod().DeclaringType); | ||
20 | |||
21 | protected List<Scene> m_Scenes; | ||
22 | |||
23 | // The cache proper | ||
24 | protected Dictionary<UUID, Dictionary<AssetType, InventoryFolderBase>> m_InventoryCache; | ||
25 | |||
26 | protected virtual void Init(IConfigSource source) | ||
27 | { | ||
28 | m_Scenes = new List<Scene>(); | ||
29 | m_InventoryCache = new Dictionary<UUID, Dictionary<AssetType, InventoryFolderBase>>(); | ||
30 | } | ||
31 | |||
32 | public virtual void AddRegion(Scene scene) | ||
33 | { | ||
34 | m_Scenes.Add(scene); | ||
35 | scene.EventManager.OnMakeRootAgent += OnMakeRootAgent; | ||
36 | scene.EventManager.OnClientClosed += OnClientClosed; | ||
37 | } | ||
38 | |||
39 | public virtual void RemoveRegion(Scene scene) | ||
40 | { | ||
41 | if ((m_Scenes != null) && m_Scenes.Contains(scene)) | ||
42 | { | ||
43 | m_Scenes.Remove(scene); | ||
44 | } | ||
45 | } | ||
46 | |||
47 | void OnMakeRootAgent(ScenePresence presence) | ||
48 | { | ||
49 | // Get system folders | ||
50 | |||
51 | // First check if they're here already | ||
52 | lock (m_InventoryCache) | ||
53 | { | ||
54 | if (m_InventoryCache.ContainsKey(presence.UUID)) | ||
55 | { | ||
56 | m_log.DebugFormat("[INVENTORY CACHE]: OnMakeRootAgent, system folders for {0} {1} already in cache", presence.Firstname, presence.Lastname); | ||
57 | return; | ||
58 | } | ||
59 | } | ||
60 | |||
61 | // If not, go get them and place them in the cache | ||
62 | Dictionary<AssetType, InventoryFolderBase> folders = GetSystemFolders(presence.UUID); | ||
63 | m_log.DebugFormat("[INVENTORY CACHE]: OnMakeRootAgent, fetched system folders for {0} {1}: count {2}", | ||
64 | presence.Firstname, presence.Lastname, folders.Count); | ||
65 | if (folders.Count > 0) | ||
66 | lock (m_InventoryCache) | ||
67 | m_InventoryCache.Add(presence.UUID, folders); | ||
68 | } | ||
69 | |||
70 | void OnClientClosed(UUID clientID, Scene scene) | ||
71 | { | ||
72 | ScenePresence sp = null; | ||
73 | foreach (Scene s in m_Scenes) | ||
74 | { | ||
75 | s.TryGetAvatar(clientID, out sp); | ||
76 | if (sp != null) | ||
77 | { | ||
78 | m_log.DebugFormat("[INVENTORY CACHE]: OnClientClosed, but user {0} still in sim. Keeping system folders in cache", clientID); | ||
79 | return; | ||
80 | } | ||
81 | } | ||
82 | |||
83 | m_log.DebugFormat("[INVENTORY CACHE]: OnClientClosed, user {0} out of sim. Dropping system folders", clientID); | ||
84 | // Drop system folders | ||
85 | lock (m_InventoryCache) | ||
86 | if (m_InventoryCache.ContainsKey(clientID)) | ||
87 | m_InventoryCache.Remove(clientID); | ||
88 | |||
89 | } | ||
90 | |||
91 | public abstract Dictionary<AssetType, InventoryFolderBase> GetSystemFolders(UUID userID); | ||
92 | |||
93 | public InventoryFolderBase GetFolderForType(UUID userID, AssetType type) | ||
94 | { | ||
95 | Dictionary<AssetType, InventoryFolderBase> folders = null; | ||
96 | lock (m_InventoryCache) | ||
97 | { | ||
98 | m_InventoryCache.TryGetValue(userID, out folders); | ||
99 | } | ||
100 | if ((folders != null) && folders.ContainsKey(type)) | ||
101 | { | ||
102 | return folders[type]; | ||
103 | } | ||
104 | |||
105 | return null; | ||
106 | } | ||
107 | } | ||
108 | } | ||
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs index bab0044..5c52897f 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 | ||
42 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | 42 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory |
43 | { | 43 | { |
44 | public class LocalInventoryServicesConnector : ISharedRegionModule, IInventoryService | 44 | public class LocalInventoryServicesConnector : InventoryCache, ISharedRegionModule, IInventoryService |
45 | { | 45 | { |
46 | private static readonly ILog m_log = | 46 | private static readonly ILog m_log = |
47 | LogManager.GetLogger( | 47 | LogManager.GetLogger( |
@@ -108,6 +108,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
108 | // m_InventoryService.AddPlugin(new OspInventoryWrapperPlugin(plugin, this)); | 108 | // m_InventoryService.AddPlugin(new OspInventoryWrapperPlugin(plugin, this)); |
109 | //} | 109 | //} |
110 | 110 | ||
111 | Init(source); | ||
112 | |||
111 | m_Enabled = true; | 113 | m_Enabled = true; |
112 | m_log.Info("[INVENTORY CONNECTOR]: Local inventory connector enabled"); | 114 | m_log.Info("[INVENTORY CONNECTOR]: Local inventory connector enabled"); |
113 | } | 115 | } |
@@ -122,7 +124,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
122 | { | 124 | { |
123 | } | 125 | } |
124 | 126 | ||
125 | public void AddRegion(Scene scene) | 127 | public override void AddRegion(Scene scene) |
126 | { | 128 | { |
127 | if (!m_Enabled) | 129 | if (!m_Enabled) |
128 | return; | 130 | return; |
@@ -139,10 +141,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
139 | // "[INVENTORY CONNECTOR]: Registering IInventoryService to scene {0}", scene.RegionInfo.RegionName); | 141 | // "[INVENTORY CONNECTOR]: Registering IInventoryService to scene {0}", scene.RegionInfo.RegionName); |
140 | 142 | ||
141 | scene.RegisterModuleInterface<IInventoryService>(this); | 143 | scene.RegisterModuleInterface<IInventoryService>(this); |
144 | base.AddRegion(scene); | ||
142 | } | 145 | } |
143 | 146 | ||
144 | public void RemoveRegion(Scene scene) | 147 | public override void RemoveRegion(Scene scene) |
145 | { | 148 | { |
149 | base.RemoveRegion(scene); | ||
146 | } | 150 | } |
147 | 151 | ||
148 | public void RegionLoaded(Scene scene) | 152 | public void RegionLoaded(Scene scene) |
@@ -176,9 +180,30 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
176 | m_InventoryService.GetUserInventory(userID, callback); | 180 | m_InventoryService.GetUserInventory(userID, callback); |
177 | } | 181 | } |
178 | 182 | ||
179 | public InventoryFolderBase GetFolderForType(UUID userID, AssetType type) | 183 | // Inherited. See base |
184 | //public InventoryFolderBase GetFolderForType(UUID userID, AssetType type) | ||
185 | //{ | ||
186 | // return m_InventoryService.GetFolderForType(userID, type); | ||
187 | //} | ||
188 | |||
189 | public override Dictionary<AssetType, InventoryFolderBase> GetSystemFolders(UUID userID) | ||
180 | { | 190 | { |
181 | return m_InventoryService.GetFolderForType(userID, type); | 191 | InventoryFolderBase root = GetRootFolder(userID); |
192 | if (root != null) | ||
193 | { | ||
194 | InventoryCollection content = GetFolderContent(userID, root.ID); | ||
195 | if (content != null) | ||
196 | { | ||
197 | Dictionary<AssetType, InventoryFolderBase> folders = new Dictionary<AssetType, InventoryFolderBase>(); | ||
198 | foreach (InventoryFolderBase folder in content.Folders) | ||
199 | { | ||
200 | if (folder.Type != (short)AssetType.Folder) | ||
201 | folders[(AssetType)folder.Type] = folder; | ||
202 | } | ||
203 | return folders; | ||
204 | } | ||
205 | } | ||
206 | return new Dictionary<AssetType, InventoryFolderBase>(); | ||
182 | } | 207 | } |
183 | 208 | ||
184 | public InventoryCollection GetFolderContent(UUID userID, UUID folderID) | 209 | public InventoryCollection GetFolderContent(UUID userID, UUID folderID) |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs index 2064558..dceda38 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 | ||
41 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | 41 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory |
42 | { | 42 | { |
43 | public class RemoteInventoryServicesConnector : ISharedRegionModule, IInventoryService | 43 | public class RemoteInventoryServicesConnector : InventoryCache, 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); |
@@ -69,9 +69,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
69 | Init(source); | 69 | Init(source); |
70 | } | 70 | } |
71 | 71 | ||
72 | private void Init(IConfigSource source) | 72 | protected override void Init(IConfigSource source) |
73 | { | 73 | { |
74 | m_RemoteConnector = new InventoryServicesConnector(source); | 74 | m_RemoteConnector = new InventoryServicesConnector(source); |
75 | base.Init(source); | ||
75 | } | 76 | } |
76 | 77 | ||
77 | 78 | ||
@@ -101,7 +102,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
101 | { | 102 | { |
102 | } | 103 | } |
103 | 104 | ||
104 | public void AddRegion(Scene scene) | 105 | public override void AddRegion(Scene scene) |
105 | { | 106 | { |
106 | if (!m_Enabled) | 107 | if (!m_Enabled) |
107 | return; | 108 | return; |
@@ -116,10 +117,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
116 | } | 117 | } |
117 | 118 | ||
118 | scene.RegisterModuleInterface<IInventoryService>(this); | 119 | scene.RegisterModuleInterface<IInventoryService>(this); |
120 | base.AddRegion(scene); | ||
119 | } | 121 | } |
120 | 122 | ||
121 | public void RemoveRegion(Scene scene) | 123 | public override void RemoveRegion(Scene scene) |
122 | { | 124 | { |
125 | base.RemoveRegion(scene); | ||
123 | } | 126 | } |
124 | 127 | ||
125 | public void RegionLoaded(Scene scene) | 128 | public void RegionLoaded(Scene scene) |
@@ -168,23 +171,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
168 | 171 | ||
169 | } | 172 | } |
170 | 173 | ||
171 | public InventoryFolderBase GetFolderForType(UUID userID, AssetType type) | 174 | // inherited. See base class |
172 | { | 175 | // public InventoryFolderBase GetFolderForType(UUID userID, AssetType type) |
173 | //UUID sessionID = GetSessionID(userID); | ||
174 | //List<InventoryFolderBase> sysFolders; | ||
175 | //try | ||
176 | //{ | ||
177 | // sysFolders = m_RemoteConnector.GetSystemFolders(userID.ToString(), sessionID); | ||
178 | //} | ||
179 | //catch (Exception e) | ||
180 | //{ | ||
181 | // m_log.ErrorFormat("[INVENTORY CONNECTOR]: GetFolderForType operation failed, {0} {1}", | ||
182 | // e.Source, e.Message); | ||
183 | //} | ||
184 | |||
185 | // PLACEHOLDER UNTIL CACHE IS DONE | ||
186 | return null; | ||
187 | 176 | ||
177 | public override Dictionary<AssetType, InventoryFolderBase> GetSystemFolders(UUID userID) | ||
178 | { | ||
179 | UUID sessionID = GetSessionID(userID); | ||
180 | return m_RemoteConnector.GetSystemFolders(userID.ToString(), sessionID); | ||
188 | } | 181 | } |
189 | 182 | ||
190 | public InventoryCollection GetFolderContent(UUID userID, UUID folderID) | 183 | public InventoryCollection GetFolderContent(UUID userID, UUID folderID) |
diff --git a/OpenSim/Services/Connectors/Inventory/HGInventoryServiceConnector.cs b/OpenSim/Services/Connectors/Inventory/HGInventoryServiceConnector.cs index b168871..f6d1500 100644 --- a/OpenSim/Services/Connectors/Inventory/HGInventoryServiceConnector.cs +++ b/OpenSim/Services/Connectors/Inventory/HGInventoryServiceConnector.cs | |||
@@ -126,7 +126,7 @@ namespace OpenSim.Services.Connectors.Inventory | |||
126 | /// <param name="userID"></param> | 126 | /// <param name="userID"></param> |
127 | /// <param name="type"></param> | 127 | /// <param name="type"></param> |
128 | /// <returns></returns> | 128 | /// <returns></returns> |
129 | public List<InventoryFolderBase> GetSystemFolders(string id, UUID sessionID) | 129 | public Dictionary<AssetType, InventoryFolderBase> GetSystemFolders(string id, UUID sessionID) |
130 | { | 130 | { |
131 | m_log.Debug("[HGInventory]: GetSystemFolders " + id); | 131 | m_log.Debug("[HGInventory]: GetSystemFolders " + id); |
132 | string url = string.Empty; | 132 | string url = string.Empty; |
@@ -138,7 +138,7 @@ namespace OpenSim.Services.Connectors.Inventory | |||
138 | return connector.GetSystemFolders(userID, sessionID); | 138 | return connector.GetSystemFolders(userID, sessionID); |
139 | } | 139 | } |
140 | 140 | ||
141 | return new List<InventoryFolderBase>(); | 141 | return new Dictionary<AssetType, InventoryFolderBase>(); |
142 | } | 142 | } |
143 | 143 | ||
144 | /// <summary> | 144 | /// <summary> |
diff --git a/OpenSim/Services/Connectors/Inventory/ISessionAuthInventoryService.cs b/OpenSim/Services/Connectors/Inventory/ISessionAuthInventoryService.cs index 98fd680..973cb0a 100644 --- a/OpenSim/Services/Connectors/Inventory/ISessionAuthInventoryService.cs +++ b/OpenSim/Services/Connectors/Inventory/ISessionAuthInventoryService.cs | |||
@@ -57,7 +57,7 @@ namespace OpenSim.Services.Connectors | |||
57 | /// <param name="userID"></param> | 57 | /// <param name="userID"></param> |
58 | /// <param name="type"></param> | 58 | /// <param name="type"></param> |
59 | /// <returns></returns> | 59 | /// <returns></returns> |
60 | List<InventoryFolderBase> GetSystemFolders(string userID, UUID session_id); | 60 | Dictionary<AssetType, InventoryFolderBase> GetSystemFolders(string userID, UUID session_id); |
61 | 61 | ||
62 | /// <summary> | 62 | /// <summary> |
63 | /// Gets everything (folders and items) inside a folder | 63 | /// Gets everything (folders and items) inside a folder |
diff --git a/OpenSim/Services/Connectors/Inventory/InventoryServiceConnector.cs b/OpenSim/Services/Connectors/Inventory/InventoryServiceConnector.cs index 1a6826e..3b15831 100644 --- a/OpenSim/Services/Connectors/Inventory/InventoryServiceConnector.cs +++ b/OpenSim/Services/Connectors/Inventory/InventoryServiceConnector.cs | |||
@@ -161,11 +161,11 @@ namespace OpenSim.Services.Connectors | |||
161 | /// <param name="userID"></param> | 161 | /// <param name="userID"></param> |
162 | /// <param name="type"></param> | 162 | /// <param name="type"></param> |
163 | /// <returns></returns> | 163 | /// <returns></returns> |
164 | public List<InventoryFolderBase> GetSystemFolders(string userID, UUID sessionID) | 164 | public Dictionary<AssetType, InventoryFolderBase> GetSystemFolders(string userID, UUID sessionID) |
165 | { | 165 | { |
166 | try | 166 | try |
167 | { | 167 | { |
168 | return SynchronousRestSessionObjectPoster<string, List<InventoryFolderBase>>.BeginPostObject( | 168 | return SynchronousRestSessionObjectPoster<string, Dictionary<AssetType, InventoryFolderBase>>.BeginPostObject( |
169 | "GET", m_ServerURI + "/SystemFolders/", userID, sessionID.ToString(), userID.ToString()); | 169 | "GET", m_ServerURI + "/SystemFolders/", userID, sessionID.ToString(), userID.ToString()); |
170 | } | 170 | } |
171 | catch (Exception e) | 171 | catch (Exception e) |
@@ -174,7 +174,7 @@ namespace OpenSim.Services.Connectors | |||
174 | e.Source, e.Message); | 174 | e.Source, e.Message); |
175 | } | 175 | } |
176 | 176 | ||
177 | return new List<InventoryFolderBase>(); | 177 | return new Dictionary<AssetType, InventoryFolderBase>(); |
178 | } | 178 | } |
179 | 179 | ||
180 | /// <summary> | 180 | /// <summary> |
diff --git a/OpenSim/Services/InventoryService/InventoryService.cs b/OpenSim/Services/InventoryService/InventoryService.cs index dd435c9..fc54c12 100644 --- a/OpenSim/Services/InventoryService/InventoryService.cs +++ b/OpenSim/Services/InventoryService/InventoryService.cs | |||
@@ -273,6 +273,26 @@ namespace OpenSim.Services.InventoryService | |||
273 | return root; | 273 | return root; |
274 | } | 274 | } |
275 | 275 | ||
276 | public Dictionary<AssetType, InventoryFolderBase> GetSystemFolders(UUID userID) | ||
277 | { | ||
278 | InventoryFolderBase root = GetRootFolder(userID); | ||
279 | if (root != null) | ||
280 | { | ||
281 | InventoryCollection content = GetFolderContent(userID, root.ID); | ||
282 | if (content != null) | ||
283 | { | ||
284 | Dictionary<AssetType, InventoryFolderBase> folders = new Dictionary<AssetType, InventoryFolderBase>(); | ||
285 | foreach (InventoryFolderBase folder in content.Folders) | ||
286 | { | ||
287 | if (folder.Type != (short)AssetType.Folder) | ||
288 | folders[(AssetType)folder.Type] = folder; | ||
289 | } | ||
290 | return folders; | ||
291 | } | ||
292 | } | ||
293 | return new Dictionary<AssetType, InventoryFolderBase>(); | ||
294 | } | ||
295 | |||
276 | public List<InventoryItemBase> GetActiveGestures(UUID userId) | 296 | public List<InventoryItemBase> GetActiveGestures(UUID userId) |
277 | { | 297 | { |
278 | List<InventoryItemBase> activeGestures = new List<InventoryItemBase>(); | 298 | List<InventoryItemBase> activeGestures = new List<InventoryItemBase>(); |