aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/ScriptEngine/Engines/DotNetEngine/DotNetEngine.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/ScriptEngine/Engines/DotNetEngine/DotNetEngine.cs')
-rw-r--r--OpenSim/ScriptEngine/Engines/DotNetEngine/DotNetEngine.cs196
1 files changed, 0 insertions, 196 deletions
diff --git a/OpenSim/ScriptEngine/Engines/DotNetEngine/DotNetEngine.cs b/OpenSim/ScriptEngine/Engines/DotNetEngine/DotNetEngine.cs
deleted file mode 100644
index 3b8a0ae..0000000
--- a/OpenSim/ScriptEngine/Engines/DotNetEngine/DotNetEngine.cs
+++ /dev/null
@@ -1,196 +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.Collections.Generic;
29using System.Reflection;
30using System.Text;
31using System.Text.RegularExpressions;
32using log4net;
33using Nini.Config;
34using OpenMetaverse;
35using OpenSim.ApplicationPlugins.ScriptEngine;
36using OpenSim.Region.Framework.Interfaces;
37using OpenSim.Region.Framework.Scenes;
38using OpenSim.ScriptEngine.Components.DotNetEngine.Events;
39using OpenSim.ScriptEngine.Components.DotNetEngine.Scheduler;
40using OpenSim.ScriptEngine.Shared;
41using ComponentFactory = OpenSim.ApplicationPlugins.ScriptEngine.ComponentFactory;
42
43namespace OpenSim.ScriptEngine.Engines.DotNetEngine
44{
45 // This is a sample engine
46 public partial class DotNetEngine : IScriptEngine
47 {
48
49 //private string[] _ComponentNames = new string[] {
50 // "Commands_LSL",
51 // "Commands_OSSL",
52 // "Compiler_CS",
53 // "Compiler_JS",
54 // "Compiler_LSL",
55 // "Compiler_VB",
56 // "LSLEventProvider",
57 // "Scheduler"
58 // };
59 internal static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
60
61 public string Name { get { return "SECS.DotNetEngine"; } }
62 //public bool IsSharedModule { get { return true; } }
63 internal RegionInfoStructure RegionInfo;
64
65 private string[] commandNames = new string[]
66 {
67 "Commands_LSL"
68 };
69
70 private string[] compilerNames = new string[]
71 {
72 "Compiler_CS",
73 "Compiler_JS",
74 "Compiler_LSL",
75 "Compiler_YP",
76 "Compiler_VB"
77 };
78 private string[] schedulerNames = new string[]
79 {
80 "Scheduler"
81 };
82
83 //internal IScriptLoader m_ScriptLoader;
84 internal LSLEventProvider m_LSLEventProvider;
85 //internal IScriptExecutor m_Executor;
86 //internal Dictionary<string, IScriptCompiler> Compilers = new Dictionary<string, IScriptCompiler>();
87 internal Dictionary<string, IScriptScheduler> Schedulers = new Dictionary<string, IScriptScheduler>();
88 public static Dictionary<string, IScriptCompiler> Compilers = new Dictionary<string, IScriptCompiler>();
89// private static bool haveInitialized = false;
90
91 public DotNetEngine()
92 {
93 RegionInfo = new RegionInfoStructure();
94 RegionInfo.Compilers = Compilers;
95 RegionInfo.Schedulers = Schedulers;
96 RegionInfo.Executors = new Dictionary<string, IScriptExecutor>();
97 RegionInfo.CommandProviders = new Dictionary<string, IScriptCommandProvider>();
98 RegionInfo.EventProviders = new Dictionary<string, IScriptEventProvider>();
99 }
100
101 public void Initialise(Scene scene, IConfigSource source)
102 {
103 RegionInfo.Scene = scene;
104 RegionInfo.ConfigSource = source;
105
106 m_log.DebugFormat("[{0}] Initializing components", Name);
107 InitializeComponents();
108 }
109
110 public void PostInitialise() { }
111
112 /// <summary>
113 /// Called on region close
114 /// </summary>
115 public void Close()
116 {
117 ComponentClose();
118 }
119 #region Initialize the Script Engine Components we need
120 public void InitializeComponents()
121 {
122 string cname = "";
123 m_log.DebugFormat("[{0}] Component initialization", Name);
124 // Initialize an instance of all module we want
125 try
126 {
127 cname = "ScriptManager";
128 m_log.DebugFormat("[{0}] Executor: {1}", Name, cname);
129 RegionInfo.Executors.Add(cname,
130 ComponentFactory.GetComponentInstance(RegionInfo, cname) as IScriptExecutor);
131
132 cname = "ScriptLoader";
133 m_log.DebugFormat("[{0}] ScriptLoader: {1}", Name, cname);
134 RegionInfo.ScriptLoader =
135 ComponentFactory.GetComponentInstance(RegionInfo, cname) as IScriptExecutor as ScriptLoader;
136
137 // CommandProviders
138 foreach (string cn in commandNames)
139 {
140 cname = cn;
141 m_log.DebugFormat("[{0}] CommandProvider: {1}", Name, cname);
142 RegionInfo.CommandProviders.Add(cname,
143 ComponentFactory.GetComponentInstance(RegionInfo, cname) as
144 IScriptCommandProvider);
145 }
146
147 // Compilers
148 foreach (string cn in compilerNames)
149 {
150 cname = cn;
151 m_log.DebugFormat("[{0}] Compiler: {1}", Name, cname);
152 RegionInfo.Compilers.Add(cname,
153 ComponentFactory.GetComponentInstance(RegionInfo, cname) as
154 IScriptCompiler);
155 }
156
157 // Schedulers
158 foreach (string cn in schedulerNames)
159 {
160 cname = cn;
161 m_log.DebugFormat("[{0}] Scheduler: {1}", Name, cname);
162 RegionInfo.Schedulers.Add(cname,
163 ComponentFactory.GetComponentInstance(RegionInfo, cname) as
164 IScriptScheduler);
165 }
166
167 // Event provider
168 cname = "LSLEventProvider";
169 m_log.DebugFormat("[{0}] EventProvider: {1}", Name, cname);
170 IScriptEventProvider sep = ComponentFactory.GetComponentInstance(RegionInfo, cname) as IScriptEventProvider;
171 RegionInfo.EventProviders.Add(cname, sep);
172 m_LSLEventProvider = sep as LSLEventProvider;
173
174 // Hook up events
175 m_LSLEventProvider.RezScript += Events_RezScript;
176 m_LSLEventProvider.RemoveScript += Events_RemoveScript;
177 }
178 catch (Exception e)
179 {
180 m_log.ErrorFormat("[{0}] Exception while loading \"{1}\": {2}", Name, cname, e.ToString());
181 }
182 }
183
184 private void ComponentClose()
185 {
186 // Close schedulers
187 foreach (IScriptScheduler scheduler in RegionInfo.Schedulers.Values)
188 {
189 scheduler.Close();
190 }
191 }
192
193 #endregion
194
195 }
196}