One more module converted: XMLRPCModule. Removed it from the special loading at start.

integration
Diva Canto 2012-11-11 15:29:25 -08:00
parent 4de8915ddd
commit 571f6a0300
2 changed files with 53 additions and 33 deletions

View File

@ -103,8 +103,8 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
//m_openSim.ModuleLoader.LoadDefaultSharedModule(new DynamicTextureModule()); //m_openSim.ModuleLoader.LoadDefaultSharedModule(new DynamicTextureModule());
//m_log.Info("[LOAD REGIONS PLUGIN]: LoadImageURLModule..."); //m_log.Info("[LOAD REGIONS PLUGIN]: LoadImageURLModule...");
//m_openSim.ModuleLoader.LoadDefaultSharedModule(new LoadImageURLModule()); //m_openSim.ModuleLoader.LoadDefaultSharedModule(new LoadImageURLModule());
m_log.Info("[LOAD REGIONS PLUGIN]: XMLRPCModule..."); //m_log.Info("[LOAD REGIONS PLUGIN]: XMLRPCModule...");
m_openSim.ModuleLoader.LoadDefaultSharedModule(new XMLRPCModule()); //m_openSim.ModuleLoader.LoadDefaultSharedModule(new XMLRPCModule());
// m_log.Info("[LOADREGIONSPLUGIN]: AssetTransactionModule..."); // m_log.Info("[LOADREGIONSPLUGIN]: AssetTransactionModule...");
// m_openSim.ModuleLoader.LoadDefaultSharedModule(new AssetTransactionModule()); // m_openSim.ModuleLoader.LoadDefaultSharedModule(new AssetTransactionModule());
m_log.Info("[LOAD REGIONS PLUGIN]: Done."); m_log.Info("[LOAD REGIONS PLUGIN]: Done.");

View File

@ -40,6 +40,7 @@ using OpenSim.Framework.Servers;
using OpenSim.Framework.Servers.HttpServer; using OpenSim.Framework.Servers.HttpServer;
using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Scenes;
using Mono.Addins;
/***************************************************** /*****************************************************
* *
@ -76,7 +77,8 @@ using OpenSim.Region.Framework.Scenes;
namespace OpenSim.Region.CoreModules.Scripting.XMLRPC namespace OpenSim.Region.CoreModules.Scripting.XMLRPC
{ {
public class XMLRPCModule : IRegionModule, IXMLRPC [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "XMLRPCModule")]
public class XMLRPCModule : ISharedRegionModule, IXMLRPC
{ {
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@ -86,6 +88,10 @@ namespace OpenSim.Region.CoreModules.Scripting.XMLRPC
private Dictionary<UUID, RPCChannelInfo> m_openChannels; private Dictionary<UUID, RPCChannelInfo> m_openChannels;
private Dictionary<UUID, SendRemoteDataRequest> m_pendingSRDResponses; private Dictionary<UUID, SendRemoteDataRequest> m_pendingSRDResponses;
private int m_remoteDataPort = 0; private int m_remoteDataPort = 0;
public int Port
{
get { return m_remoteDataPort; }
}
private Dictionary<UUID, RPCRequestInfo> m_rpcPending; private Dictionary<UUID, RPCRequestInfo> m_rpcPending;
private Dictionary<UUID, RPCRequestInfo> m_rpcPendingResponses; private Dictionary<UUID, RPCRequestInfo> m_rpcPendingResponses;
@ -94,34 +100,24 @@ namespace OpenSim.Region.CoreModules.Scripting.XMLRPC
private int RemoteReplyScriptWait = 300; private int RemoteReplyScriptWait = 300;
private object XMLRPCListLock = new object(); private object XMLRPCListLock = new object();
#region IRegionModule Members #region ISharedRegionModule Members
public void Initialise(Scene scene, IConfigSource config) public void Initialise(IConfigSource config)
{ {
// We need to create these early because the scripts might be calling // We need to create these early because the scripts might be calling
// But since this gets called for every region, we need to make sure they // But since this gets called for every region, we need to make sure they
// get called only one time (or we lose any open channels) // get called only one time (or we lose any open channels)
if (null == m_openChannels) m_openChannels = new Dictionary<UUID, RPCChannelInfo>();
{ m_rpcPending = new Dictionary<UUID, RPCRequestInfo>();
m_openChannels = new Dictionary<UUID, RPCChannelInfo>(); m_rpcPendingResponses = new Dictionary<UUID, RPCRequestInfo>();
m_rpcPending = new Dictionary<UUID, RPCRequestInfo>(); m_pendingSRDResponses = new Dictionary<UUID, SendRemoteDataRequest>();
m_rpcPendingResponses = new Dictionary<UUID, RPCRequestInfo>();
m_pendingSRDResponses = new Dictionary<UUID, SendRemoteDataRequest>();
try try
{ {
m_remoteDataPort = config.Configs["XMLRPC"].GetInt("XmlRpcPort", m_remoteDataPort); m_remoteDataPort = config.Configs["XMLRPC"].GetInt("XmlRpcPort", m_remoteDataPort);
}
catch (Exception)
{
}
} }
catch (Exception)
if (!m_scenes.Contains(scene))
{ {
m_scenes.Add(scene);
scene.RegisterModuleInterface<IXMLRPC>(this);
} }
} }
@ -131,15 +127,44 @@ namespace OpenSim.Region.CoreModules.Scripting.XMLRPC
{ {
// Start http server // Start http server
// Attach xmlrpc handlers // Attach xmlrpc handlers
// m_log.InfoFormat( // m_log.InfoFormat(
// "[XML RPC MODULE]: Starting up XMLRPC Server on port {0} for llRemoteData commands.", // "[XML RPC MODULE]: Starting up XMLRPC Server on port {0} for llRemoteData commands.",
// m_remoteDataPort); // m_remoteDataPort);
IHttpServer httpServer = MainServer.GetHttpServer((uint)m_remoteDataPort); IHttpServer httpServer = MainServer.GetHttpServer((uint)m_remoteDataPort);
httpServer.AddXmlRPCHandler("llRemoteData", XmlRpcRemoteData); httpServer.AddXmlRPCHandler("llRemoteData", XmlRpcRemoteData);
} }
} }
public void AddRegion(Scene scene)
{
if (!IsEnabled())
return;
if (!m_scenes.Contains(scene))
{
m_scenes.Add(scene);
scene.RegisterModuleInterface<IXMLRPC>(this);
}
}
public void RegionLoaded(Scene scene)
{
}
public void RemoveRegion(Scene scene)
{
if (!IsEnabled())
return;
if (m_scenes.Contains(scene))
{
scene.UnregisterModuleInterface<IXMLRPC>(this);
m_scenes.Remove(scene);
}
}
public void Close() public void Close()
{ {
} }
@ -149,14 +174,9 @@ namespace OpenSim.Region.CoreModules.Scripting.XMLRPC
get { return m_name; } get { return m_name; }
} }
public bool IsSharedModule public Type ReplaceableInterface
{ {
get { return true; } get { return null; }
}
public int Port
{
get { return m_remoteDataPort; }
} }
#endregion #endregion