diff options
author | Tedd Hansen | 2008-11-08 17:35:48 +0000 |
---|---|---|
committer | Tedd Hansen | 2008-11-08 17:35:48 +0000 |
commit | 9511a8c76370f21e839114007dcd2b25c69b009a (patch) | |
tree | b63323dfd96ecd1cc3cd560939bd66bb43ec9c1c /OpenSim/ApplicationPlugins/ScriptEngine/RegionEngineLoader.cs | |
parent | * Added IClientIM to IClientCore interfaces (diff) | |
download | opensim-SC-9511a8c76370f21e839114007dcd2b25c69b009a.zip opensim-SC-9511a8c76370f21e839114007dcd2b25c69b009a.tar.gz opensim-SC-9511a8c76370f21e839114007dcd2b25c69b009a.tar.bz2 opensim-SC-9511a8c76370f21e839114007dcd2b25c69b009a.tar.xz |
Work in progress on SECS stuff. Have been holding it off until after 0.6 release. Still messy as hell and doesn't really work yet. Will undergo dramatic changes. AND MOST IMPORTANTLY: Will be conformed to work in coop with todays DNE and XEngine, hopefully one day providing a common interface for all components.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/ApplicationPlugins/ScriptEngine/RegionEngineLoader.cs (renamed from OpenSim/ApplicationPlugins/ScriptEngine/RegionScriptEnginePlugin.cs) | 72 |
1 files changed, 47 insertions, 25 deletions
diff --git a/OpenSim/ApplicationPlugins/ScriptEngine/RegionScriptEnginePlugin.cs b/OpenSim/ApplicationPlugins/ScriptEngine/RegionEngineLoader.cs index e6def85..115d237 100644 --- a/OpenSim/ApplicationPlugins/ScriptEngine/RegionScriptEnginePlugin.cs +++ b/OpenSim/ApplicationPlugins/ScriptEngine/RegionEngineLoader.cs | |||
@@ -26,45 +26,51 @@ | |||
26 | */ | 26 | */ |
27 | using System; | 27 | using System; |
28 | using System.Collections.Generic; | 28 | using System.Collections.Generic; |
29 | using System.Reflection; | ||
29 | using System.Text; | 30 | using System.Text; |
31 | using log4net; | ||
30 | using Nini.Config; | 32 | using Nini.Config; |
31 | using OpenSim.Region.Environment.Interfaces; | 33 | using OpenSim.Region.Environment.Interfaces; |
32 | using OpenSim.Region.Environment.Scenes; | 34 | using OpenSim.Region.Environment.Scenes; |
35 | using OpenSim.ScriptEngine.Shared; | ||
33 | 36 | ||
34 | namespace OpenSim.ApplicationPlugins.ScriptEngine | 37 | namespace OpenSim.ApplicationPlugins.ScriptEngine |
35 | { | 38 | { |
36 | public class RegionScriptEnginePlugin : IRegionModule | 39 | public class RegionEngineLoader : IRegionModule |
37 | { | 40 | { |
38 | // This is a region module. | 41 | // This is a region module. |
39 | // This means: Every time a new region is created, a new instance of this module is also created. | 42 | // This means: Every time a new region is created, a new instance of this module is also created. |
40 | // This module is responsible for starting the script engine for this region. | 43 | // This module is responsible for starting the script engine for this region. |
44 | public string Name { get { return "SECS.DotNetEngine.Scheduler.RegionLoader"; } } | ||
45 | public bool IsSharedModule { get { return true; } } | ||
41 | 46 | ||
47 | internal static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
42 | private string tempScriptEngineName = "DotNetEngine"; | 48 | private string tempScriptEngineName = "DotNetEngine"; |
43 | public RegionScriptEngineBase scriptEngine; | 49 | public IScriptEngine scriptEngine; |
50 | public IConfigSource ConfigSource; | ||
51 | public IConfig ScriptConfigSource; | ||
44 | public void Initialise(Scene scene, IConfigSource source) | 52 | public void Initialise(Scene scene, IConfigSource source) |
45 | { | 53 | { |
46 | return; | ||
47 | // New region is being created | 54 | // New region is being created |
48 | // Create a new script engine | 55 | // Create a new script engine |
49 | // try | 56 | // Make sure we have config |
50 | // { | 57 | if (ConfigSource.Configs["SECS"] == null) |
51 | // lock (ComponentRegistry.scriptEngines) | 58 | ConfigSource.AddConfig("SECS"); |
52 | // { | 59 | ScriptConfigSource = ConfigSource.Configs["SECS"]; |
53 | // scriptEngine = | 60 | |
54 | // Activator.CreateInstance(ComponentRegistry.scriptEngines[tempScriptEngineName]) as | 61 | // Is SECS enabled? |
55 | // RegionScriptEngineBase; | 62 | if (ScriptConfigSource.GetBoolean("Enabled", false)) |
56 | // } | 63 | { |
57 | // scriptEngine.Initialize(scene, source); | 64 | LoadEngine(); |
58 | // } | 65 | if (scriptEngine != null) |
59 | // catch (Exception ex) | 66 | scriptEngine.Initialise(scene, source); |
60 | // { | 67 | } |
61 | // scriptEngine.m_log.Error("[ScriptEngine]: Unable to load engine \"" + tempScriptEngineName + "\": " + ex.ToString()); | ||
62 | // } | ||
63 | } | 68 | } |
64 | 69 | ||
65 | public void PostInitialise() | 70 | public void PostInitialise() |
66 | { | 71 | { |
67 | // Nothing | 72 | if (scriptEngine != null) |
73 | scriptEngine.PostInitialise(); | ||
68 | } | 74 | } |
69 | 75 | ||
70 | public void Close() | 76 | public void Close() |
@@ -76,18 +82,34 @@ namespace OpenSim.ApplicationPlugins.ScriptEngine | |||
76 | } | 82 | } |
77 | catch (Exception ex) | 83 | catch (Exception ex) |
78 | { | 84 | { |
79 | scriptEngine.m_log.Error("[ScriptEngine]: Unable to close engine \"" + tempScriptEngineName + "\": " + ex.ToString()); | 85 | m_log.ErrorFormat("[{0}] Unable to close engine \"{1}\": {2}", Name, tempScriptEngineName, ex.ToString()); |
80 | } | 86 | } |
81 | } | 87 | } |
82 | 88 | ||
83 | public string Name | 89 | private void LoadEngine() |
84 | { | 90 | { |
85 | get { return "ScriptEngine Region Loader"; } | 91 | m_log.DebugFormat("[{0}] Loading region script engine engine \"{1}\".", Name, tempScriptEngineName); |
92 | try | ||
93 | { | ||
94 | lock (ScriptEnginePlugin.scriptEngines) | ||
95 | { | ||
96 | if (!ScriptEnginePlugin.scriptEngines.ContainsKey(tempScriptEngineName)) | ||
97 | { | ||
98 | m_log.ErrorFormat("[{0}] Unable to load region script engine: Script engine \"{1}\" does not exist.", Name, tempScriptEngineName); | ||
99 | } | ||
100 | else | ||
101 | { | ||
102 | scriptEngine = | ||
103 | Activator.CreateInstance(ScriptEnginePlugin.scriptEngines[tempScriptEngineName]) as | ||
104 | IScriptEngine; | ||
105 | } | ||
106 | } | ||
107 | } | ||
108 | catch (Exception ex) | ||
109 | { | ||
110 | m_log.ErrorFormat("[{0}] Internal error loading region script engine \"{1}\": {2}", Name, tempScriptEngineName, ex.ToString()); | ||
111 | } | ||
86 | } | 112 | } |
87 | 113 | ||
88 | public bool IsSharedModule | ||
89 | { | ||
90 | get { return true; } | ||
91 | } | ||
92 | } | 114 | } |
93 | } | 115 | } |