aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorDiva Canto2009-08-11 12:30:28 -0700
committerDiva Canto2009-08-11 12:30:28 -0700
commite3dbd0e049e96c30660155584d034d8b550f9063 (patch)
treef627211d00e82dbac0c0497da23e075f42bee729 /OpenSim
parentMerged with origin, and resolved one conflict in LoginServiceTests.cs (diff)
downloadopensim-SC-e3dbd0e049e96c30660155584d034d8b550f9063.zip
opensim-SC-e3dbd0e049e96c30660155584d034d8b550f9063.tar.gz
opensim-SC-e3dbd0e049e96c30660155584d034d8b550f9063.tar.bz2
opensim-SC-e3dbd0e049e96c30660155584d034d8b550f9063.tar.xz
Added http handlers for the two new inventory operations.
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Server/Handlers/Inventory/InventoryServerInConnector.cs42
-rw-r--r--OpenSim/Services/Connectors/Inventory/InventoryServiceConnector.cs8
2 files changed, 46 insertions, 4 deletions
diff --git a/OpenSim/Server/Handlers/Inventory/InventoryServerInConnector.cs b/OpenSim/Server/Handlers/Inventory/InventoryServerInConnector.cs
index 3354b84..c74c431 100644
--- a/OpenSim/Server/Handlers/Inventory/InventoryServerInConnector.cs
+++ b/OpenSim/Server/Handlers/Inventory/InventoryServerInConnector.cs
@@ -85,6 +85,14 @@ namespace OpenSim.Server.Handlers.Inventory
85 "POST", "/GetInventory/", GetUserInventory, CheckAuthSession)); 85 "POST", "/GetInventory/", GetUserInventory, CheckAuthSession));
86 86
87 m_httpServer.AddStreamHandler( 87 m_httpServer.AddStreamHandler(
88 new RestDeserialiseSecureHandler<Guid, Dictionary<AssetType, InventoryFolderBase>>(
89 "GET", "/SystemFolders/", GetSystemFolders, CheckAuthSession));
90
91 m_httpServer.AddStreamHandler(
92 new RestDeserialiseSecureHandler<Guid, InventoryCollection>(
93 "POST", "/GetFolderContent/", GetFolderContent, CheckAuthSession));
94
95 m_httpServer.AddStreamHandler(
88 new RestDeserialiseSecureHandler<InventoryFolderBase, bool>( 96 new RestDeserialiseSecureHandler<InventoryFolderBase, bool>(
89 "POST", "/UpdateFolder/", m_InventoryService.UpdateFolder, CheckAuthSession)); 97 "POST", "/UpdateFolder/", m_InventoryService.UpdateFolder, CheckAuthSession));
90 98
@@ -155,6 +163,40 @@ namespace OpenSim.Server.Handlers.Inventory
155 return m_InventoryService.GetUserInventory(userID); 163 return m_InventoryService.GetUserInventory(userID);
156 } 164 }
157 165
166 public Dictionary<AssetType, InventoryFolderBase> GetSystemFolders(Guid guid)
167 {
168 UUID userID = new UUID(guid);
169 return GetSystemFolders(userID);
170 }
171
172 // This shouldn't be here, it should be in the inventory service.
173 // But I don't want to deal with types and dependencies for now.
174 private Dictionary<AssetType, InventoryFolderBase> GetSystemFolders(UUID userID)
175 {
176 InventoryFolderBase root = m_InventoryService.GetRootFolder(userID);
177 if (root != null)
178 {
179 InventoryCollection content = m_InventoryService.GetFolderContent(userID, root.ID);
180 if (content != null)
181 {
182 Dictionary<AssetType, InventoryFolderBase> folders = new Dictionary<AssetType, InventoryFolderBase>();
183 foreach (InventoryFolderBase folder in content.Folders)
184 {
185 if ((folder.Type != (short)AssetType.Folder) && (folder.Type != (short)AssetType.Unknown))
186 folders[(AssetType)folder.Type] = folder;
187 }
188 return folders;
189 }
190 }
191 m_log.WarnFormat("[INVENTORY SERVICE]: System folders for {0} not found", userID);
192 return new Dictionary<AssetType, InventoryFolderBase>();
193 }
194
195 public InventoryCollection GetFolderContent(Guid guid)
196 {
197 return m_InventoryService.GetFolderContent(UUID.Zero, new UUID(guid));
198 }
199
158 public List<InventoryItemBase> GetFolderItems(Guid folderID) 200 public List<InventoryItemBase> GetFolderItems(Guid folderID)
159 { 201 {
160 List<InventoryItemBase> allItems = new List<InventoryItemBase>(); 202 List<InventoryItemBase> allItems = new List<InventoryItemBase>();
diff --git a/OpenSim/Services/Connectors/Inventory/InventoryServiceConnector.cs b/OpenSim/Services/Connectors/Inventory/InventoryServiceConnector.cs
index 3b15831..4837c0d 100644
--- a/OpenSim/Services/Connectors/Inventory/InventoryServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Inventory/InventoryServiceConnector.cs
@@ -165,8 +165,8 @@ namespace OpenSim.Services.Connectors
165 { 165 {
166 try 166 try
167 { 167 {
168 return SynchronousRestSessionObjectPoster<string, Dictionary<AssetType, InventoryFolderBase>>.BeginPostObject( 168 return SynchronousRestSessionObjectPoster<Guid, Dictionary<AssetType, InventoryFolderBase>>.BeginPostObject(
169 "GET", m_ServerURI + "/SystemFolders/", userID, sessionID.ToString(), userID.ToString()); 169 "GET", m_ServerURI + "/SystemFolders/", new Guid(userID), sessionID.ToString(), userID.ToString());
170 } 170 }
171 catch (Exception e) 171 catch (Exception e)
172 { 172 {
@@ -187,8 +187,8 @@ namespace OpenSim.Services.Connectors
187 { 187 {
188 try 188 try
189 { 189 {
190 return SynchronousRestSessionObjectPoster<UUID, InventoryCollection>.BeginPostObject( 190 return SynchronousRestSessionObjectPoster<Guid, InventoryCollection>.BeginPostObject(
191 "GET", m_ServerURI + "/GetFolderContents/", folderID, sessionID.ToString(), userID.ToString()); 191 "POST", m_ServerURI + "/GetFolderContent/", folderID.Guid, sessionID.ToString(), userID.ToString());
192 } 192 }
193 catch (Exception e) 193 catch (Exception e)
194 { 194 {