aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Modules/Scripting/XMLRPC
diff options
context:
space:
mode:
authorDr Scofield2009-02-06 16:55:34 +0000
committerDr Scofield2009-02-06 16:55:34 +0000
commit9b66108081a8c8cf79faaa6c541554091c40850e (patch)
tree095a232ae5a9de3a9244bcd34da08294f61eeea5 /OpenSim/Region/Environment/Modules/Scripting/XMLRPC
parent* removed superfluous constants class (diff)
downloadopensim-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/XMLRPC')
-rw-r--r--OpenSim/Region/Environment/Modules/Scripting/XMLRPC/XMLRPCModule.cs110
1 files changed, 65 insertions, 45 deletions
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;
37using Nwc.XmlRpc; 37using Nwc.XmlRpc;
38using OpenSim.Framework; 38using OpenSim.Framework;
39using OpenSim.Framework.Servers; 39using OpenSim.Framework.Servers;
40using OpenSim.Region.Environment.Interfaces; 40using OpenSim.Region.Framework.Interfaces;
41using OpenSim.Region.Environment.Scenes; 41using 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}