aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Grid
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Grid/ScriptServer/Main.cs46
-rw-r--r--OpenSim/Grid/ScriptServer/Properties/AssemblyInfo.cs33
-rw-r--r--OpenSim/Grid/ScriptServer/RegionConnectionManager.cs16
-rw-r--r--OpenSim/Grid/ScriptServer/RegionScriptDaemon.cs94
-rw-r--r--OpenSim/Grid/ScriptServer/RegionsManager.cs19
-rw-r--r--OpenSim/Grid/ScriptServer/ScriptEngineInterface.cs38
-rw-r--r--OpenSim/Grid/ScriptServer/ScriptEngineLoader.cs124
-rw-r--r--OpenSim/Grid/ScriptServer/ScriptServer.cs27
-rw-r--r--OpenSim/Grid/ScriptServer/ScriptServer.csproj47
9 files changed, 444 insertions, 0 deletions
diff --git a/OpenSim/Grid/ScriptServer/Main.cs b/OpenSim/Grid/ScriptServer/Main.cs
new file mode 100644
index 0000000..9f16ea8
--- /dev/null
+++ b/OpenSim/Grid/ScriptServer/Main.cs
@@ -0,0 +1,46 @@
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.Collections.Generic;
30using System.Text;
31
32namespace OpenSim.Grid.ScriptServer
33{
34 class OpenScript_Main
35 {
36
37 public static ScriptServer SE;
38
39 static void Main(string[] args)
40 {
41 // Application is starting
42 SE = new ScriptServer();
43 }
44
45 }
46}
diff --git a/OpenSim/Grid/ScriptServer/Properties/AssemblyInfo.cs b/OpenSim/Grid/ScriptServer/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..d60dbb4
--- /dev/null
+++ b/OpenSim/Grid/ScriptServer/Properties/AssemblyInfo.cs
@@ -0,0 +1,33 @@
1using System.Reflection;
2using System.Runtime.CompilerServices;
3using System.Runtime.InteropServices;
4
5// General Information about an assembly is controlled through the following
6// set of attributes. Change these attribute values to modify the information
7// associated with an assembly.
8[assembly: AssemblyTitle("OpenSim.Grid.ScriptServer")]
9[assembly: AssemblyDescription("")]
10[assembly: AssemblyConfiguration("")]
11[assembly: AssemblyCompany("")]
12[assembly: AssemblyProduct("OpenSim.Grid.ScriptServer")]
13[assembly: AssemblyCopyright("Copyright © 2007")]
14[assembly: AssemblyTrademark("")]
15[assembly: AssemblyCulture("")]
16
17// Setting ComVisible to false makes the types in this assembly not visible
18// to COM components. If you need to access a type in this assembly from
19// COM, set the ComVisible attribute to true on that type.
20[assembly: ComVisible(false)]
21
22// The following GUID is for the ID of the typelib if this project is exposed to COM
23[assembly: Guid("b6861b87-5203-4040-b756-fd4774932f82")]
24
25// Version information for an assembly consists of the following four values:
26//
27// Major Version
28// Minor Version
29// Build Number
30// Revision
31//
32[assembly: AssemblyVersion("1.0.0.0")]
33[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/OpenSim/Grid/ScriptServer/RegionConnectionManager.cs b/OpenSim/Grid/ScriptServer/RegionConnectionManager.cs
new file mode 100644
index 0000000..6a517e9
--- /dev/null
+++ b/OpenSim/Grid/ScriptServer/RegionConnectionManager.cs
@@ -0,0 +1,16 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4
5namespace OpenSim.Grid.ScriptServer
6{
7 // Maintains connection and communication to a region
8 class RegionConnectionManager
9 {
10
11 public RegionConnectionManager()
12 {
13 }
14
15 }
16}
diff --git a/OpenSim/Grid/ScriptServer/RegionScriptDaemon.cs b/OpenSim/Grid/ScriptServer/RegionScriptDaemon.cs
new file mode 100644
index 0000000..435c09b
--- /dev/null
+++ b/OpenSim/Grid/ScriptServer/RegionScriptDaemon.cs
@@ -0,0 +1,94 @@
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.Collections.Generic;
30using System.Text;
31using System.Threading;
32
33namespace OpenSim.Grid.ScriptServer
34{
35 // Waiting for incoming script requests from region
36 internal class RegionScriptDaemon
37 {
38 private Thread listenThread;
39
40 public ScriptServer m_ScriptServer;
41 public RegionScriptDaemon(ScriptServer scriptServer)
42 {
43 m_ScriptServer = scriptServer;
44 }
45 ~RegionScriptDaemon()
46 {
47 Stop();
48 }
49
50 /// <summary>
51 /// Starts listening for region requests
52 /// </summary>
53 public void Start()
54 {
55 // Start listener
56 Stop();
57 listenThread = new Thread(ListenThreadLoop);
58 listenThread.Name = "listenThread";
59 listenThread.IsBackground = true;
60 listenThread.Start();
61 }
62 /// <summary>
63 /// Stops listening for region requests
64 /// </summary>
65 public void Stop()
66 {
67 // Stop listener, clean up
68 if (listenThread != null)
69 {
70 try
71 {
72 if (listenThread.IsAlive)
73 listenThread.Abort();
74 listenThread.Join(1000); // Wait 1 second for thread to shut down
75 }
76 catch { }
77 listenThread = null;
78 }
79 }
80
81 private void ListenThreadLoop()
82 {
83 // * Listen for requests from regions
84 // * When a request is received:
85 // - Authenticate region
86 // - Authenticate user
87 // - Have correct scriptengine load script
88 // ~ ask scriptengines if they will accept script?
89 // - Add script to shared communication channel towards that region
90
91 }
92
93 }
94}
diff --git a/OpenSim/Grid/ScriptServer/RegionsManager.cs b/OpenSim/Grid/ScriptServer/RegionsManager.cs
new file mode 100644
index 0000000..0e1fad1
--- /dev/null
+++ b/OpenSim/Grid/ScriptServer/RegionsManager.cs
@@ -0,0 +1,19 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4
5namespace OpenSim.Grid.ScriptServer
6{
7 // Maintains all regions
8 class RegionsManager
9 {
10 private List<RegionConnectionManager> Regions = new List<RegionConnectionManager>();
11
12 public ScriptServer m_ScriptServer;
13 public RegionsManager(ScriptServer scriptServer)
14 {
15 m_ScriptServer = scriptServer;
16 }
17
18 }
19}
diff --git a/OpenSim/Grid/ScriptServer/ScriptEngineInterface.cs b/OpenSim/Grid/ScriptServer/ScriptEngineInterface.cs
new file mode 100644
index 0000000..7440bcb
--- /dev/null
+++ b/OpenSim/Grid/ScriptServer/ScriptEngineInterface.cs
@@ -0,0 +1,38 @@
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(Scene Sceneworld, 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/ScriptEngineLoader.cs b/OpenSim/Grid/ScriptServer/ScriptEngineLoader.cs
new file mode 100644
index 0000000..1b5dc39
--- /dev/null
+++ b/OpenSim/Grid/ScriptServer/ScriptEngineLoader.cs
@@ -0,0 +1,124 @@
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 public class ScriptEngineLoader
36 {
37 private LogBase m_log;
38
39 public ScriptEngineLoader(LogBase logger)
40 {
41 m_log = logger;
42 }
43
44 public ScriptEngineInterface LoadScriptEngine(string EngineName)
45 {
46 ScriptEngineInterface ret = null;
47 try
48 {
49 ret =
50 LoadAndInitAssembly(
51 Path.Combine("ScriptEngines", "OpenSim.Region.ScriptEngine." + EngineName + ".dll"),
52 "OpenSim.Region.ScriptEngine." + EngineName + ".ScriptEngine");
53 }
54 catch (Exception e)
55 {
56 m_log.Error("ScriptEngine",
57 "Error loading assembly \"" + EngineName + "\": " + e.Message + ", " +
58 e.StackTrace.ToString());
59 }
60 return ret;
61 }
62
63 /// <summary>
64 /// Does actual loading and initialization of script Assembly
65 /// </summary>
66 /// <param name="FreeAppDomain">AppDomain to load script into</param>
67 /// <param name="FileName">FileName of script assembly (.dll)</param>
68 /// <returns></returns>
69 private ScriptEngineInterface LoadAndInitAssembly(string FileName, string NameSpace)
70 {
71 //Common.SendToDebug("Loading ScriptEngine Assembly " + FileName);
72 // Load .Net Assembly (.dll)
73 // Initialize and return it
74
75 // TODO: Add error handling
76
77 Assembly a;
78 //try
79 //{
80
81
82 // Load to default appdomain (temporary)
83 a = Assembly.LoadFrom(FileName);
84 // Load to specified appdomain
85 // TODO: Insert security
86 //a = FreeAppDomain.Load(FileName);
87 //}
88 //catch (Exception e)
89 //{
90 // m_log.Error("ScriptEngine", "Error loading assembly \"" + FileName + "\": " + e.ToString());
91 //}
92
93
94 //Console.WriteLine("Loading: " + FileName);
95 //foreach (Type _t in a.GetTypes())
96 //{
97 // Console.WriteLine("Type: " + _t.ToString());
98 //}
99
100 Type t;
101 //try
102 //{
103 t = a.GetType(NameSpace, true);
104 //}
105 //catch (Exception e)
106 //{
107 // m_log.Error("ScriptEngine", "Error initializing type \"" + NameSpace + "\" from \"" + FileName + "\": " + e.ToString());
108 //}
109
110 ScriptEngineInterface ret;
111 //try
112 //{
113 ret = (ScriptEngineInterface) Activator.CreateInstance(t);
114 //}
115 //catch (Exception e)
116 //{
117 // m_log.Error("ScriptEngine", "Error initializing type \"" + NameSpace + "\" from \"" + FileName + "\": " + e.ToString());
118 //}
119
120 return ret;
121 }
122 }
123}
124
diff --git a/OpenSim/Grid/ScriptServer/ScriptServer.cs b/OpenSim/Grid/ScriptServer/ScriptServer.cs
new file mode 100644
index 0000000..2c26027
--- /dev/null
+++ b/OpenSim/Grid/ScriptServer/ScriptServer.cs
@@ -0,0 +1,27 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4
5namespace OpenSim.Grid.ScriptServer
6{
7 class ScriptServer
8 {
9 public RegionScriptDaemon RegionScriptDaemon; // Listen for incoming from region
10 public RegionsManager RegionManager; // Handle regions
11 public ScriptEngineLoader ScriptEngineLoader; // Loads scriptengines
12
13 public ScriptServer()
14 {
15 RegionScriptDaemon = new RegionScriptDaemon(this);
16 RegionManager = new RegionsManager(this);
17 //ScriptEngineLoader = new ScriptEngineLoader(this);
18 }
19
20 ~ScriptServer()
21 {
22 }
23
24
25
26 }
27}
diff --git a/OpenSim/Grid/ScriptServer/ScriptServer.csproj b/OpenSim/Grid/ScriptServer/ScriptServer.csproj
new file mode 100644
index 0000000..6968848
--- /dev/null
+++ b/OpenSim/Grid/ScriptServer/ScriptServer.csproj
@@ -0,0 +1,47 @@
1<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2 <PropertyGroup>
3 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
4 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
5 <ProductVersion>8.0.50727</ProductVersion>
6 <SchemaVersion>2.0</SchemaVersion>
7 <ProjectGuid>{8FF1D8B6-9E2F-47AB-A26A-F44CED20CD0E}</ProjectGuid>
8 <OutputType>Exe</OutputType>
9 <AppDesignerFolder>Properties</AppDesignerFolder>
10 <RootNamespace>ScriptServer</RootNamespace>
11 <AssemblyName>ScriptServer</AssemblyName>
12 </PropertyGroup>
13 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
14 <DebugSymbols>true</DebugSymbols>
15 <DebugType>full</DebugType>
16 <Optimize>false</Optimize>
17 <OutputPath>bin\Debug\</OutputPath>
18 <DefineConstants>DEBUG;TRACE</DefineConstants>
19 <ErrorReport>prompt</ErrorReport>
20 <WarningLevel>4</WarningLevel>
21 </PropertyGroup>
22 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
23 <DebugType>pdbonly</DebugType>
24 <Optimize>true</Optimize>
25 <OutputPath>bin\Release\</OutputPath>
26 <DefineConstants>TRACE</DefineConstants>
27 <ErrorReport>prompt</ErrorReport>
28 <WarningLevel>4</WarningLevel>
29 </PropertyGroup>
30 <ItemGroup>
31 <Reference Include="System" />
32 <Reference Include="System.Data" />
33 <Reference Include="System.Xml" />
34 </ItemGroup>
35 <ItemGroup>
36 <Compile Include="Program.cs" />
37 <Compile Include="Properties\AssemblyInfo.cs" />
38 </ItemGroup>
39 <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
40 <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
41 Other similar extension points exist, see Microsoft.Common.targets.
42 <Target Name="BeforeBuild">
43 </Target>
44 <Target Name="AfterBuild">
45 </Target>
46 -->
47</Project> \ No newline at end of file