aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Grid
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Grid/ScriptServer/RemotingObject.cs10
-rw-r--r--OpenSim/Grid/ScriptServer/RemotingServer.cs7
-rw-r--r--OpenSim/Grid/ScriptServer/ScriptServer/ScriptEngineManager/ScriptEngineInterface.cs38
-rw-r--r--OpenSim/Grid/ScriptServer/ScriptServer/ScriptEngineManager/ScriptEngineLoader.cs124
-rw-r--r--OpenSim/Grid/ScriptServer/ScriptServer/ScriptEnginesManager.cs13
-rw-r--r--OpenSim/Grid/ScriptServer/ScriptServerMain.cs21
6 files changed, 26 insertions, 187 deletions
diff --git a/OpenSim/Grid/ScriptServer/RemotingObject.cs b/OpenSim/Grid/ScriptServer/RemotingObject.cs
index 915d020..54aff7a 100644
--- a/OpenSim/Grid/ScriptServer/RemotingObject.cs
+++ b/OpenSim/Grid/ScriptServer/RemotingObject.cs
@@ -10,18 +10,10 @@ namespace OpenSim.Grid.ScriptServer
10 { 10 {
11 // This object will be exposed over remoting. It is a singleton, so it exists only in as one instance. 11 // This object will be exposed over remoting. It is a singleton, so it exists only in as one instance.
12 12
13 // Expose ScriptEngine directly for now ... this is not very secure :)
14 // NOTE! CURRENTLY JUST HARDWIRED DOTNETENGINE!
15 //private OpenSim.Region.ScriptEngine.DotNetEngine.ScriptEngine SE =
16 // new OpenSim.Region.ScriptEngine.DotNetEngine.ScriptEngine();
17 //public OpenSim.Region.ScriptEngine.Common.ScriptServerInterfaces.RemoteEvents Events =
18 // (OpenSim.Region.ScriptEngine.Common.ScriptServerInterfaces.RemoteEvents)SE.m_EventManager;
19
20 //private ScriptServerInterfaces.RemoteEvents _events = new abc;
21 13
22 ScriptServerInterfaces.RemoteEvents ScriptServerInterfaces.ServerRemotingObject.Events() 14 ScriptServerInterfaces.RemoteEvents ScriptServerInterfaces.ServerRemotingObject.Events()
23 { 15 {
24 return null; 16 return ScriptServerMain.Engine.EventManager();
25 } 17 }
26 } 18 }
27} 19}
diff --git a/OpenSim/Grid/ScriptServer/RemotingServer.cs b/OpenSim/Grid/ScriptServer/RemotingServer.cs
index 33d8dc8..eb29740 100644
--- a/OpenSim/Grid/ScriptServer/RemotingServer.cs
+++ b/OpenSim/Grid/ScriptServer/RemotingServer.cs
@@ -4,17 +4,18 @@ using System.Text;
4using System.Runtime.Remoting; 4using System.Runtime.Remoting;
5using System.Runtime.Remoting.Channels; 5using System.Runtime.Remoting.Channels;
6using System.Runtime.Remoting.Channels.Tcp; 6using System.Runtime.Remoting.Channels.Tcp;
7using OpenSim.Region.ScriptEngine.Common;
7 8
8 9
9namespace OpenSim.Grid.ScriptServer 10namespace OpenSim.Grid.ScriptServer
10{ 11{
11 class RemotingServer 12 class RemotingServer
12 { 13 {
13 14 TcpChannel channel;
14 public void CreateServer(int port, string instanceName) 15 public RemotingServer(int port, string instanceName)
15 { 16 {
16 // Create an instance of a channel 17 // Create an instance of a channel
17 TcpChannel channel = new TcpChannel(port); 18 channel = new TcpChannel(port);
18 ChannelServices.RegisterChannel(channel, true); 19 ChannelServices.RegisterChannel(channel, true);
19 20
20 // Register as an available service with the name HelloWorld 21 // Register as an available service with the name HelloWorld
diff --git a/OpenSim/Grid/ScriptServer/ScriptServer/ScriptEngineManager/ScriptEngineInterface.cs b/OpenSim/Grid/ScriptServer/ScriptServer/ScriptEngineManager/ScriptEngineInterface.cs
deleted file mode 100644
index 518c198..0000000
--- a/OpenSim/Grid/ScriptServer/ScriptServer/ScriptEngineManager/ScriptEngineInterface.cs
+++ /dev/null
@@ -1,38 +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 OpenSim 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 OpenSim.Framework.Console;
29
30namespace OpenSim.Grid.ScriptServer
31{
32 public interface ScriptEngineInterface
33 {
34 void InitializeEngine(RegionConnectionManager Region, LogBase logger);
35 void Shutdown();
36// void StartScript(string ScriptID, IScriptHost ObjectID);
37 }
38} \ No newline at end of file
diff --git a/OpenSim/Grid/ScriptServer/ScriptServer/ScriptEngineManager/ScriptEngineLoader.cs b/OpenSim/Grid/ScriptServer/ScriptServer/ScriptEngineManager/ScriptEngineLoader.cs
deleted file mode 100644
index 7f39931..0000000
--- a/OpenSim/Grid/ScriptServer/ScriptServer/ScriptEngineManager/ScriptEngineLoader.cs
+++ /dev/null
@@ -1,124 +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 OpenSim 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.IO;
30using System.Reflection;
31using OpenSim.Framework.Console;
32
33namespace OpenSim.Grid.ScriptServer
34{
35 internal class ScriptEngineLoader
36 {
37 private LogBase m_log;
38
39
40 public ScriptEngineLoader(LogBase logger)
41 {
42 m_log = logger;
43 }
44
45 public ScriptEngineInterface LoadScriptEngine(string EngineName)
46 {
47 ScriptEngineInterface ret = null;
48 try
49 {
50 ret =
51 LoadAndInitAssembly(
52 Path.Combine("ScriptEngines", "OpenSim.Region.ScriptEngine." + EngineName + ".dll"),
53 "OpenSim.Region.ScriptEngine." + EngineName + ".ScriptEngine");
54 }
55 catch (Exception e)
56 {
57 m_log.Error("ScriptEngine",
58 "Error loading assembly \"" + EngineName + "\": " + e.Message + ", " +
59 e.StackTrace.ToString());
60 }
61 return ret;
62 }
63
64 /// <summary>
65 /// Does actual loading and initialization of script Assembly
66 /// </summary>
67 /// <param name="FreeAppDomain">AppDomain to load script into</param>
68 /// <param name="FileName">FileName of script assembly (.dll)</param>
69 /// <returns></returns>
70 private ScriptEngineInterface LoadAndInitAssembly(string FileName, string NameSpace)
71 {
72 //Common.SendToDebug("Loading ScriptEngine Assembly " + FileName);
73 // Load .Net Assembly (.dll)
74 // Initialize and return it
75
76 // TODO: Add error handling
77
78 Assembly a;
79 //try
80 //{
81
82
83 // Load to default appdomain (temporary)
84 a = Assembly.LoadFrom(FileName);
85 // Load to specified appdomain
86 // TODO: Insert security
87 //a = FreeAppDomain.Load(FileName);
88 //}
89 //catch (Exception e)
90 //{
91 // m_log.Error("ScriptEngine", "Error loading assembly \"" + FileName + "\": " + e.ToString());
92 //}
93
94
95 //Console.WriteLine("Loading: " + FileName);
96 //foreach (Type _t in a.GetTypes())
97 //{
98 // Console.WriteLine("Type: " + _t.ToString());
99 //}
100
101 Type t;
102 //try
103 //{
104 t = a.GetType(NameSpace, true);
105 //}
106 //catch (Exception e)
107 //{
108 // m_log.Error("ScriptEngine", "Error initializing type \"" + NameSpace + "\" from \"" + FileName + "\": " + e.ToString());
109 //}
110
111 ScriptEngineInterface ret;
112 //try
113 //{
114 ret = (ScriptEngineInterface) Activator.CreateInstance(t);
115 //}
116 //catch (Exception e)
117 //{
118 // m_log.Error("ScriptEngine", "Error initializing type \"" + NameSpace + "\" from \"" + FileName + "\": " + e.ToString());
119 //}
120
121 return ret;
122 }
123 }
124} \ No newline at end of file
diff --git a/OpenSim/Grid/ScriptServer/ScriptServer/ScriptEnginesManager.cs b/OpenSim/Grid/ScriptServer/ScriptServer/ScriptEnginesManager.cs
index 7b49127..3bfca87 100644
--- a/OpenSim/Grid/ScriptServer/ScriptServer/ScriptEnginesManager.cs
+++ b/OpenSim/Grid/ScriptServer/ScriptServer/ScriptEnginesManager.cs
@@ -28,14 +28,15 @@
28 28
29using System.Collections.Generic; 29using System.Collections.Generic;
30using OpenSim.Framework.Console; 30using OpenSim.Framework.Console;
31using OpenSim.Region.ScriptEngine.Common;
31 32
32namespace OpenSim.Grid.ScriptServer 33namespace OpenSim.Grid.ScriptServer.ScriptServer
33{ 34{
34 internal class ScriptEngineManager 35 internal class ScriptEngineManager
35 { 36 {
36 private LogBase m_log; 37 private LogBase m_log;
37 private ScriptEngineLoader ScriptEngineLoader; 38 private ScriptEngineLoader ScriptEngineLoader;
38 private List<ScriptEngineInterface> scriptEngines = new List<ScriptEngineInterface>(); 39 private List<ScriptServerInterfaces.ScriptEngine> scriptEngines = new List<ScriptServerInterfaces.ScriptEngine>();
39 private ScriptServerMain m_ScriptServerMain; 40 private ScriptServerMain m_ScriptServerMain;
40 41
41 // Initialize 42 // Initialize
@@ -44,23 +45,21 @@ namespace OpenSim.Grid.ScriptServer
44 m_ScriptServerMain = scm; 45 m_ScriptServerMain = scm;
45 m_log = logger; 46 m_log = logger;
46 ScriptEngineLoader = new ScriptEngineLoader(m_log); 47 ScriptEngineLoader = new ScriptEngineLoader(m_log);
47
48 // Temp - we should not load during initialize... Loading should be done later.
49 LoadEngine("DotNetScriptEngine");
50 } 48 }
51 49
52 ~ScriptEngineManager() 50 ~ScriptEngineManager()
53 { 51 {
54 } 52 }
55 53
56 public void LoadEngine(string engineName) 54 public ScriptServerInterfaces.ScriptEngine LoadEngine(string engineName)
57 { 55 {
58 // Load and add to list of ScriptEngines 56 // Load and add to list of ScriptEngines
59 ScriptEngineInterface sei = ScriptEngineLoader.LoadScriptEngine(engineName); 57 ScriptServerInterfaces.ScriptEngine sei = ScriptEngineLoader.LoadScriptEngine(engineName);
60 if (sei != null) 58 if (sei != null)
61 { 59 {
62 scriptEngines.Add(sei); 60 scriptEngines.Add(sei);
63 } 61 }
62 return sei;
64 } 63 }
65 } 64 }
66} \ No newline at end of file 65} \ No newline at end of file
diff --git a/OpenSim/Grid/ScriptServer/ScriptServerMain.cs b/OpenSim/Grid/ScriptServer/ScriptServerMain.cs
index 884a09e..568c12b 100644
--- a/OpenSim/Grid/ScriptServer/ScriptServerMain.cs
+++ b/OpenSim/Grid/ScriptServer/ScriptServerMain.cs
@@ -29,6 +29,8 @@
29using System.IO; 29using System.IO;
30using OpenSim.Framework; 30using OpenSim.Framework;
31using OpenSim.Framework.Console; 31using OpenSim.Framework.Console;
32using OpenSim.Grid.ScriptServer.ScriptServer;
33using OpenSim.Region.ScriptEngine.Common;
32 34
33namespace OpenSim.Grid.ScriptServer 35namespace OpenSim.Grid.ScriptServer
34{ 36{
@@ -41,19 +43,26 @@ namespace OpenSim.Grid.ScriptServer
41 private readonly string m_logFilename = ("region-console.log"); 43 private readonly string m_logFilename = ("region-console.log");
42 private LogBase m_log; 44 private LogBase m_log;
43 45
46 // TEMP
47 public static ScriptServerInterfaces.ScriptEngine Engine;
48
44 // Objects we use 49 // Objects we use
45 internal RegionCommManager RegionScriptDaemon; // Listen for incoming from region 50 internal RegionCommManager RegionScriptDaemon; // Listen for incoming from region
46 //internal ScriptEngineManager ScriptEngines; // Loads scriptengines 51 internal ScriptEngineManager ScriptEngines; // Loads scriptengines
47 internal RemotingServer m_RemotingServer; 52 internal RemotingServer m_RemotingServer;
48 53
49 public ScriptServerMain() 54 public ScriptServerMain()
50 { 55 {
51 m_log = CreateLog(); 56 m_log = CreateLog();
52 57
53 RegionScriptDaemon = new RegionCommManager(this, m_log); 58 // Set up script engine mananger
54 //ScriptEngines = new ScriptEngineManager(this, m_log); 59 ScriptEngines = new ScriptEngineManager(this, m_log);
55 m_RemotingServer = new RemotingServer(); 60
56 m_RemotingServer.CreateServer(listenPort, "DotNetEngine"); 61 // Load DotNetEngine
62 Engine = ScriptEngines.LoadEngine("DotNetEngine");
63
64 // Set up server
65 m_RemotingServer = new RemotingServer(listenPort, "DotNetEngine");
57 System.Console.ReadLine(); 66 System.Console.ReadLine();
58 } 67 }
59 68
@@ -68,7 +77,7 @@ namespace OpenSim.Grid.ScriptServer
68 Directory.CreateDirectory(Util.logDir()); 77 Directory.CreateDirectory(Util.logDir());
69 } 78 }
70 79
71 return new LogBase((Path.Combine(Util.logDir(), m_logFilename)), "Region", this, true); 80 return new LogBase((Path.Combine(Util.logDir(), m_logFilename)), "ScriptServer", this, true);
72 } 81 }
73 82
74 public void RunCmd(string command, string[] cmdparams) 83 public void RunCmd(string command, string[] cmdparams)