Two more modules converted: XmlRpcGridRouterModule and XmlRpcRouterModule.

integration
Diva Canto 2012-11-11 16:44:59 -08:00
parent 4e8c8b2cd8
commit 64fad2f80e
2 changed files with 60 additions and 18 deletions

View File

@ -32,6 +32,7 @@ using System.Reflection;
using log4net; using log4net;
using Nini.Config; using Nini.Config;
using OpenMetaverse; using OpenMetaverse;
using Mono.Addins;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Framework.Communications; using OpenSim.Framework.Communications;
@ -49,7 +50,8 @@ namespace OpenSim.Region.OptionalModules.Scripting.XmlRpcGridRouterModule
public string uri; public string uri;
} }
public class XmlRpcGridRouter : IRegionModule, IXmlRpcRouter [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "XmlRpcGridRouter")]
public class XmlRpcGridRouter : INonSharedRegionModule, IXmlRpcRouter
{ {
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@ -59,9 +61,11 @@ namespace OpenSim.Region.OptionalModules.Scripting.XmlRpcGridRouterModule
private bool m_Enabled = false; private bool m_Enabled = false;
private string m_ServerURI = String.Empty; private string m_ServerURI = String.Empty;
public void Initialise(Scene scene, IConfigSource config) #region INonSharedRegionModule
public void Initialise(IConfigSource config)
{ {
IConfig startupConfig = config.Configs["Startup"]; IConfig startupConfig = config.Configs["XMLRPC"];
if (startupConfig == null) if (startupConfig == null)
return; return;
@ -74,14 +78,28 @@ namespace OpenSim.Region.OptionalModules.Scripting.XmlRpcGridRouterModule
m_log.Error("[XMLRPC GRID ROUTER] Module configured but no URI given. Disabling"); m_log.Error("[XMLRPC GRID ROUTER] Module configured but no URI given. Disabling");
return; return;
} }
scene.RegisterModuleInterface<IXmlRpcRouter>(this);
m_Enabled = true; m_Enabled = true;
} }
} }
public void PostInitialise() public void AddRegion(Scene scene)
{ {
if (!m_Enabled)
return;
scene.RegisterModuleInterface<IXmlRpcRouter>(this);
}
public void RegionLoaded(Scene scene)
{
}
public void RemoveRegion(Scene scene)
{
if (!m_Enabled)
return;
scene.UnregisterModuleInterface<IXmlRpcRouter>(this);
} }
public void Close() public void Close()
@ -93,11 +111,13 @@ namespace OpenSim.Region.OptionalModules.Scripting.XmlRpcGridRouterModule
get { return "XmlRpcGridRouterModule"; } get { return "XmlRpcGridRouterModule"; }
} }
public bool IsSharedModule public Type ReplaceableInterface
{ {
get { return false; } get { return null; }
} }
#endregion
public void RegisterNewReceiver(IScriptModule scriptEngine, UUID channel, UUID objectID, UUID itemID, string uri) public void RegisterNewReceiver(IScriptModule scriptEngine, UUID channel, UUID objectID, UUID itemID, string uri)
{ {
if (!m_Channels.ContainsKey(itemID)) if (!m_Channels.ContainsKey(itemID))

View File

@ -31,6 +31,7 @@ using System.Reflection;
using log4net; using log4net;
using Nini.Config; using Nini.Config;
using OpenMetaverse; using OpenMetaverse;
using Mono.Addins;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Interfaces;
@ -39,25 +40,44 @@ using OpenSim.Region.Framework.Scenes;
namespace OpenSim.Region.OptionalModules.Scripting.XmlRpcRouterModule namespace OpenSim.Region.OptionalModules.Scripting.XmlRpcRouterModule
{ {
public class XmlRpcRouter : IRegionModule, IXmlRpcRouter [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "XmlRpcRouter")]
public class XmlRpcRouter : INonSharedRegionModule, IXmlRpcRouter
{ {
//private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public void Initialise(Scene scene, IConfigSource config) private bool m_Enabled;
#region INonSharedRegionModule
public void Initialise(IConfigSource config)
{ {
IConfig startupConfig = config.Configs["Startup"]; IConfig startupConfig = config.Configs["XMLRPC"];
if (startupConfig == null) if (startupConfig == null)
return; return;
if (startupConfig.GetString("XmlRpcRouterModule", if (startupConfig.GetString("XmlRpcRouterModule",
"XmlRpcRouterModule") == "XmlRpcRouterModule") "XmlRpcRouterModule") == "XmlRpcRouterModule")
{ m_Enabled = true;
scene.RegisterModuleInterface<IXmlRpcRouter>(this);
}
} }
public void PostInitialise() public void AddRegion(Scene scene)
{ {
if (!m_Enabled)
return;
scene.RegisterModuleInterface<IXmlRpcRouter>(this);
}
public void RegionLoaded(Scene scene)
{
}
public void RemoveRegion(Scene scene)
{
if (!m_Enabled)
return;
scene.UnregisterModuleInterface<IXmlRpcRouter>(this);
} }
public void Close() public void Close()
@ -69,11 +89,13 @@ namespace OpenSim.Region.OptionalModules.Scripting.XmlRpcRouterModule
get { return "XmlRpcRouterModule"; } get { return "XmlRpcRouterModule"; }
} }
public bool IsSharedModule public Type ReplaceableInterface
{ {
get { return false; } get { return null; }
} }
#endregion
public void RegisterNewReceiver(IScriptModule scriptEngine, UUID channel, UUID objectID, UUID itemID, string uri) public void RegisterNewReceiver(IScriptModule scriptEngine, UUID channel, UUID objectID, UUID itemID, string uri)
{ {
scriptEngine.PostScriptEvent(itemID, "xmlrpc_uri", new Object[] {uri}); scriptEngine.PostScriptEvent(itemID, "xmlrpc_uri", new Object[] {uri});