diff options
author | Diva Canto | 2010-01-17 18:04:55 -0800 |
---|---|---|
committer | Diva Canto | 2010-01-17 18:04:55 -0800 |
commit | b2e6ec9e12ad07eb08496ebe8ca0476b793017d5 (patch) | |
tree | ac72f03b9cfca6f344d697f6d7581e5147ccf450 /OpenSim/Server/Handlers | |
parent | Oops, forgot this one. (diff) | |
download | opensim-SC_OLD-b2e6ec9e12ad07eb08496ebe8ca0476b793017d5.zip opensim-SC_OLD-b2e6ec9e12ad07eb08496ebe8ca0476b793017d5.tar.gz opensim-SC_OLD-b2e6ec9e12ad07eb08496ebe8ca0476b793017d5.tar.bz2 opensim-SC_OLD-b2e6ec9e12ad07eb08496ebe8ca0476b793017d5.tar.xz |
Agent gets there through the Gatekeeper, but still a few quirks to fix.
Diffstat (limited to 'OpenSim/Server/Handlers')
6 files changed, 305 insertions, 75 deletions
diff --git a/OpenSim/Server/Handlers/Hypergrid/AgentHandlers.cs b/OpenSim/Server/Handlers/Hypergrid/AgentHandlers.cs new file mode 100644 index 0000000..a56363c --- /dev/null +++ b/OpenSim/Server/Handlers/Hypergrid/AgentHandlers.cs | |||
@@ -0,0 +1,79 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections; | ||
30 | using System.IO; | ||
31 | using System.Reflection; | ||
32 | using System.Net; | ||
33 | using System.Text; | ||
34 | |||
35 | using OpenSim.Server.Base; | ||
36 | using OpenSim.Server.Handlers.Base; | ||
37 | using OpenSim.Services.Interfaces; | ||
38 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; | ||
39 | using OpenSim.Framework; | ||
40 | using OpenSim.Framework.Servers.HttpServer; | ||
41 | using OpenSim.Server.Handlers.Simulation; | ||
42 | using Utils = OpenSim.Server.Handlers.Simulation.Utils; | ||
43 | |||
44 | using OpenMetaverse; | ||
45 | using OpenMetaverse.StructuredData; | ||
46 | using Nini.Config; | ||
47 | using log4net; | ||
48 | |||
49 | |||
50 | namespace OpenSim.Server.Handlers.Hypergrid | ||
51 | { | ||
52 | public class AgentHandler : OpenSim.Server.Handlers.Simulation.AgentHandler | ||
53 | { | ||
54 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
55 | private IGatekeeperService m_GatekeeperService; | ||
56 | |||
57 | public AgentHandler(IGatekeeperService gatekeeper) | ||
58 | { | ||
59 | m_GatekeeperService = gatekeeper; | ||
60 | } | ||
61 | |||
62 | protected override bool CreateAgent(GridRegion destination, AgentCircuitData aCircuit, uint teleportFlags, out string reason) | ||
63 | { | ||
64 | return m_GatekeeperService.LoginAgent(aCircuit, destination, out reason); | ||
65 | } | ||
66 | |||
67 | protected override bool UpdateAgent(GridRegion destination, AgentData agent) | ||
68 | { | ||
69 | return m_GatekeeperService.UpdateAgent(destination, agent); | ||
70 | } | ||
71 | |||
72 | protected override void ReleaseAgent(UUID regionID, UUID id) | ||
73 | { | ||
74 | m_GatekeeperService.ReleaseAgent(regionID, id); | ||
75 | } | ||
76 | |||
77 | } | ||
78 | |||
79 | } | ||
diff --git a/OpenSim/Server/Handlers/Hypergrid/GatekeeperServerConnector.cs b/OpenSim/Server/Handlers/Hypergrid/GatekeeperServerConnector.cs index f72b36c..27b793d 100644 --- a/OpenSim/Server/Handlers/Hypergrid/GatekeeperServerConnector.cs +++ b/OpenSim/Server/Handlers/Hypergrid/GatekeeperServerConnector.cs | |||
@@ -26,21 +26,16 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections; | ||
30 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
31 | using System.Reflection; | 30 | using System.Reflection; |
32 | using System.Net; | ||
33 | using Nini.Config; | 31 | using Nini.Config; |
34 | using OpenSim.Framework; | 32 | using OpenSim.Framework; |
35 | using OpenSim.Server.Base; | 33 | using OpenSim.Server.Base; |
36 | using OpenSim.Services.Interfaces; | 34 | using OpenSim.Services.Interfaces; |
37 | using OpenSim.Framework.Servers.HttpServer; | 35 | using OpenSim.Framework.Servers.HttpServer; |
38 | using OpenSim.Server.Handlers.Base; | 36 | using OpenSim.Server.Handlers.Base; |
39 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; | ||
40 | 37 | ||
41 | using OpenMetaverse; | ||
42 | using log4net; | 38 | using log4net; |
43 | using Nwc.XmlRpc; | ||
44 | 39 | ||
45 | namespace OpenSim.Server.Handlers.Hypergrid | 40 | namespace OpenSim.Server.Handlers.Hypergrid |
46 | { | 41 | { |
@@ -65,8 +60,13 @@ namespace OpenSim.Server.Handlers.Hypergrid | |||
65 | if (m_GatekeeperService == null) | 60 | if (m_GatekeeperService == null) |
66 | throw new Exception("Gatekeeper server connector cannot proceed because of missing service"); | 61 | throw new Exception("Gatekeeper server connector cannot proceed because of missing service"); |
67 | 62 | ||
68 | server.AddXmlRPCHandler("link_region", LinkRegionRequest, false); | 63 | HypergridHandlers hghandlers = new HypergridHandlers(m_GatekeeperService); |
69 | server.AddXmlRPCHandler("get_region", GetRegion, false); | 64 | server.AddXmlRPCHandler("link_region", hghandlers.LinkRegionRequest, false); |
65 | server.AddXmlRPCHandler("get_region", hghandlers.GetRegion, false); | ||
66 | |||
67 | server.AddHTTPHandler("/foreignagent/", new AgentHandler(m_GatekeeperService).Handler); | ||
68 | server.AddHTTPHandler("/foreignobject/", new ObjectHandler(m_GatekeeperService).Handler); | ||
69 | |||
70 | } | 70 | } |
71 | 71 | ||
72 | public GatekeeperServiceInConnector(IConfigSource config, IHttpServer server) | 72 | public GatekeeperServiceInConnector(IConfigSource config, IHttpServer server) |
@@ -74,65 +74,5 @@ namespace OpenSim.Server.Handlers.Hypergrid | |||
74 | { | 74 | { |
75 | } | 75 | } |
76 | 76 | ||
77 | /// <summary> | ||
78 | /// Someone wants to link to us | ||
79 | /// </summary> | ||
80 | /// <param name="request"></param> | ||
81 | /// <returns></returns> | ||
82 | public XmlRpcResponse LinkRegionRequest(XmlRpcRequest request, IPEndPoint remoteClient) | ||
83 | { | ||
84 | Hashtable requestData = (Hashtable)request.Params[0]; | ||
85 | //string host = (string)requestData["host"]; | ||
86 | //string portstr = (string)requestData["port"]; | ||
87 | string name = (string)requestData["region_name"]; | ||
88 | |||
89 | UUID regionID = UUID.Zero; | ||
90 | string imageURL = string.Empty; | ||
91 | ulong regionHandle = 0; | ||
92 | string reason = string.Empty; | ||
93 | |||
94 | bool success = m_GatekeeperService.LinkRegion(name, out regionID, out regionHandle, out imageURL, out reason); | ||
95 | |||
96 | Hashtable hash = new Hashtable(); | ||
97 | hash["result"] = success.ToString(); | ||
98 | hash["uuid"] = regionID.ToString(); | ||
99 | hash["handle"] = regionHandle.ToString(); | ||
100 | hash["region_image"] = imageURL; | ||
101 | |||
102 | XmlRpcResponse response = new XmlRpcResponse(); | ||
103 | response.Value = hash; | ||
104 | return response; | ||
105 | } | ||
106 | |||
107 | public XmlRpcResponse GetRegion(XmlRpcRequest request, IPEndPoint remoteClient) | ||
108 | { | ||
109 | Hashtable requestData = (Hashtable)request.Params[0]; | ||
110 | //string host = (string)requestData["host"]; | ||
111 | //string portstr = (string)requestData["port"]; | ||
112 | string regionID_str = (string)requestData["region_uuid"]; | ||
113 | UUID regionID = UUID.Zero; | ||
114 | UUID.TryParse(regionID_str, out regionID); | ||
115 | |||
116 | GridRegion regInfo = m_GatekeeperService.GetHyperlinkRegion(regionID); | ||
117 | |||
118 | Hashtable hash = new Hashtable(); | ||
119 | if (regInfo == null) | ||
120 | hash["result"] = "false"; | ||
121 | else | ||
122 | { | ||
123 | hash["result"] = "true"; | ||
124 | hash["uuid"] = regInfo.RegionID.ToString(); | ||
125 | hash["x"] = regInfo.RegionLocX.ToString(); | ||
126 | hash["y"] = regInfo.RegionLocY.ToString(); | ||
127 | hash["region_name"] = regInfo.RegionName; | ||
128 | hash["hostname"] = regInfo.ExternalHostName; | ||
129 | hash["http_port"] = regInfo.HttpPort.ToString(); | ||
130 | hash["internal_port"] = regInfo.InternalEndPoint.Port.ToString(); | ||
131 | } | ||
132 | XmlRpcResponse response = new XmlRpcResponse(); | ||
133 | response.Value = hash; | ||
134 | return response; | ||
135 | |||
136 | } | ||
137 | } | 77 | } |
138 | } | 78 | } |
diff --git a/OpenSim/Server/Handlers/Hypergrid/HypergridHandlers.cs b/OpenSim/Server/Handlers/Hypergrid/HypergridHandlers.cs new file mode 100644 index 0000000..baafd7d --- /dev/null +++ b/OpenSim/Server/Handlers/Hypergrid/HypergridHandlers.cs | |||
@@ -0,0 +1,115 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | using System; | ||
28 | using System.Collections; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Net; | ||
31 | using System.Reflection; | ||
32 | |||
33 | using OpenSim.Services.Interfaces; | ||
34 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; | ||
35 | |||
36 | using log4net; | ||
37 | using Nwc.XmlRpc; | ||
38 | using OpenMetaverse; | ||
39 | |||
40 | namespace OpenSim.Server.Handlers.Hypergrid | ||
41 | { | ||
42 | public class HypergridHandlers | ||
43 | { | ||
44 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
45 | |||
46 | private IGatekeeperService m_GatekeeperService; | ||
47 | |||
48 | public HypergridHandlers(IGatekeeperService gatekeeper) | ||
49 | { | ||
50 | m_GatekeeperService = gatekeeper; | ||
51 | } | ||
52 | |||
53 | /// <summary> | ||
54 | /// Someone wants to link to us | ||
55 | /// </summary> | ||
56 | /// <param name="request"></param> | ||
57 | /// <returns></returns> | ||
58 | public XmlRpcResponse LinkRegionRequest(XmlRpcRequest request, IPEndPoint remoteClient) | ||
59 | { | ||
60 | Hashtable requestData = (Hashtable)request.Params[0]; | ||
61 | //string host = (string)requestData["host"]; | ||
62 | //string portstr = (string)requestData["port"]; | ||
63 | string name = (string)requestData["region_name"]; | ||
64 | |||
65 | UUID regionID = UUID.Zero; | ||
66 | string imageURL = string.Empty; | ||
67 | ulong regionHandle = 0; | ||
68 | string reason = string.Empty; | ||
69 | |||
70 | bool success = m_GatekeeperService.LinkRegion(name, out regionID, out regionHandle, out imageURL, out reason); | ||
71 | |||
72 | Hashtable hash = new Hashtable(); | ||
73 | hash["result"] = success.ToString(); | ||
74 | hash["uuid"] = regionID.ToString(); | ||
75 | hash["handle"] = regionHandle.ToString(); | ||
76 | hash["region_image"] = imageURL; | ||
77 | |||
78 | XmlRpcResponse response = new XmlRpcResponse(); | ||
79 | response.Value = hash; | ||
80 | return response; | ||
81 | } | ||
82 | |||
83 | public XmlRpcResponse GetRegion(XmlRpcRequest request, IPEndPoint remoteClient) | ||
84 | { | ||
85 | Hashtable requestData = (Hashtable)request.Params[0]; | ||
86 | //string host = (string)requestData["host"]; | ||
87 | //string portstr = (string)requestData["port"]; | ||
88 | string regionID_str = (string)requestData["region_uuid"]; | ||
89 | UUID regionID = UUID.Zero; | ||
90 | UUID.TryParse(regionID_str, out regionID); | ||
91 | |||
92 | GridRegion regInfo = m_GatekeeperService.GetHyperlinkRegion(regionID); | ||
93 | |||
94 | Hashtable hash = new Hashtable(); | ||
95 | if (regInfo == null) | ||
96 | hash["result"] = "false"; | ||
97 | else | ||
98 | { | ||
99 | hash["result"] = "true"; | ||
100 | hash["uuid"] = regInfo.RegionID.ToString(); | ||
101 | hash["x"] = regInfo.RegionLocX.ToString(); | ||
102 | hash["y"] = regInfo.RegionLocY.ToString(); | ||
103 | hash["region_name"] = regInfo.RegionName; | ||
104 | hash["hostname"] = regInfo.ExternalHostName; | ||
105 | hash["http_port"] = regInfo.HttpPort.ToString(); | ||
106 | hash["internal_port"] = regInfo.InternalEndPoint.Port.ToString(); | ||
107 | } | ||
108 | XmlRpcResponse response = new XmlRpcResponse(); | ||
109 | response.Value = hash; | ||
110 | return response; | ||
111 | |||
112 | } | ||
113 | |||
114 | } | ||
115 | } | ||
diff --git a/OpenSim/Server/Handlers/Hypergrid/ObjectHandlers.cs b/OpenSim/Server/Handlers/Hypergrid/ObjectHandlers.cs new file mode 100644 index 0000000..20eb375 --- /dev/null +++ b/OpenSim/Server/Handlers/Hypergrid/ObjectHandlers.cs | |||
@@ -0,0 +1,68 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections; | ||
30 | using System.IO; | ||
31 | using System.Reflection; | ||
32 | using System.Net; | ||
33 | using System.Text; | ||
34 | |||
35 | using OpenSim.Server.Base; | ||
36 | using OpenSim.Server.Handlers.Base; | ||
37 | using OpenSim.Services.Interfaces; | ||
38 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; | ||
39 | using OpenSim.Framework; | ||
40 | using OpenSim.Framework.Servers.HttpServer; | ||
41 | using OpenSim.Server.Handlers.Simulation; | ||
42 | using Utils = OpenSim.Server.Handlers.Simulation.Utils; | ||
43 | |||
44 | using OpenMetaverse; | ||
45 | using OpenMetaverse.StructuredData; | ||
46 | using Nini.Config; | ||
47 | using log4net; | ||
48 | |||
49 | |||
50 | namespace OpenSim.Server.Handlers.Hypergrid | ||
51 | { | ||
52 | public class ObjectHandler : OpenSim.Server.Handlers.Simulation.ObjectHandler | ||
53 | { | ||
54 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
55 | private IGatekeeperService m_GatekeeperService; | ||
56 | |||
57 | public ObjectHandler(IGatekeeperService gatekeeper) | ||
58 | { | ||
59 | m_GatekeeperService = gatekeeper; | ||
60 | } | ||
61 | |||
62 | protected override bool CreateObject(GridRegion destination, ISceneObject sog) | ||
63 | { | ||
64 | return m_GatekeeperService.LoginAttachment(destination, sog); | ||
65 | } | ||
66 | |||
67 | } | ||
68 | } \ No newline at end of file | ||
diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index 0c098d9..ab3250d 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs | |||
@@ -52,6 +52,8 @@ namespace OpenSim.Server.Handlers.Simulation | |||
52 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 52 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
53 | private ISimulationService m_SimulationService; | 53 | private ISimulationService m_SimulationService; |
54 | 54 | ||
55 | public AgentHandler() { } | ||
56 | |||
55 | public AgentHandler(ISimulationService sim) | 57 | public AgentHandler(ISimulationService sim) |
56 | { | 58 | { |
57 | m_SimulationService = sim; | 59 | m_SimulationService = sim; |
@@ -117,7 +119,7 @@ namespace OpenSim.Server.Handlers.Simulation | |||
117 | 119 | ||
118 | } | 120 | } |
119 | 121 | ||
120 | protected virtual void DoAgentPost(Hashtable request, Hashtable responsedata, UUID id) | 122 | protected void DoAgentPost(Hashtable request, Hashtable responsedata, UUID id) |
121 | { | 123 | { |
122 | OSDMap args = Utils.GetOSDMap((string)request["body"]); | 124 | OSDMap args = Utils.GetOSDMap((string)request["body"]); |
123 | if (args == null) | 125 | if (args == null) |
@@ -171,7 +173,8 @@ namespace OpenSim.Server.Handlers.Simulation | |||
171 | 173 | ||
172 | // This is the meaning of POST agent | 174 | // This is the meaning of POST agent |
173 | //m_regionClient.AdjustUserInformation(aCircuit); | 175 | //m_regionClient.AdjustUserInformation(aCircuit); |
174 | bool result = m_SimulationService.CreateAgent(destination, aCircuit, teleportFlags, out reason); | 176 | //bool result = m_SimulationService.CreateAgent(destination, aCircuit, teleportFlags, out reason); |
177 | bool result = CreateAgent(destination, aCircuit, teleportFlags, out reason); | ||
175 | 178 | ||
176 | resp["reason"] = OSD.FromString(reason); | 179 | resp["reason"] = OSD.FromString(reason); |
177 | resp["success"] = OSD.FromBoolean(result); | 180 | resp["success"] = OSD.FromBoolean(result); |
@@ -181,7 +184,13 @@ namespace OpenSim.Server.Handlers.Simulation | |||
181 | responsedata["str_response_string"] = OSDParser.SerializeJsonString(resp); | 184 | responsedata["str_response_string"] = OSDParser.SerializeJsonString(resp); |
182 | } | 185 | } |
183 | 186 | ||
184 | protected virtual void DoAgentPut(Hashtable request, Hashtable responsedata) | 187 | // subclasses can override this |
188 | protected virtual bool CreateAgent(GridRegion destination, AgentCircuitData aCircuit, uint teleportFlags, out string reason) | ||
189 | { | ||
190 | return m_SimulationService.CreateAgent(destination, aCircuit, teleportFlags, out reason); | ||
191 | } | ||
192 | |||
193 | protected void DoAgentPut(Hashtable request, Hashtable responsedata) | ||
185 | { | 194 | { |
186 | OSDMap args = Utils.GetOSDMap((string)request["body"]); | 195 | OSDMap args = Utils.GetOSDMap((string)request["body"]); |
187 | if (args == null) | 196 | if (args == null) |
@@ -237,7 +246,7 @@ namespace OpenSim.Server.Handlers.Simulation | |||
237 | 246 | ||
238 | //agent.Dump(); | 247 | //agent.Dump(); |
239 | // This is one of the meanings of PUT agent | 248 | // This is one of the meanings of PUT agent |
240 | result = m_SimulationService.UpdateAgent(destination, agent); | 249 | result = UpdateAgent(destination, agent); |
241 | 250 | ||
242 | } | 251 | } |
243 | else if ("AgentPosition".Equals(messageType)) | 252 | else if ("AgentPosition".Equals(messageType)) |
@@ -263,6 +272,12 @@ namespace OpenSim.Server.Handlers.Simulation | |||
263 | //responsedata["str_response_string"] = OSDParser.SerializeJsonString(resp); ??? instead | 272 | //responsedata["str_response_string"] = OSDParser.SerializeJsonString(resp); ??? instead |
264 | } | 273 | } |
265 | 274 | ||
275 | // subclasses cab override this | ||
276 | protected virtual bool UpdateAgent(GridRegion destination, AgentData agent) | ||
277 | { | ||
278 | return m_SimulationService.UpdateAgent(destination, agent); | ||
279 | } | ||
280 | |||
266 | protected virtual void DoAgentGet(Hashtable request, Hashtable responsedata, UUID id, UUID regionID) | 281 | protected virtual void DoAgentGet(Hashtable request, Hashtable responsedata, UUID id, UUID regionID) |
267 | { | 282 | { |
268 | GridRegion destination = new GridRegion(); | 283 | GridRegion destination = new GridRegion(); |
@@ -305,7 +320,7 @@ namespace OpenSim.Server.Handlers.Simulation | |||
305 | } | 320 | } |
306 | } | 321 | } |
307 | 322 | ||
308 | protected virtual void DoAgentDelete(Hashtable request, Hashtable responsedata, UUID id, string action, UUID regionID) | 323 | protected void DoAgentDelete(Hashtable request, Hashtable responsedata, UUID id, string action, UUID regionID) |
309 | { | 324 | { |
310 | m_log.Debug(" >>> DoDelete action:" + action + "; RegionID:" + regionID); | 325 | m_log.Debug(" >>> DoDelete action:" + action + "; RegionID:" + regionID); |
311 | 326 | ||
@@ -313,7 +328,7 @@ namespace OpenSim.Server.Handlers.Simulation | |||
313 | destination.RegionID = regionID; | 328 | destination.RegionID = regionID; |
314 | 329 | ||
315 | if (action.Equals("release")) | 330 | if (action.Equals("release")) |
316 | m_SimulationService.ReleaseAgent(regionID, id, ""); | 331 | ReleaseAgent(regionID, id); |
317 | else | 332 | else |
318 | m_SimulationService.CloseAgent(destination, id); | 333 | m_SimulationService.CloseAgent(destination, id); |
319 | 334 | ||
@@ -322,6 +337,11 @@ namespace OpenSim.Server.Handlers.Simulation | |||
322 | 337 | ||
323 | m_log.Debug("[AGENT HANDLER]: Agent Released/Deleted."); | 338 | m_log.Debug("[AGENT HANDLER]: Agent Released/Deleted."); |
324 | } | 339 | } |
340 | |||
341 | protected virtual void ReleaseAgent(UUID regionID, UUID id) | ||
342 | { | ||
343 | m_SimulationService.ReleaseAgent(regionID, id, ""); | ||
344 | } | ||
325 | } | 345 | } |
326 | 346 | ||
327 | } | 347 | } |
diff --git a/OpenSim/Server/Handlers/Simulation/ObjectHandlers.cs b/OpenSim/Server/Handlers/Simulation/ObjectHandlers.cs index b6eabe3..33e5aa6 100644 --- a/OpenSim/Server/Handlers/Simulation/ObjectHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/ObjectHandlers.cs | |||
@@ -52,6 +52,8 @@ namespace OpenSim.Server.Handlers.Simulation | |||
52 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 52 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
53 | private ISimulationService m_SimulationService; | 53 | private ISimulationService m_SimulationService; |
54 | 54 | ||
55 | public ObjectHandler() { } | ||
56 | |||
55 | public ObjectHandler(ISimulationService sim) | 57 | public ObjectHandler(ISimulationService sim) |
56 | { | 58 | { |
57 | m_SimulationService = sim; | 59 | m_SimulationService = sim; |
@@ -110,7 +112,7 @@ namespace OpenSim.Server.Handlers.Simulation | |||
110 | 112 | ||
111 | } | 113 | } |
112 | 114 | ||
113 | protected virtual void DoObjectPost(Hashtable request, Hashtable responsedata, UUID regionID) | 115 | protected void DoObjectPost(Hashtable request, Hashtable responsedata, UUID regionID) |
114 | { | 116 | { |
115 | OSDMap args = Utils.GetOSDMap((string)request["body"]); | 117 | OSDMap args = Utils.GetOSDMap((string)request["body"]); |
116 | if (args == null) | 118 | if (args == null) |
@@ -181,7 +183,7 @@ namespace OpenSim.Server.Handlers.Simulation | |||
181 | try | 183 | try |
182 | { | 184 | { |
183 | // This is the meaning of POST object | 185 | // This is the meaning of POST object |
184 | result = m_SimulationService.CreateObject(destination, sog, false); | 186 | result = CreateObject(destination, sog); |
185 | } | 187 | } |
186 | catch (Exception e) | 188 | catch (Exception e) |
187 | { | 189 | { |
@@ -192,6 +194,12 @@ namespace OpenSim.Server.Handlers.Simulation | |||
192 | responsedata["str_response_string"] = result.ToString(); | 194 | responsedata["str_response_string"] = result.ToString(); |
193 | } | 195 | } |
194 | 196 | ||
197 | // subclasses can override this | ||
198 | protected virtual bool CreateObject(GridRegion destination, ISceneObject sog) | ||
199 | { | ||
200 | return m_SimulationService.CreateObject(destination, sog, false); | ||
201 | } | ||
202 | |||
195 | protected virtual void DoObjectPut(Hashtable request, Hashtable responsedata, UUID regionID) | 203 | protected virtual void DoObjectPut(Hashtable request, Hashtable responsedata, UUID regionID) |
196 | { | 204 | { |
197 | OSDMap args = Utils.GetOSDMap((string)request["body"]); | 205 | OSDMap args = Utils.GetOSDMap((string)request["body"]); |