diff options
author | Dr Scofield | 2009-02-06 16:55:34 +0000 |
---|---|---|
committer | Dr Scofield | 2009-02-06 16:55:34 +0000 |
commit | 9b66108081a8c8cf79faaa6c541554091c40850e (patch) | |
tree | 095a232ae5a9de3a9244bcd34da08294f61eeea5 /OpenSim/Region/Environment/Modules/Scripting | |
parent | * removed superfluous constants class (diff) | |
download | opensim-SC_OLD-9b66108081a8c8cf79faaa6c541554091c40850e.zip opensim-SC_OLD-9b66108081a8c8cf79faaa6c541554091c40850e.tar.gz opensim-SC_OLD-9b66108081a8c8cf79faaa6c541554091c40850e.tar.bz2 opensim-SC_OLD-9b66108081a8c8cf79faaa6c541554091c40850e.tar.xz |
This changeset is the step 1 of 2 in refactoring
OpenSim.Region.Environment into a "framework" part and a modules only
part. This first changeset refactors OpenSim.Region.Environment.Scenes,
OpenSim.Region.Environment.Interfaces, and OpenSim.Region.Interfaces
into OpenSim.Region.Framework.{Interfaces,Scenes} leaving only region
modules in OpenSim.Region.Environment.
The next step will be to move region modules up from
OpenSim.Region.Environment.Modules to OpenSim.Region.CoreModules and
then sort out which modules are really core modules and which should
move out to forge.
I've been very careful to NOT BREAK anything. i hope i've
succeeded. as this is the work of a whole week i hope i managed to
keep track with the applied patches of the last week --- could any of
you that did check in stuff have a look at whether it survived? thx!
Diffstat (limited to 'OpenSim/Region/Environment/Modules/Scripting')
7 files changed, 177 insertions, 140 deletions
diff --git a/OpenSim/Region/Environment/Modules/Scripting/DynamicTexture/DynamicTextureModule.cs b/OpenSim/Region/Environment/Modules/Scripting/DynamicTexture/DynamicTextureModule.cs index bddf10d..f498f9a 100644 --- a/OpenSim/Region/Environment/Modules/Scripting/DynamicTexture/DynamicTextureModule.cs +++ b/OpenSim/Region/Environment/Modules/Scripting/DynamicTexture/DynamicTextureModule.cs | |||
@@ -33,8 +33,8 @@ using OpenMetaverse; | |||
33 | using OpenMetaverse.Imaging; | 33 | using OpenMetaverse.Imaging; |
34 | using Nini.Config; | 34 | using Nini.Config; |
35 | using OpenSim.Framework; | 35 | using OpenSim.Framework; |
36 | using OpenSim.Region.Environment.Interfaces; | 36 | using OpenSim.Region.Framework.Interfaces; |
37 | using OpenSim.Region.Environment.Scenes; | 37 | using OpenSim.Region.Framework.Scenes; |
38 | 38 | ||
39 | namespace OpenSim.Region.Environment.Modules.Scripting.DynamicTexture | 39 | namespace OpenSim.Region.Environment.Modules.Scripting.DynamicTexture |
40 | { | 40 | { |
diff --git a/OpenSim/Region/Environment/Modules/Scripting/EMailModules/EmailModule.cs b/OpenSim/Region/Environment/Modules/Scripting/EMailModules/EmailModule.cs index 5a715f5..81ce761 100644 --- a/OpenSim/Region/Environment/Modules/Scripting/EMailModules/EmailModule.cs +++ b/OpenSim/Region/Environment/Modules/Scripting/EMailModules/EmailModule.cs | |||
@@ -31,8 +31,8 @@ using System.Collections.Generic; | |||
31 | using System.Text.RegularExpressions; | 31 | using System.Text.RegularExpressions; |
32 | using OpenMetaverse; | 32 | using OpenMetaverse; |
33 | using OpenSim.Framework; | 33 | using OpenSim.Framework; |
34 | using OpenSim.Region.Environment.Interfaces; | 34 | using OpenSim.Region.Framework.Interfaces; |
35 | using OpenSim.Region.Environment.Scenes; | 35 | using OpenSim.Region.Framework.Scenes; |
36 | using log4net; | 36 | using log4net; |
37 | using Nini.Config; | 37 | using Nini.Config; |
38 | using DotNetOpenMail; | 38 | using DotNetOpenMail; |
diff --git a/OpenSim/Region/Environment/Modules/Scripting/HttpRequest/ScriptsHttpRequests.cs b/OpenSim/Region/Environment/Modules/Scripting/HttpRequest/ScriptsHttpRequests.cs index eb9b322..821c60e 100644 --- a/OpenSim/Region/Environment/Modules/Scripting/HttpRequest/ScriptsHttpRequests.cs +++ b/OpenSim/Region/Environment/Modules/Scripting/HttpRequest/ScriptsHttpRequests.cs | |||
@@ -35,8 +35,8 @@ using OpenMetaverse; | |||
35 | using Nini.Config; | 35 | using Nini.Config; |
36 | using OpenSim.Framework; | 36 | using OpenSim.Framework; |
37 | using OpenSim.Framework.Servers; | 37 | using OpenSim.Framework.Servers; |
38 | using OpenSim.Region.Environment.Interfaces; | 38 | using OpenSim.Region.Framework.Interfaces; |
39 | using OpenSim.Region.Environment.Scenes; | 39 | using OpenSim.Region.Framework.Scenes; |
40 | using System.Collections; | 40 | using System.Collections; |
41 | 41 | ||
42 | /***************************************************** | 42 | /***************************************************** |
@@ -84,14 +84,14 @@ using System.Collections; | |||
84 | 84 | ||
85 | namespace OpenSim.Region.Environment.Modules.Scripting.HttpRequest | 85 | namespace OpenSim.Region.Environment.Modules.Scripting.HttpRequest |
86 | { | 86 | { |
87 | public class HttpRequestModule : IRegionModule, IHttpRequests | 87 | public class HttpRequestModule : IRegionModule, IHttpRequestModule |
88 | { | 88 | { |
89 | private object HttpListLock = new object(); | 89 | private object HttpListLock = new object(); |
90 | private int httpTimeout = 30000; | 90 | private int httpTimeout = 30000; |
91 | private string m_name = "HttpScriptRequests"; | 91 | private string m_name = "HttpScriptRequests"; |
92 | 92 | ||
93 | private string m_proxyurl = ""; | 93 | private string m_proxyurl = ""; |
94 | private string m_proxyexcepts = ""; | 94 | private string m_proxyexcepts = ""; |
95 | 95 | ||
96 | // <request id, HttpRequestClass> | 96 | // <request id, HttpRequestClass> |
97 | private Dictionary<UUID, HttpRequestClass> m_pendingRequests; | 97 | private Dictionary<UUID, HttpRequestClass> m_pendingRequests; |
@@ -102,7 +102,7 @@ namespace OpenSim.Region.Environment.Modules.Scripting.HttpRequest | |||
102 | { | 102 | { |
103 | } | 103 | } |
104 | 104 | ||
105 | #region IHttpRequests Members | 105 | #region IHttpRequestModule Members |
106 | 106 | ||
107 | public UUID MakeHttpRequest(string url, string parameters, string body) | 107 | public UUID MakeHttpRequest(string url, string parameters, string body) |
108 | { | 108 | { |
@@ -125,22 +125,22 @@ namespace OpenSim.Region.Environment.Modules.Scripting.HttpRequest | |||
125 | { | 125 | { |
126 | switch (Int32.Parse(parms[i])) | 126 | switch (Int32.Parse(parms[i])) |
127 | { | 127 | { |
128 | case HttpRequestClass.HTTP_METHOD: | 128 | case (int)HttpRequestConstants.HTTP_METHOD: |
129 | 129 | ||
130 | htc.httpMethod = parms[i + 1]; | 130 | htc.HttpMethod = parms[i + 1]; |
131 | break; | 131 | break; |
132 | 132 | ||
133 | case HttpRequestClass.HTTP_MIMETYPE: | 133 | case (int)HttpRequestConstants.HTTP_MIMETYPE: |
134 | 134 | ||
135 | htc.httpMIMEType = parms[i + 1]; | 135 | htc.HttpMIMEType = parms[i + 1]; |
136 | break; | 136 | break; |
137 | 137 | ||
138 | case HttpRequestClass.HTTP_BODY_MAXLENGTH: | 138 | case (int)HttpRequestConstants.HTTP_BODY_MAXLENGTH: |
139 | 139 | ||
140 | // TODO implement me | 140 | // TODO implement me |
141 | break; | 141 | break; |
142 | 142 | ||
143 | case HttpRequestClass.HTTP_VERIFY_CERT: | 143 | case (int)HttpRequestConstants.HTTP_VERIFY_CERT: |
144 | 144 | ||
145 | // TODO implement me | 145 | // TODO implement me |
146 | break; | 146 | break; |
@@ -148,22 +148,22 @@ namespace OpenSim.Region.Environment.Modules.Scripting.HttpRequest | |||
148 | } | 148 | } |
149 | } | 149 | } |
150 | 150 | ||
151 | htc.localID = localID; | 151 | htc.LocalID = localID; |
152 | htc.itemID = itemID; | 152 | htc.ItemID = itemID; |
153 | htc.url = url; | 153 | htc.Url = url; |
154 | htc.reqID = reqID; | 154 | htc.ReqID = reqID; |
155 | htc.httpTimeout = httpTimeout; | 155 | htc.HttpTimeout = httpTimeout; |
156 | htc.outbound_body = body; | 156 | htc.OutboundBody = body; |
157 | htc.response_headers = headers; | 157 | htc.ResponseHeaders = headers; |
158 | htc.proxyurl = m_proxyurl; | 158 | htc.proxyurl = m_proxyurl; |
159 | htc.proxyexcepts = m_proxyexcepts; | 159 | htc.proxyexcepts = m_proxyexcepts; |
160 | 160 | ||
161 | lock (HttpListLock) | 161 | lock (HttpListLock) |
162 | { | 162 | { |
163 | m_pendingRequests.Add(reqID, htc); | 163 | m_pendingRequests.Add(reqID, htc); |
164 | } | 164 | } |
165 | 165 | ||
166 | htc.process(); | 166 | htc.Process(); |
167 | 167 | ||
168 | return reqID; | 168 | return reqID; |
169 | } | 169 | } |
@@ -193,7 +193,7 @@ namespace OpenSim.Region.Environment.Modules.Scripting.HttpRequest | |||
193 | * it will need some refactoring and this works 'enough' right now | 193 | * it will need some refactoring and this works 'enough' right now |
194 | */ | 194 | */ |
195 | 195 | ||
196 | public HttpRequestClass GetNextCompletedRequest() | 196 | public IServiceRequest GetNextCompletedRequest() |
197 | { | 197 | { |
198 | lock (HttpListLock) | 198 | lock (HttpListLock) |
199 | { | 199 | { |
@@ -203,7 +203,7 @@ namespace OpenSim.Region.Environment.Modules.Scripting.HttpRequest | |||
203 | 203 | ||
204 | if (m_pendingRequests.TryGetValue(luid, out tmpReq)) | 204 | if (m_pendingRequests.TryGetValue(luid, out tmpReq)) |
205 | { | 205 | { |
206 | if (tmpReq.finished) | 206 | if (tmpReq.Finished) |
207 | { | 207 | { |
208 | return tmpReq; | 208 | return tmpReq; |
209 | } | 209 | } |
@@ -235,10 +235,10 @@ namespace OpenSim.Region.Environment.Modules.Scripting.HttpRequest | |||
235 | { | 235 | { |
236 | m_scene = scene; | 236 | m_scene = scene; |
237 | 237 | ||
238 | m_scene.RegisterModuleInterface<IHttpRequests>(this); | 238 | m_scene.RegisterModuleInterface<IHttpRequestModule>(this); |
239 | 239 | ||
240 | m_proxyurl = config.Configs["Startup"].GetString("HttpProxy"); | 240 | m_proxyurl = config.Configs["Startup"].GetString("HttpProxy"); |
241 | m_proxyexcepts = config.Configs["Startup"].GetString("HttpProxyExceptions"); | 241 | m_proxyexcepts = config.Configs["Startup"].GetString("HttpProxyExceptions"); |
242 | 242 | ||
243 | m_pendingRequests = new Dictionary<UUID, HttpRequestClass>(); | 243 | m_pendingRequests = new Dictionary<UUID, HttpRequestClass>(); |
244 | } | 244 | } |
@@ -264,45 +264,64 @@ namespace OpenSim.Region.Environment.Modules.Scripting.HttpRequest | |||
264 | #endregion | 264 | #endregion |
265 | } | 265 | } |
266 | 266 | ||
267 | public class HttpRequestClass | 267 | public class HttpRequestClass: IServiceRequest |
268 | { | 268 | { |
269 | // Constants for parameters | 269 | // Constants for parameters |
270 | public const int HTTP_BODY_MAXLENGTH = 2; | 270 | // public const int HTTP_BODY_MAXLENGTH = 2; |
271 | public const int HTTP_METHOD = 0; | 271 | // public const int HTTP_METHOD = 0; |
272 | public const int HTTP_MIMETYPE = 1; | 272 | // public const int HTTP_MIMETYPE = 1; |
273 | public const int HTTP_VERIFY_CERT = 3; | 273 | // public const int HTTP_VERIFY_CERT = 3; |
274 | public bool finished; | 274 | private bool _finished; |
275 | public int httpBodyMaxLen = 2048; // not implemented | 275 | public bool Finished |
276 | { | ||
277 | get { return _finished; } | ||
278 | } | ||
279 | // public int HttpBodyMaxLen = 2048; // not implemented | ||
276 | 280 | ||
277 | // Parameter members and default values | 281 | // Parameter members and default values |
278 | public string httpMethod = "GET"; | 282 | public string HttpMethod = "GET"; |
279 | public string httpMIMEType = "text/plain;charset=utf-8"; | 283 | public string HttpMIMEType = "text/plain;charset=utf-8"; |
284 | public int HttpTimeout; | ||
285 | // public bool HttpVerifyCert = true; // not implemented | ||
280 | private Thread httpThread; | 286 | private Thread httpThread; |
281 | public int httpTimeout; | ||
282 | public bool httpVerifyCert = true; // not implemented | ||
283 | 287 | ||
284 | // Request info | 288 | // Request info |
285 | public UUID itemID; | 289 | private UUID _itemID; |
286 | public uint localID; | 290 | public UUID ItemID |
287 | public DateTime next; | 291 | { |
288 | public string outbound_body; | 292 | get { return _itemID; } |
289 | public UUID reqID; | 293 | set { _itemID = value; } |
290 | public HttpWebRequest request; | 294 | } |
291 | public string response_body; | 295 | private uint _localID; |
292 | public List<string> response_metadata; | 296 | public uint LocalID |
293 | public Dictionary<string, string> response_headers; | 297 | { |
294 | public int status; | 298 | get { return _localID; } |
295 | public string url; | 299 | set { _localID = value; } |
300 | } | ||
301 | public DateTime Next; | ||
296 | public string proxyurl; | 302 | public string proxyurl; |
297 | public string proxyexcepts; | 303 | public string proxyexcepts; |
298 | 304 | public string OutboundBody; | |
299 | public void process() | 305 | private UUID _reqID; |
306 | public UUID ReqID | ||
307 | { | ||
308 | get { return _reqID; } | ||
309 | set { _reqID = value; } | ||
310 | } | ||
311 | public HttpWebRequest Request; | ||
312 | public string ResponseBody; | ||
313 | public List<string> ResponseMetadata; | ||
314 | public Dictionary<string, string> ResponseHeaders; | ||
315 | public int Status; | ||
316 | public string Url; | ||
317 | |||
318 | public void Process() | ||
300 | { | 319 | { |
301 | httpThread = new Thread(SendRequest); | 320 | httpThread = new Thread(SendRequest); |
302 | httpThread.Name = "HttpRequestThread"; | 321 | httpThread.Name = "HttpRequestThread"; |
303 | httpThread.Priority = ThreadPriority.BelowNormal; | 322 | httpThread.Priority = ThreadPriority.BelowNormal; |
304 | httpThread.IsBackground = true; | 323 | httpThread.IsBackground = true; |
305 | finished = false; | 324 | _finished = false; |
306 | httpThread.Start(); | 325 | httpThread.Start(); |
307 | ThreadTracker.Add(httpThread); | 326 | ThreadTracker.Add(httpThread); |
308 | } | 327 | } |
@@ -322,37 +341,35 @@ namespace OpenSim.Region.Environment.Modules.Scripting.HttpRequest | |||
322 | 341 | ||
323 | try | 342 | try |
324 | { | 343 | { |
325 | request = (HttpWebRequest) | 344 | Request = (HttpWebRequest) WebRequest.Create(Url); |
326 | WebRequest.Create(url); | 345 | Request.Method = HttpMethod; |
327 | request.Method = httpMethod; | 346 | Request.ContentType = HttpMIMEType; |
328 | request.ContentType = httpMIMEType; | 347 | if (proxyurl.Length > 0) |
329 | if (proxyurl.Length > 0) | 348 | { |
330 | { | 349 | if (proxyexcepts.Length > 0) { |
331 | if (proxyexcepts.Length > 0) { | 350 | string[] elist = proxyexcepts.Split(';'); |
332 | string[] elist = proxyexcepts.Split(';'); | 351 | Request.Proxy = new WebProxy(proxyurl,true,elist); |
333 | request.Proxy = new WebProxy(proxyurl,true,elist); | 352 | } else { |
334 | } else { | 353 | Request.Proxy = new WebProxy(proxyurl,true); |
335 | request.Proxy = new WebProxy(proxyurl,true); | 354 | } |
336 | } | 355 | } |
337 | } | 356 | |
338 | 357 | foreach (KeyValuePair<string, string> entry in ResponseHeaders) | |
339 | foreach (KeyValuePair<string, string> entry in response_headers) | 358 | Request.Headers[entry.Key] = entry.Value; |
340 | request.Headers[entry.Key] = entry.Value; | ||
341 | 359 | ||
342 | // Encode outbound data | 360 | // Encode outbound data |
343 | if (outbound_body.Length > 0) { | 361 | if (OutboundBody.Length > 0) { |
344 | byte[] data = Encoding.UTF8.GetBytes(outbound_body); | 362 | byte[] data = Encoding.UTF8.GetBytes(OutboundBody); |
345 | 363 | ||
346 | request.ContentLength = data.Length; | 364 | Request.ContentLength = data.Length; |
347 | Stream bstream = request.GetRequestStream(); | 365 | Stream bstream = Request.GetRequestStream(); |
348 | bstream.Write(data, 0, data.Length); | 366 | bstream.Write(data, 0, data.Length); |
349 | bstream.Close(); | 367 | bstream.Close(); |
350 | } | 368 | } |
351 | 369 | ||
352 | request.Timeout = httpTimeout; | 370 | Request.Timeout = HttpTimeout; |
353 | // execute the request | 371 | // execute the request |
354 | response = (HttpWebResponse) | 372 | response = (HttpWebResponse) Request.GetResponse(); |
355 | request.GetResponse(); | ||
356 | 373 | ||
357 | Stream resStream = response.GetResponseStream(); | 374 | Stream resStream = response.GetResponseStream(); |
358 | 375 | ||
@@ -372,23 +389,23 @@ namespace OpenSim.Region.Environment.Modules.Scripting.HttpRequest | |||
372 | } | 389 | } |
373 | } while (count > 0); // any more data to read? | 390 | } while (count > 0); // any more data to read? |
374 | 391 | ||
375 | response_body = sb.ToString(); | 392 | ResponseBody = sb.ToString(); |
376 | } | 393 | } |
377 | catch (Exception e) | 394 | catch (Exception e) |
378 | { | 395 | { |
379 | if (e is WebException && ((WebException)e).Status == WebExceptionStatus.ProtocolError) | 396 | if (e is WebException && ((WebException)e).Status == WebExceptionStatus.ProtocolError) |
380 | { | 397 | { |
381 | HttpWebResponse webRsp = (HttpWebResponse)((WebException)e).Response; | 398 | HttpWebResponse webRsp = (HttpWebResponse)((WebException)e).Response; |
382 | status = (int)webRsp.StatusCode; | 399 | Status = (int)webRsp.StatusCode; |
383 | response_body = webRsp.StatusDescription; | 400 | ResponseBody = webRsp.StatusDescription; |
384 | } | 401 | } |
385 | else | 402 | else |
386 | { | 403 | { |
387 | status = (int)OSHttpStatusCode.ClientErrorJoker; | 404 | Status = (int)OSHttpStatusCode.ClientErrorJoker; |
388 | response_body = e.Message; | 405 | ResponseBody = e.Message; |
389 | } | 406 | } |
390 | 407 | ||
391 | finished = true; | 408 | _finished = true; |
392 | return; | 409 | return; |
393 | } | 410 | } |
394 | finally | 411 | finally |
@@ -397,8 +414,8 @@ namespace OpenSim.Region.Environment.Modules.Scripting.HttpRequest | |||
397 | response.Close(); | 414 | response.Close(); |
398 | } | 415 | } |
399 | 416 | ||
400 | status = (int)OSHttpStatusCode.SuccessOk; | 417 | Status = (int)OSHttpStatusCode.SuccessOk; |
401 | finished = true; | 418 | _finished = true; |
402 | } | 419 | } |
403 | 420 | ||
404 | public void Stop() | 421 | public void Stop() |
diff --git a/OpenSim/Region/Environment/Modules/Scripting/LoadImageURL/LoadImageURLModule.cs b/OpenSim/Region/Environment/Modules/Scripting/LoadImageURL/LoadImageURLModule.cs index 3d0afd1..af78c36 100644 --- a/OpenSim/Region/Environment/Modules/Scripting/LoadImageURL/LoadImageURLModule.cs +++ b/OpenSim/Region/Environment/Modules/Scripting/LoadImageURL/LoadImageURLModule.cs | |||
@@ -32,8 +32,8 @@ using System.Net; | |||
32 | using OpenMetaverse; | 32 | using OpenMetaverse; |
33 | using OpenMetaverse.Imaging; | 33 | using OpenMetaverse.Imaging; |
34 | using Nini.Config; | 34 | using Nini.Config; |
35 | using OpenSim.Region.Environment.Interfaces; | 35 | using OpenSim.Region.Framework.Interfaces; |
36 | using OpenSim.Region.Environment.Scenes; | 36 | using OpenSim.Region.Framework.Scenes; |
37 | 37 | ||
38 | namespace OpenSim.Region.Environment.Modules.Scripting.LoadImageURL | 38 | namespace OpenSim.Region.Environment.Modules.Scripting.LoadImageURL |
39 | { | 39 | { |
diff --git a/OpenSim/Region/Environment/Modules/Scripting/VectorRender/VectorRenderModule.cs b/OpenSim/Region/Environment/Modules/Scripting/VectorRender/VectorRenderModule.cs index 3b318a4..60806a7 100644 --- a/OpenSim/Region/Environment/Modules/Scripting/VectorRender/VectorRenderModule.cs +++ b/OpenSim/Region/Environment/Modules/Scripting/VectorRender/VectorRenderModule.cs | |||
@@ -34,8 +34,8 @@ using System.Net; | |||
34 | using OpenMetaverse; | 34 | using OpenMetaverse; |
35 | using OpenMetaverse.Imaging; | 35 | using OpenMetaverse.Imaging; |
36 | using Nini.Config; | 36 | using Nini.Config; |
37 | using OpenSim.Region.Environment.Interfaces; | 37 | using OpenSim.Region.Framework.Interfaces; |
38 | using OpenSim.Region.Environment.Scenes; | 38 | using OpenSim.Region.Framework.Scenes; |
39 | 39 | ||
40 | //using Cairo; | 40 | //using Cairo; |
41 | 41 | ||
diff --git a/OpenSim/Region/Environment/Modules/Scripting/WorldComm/WorldCommModule.cs b/OpenSim/Region/Environment/Modules/Scripting/WorldComm/WorldCommModule.cs index 99e3177..258734d 100644 --- a/OpenSim/Region/Environment/Modules/Scripting/WorldComm/WorldCommModule.cs +++ b/OpenSim/Region/Environment/Modules/Scripting/WorldComm/WorldCommModule.cs | |||
@@ -31,8 +31,8 @@ using System.Collections.Generic; | |||
31 | using OpenMetaverse; | 31 | using OpenMetaverse; |
32 | using Nini.Config; | 32 | using Nini.Config; |
33 | using OpenSim.Framework; | 33 | using OpenSim.Framework; |
34 | using OpenSim.Region.Environment.Interfaces; | 34 | using OpenSim.Region.Framework.Interfaces; |
35 | using OpenSim.Region.Environment.Scenes; | 35 | using OpenSim.Region.Framework.Scenes; |
36 | 36 | ||
37 | // using log4net; | 37 | // using log4net; |
38 | // using System.Reflection; | 38 | // using System.Reflection; |
@@ -313,7 +313,7 @@ namespace OpenSim.Region.Environment.Modules.Scripting.WorldComm | |||
313 | /// Pop the first availlable listen event from the queue | 313 | /// Pop the first availlable listen event from the queue |
314 | /// </summary> | 314 | /// </summary> |
315 | /// <returns>ListenerInfo with filter filled in</returns> | 315 | /// <returns>ListenerInfo with filter filled in</returns> |
316 | public ListenerInfo GetNextMessage() | 316 | public IWorldCommListenerInfo GetNextMessage() |
317 | { | 317 | { |
318 | ListenerInfo li = null; | 318 | ListenerInfo li = null; |
319 | 319 | ||
@@ -608,7 +608,7 @@ namespace OpenSim.Region.Environment.Modules.Scripting.WorldComm | |||
608 | } | 608 | } |
609 | } | 609 | } |
610 | 610 | ||
611 | public class ListenerInfo | 611 | public class ListenerInfo: IWorldCommListenerInfo |
612 | { | 612 | { |
613 | private bool m_active; // Listener is active or not | 613 | private bool m_active; // Listener is active or not |
614 | private int m_handle; // Assigned handle of this listener | 614 | private int m_handle; // Assigned handle of this listener |
diff --git a/OpenSim/Region/Environment/Modules/Scripting/XMLRPC/XMLRPCModule.cs b/OpenSim/Region/Environment/Modules/Scripting/XMLRPC/XMLRPCModule.cs index 28028bc..fb86731 100644 --- a/OpenSim/Region/Environment/Modules/Scripting/XMLRPC/XMLRPCModule.cs +++ b/OpenSim/Region/Environment/Modules/Scripting/XMLRPC/XMLRPCModule.cs | |||
@@ -37,8 +37,8 @@ using Nini.Config; | |||
37 | using Nwc.XmlRpc; | 37 | using Nwc.XmlRpc; |
38 | using OpenSim.Framework; | 38 | using OpenSim.Framework; |
39 | using OpenSim.Framework.Servers; | 39 | using OpenSim.Framework.Servers; |
40 | using OpenSim.Region.Environment.Interfaces; | 40 | using OpenSim.Region.Framework.Interfaces; |
41 | using OpenSim.Region.Environment.Scenes; | 41 | using OpenSim.Region.Framework.Scenes; |
42 | 42 | ||
43 | /***************************************************** | 43 | /***************************************************** |
44 | * | 44 | * |
@@ -302,7 +302,7 @@ namespace OpenSim.Region.Environment.Modules.Scripting.XMLRPC | |||
302 | } | 302 | } |
303 | } | 303 | } |
304 | 304 | ||
305 | public RPCRequestInfo GetNextCompletedRequest() | 305 | public IXmlRpcRequestInfo GetNextCompletedRequest() |
306 | { | 306 | { |
307 | if (m_rpcPending != null) | 307 | if (m_rpcPending != null) |
308 | { | 308 | { |
@@ -345,10 +345,11 @@ namespace OpenSim.Region.Environment.Modules.Scripting.XMLRPC | |||
345 | localID, itemID, channel, dest, idata, sdata | 345 | localID, itemID, channel, dest, idata, sdata |
346 | ); | 346 | ); |
347 | m_pendingSRDResponses.Add(req.GetReqID(), req); | 347 | m_pendingSRDResponses.Add(req.GetReqID(), req); |
348 | return req.process(); | 348 | req.Process(); |
349 | return req.ReqID; | ||
349 | } | 350 | } |
350 | 351 | ||
351 | public SendRemoteDataRequest GetNextCompletedSRDRequest() | 352 | public IServiceRequest GetNextCompletedSRDRequest() |
352 | { | 353 | { |
353 | if (m_pendingSRDResponses != null) | 354 | if (m_pendingSRDResponses != null) |
354 | { | 355 | { |
@@ -360,7 +361,7 @@ namespace OpenSim.Region.Environment.Modules.Scripting.XMLRPC | |||
360 | 361 | ||
361 | if (m_pendingSRDResponses.TryGetValue(luid, out tmpReq)) | 362 | if (m_pendingSRDResponses.TryGetValue(luid, out tmpReq)) |
362 | { | 363 | { |
363 | if (tmpReq.finished) | 364 | if (tmpReq.Finished) |
364 | return tmpReq; | 365 | return tmpReq; |
365 | } | 366 | } |
366 | } | 367 | } |
@@ -389,7 +390,7 @@ namespace OpenSim.Region.Environment.Modules.Scripting.XMLRPC | |||
389 | { | 390 | { |
390 | foreach (SendRemoteDataRequest li in m_pendingSRDResponses.Values) | 391 | foreach (SendRemoteDataRequest li in m_pendingSRDResponses.Values) |
391 | { | 392 | { |
392 | if (li.m_itemID.Equals(itemID)) | 393 | if (li.ItemID.Equals(itemID)) |
393 | m_pendingSRDResponses.Remove(li.GetReqID()); | 394 | m_pendingSRDResponses.Remove(li.GetReqID()); |
394 | } | 395 | } |
395 | } | 396 | } |
@@ -460,7 +461,7 @@ namespace OpenSim.Region.Environment.Modules.Scripting.XMLRPC | |||
460 | } | 461 | } |
461 | } | 462 | } |
462 | 463 | ||
463 | public class RPCRequestInfo | 464 | public class RPCRequestInfo: IXmlRpcRequestInfo |
464 | { | 465 | { |
465 | private UUID m_ChannelKey; | 466 | private UUID m_ChannelKey; |
466 | private string m_IntVal; | 467 | private string m_IntVal; |
@@ -575,45 +576,64 @@ namespace OpenSim.Region.Environment.Modules.Scripting.XMLRPC | |||
575 | } | 576 | } |
576 | } | 577 | } |
577 | 578 | ||
578 | public class SendRemoteDataRequest | 579 | public class SendRemoteDataRequest: IServiceRequest |
579 | { | 580 | { |
580 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 581 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
581 | public string channel; | 582 | |
582 | public string destURL; | 583 | public string Channel; |
583 | public bool finished; | 584 | public string DestURL; |
585 | private bool _finished; | ||
586 | public bool Finished | ||
587 | { | ||
588 | get { return _finished; } | ||
589 | set { _finished = value; } | ||
590 | } | ||
584 | private Thread httpThread; | 591 | private Thread httpThread; |
585 | public int idata; | 592 | public int Idata; |
586 | public UUID m_itemID; | 593 | private UUID _itemID; |
587 | public uint m_localID; | 594 | public UUID ItemID |
588 | public UUID reqID; | 595 | { |
589 | public XmlRpcRequest request; | 596 | get { return _itemID; } |
590 | public int response_idata; | 597 | set { _itemID = value; } |
591 | public string response_sdata; | 598 | } |
592 | public string sdata; | 599 | private uint _localID; |
600 | public uint LocalID | ||
601 | { | ||
602 | get { return _localID; } | ||
603 | set { _localID = value; } | ||
604 | } | ||
605 | private UUID _reqID; | ||
606 | public UUID ReqID | ||
607 | { | ||
608 | get { return _reqID; } | ||
609 | set { _reqID = value; } | ||
610 | } | ||
611 | public XmlRpcRequest Request; | ||
612 | public int ResponseIdata; | ||
613 | public string ResponseSdata; | ||
614 | public string Sdata; | ||
593 | 615 | ||
594 | public SendRemoteDataRequest(uint localID, UUID itemID, string channel, string dest, int idata, string sdata) | 616 | public SendRemoteDataRequest(uint localID, UUID itemID, string channel, string dest, int idata, string sdata) |
595 | { | 617 | { |
596 | this.channel = channel; | 618 | this.Channel = channel; |
597 | destURL = dest; | 619 | DestURL = dest; |
598 | this.idata = idata; | 620 | this.Idata = idata; |
599 | this.sdata = sdata; | 621 | this.Sdata = sdata; |
600 | m_itemID = itemID; | 622 | ItemID = itemID; |
601 | m_localID = localID; | 623 | LocalID = localID; |
602 | 624 | ||
603 | reqID = UUID.Random(); | 625 | ReqID = UUID.Random(); |
604 | } | 626 | } |
605 | 627 | ||
606 | public UUID process() | 628 | public void Process() |
607 | { | 629 | { |
608 | httpThread = new Thread(SendRequest); | 630 | httpThread = new Thread(SendRequest); |
609 | httpThread.Name = "HttpRequestThread"; | 631 | httpThread.Name = "HttpRequestThread"; |
610 | httpThread.Priority = ThreadPriority.BelowNormal; | 632 | httpThread.Priority = ThreadPriority.BelowNormal; |
611 | httpThread.IsBackground = true; | 633 | httpThread.IsBackground = true; |
612 | finished = false; | 634 | _finished = false; |
613 | httpThread.Start(); | 635 | httpThread.Start(); |
614 | ThreadTracker.Add(httpThread); | 636 | ThreadTracker.Add(httpThread); |
615 | |||
616 | return reqID; | ||
617 | } | 637 | } |
618 | 638 | ||
619 | /* | 639 | /* |
@@ -629,21 +649,21 @@ namespace OpenSim.Region.Environment.Modules.Scripting.XMLRPC | |||
629 | // if not, use as method name | 649 | // if not, use as method name |
630 | UUID parseUID; | 650 | UUID parseUID; |
631 | string mName = "llRemoteData"; | 651 | string mName = "llRemoteData"; |
632 | if ((channel != null) && (channel != "")) | 652 | if ((Channel != null) && (Channel != "")) |
633 | if (!UUID.TryParse(channel, out parseUID)) | 653 | if (!UUID.TryParse(Channel, out parseUID)) |
634 | mName = channel; | 654 | mName = Channel; |
635 | else | 655 | else |
636 | param["Channel"] = channel; | 656 | param["Channel"] = Channel; |
637 | 657 | ||
638 | param["StringValue"] = sdata; | 658 | param["StringValue"] = Sdata; |
639 | param["IntValue"] = Convert.ToString(idata); | 659 | param["IntValue"] = Convert.ToString(Idata); |
640 | 660 | ||
641 | ArrayList parameters = new ArrayList(); | 661 | ArrayList parameters = new ArrayList(); |
642 | parameters.Add(param); | 662 | parameters.Add(param); |
643 | XmlRpcRequest req = new XmlRpcRequest(mName, parameters); | 663 | XmlRpcRequest req = new XmlRpcRequest(mName, parameters); |
644 | try | 664 | try |
645 | { | 665 | { |
646 | XmlRpcResponse resp = req.Send(destURL, 30000); | 666 | XmlRpcResponse resp = req.Send(DestURL, 30000); |
647 | if (resp != null) | 667 | if (resp != null) |
648 | { | 668 | { |
649 | Hashtable respParms; | 669 | Hashtable respParms; |
@@ -660,31 +680,31 @@ namespace OpenSim.Region.Environment.Modules.Scripting.XMLRPC | |||
660 | { | 680 | { |
661 | if (respParms.Contains("StringValue")) | 681 | if (respParms.Contains("StringValue")) |
662 | { | 682 | { |
663 | sdata = (string) respParms["StringValue"]; | 683 | Sdata = (string) respParms["StringValue"]; |
664 | } | 684 | } |
665 | if (respParms.Contains("IntValue")) | 685 | if (respParms.Contains("IntValue")) |
666 | { | 686 | { |
667 | idata = Convert.ToInt32((string) respParms["IntValue"]); | 687 | Idata = Convert.ToInt32((string) respParms["IntValue"]); |
668 | } | 688 | } |
669 | if (respParms.Contains("faultString")) | 689 | if (respParms.Contains("faultString")) |
670 | { | 690 | { |
671 | sdata = (string) respParms["faultString"]; | 691 | Sdata = (string) respParms["faultString"]; |
672 | } | 692 | } |
673 | if (respParms.Contains("faultCode")) | 693 | if (respParms.Contains("faultCode")) |
674 | { | 694 | { |
675 | idata = Convert.ToInt32(respParms["faultCode"]); | 695 | Idata = Convert.ToInt32(respParms["faultCode"]); |
676 | } | 696 | } |
677 | } | 697 | } |
678 | } | 698 | } |
679 | } | 699 | } |
680 | catch (Exception we) | 700 | catch (Exception we) |
681 | { | 701 | { |
682 | sdata = we.Message; | 702 | Sdata = we.Message; |
683 | m_log.Warn("[SendRemoteDataRequest]: Request failed"); | 703 | m_log.Warn("[SendRemoteDataRequest]: Request failed"); |
684 | m_log.Warn(we.StackTrace); | 704 | m_log.Warn(we.StackTrace); |
685 | } | 705 | } |
686 | 706 | ||
687 | finished = true; | 707 | _finished = true; |
688 | } | 708 | } |
689 | 709 | ||
690 | public void Stop() | 710 | public void Stop() |
@@ -700,7 +720,7 @@ namespace OpenSim.Region.Environment.Modules.Scripting.XMLRPC | |||
700 | 720 | ||
701 | public UUID GetReqID() | 721 | public UUID GetReqID() |
702 | { | 722 | { |
703 | return reqID; | 723 | return ReqID; |
704 | } | 724 | } |
705 | } | 725 | } |
706 | } | 726 | } |