diff options
author | David Walter Seikel | 2016-11-03 21:44:39 +1000 |
---|---|---|
committer | David Walter Seikel | 2016-11-03 21:44:39 +1000 |
commit | 134f86e8d5c414409631b25b8c6f0ee45fbd8631 (patch) | |
tree | 216b89d3fb89acfb81be1e440c25c41ab09fa96d /OpenSim/Capabilities/Handlers/FetchInventory2 | |
parent | More changing to production grid. Double oops. (diff) | |
download | opensim-SC_OLD-134f86e8d5c414409631b25b8c6f0ee45fbd8631.zip opensim-SC_OLD-134f86e8d5c414409631b25b8c6f0ee45fbd8631.tar.gz opensim-SC_OLD-134f86e8d5c414409631b25b8c6f0ee45fbd8631.tar.bz2 opensim-SC_OLD-134f86e8d5c414409631b25b8c6f0ee45fbd8631.tar.xz |
Initial update to OpenSim 0.8.2.1 source code.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Capabilities/Handlers/FetchInventory/FetchInventory2Handler.cs (renamed from OpenSim/Capabilities/Handlers/FetchInventory2/FetchInventory2Handler.cs) | 41 | ||||
-rw-r--r-- | OpenSim/Capabilities/Handlers/GetDisplayNames/GetDisplayNamesServerConnector.cs (renamed from OpenSim/Capabilities/Handlers/FetchInventory2/FetchInventory2ServerConnector.cs) | 32 |
2 files changed, 45 insertions, 28 deletions
diff --git a/OpenSim/Capabilities/Handlers/FetchInventory2/FetchInventory2Handler.cs b/OpenSim/Capabilities/Handlers/FetchInventory/FetchInventory2Handler.cs index c0ca1e1..c904392 100644 --- a/OpenSim/Capabilities/Handlers/FetchInventory2/FetchInventory2Handler.cs +++ b/OpenSim/Capabilities/Handlers/FetchInventory/FetchInventory2Handler.cs | |||
@@ -25,23 +25,18 @@ | |||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | ||
29 | using System.Collections; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Reflection; | 28 | using System.Reflection; |
32 | using log4net; | ||
33 | using Nini.Config; | ||
34 | using OpenMetaverse; | 29 | using OpenMetaverse; |
35 | using OpenMetaverse.StructuredData; | 30 | using OpenMetaverse.StructuredData; |
36 | using OpenSim.Framework; | 31 | using OpenSim.Framework; |
37 | using OpenSim.Framework.Capabilities; | 32 | using OpenSim.Framework.Capabilities; |
38 | using OpenSim.Region.Framework.Interfaces; | ||
39 | using OpenSim.Framework.Servers.HttpServer; | 33 | using OpenSim.Framework.Servers.HttpServer; |
40 | using OpenSim.Services.Interfaces; | 34 | using OpenSim.Services.Interfaces; |
41 | using Caps = OpenSim.Framework.Capabilities.Caps; | ||
42 | using OSDArray = OpenMetaverse.StructuredData.OSDArray; | 35 | using OSDArray = OpenMetaverse.StructuredData.OSDArray; |
43 | using OSDMap = OpenMetaverse.StructuredData.OSDMap; | 36 | using OSDMap = OpenMetaverse.StructuredData.OSDMap; |
44 | 37 | ||
38 | using log4net; | ||
39 | |||
45 | namespace OpenSim.Capabilities.Handlers | 40 | namespace OpenSim.Capabilities.Handlers |
46 | { | 41 | { |
47 | public class FetchInventory2Handler | 42 | public class FetchInventory2Handler |
@@ -49,15 +44,17 @@ namespace OpenSim.Capabilities.Handlers | |||
49 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 44 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
50 | 45 | ||
51 | private IInventoryService m_inventoryService; | 46 | private IInventoryService m_inventoryService; |
47 | private UUID m_agentID; | ||
52 | 48 | ||
53 | public FetchInventory2Handler(IInventoryService invService) | 49 | public FetchInventory2Handler(IInventoryService invService, UUID agentId) |
54 | { | 50 | { |
55 | m_inventoryService = invService; | 51 | m_inventoryService = invService; |
52 | m_agentID = agentId; | ||
56 | } | 53 | } |
57 | 54 | ||
58 | public string FetchInventoryRequest(string request, string path, string param, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) | 55 | public string FetchInventoryRequest(string request, string path, string param, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) |
59 | { | 56 | { |
60 | // m_log.DebugFormat("[FETCH INVENTORY HANDLER]: Received FetchInventory capabilty request"); | 57 | //m_log.DebugFormat("[FETCH INVENTORY HANDLER]: Received FetchInventory capability request {0}", request); |
61 | 58 | ||
62 | OSDMap requestmap = (OSDMap)OSDParser.DeserializeLLSDXml(Utils.StringToBytes(request)); | 59 | OSDMap requestmap = (OSDMap)OSDParser.DeserializeLLSDXml(Utils.StringToBytes(request)); |
63 | OSDArray itemsRequested = (OSDArray)requestmap["items"]; | 60 | OSDArray itemsRequested = (OSDArray)requestmap["items"]; |
@@ -65,12 +62,32 @@ namespace OpenSim.Capabilities.Handlers | |||
65 | string reply; | 62 | string reply; |
66 | LLSDFetchInventory llsdReply = new LLSDFetchInventory(); | 63 | LLSDFetchInventory llsdReply = new LLSDFetchInventory(); |
67 | 64 | ||
65 | UUID[] itemIDs = new UUID[itemsRequested.Count]; | ||
66 | int i = 0; | ||
68 | foreach (OSDMap osdItemId in itemsRequested) | 67 | foreach (OSDMap osdItemId in itemsRequested) |
69 | { | 68 | { |
70 | UUID itemId = osdItemId["item_id"].AsUUID(); | 69 | itemIDs[i++] = osdItemId["item_id"].AsUUID(); |
70 | } | ||
71 | |||
72 | InventoryItemBase[] items = m_inventoryService.GetMultipleItems(m_agentID, itemIDs); | ||
71 | 73 | ||
72 | InventoryItemBase item = m_inventoryService.GetItem(new InventoryItemBase(itemId)); | 74 | if (items == null) |
75 | { | ||
76 | // OMG!!! One by one!!! This is fallback code, in case the backend isn't updated | ||
77 | m_log.WarnFormat("[FETCH INVENTORY HANDLER]: GetMultipleItems failed. Falling back to fetching inventory items one by one."); | ||
78 | items = new InventoryItemBase[itemsRequested.Count]; | ||
79 | i = 0; | ||
80 | InventoryItemBase item = new InventoryItemBase(); | ||
81 | item.Owner = m_agentID; | ||
82 | foreach (UUID id in itemIDs) | ||
83 | { | ||
84 | item.ID = id; | ||
85 | items[i++] = m_inventoryService.GetItem(item); | ||
86 | } | ||
87 | } | ||
73 | 88 | ||
89 | foreach (InventoryItemBase item in items) | ||
90 | { | ||
74 | if (item != null) | 91 | if (item != null) |
75 | { | 92 | { |
76 | // We don't know the agent that this request belongs to so we'll use the agent id of the item | 93 | // We don't know the agent that this request belongs to so we'll use the agent id of the item |
@@ -121,4 +138,4 @@ namespace OpenSim.Capabilities.Handlers | |||
121 | return llsdItem; | 138 | return llsdItem; |
122 | } | 139 | } |
123 | } | 140 | } |
124 | } | 141 | } \ No newline at end of file |
diff --git a/OpenSim/Capabilities/Handlers/FetchInventory2/FetchInventory2ServerConnector.cs b/OpenSim/Capabilities/Handlers/GetDisplayNames/GetDisplayNamesServerConnector.cs index 5bab52f..d42de56 100644 --- a/OpenSim/Capabilities/Handlers/FetchInventory2/FetchInventory2ServerConnector.cs +++ b/OpenSim/Capabilities/Handlers/GetDisplayNames/GetDisplayNamesServerConnector.cs | |||
@@ -35,13 +35,13 @@ using OpenMetaverse; | |||
35 | 35 | ||
36 | namespace OpenSim.Capabilities.Handlers | 36 | namespace OpenSim.Capabilities.Handlers |
37 | { | 37 | { |
38 | public class FetchInventory2ServerConnector : ServiceConnector | 38 | public class GetDisplayNamesServerConnector : ServiceConnector |
39 | { | 39 | { |
40 | private IInventoryService m_InventoryService; | 40 | private IUserManagement m_UserManagement; |
41 | private string m_ConfigName = "CapsService"; | 41 | private string m_ConfigName = "CapsService"; |
42 | 42 | ||
43 | public FetchInventory2ServerConnector(IConfigSource config, IHttpServer server, string configName) | 43 | public GetDisplayNamesServerConnector(IConfigSource config, IHttpServer server, string configName) : |
44 | : base(config, server, configName) | 44 | base(config, server, configName) |
45 | { | 45 | { |
46 | if (configName != String.Empty) | 46 | if (configName != String.Empty) |
47 | m_ConfigName = configName; | 47 | m_ConfigName = configName; |
@@ -50,22 +50,22 @@ namespace OpenSim.Capabilities.Handlers | |||
50 | if (serverConfig == null) | 50 | if (serverConfig == null) |
51 | throw new Exception(String.Format("No section '{0}' in config file", m_ConfigName)); | 51 | throw new Exception(String.Format("No section '{0}' in config file", m_ConfigName)); |
52 | 52 | ||
53 | string invService = serverConfig.GetString("InventoryService", String.Empty); | 53 | string umService = serverConfig.GetString("AssetService", String.Empty); |
54 | 54 | ||
55 | if (invService == String.Empty) | 55 | if (umService == String.Empty) |
56 | throw new Exception("No InventoryService in config file"); | 56 | throw new Exception("No AssetService in config file"); |
57 | 57 | ||
58 | Object[] args = new Object[] { config }; | 58 | Object[] args = new Object[] { config }; |
59 | m_InventoryService = ServerUtils.LoadPlugin<IInventoryService>(invService, args); | 59 | m_UserManagement = |
60 | ServerUtils.LoadPlugin<IUserManagement>(umService, args); | ||
60 | 61 | ||
61 | if (m_InventoryService == null) | 62 | if (m_UserManagement == null) |
62 | throw new Exception(String.Format("Failed to load InventoryService from {0}; config is {1}", invService, m_ConfigName)); | 63 | throw new Exception(String.Format("Failed to load UserManagement from {0}; config is {1}", umService, m_ConfigName)); |
63 | 64 | ||
64 | FetchInventory2Handler fiHandler = new FetchInventory2Handler(m_InventoryService); | 65 | string rurl = serverConfig.GetString("GetTextureRedirectURL"); |
65 | IRequestHandler reqHandler | 66 | |
66 | = new RestStreamHandler( | 67 | server.AddStreamHandler( |
67 | "POST", "/CAPS/FetchInventory/", fiHandler.FetchInventoryRequest, "FetchInventory", null); | 68 | new GetDisplayNamesHandler("/CAPS/agents/", m_UserManagement, "GetDisplayNames", null)); |
68 | server.AddStreamHandler(reqHandler); | ||
69 | } | 69 | } |
70 | } | 70 | } |
71 | } | 71 | } \ No newline at end of file |