diff options
author | Diva Canto | 2010-01-03 09:35:12 -0800 |
---|---|---|
committer | Diva Canto | 2010-01-03 09:35:12 -0800 |
commit | c268e342d19b6cc5969b1c1d94f20a3f4eb844ef (patch) | |
tree | 713af45648bd51675b087af23b0ea0df9ab0f72c /OpenSim/Server/Handlers | |
parent | Applied fix for avatar connectors similar to yesterday's fix of user account ... (diff) | |
download | opensim-SC_OLD-c268e342d19b6cc5969b1c1d94f20a3f4eb844ef.zip opensim-SC_OLD-c268e342d19b6cc5969b1c1d94f20a3f4eb844ef.tar.gz opensim-SC_OLD-c268e342d19b6cc5969b1c1d94f20a3f4eb844ef.tar.bz2 opensim-SC_OLD-c268e342d19b6cc5969b1c1d94f20a3f4eb844ef.tar.xz |
* Changed ISimulation interface to take a GridRegion as input arg instead of a regionHandle.
* Added the RemoteSimulationConnectorModule, which is the replacement for RESTComms. Scenes is not using this yet, only (standalone) Login uses these region modules for now.
* Completed SimulationServiceConnector and corresponding handlers.
Diffstat (limited to 'OpenSim/Server/Handlers')
4 files changed, 115 insertions, 205 deletions
diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index 4966f66..f4f3eea 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs | |||
@@ -35,6 +35,7 @@ using System.Text; | |||
35 | using OpenSim.Server.Base; | 35 | using OpenSim.Server.Base; |
36 | using OpenSim.Server.Handlers.Base; | 36 | using OpenSim.Server.Handlers.Base; |
37 | using OpenSim.Services.Interfaces; | 37 | using OpenSim.Services.Interfaces; |
38 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; | ||
38 | using OpenSim.Framework; | 39 | using OpenSim.Framework; |
39 | using OpenSim.Framework.Servers.HttpServer; | 40 | using OpenSim.Framework.Servers.HttpServer; |
40 | 41 | ||
@@ -72,9 +73,9 @@ namespace OpenSim.Server.Handlers.Simulation | |||
72 | 73 | ||
73 | 74 | ||
74 | UUID agentID; | 75 | UUID agentID; |
76 | UUID regionID; | ||
75 | string action; | 77 | string action; |
76 | ulong regionHandle; | 78 | if (!Utils.GetParams((string)request["uri"], out agentID, out regionID, out action)) |
77 | if (!Utils.GetParams((string)request["uri"], out agentID, out regionHandle, out action)) | ||
78 | { | 79 | { |
79 | m_log.InfoFormat("[AGENT HANDLER]: Invalid parameters for agent message {0}", request["uri"]); | 80 | m_log.InfoFormat("[AGENT HANDLER]: Invalid parameters for agent message {0}", request["uri"]); |
80 | responsedata["int_response_code"] = 404; | 81 | responsedata["int_response_code"] = 404; |
@@ -97,12 +98,12 @@ namespace OpenSim.Server.Handlers.Simulation | |||
97 | } | 98 | } |
98 | else if (method.Equals("GET")) | 99 | else if (method.Equals("GET")) |
99 | { | 100 | { |
100 | DoAgentGet(request, responsedata, agentID, regionHandle); | 101 | DoAgentGet(request, responsedata, agentID, regionID); |
101 | return responsedata; | 102 | return responsedata; |
102 | } | 103 | } |
103 | else if (method.Equals("DELETE")) | 104 | else if (method.Equals("DELETE")) |
104 | { | 105 | { |
105 | DoAgentDelete(request, responsedata, agentID, action, regionHandle); | 106 | DoAgentDelete(request, responsedata, agentID, action, regionID); |
106 | return responsedata; | 107 | return responsedata; |
107 | } | 108 | } |
108 | else | 109 | else |
@@ -126,10 +127,27 @@ namespace OpenSim.Server.Handlers.Simulation | |||
126 | return; | 127 | return; |
127 | } | 128 | } |
128 | 129 | ||
129 | // retrieve the regionhandle | 130 | // retrieve the input arguments |
130 | ulong regionhandle = 0; | 131 | int x = 0, y = 0; |
131 | if (args["destination_handle"] != null) | 132 | UUID uuid = UUID.Zero; |
132 | UInt64.TryParse(args["destination_handle"].AsString(), out regionhandle); | 133 | string regionname = string.Empty; |
134 | uint teleportFlags = 0; | ||
135 | if (args.ContainsKey("destination_x") && args["destination_x"] != null) | ||
136 | Int32.TryParse(args["destination_x"].AsString(), out x); | ||
137 | if (args.ContainsKey("destination_y") && args["destination_y"] != null) | ||
138 | Int32.TryParse(args["destination_y"].AsString(), out y); | ||
139 | if (args.ContainsKey("destination_uuid") && args["destination_uuid"] != null) | ||
140 | UUID.TryParse(args["destination_uuid"].AsString(), out uuid); | ||
141 | if (args.ContainsKey("destination_name") && args["destination_name"] != null) | ||
142 | regionname = args["destination_name"].ToString(); | ||
143 | if (args.ContainsKey("teleport_flags") && args["teleport_flags"] != null) | ||
144 | teleportFlags = args["teleport_flags"].AsUInteger(); | ||
145 | |||
146 | GridRegion destination = new GridRegion(); | ||
147 | destination.RegionID = uuid; | ||
148 | destination.RegionLocX = x; | ||
149 | destination.RegionLocY = y; | ||
150 | destination.RegionName = regionname; | ||
133 | 151 | ||
134 | AgentCircuitData aCircuit = new AgentCircuitData(); | 152 | AgentCircuitData aCircuit = new AgentCircuitData(); |
135 | try | 153 | try |
@@ -146,15 +164,10 @@ namespace OpenSim.Server.Handlers.Simulation | |||
146 | 164 | ||
147 | OSDMap resp = new OSDMap(2); | 165 | OSDMap resp = new OSDMap(2); |
148 | string reason = String.Empty; | 166 | string reason = String.Empty; |
149 | uint teleportFlags = 0; | ||
150 | if (args.ContainsKey("teleport_flags")) | ||
151 | { | ||
152 | teleportFlags = args["teleport_flags"].AsUInteger(); | ||
153 | } | ||
154 | 167 | ||
155 | // This is the meaning of POST agent | 168 | // This is the meaning of POST agent |
156 | //m_regionClient.AdjustUserInformation(aCircuit); | 169 | //m_regionClient.AdjustUserInformation(aCircuit); |
157 | bool result = m_SimulationService.CreateAgent(regionhandle, aCircuit, teleportFlags, out reason); | 170 | bool result = m_SimulationService.CreateAgent(destination, aCircuit, teleportFlags, out reason); |
158 | 171 | ||
159 | resp["reason"] = OSD.FromString(reason); | 172 | resp["reason"] = OSD.FromString(reason); |
160 | resp["success"] = OSD.FromBoolean(result); | 173 | resp["success"] = OSD.FromBoolean(result); |
@@ -174,10 +187,24 @@ namespace OpenSim.Server.Handlers.Simulation | |||
174 | return; | 187 | return; |
175 | } | 188 | } |
176 | 189 | ||
177 | // retrieve the regionhandle | 190 | // retrieve the input arguments |
178 | ulong regionhandle = 0; | 191 | int x = 0, y = 0; |
179 | if (args["destination_handle"] != null) | 192 | UUID uuid = UUID.Zero; |
180 | UInt64.TryParse(args["destination_handle"].AsString(), out regionhandle); | 193 | string regionname = string.Empty; |
194 | if (args.ContainsKey("destination_x") && args["destination_x"] != null) | ||
195 | Int32.TryParse(args["destination_x"].AsString(), out x); | ||
196 | if (args.ContainsKey("destination_y") && args["destination_y"] != null) | ||
197 | Int32.TryParse(args["destination_y"].AsString(), out y); | ||
198 | if (args.ContainsKey("destination_uuid") && args["destination_uuid"] != null) | ||
199 | UUID.TryParse(args["destination_uuid"].AsString(), out uuid); | ||
200 | if (args.ContainsKey("destination_name") && args["destination_name"] != null) | ||
201 | regionname = args["destination_name"].ToString(); | ||
202 | |||
203 | GridRegion destination = new GridRegion(); | ||
204 | destination.RegionID = uuid; | ||
205 | destination.RegionLocX = x; | ||
206 | destination.RegionLocY = y; | ||
207 | destination.RegionName = regionname; | ||
181 | 208 | ||
182 | string messageType; | 209 | string messageType; |
183 | if (args["message_type"] != null) | 210 | if (args["message_type"] != null) |
@@ -206,7 +233,7 @@ namespace OpenSim.Server.Handlers.Simulation | |||
206 | 233 | ||
207 | //agent.Dump(); | 234 | //agent.Dump(); |
208 | // This is one of the meanings of PUT agent | 235 | // This is one of the meanings of PUT agent |
209 | result = m_SimulationService.UpdateAgent(regionhandle, agent); | 236 | result = m_SimulationService.UpdateAgent(destination, agent); |
210 | 237 | ||
211 | } | 238 | } |
212 | else if ("AgentPosition".Equals(messageType)) | 239 | else if ("AgentPosition".Equals(messageType)) |
@@ -223,7 +250,7 @@ namespace OpenSim.Server.Handlers.Simulation | |||
223 | } | 250 | } |
224 | //agent.Dump(); | 251 | //agent.Dump(); |
225 | // This is one of the meanings of PUT agent | 252 | // This is one of the meanings of PUT agent |
226 | result = m_SimulationService.UpdateAgent(regionhandle, agent); | 253 | result = m_SimulationService.UpdateAgent(destination, agent); |
227 | 254 | ||
228 | } | 255 | } |
229 | 256 | ||
@@ -232,10 +259,13 @@ namespace OpenSim.Server.Handlers.Simulation | |||
232 | //responsedata["str_response_string"] = OSDParser.SerializeJsonString(resp); ??? instead | 259 | //responsedata["str_response_string"] = OSDParser.SerializeJsonString(resp); ??? instead |
233 | } | 260 | } |
234 | 261 | ||
235 | protected virtual void DoAgentGet(Hashtable request, Hashtable responsedata, UUID id, ulong regionHandle) | 262 | protected virtual void DoAgentGet(Hashtable request, Hashtable responsedata, UUID id, UUID regionID) |
236 | { | 263 | { |
264 | GridRegion destination = new GridRegion(); | ||
265 | destination.RegionID = regionID; | ||
266 | |||
237 | IAgentData agent = null; | 267 | IAgentData agent = null; |
238 | bool result = m_SimulationService.RetrieveAgent(regionHandle, id, out agent); | 268 | bool result = m_SimulationService.RetrieveAgent(destination, id, out agent); |
239 | OSDMap map = null; | 269 | OSDMap map = null; |
240 | if (result) | 270 | if (result) |
241 | { | 271 | { |
@@ -271,14 +301,17 @@ namespace OpenSim.Server.Handlers.Simulation | |||
271 | } | 301 | } |
272 | } | 302 | } |
273 | 303 | ||
274 | protected virtual void DoAgentDelete(Hashtable request, Hashtable responsedata, UUID id, string action, ulong regionHandle) | 304 | protected virtual void DoAgentDelete(Hashtable request, Hashtable responsedata, UUID id, string action, UUID regionID) |
275 | { | 305 | { |
276 | //m_log.Debug(" >>> DoDelete action:" + action + "; regionHandle:" + regionHandle); | 306 | //m_log.Debug(" >>> DoDelete action:" + action + "; regionHandle:" + regionHandle); |
277 | 307 | ||
308 | GridRegion destination = new GridRegion(); | ||
309 | destination.RegionID = regionID; | ||
310 | |||
278 | if (action.Equals("release")) | 311 | if (action.Equals("release")) |
279 | m_SimulationService.ReleaseAgent(regionHandle, id, ""); | 312 | m_SimulationService.ReleaseAgent(destination, id, ""); |
280 | else | 313 | else |
281 | m_SimulationService.CloseAgent(regionHandle, id); | 314 | m_SimulationService.CloseAgent(destination, id); |
282 | 315 | ||
283 | responsedata["int_response_code"] = HttpStatusCode.OK; | 316 | responsedata["int_response_code"] = HttpStatusCode.OK; |
284 | responsedata["str_response_string"] = "OpenSim agent " + id.ToString(); | 317 | responsedata["str_response_string"] = "OpenSim agent " + id.ToString(); |
@@ -287,165 +320,4 @@ namespace OpenSim.Server.Handlers.Simulation | |||
287 | } | 320 | } |
288 | } | 321 | } |
289 | 322 | ||
290 | public class AgentGetHandler : BaseStreamHandler | ||
291 | { | ||
292 | // TODO: unused: private ISimulationService m_SimulationService; | ||
293 | // TODO: unused: private IAuthenticationService m_AuthenticationService; | ||
294 | |||
295 | public AgentGetHandler(ISimulationService service, IAuthenticationService authentication) : | ||
296 | base("GET", "/agent") | ||
297 | { | ||
298 | // TODO: unused: m_SimulationService = service; | ||
299 | // TODO: unused: m_AuthenticationService = authentication; | ||
300 | } | ||
301 | |||
302 | public override byte[] Handle(string path, Stream request, | ||
303 | OSHttpRequest httpRequest, OSHttpResponse httpResponse) | ||
304 | { | ||
305 | // Not implemented yet | ||
306 | httpResponse.StatusCode = (int)HttpStatusCode.NotImplemented; | ||
307 | return new byte[] { }; | ||
308 | } | ||
309 | } | ||
310 | |||
311 | public class AgentPostHandler : BaseStreamHandler | ||
312 | { | ||
313 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
314 | private ISimulationService m_SimulationService; | ||
315 | private IAuthenticationService m_AuthenticationService; | ||
316 | // TODO: unused: private bool m_AllowForeignGuests; | ||
317 | |||
318 | public AgentPostHandler(ISimulationService service, IAuthenticationService authentication, bool foreignGuests) : | ||
319 | base("POST", "/agent") | ||
320 | { | ||
321 | m_SimulationService = service; | ||
322 | m_AuthenticationService = authentication; | ||
323 | // TODO: unused: m_AllowForeignGuests = foreignGuests; | ||
324 | } | ||
325 | |||
326 | public override byte[] Handle(string path, Stream request, | ||
327 | OSHttpRequest httpRequest, OSHttpResponse httpResponse) | ||
328 | { | ||
329 | byte[] result = new byte[0]; | ||
330 | |||
331 | UUID agentID; | ||
332 | string action; | ||
333 | ulong regionHandle; | ||
334 | if (!RestHandlerUtils.GetParams(path, out agentID, out regionHandle, out action)) | ||
335 | { | ||
336 | m_log.InfoFormat("[AgentPostHandler]: Invalid parameters for agent message {0}", path); | ||
337 | httpResponse.StatusCode = (int)HttpStatusCode.BadRequest; | ||
338 | httpResponse.StatusDescription = "Invalid parameters for agent message " + path; | ||
339 | |||
340 | return result; | ||
341 | } | ||
342 | |||
343 | if (m_AuthenticationService != null) | ||
344 | { | ||
345 | // Authentication | ||
346 | string authority = string.Empty; | ||
347 | string authToken = string.Empty; | ||
348 | if (!RestHandlerUtils.GetAuthentication(httpRequest, out authority, out authToken)) | ||
349 | { | ||
350 | m_log.InfoFormat("[AgentPostHandler]: Authentication failed for agent message {0}", path); | ||
351 | httpResponse.StatusCode = (int)HttpStatusCode.Unauthorized; | ||
352 | return result; | ||
353 | } | ||
354 | // TODO: Rethink this | ||
355 | //if (!m_AuthenticationService.VerifyKey(agentID, authToken)) | ||
356 | //{ | ||
357 | // m_log.InfoFormat("[AgentPostHandler]: Authentication failed for agent message {0}", path); | ||
358 | // httpResponse.StatusCode = (int)HttpStatusCode.Forbidden; | ||
359 | // return result; | ||
360 | //} | ||
361 | m_log.DebugFormat("[AgentPostHandler]: Authentication succeeded for {0}", agentID); | ||
362 | } | ||
363 | |||
364 | OSDMap args = Util.GetOSDMap(request, (int)httpRequest.ContentLength); | ||
365 | if (args == null) | ||
366 | { | ||
367 | httpResponse.StatusCode = (int)HttpStatusCode.BadRequest; | ||
368 | httpResponse.StatusDescription = "Unable to retrieve data"; | ||
369 | m_log.DebugFormat("[AgentPostHandler]: Unable to retrieve data for post {0}", path); | ||
370 | return result; | ||
371 | } | ||
372 | |||
373 | // retrieve the regionhandle | ||
374 | ulong regionhandle = 0; | ||
375 | if (args["destination_handle"] != null) | ||
376 | UInt64.TryParse(args["destination_handle"].AsString(), out regionhandle); | ||
377 | |||
378 | AgentCircuitData aCircuit = new AgentCircuitData(); | ||
379 | try | ||
380 | { | ||
381 | aCircuit.UnpackAgentCircuitData(args); | ||
382 | } | ||
383 | catch (Exception ex) | ||
384 | { | ||
385 | m_log.InfoFormat("[AgentPostHandler]: exception on unpacking CreateAgent message {0}", ex.Message); | ||
386 | httpResponse.StatusCode = (int)HttpStatusCode.BadRequest; | ||
387 | httpResponse.StatusDescription = "Problems with data deserialization"; | ||
388 | return result; | ||
389 | } | ||
390 | |||
391 | string reason = string.Empty; | ||
392 | |||
393 | // We need to clean up a few things in the user service before I can do this | ||
394 | //if (m_AllowForeignGuests) | ||
395 | // m_regionClient.AdjustUserInformation(aCircuit); | ||
396 | |||
397 | // Finally! | ||
398 | bool success = m_SimulationService.CreateAgent(regionhandle, aCircuit, /*!!!*/0, out reason); | ||
399 | |||
400 | OSDMap resp = new OSDMap(1); | ||
401 | |||
402 | resp["success"] = OSD.FromBoolean(success); | ||
403 | |||
404 | httpResponse.StatusCode = (int)HttpStatusCode.OK; | ||
405 | |||
406 | return Util.UTF8.GetBytes(OSDParser.SerializeJsonString(resp)); | ||
407 | } | ||
408 | } | ||
409 | |||
410 | public class AgentPutHandler : BaseStreamHandler | ||
411 | { | ||
412 | // TODO: unused: private ISimulationService m_SimulationService; | ||
413 | // TODO: unused: private IAuthenticationService m_AuthenticationService; | ||
414 | |||
415 | public AgentPutHandler(ISimulationService service, IAuthenticationService authentication) : | ||
416 | base("PUT", "/agent") | ||
417 | { | ||
418 | // TODO: unused: m_SimulationService = service; | ||
419 | // TODO: unused: m_AuthenticationService = authentication; | ||
420 | } | ||
421 | |||
422 | public override byte[] Handle(string path, Stream request, | ||
423 | OSHttpRequest httpRequest, OSHttpResponse httpResponse) | ||
424 | { | ||
425 | // Not implemented yet | ||
426 | httpResponse.StatusCode = (int)HttpStatusCode.NotImplemented; | ||
427 | return new byte[] { }; | ||
428 | } | ||
429 | } | ||
430 | |||
431 | public class AgentDeleteHandler : BaseStreamHandler | ||
432 | { | ||
433 | // TODO: unused: private ISimulationService m_SimulationService; | ||
434 | // TODO: unused: private IAuthenticationService m_AuthenticationService; | ||
435 | |||
436 | public AgentDeleteHandler(ISimulationService service, IAuthenticationService authentication) : | ||
437 | base("DELETE", "/agent") | ||
438 | { | ||
439 | // TODO: unused: m_SimulationService = service; | ||
440 | // TODO: unused: m_AuthenticationService = authentication; | ||
441 | } | ||
442 | |||
443 | public override byte[] Handle(string path, Stream request, | ||
444 | OSHttpRequest httpRequest, OSHttpResponse httpResponse) | ||
445 | { | ||
446 | // Not implemented yet | ||
447 | httpResponse.StatusCode = (int)HttpStatusCode.NotImplemented; | ||
448 | return new byte[] { }; | ||
449 | } | ||
450 | } | ||
451 | } | 323 | } |
diff --git a/OpenSim/Server/Handlers/Simulation/ObjectHandlers.cs b/OpenSim/Server/Handlers/Simulation/ObjectHandlers.cs index 8c3af72..995a3c4 100644 --- a/OpenSim/Server/Handlers/Simulation/ObjectHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/ObjectHandlers.cs | |||
@@ -35,6 +35,7 @@ using System.Text; | |||
35 | using OpenSim.Server.Base; | 35 | using OpenSim.Server.Base; |
36 | using OpenSim.Server.Handlers.Base; | 36 | using OpenSim.Server.Handlers.Base; |
37 | using OpenSim.Services.Interfaces; | 37 | using OpenSim.Services.Interfaces; |
38 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; | ||
38 | using OpenSim.Framework; | 39 | using OpenSim.Framework; |
39 | using OpenSim.Framework.Servers.HttpServer; | 40 | using OpenSim.Framework.Servers.HttpServer; |
40 | 41 | ||
@@ -70,9 +71,9 @@ namespace OpenSim.Server.Handlers.Simulation | |||
70 | responsedata["content_type"] = "text/html"; | 71 | responsedata["content_type"] = "text/html"; |
71 | 72 | ||
72 | UUID objectID; | 73 | UUID objectID; |
74 | UUID regionID; | ||
73 | string action; | 75 | string action; |
74 | ulong regionHandle; | 76 | if (!Utils.GetParams((string)request["uri"], out objectID, out regionID, out action)) |
75 | if (!Utils.GetParams((string)request["uri"], out objectID, out regionHandle, out action)) | ||
76 | { | 77 | { |
77 | m_log.InfoFormat("[REST COMMS]: Invalid parameters for object message {0}", request["uri"]); | 78 | m_log.InfoFormat("[REST COMMS]: Invalid parameters for object message {0}", request["uri"]); |
78 | responsedata["int_response_code"] = 404; | 79 | responsedata["int_response_code"] = 404; |
@@ -85,12 +86,12 @@ namespace OpenSim.Server.Handlers.Simulation | |||
85 | string method = (string)request["http-method"]; | 86 | string method = (string)request["http-method"]; |
86 | if (method.Equals("POST")) | 87 | if (method.Equals("POST")) |
87 | { | 88 | { |
88 | DoObjectPost(request, responsedata, regionHandle); | 89 | DoObjectPost(request, responsedata, regionID); |
89 | return responsedata; | 90 | return responsedata; |
90 | } | 91 | } |
91 | else if (method.Equals("PUT")) | 92 | else if (method.Equals("PUT")) |
92 | { | 93 | { |
93 | DoObjectPut(request, responsedata, regionHandle); | 94 | DoObjectPut(request, responsedata, regionID); |
94 | return responsedata; | 95 | return responsedata; |
95 | } | 96 | } |
96 | //else if (method.Equals("DELETE")) | 97 | //else if (method.Equals("DELETE")) |
@@ -109,7 +110,7 @@ namespace OpenSim.Server.Handlers.Simulation | |||
109 | 110 | ||
110 | } | 111 | } |
111 | 112 | ||
112 | protected virtual void DoObjectPost(Hashtable request, Hashtable responsedata, ulong regionhandle) | 113 | protected virtual void DoObjectPost(Hashtable request, Hashtable responsedata, UUID regionID) |
113 | { | 114 | { |
114 | OSDMap args = Utils.GetOSDMap((string)request["body"]); | 115 | OSDMap args = Utils.GetOSDMap((string)request["body"]); |
115 | if (args == null) | 116 | if (args == null) |
@@ -118,14 +119,32 @@ namespace OpenSim.Server.Handlers.Simulation | |||
118 | responsedata["str_response_string"] = "false"; | 119 | responsedata["str_response_string"] = "false"; |
119 | return; | 120 | return; |
120 | } | 121 | } |
122 | // retrieve the input arguments | ||
123 | int x = 0, y = 0; | ||
124 | UUID uuid = UUID.Zero; | ||
125 | string regionname = string.Empty; | ||
126 | if (args.ContainsKey("destination_x") && args["destination_x"] != null) | ||
127 | Int32.TryParse(args["destination_x"].AsString(), out x); | ||
128 | if (args.ContainsKey("destination_y") && args["destination_y"] != null) | ||
129 | Int32.TryParse(args["destination_y"].AsString(), out y); | ||
130 | if (args.ContainsKey("destination_uuid") && args["destination_uuid"] != null) | ||
131 | UUID.TryParse(args["destination_uuid"].AsString(), out uuid); | ||
132 | if (args.ContainsKey("destination_name") && args["destination_name"] != null) | ||
133 | regionname = args["destination_name"].ToString(); | ||
134 | |||
135 | GridRegion destination = new GridRegion(); | ||
136 | destination.RegionID = uuid; | ||
137 | destination.RegionLocX = x; | ||
138 | destination.RegionLocY = y; | ||
139 | destination.RegionName = regionname; | ||
121 | 140 | ||
122 | string sogXmlStr = "", extraStr = "", stateXmlStr = ""; | 141 | string sogXmlStr = "", extraStr = "", stateXmlStr = ""; |
123 | if (args["sog"] != null) | 142 | if (args.ContainsKey("sog") && args["sog"] != null) |
124 | sogXmlStr = args["sog"].AsString(); | 143 | sogXmlStr = args["sog"].AsString(); |
125 | if (args["extra"] != null) | 144 | if (args.ContainsKey("extra") && args["extra"] != null) |
126 | extraStr = args["extra"].AsString(); | 145 | extraStr = args["extra"].AsString(); |
127 | 146 | ||
128 | IScene s = m_SimulationService.GetScene(regionhandle); | 147 | IScene s = m_SimulationService.GetScene(destination.RegionHandle); |
129 | ISceneObject sog = null; | 148 | ISceneObject sog = null; |
130 | try | 149 | try |
131 | { | 150 | { |
@@ -158,13 +177,13 @@ namespace OpenSim.Server.Handlers.Simulation | |||
158 | } | 177 | } |
159 | } | 178 | } |
160 | // This is the meaning of POST object | 179 | // This is the meaning of POST object |
161 | bool result = m_SimulationService.CreateObject(regionhandle, sog, false); | 180 | bool result = m_SimulationService.CreateObject(destination, sog, false); |
162 | 181 | ||
163 | responsedata["int_response_code"] = HttpStatusCode.OK; | 182 | responsedata["int_response_code"] = HttpStatusCode.OK; |
164 | responsedata["str_response_string"] = result.ToString(); | 183 | responsedata["str_response_string"] = result.ToString(); |
165 | } | 184 | } |
166 | 185 | ||
167 | protected virtual void DoObjectPut(Hashtable request, Hashtable responsedata, ulong regionhandle) | 186 | protected virtual void DoObjectPut(Hashtable request, Hashtable responsedata, UUID regionID) |
168 | { | 187 | { |
169 | OSDMap args = Utils.GetOSDMap((string)request["body"]); | 188 | OSDMap args = Utils.GetOSDMap((string)request["body"]); |
170 | if (args == null) | 189 | if (args == null) |
@@ -174,14 +193,33 @@ namespace OpenSim.Server.Handlers.Simulation | |||
174 | return; | 193 | return; |
175 | } | 194 | } |
176 | 195 | ||
196 | // retrieve the input arguments | ||
197 | int x = 0, y = 0; | ||
198 | UUID uuid = UUID.Zero; | ||
199 | string regionname = string.Empty; | ||
200 | if (args.ContainsKey("destination_x") && args["destination_x"] != null) | ||
201 | Int32.TryParse(args["destination_x"].AsString(), out x); | ||
202 | if (args.ContainsKey("destination_y") && args["destination_y"] != null) | ||
203 | Int32.TryParse(args["destination_y"].AsString(), out y); | ||
204 | if (args.ContainsKey("destination_uuid") && args["destination_uuid"] != null) | ||
205 | UUID.TryParse(args["destination_uuid"].AsString(), out uuid); | ||
206 | if (args.ContainsKey("destination_name") && args["destination_name"] != null) | ||
207 | regionname = args["destination_name"].ToString(); | ||
208 | |||
209 | GridRegion destination = new GridRegion(); | ||
210 | destination.RegionID = uuid; | ||
211 | destination.RegionLocX = x; | ||
212 | destination.RegionLocY = y; | ||
213 | destination.RegionName = regionname; | ||
214 | |||
177 | UUID userID = UUID.Zero, itemID = UUID.Zero; | 215 | UUID userID = UUID.Zero, itemID = UUID.Zero; |
178 | if (args["userid"] != null) | 216 | if (args.ContainsKey("userid") && args["userid"] != null) |
179 | userID = args["userid"].AsUUID(); | 217 | userID = args["userid"].AsUUID(); |
180 | if (args["itemid"] != null) | 218 | if (args.ContainsKey("itemid") && args["itemid"] != null) |
181 | itemID = args["itemid"].AsUUID(); | 219 | itemID = args["itemid"].AsUUID(); |
182 | 220 | ||
183 | // This is the meaning of PUT object | 221 | // This is the meaning of PUT object |
184 | bool result = m_SimulationService.CreateObject(regionhandle, userID, itemID); | 222 | bool result = m_SimulationService.CreateObject(destination, userID, itemID); |
185 | 223 | ||
186 | responsedata["int_response_code"] = 200; | 224 | responsedata["int_response_code"] = 200; |
187 | responsedata["str_response_string"] = result.ToString(); | 225 | responsedata["str_response_string"] = result.ToString(); |
diff --git a/OpenSim/Server/Handlers/Simulation/SimulationServiceInConnector.cs b/OpenSim/Server/Handlers/Simulation/SimulationServiceInConnector.cs index 8611228..55a575c 100644 --- a/OpenSim/Server/Handlers/Simulation/SimulationServiceInConnector.cs +++ b/OpenSim/Server/Handlers/Simulation/SimulationServiceInConnector.cs | |||
@@ -43,9 +43,9 @@ namespace OpenSim.Server.Handlers.Simulation | |||
43 | public SimulationServiceInConnector(IConfigSource config, IHttpServer server, IScene scene) : | 43 | public SimulationServiceInConnector(IConfigSource config, IHttpServer server, IScene scene) : |
44 | base(config, server, String.Empty) | 44 | base(config, server, String.Empty) |
45 | { | 45 | { |
46 | IConfig serverConfig = config.Configs["SimulationService"]; | 46 | //IConfig serverConfig = config.Configs["SimulationService"]; |
47 | if (serverConfig == null) | 47 | //if (serverConfig == null) |
48 | throw new Exception("No section 'SimulationService' in config file"); | 48 | // throw new Exception("No section 'SimulationService' in config file"); |
49 | 49 | ||
50 | //string simService = serverConfig.GetString("LocalServiceModule", | 50 | //string simService = serverConfig.GetString("LocalServiceModule", |
51 | // String.Empty); | 51 | // String.Empty); |
diff --git a/OpenSim/Server/Handlers/Simulation/Utils.cs b/OpenSim/Server/Handlers/Simulation/Utils.cs index 1f2f851..ed379da 100644 --- a/OpenSim/Server/Handlers/Simulation/Utils.cs +++ b/OpenSim/Server/Handlers/Simulation/Utils.cs | |||
@@ -46,11 +46,11 @@ namespace OpenSim.Server.Handlers.Simulation | |||
46 | /// <param name="uri">Something like this: /agent/uuid/ or /agent/uuid/handle/release</param> | 46 | /// <param name="uri">Something like this: /agent/uuid/ or /agent/uuid/handle/release</param> |
47 | /// <param name="uri">uuid on uuid field</param> | 47 | /// <param name="uri">uuid on uuid field</param> |
48 | /// <param name="action">optional action</param> | 48 | /// <param name="action">optional action</param> |
49 | public static bool GetParams(string uri, out UUID uuid, out ulong regionHandle, out string action) | 49 | public static bool GetParams(string uri, out UUID uuid, out UUID regionID, out string action) |
50 | { | 50 | { |
51 | uuid = UUID.Zero; | 51 | uuid = UUID.Zero; |
52 | regionID = UUID.Zero; | ||
52 | action = ""; | 53 | action = ""; |
53 | regionHandle = 0; | ||
54 | 54 | ||
55 | uri = uri.Trim(new char[] { '/' }); | 55 | uri = uri.Trim(new char[] { '/' }); |
56 | string[] parts = uri.Split('/'); | 56 | string[] parts = uri.Split('/'); |
@@ -64,7 +64,7 @@ namespace OpenSim.Server.Handlers.Simulation | |||
64 | return false; | 64 | return false; |
65 | 65 | ||
66 | if (parts.Length >= 3) | 66 | if (parts.Length >= 3) |
67 | UInt64.TryParse(parts[2], out regionHandle); | 67 | UUID.TryParse(parts[2], out regionID); |
68 | if (parts.Length >= 4) | 68 | if (parts.Length >= 4) |
69 | action = parts[3]; | 69 | action = parts[3]; |
70 | 70 | ||