diff options
author | BlueWall | 2010-09-25 16:22:18 -0400 |
---|---|---|
committer | Melanie | 2010-09-26 02:30:46 +0100 |
commit | 4f25b73b572e458a3e98614fc5694286e5e3fb92 (patch) | |
tree | 848a886d6cf75ae09b549ea3400073e60de83c73 /OpenSim/Region/ScriptEngine | |
parent | Prevent spoofing the agent name on text IM (diff) | |
download | opensim-SC_OLD-4f25b73b572e458a3e98614fc5694286e5e3fb92.zip opensim-SC_OLD-4f25b73b572e458a3e98614fc5694286e5e3fb92.tar.gz opensim-SC_OLD-4f25b73b572e458a3e98614fc5694286e5e3fb92.tar.bz2 opensim-SC_OLD-4f25b73b572e458a3e98614fc5694286e5e3fb92.tar.xz |
Add configurable path to script engine assemblies
Adding ability to place script engine assemblies outside
the codebase directories.
Uses new [XEngine] option: ScriptEnginesPath = "path_to_assemblies"
Signed-off-by: Melanie <melanie@t-data.com>
Diffstat (limited to 'OpenSim/Region/ScriptEngine')
4 files changed, 25 insertions, 15 deletions
diff --git a/OpenSim/Region/ScriptEngine/Interfaces/IScriptEngine.cs b/OpenSim/Region/ScriptEngine/Interfaces/IScriptEngine.cs index 02d1511..581a9a9 100644 --- a/OpenSim/Region/ScriptEngine/Interfaces/IScriptEngine.cs +++ b/OpenSim/Region/ScriptEngine/Interfaces/IScriptEngine.cs | |||
@@ -82,6 +82,7 @@ namespace OpenSim.Region.ScriptEngine.Interfaces | |||
82 | IConfig Config { get; } | 82 | IConfig Config { get; } |
83 | IConfigSource ConfigSource { get; } | 83 | IConfigSource ConfigSource { get; } |
84 | string ScriptEngineName { get; } | 84 | string ScriptEngineName { get; } |
85 | string ScriptEnginePath { get; } | ||
85 | IScriptApi GetApi(UUID itemID, string name); | 86 | IScriptApi GetApi(UUID itemID, string name); |
86 | } | 87 | } |
87 | } | 88 | } |
diff --git a/OpenSim/Region/ScriptEngine/Shared/AssemblyResolver.cs b/OpenSim/Region/ScriptEngine/Shared/AssemblyResolver.cs index ade1924..130e197 100644 --- a/OpenSim/Region/ScriptEngine/Shared/AssemblyResolver.cs +++ b/OpenSim/Region/ScriptEngine/Shared/AssemblyResolver.cs | |||
@@ -32,7 +32,7 @@ using System.Reflection; | |||
32 | namespace OpenSim.Region.ScriptEngine.Shared | 32 | namespace OpenSim.Region.ScriptEngine.Shared |
33 | { | 33 | { |
34 | [Serializable] | 34 | [Serializable] |
35 | public class AssemblyResolver | 35 | public class AssemblyResolver : MarshalByRefObject |
36 | { | 36 | { |
37 | public static Assembly OnAssemblyResolve(object sender, | 37 | public static Assembly OnAssemblyResolve(object sender, |
38 | ResolveEventArgs args) | 38 | ResolveEventArgs args) |
@@ -42,9 +42,10 @@ namespace OpenSim.Region.ScriptEngine.Shared | |||
42 | 42 | ||
43 | AppDomain myDomain = (AppDomain)sender; | 43 | AppDomain myDomain = (AppDomain)sender; |
44 | string dirName = myDomain.FriendlyName; | 44 | string dirName = myDomain.FriendlyName; |
45 | string ScriptEnginesPath = myDomain.SetupInformation.PrivateBinPath; | ||
45 | 46 | ||
46 | string[] pathList = new string[] {"bin", "ScriptEngines", | 47 | string[] pathList = new string[] {"bin", ScriptEnginesPath, |
47 | Path.Combine("ScriptEngines", dirName)}; | 48 | Path.Combine(ScriptEnginesPath, dirName)}; |
48 | 49 | ||
49 | string assemblyName = args.Name; | 50 | string assemblyName = args.Name; |
50 | if (assemblyName.IndexOf(",") != -1) | 51 | if (assemblyName.IndexOf(",") != -1) |
diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs index cd8c67e..49d6abe 100644 --- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs +++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs | |||
@@ -72,7 +72,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools | |||
72 | private Dictionary<string, enumCompileType> LanguageMapping = new Dictionary<string, enumCompileType>(StringComparer.CurrentCultureIgnoreCase); | 72 | private Dictionary<string, enumCompileType> LanguageMapping = new Dictionary<string, enumCompileType>(StringComparer.CurrentCultureIgnoreCase); |
73 | 73 | ||
74 | private string FilePrefix; | 74 | private string FilePrefix; |
75 | private string ScriptEnginesPath = "ScriptEngines"; | 75 | private string ScriptEnginesPath = null; |
76 | // mapping between LSL and C# line/column numbers | 76 | // mapping between LSL and C# line/column numbers |
77 | private ICodeConverter LSL_Converter; | 77 | private ICodeConverter LSL_Converter; |
78 | 78 | ||
@@ -95,7 +95,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools | |||
95 | 95 | ||
96 | public Compiler(IScriptEngine scriptEngine) | 96 | public Compiler(IScriptEngine scriptEngine) |
97 | { | 97 | { |
98 | m_scriptEngine = scriptEngine; | 98 | m_scriptEngine = scriptEngine;; |
99 | ScriptEnginesPath = scriptEngine.ScriptEnginePath; | ||
99 | ReadConfig(); | 100 | ReadConfig(); |
100 | } | 101 | } |
101 | 102 | ||
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs index 427d4e5..8629674 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | |||
@@ -88,6 +88,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
88 | private IXmlRpcRouter m_XmlRpcRouter; | 88 | private IXmlRpcRouter m_XmlRpcRouter; |
89 | private int m_EventLimit; | 89 | private int m_EventLimit; |
90 | private bool m_KillTimedOutScripts; | 90 | private bool m_KillTimedOutScripts; |
91 | private string m_ScriptEnginesPath = null; | ||
91 | 92 | ||
92 | private static List<XEngine> m_ScriptEngines = | 93 | private static List<XEngine> m_ScriptEngines = |
93 | new List<XEngine>(); | 94 | new List<XEngine>(); |
@@ -156,6 +157,11 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
156 | get { return m_ScriptConfig; } | 157 | get { return m_ScriptConfig; } |
157 | } | 158 | } |
158 | 159 | ||
160 | public string ScriptEnginePath | ||
161 | { | ||
162 | get { return m_ScriptEnginesPath; } | ||
163 | } | ||
164 | |||
159 | public IConfigSource ConfigSource | 165 | public IConfigSource ConfigSource |
160 | { | 166 | { |
161 | get { return m_ConfigSource; } | 167 | get { return m_ConfigSource; } |
@@ -213,6 +219,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
213 | m_EventLimit = m_ScriptConfig.GetInt("EventLimit", 30); | 219 | m_EventLimit = m_ScriptConfig.GetInt("EventLimit", 30); |
214 | m_KillTimedOutScripts = m_ScriptConfig.GetBoolean("KillTimedOutScripts", false); | 220 | m_KillTimedOutScripts = m_ScriptConfig.GetBoolean("KillTimedOutScripts", false); |
215 | m_SaveTime = m_ScriptConfig.GetInt("SaveInterval", 120) * 1000; | 221 | m_SaveTime = m_ScriptConfig.GetInt("SaveInterval", 120) * 1000; |
222 | m_ScriptEnginesPath = m_ScriptConfig.GetString("ScriptEnginesPath", "ScriptEngines"); | ||
216 | 223 | ||
217 | m_Prio = ThreadPriority.BelowNormal; | 224 | m_Prio = ThreadPriority.BelowNormal; |
218 | switch (priority) | 225 | switch (priority) |
@@ -410,7 +417,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
410 | return 0; | 417 | return 0; |
411 | } | 418 | } |
412 | 419 | ||
413 | public Type ReplaceableInterface | 420 | public Type ReplaceableInterface |
414 | { | 421 | { |
415 | get { return null; } | 422 | get { return null; } |
416 | } | 423 | } |
@@ -719,9 +726,9 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
719 | try | 726 | try |
720 | { | 727 | { |
721 | AppDomainSetup appSetup = new AppDomainSetup(); | 728 | AppDomainSetup appSetup = new AppDomainSetup(); |
722 | // appSetup.ApplicationBase = Path.Combine( | 729 | appSetup.PrivateBinPath = Path.Combine( |
723 | // "ScriptEngines", | 730 | m_ScriptEnginesPath, |
724 | // m_Scene.RegionInfo.RegionID.ToString()); | 731 | m_Scene.RegionInfo.RegionID.ToString()); |
725 | 732 | ||
726 | Evidence baseEvidence = AppDomain.CurrentDomain.Evidence; | 733 | Evidence baseEvidence = AppDomain.CurrentDomain.Evidence; |
727 | Evidence evidence = new Evidence(baseEvidence); | 734 | Evidence evidence = new Evidence(baseEvidence); |
@@ -965,7 +972,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
965 | startInfo.IdleTimeout = idleTimeout*1000; // convert to seconds as stated in .ini | 972 | startInfo.IdleTimeout = idleTimeout*1000; // convert to seconds as stated in .ini |
966 | startInfo.MaxWorkerThreads = maxThreads; | 973 | startInfo.MaxWorkerThreads = maxThreads; |
967 | startInfo.MinWorkerThreads = minThreads; | 974 | startInfo.MinWorkerThreads = minThreads; |
968 | startInfo.ThreadPriority = threadPriority; | 975 | startInfo.ThreadPriority = threadPriority;; |
969 | startInfo.StackSize = stackSize; | 976 | startInfo.StackSize = stackSize; |
970 | startInfo.StartSuspended = true; | 977 | startInfo.StartSuspended = true; |
971 | 978 | ||
@@ -1110,8 +1117,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
1110 | if (!(sender is System.AppDomain)) | 1117 | if (!(sender is System.AppDomain)) |
1111 | return null; | 1118 | return null; |
1112 | 1119 | ||
1113 | string[] pathList = new string[] {"bin", "ScriptEngines", | 1120 | string[] pathList = new string[] {"bin", m_ScriptEnginesPath, |
1114 | Path.Combine("ScriptEngines", | 1121 | Path.Combine(m_ScriptEnginesPath, |
1115 | m_Scene.RegionInfo.RegionID.ToString())}; | 1122 | m_Scene.RegionInfo.RegionID.ToString())}; |
1116 | 1123 | ||
1117 | string assemblyName = args.Name; | 1124 | string assemblyName = args.Name; |
@@ -1485,7 +1492,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
1485 | string fn = assemE.GetAttribute("Filename"); | 1492 | string fn = assemE.GetAttribute("Filename"); |
1486 | string base64 = assemE.InnerText; | 1493 | string base64 = assemE.InnerText; |
1487 | 1494 | ||
1488 | string path = Path.Combine("ScriptEngines", World.RegionInfo.RegionID.ToString()); | 1495 | string path = Path.Combine(m_ScriptEnginesPath, World.RegionInfo.RegionID.ToString()); |
1489 | path = Path.Combine(path, fn); | 1496 | path = Path.Combine(path, fn); |
1490 | 1497 | ||
1491 | if (!File.Exists(path)) | 1498 | if (!File.Exists(path)) |
@@ -1525,7 +1532,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
1525 | } | 1532 | } |
1526 | } | 1533 | } |
1527 | 1534 | ||
1528 | string statepath = Path.Combine("ScriptEngines", World.RegionInfo.RegionID.ToString()); | 1535 | string statepath = Path.Combine(m_ScriptEnginesPath, World.RegionInfo.RegionID.ToString()); |
1529 | statepath = Path.Combine(statepath, itemID.ToString() + ".state"); | 1536 | statepath = Path.Combine(statepath, itemID.ToString() + ".state"); |
1530 | 1537 | ||
1531 | try | 1538 | try |
@@ -1551,7 +1558,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
1551 | { | 1558 | { |
1552 | XmlElement mapE = (XmlElement)mapL[0]; | 1559 | XmlElement mapE = (XmlElement)mapL[0]; |
1553 | 1560 | ||
1554 | string mappath = Path.Combine("ScriptEngines", World.RegionInfo.RegionID.ToString()); | 1561 | string mappath = Path.Combine(m_ScriptEnginesPath, World.RegionInfo.RegionID.ToString()); |
1555 | mappath = Path.Combine(mappath, mapE.GetAttribute("Filename")); | 1562 | mappath = Path.Combine(mappath, mapE.GetAttribute("Filename")); |
1556 | 1563 | ||
1557 | try | 1564 | try |