aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/ScriptEngine/Engines/DotNetEngine
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/ScriptEngine/Engines/DotNetEngine/DotNetEngine.cs196
-rw-r--r--OpenSim/ScriptEngine/Engines/DotNetEngine/DotNetEngine_ScriptLoadUnload.cs95
-rw-r--r--OpenSim/ScriptEngine/Engines/DotNetEngine/Properties/AssemblyInfo.cs63
3 files changed, 0 insertions, 354 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}
diff --git a/OpenSim/ScriptEngine/Engines/DotNetEngine/DotNetEngine_ScriptLoadUnload.cs b/OpenSim/ScriptEngine/Engines/DotNetEngine/DotNetEngine_ScriptLoadUnload.cs
deleted file mode 100644
index a113c1e..0000000
--- a/OpenSim/ScriptEngine/Engines/DotNetEngine/DotNetEngine_ScriptLoadUnload.cs
+++ /dev/null
@@ -1,95 +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 */
27
28using System;
29using System.Collections.Generic;
30using System.Text;
31using OpenMetaverse;
32using OpenSim.ScriptEngine.Components.DotNetEngine.Events;
33using OpenSim.ScriptEngine.Shared;
34
35namespace OpenSim.ScriptEngine.Engines.DotNetEngine
36{
37 public partial class DotNetEngine
38 {
39
40 //internal Dictionary<int, IScriptScheduler> ScriptMapping = new Dictionary<int, IScriptScheduler>();
41
42
43 //
44 // HANDLE EVENTS FROM SCRIPTS
45 // We will handle script add, change and remove events outside of command pipeline
46 //
47 #region Script Add/Change/Remove
48 void Events_RezScript(uint localID, UUID itemID, string script, int startParam, bool postOnRez, string engine)
49 {
50 // ###
51 // # New script created
52 // ###
53 m_log.DebugFormat(
54 "[{0}] NEW SCRIPT: localID: {1}, itemID: {2}, startParam: {3}, postOnRez: {4}, engine: {5}",
55 Name, localID, itemID, startParam, postOnRez, engine);
56
57 // Make a script object
58 ScriptStructure scriptObject = new ScriptStructure();
59 scriptObject.RegionInfo = RegionInfo;
60 scriptObject.LocalID = localID;
61 scriptObject.ItemID = itemID;
62 scriptObject.Source = script;
63
64 //
65 // Get MetaData from script header
66 //
67 ScriptMetaData scriptMetaData = ScriptMetaData.Extract(ref script);
68 scriptObject.ScriptMetaData = scriptMetaData;
69 foreach (string key in scriptObject.ScriptMetaData.Keys)
70 {
71 m_log.DebugFormat("[{0}] Script metadata: Key: \"{1}\", Value: \"{2}\".", Name, key, scriptObject.ScriptMetaData[key]);
72 }
73
74 //
75 // Load this assembly
76 //
77 // TODO: Use Executor to send a command instead?
78 m_log.DebugFormat("[{0}] Adding script to scheduler", Name);
79 RegionInfo.FindScheduler(scriptObject.ScriptMetaData).AddScript(scriptObject);
80 // Add to our internal mapping
81 //ScriptMapping.Add(itemID, Schedulers[scheduler]);
82 }
83
84 private void Events_RemoveScript(uint localID, UUID itemID)
85 {
86 // Tell all schedulers to remove this item
87 foreach (IScriptScheduler scheduler in RegionInfo.Schedulers.Values)
88 {
89 scheduler.Removecript(localID, itemID);
90 }
91 }
92 #endregion
93
94 }
95}
diff --git a/OpenSim/ScriptEngine/Engines/DotNetEngine/Properties/AssemblyInfo.cs b/OpenSim/ScriptEngine/Engines/DotNetEngine/Properties/AssemblyInfo.cs
deleted file mode 100644
index bca9c2c..0000000
--- a/OpenSim/ScriptEngine/Engines/DotNetEngine/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,63 +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 */
27
28using System.Reflection;
29using System.Runtime.CompilerServices;
30using System.Runtime.InteropServices;
31
32// General Information about an assembly is controlled through the following
33// set of attributes. Change these attribute values to modify the information
34// associated with an assembly.
35[assembly: AssemblyTitle("OpenSim.ScriptEngine.Engines.DotNetEngine")]
36[assembly: AssemblyDescription("")]
37[assembly: AssemblyConfiguration("")]
38[assembly: AssemblyCompany("http://opensimulator.org")]
39[assembly: AssemblyProduct("OpenSim.ScriptEngine.Engines.DotNetEngine")]
40[assembly: AssemblyCopyright("Copyright © Microsoft 2008")]
41[assembly: AssemblyTrademark("")]
42[assembly: AssemblyCulture("")]
43
44// Setting ComVisible to false makes the types in this assembly not visible
45// to COM components. If you need to access a type in this assembly from
46// COM, set the ComVisible attribute to true on that type.
47[assembly: ComVisible(false)]
48
49// The following GUID is for the ID of the typelib if this project is exposed to COM
50[assembly: Guid("1d1c68a7-026f-4556-a060-4af69f488d2a")]
51
52// Version information for an assembly consists of the following four values:
53//
54// Major Version
55// Minor Version
56// Build Number
57// Revision
58//
59// You can specify all the values or you can default the Build and Revision Numbers
60// by using the '*' as shown below:
61// [assembly: AssemblyVersion("0.6.5.*")]
62[assembly: AssemblyVersion("0.6.5.*")]
63[assembly: AssemblyFileVersion("0.6.5.0")]