29 using System.Collections.Generic;
30 using System.Reflection;
37 using OpenSim.Framework;
38 using OpenSim.Framework.Servers;
39 using OpenSim.Framework.Servers.HttpServer;
40 using OpenSim.Framework.Client;
41 using OpenSim.Region.Framework.Interfaces;
42 using OpenSim.Region.Framework.Scenes;
44 namespace OpenSim.
Region.OptionalModules.Scripting.XmlRpcGridRouterModule
53 [Extension(Path =
"/OpenSim/RegionModules", NodeName =
"RegionModule", Id =
"XmlRpcGridRouter")]
56 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
58 private Dictionary<UUID, UUID> m_Channels =
59 new Dictionary<UUID, UUID>();
61 private bool m_Enabled =
false;
62 private string m_ServerURI = String.Empty;
64 #region INonSharedRegionModule
68 IConfig startupConfig = config.Configs[
"XMLRPC"];
69 if (startupConfig == null)
72 if (startupConfig.GetString(
"XmlRpcRouterModule",
73 "XmlRpcRouterModule") ==
"XmlRpcGridRouterModule")
75 m_ServerURI = startupConfig.GetString(
"XmlRpcHubURI", String.Empty);
76 if (m_ServerURI ==
String.Empty)
78 m_log.Error(
"[XMLRPC GRID ROUTER] Module configured but no URI given. Disabling");
93 if ( scriptEngine != null )
119 get {
return "XmlRpcGridRouterModule"; }
122 public Type ReplaceableInterface
134 m_log.InfoFormat(
"[XMLRPC GRID ROUTER]: New receiver Obj: {0} Ch: {1} ID: {2} URI: {3}",
135 objectID.ToString(), channel.ToString(), itemID.ToString(), uri);
138 info.channel = channel;
142 bool success = SynchronousRestObjectRequester.MakeRequest<
XmlRpcInfo,
bool>(
143 "POST", m_ServerURI+
"/RegisterChannel/", info);
147 m_log.Error(
"[XMLRPC GRID ROUTER] Error contacting server");
150 m_Channels[itemID] = channel;
159 RemoveChannel(itemID);
168 RemoveChannel(itemID);
177 private bool RemoveChannel(UUID itemID)
179 if(!m_Channels.ContainsKey(itemID))
185 XmlRpcInfo info =
new XmlRpcInfo();
187 info.channel = m_Channels[itemID];
189 info.uri =
"http://0.0.0.0:00";
193 bool success = SynchronousRestObjectRequester.MakeRequest<XmlRpcInfo,
bool>(
194 "POST", m_ServerURI+
"/RemoveChannel/", info);
198 m_log.Error(
"[XMLRPC GRID ROUTER] Error contacting server");
201 m_Channels.Remove(itemID);
void RegionLoaded(Scene scene)
This will be called once for every scene loaded. In a shared module this will be multiple times in on...
void AddRegion(Scene scene)
This is called whenever a Scene is added. For shared modules, this can happen several times...
void RegisterNewReceiver(IScriptModule scriptEngine, UUID channel, UUID objectID, UUID itemID, string uri)
void RemoveRegion(Scene scene)
This is called whenever a Scene is removed. For shared modules, this can happen several times...
void ScriptRemoved(UUID itemID)
void UnRegisterReceiver(string channelID, UUID itemID)
void Close()
This is the inverse to Initialise. After a Close(), this instance won't be usable anymore...
delegate void ObjectRemoved(UUID prim)
void ObjectRemoved(UUID objectID)
Interactive OpenSim region server
void Initialise(IConfigSource config)
This is called to initialize the region module. For shared modules, this is called exactly once...
delegate void ScriptRemoved(UUID script)