diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Services/Connectors/Inventory/InventoryServiceConnector.cs | 64 |
1 files changed, 35 insertions, 29 deletions
diff --git a/OpenSim/Services/Connectors/Inventory/InventoryServiceConnector.cs b/OpenSim/Services/Connectors/Inventory/InventoryServiceConnector.cs index bcf9d87..b573a06 100644 --- a/OpenSim/Services/Connectors/Inventory/InventoryServiceConnector.cs +++ b/OpenSim/Services/Connectors/Inventory/InventoryServiceConnector.cs | |||
@@ -178,30 +178,36 @@ namespace OpenSim.Services.Connectors | |||
178 | catch (Exception e) | 178 | catch (Exception e) |
179 | { | 179 | { |
180 | // Maybe we're talking to an old inventory server. Try this other thing. | 180 | // Maybe we're talking to an old inventory server. Try this other thing. |
181 | m_log.ErrorFormat("[INVENTORY CONNECTOR]: GetSystemFolders operation failed, {0} {1}. Trying RootFolders.", | 181 | m_log.ErrorFormat("[INVENTORY CONNECTOR]: GetSystemFolders operation failed, {0} {1} (old sever?). Trying GetInventory.", |
182 | e.Source, e.Message); | 182 | e.Source, e.Message); |
183 | 183 | ||
184 | try | 184 | try |
185 | { | 185 | { |
186 | folders = SynchronousRestSessionObjectPoster<Guid, List<InventoryFolderBase>>.BeginPostObject( | 186 | InventoryCollection inventory = SynchronousRestSessionObjectPoster<Guid, InventoryCollection>.BeginPostObject( |
187 | "POST", m_ServerURI + "/RootFolders/", new Guid(userID), sessionID.ToString(), userID.ToString()); | 187 | "POST", m_ServerURI + "/GetInventory/", new Guid(userID), sessionID.ToString(), userID.ToString()); |
188 | folders = inventory.Folders; | ||
188 | } | 189 | } |
189 | catch (Exception ex) | 190 | catch (Exception ex) |
190 | { | 191 | { |
191 | m_log.ErrorFormat("[INVENTORY CONNECTOR]: RootFolders operation also failed, {0} {1}. Give up.", | 192 | m_log.ErrorFormat("[INVENTORY CONNECTOR]: GetInventory operation also failed, {0} {1}. Giving up.", |
192 | e.Source, ex.Message); | 193 | e.Source, ex.Message); |
193 | } | 194 | } |
194 | 195 | ||
195 | if ((folders != null) && (folders.Count > 0)) | 196 | if ((folders != null) && (folders.Count > 0)) |
196 | { | 197 | { |
197 | dFolders[AssetType.Folder] = folders[0]; // Root folder is the first one | 198 | m_log.DebugFormat("[INVENTORY CONNECTOR]: Received entire inventory ({0} folders) for user {1}", |
198 | folders.RemoveAt(0); | 199 | folders.Count, userID); |
199 | foreach (InventoryFolderBase f in folders) | 200 | foreach (InventoryFolderBase f in folders) |
200 | { | 201 | { |
201 | if ((f.Type != (short)AssetType.Folder) && (f.Type != (short)AssetType.Unknown)) | 202 | if ((f.Type != (short)AssetType.Folder) && (f.Type != (short)AssetType.Unknown)) |
202 | dFolders[(AssetType)f.Type] = f; | 203 | dFolders[(AssetType)f.Type] = f; |
203 | } | 204 | } |
204 | 205 | ||
206 | UUID rootFolderID = dFolders[AssetType.Animation].ParentID; | ||
207 | InventoryFolderBase rootFolder = new InventoryFolderBase(rootFolderID, new UUID(userID)); | ||
208 | rootFolder = QueryFolder(userID, rootFolder, sessionID); | ||
209 | dFolders[AssetType.Folder] = rootFolder; | ||
210 | m_log.DebugFormat("[INVENTORY CONNECTOR]: {0} system folders for user {1}", dFolders.Count, userID); | ||
205 | return dFolders; | 211 | return dFolders; |
206 | } | 212 | } |
207 | } | 213 | } |
@@ -226,48 +232,48 @@ namespace OpenSim.Services.Connectors | |||
226 | catch (Exception e) | 232 | catch (Exception e) |
227 | { | 233 | { |
228 | // Maybe we're talking to an old inventory server. Try this other thing. | 234 | // Maybe we're talking to an old inventory server. Try this other thing. |
229 | m_log.ErrorFormat("[INVENTORY CONNECTOR]: GetFolderForType operation failed, {0} {1}. Trying RootFolders and GetItems.", | 235 | m_log.ErrorFormat("[INVENTORY CONNECTOR]: GetFolderContent operation failed, {0} {1} (old server?). Trying GetInventory.", |
230 | e.Source, e.Message); | 236 | e.Source, e.Message); |
231 | 237 | ||
238 | InventoryCollection inventory; | ||
232 | List<InventoryFolderBase> folders = null; | 239 | List<InventoryFolderBase> folders = null; |
233 | try | 240 | try |
234 | { | 241 | { |
235 | folders = SynchronousRestSessionObjectPoster<Guid, List<InventoryFolderBase>>.BeginPostObject( | 242 | inventory = SynchronousRestSessionObjectPoster<Guid, InventoryCollection>.BeginPostObject( |
236 | "POST", m_ServerURI + "/RootFolders/", new Guid(userID), sessionID.ToString(), userID.ToString()); | 243 | "POST", m_ServerURI + "/GetInventory/", new Guid(userID), sessionID.ToString(), userID.ToString()); |
244 | if (inventory != null) | ||
245 | folders = inventory.Folders; | ||
237 | } | 246 | } |
238 | catch (Exception ex) | 247 | catch (Exception ex) |
239 | { | 248 | { |
240 | m_log.ErrorFormat("[INVENTORY CONNECTOR]: RootFolders operation also failed, {0} {1}. Give up.", | 249 | m_log.ErrorFormat("[INVENTORY CONNECTOR]: GetInventory operation also failed, {0} {1}. Giving up.", |
241 | e.Source, ex.Message); | 250 | e.Source, ex.Message); |
251 | return new InventoryCollection(); | ||
242 | } | 252 | } |
243 | 253 | ||
244 | if ((folders != null) && (folders.Count > 0)) | 254 | if ((folders != null) && (folders.Count > 0)) |
245 | { | 255 | { |
246 | folders = folders.FindAll(delegate (InventoryFolderBase f) { return f.ParentID == folderID ; }); | 256 | m_log.DebugFormat("[INVENTORY CONNECTOR]: Received entire inventory ({0} folders) for user {1}", |
257 | folders.Count, userID); | ||
247 | 258 | ||
248 | try | 259 | folders = folders.FindAll(delegate(InventoryFolderBase f) { return f.ParentID == folderID; }); |
260 | List<InventoryItemBase> items = inventory.Items; | ||
261 | if (items != null) | ||
249 | { | 262 | { |
250 | List<InventoryItemBase> items = SynchronousRestSessionObjectPoster<Guid, List<InventoryItemBase>>.BeginPostObject( | 263 | items = items.FindAll(delegate(InventoryItemBase i) { return i.Folder == folderID; }); |
251 | "POST", m_ServerURI + "/GetItems/", folderID.Guid, sessionID.ToString(), userID.ToString()); | ||
252 | |||
253 | if (items != null) | ||
254 | { | ||
255 | InventoryCollection result = new InventoryCollection(); | ||
256 | result.Folders = folders; | ||
257 | result.Items = items; | ||
258 | result.UserID = new UUID(userID); | ||
259 | return result; | ||
260 | } | ||
261 | } | ||
262 | catch (Exception ex) | ||
263 | { | ||
264 | m_log.ErrorFormat("[INVENTORY CONNECTOR]: QueryFolder and GetItems operation failed, {0} {1}. Give up.", | ||
265 | e.Source, ex.Message); | ||
266 | } | 264 | } |
265 | |||
266 | inventory.Items = items; | ||
267 | inventory.Folders = folders; | ||
268 | return inventory; | ||
267 | } | 269 | } |
268 | } | 270 | } |
269 | 271 | ||
270 | return null; | 272 | InventoryCollection nullCollection = new InventoryCollection(); |
273 | nullCollection.Folders = new List<InventoryFolderBase>(); | ||
274 | nullCollection.Items = new List<InventoryItemBase>(); | ||
275 | nullCollection.UserID = new UUID(userID); | ||
276 | return nullCollection; | ||
271 | } | 277 | } |
272 | 278 | ||
273 | public bool AddFolder(string userID, InventoryFolderBase folder, UUID sessionID) | 279 | public bool AddFolder(string userID, InventoryFolderBase folder, UUID sessionID) |