aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/ApplicationPlugins/ScriptEngine/RegionEngineLoader.cs
diff options
context:
space:
mode:
authorMelanie2009-10-27 21:17:08 +0000
committerMelanie2009-10-27 21:17:08 +0000
commit704bc08e5c3cdab8c0551ea803a77800cad0294f (patch)
tree2abf21a52de0f838fef95dee74989547516fc8f7 /OpenSim/ApplicationPlugins/ScriptEngine/RegionEngineLoader.cs
parentMerge branch 'master' into vehicles (diff)
parentRemove the SECS loader (diff)
downloadopensim-SC-704bc08e5c3cdab8c0551ea803a77800cad0294f.zip
opensim-SC-704bc08e5c3cdab8c0551ea803a77800cad0294f.tar.gz
opensim-SC-704bc08e5c3cdab8c0551ea803a77800cad0294f.tar.bz2
opensim-SC-704bc08e5c3cdab8c0551ea803a77800cad0294f.tar.xz
Merge branch 'master' into vehicles
Diffstat (limited to 'OpenSim/ApplicationPlugins/ScriptEngine/RegionEngineLoader.cs')
-rw-r--r--OpenSim/ApplicationPlugins/ScriptEngine/RegionEngineLoader.cs119
1 files changed, 0 insertions, 119 deletions
diff --git a/OpenSim/ApplicationPlugins/ScriptEngine/RegionEngineLoader.cs b/OpenSim/ApplicationPlugins/ScriptEngine/RegionEngineLoader.cs
deleted file mode 100644
index 41a5278..0000000
--- a/OpenSim/ApplicationPlugins/ScriptEngine/RegionEngineLoader.cs
+++ /dev/null
@@ -1,119 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27using System;
28using System.Reflection;
29using log4net;
30using Nini.Config;
31using OpenSim.Region.Framework.Interfaces;
32using OpenSim.Region.Framework.Scenes;
33using OpenSim.ScriptEngine.Shared;
34
35namespace OpenSim.ApplicationPlugins.ScriptEngine
36{
37 public class RegionEngineLoader : IRegionModule
38 {
39 // This is a region module.
40 // This means: Every time a new region is created, a new instance of this module is also created.
41 // This module is responsible for starting the script engine for this region.
42 public string Name { get { return "SECS.DotNetEngine.Scheduler.RegionLoader"; } }
43 public bool IsSharedModule { get { return true; } }
44
45 internal static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
46 private string tempScriptEngineName = "DotNetEngine";
47 public IScriptEngine scriptEngine;
48 public IConfigSource ConfigSource;
49 public IConfig ScriptConfigSource;
50 public void Initialise(Scene scene, IConfigSource source)
51 {
52 // New region is being created
53 // Create a new script engine
54 // Make sure we have config
55 try
56 {
57 if (ConfigSource.Configs["SECS"] == null)
58 ConfigSource.AddConfig("SECS");
59 ScriptConfigSource = ConfigSource.Configs["SECS"];
60
61 // Is SECS enabled?
62 if (ScriptConfigSource.GetBoolean("Enabled", false))
63 {
64 LoadEngine();
65 if (scriptEngine != null)
66 scriptEngine.Initialise(scene, source);
67 }
68 }
69 catch (NullReferenceException)
70 {
71 }
72 }
73
74 public void PostInitialise()
75 {
76 if (scriptEngine != null)
77 scriptEngine.PostInitialise();
78 }
79
80 public void Close()
81 {
82 try
83 {
84 if (scriptEngine != null)
85 scriptEngine.Close();
86 }
87 catch (Exception ex)
88 {
89 m_log.ErrorFormat("[{0}] Unable to close engine \"{1}\": {2}", Name, tempScriptEngineName, ex.ToString());
90 }
91 }
92
93 private void LoadEngine()
94 {
95 m_log.DebugFormat("[{0}] Loading region script engine engine \"{1}\".", Name, tempScriptEngineName);
96 try
97 {
98 lock (ComponentFactory.scriptEngines)
99 {
100 if (!ComponentFactory.scriptEngines.ContainsKey(tempScriptEngineName))
101 {
102 m_log.ErrorFormat("[{0}] Unable to load region script engine: Script engine \"{1}\" does not exist.", Name, tempScriptEngineName);
103 }
104 else
105 {
106 scriptEngine =
107 Activator.CreateInstance(ComponentFactory.scriptEngines[tempScriptEngineName]) as
108 IScriptEngine;
109 }
110 }
111 }
112 catch (Exception ex)
113 {
114 m_log.ErrorFormat("[{0}] Internal error loading region script engine \"{1}\": {2}", Name, tempScriptEngineName, ex.ToString());
115 }
116 }
117
118 }
119}