aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorDiva Canto2012-11-11 15:29:25 -0800
committerDiva Canto2012-11-11 15:29:25 -0800
commit571f6a030002e754e9c711218396fa649ac28de6 (patch)
tree902f6466bacaa27cd962a0138c27e93658e6b9af /OpenSim/Region
parentOne more module converted: VectorRenderModule. (diff)
downloadopensim-SC_OLD-571f6a030002e754e9c711218396fa649ac28de6.zip
opensim-SC_OLD-571f6a030002e754e9c711218396fa649ac28de6.tar.gz
opensim-SC_OLD-571f6a030002e754e9c711218396fa649ac28de6.tar.bz2
opensim-SC_OLD-571f6a030002e754e9c711218396fa649ac28de6.tar.xz
One more module converted: XMLRPCModule. Removed it from the special loading at start.
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/CoreModules/Scripting/XMLRPC/XMLRPCModule.cs82
1 files changed, 51 insertions, 31 deletions
diff --git a/OpenSim/Region/CoreModules/Scripting/XMLRPC/XMLRPCModule.cs b/OpenSim/Region/CoreModules/Scripting/XMLRPC/XMLRPCModule.cs
index 0003af2..385f5ad 100644
--- a/OpenSim/Region/CoreModules/Scripting/XMLRPC/XMLRPCModule.cs
+++ b/OpenSim/Region/CoreModules/Scripting/XMLRPC/XMLRPCModule.cs
@@ -40,6 +40,7 @@ using OpenSim.Framework.Servers;
40using OpenSim.Framework.Servers.HttpServer; 40using OpenSim.Framework.Servers.HttpServer;
41using OpenSim.Region.Framework.Interfaces; 41using OpenSim.Region.Framework.Interfaces;
42using OpenSim.Region.Framework.Scenes; 42using OpenSim.Region.Framework.Scenes;
43using Mono.Addins;
43 44
44/***************************************************** 45/*****************************************************
45 * 46 *
@@ -76,7 +77,8 @@ using OpenSim.Region.Framework.Scenes;
76 77
77namespace OpenSim.Region.CoreModules.Scripting.XMLRPC 78namespace OpenSim.Region.CoreModules.Scripting.XMLRPC
78{ 79{
79 public class XMLRPCModule : IRegionModule, IXMLRPC 80 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "XMLRPCModule")]
81 public class XMLRPCModule : ISharedRegionModule, IXMLRPC
80 { 82 {
81 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 83 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
82 84
@@ -86,6 +88,10 @@ namespace OpenSim.Region.CoreModules.Scripting.XMLRPC
86 private Dictionary<UUID, RPCChannelInfo> m_openChannels; 88 private Dictionary<UUID, RPCChannelInfo> m_openChannels;
87 private Dictionary<UUID, SendRemoteDataRequest> m_pendingSRDResponses; 89 private Dictionary<UUID, SendRemoteDataRequest> m_pendingSRDResponses;
88 private int m_remoteDataPort = 0; 90 private int m_remoteDataPort = 0;
91 public int Port
92 {
93 get { return m_remoteDataPort; }
94 }
89 95
90 private Dictionary<UUID, RPCRequestInfo> m_rpcPending; 96 private Dictionary<UUID, RPCRequestInfo> m_rpcPending;
91 private Dictionary<UUID, RPCRequestInfo> m_rpcPendingResponses; 97 private Dictionary<UUID, RPCRequestInfo> m_rpcPendingResponses;
@@ -94,34 +100,24 @@ namespace OpenSim.Region.CoreModules.Scripting.XMLRPC
94 private int RemoteReplyScriptWait = 300; 100 private int RemoteReplyScriptWait = 300;
95 private object XMLRPCListLock = new object(); 101 private object XMLRPCListLock = new object();
96 102
97 #region IRegionModule Members 103 #region ISharedRegionModule Members
98 104
99 public void Initialise(Scene scene, IConfigSource config) 105 public void Initialise(IConfigSource config)
100 { 106 {
101 // We need to create these early because the scripts might be calling 107 // We need to create these early because the scripts might be calling
102 // But since this gets called for every region, we need to make sure they 108 // But since this gets called for every region, we need to make sure they
103 // get called only one time (or we lose any open channels) 109 // get called only one time (or we lose any open channels)
104 if (null == m_openChannels) 110 m_openChannels = new Dictionary<UUID, RPCChannelInfo>();
105 { 111 m_rpcPending = new Dictionary<UUID, RPCRequestInfo>();
106 m_openChannels = new Dictionary<UUID, RPCChannelInfo>(); 112 m_rpcPendingResponses = new Dictionary<UUID, RPCRequestInfo>();
107 m_rpcPending = new Dictionary<UUID, RPCRequestInfo>(); 113 m_pendingSRDResponses = new Dictionary<UUID, SendRemoteDataRequest>();
108 m_rpcPendingResponses = new Dictionary<UUID, RPCRequestInfo>();
109 m_pendingSRDResponses = new Dictionary<UUID, SendRemoteDataRequest>();
110 114
111 try 115 try
112 { 116 {
113 m_remoteDataPort = config.Configs["XMLRPC"].GetInt("XmlRpcPort", m_remoteDataPort); 117 m_remoteDataPort = config.Configs["XMLRPC"].GetInt("XmlRpcPort", m_remoteDataPort);
114 }
115 catch (Exception)
116 {
117 }
118 } 118 }
119 119 catch (Exception)
120 if (!m_scenes.Contains(scene))
121 { 120 {
122 m_scenes.Add(scene);
123
124 scene.RegisterModuleInterface<IXMLRPC>(this);
125 } 121 }
126 } 122 }
127 123
@@ -131,32 +127,56 @@ namespace OpenSim.Region.CoreModules.Scripting.XMLRPC
131 { 127 {
132 // Start http server 128 // Start http server
133 // Attach xmlrpc handlers 129 // Attach xmlrpc handlers
134// m_log.InfoFormat( 130 // m_log.InfoFormat(
135// "[XML RPC MODULE]: Starting up XMLRPC Server on port {0} for llRemoteData commands.", 131 // "[XML RPC MODULE]: Starting up XMLRPC Server on port {0} for llRemoteData commands.",
136// m_remoteDataPort); 132 // m_remoteDataPort);
137 133
138 IHttpServer httpServer = MainServer.GetHttpServer((uint)m_remoteDataPort); 134 IHttpServer httpServer = MainServer.GetHttpServer((uint)m_remoteDataPort);
139 httpServer.AddXmlRPCHandler("llRemoteData", XmlRpcRemoteData); 135 httpServer.AddXmlRPCHandler("llRemoteData", XmlRpcRemoteData);
140 } 136 }
141 } 137 }
142 138
143 public void Close() 139 public void AddRegion(Scene scene)
140 {
141 if (!IsEnabled())
142 return;
143
144 if (!m_scenes.Contains(scene))
145 {
146 m_scenes.Add(scene);
147
148 scene.RegisterModuleInterface<IXMLRPC>(this);
149 }
150 }
151
152 public void RegionLoaded(Scene scene)
144 { 153 {
145 } 154 }
146 155
147 public string Name 156 public void RemoveRegion(Scene scene)
148 { 157 {
149 get { return m_name; } 158 if (!IsEnabled())
159 return;
160
161 if (m_scenes.Contains(scene))
162 {
163 scene.UnregisterModuleInterface<IXMLRPC>(this);
164 m_scenes.Remove(scene);
165 }
150 } 166 }
151 167
152 public bool IsSharedModule 168 public void Close()
153 { 169 {
154 get { return true; }
155 } 170 }
156 171
157 public int Port 172 public string Name
158 { 173 {
159 get { return m_remoteDataPort; } 174 get { return m_name; }
175 }
176
177 public Type ReplaceableInterface
178 {
179 get { return null; }
160 } 180 }
161 181
162 #endregion 182 #endregion