diff options
Diffstat (limited to 'OpenSim')
10 files changed, 1014 insertions, 1014 deletions
diff --git a/OpenSim/Framework/Animation.cs b/OpenSim/Framework/Animation.cs index cda8387..6cfedda 100644 --- a/OpenSim/Framework/Animation.cs +++ b/OpenSim/Framework/Animation.cs | |||
@@ -1,94 +1,94 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | 2 | * Copyright (c) Contributors, http://opensimulator.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSim Project nor the | 12 | * * Neither the name of the OpenSim Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 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 | 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 | 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 | 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. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using OpenMetaverse; | 29 | using OpenMetaverse; |
30 | using OpenMetaverse.StructuredData; | 30 | using OpenMetaverse.StructuredData; |
31 | 31 | ||
32 | namespace OpenSim.Framework | 32 | namespace OpenSim.Framework |
33 | { | 33 | { |
34 | [Serializable] | 34 | [Serializable] |
35 | public class Animation | 35 | public class Animation |
36 | { | 36 | { |
37 | private UUID animID; | 37 | private UUID animID; |
38 | public UUID AnimID | 38 | public UUID AnimID |
39 | { | 39 | { |
40 | get { return animID; } | 40 | get { return animID; } |
41 | set { animID = value; } | 41 | set { animID = value; } |
42 | } | 42 | } |
43 | 43 | ||
44 | private int sequenceNum; | 44 | private int sequenceNum; |
45 | public int SequenceNum | 45 | public int SequenceNum |
46 | { | 46 | { |
47 | get { return sequenceNum; } | 47 | get { return sequenceNum; } |
48 | set { sequenceNum = value; } | 48 | set { sequenceNum = value; } |
49 | } | 49 | } |
50 | 50 | ||
51 | private UUID objectID; | 51 | private UUID objectID; |
52 | public UUID ObjectID | 52 | public UUID ObjectID |
53 | { | 53 | { |
54 | get { return objectID; } | 54 | get { return objectID; } |
55 | set { objectID = value; } | 55 | set { objectID = value; } |
56 | } | 56 | } |
57 | 57 | ||
58 | public Animation() | 58 | public Animation() |
59 | { | 59 | { |
60 | } | 60 | } |
61 | 61 | ||
62 | public Animation(UUID animID, int sequenceNum, UUID objectID) | 62 | public Animation(UUID animID, int sequenceNum, UUID objectID) |
63 | { | 63 | { |
64 | this.animID = animID; | 64 | this.animID = animID; |
65 | this.sequenceNum = sequenceNum; | 65 | this.sequenceNum = sequenceNum; |
66 | this.objectID = objectID; | 66 | this.objectID = objectID; |
67 | } | 67 | } |
68 | 68 | ||
69 | public Animation(OSDMap args) | 69 | public Animation(OSDMap args) |
70 | { | 70 | { |
71 | UnpackUpdateMessage(args); | 71 | UnpackUpdateMessage(args); |
72 | } | 72 | } |
73 | 73 | ||
74 | public OSDMap PackUpdateMessage() | 74 | public OSDMap PackUpdateMessage() |
75 | { | 75 | { |
76 | OSDMap anim = new OSDMap(); | 76 | OSDMap anim = new OSDMap(); |
77 | anim["animation"] = OSD.FromUUID(animID); | 77 | anim["animation"] = OSD.FromUUID(animID); |
78 | anim["object_id"] = OSD.FromUUID(objectID); | 78 | anim["object_id"] = OSD.FromUUID(objectID); |
79 | anim["seq_num"] = OSD.FromInteger(sequenceNum); | 79 | anim["seq_num"] = OSD.FromInteger(sequenceNum); |
80 | return anim; | 80 | return anim; |
81 | } | 81 | } |
82 | 82 | ||
83 | public void UnpackUpdateMessage(OSDMap args) | 83 | public void UnpackUpdateMessage(OSDMap args) |
84 | { | 84 | { |
85 | if (args["animation"] != null) | 85 | if (args["animation"] != null) |
86 | animID = args["animation"].AsUUID(); | 86 | animID = args["animation"].AsUUID(); |
87 | if (args["object_id"] != null) | 87 | if (args["object_id"] != null) |
88 | objectID = args["object_id"].AsUUID(); | 88 | objectID = args["object_id"].AsUUID(); |
89 | if (args["seq_num"] != null) | 89 | if (args["seq_num"] != null) |
90 | sequenceNum = args["seq_num"].AsInteger(); | 90 | sequenceNum = args["seq_num"].AsInteger(); |
91 | } | 91 | } |
92 | 92 | ||
93 | } | 93 | } |
94 | } | 94 | } |
diff --git a/OpenSim/Framework/Communications/Clients/RegionClient.cs b/OpenSim/Framework/Communications/Clients/RegionClient.cs index 196bcf9..27353b0 100644 --- a/OpenSim/Framework/Communications/Clients/RegionClient.cs +++ b/OpenSim/Framework/Communications/Clients/RegionClient.cs | |||
@@ -1,631 +1,631 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | 2 | * Copyright (c) Contributors, http://opensimulator.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSim Project nor the | 12 | * * Neither the name of the OpenSim Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 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 | 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 | 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 | 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. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.IO; | 30 | using System.IO; |
31 | using System.Net; | 31 | using System.Net; |
32 | using System.Reflection; | 32 | using System.Reflection; |
33 | using System.Text; | 33 | using System.Text; |
34 | 34 | ||
35 | using OpenMetaverse; | 35 | using OpenMetaverse; |
36 | using OpenMetaverse.StructuredData; | 36 | using OpenMetaverse.StructuredData; |
37 | 37 | ||
38 | using log4net; | 38 | using log4net; |
39 | 39 | ||
40 | namespace OpenSim.Framework.Communications.Clients | 40 | namespace OpenSim.Framework.Communications.Clients |
41 | { | 41 | { |
42 | public class RegionClient | 42 | public class RegionClient |
43 | { | 43 | { |
44 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 44 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
45 | 45 | ||
46 | public bool DoCreateChildAgentCall(RegionInfo region, AgentCircuitData aCircuit) | 46 | public bool DoCreateChildAgentCall(RegionInfo region, AgentCircuitData aCircuit) |
47 | { | 47 | { |
48 | // Eventually, we want to use a caps url instead of the agentID | 48 | // Eventually, we want to use a caps url instead of the agentID |
49 | string uri = "http://" + region.ExternalEndPoint.Address + ":" + region.HttpPort + "/agent/" + aCircuit.AgentID + "/"; | 49 | string uri = "http://" + region.ExternalEndPoint.Address + ":" + region.HttpPort + "/agent/" + aCircuit.AgentID + "/"; |
50 | //Console.WriteLine(" >>> DoCreateChildAgentCall <<< " + uri); | 50 | //Console.WriteLine(" >>> DoCreateChildAgentCall <<< " + uri); |
51 | 51 | ||
52 | HttpWebRequest AgentCreateRequest = (HttpWebRequest)WebRequest.Create(uri); | 52 | HttpWebRequest AgentCreateRequest = (HttpWebRequest)WebRequest.Create(uri); |
53 | AgentCreateRequest.Method = "POST"; | 53 | AgentCreateRequest.Method = "POST"; |
54 | AgentCreateRequest.ContentType = "application/json"; | 54 | AgentCreateRequest.ContentType = "application/json"; |
55 | AgentCreateRequest.Timeout = 10000; | 55 | AgentCreateRequest.Timeout = 10000; |
56 | //AgentCreateRequest.KeepAlive = false; | 56 | //AgentCreateRequest.KeepAlive = false; |
57 | 57 | ||
58 | // Fill it in | 58 | // Fill it in |
59 | OSDMap args = null; | 59 | OSDMap args = null; |
60 | try | 60 | try |
61 | { | 61 | { |
62 | args = aCircuit.PackAgentCircuitData(); | 62 | args = aCircuit.PackAgentCircuitData(); |
63 | } | 63 | } |
64 | catch (Exception e) | 64 | catch (Exception e) |
65 | { | 65 | { |
66 | m_log.Debug("[REST COMMS]: PackAgentCircuitData failed with exception: " + e.Message); | 66 | m_log.Debug("[REST COMMS]: PackAgentCircuitData failed with exception: " + e.Message); |
67 | } | 67 | } |
68 | // Add the regionhandle of the destination region | 68 | // Add the regionhandle of the destination region |
69 | ulong regionHandle = GetRegionHandle(region.RegionHandle); | 69 | ulong regionHandle = GetRegionHandle(region.RegionHandle); |
70 | args["destination_handle"] = OSD.FromString(regionHandle.ToString()); | 70 | args["destination_handle"] = OSD.FromString(regionHandle.ToString()); |
71 | 71 | ||
72 | string strBuffer = ""; | 72 | string strBuffer = ""; |
73 | byte[] buffer = new byte[1]; | 73 | byte[] buffer = new byte[1]; |
74 | try | 74 | try |
75 | { | 75 | { |
76 | strBuffer = OSDParser.SerializeJsonString(args); | 76 | strBuffer = OSDParser.SerializeJsonString(args); |
77 | UTF8Encoding str = new UTF8Encoding(); | 77 | UTF8Encoding str = new UTF8Encoding(); |
78 | buffer = str.GetBytes(strBuffer); | 78 | buffer = str.GetBytes(strBuffer); |
79 | 79 | ||
80 | } | 80 | } |
81 | catch (Exception e) | 81 | catch (Exception e) |
82 | { | 82 | { |
83 | m_log.WarnFormat("[OSG2]: Exception thrown on serialization of ChildCreate: {0}", e.Message); | 83 | m_log.WarnFormat("[OSG2]: Exception thrown on serialization of ChildCreate: {0}", e.Message); |
84 | // ignore. buffer will be empty, caller should check. | 84 | // ignore. buffer will be empty, caller should check. |
85 | } | 85 | } |
86 | 86 | ||
87 | Stream os = null; | 87 | Stream os = null; |
88 | try | 88 | try |
89 | { // send the Post | 89 | { // send the Post |
90 | AgentCreateRequest.ContentLength = buffer.Length; //Count bytes to send | 90 | AgentCreateRequest.ContentLength = buffer.Length; //Count bytes to send |
91 | os = AgentCreateRequest.GetRequestStream(); | 91 | os = AgentCreateRequest.GetRequestStream(); |
92 | os.Write(buffer, 0, strBuffer.Length); //Send it | 92 | os.Write(buffer, 0, strBuffer.Length); //Send it |
93 | os.Close(); | 93 | os.Close(); |
94 | //m_log.InfoFormat("[REST COMMS]: Posted ChildAgentUpdate request to remote sim {0}", uri); | 94 | //m_log.InfoFormat("[REST COMMS]: Posted ChildAgentUpdate request to remote sim {0}", uri); |
95 | } | 95 | } |
96 | //catch (WebException ex) | 96 | //catch (WebException ex) |
97 | catch | 97 | catch |
98 | { | 98 | { |
99 | //m_log.InfoFormat("[REST COMMS]: Bad send on ChildAgentUpdate {0}", ex.Message); | 99 | //m_log.InfoFormat("[REST COMMS]: Bad send on ChildAgentUpdate {0}", ex.Message); |
100 | 100 | ||
101 | return false; | 101 | return false; |
102 | } | 102 | } |
103 | 103 | ||
104 | // Let's wait for the response | 104 | // Let's wait for the response |
105 | //m_log.Info("[REST COMMS]: Waiting for a reply after DoCreateChildAgentCall"); | 105 | //m_log.Info("[REST COMMS]: Waiting for a reply after DoCreateChildAgentCall"); |
106 | 106 | ||
107 | try | 107 | try |
108 | { | 108 | { |
109 | WebResponse webResponse = AgentCreateRequest.GetResponse(); | 109 | WebResponse webResponse = AgentCreateRequest.GetResponse(); |
110 | if (webResponse == null) | 110 | if (webResponse == null) |
111 | { | 111 | { |
112 | m_log.Info("[REST COMMS]: Null reply on DoCreateChildAgentCall post"); | 112 | m_log.Info("[REST COMMS]: Null reply on DoCreateChildAgentCall post"); |
113 | } | 113 | } |
114 | 114 | ||
115 | StreamReader sr = new StreamReader(webResponse.GetResponseStream()); | 115 | StreamReader sr = new StreamReader(webResponse.GetResponseStream()); |
116 | //reply = sr.ReadToEnd().Trim(); | 116 | //reply = sr.ReadToEnd().Trim(); |
117 | sr.ReadToEnd().Trim(); | 117 | sr.ReadToEnd().Trim(); |
118 | sr.Close(); | 118 | sr.Close(); |
119 | //m_log.InfoFormat("[REST COMMS]: DoCreateChildAgentCall reply was {0} ", reply); | 119 | //m_log.InfoFormat("[REST COMMS]: DoCreateChildAgentCall reply was {0} ", reply); |
120 | 120 | ||
121 | } | 121 | } |
122 | catch (WebException ex) | 122 | catch (WebException ex) |
123 | { | 123 | { |
124 | m_log.InfoFormat("[REST COMMS]: exception on reply of DoCreateChildAgentCall {0}", ex.Message); | 124 | m_log.InfoFormat("[REST COMMS]: exception on reply of DoCreateChildAgentCall {0}", ex.Message); |
125 | // ignore, really | 125 | // ignore, really |
126 | } | 126 | } |
127 | 127 | ||
128 | return true; | 128 | return true; |
129 | 129 | ||
130 | } | 130 | } |
131 | 131 | ||
132 | public bool DoChildAgentUpdateCall(RegionInfo region, IAgentData cAgentData) | 132 | public bool DoChildAgentUpdateCall(RegionInfo region, IAgentData cAgentData) |
133 | { | 133 | { |
134 | // Eventually, we want to use a caps url instead of the agentID | 134 | // Eventually, we want to use a caps url instead of the agentID |
135 | string uri = "http://" + region.ExternalEndPoint.Address + ":" + region.HttpPort + "/agent/" + cAgentData.AgentID + "/"; | 135 | string uri = "http://" + region.ExternalEndPoint.Address + ":" + region.HttpPort + "/agent/" + cAgentData.AgentID + "/"; |
136 | //Console.WriteLine(" >>> DoChildAgentUpdateCall <<< " + uri); | 136 | //Console.WriteLine(" >>> DoChildAgentUpdateCall <<< " + uri); |
137 | 137 | ||
138 | HttpWebRequest ChildUpdateRequest = (HttpWebRequest)WebRequest.Create(uri); | 138 | HttpWebRequest ChildUpdateRequest = (HttpWebRequest)WebRequest.Create(uri); |
139 | ChildUpdateRequest.Method = "PUT"; | 139 | ChildUpdateRequest.Method = "PUT"; |
140 | ChildUpdateRequest.ContentType = "application/json"; | 140 | ChildUpdateRequest.ContentType = "application/json"; |
141 | ChildUpdateRequest.Timeout = 10000; | 141 | ChildUpdateRequest.Timeout = 10000; |
142 | //ChildUpdateRequest.KeepAlive = false; | 142 | //ChildUpdateRequest.KeepAlive = false; |
143 | 143 | ||
144 | // Fill it in | 144 | // Fill it in |
145 | OSDMap args = null; | 145 | OSDMap args = null; |
146 | try | 146 | try |
147 | { | 147 | { |
148 | args = cAgentData.Pack(); | 148 | args = cAgentData.Pack(); |
149 | } | 149 | } |
150 | catch (Exception e) | 150 | catch (Exception e) |
151 | { | 151 | { |
152 | m_log.Debug("[REST COMMS]: PackUpdateMessage failed with exception: " + e.Message); | 152 | m_log.Debug("[REST COMMS]: PackUpdateMessage failed with exception: " + e.Message); |
153 | } | 153 | } |
154 | // Add the regionhandle of the destination region | 154 | // Add the regionhandle of the destination region |
155 | ulong regionHandle = GetRegionHandle(region.RegionHandle); | 155 | ulong regionHandle = GetRegionHandle(region.RegionHandle); |
156 | args["destination_handle"] = OSD.FromString(regionHandle.ToString()); | 156 | args["destination_handle"] = OSD.FromString(regionHandle.ToString()); |
157 | 157 | ||
158 | string strBuffer = ""; | 158 | string strBuffer = ""; |
159 | byte[] buffer = new byte[1]; | 159 | byte[] buffer = new byte[1]; |
160 | try | 160 | try |
161 | { | 161 | { |
162 | strBuffer = OSDParser.SerializeJsonString(args); | 162 | strBuffer = OSDParser.SerializeJsonString(args); |
163 | UTF8Encoding str = new UTF8Encoding(); | 163 | UTF8Encoding str = new UTF8Encoding(); |
164 | buffer = str.GetBytes(strBuffer); | 164 | buffer = str.GetBytes(strBuffer); |
165 | 165 | ||
166 | } | 166 | } |
167 | catch (Exception e) | 167 | catch (Exception e) |
168 | { | 168 | { |
169 | m_log.WarnFormat("[REST COMMS]: Exception thrown on serialization of ChildUpdate: {0}", e.Message); | 169 | m_log.WarnFormat("[REST COMMS]: Exception thrown on serialization of ChildUpdate: {0}", e.Message); |
170 | // ignore. buffer will be empty, caller should check. | 170 | // ignore. buffer will be empty, caller should check. |
171 | } | 171 | } |
172 | 172 | ||
173 | Stream os = null; | 173 | Stream os = null; |
174 | try | 174 | try |
175 | { // send the Post | 175 | { // send the Post |
176 | ChildUpdateRequest.ContentLength = buffer.Length; //Count bytes to send | 176 | ChildUpdateRequest.ContentLength = buffer.Length; //Count bytes to send |
177 | os = ChildUpdateRequest.GetRequestStream(); | 177 | os = ChildUpdateRequest.GetRequestStream(); |
178 | os.Write(buffer, 0, strBuffer.Length); //Send it | 178 | os.Write(buffer, 0, strBuffer.Length); //Send it |
179 | os.Close(); | 179 | os.Close(); |
180 | //m_log.InfoFormat("[REST COMMS]: Posted ChildAgentUpdate request to remote sim {0}", uri); | 180 | //m_log.InfoFormat("[REST COMMS]: Posted ChildAgentUpdate request to remote sim {0}", uri); |
181 | } | 181 | } |
182 | //catch (WebException ex) | 182 | //catch (WebException ex) |
183 | catch | 183 | catch |
184 | { | 184 | { |
185 | //m_log.InfoFormat("[REST COMMS]: Bad send on ChildAgentUpdate {0}", ex.Message); | 185 | //m_log.InfoFormat("[REST COMMS]: Bad send on ChildAgentUpdate {0}", ex.Message); |
186 | 186 | ||
187 | return false; | 187 | return false; |
188 | } | 188 | } |
189 | 189 | ||
190 | // Let's wait for the response | 190 | // Let's wait for the response |
191 | //m_log.Info("[REST COMMS]: Waiting for a reply after ChildAgentUpdate"); | 191 | //m_log.Info("[REST COMMS]: Waiting for a reply after ChildAgentUpdate"); |
192 | 192 | ||
193 | try | 193 | try |
194 | { | 194 | { |
195 | WebResponse webResponse = ChildUpdateRequest.GetResponse(); | 195 | WebResponse webResponse = ChildUpdateRequest.GetResponse(); |
196 | if (webResponse == null) | 196 | if (webResponse == null) |
197 | { | 197 | { |
198 | m_log.Info("[REST COMMS]: Null reply on ChilAgentUpdate post"); | 198 | m_log.Info("[REST COMMS]: Null reply on ChilAgentUpdate post"); |
199 | } | 199 | } |
200 | 200 | ||
201 | StreamReader sr = new StreamReader(webResponse.GetResponseStream()); | 201 | StreamReader sr = new StreamReader(webResponse.GetResponseStream()); |
202 | //reply = sr.ReadToEnd().Trim(); | 202 | //reply = sr.ReadToEnd().Trim(); |
203 | sr.ReadToEnd().Trim(); | 203 | sr.ReadToEnd().Trim(); |
204 | sr.Close(); | 204 | sr.Close(); |
205 | //m_log.InfoFormat("[REST COMMS]: ChilAgentUpdate reply was {0} ", reply); | 205 | //m_log.InfoFormat("[REST COMMS]: ChilAgentUpdate reply was {0} ", reply); |
206 | 206 | ||
207 | } | 207 | } |
208 | catch (WebException ex) | 208 | catch (WebException ex) |
209 | { | 209 | { |
210 | m_log.InfoFormat("[REST COMMS]: exception on reply of ChilAgentUpdate {0}", ex.Message); | 210 | m_log.InfoFormat("[REST COMMS]: exception on reply of ChilAgentUpdate {0}", ex.Message); |
211 | // ignore, really | 211 | // ignore, really |
212 | } | 212 | } |
213 | 213 | ||
214 | return true; | 214 | return true; |
215 | } | 215 | } |
216 | 216 | ||
217 | public bool DoRetrieveRootAgentCall(RegionInfo region, UUID id, out IAgentData agent) | 217 | public bool DoRetrieveRootAgentCall(RegionInfo region, UUID id, out IAgentData agent) |
218 | { | 218 | { |
219 | agent = null; | 219 | agent = null; |
220 | // Eventually, we want to use a caps url instead of the agentID | 220 | // Eventually, we want to use a caps url instead of the agentID |
221 | string uri = "http://" + region.ExternalEndPoint.Address + ":" + region.HttpPort + "/agent/" + id + "/" + region.RegionHandle.ToString() + "/"; | 221 | string uri = "http://" + region.ExternalEndPoint.Address + ":" + region.HttpPort + "/agent/" + id + "/" + region.RegionHandle.ToString() + "/"; |
222 | //Console.WriteLine(" >>> DoRetrieveRootAgentCall <<< " + uri); | 222 | //Console.WriteLine(" >>> DoRetrieveRootAgentCall <<< " + uri); |
223 | 223 | ||
224 | HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri); | 224 | HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri); |
225 | request.Method = "GET"; | 225 | request.Method = "GET"; |
226 | request.Timeout = 10000; | 226 | request.Timeout = 10000; |
227 | //request.Headers.Add("authorization", ""); // coming soon | 227 | //request.Headers.Add("authorization", ""); // coming soon |
228 | 228 | ||
229 | HttpWebResponse webResponse = null; | 229 | HttpWebResponse webResponse = null; |
230 | string reply = string.Empty; | 230 | string reply = string.Empty; |
231 | try | 231 | try |
232 | { | 232 | { |
233 | webResponse = (HttpWebResponse)request.GetResponse(); | 233 | webResponse = (HttpWebResponse)request.GetResponse(); |
234 | if (webResponse == null) | 234 | if (webResponse == null) |
235 | { | 235 | { |
236 | m_log.Info("[REST COMMS]: Null reply on agent get "); | 236 | m_log.Info("[REST COMMS]: Null reply on agent get "); |
237 | } | 237 | } |
238 | 238 | ||
239 | StreamReader sr = new StreamReader(webResponse.GetResponseStream()); | 239 | StreamReader sr = new StreamReader(webResponse.GetResponseStream()); |
240 | reply = sr.ReadToEnd().Trim(); | 240 | reply = sr.ReadToEnd().Trim(); |
241 | sr.Close(); | 241 | sr.Close(); |
242 | 242 | ||
243 | //Console.WriteLine("[REST COMMS]: ChilAgentUpdate reply was " + reply); | 243 | //Console.WriteLine("[REST COMMS]: ChilAgentUpdate reply was " + reply); |
244 | 244 | ||
245 | } | 245 | } |
246 | catch (WebException ex) | 246 | catch (WebException ex) |
247 | { | 247 | { |
248 | m_log.InfoFormat("[REST COMMS]: exception on reply of agent get {0}", ex.Message); | 248 | m_log.InfoFormat("[REST COMMS]: exception on reply of agent get {0}", ex.Message); |
249 | // ignore, really | 249 | // ignore, really |
250 | return false; | 250 | return false; |
251 | } | 251 | } |
252 | 252 | ||
253 | if (webResponse.StatusCode == HttpStatusCode.OK) | 253 | if (webResponse.StatusCode == HttpStatusCode.OK) |
254 | { | 254 | { |
255 | // we know it's jason | 255 | // we know it's jason |
256 | OSDMap args = GetOSDMap(reply); | 256 | OSDMap args = GetOSDMap(reply); |
257 | if (args == null) | 257 | if (args == null) |
258 | { | 258 | { |
259 | //Console.WriteLine("[REST COMMS]: Error getting OSDMap from reply"); | 259 | //Console.WriteLine("[REST COMMS]: Error getting OSDMap from reply"); |
260 | return false; | 260 | return false; |
261 | } | 261 | } |
262 | 262 | ||
263 | agent = new CompleteAgentData(); | 263 | agent = new CompleteAgentData(); |
264 | agent.Unpack(args); | 264 | agent.Unpack(args); |
265 | return true; | 265 | return true; |
266 | } | 266 | } |
267 | 267 | ||
268 | //Console.WriteLine("[REST COMMS]: DoRetrieveRootAgentCall returned status " + webResponse.StatusCode); | 268 | //Console.WriteLine("[REST COMMS]: DoRetrieveRootAgentCall returned status " + webResponse.StatusCode); |
269 | return false; | 269 | return false; |
270 | } | 270 | } |
271 | 271 | ||
272 | public bool DoReleaseAgentCall(ulong regionHandle, UUID id, string uri) | 272 | public bool DoReleaseAgentCall(ulong regionHandle, UUID id, string uri) |
273 | { | 273 | { |
274 | //m_log.Debug(" >>> DoReleaseAgentCall <<< " + uri); | 274 | //m_log.Debug(" >>> DoReleaseAgentCall <<< " + uri); |
275 | 275 | ||
276 | WebRequest request = WebRequest.Create(uri); | 276 | WebRequest request = WebRequest.Create(uri); |
277 | request.Method = "DELETE"; | 277 | request.Method = "DELETE"; |
278 | request.Timeout = 10000; | 278 | request.Timeout = 10000; |
279 | 279 | ||
280 | try | 280 | try |
281 | { | 281 | { |
282 | WebResponse webResponse = request.GetResponse(); | 282 | WebResponse webResponse = request.GetResponse(); |
283 | if (webResponse == null) | 283 | if (webResponse == null) |
284 | { | 284 | { |
285 | m_log.Info("[REST COMMS]: Null reply on agent delete "); | 285 | m_log.Info("[REST COMMS]: Null reply on agent delete "); |
286 | } | 286 | } |
287 | 287 | ||
288 | StreamReader sr = new StreamReader(webResponse.GetResponseStream()); | 288 | StreamReader sr = new StreamReader(webResponse.GetResponseStream()); |
289 | //reply = sr.ReadToEnd().Trim(); | 289 | //reply = sr.ReadToEnd().Trim(); |
290 | sr.ReadToEnd().Trim(); | 290 | sr.ReadToEnd().Trim(); |
291 | sr.Close(); | 291 | sr.Close(); |
292 | //m_log.InfoFormat("[REST COMMS]: ChilAgentUpdate reply was {0} ", reply); | 292 | //m_log.InfoFormat("[REST COMMS]: ChilAgentUpdate reply was {0} ", reply); |
293 | 293 | ||
294 | } | 294 | } |
295 | catch (WebException ex) | 295 | catch (WebException ex) |
296 | { | 296 | { |
297 | m_log.InfoFormat("[REST COMMS]: exception on reply of agent delete {0}", ex.Message); | 297 | m_log.InfoFormat("[REST COMMS]: exception on reply of agent delete {0}", ex.Message); |
298 | // ignore, really | 298 | // ignore, really |
299 | } | 299 | } |
300 | 300 | ||
301 | return true; | 301 | return true; |
302 | } | 302 | } |
303 | 303 | ||
304 | 304 | ||
305 | public bool DoCloseAgentCall(RegionInfo region, UUID id) | 305 | public bool DoCloseAgentCall(RegionInfo region, UUID id) |
306 | { | 306 | { |
307 | string uri = "http://" + region.ExternalEndPoint.Address + ":" + region.HttpPort + "/agent/" + id + "/" + region.RegionHandle.ToString() + "/"; | 307 | string uri = "http://" + region.ExternalEndPoint.Address + ":" + region.HttpPort + "/agent/" + id + "/" + region.RegionHandle.ToString() + "/"; |
308 | 308 | ||
309 | //Console.WriteLine(" >>> DoCloseAgentCall <<< " + uri); | 309 | //Console.WriteLine(" >>> DoCloseAgentCall <<< " + uri); |
310 | 310 | ||
311 | WebRequest request = WebRequest.Create(uri); | 311 | WebRequest request = WebRequest.Create(uri); |
312 | request.Method = "DELETE"; | 312 | request.Method = "DELETE"; |
313 | request.Timeout = 10000; | 313 | request.Timeout = 10000; |
314 | 314 | ||
315 | try | 315 | try |
316 | { | 316 | { |
317 | WebResponse webResponse = request.GetResponse(); | 317 | WebResponse webResponse = request.GetResponse(); |
318 | if (webResponse == null) | 318 | if (webResponse == null) |
319 | { | 319 | { |
320 | m_log.Info("[REST COMMS]: Null reply on agent delete "); | 320 | m_log.Info("[REST COMMS]: Null reply on agent delete "); |
321 | } | 321 | } |
322 | 322 | ||
323 | StreamReader sr = new StreamReader(webResponse.GetResponseStream()); | 323 | StreamReader sr = new StreamReader(webResponse.GetResponseStream()); |
324 | //reply = sr.ReadToEnd().Trim(); | 324 | //reply = sr.ReadToEnd().Trim(); |
325 | sr.ReadToEnd().Trim(); | 325 | sr.ReadToEnd().Trim(); |
326 | sr.Close(); | 326 | sr.Close(); |
327 | //m_log.InfoFormat("[REST COMMS]: ChilAgentUpdate reply was {0} ", reply); | 327 | //m_log.InfoFormat("[REST COMMS]: ChilAgentUpdate reply was {0} ", reply); |
328 | 328 | ||
329 | } | 329 | } |
330 | catch (WebException ex) | 330 | catch (WebException ex) |
331 | { | 331 | { |
332 | m_log.InfoFormat("[REST COMMS]: exception on reply of agent delete {0}", ex.Message); | 332 | m_log.InfoFormat("[REST COMMS]: exception on reply of agent delete {0}", ex.Message); |
333 | // ignore, really | 333 | // ignore, really |
334 | } | 334 | } |
335 | 335 | ||
336 | return true; | 336 | return true; |
337 | } | 337 | } |
338 | 338 | ||
339 | public bool DoCreateObjectCall(RegionInfo region, ISceneObject sog, bool allowScriptCrossing) | 339 | public bool DoCreateObjectCall(RegionInfo region, ISceneObject sog, bool allowScriptCrossing) |
340 | { | 340 | { |
341 | ulong regionHandle = GetRegionHandle(region.RegionHandle); | 341 | ulong regionHandle = GetRegionHandle(region.RegionHandle); |
342 | string uri = "http://" + region.ExternalEndPoint.Address + ":" + region.HttpPort + "/object/" + sog.UUID + "/" + regionHandle.ToString() + "/"; | 342 | string uri = "http://" + region.ExternalEndPoint.Address + ":" + region.HttpPort + "/object/" + sog.UUID + "/" + regionHandle.ToString() + "/"; |
343 | //m_log.Debug(" >>> DoCreateChildAgentCall <<< " + uri); | 343 | //m_log.Debug(" >>> DoCreateChildAgentCall <<< " + uri); |
344 | 344 | ||
345 | WebRequest ObjectCreateRequest = WebRequest.Create(uri); | 345 | WebRequest ObjectCreateRequest = WebRequest.Create(uri); |
346 | ObjectCreateRequest.Method = "POST"; | 346 | ObjectCreateRequest.Method = "POST"; |
347 | ObjectCreateRequest.ContentType = "application/json"; | 347 | ObjectCreateRequest.ContentType = "application/json"; |
348 | ObjectCreateRequest.Timeout = 10000; | 348 | ObjectCreateRequest.Timeout = 10000; |
349 | 349 | ||
350 | OSDMap args = new OSDMap(2); | 350 | OSDMap args = new OSDMap(2); |
351 | args["sog"] = OSD.FromString(sog.ToXmlString2()); | 351 | args["sog"] = OSD.FromString(sog.ToXmlString2()); |
352 | args["extra"] = OSD.FromString(sog.ExtraToXmlString()); | 352 | args["extra"] = OSD.FromString(sog.ExtraToXmlString()); |
353 | if (allowScriptCrossing) | 353 | if (allowScriptCrossing) |
354 | { | 354 | { |
355 | string state = sog.GetStateSnapshot(); | 355 | string state = sog.GetStateSnapshot(); |
356 | if (state.Length > 0) | 356 | if (state.Length > 0) |
357 | args["state"] = OSD.FromString(state); | 357 | args["state"] = OSD.FromString(state); |
358 | } | 358 | } |
359 | 359 | ||
360 | string strBuffer = ""; | 360 | string strBuffer = ""; |
361 | byte[] buffer = new byte[1]; | 361 | byte[] buffer = new byte[1]; |
362 | try | 362 | try |
363 | { | 363 | { |
364 | strBuffer = OSDParser.SerializeJsonString(args); | 364 | strBuffer = OSDParser.SerializeJsonString(args); |
365 | UTF8Encoding str = new UTF8Encoding(); | 365 | UTF8Encoding str = new UTF8Encoding(); |
366 | buffer = str.GetBytes(strBuffer); | 366 | buffer = str.GetBytes(strBuffer); |
367 | 367 | ||
368 | } | 368 | } |
369 | catch (Exception e) | 369 | catch (Exception e) |
370 | { | 370 | { |
371 | m_log.WarnFormat("[REST COMMS]: Exception thrown on serialization of CreateObject: {0}", e.Message); | 371 | m_log.WarnFormat("[REST COMMS]: Exception thrown on serialization of CreateObject: {0}", e.Message); |
372 | // ignore. buffer will be empty, caller should check. | 372 | // ignore. buffer will be empty, caller should check. |
373 | } | 373 | } |
374 | 374 | ||
375 | Stream os = null; | 375 | Stream os = null; |
376 | try | 376 | try |
377 | { // send the Post | 377 | { // send the Post |
378 | ObjectCreateRequest.ContentLength = buffer.Length; //Count bytes to send | 378 | ObjectCreateRequest.ContentLength = buffer.Length; //Count bytes to send |
379 | os = ObjectCreateRequest.GetRequestStream(); | 379 | os = ObjectCreateRequest.GetRequestStream(); |
380 | os.Write(buffer, 0, strBuffer.Length); //Send it | 380 | os.Write(buffer, 0, strBuffer.Length); //Send it |
381 | os.Close(); | 381 | os.Close(); |
382 | m_log.InfoFormat("[REST COMMS]: Posted ChildAgentUpdate request to remote sim {0}", uri); | 382 | m_log.InfoFormat("[REST COMMS]: Posted ChildAgentUpdate request to remote sim {0}", uri); |
383 | } | 383 | } |
384 | //catch (WebException ex) | 384 | //catch (WebException ex) |
385 | catch | 385 | catch |
386 | { | 386 | { |
387 | // m_log.InfoFormat("[REST COMMS]: Bad send on CreateObject {0}", ex.Message); | 387 | // m_log.InfoFormat("[REST COMMS]: Bad send on CreateObject {0}", ex.Message); |
388 | 388 | ||
389 | return false; | 389 | return false; |
390 | } | 390 | } |
391 | 391 | ||
392 | // Let's wait for the response | 392 | // Let's wait for the response |
393 | //m_log.Info("[REST COMMS]: Waiting for a reply after DoCreateChildAgentCall"); | 393 | //m_log.Info("[REST COMMS]: Waiting for a reply after DoCreateChildAgentCall"); |
394 | 394 | ||
395 | try | 395 | try |
396 | { | 396 | { |
397 | WebResponse webResponse = ObjectCreateRequest.GetResponse(); | 397 | WebResponse webResponse = ObjectCreateRequest.GetResponse(); |
398 | if (webResponse == null) | 398 | if (webResponse == null) |
399 | { | 399 | { |
400 | m_log.Info("[REST COMMS]: Null reply on DoCreateObjectCall post"); | 400 | m_log.Info("[REST COMMS]: Null reply on DoCreateObjectCall post"); |
401 | } | 401 | } |
402 | 402 | ||
403 | StreamReader sr = new StreamReader(webResponse.GetResponseStream()); | 403 | StreamReader sr = new StreamReader(webResponse.GetResponseStream()); |
404 | //reply = sr.ReadToEnd().Trim(); | 404 | //reply = sr.ReadToEnd().Trim(); |
405 | sr.ReadToEnd().Trim(); | 405 | sr.ReadToEnd().Trim(); |
406 | sr.Close(); | 406 | sr.Close(); |
407 | //m_log.InfoFormat("[REST COMMS]: DoCreateChildAgentCall reply was {0} ", reply); | 407 | //m_log.InfoFormat("[REST COMMS]: DoCreateChildAgentCall reply was {0} ", reply); |
408 | 408 | ||
409 | } | 409 | } |
410 | catch (WebException ex) | 410 | catch (WebException ex) |
411 | { | 411 | { |
412 | m_log.InfoFormat("[REST COMMS]: exception on reply of DoCreateObjectCall {0}", ex.Message); | 412 | m_log.InfoFormat("[REST COMMS]: exception on reply of DoCreateObjectCall {0}", ex.Message); |
413 | // ignore, really | 413 | // ignore, really |
414 | } | 414 | } |
415 | 415 | ||
416 | return true; | 416 | return true; |
417 | 417 | ||
418 | } | 418 | } |
419 | 419 | ||
420 | public bool DoCreateObjectCall(RegionInfo region, UUID userID, UUID itemID) | 420 | public bool DoCreateObjectCall(RegionInfo region, UUID userID, UUID itemID) |
421 | { | 421 | { |
422 | ulong regionHandle = GetRegionHandle(region.RegionHandle); | 422 | ulong regionHandle = GetRegionHandle(region.RegionHandle); |
423 | string uri = "http://" + region.ExternalEndPoint.Address + ":" + region.HttpPort + "/object/" + UUID.Zero + "/" + regionHandle.ToString() + "/"; | 423 | string uri = "http://" + region.ExternalEndPoint.Address + ":" + region.HttpPort + "/object/" + UUID.Zero + "/" + regionHandle.ToString() + "/"; |
424 | //m_log.Debug(" >>> DoCreateChildAgentCall <<< " + uri); | 424 | //m_log.Debug(" >>> DoCreateChildAgentCall <<< " + uri); |
425 | 425 | ||
426 | WebRequest ObjectCreateRequest = WebRequest.Create(uri); | 426 | WebRequest ObjectCreateRequest = WebRequest.Create(uri); |
427 | ObjectCreateRequest.Method = "PUT"; | 427 | ObjectCreateRequest.Method = "PUT"; |
428 | ObjectCreateRequest.ContentType = "application/json"; | 428 | ObjectCreateRequest.ContentType = "application/json"; |
429 | ObjectCreateRequest.Timeout = 10000; | 429 | ObjectCreateRequest.Timeout = 10000; |
430 | 430 | ||
431 | OSDMap args = new OSDMap(2); | 431 | OSDMap args = new OSDMap(2); |
432 | args["userid"] = OSD.FromUUID(userID); | 432 | args["userid"] = OSD.FromUUID(userID); |
433 | args["itemid"] = OSD.FromUUID(itemID); | 433 | args["itemid"] = OSD.FromUUID(itemID); |
434 | 434 | ||
435 | string strBuffer = ""; | 435 | string strBuffer = ""; |
436 | byte[] buffer = new byte[1]; | 436 | byte[] buffer = new byte[1]; |
437 | try | 437 | try |
438 | { | 438 | { |
439 | strBuffer = OSDParser.SerializeJsonString(args); | 439 | strBuffer = OSDParser.SerializeJsonString(args); |
440 | UTF8Encoding str = new UTF8Encoding(); | 440 | UTF8Encoding str = new UTF8Encoding(); |
441 | buffer = str.GetBytes(strBuffer); | 441 | buffer = str.GetBytes(strBuffer); |
442 | 442 | ||
443 | } | 443 | } |
444 | catch (Exception e) | 444 | catch (Exception e) |
445 | { | 445 | { |
446 | m_log.WarnFormat("[REST COMMS]: Exception thrown on serialization of CreateObject: {0}", e.Message); | 446 | m_log.WarnFormat("[REST COMMS]: Exception thrown on serialization of CreateObject: {0}", e.Message); |
447 | // ignore. buffer will be empty, caller should check. | 447 | // ignore. buffer will be empty, caller should check. |
448 | } | 448 | } |
449 | 449 | ||
450 | Stream os = null; | 450 | Stream os = null; |
451 | try | 451 | try |
452 | { // send the Post | 452 | { // send the Post |
453 | ObjectCreateRequest.ContentLength = buffer.Length; //Count bytes to send | 453 | ObjectCreateRequest.ContentLength = buffer.Length; //Count bytes to send |
454 | os = ObjectCreateRequest.GetRequestStream(); | 454 | os = ObjectCreateRequest.GetRequestStream(); |
455 | os.Write(buffer, 0, strBuffer.Length); //Send it | 455 | os.Write(buffer, 0, strBuffer.Length); //Send it |
456 | os.Close(); | 456 | os.Close(); |
457 | //m_log.InfoFormat("[REST COMMS]: Posted CreateObject request to remote sim {0}", uri); | 457 | //m_log.InfoFormat("[REST COMMS]: Posted CreateObject request to remote sim {0}", uri); |
458 | } | 458 | } |
459 | //catch (WebException ex) | 459 | //catch (WebException ex) |
460 | catch | 460 | catch |
461 | { | 461 | { |
462 | // m_log.InfoFormat("[REST COMMS]: Bad send on CreateObject {0}", ex.Message); | 462 | // m_log.InfoFormat("[REST COMMS]: Bad send on CreateObject {0}", ex.Message); |
463 | 463 | ||
464 | return false; | 464 | return false; |
465 | } | 465 | } |
466 | 466 | ||
467 | // Let's wait for the response | 467 | // Let's wait for the response |
468 | //m_log.Info("[REST COMMS]: Waiting for a reply after DoCreateChildAgentCall"); | 468 | //m_log.Info("[REST COMMS]: Waiting for a reply after DoCreateChildAgentCall"); |
469 | 469 | ||
470 | try | 470 | try |
471 | { | 471 | { |
472 | WebResponse webResponse = ObjectCreateRequest.GetResponse(); | 472 | WebResponse webResponse = ObjectCreateRequest.GetResponse(); |
473 | if (webResponse == null) | 473 | if (webResponse == null) |
474 | { | 474 | { |
475 | m_log.Info("[REST COMMS]: Null reply on DoCreateObjectCall post"); | 475 | m_log.Info("[REST COMMS]: Null reply on DoCreateObjectCall post"); |
476 | } | 476 | } |
477 | 477 | ||
478 | StreamReader sr = new StreamReader(webResponse.GetResponseStream()); | 478 | StreamReader sr = new StreamReader(webResponse.GetResponseStream()); |
479 | sr.ReadToEnd().Trim(); | 479 | sr.ReadToEnd().Trim(); |
480 | sr.ReadToEnd().Trim(); | 480 | sr.ReadToEnd().Trim(); |
481 | sr.Close(); | 481 | sr.Close(); |
482 | 482 | ||
483 | //m_log.InfoFormat("[REST COMMS]: DoCreateChildAgentCall reply was {0} ", reply); | 483 | //m_log.InfoFormat("[REST COMMS]: DoCreateChildAgentCall reply was {0} ", reply); |
484 | 484 | ||
485 | } | 485 | } |
486 | catch (WebException ex) | 486 | catch (WebException ex) |
487 | { | 487 | { |
488 | m_log.InfoFormat("[REST COMMS]: exception on reply of DoCreateObjectCall {0}", ex.Message); | 488 | m_log.InfoFormat("[REST COMMS]: exception on reply of DoCreateObjectCall {0}", ex.Message); |
489 | // ignore, really | 489 | // ignore, really |
490 | } | 490 | } |
491 | 491 | ||
492 | return true; | 492 | return true; |
493 | 493 | ||
494 | } | 494 | } |
495 | 495 | ||
496 | public bool DoHelloNeighbourCall(RegionInfo region, RegionInfo thisRegion) | 496 | public bool DoHelloNeighbourCall(RegionInfo region, RegionInfo thisRegion) |
497 | { | 497 | { |
498 | string uri = "http://" + region.ExternalEndPoint.Address + ":" + region.HttpPort + "/region/" + thisRegion.RegionID + "/"; | 498 | string uri = "http://" + region.ExternalEndPoint.Address + ":" + region.HttpPort + "/region/" + thisRegion.RegionID + "/"; |
499 | //m_log.Debug(" >>> DoHelloNeighbourCall <<< " + uri); | 499 | //m_log.Debug(" >>> DoHelloNeighbourCall <<< " + uri); |
500 | 500 | ||
501 | WebRequest HelloNeighbourRequest = WebRequest.Create(uri); | 501 | WebRequest HelloNeighbourRequest = WebRequest.Create(uri); |
502 | HelloNeighbourRequest.Method = "POST"; | 502 | HelloNeighbourRequest.Method = "POST"; |
503 | HelloNeighbourRequest.ContentType = "application/json"; | 503 | HelloNeighbourRequest.ContentType = "application/json"; |
504 | HelloNeighbourRequest.Timeout = 10000; | 504 | HelloNeighbourRequest.Timeout = 10000; |
505 | 505 | ||
506 | // Fill it in | 506 | // Fill it in |
507 | OSDMap args = null; | 507 | OSDMap args = null; |
508 | try | 508 | try |
509 | { | 509 | { |
510 | args = thisRegion.PackRegionInfoData(); | 510 | args = thisRegion.PackRegionInfoData(); |
511 | } | 511 | } |
512 | catch (Exception e) | 512 | catch (Exception e) |
513 | { | 513 | { |
514 | m_log.Debug("[REST COMMS]: PackRegionInfoData failed with exception: " + e.Message); | 514 | m_log.Debug("[REST COMMS]: PackRegionInfoData failed with exception: " + e.Message); |
515 | } | 515 | } |
516 | // Add the regionhandle of the destination region | 516 | // Add the regionhandle of the destination region |
517 | ulong regionHandle = GetRegionHandle(region.RegionHandle); | 517 | ulong regionHandle = GetRegionHandle(region.RegionHandle); |
518 | args["destination_handle"] = OSD.FromString(regionHandle.ToString()); | 518 | args["destination_handle"] = OSD.FromString(regionHandle.ToString()); |
519 | 519 | ||
520 | string strBuffer = ""; | 520 | string strBuffer = ""; |
521 | byte[] buffer = new byte[1]; | 521 | byte[] buffer = new byte[1]; |
522 | try | 522 | try |
523 | { | 523 | { |
524 | strBuffer = OSDParser.SerializeJsonString(args); | 524 | strBuffer = OSDParser.SerializeJsonString(args); |
525 | UTF8Encoding str = new UTF8Encoding(); | 525 | UTF8Encoding str = new UTF8Encoding(); |
526 | buffer = str.GetBytes(strBuffer); | 526 | buffer = str.GetBytes(strBuffer); |
527 | 527 | ||
528 | } | 528 | } |
529 | catch (Exception e) | 529 | catch (Exception e) |
530 | { | 530 | { |
531 | m_log.WarnFormat("[REST COMMS]: Exception thrown on serialization of HelloNeighbour: {0}", e.Message); | 531 | m_log.WarnFormat("[REST COMMS]: Exception thrown on serialization of HelloNeighbour: {0}", e.Message); |
532 | // ignore. buffer will be empty, caller should check. | 532 | // ignore. buffer will be empty, caller should check. |
533 | } | 533 | } |
534 | 534 | ||
535 | Stream os = null; | 535 | Stream os = null; |
536 | try | 536 | try |
537 | { // send the Post | 537 | { // send the Post |
538 | HelloNeighbourRequest.ContentLength = buffer.Length; //Count bytes to send | 538 | HelloNeighbourRequest.ContentLength = buffer.Length; //Count bytes to send |
539 | os = HelloNeighbourRequest.GetRequestStream(); | 539 | os = HelloNeighbourRequest.GetRequestStream(); |
540 | os.Write(buffer, 0, strBuffer.Length); //Send it | 540 | os.Write(buffer, 0, strBuffer.Length); //Send it |
541 | os.Close(); | 541 | os.Close(); |
542 | //m_log.InfoFormat("[REST COMMS]: Posted HelloNeighbour request to remote sim {0}", uri); | 542 | //m_log.InfoFormat("[REST COMMS]: Posted HelloNeighbour request to remote sim {0}", uri); |
543 | } | 543 | } |
544 | //catch (WebException ex) | 544 | //catch (WebException ex) |
545 | catch | 545 | catch |
546 | { | 546 | { |
547 | //m_log.InfoFormat("[REST COMMS]: Bad send on HelloNeighbour {0}", ex.Message); | 547 | //m_log.InfoFormat("[REST COMMS]: Bad send on HelloNeighbour {0}", ex.Message); |
548 | 548 | ||
549 | return false; | 549 | return false; |
550 | } | 550 | } |
551 | 551 | ||
552 | // Let's wait for the response | 552 | // Let's wait for the response |
553 | //m_log.Info("[REST COMMS]: Waiting for a reply after DoHelloNeighbourCall"); | 553 | //m_log.Info("[REST COMMS]: Waiting for a reply after DoHelloNeighbourCall"); |
554 | 554 | ||
555 | try | 555 | try |
556 | { | 556 | { |
557 | WebResponse webResponse = HelloNeighbourRequest.GetResponse(); | 557 | WebResponse webResponse = HelloNeighbourRequest.GetResponse(); |
558 | if (webResponse == null) | 558 | if (webResponse == null) |
559 | { | 559 | { |
560 | m_log.Info("[REST COMMS]: Null reply on DoHelloNeighbourCall post"); | 560 | m_log.Info("[REST COMMS]: Null reply on DoHelloNeighbourCall post"); |
561 | } | 561 | } |
562 | 562 | ||
563 | StreamReader sr = new StreamReader(webResponse.GetResponseStream()); | 563 | StreamReader sr = new StreamReader(webResponse.GetResponseStream()); |
564 | //reply = sr.ReadToEnd().Trim(); | 564 | //reply = sr.ReadToEnd().Trim(); |
565 | sr.ReadToEnd().Trim(); | 565 | sr.ReadToEnd().Trim(); |
566 | sr.Close(); | 566 | sr.Close(); |
567 | //m_log.InfoFormat("[REST COMMS]: DoHelloNeighbourCall reply was {0} ", reply); | 567 | //m_log.InfoFormat("[REST COMMS]: DoHelloNeighbourCall reply was {0} ", reply); |
568 | 568 | ||
569 | } | 569 | } |
570 | catch (WebException ex) | 570 | catch (WebException ex) |
571 | { | 571 | { |
572 | m_log.InfoFormat("[REST COMMS]: exception on reply of DoHelloNeighbourCall {0}", ex.Message); | 572 | m_log.InfoFormat("[REST COMMS]: exception on reply of DoHelloNeighbourCall {0}", ex.Message); |
573 | // ignore, really | 573 | // ignore, really |
574 | } | 574 | } |
575 | 575 | ||
576 | return true; | 576 | return true; |
577 | 577 | ||
578 | } | 578 | } |
579 | 579 | ||
580 | #region Hyperlinks | 580 | #region Hyperlinks |
581 | 581 | ||
582 | public virtual ulong GetRegionHandle(ulong handle) | 582 | public virtual ulong GetRegionHandle(ulong handle) |
583 | { | 583 | { |
584 | return handle; | 584 | return handle; |
585 | } | 585 | } |
586 | 586 | ||
587 | public virtual bool IsHyperlink(ulong handle) | 587 | public virtual bool IsHyperlink(ulong handle) |
588 | { | 588 | { |
589 | return false; | 589 | return false; |
590 | } | 590 | } |
591 | 591 | ||
592 | public virtual void SendUserInformation(RegionInfo regInfo, AgentCircuitData aCircuit) | 592 | public virtual void SendUserInformation(RegionInfo regInfo, AgentCircuitData aCircuit) |
593 | { | 593 | { |
594 | } | 594 | } |
595 | 595 | ||
596 | public virtual void AdjustUserInformation(AgentCircuitData aCircuit) | 596 | public virtual void AdjustUserInformation(AgentCircuitData aCircuit) |
597 | { | 597 | { |
598 | } | 598 | } |
599 | 599 | ||
600 | #endregion /* Hyperlinks */ | 600 | #endregion /* Hyperlinks */ |
601 | 601 | ||
602 | public static OSDMap GetOSDMap(string data) | 602 | public static OSDMap GetOSDMap(string data) |
603 | { | 603 | { |
604 | OSDMap args = null; | 604 | OSDMap args = null; |
605 | try | 605 | try |
606 | { | 606 | { |
607 | OSD buffer; | 607 | OSD buffer; |
608 | // We should pay attention to the content-type, but let's assume we know it's Json | 608 | // We should pay attention to the content-type, but let's assume we know it's Json |
609 | buffer = OSDParser.DeserializeJson(data); | 609 | buffer = OSDParser.DeserializeJson(data); |
610 | if (buffer.Type == OSDType.Map) | 610 | if (buffer.Type == OSDType.Map) |
611 | { | 611 | { |
612 | args = (OSDMap)buffer; | 612 | args = (OSDMap)buffer; |
613 | return args; | 613 | return args; |
614 | } | 614 | } |
615 | else | 615 | else |
616 | { | 616 | { |
617 | // uh? | 617 | // uh? |
618 | System.Console.WriteLine("[REST COMMS]: Got OSD of type " + buffer.Type.ToString()); | 618 | System.Console.WriteLine("[REST COMMS]: Got OSD of type " + buffer.Type.ToString()); |
619 | return null; | 619 | return null; |
620 | } | 620 | } |
621 | } | 621 | } |
622 | catch (Exception ex) | 622 | catch (Exception ex) |
623 | { | 623 | { |
624 | System.Console.WriteLine("[REST COMMS]: exception on parse of REST message " + ex.Message); | 624 | System.Console.WriteLine("[REST COMMS]: exception on parse of REST message " + ex.Message); |
625 | return null; | 625 | return null; |
626 | } | 626 | } |
627 | } | 627 | } |
628 | 628 | ||
629 | 629 | ||
630 | } | 630 | } |
631 | } | 631 | } |
diff --git a/OpenSim/Framework/ISceneObject.cs b/OpenSim/Framework/ISceneObject.cs index 87dcc2d..c327b05 100644 --- a/OpenSim/Framework/ISceneObject.cs +++ b/OpenSim/Framework/ISceneObject.cs | |||
@@ -1,42 +1,42 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | 2 | * Copyright (c) Contributors, http://opensimulator.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSimulator Project nor the | 12 | * * Neither the name of the OpenSimulator Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 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 | 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 | 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 | 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. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | using OpenMetaverse; | 28 | using OpenMetaverse; |
29 | 29 | ||
30 | namespace OpenSim.Framework | 30 | namespace OpenSim.Framework |
31 | { | 31 | { |
32 | public interface ISceneObject | 32 | public interface ISceneObject |
33 | { | 33 | { |
34 | UUID UUID { get; } | 34 | UUID UUID { get; } |
35 | ISceneObject CloneForNewScene(); | 35 | ISceneObject CloneForNewScene(); |
36 | string ToXmlString2(); | 36 | string ToXmlString2(); |
37 | string ExtraToXmlString(); | 37 | string ExtraToXmlString(); |
38 | void ExtraFromXmlString(string xmlstr); | 38 | void ExtraFromXmlString(string xmlstr); |
39 | string GetStateSnapshot(); | 39 | string GetStateSnapshot(); |
40 | void SetState(string xmlstr, UUID regionID); | 40 | void SetState(string xmlstr, UUID regionID); |
41 | } | 41 | } |
42 | } | 42 | } |
diff --git a/OpenSim/Region/OptionalModules/Autooar/AutooarModule.cs b/OpenSim/Region/OptionalModules/Autooar/AutooarModule.cs index 6c10928..580c8e1 100644 --- a/OpenSim/Region/OptionalModules/Autooar/AutooarModule.cs +++ b/OpenSim/Region/OptionalModules/Autooar/AutooarModule.cs | |||
@@ -1,72 +1,72 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using System.IO; | 3 | using System.IO; |
4 | using System.Text; | 4 | using System.Text; |
5 | using System.Timers; | 5 | using System.Timers; |
6 | using Nini.Config; | 6 | using Nini.Config; |
7 | using OpenSim.Region.Framework.Interfaces; | 7 | using OpenSim.Region.Framework.Interfaces; |
8 | using OpenSim.Region.Framework.Scenes; | 8 | using OpenSim.Region.Framework.Scenes; |
9 | 9 | ||
10 | namespace OpenSim.Region.OptionalModules.Autooar | 10 | namespace OpenSim.Region.OptionalModules.Autooar |
11 | { | 11 | { |
12 | public class AutooarModule : IRegionModule | 12 | public class AutooarModule : IRegionModule |
13 | { | 13 | { |
14 | private readonly Timer m_timer = new Timer(60000*20); | 14 | private readonly Timer m_timer = new Timer(60000*20); |
15 | private readonly List<Scene> m_scenes = new List<Scene>(); | 15 | private readonly List<Scene> m_scenes = new List<Scene>(); |
16 | private IConfigSource config; | 16 | private IConfigSource config; |
17 | private bool m_enabled = false; | 17 | private bool m_enabled = false; |
18 | 18 | ||
19 | 19 | ||
20 | public void Initialise(Scene scene, IConfigSource source) | 20 | public void Initialise(Scene scene, IConfigSource source) |
21 | { | 21 | { |
22 | m_scenes.Add(scene); | 22 | m_scenes.Add(scene); |
23 | config = source; | 23 | config = source; |
24 | } | 24 | } |
25 | 25 | ||
26 | public void PostInitialise() | 26 | public void PostInitialise() |
27 | { | 27 | { |
28 | if(config.Configs["autooar"] != null) | 28 | if(config.Configs["autooar"] != null) |
29 | { | 29 | { |
30 | m_enabled = config.Configs["autooar"].GetBoolean("Enabled", m_enabled); | 30 | m_enabled = config.Configs["autooar"].GetBoolean("Enabled", m_enabled); |
31 | } | 31 | } |
32 | 32 | ||
33 | if(m_enabled) | 33 | if(m_enabled) |
34 | { | 34 | { |
35 | m_timer.Elapsed += m_timer_Elapsed; | 35 | m_timer.Elapsed += m_timer_Elapsed; |
36 | m_timer.AutoReset = true; | 36 | m_timer.AutoReset = true; |
37 | m_timer.Start(); | 37 | m_timer.Start(); |
38 | } | 38 | } |
39 | } | 39 | } |
40 | 40 | ||
41 | void m_timer_Elapsed(object sender, ElapsedEventArgs e) | 41 | void m_timer_Elapsed(object sender, ElapsedEventArgs e) |
42 | { | 42 | { |
43 | if (!Directory.Exists("autooars")) | 43 | if (!Directory.Exists("autooars")) |
44 | Directory.CreateDirectory("autooars"); | 44 | Directory.CreateDirectory("autooars"); |
45 | 45 | ||
46 | foreach (Scene scene in m_scenes) | 46 | foreach (Scene scene in m_scenes) |
47 | { | 47 | { |
48 | IRegionArchiverModule archiver = scene.RequestModuleInterface<IRegionArchiverModule>(); | 48 | IRegionArchiverModule archiver = scene.RequestModuleInterface<IRegionArchiverModule>(); |
49 | 49 | ||
50 | archiver.ArchiveRegion(Path.Combine("autooars", | 50 | archiver.ArchiveRegion(Path.Combine("autooars", |
51 | scene.RegionInfo.RegionName + "_" + scene.RegionInfo.RegionLocX + | 51 | scene.RegionInfo.RegionName + "_" + scene.RegionInfo.RegionLocX + |
52 | "x" + scene.RegionInfo.RegionLocY + ".oar.tar.gz")); | 52 | "x" + scene.RegionInfo.RegionLocY + ".oar.tar.gz")); |
53 | } | 53 | } |
54 | } | 54 | } |
55 | 55 | ||
56 | public void Close() | 56 | public void Close() |
57 | { | 57 | { |
58 | if (m_timer.Enabled) | 58 | if (m_timer.Enabled) |
59 | m_timer.Stop(); | 59 | m_timer.Stop(); |
60 | } | 60 | } |
61 | 61 | ||
62 | public string Name | 62 | public string Name |
63 | { | 63 | { |
64 | get { return "Automatic OAR Module"; } | 64 | get { return "Automatic OAR Module"; } |
65 | } | 65 | } |
66 | 66 | ||
67 | public bool IsSharedModule | 67 | public bool IsSharedModule |
68 | { | 68 | { |
69 | get { return true; } | 69 | get { return true; } |
70 | } | 70 | } |
71 | } | 71 | } |
72 | } | 72 | } |
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/IParcel.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/IParcel.cs index 2a973a9..2849f16 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/IParcel.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/IParcel.cs | |||
@@ -1,15 +1,15 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using System.Text; | 3 | using System.Text; |
4 | using OpenMetaverse; | 4 | using OpenMetaverse; |
5 | 5 | ||
6 | namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | 6 | namespace OpenSim.Region.OptionalModules.Scripting.Minimodule |
7 | { | 7 | { |
8 | public interface IParcel | 8 | public interface IParcel |
9 | { | 9 | { |
10 | string Name { get; set; } | 10 | string Name { get; set; } |
11 | string Description { get; set; } | 11 | string Description { get; set; } |
12 | ISocialEntity Owner { get; set; } | 12 | ISocialEntity Owner { get; set; } |
13 | bool[,] Bitmap { get; } | 13 | bool[,] Bitmap { get; } |
14 | } | 14 | } |
15 | } | 15 | } |
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/IPersistence.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/IPersistence.cs index e433c11..c093880 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/IPersistence.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/IPersistence.cs | |||
@@ -1,29 +1,29 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using System.Text; | 3 | using System.Text; |
4 | 4 | ||
5 | namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | 5 | namespace OpenSim.Region.OptionalModules.Scripting.Minimodule |
6 | { | 6 | { |
7 | interface IPersistence | 7 | interface IPersistence |
8 | { | 8 | { |
9 | T Get<T>(Guid storageID); | 9 | T Get<T>(Guid storageID); |
10 | T Get<T>(); | 10 | T Get<T>(); |
11 | 11 | ||
12 | /// <summary> | 12 | /// <summary> |
13 | /// Stores 'data' into the persistence system | 13 | /// Stores 'data' into the persistence system |
14 | /// associated with this object, however saved | 14 | /// associated with this object, however saved |
15 | /// under the ID 'storageID'. This data may | 15 | /// under the ID 'storageID'. This data may |
16 | /// be accessed by other scripts however. | 16 | /// be accessed by other scripts however. |
17 | /// </summary> | 17 | /// </summary> |
18 | /// <param name="storageID"></param> | 18 | /// <param name="storageID"></param> |
19 | /// <param name="data"></param> | 19 | /// <param name="data"></param> |
20 | void Put<T>(Guid storageID, T data); | 20 | void Put<T>(Guid storageID, T data); |
21 | 21 | ||
22 | /// <summary> | 22 | /// <summary> |
23 | /// Stores 'data' into the persistence system | 23 | /// Stores 'data' into the persistence system |
24 | /// using the default ID for this script. | 24 | /// using the default ID for this script. |
25 | /// </summary> | 25 | /// </summary> |
26 | /// <param name="data"></param> | 26 | /// <param name="data"></param> |
27 | void Put<T>(T data); | 27 | void Put<T>(T data); |
28 | } | 28 | } |
29 | } | 29 | } |
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/ISocialEntity.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/ISocialEntity.cs index 0833ffd..cc664eb 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/ISocialEntity.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/ISocialEntity.cs | |||
@@ -1,14 +1,14 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using System.Text; | 3 | using System.Text; |
4 | using OpenMetaverse; | 4 | using OpenMetaverse; |
5 | 5 | ||
6 | namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | 6 | namespace OpenSim.Region.OptionalModules.Scripting.Minimodule |
7 | { | 7 | { |
8 | public interface ISocialEntity | 8 | public interface ISocialEntity |
9 | { | 9 | { |
10 | UUID GlobalID { get; } | 10 | UUID GlobalID { get; } |
11 | string Name { get; } | 11 | string Name { get; } |
12 | bool IsUser { get; } | 12 | bool IsUser { get; } |
13 | } | 13 | } |
14 | } \ No newline at end of file | 14 | } \ No newline at end of file |
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/LOParcel.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/LOParcel.cs index aceeacc..8ab1a56 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/LOParcel.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/LOParcel.cs | |||
@@ -1,45 +1,45 @@ | |||
1 | using OpenSim.Region.Framework.Interfaces; | 1 | using OpenSim.Region.Framework.Interfaces; |
2 | using OpenSim.Region.Framework.Scenes; | 2 | using OpenSim.Region.Framework.Scenes; |
3 | 3 | ||
4 | namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | 4 | namespace OpenSim.Region.OptionalModules.Scripting.Minimodule |
5 | { | 5 | { |
6 | class LOParcel : IParcel | 6 | class LOParcel : IParcel |
7 | { | 7 | { |
8 | private readonly Scene m_scene; | 8 | private readonly Scene m_scene; |
9 | private readonly int m_parcelID; | 9 | private readonly int m_parcelID; |
10 | 10 | ||
11 | public LOParcel(Scene m_scene, int m_parcelID) | 11 | public LOParcel(Scene m_scene, int m_parcelID) |
12 | { | 12 | { |
13 | this.m_scene = m_scene; | 13 | this.m_scene = m_scene; |
14 | this.m_parcelID = m_parcelID; | 14 | this.m_parcelID = m_parcelID; |
15 | } | 15 | } |
16 | 16 | ||
17 | private ILandObject GetLO() | 17 | private ILandObject GetLO() |
18 | { | 18 | { |
19 | return m_scene.LandChannel.GetLandObject(m_parcelID); | 19 | return m_scene.LandChannel.GetLandObject(m_parcelID); |
20 | } | 20 | } |
21 | 21 | ||
22 | public string Name | 22 | public string Name |
23 | { | 23 | { |
24 | get { return GetLO().landData.Name; } | 24 | get { return GetLO().landData.Name; } |
25 | set { GetLO().landData.Name = value; } | 25 | set { GetLO().landData.Name = value; } |
26 | } | 26 | } |
27 | 27 | ||
28 | public string Description | 28 | public string Description |
29 | { | 29 | { |
30 | get { return GetLO().landData.Description; } | 30 | get { return GetLO().landData.Description; } |
31 | set { GetLO().landData.Description = value; } | 31 | set { GetLO().landData.Description = value; } |
32 | } | 32 | } |
33 | 33 | ||
34 | public ISocialEntity Owner | 34 | public ISocialEntity Owner |
35 | { | 35 | { |
36 | get { throw new System.NotImplementedException(); } | 36 | get { throw new System.NotImplementedException(); } |
37 | set { throw new System.NotImplementedException(); } | 37 | set { throw new System.NotImplementedException(); } |
38 | } | 38 | } |
39 | 39 | ||
40 | public bool[,] Bitmap | 40 | public bool[,] Bitmap |
41 | { | 41 | { |
42 | get { return GetLO().landBitmap; } | 42 | get { return GetLO().landBitmap; } |
43 | } | 43 | } |
44 | } | 44 | } |
45 | } | 45 | } |
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Object/IObjectPhysics.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/Object/IObjectPhysics.cs index 6ca4e5f..3682e9b 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Object/IObjectPhysics.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/Object/IObjectPhysics.cs | |||
@@ -1,39 +1,39 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using System.Text; | 3 | using System.Text; |
4 | using OpenMetaverse; | 4 | using OpenMetaverse; |
5 | 5 | ||
6 | namespace OpenSim.Region.OptionalModules.Scripting.Minimodule.Object | 6 | namespace OpenSim.Region.OptionalModules.Scripting.Minimodule.Object |
7 | { | 7 | { |
8 | /// <summary> | 8 | /// <summary> |
9 | /// This implements an interface similar to that provided by physics engines to OpenSim internally. | 9 | /// This implements an interface similar to that provided by physics engines to OpenSim internally. |
10 | /// Eg, PhysicsActor. It is capable of setting and getting properties related to the current | 10 | /// Eg, PhysicsActor. It is capable of setting and getting properties related to the current |
11 | /// physics scene representation of this object. | 11 | /// physics scene representation of this object. |
12 | /// </summary> | 12 | /// </summary> |
13 | public interface IObjectPhysics | 13 | public interface IObjectPhysics |
14 | { | 14 | { |
15 | bool Enabled { get; set; } | 15 | bool Enabled { get; set; } |
16 | 16 | ||
17 | bool Phantom { get; set; } | 17 | bool Phantom { get; set; } |
18 | bool PhantomCollisions { get; set; } | 18 | bool PhantomCollisions { get; set; } |
19 | 19 | ||
20 | double Density { get; set; } | 20 | double Density { get; set; } |
21 | double Mass { get; set; } | 21 | double Mass { get; set; } |
22 | double Buoyancy { get; set; } | 22 | double Buoyancy { get; set; } |
23 | 23 | ||
24 | Vector3 GeometricCenter { get; } | 24 | Vector3 GeometricCenter { get; } |
25 | Vector3 CenterOfMass { get; } | 25 | Vector3 CenterOfMass { get; } |
26 | 26 | ||
27 | Vector3 RotationalVelocity { get; set; } | 27 | Vector3 RotationalVelocity { get; set; } |
28 | Vector3 Velocity { get; set; } | 28 | Vector3 Velocity { get; set; } |
29 | Vector3 Torque { get; set; } | 29 | Vector3 Torque { get; set; } |
30 | Vector3 Acceleration { get; } | 30 | Vector3 Acceleration { get; } |
31 | Vector3 Force { get; set; } | 31 | Vector3 Force { get; set; } |
32 | 32 | ||
33 | bool FloatOnWater { set; } | 33 | bool FloatOnWater { set; } |
34 | 34 | ||
35 | void AddForce(Vector3 force, bool pushforce); | 35 | void AddForce(Vector3 force, bool pushforce); |
36 | void AddAngularForce(Vector3 force, bool pushforce); | 36 | void AddAngularForce(Vector3 force, bool pushforce); |
37 | void SetMomentum(Vector3 momentum); | 37 | void SetMomentum(Vector3 momentum); |
38 | } | 38 | } |
39 | } | 39 | } |
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SEUser.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SEUser.cs index a35e051..a7da114 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SEUser.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SEUser.cs | |||
@@ -1,34 +1,34 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using System.Text; | 3 | using System.Text; |
4 | using OpenMetaverse; | 4 | using OpenMetaverse; |
5 | 5 | ||
6 | namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | 6 | namespace OpenSim.Region.OptionalModules.Scripting.Minimodule |
7 | { | 7 | { |
8 | class SEUser : ISocialEntity | 8 | class SEUser : ISocialEntity |
9 | { | 9 | { |
10 | private readonly UUID m_uuid; | 10 | private readonly UUID m_uuid; |
11 | private readonly string m_name; | 11 | private readonly string m_name; |
12 | 12 | ||
13 | public SEUser(UUID uuid, string name) | 13 | public SEUser(UUID uuid, string name) |
14 | { | 14 | { |
15 | m_uuid = uuid; | 15 | m_uuid = uuid; |
16 | m_name = name; | 16 | m_name = name; |
17 | } | 17 | } |
18 | 18 | ||
19 | public UUID GlobalID | 19 | public UUID GlobalID |
20 | { | 20 | { |
21 | get { return m_uuid; } | 21 | get { return m_uuid; } |
22 | } | 22 | } |
23 | 23 | ||
24 | public string Name | 24 | public string Name |
25 | { | 25 | { |
26 | get { return m_name; } | 26 | get { return m_name; } |
27 | } | 27 | } |
28 | 28 | ||
29 | public bool IsUser | 29 | public bool IsUser |
30 | { | 30 | { |
31 | get { return true; } | 31 | get { return true; } |
32 | } | 32 | } |
33 | } | 33 | } |
34 | } | 34 | } |