diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/CoreModules/Scripting/ScriptModuleComms/ScriptModuleCommsModule.cs (renamed from OpenSim/Region/OptionalModules/Scripting/ScriptModuleComms/ScriptModuleCommsModule.cs) | 83 | ||||
-rw-r--r-- | OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreModule.cs | 16 | ||||
-rw-r--r-- | OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreScriptModule.cs | 4 | ||||
-rw-r--r-- | OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs | 91 | ||||
-rw-r--r-- | OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs | 7 | ||||
-rw-r--r-- | OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs | 4 | ||||
-rw-r--r-- | OpenSim/Region/OptionalModules/Scripting/XmlRpcRouterModule/XmlRpcGridRouterModule.cs | 36 | ||||
-rw-r--r-- | OpenSim/Region/OptionalModules/Scripting/XmlRpcRouterModule/XmlRpcRouterModule.cs | 49 |
8 files changed, 206 insertions, 84 deletions
diff --git a/OpenSim/Region/OptionalModules/Scripting/ScriptModuleComms/ScriptModuleCommsModule.cs b/OpenSim/Region/CoreModules/Scripting/ScriptModuleComms/ScriptModuleCommsModule.cs index c5c96a9..f6e1d39 100644 --- a/OpenSim/Region/OptionalModules/Scripting/ScriptModuleComms/ScriptModuleCommsModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/ScriptModuleComms/ScriptModuleCommsModule.cs | |||
@@ -38,7 +38,7 @@ using OpenMetaverse; | |||
38 | using System.Linq; | 38 | using System.Linq; |
39 | using System.Linq.Expressions; | 39 | using System.Linq.Expressions; |
40 | 40 | ||
41 | namespace OpenSim.Region.OptionalModules.Scripting.ScriptModuleComms | 41 | namespace OpenSim.Region.CoreModules.Scripting.ScriptModuleComms |
42 | { | 42 | { |
43 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "ScriptModuleCommsModule")] | 43 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "ScriptModuleCommsModule")] |
44 | class ScriptModuleCommsModule : INonSharedRegionModule, IScriptModuleComms | 44 | class ScriptModuleCommsModule : INonSharedRegionModule, IScriptModuleComms |
@@ -130,13 +130,25 @@ namespace OpenSim.Region.OptionalModules.Scripting.ScriptModuleComms | |||
130 | m_scriptModule.PostScriptEvent(script, "link_message", args); | 130 | m_scriptModule.PostScriptEvent(script, "link_message", args); |
131 | } | 131 | } |
132 | 132 | ||
133 | private static MethodInfo GetMethodInfoFromType(Type target, string meth, bool searchInstanceMethods) | ||
134 | { | ||
135 | BindingFlags getMethodFlags = | ||
136 | BindingFlags.NonPublic | BindingFlags.Public; | ||
137 | |||
138 | if (searchInstanceMethods) | ||
139 | getMethodFlags |= BindingFlags.Instance; | ||
140 | else | ||
141 | getMethodFlags |= BindingFlags.Static; | ||
142 | |||
143 | return target.GetMethod(meth, getMethodFlags); | ||
144 | } | ||
145 | |||
133 | public void RegisterScriptInvocation(object target, string meth) | 146 | public void RegisterScriptInvocation(object target, string meth) |
134 | { | 147 | { |
135 | MethodInfo mi = target.GetType().GetMethod(meth, | 148 | MethodInfo mi = GetMethodInfoFromType(target.GetType(), meth, true); |
136 | BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance); | ||
137 | if (mi == null) | 149 | if (mi == null) |
138 | { | 150 | { |
139 | m_log.WarnFormat("[MODULE COMMANDS] Failed to register method {0}",meth); | 151 | m_log.WarnFormat("[MODULE COMMANDS] Failed to register method {0}", meth); |
140 | return; | 152 | return; |
141 | } | 153 | } |
142 | 154 | ||
@@ -151,38 +163,71 @@ namespace OpenSim.Region.OptionalModules.Scripting.ScriptModuleComms | |||
151 | 163 | ||
152 | public void RegisterScriptInvocation(object target, MethodInfo mi) | 164 | public void RegisterScriptInvocation(object target, MethodInfo mi) |
153 | { | 165 | { |
154 | m_log.DebugFormat("[MODULE COMMANDS] Register method {0} from type {1}", mi.Name, target.GetType().Name); | 166 | m_log.DebugFormat("[MODULE COMMANDS] Register method {0} from type {1}", mi.Name, (target is Type) ? ((Type)target).Name : target.GetType().Name); |
155 | 167 | ||
156 | Type delegateType; | 168 | Type delegateType; |
157 | var typeArgs = mi.GetParameters() | 169 | List<Type> typeArgs = mi.GetParameters() |
158 | .Select(p => p.ParameterType) | 170 | .Select(p => p.ParameterType) |
159 | .ToList(); | 171 | .ToList(); |
160 | 172 | ||
161 | if (mi.ReturnType == typeof(void)) | 173 | if (mi.ReturnType == typeof(void)) |
162 | { | 174 | { |
163 | delegateType = Expression.GetActionType(typeArgs.ToArray()); | 175 | delegateType = Expression.GetActionType(typeArgs.ToArray()); |
164 | } | 176 | } |
165 | else | 177 | else |
166 | { | 178 | { |
167 | typeArgs.Add(mi.ReturnType); | 179 | typeArgs.Add(mi.ReturnType); |
168 | delegateType = Expression.GetFuncType(typeArgs.ToArray()); | 180 | delegateType = Expression.GetFuncType(typeArgs.ToArray()); |
169 | } | 181 | } |
170 | 182 | ||
171 | Delegate fcall = Delegate.CreateDelegate(delegateType, target, mi); | 183 | Delegate fcall; |
184 | if (!(target is Type)) | ||
185 | fcall = Delegate.CreateDelegate(delegateType, target, mi); | ||
186 | else | ||
187 | fcall = Delegate.CreateDelegate(delegateType, (Type)target, mi.Name); | ||
172 | 188 | ||
173 | lock (m_scriptInvocation) | 189 | lock (m_scriptInvocation) |
174 | { | 190 | { |
175 | ParameterInfo[] parameters = fcall.Method.GetParameters (); | 191 | ParameterInfo[] parameters = fcall.Method.GetParameters(); |
176 | if (parameters.Length < 2) // Must have two UUID params | 192 | if (parameters.Length < 2) // Must have two UUID params |
177 | return; | 193 | return; |
178 | 194 | ||
179 | // Hide the first two parameters | 195 | // Hide the first two parameters |
180 | Type[] parmTypes = new Type[parameters.Length - 2]; | 196 | Type[] parmTypes = new Type[parameters.Length - 2]; |
181 | for (int i = 2 ; i < parameters.Length ; i++) | 197 | for (int i = 2; i < parameters.Length; i++) |
182 | parmTypes[i - 2] = parameters[i].ParameterType; | 198 | parmTypes[i - 2] = parameters[i].ParameterType; |
183 | m_scriptInvocation[fcall.Method.Name] = new ScriptInvocationData(fcall.Method.Name, fcall, parmTypes, fcall.Method.ReturnType); | 199 | m_scriptInvocation[fcall.Method.Name] = new ScriptInvocationData(fcall.Method.Name, fcall, parmTypes, fcall.Method.ReturnType); |
184 | } | 200 | } |
185 | } | 201 | } |
202 | |||
203 | public void RegisterScriptInvocation(Type target, string[] methods) | ||
204 | { | ||
205 | foreach (string method in methods) | ||
206 | { | ||
207 | MethodInfo mi = GetMethodInfoFromType(target, method, false); | ||
208 | if (mi == null) | ||
209 | m_log.WarnFormat("[MODULE COMMANDS] Failed to register method {0}", method); | ||
210 | else | ||
211 | RegisterScriptInvocation(target, mi); | ||
212 | } | ||
213 | } | ||
214 | |||
215 | public void RegisterScriptInvocations(IRegionModuleBase target) | ||
216 | { | ||
217 | foreach(MethodInfo method in target.GetType().GetMethods( | ||
218 | BindingFlags.Public | BindingFlags.Instance | | ||
219 | BindingFlags.Static)) | ||
220 | { | ||
221 | if(method.GetCustomAttributes( | ||
222 | typeof(ScriptInvocationAttribute), true).Any()) | ||
223 | { | ||
224 | if(method.IsStatic) | ||
225 | RegisterScriptInvocation(target.GetType(), method); | ||
226 | else | ||
227 | RegisterScriptInvocation(target, method); | ||
228 | } | ||
229 | } | ||
230 | } | ||
186 | 231 | ||
187 | public Delegate[] GetScriptInvocationList() | 232 | public Delegate[] GetScriptInvocationList() |
188 | { | 233 | { |
@@ -285,6 +330,20 @@ namespace OpenSim.Region.OptionalModules.Scripting.ScriptModuleComms | |||
285 | } | 330 | } |
286 | } | 331 | } |
287 | 332 | ||
333 | public void RegisterConstants(IRegionModuleBase target) | ||
334 | { | ||
335 | foreach (FieldInfo field in target.GetType().GetFields( | ||
336 | BindingFlags.Public | BindingFlags.Static | | ||
337 | BindingFlags.Instance)) | ||
338 | { | ||
339 | if (field.GetCustomAttributes( | ||
340 | typeof(ScriptConstantAttribute), true).Any()) | ||
341 | { | ||
342 | RegisterConstant(field.Name, field.GetValue(target)); | ||
343 | } | ||
344 | } | ||
345 | } | ||
346 | |||
288 | /// <summary> | 347 | /// <summary> |
289 | /// Operation to check for a registered constant | 348 | /// Operation to check for a registered constant |
290 | /// </summary> | 349 | /// </summary> |
diff --git a/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreModule.cs b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreModule.cs index 311531c..e68764a 100644 --- a/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreModule.cs +++ b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreModule.cs | |||
@@ -59,7 +59,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore | |||
59 | private Dictionary<UUID,JsonStore> m_JsonValueStore; | 59 | private Dictionary<UUID,JsonStore> m_JsonValueStore; |
60 | private UUID m_sharedStore; | 60 | private UUID m_sharedStore; |
61 | 61 | ||
62 | #region IRegionModule Members | 62 | #region Region Module interface |
63 | 63 | ||
64 | // ----------------------------------------------------------------- | 64 | // ----------------------------------------------------------------- |
65 | /// <summary> | 65 | /// <summary> |
@@ -175,14 +175,15 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore | |||
175 | /// | 175 | /// |
176 | /// </summary> | 176 | /// </summary> |
177 | // ----------------------------------------------------------------- | 177 | // ----------------------------------------------------------------- |
178 | public bool CreateStore(string value, out UUID result) | 178 | public bool CreateStore(string value, ref UUID result) |
179 | { | 179 | { |
180 | result = UUID.Zero; | 180 | if (result == UUID.Zero) |
181 | result = UUID.Random(); | ||
182 | |||
183 | JsonStore map = null; | ||
181 | 184 | ||
182 | if (! m_enabled) return false; | 185 | if (! m_enabled) return false; |
183 | 186 | ||
184 | UUID uuid = UUID.Random(); | ||
185 | JsonStore map = null; | ||
186 | 187 | ||
187 | try | 188 | try |
188 | { | 189 | { |
@@ -195,9 +196,8 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore | |||
195 | } | 196 | } |
196 | 197 | ||
197 | lock (m_JsonValueStore) | 198 | lock (m_JsonValueStore) |
198 | m_JsonValueStore.Add(uuid,map); | 199 | m_JsonValueStore.Add(result,map); |
199 | 200 | ||
200 | result = uuid; | ||
201 | return true; | 201 | return true; |
202 | } | 202 | } |
203 | 203 | ||
@@ -231,7 +231,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore | |||
231 | if (! m_JsonValueStore.TryGetValue(storeID,out map)) | 231 | if (! m_JsonValueStore.TryGetValue(storeID,out map)) |
232 | { | 232 | { |
233 | m_log.InfoFormat("[JsonStore] Missing store {0}",storeID); | 233 | m_log.InfoFormat("[JsonStore] Missing store {0}",storeID); |
234 | return true; | 234 | return false; |
235 | } | 235 | } |
236 | } | 236 | } |
237 | 237 | ||
diff --git a/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreScriptModule.cs b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreScriptModule.cs index eaba816..0c175ca 100644 --- a/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreScriptModule.cs +++ b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreScriptModule.cs | |||
@@ -58,7 +58,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore | |||
58 | private IScriptModuleComms m_comms; | 58 | private IScriptModuleComms m_comms; |
59 | private IJsonStoreModule m_store; | 59 | private IJsonStoreModule m_store; |
60 | 60 | ||
61 | #region IRegionModule Members | 61 | #region Region Module interface |
62 | 62 | ||
63 | // ----------------------------------------------------------------- | 63 | // ----------------------------------------------------------------- |
64 | /// <summary> | 64 | /// <summary> |
@@ -227,7 +227,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore | |||
227 | protected UUID JsonCreateStore(UUID hostID, UUID scriptID, string value) | 227 | protected UUID JsonCreateStore(UUID hostID, UUID scriptID, string value) |
228 | { | 228 | { |
229 | UUID uuid = UUID.Zero; | 229 | UUID uuid = UUID.Zero; |
230 | if (! m_store.CreateStore(value, out uuid)) | 230 | if (! m_store.CreateStore(value, ref uuid)) |
231 | GenerateRuntimeError("Failed to create Json store"); | 231 | GenerateRuntimeError("Failed to create Json store"); |
232 | 232 | ||
233 | return uuid; | 233 | return uuid; |
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs index 03481d2..6fb28e2 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs | |||
@@ -43,13 +43,17 @@ using OpenMetaverse; | |||
43 | using OpenSim.Framework; | 43 | using OpenSim.Framework; |
44 | using OpenSim.Region.Framework.Interfaces; | 44 | using OpenSim.Region.Framework.Interfaces; |
45 | using OpenSim.Region.Framework.Scenes; | 45 | using OpenSim.Region.Framework.Scenes; |
46 | using Mono.Addins; | ||
46 | 47 | ||
47 | namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | 48 | namespace OpenSim.Region.OptionalModules.Scripting.Minimodule |
48 | { | 49 | { |
49 | public class MRMModule : IRegionModule, IMRMModule | 50 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "MRMModule")] |
51 | public class MRMModule : INonSharedRegionModule, IMRMModule | ||
50 | { | 52 | { |
51 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 53 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
52 | private Scene m_scene; | 54 | private Scene m_scene; |
55 | private bool m_Enabled; | ||
56 | private bool m_Hidden; | ||
53 | 57 | ||
54 | private readonly Dictionary<UUID,MRMBase> m_scripts = new Dictionary<UUID, MRMBase>(); | 58 | private readonly Dictionary<UUID,MRMBase> m_scripts = new Dictionary<UUID, MRMBase>(); |
55 | 59 | ||
@@ -67,7 +71,9 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | |||
67 | m_extensions[typeof (T)] = instance; | 71 | m_extensions[typeof (T)] = instance; |
68 | } | 72 | } |
69 | 73 | ||
70 | public void Initialise(Scene scene, IConfigSource source) | 74 | #region INonSharedRegionModule |
75 | |||
76 | public void Initialise(IConfigSource source) | ||
71 | { | 77 | { |
72 | if (source.Configs["MRM"] != null) | 78 | if (source.Configs["MRM"] != null) |
73 | { | 79 | { |
@@ -76,23 +82,60 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | |||
76 | if (source.Configs["MRM"].GetBoolean("Enabled", false)) | 82 | if (source.Configs["MRM"].GetBoolean("Enabled", false)) |
77 | { | 83 | { |
78 | m_log.Info("[MRM]: Enabling MRM Module"); | 84 | m_log.Info("[MRM]: Enabling MRM Module"); |
79 | m_scene = scene; | 85 | m_Enabled = true; |
86 | m_Hidden = source.Configs["MRM"].GetBoolean("Hidden", false); | ||
87 | } | ||
88 | } | ||
89 | } | ||
80 | 90 | ||
81 | // when hidden, we don't listen for client initiated script events | 91 | public void AddRegion(Scene scene) |
82 | // only making the MRM engine available for region modules | 92 | { |
83 | if (!source.Configs["MRM"].GetBoolean("Hidden", false)) | 93 | if (!m_Enabled) |
84 | { | 94 | return; |
85 | scene.EventManager.OnRezScript += EventManager_OnRezScript; | ||
86 | scene.EventManager.OnStopScript += EventManager_OnStopScript; | ||
87 | } | ||
88 | 95 | ||
89 | scene.EventManager.OnFrame += EventManager_OnFrame; | 96 | m_scene = scene; |
90 | 97 | ||
91 | scene.RegisterModuleInterface<IMRMModule>(this); | 98 | // when hidden, we don't listen for client initiated script events |
92 | } | 99 | // only making the MRM engine available for region modules |
100 | if (!m_Hidden) | ||
101 | { | ||
102 | scene.EventManager.OnRezScript += EventManager_OnRezScript; | ||
103 | scene.EventManager.OnStopScript += EventManager_OnStopScript; | ||
93 | } | 104 | } |
105 | |||
106 | scene.EventManager.OnFrame += EventManager_OnFrame; | ||
107 | |||
108 | scene.RegisterModuleInterface<IMRMModule>(this); | ||
109 | } | ||
110 | |||
111 | public void RegionLoaded(Scene scene) | ||
112 | { | ||
94 | } | 113 | } |
95 | 114 | ||
115 | public void RemoveRegion(Scene scene) | ||
116 | { | ||
117 | } | ||
118 | |||
119 | public void Close() | ||
120 | { | ||
121 | foreach (KeyValuePair<UUID, MRMBase> pair in m_scripts) | ||
122 | { | ||
123 | pair.Value.Stop(); | ||
124 | } | ||
125 | } | ||
126 | |||
127 | public string Name | ||
128 | { | ||
129 | get { return "MiniRegionModule"; } | ||
130 | } | ||
131 | |||
132 | public Type ReplaceableInterface | ||
133 | { | ||
134 | get { return null; } | ||
135 | } | ||
136 | |||
137 | #endregion | ||
138 | |||
96 | void EventManager_OnStopScript(uint localID, UUID itemID) | 139 | void EventManager_OnStopScript(uint localID, UUID itemID) |
97 | { | 140 | { |
98 | if (m_scripts.ContainsKey(itemID)) | 141 | if (m_scripts.ContainsKey(itemID)) |
@@ -293,28 +336,6 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | |||
293 | mmb.InitMiniModule(world, host, itemID); | 336 | mmb.InitMiniModule(world, host, itemID); |
294 | } | 337 | } |
295 | 338 | ||
296 | public void PostInitialise() | ||
297 | { | ||
298 | } | ||
299 | |||
300 | public void Close() | ||
301 | { | ||
302 | foreach (KeyValuePair<UUID, MRMBase> pair in m_scripts) | ||
303 | { | ||
304 | pair.Value.Stop(); | ||
305 | } | ||
306 | } | ||
307 | |||
308 | public string Name | ||
309 | { | ||
310 | get { return "MiniRegionModule"; } | ||
311 | } | ||
312 | |||
313 | public bool IsSharedModule | ||
314 | { | ||
315 | get { return false; } | ||
316 | } | ||
317 | |||
318 | /// <summary> | 339 | /// <summary> |
319 | /// Stolen from ScriptEngine Common | 340 | /// Stolen from ScriptEngine Common |
320 | /// </summary> | 341 | /// </summary> |
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs index aa23fee..5ed1514 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs | |||
@@ -821,8 +821,11 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | |||
821 | { | 821 | { |
822 | if (!CanEdit()) | 822 | if (!CanEdit()) |
823 | return; | 823 | return; |
824 | 824 | ISoundModule module = m_rootScene.RequestModuleInterface<ISoundModule>(); | |
825 | GetSOP().SendSound(asset.ToString(), volume, true, 0, 0, false, false); | 825 | if (module != null) |
826 | { | ||
827 | module.SendSound(GetSOP().UUID, asset, volume, true, 0, 0, false, false); | ||
828 | } | ||
826 | } | 829 | } |
827 | 830 | ||
828 | #endregion | 831 | #endregion |
diff --git a/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs b/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs index fff3a32..c550c44 100644 --- a/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs +++ b/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs | |||
@@ -32,6 +32,7 @@ using System.Net; | |||
32 | using System.IO; | 32 | using System.IO; |
33 | using System.Text; | 33 | using System.Text; |
34 | using log4net; | 34 | using log4net; |
35 | using Mono.Addins; | ||
35 | using Nini.Config; | 36 | using Nini.Config; |
36 | using OpenMetaverse; | 37 | using OpenMetaverse; |
37 | using OpenMetaverse.StructuredData; | 38 | using OpenMetaverse.StructuredData; |
@@ -42,6 +43,7 @@ using OpenSim.Services.Interfaces; | |||
42 | 43 | ||
43 | namespace OpenSim.Region.OptionalModules.Scripting.RegionReady | 44 | namespace OpenSim.Region.OptionalModules.Scripting.RegionReady |
44 | { | 45 | { |
46 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "RegionReadyModule")] | ||
45 | public class RegionReadyModule : IRegionReadyModule, INonSharedRegionModule | 47 | public class RegionReadyModule : IRegionReadyModule, INonSharedRegionModule |
46 | { | 48 | { |
47 | private static readonly ILog m_log = | 49 | private static readonly ILog m_log = |
@@ -181,7 +183,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady | |||
181 | } | 183 | } |
182 | } | 184 | } |
183 | 185 | ||
184 | void OnOarFileLoaded(Guid requestId, string message) | 186 | void OnOarFileLoaded(Guid requestId, List<UUID> loadedScenes, string message) |
185 | { | 187 | { |
186 | m_oarFileLoading = true; | 188 | m_oarFileLoading = true; |
187 | 189 | ||
diff --git a/OpenSim/Region/OptionalModules/Scripting/XmlRpcRouterModule/XmlRpcGridRouterModule.cs b/OpenSim/Region/OptionalModules/Scripting/XmlRpcRouterModule/XmlRpcGridRouterModule.cs index 2187449..6120a81 100644 --- a/OpenSim/Region/OptionalModules/Scripting/XmlRpcRouterModule/XmlRpcGridRouterModule.cs +++ b/OpenSim/Region/OptionalModules/Scripting/XmlRpcRouterModule/XmlRpcGridRouterModule.cs | |||
@@ -32,6 +32,7 @@ using System.Reflection; | |||
32 | using log4net; | 32 | using log4net; |
33 | using Nini.Config; | 33 | using Nini.Config; |
34 | using OpenMetaverse; | 34 | using OpenMetaverse; |
35 | using Mono.Addins; | ||
35 | 36 | ||
36 | using OpenSim.Framework; | 37 | using OpenSim.Framework; |
37 | using OpenSim.Framework.Communications; | 38 | using OpenSim.Framework.Communications; |
@@ -49,7 +50,8 @@ namespace OpenSim.Region.OptionalModules.Scripting.XmlRpcGridRouterModule | |||
49 | public string uri; | 50 | public string uri; |
50 | } | 51 | } |
51 | 52 | ||
52 | public class XmlRpcGridRouter : IRegionModule, IXmlRpcRouter | 53 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "XmlRpcGridRouter")] |
54 | public class XmlRpcGridRouter : INonSharedRegionModule, IXmlRpcRouter | ||
53 | { | 55 | { |
54 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 56 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
55 | 57 | ||
@@ -59,9 +61,11 @@ namespace OpenSim.Region.OptionalModules.Scripting.XmlRpcGridRouterModule | |||
59 | private bool m_Enabled = false; | 61 | private bool m_Enabled = false; |
60 | private string m_ServerURI = String.Empty; | 62 | private string m_ServerURI = String.Empty; |
61 | 63 | ||
62 | public void Initialise(Scene scene, IConfigSource config) | 64 | #region INonSharedRegionModule |
65 | |||
66 | public void Initialise(IConfigSource config) | ||
63 | { | 67 | { |
64 | IConfig startupConfig = config.Configs["Startup"]; | 68 | IConfig startupConfig = config.Configs["XMLRPC"]; |
65 | if (startupConfig == null) | 69 | if (startupConfig == null) |
66 | return; | 70 | return; |
67 | 71 | ||
@@ -74,16 +78,30 @@ namespace OpenSim.Region.OptionalModules.Scripting.XmlRpcGridRouterModule | |||
74 | m_log.Error("[XMLRPC GRID ROUTER] Module configured but no URI given. Disabling"); | 78 | m_log.Error("[XMLRPC GRID ROUTER] Module configured but no URI given. Disabling"); |
75 | return; | 79 | return; |
76 | } | 80 | } |
77 | |||
78 | scene.RegisterModuleInterface<IXmlRpcRouter>(this); | ||
79 | m_Enabled = true; | 81 | m_Enabled = true; |
80 | } | 82 | } |
81 | } | 83 | } |
82 | 84 | ||
83 | public void PostInitialise() | 85 | public void AddRegion(Scene scene) |
86 | { | ||
87 | if (!m_Enabled) | ||
88 | return; | ||
89 | |||
90 | scene.RegisterModuleInterface<IXmlRpcRouter>(this); | ||
91 | } | ||
92 | |||
93 | public void RegionLoaded(Scene scene) | ||
84 | { | 94 | { |
85 | } | 95 | } |
86 | 96 | ||
97 | public void RemoveRegion(Scene scene) | ||
98 | { | ||
99 | if (!m_Enabled) | ||
100 | return; | ||
101 | |||
102 | scene.UnregisterModuleInterface<IXmlRpcRouter>(this); | ||
103 | } | ||
104 | |||
87 | public void Close() | 105 | public void Close() |
88 | { | 106 | { |
89 | } | 107 | } |
@@ -93,11 +111,13 @@ namespace OpenSim.Region.OptionalModules.Scripting.XmlRpcGridRouterModule | |||
93 | get { return "XmlRpcGridRouterModule"; } | 111 | get { return "XmlRpcGridRouterModule"; } |
94 | } | 112 | } |
95 | 113 | ||
96 | public bool IsSharedModule | 114 | public Type ReplaceableInterface |
97 | { | 115 | { |
98 | get { return false; } | 116 | get { return null; } |
99 | } | 117 | } |
100 | 118 | ||
119 | #endregion | ||
120 | |||
101 | public void RegisterNewReceiver(IScriptModule scriptEngine, UUID channel, UUID objectID, UUID itemID, string uri) | 121 | public void RegisterNewReceiver(IScriptModule scriptEngine, UUID channel, UUID objectID, UUID itemID, string uri) |
102 | { | 122 | { |
103 | if (!m_Channels.ContainsKey(itemID)) | 123 | if (!m_Channels.ContainsKey(itemID)) |
diff --git a/OpenSim/Region/OptionalModules/Scripting/XmlRpcRouterModule/XmlRpcRouterModule.cs b/OpenSim/Region/OptionalModules/Scripting/XmlRpcRouterModule/XmlRpcRouterModule.cs index 11c87f8..4bde52a 100644 --- a/OpenSim/Region/OptionalModules/Scripting/XmlRpcRouterModule/XmlRpcRouterModule.cs +++ b/OpenSim/Region/OptionalModules/Scripting/XmlRpcRouterModule/XmlRpcRouterModule.cs | |||
@@ -31,6 +31,7 @@ using System.Reflection; | |||
31 | using log4net; | 31 | using log4net; |
32 | using Nini.Config; | 32 | using Nini.Config; |
33 | using OpenMetaverse; | 33 | using OpenMetaverse; |
34 | using Mono.Addins; | ||
34 | 35 | ||
35 | using OpenSim.Framework; | 36 | using OpenSim.Framework; |
36 | using OpenSim.Region.Framework.Interfaces; | 37 | using OpenSim.Region.Framework.Interfaces; |
@@ -39,32 +40,46 @@ using OpenSim.Region.Framework.Scenes; | |||
39 | 40 | ||
40 | namespace OpenSim.Region.OptionalModules.Scripting.XmlRpcRouterModule | 41 | namespace OpenSim.Region.OptionalModules.Scripting.XmlRpcRouterModule |
41 | { | 42 | { |
42 | public class XmlRpcRouter : IRegionModule, IXmlRpcRouter | 43 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "XmlRpcRouter")] |
44 | public class XmlRpcRouter : INonSharedRegionModule, IXmlRpcRouter | ||
43 | { | 45 | { |
44 | //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 46 | //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
45 | private bool m_enabled = false; | 47 | |
46 | public void Initialise(Scene scene, IConfigSource config) | 48 | private bool m_Enabled; |
49 | |||
50 | #region INonSharedRegionModule | ||
51 | |||
52 | public void Initialise(IConfigSource config) | ||
47 | { | 53 | { |
48 | IConfig startupConfig = config.Configs["XMLRPC"]; | 54 | IConfig startupConfig = config.Configs["XMLRPC"]; |
49 | if (startupConfig == null) | 55 | if (startupConfig == null) |
50 | return; | 56 | return; |
51 | 57 | ||
52 | if (startupConfig.GetString("XmlRpcRouterModule", | 58 | if (startupConfig.GetString("XmlRpcRouterModule", |
53 | "") == "XmlRpcRouterModule") | 59 | "XmlRpcRouterModule") == "XmlRpcRouterModule") |
54 | { | 60 | m_Enabled = true; |
55 | scene.RegisterModuleInterface<IXmlRpcRouter>(this); | 61 | } |
56 | m_enabled = true; | 62 | |
57 | } | 63 | public void AddRegion(Scene scene) |
58 | else | 64 | { |
59 | { | 65 | if (!m_Enabled) |
60 | m_enabled = false; | 66 | return; |
61 | } | 67 | |
68 | scene.RegisterModuleInterface<IXmlRpcRouter>(this); | ||
62 | } | 69 | } |
63 | 70 | ||
64 | public void PostInitialise() | 71 | public void RegionLoaded(Scene scene) |
65 | { | 72 | { |
66 | } | 73 | } |
67 | 74 | ||
75 | public void RemoveRegion(Scene scene) | ||
76 | { | ||
77 | if (!m_Enabled) | ||
78 | return; | ||
79 | |||
80 | scene.UnregisterModuleInterface<IXmlRpcRouter>(this); | ||
81 | } | ||
82 | |||
68 | public void Close() | 83 | public void Close() |
69 | { | 84 | { |
70 | } | 85 | } |
@@ -74,14 +89,16 @@ namespace OpenSim.Region.OptionalModules.Scripting.XmlRpcRouterModule | |||
74 | get { return "XmlRpcRouterModule"; } | 89 | get { return "XmlRpcRouterModule"; } |
75 | } | 90 | } |
76 | 91 | ||
77 | public bool IsSharedModule | 92 | public Type ReplaceableInterface |
78 | { | 93 | { |
79 | get { return false; } | 94 | get { return null; } |
80 | } | 95 | } |
81 | 96 | ||
97 | #endregion | ||
98 | |||
82 | public void RegisterNewReceiver(IScriptModule scriptEngine, UUID channel, UUID objectID, UUID itemID, string uri) | 99 | public void RegisterNewReceiver(IScriptModule scriptEngine, UUID channel, UUID objectID, UUID itemID, string uri) |
83 | { | 100 | { |
84 | if (m_enabled) | 101 | if (m_Enabled) |
85 | { | 102 | { |
86 | scriptEngine.PostScriptEvent(itemID, "xmlrpc_uri", new Object[] { uri }); | 103 | scriptEngine.PostScriptEvent(itemID, "xmlrpc_uri", new Object[] { uri }); |
87 | } | 104 | } |