* Rex merges, more grid script server.
							parent
							
								
									6f00175d89
								
							
						
					
					
						commit
						7caa40e301
					
				|  | @ -25,6 +25,8 @@ | |||
| * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||||
| *  | ||||
| */ | ||||
| 
 | ||||
| 
 | ||||
| using System; | ||||
| 
 | ||||
| namespace OpenSim.Grid.ScriptServer | ||||
|  | @ -35,6 +37,8 @@ namespace OpenSim.Grid.ScriptServer | |||
| 
 | ||||
|         private static void Main(string[] args) | ||||
|         { | ||||
|             log4net.Config.XmlConfigurator.Configure(); | ||||
| 
 | ||||
|             AppDomain.CurrentDomain.UnhandledException += | ||||
|                 new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); | ||||
| 
 | ||||
|  | @ -45,12 +49,12 @@ namespace OpenSim.Grid.ScriptServer | |||
| 
 | ||||
|         private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) | ||||
|         { | ||||
|             Console.WriteLine(""); | ||||
|             Console.WriteLine(String.Empty); | ||||
|             Console.WriteLine("APPLICATION EXCEPTION DETECTED"); | ||||
|             Console.WriteLine(""); | ||||
|             Console.WriteLine(String.Empty); | ||||
|             Console.WriteLine("Application is terminating: " + e.IsTerminating.ToString()); | ||||
|             Console.WriteLine("Exception:"); | ||||
|             Console.WriteLine(e.ExceptionObject.ToString()); | ||||
|             //Console.WriteLine("Exception:"); | ||||
|             //Console.WriteLine(e.ExceptionObject.ToString()); | ||||
|         } | ||||
|     } | ||||
| } | ||||
|  | @ -1,4 +1,4 @@ | |||
| /* | ||||
| /* | ||||
| * Copyright (c) Contributors, http://opensimulator.org/ | ||||
| * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||||
| * | ||||
|  | @ -25,14 +25,31 @@ | |||
| * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||||
| *  | ||||
| */ | ||||
| using OpenSim.Framework.Console; | ||||
| 
 | ||||
| using System; | ||||
| using System.Collections.Generic; | ||||
| using System.Text; | ||||
| using OpenSim.Framework; | ||||
| using OpenSim.Framework.Communications; | ||||
| using OpenSim.Framework.Communications.Cache; | ||||
| using OpenSim.Framework.Servers; | ||||
| using OpenSim.Region.Environment; | ||||
| using OpenSim.Region.Environment.Scenes; | ||||
| 
 | ||||
| namespace OpenSim.Grid.ScriptServer | ||||
| { | ||||
|     public interface ScriptEngineInterface | ||||
|     public class FakeScene: Scene | ||||
|     { | ||||
|         void InitializeEngine(RegionConnectionManager Region, LogBase logger); | ||||
|         void Shutdown(); | ||||
| //        void StartScript(string ScriptID, IScriptHost ObjectID); | ||||
|         public FakeScene(RegionInfo regInfo, AgentCircuitManager authen, PermissionManager permissionManager, | ||||
|                          CommunicationsManager commsMan, SceneCommunicationService sceneGridService, | ||||
|                          AssetCache assetCach, StorageManager storeManager, BaseHttpServer httpServer, | ||||
|                          ModuleLoader moduleLoader, bool dumpAssetsToFile, bool physicalPrim, bool sendTasksToChild) | ||||
|             : base( | ||||
|                 regInfo, authen, permissionManager, commsMan, sceneGridService, assetCach, storeManager, httpServer, | ||||
|                 moduleLoader, dumpAssetsToFile, physicalPrim, sendTasksToChild) | ||||
|         { | ||||
|         } | ||||
| 
 | ||||
|         // What does a scene have to do? :P | ||||
|     } | ||||
| } | ||||
|  | @ -1,3 +1,31 @@ | |||
| /* | ||||
| * Copyright (c) Contributors, http://opensimulator.org/ | ||||
| * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||||
| * | ||||
| * Redistribution and use in source and binary forms, with or without | ||||
| * modification, are permitted provided that the following conditions are met: | ||||
| *     * Redistributions of source code must retain the above copyright | ||||
| *       notice, this list of conditions and the following disclaimer. | ||||
| *     * Redistributions in binary form must reproduce the above copyright | ||||
| *       notice, this list of conditions and the following disclaimer in the | ||||
| *       documentation and/or other materials provided with the distribution. | ||||
| *     * Neither the name of the OpenSim Project nor the | ||||
| *       names of its contributors may be used to endorse or promote products | ||||
| *       derived from this software without specific prior written permission. | ||||
| * | ||||
| * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||||
| * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||||
| * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||||
| * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||||
| * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||||
| * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||||
| * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||||
| * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||||
| * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||||
| * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||||
| *  | ||||
| */ | ||||
| 
 | ||||
| using System.Reflection; | ||||
| using System.Runtime.InteropServices; | ||||
| 
 | ||||
|  | @ -10,7 +38,7 @@ using System.Runtime.InteropServices; | |||
| [assembly : AssemblyConfiguration("")] | ||||
| [assembly : AssemblyCompany("")] | ||||
| [assembly : AssemblyProduct("OpenSim.Grid.ScriptServer")] | ||||
| [assembly : AssemblyCopyright("Copyright ©  2007")] | ||||
| [assembly : AssemblyCopyright("Copyright © OpenSimulator.org Developers 2007-2008")] | ||||
| [assembly : AssemblyTrademark("")] | ||||
| [assembly : AssemblyCulture("")] | ||||
| 
 | ||||
|  |  | |||
|  | @ -1,4 +1,32 @@ | |||
| using System; | ||||
| /* | ||||
| * Copyright (c) Contributors, http://opensimulator.org/ | ||||
| * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||||
| * | ||||
| * Redistribution and use in source and binary forms, with or without | ||||
| * modification, are permitted provided that the following conditions are met: | ||||
| *     * Redistributions of source code must retain the above copyright | ||||
| *       notice, this list of conditions and the following disclaimer. | ||||
| *     * Redistributions in binary form must reproduce the above copyright | ||||
| *       notice, this list of conditions and the following disclaimer in the | ||||
| *       documentation and/or other materials provided with the distribution. | ||||
| *     * Neither the name of the OpenSim Project nor the | ||||
| *       names of its contributors may be used to endorse or promote products | ||||
| *       derived from this software without specific prior written permission. | ||||
| * | ||||
| * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||||
| * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||||
| * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||||
| * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||||
| * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||||
| * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||||
| * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||||
| * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||||
| * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||||
| * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||||
| *  | ||||
| */ | ||||
| 
 | ||||
| using System; | ||||
| using System.Collections.Generic; | ||||
| using System.Text; | ||||
| using OpenSim.Region.Environment.Interfaces; | ||||
|  | @ -10,18 +38,10 @@ namespace OpenSim.Grid.ScriptServer | |||
|     { | ||||
|         // This object will be exposed over remoting. It is a singleton, so it exists only in as one instance. | ||||
| 
 | ||||
|         // Expose ScriptEngine directly for now ... this is not very secure :) | ||||
|         // NOTE! CURRENTLY JUST HARDWIRED DOTNETENGINE! | ||||
|         //private OpenSim.Region.ScriptEngine.DotNetEngine.ScriptEngine SE = | ||||
|         //    new OpenSim.Region.ScriptEngine.DotNetEngine.ScriptEngine(); | ||||
|         //public OpenSim.Region.ScriptEngine.Common.ScriptServerInterfaces.RemoteEvents Events =  | ||||
|         //    (OpenSim.Region.ScriptEngine.Common.ScriptServerInterfaces.RemoteEvents)SE.m_EventManager; | ||||
| 
 | ||||
|         //private ScriptServerInterfaces.RemoteEvents _events = new abc; | ||||
| 
 | ||||
|         ScriptServerInterfaces.RemoteEvents ScriptServerInterfaces.ServerRemotingObject.Events() | ||||
|         { | ||||
|             return null; | ||||
|             return ScriptServerMain.Engine.EventManager(); | ||||
|         } | ||||
|     } | ||||
| } | ||||
|  |  | |||
|  | @ -1,20 +1,49 @@ | |||
| using System; | ||||
| /* | ||||
| * Copyright (c) Contributors, http://opensimulator.org/ | ||||
| * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||||
| * | ||||
| * Redistribution and use in source and binary forms, with or without | ||||
| * modification, are permitted provided that the following conditions are met: | ||||
| *     * Redistributions of source code must retain the above copyright | ||||
| *       notice, this list of conditions and the following disclaimer. | ||||
| *     * Redistributions in binary form must reproduce the above copyright | ||||
| *       notice, this list of conditions and the following disclaimer in the | ||||
| *       documentation and/or other materials provided with the distribution. | ||||
| *     * Neither the name of the OpenSim Project nor the | ||||
| *       names of its contributors may be used to endorse or promote products | ||||
| *       derived from this software without specific prior written permission. | ||||
| * | ||||
| * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||||
| * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||||
| * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||||
| * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||||
| * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||||
| * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||||
| * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||||
| * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||||
| * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||||
| * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||||
| *  | ||||
| */ | ||||
| 
 | ||||
| using System; | ||||
| using System.Collections.Generic; | ||||
| using System.Text; | ||||
| using System.Runtime.Remoting; | ||||
| using System.Runtime.Remoting.Channels; | ||||
| using System.Runtime.Remoting.Channels.Tcp; | ||||
| using OpenSim.Region.ScriptEngine.Common; | ||||
| 
 | ||||
| 
 | ||||
| namespace OpenSim.Grid.ScriptServer | ||||
| { | ||||
|     class RemotingServer | ||||
|     { | ||||
| 
 | ||||
|         public void CreateServer(int port, string instanceName) | ||||
|         TcpChannel channel; | ||||
|         public RemotingServer(int port, string instanceName) | ||||
|         { | ||||
|             // Create an instance of a channel | ||||
|             TcpChannel channel = new TcpChannel(port); | ||||
|             channel = new TcpChannel(port); | ||||
|             ChannelServices.RegisterChannel(channel, true); | ||||
| 
 | ||||
|             // Register as an available service with the name HelloWorld | ||||
|  |  | |||
|  | @ -1,47 +0,0 @@ | |||
| <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||||
|   <PropertyGroup> | ||||
|     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||||
|     <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||||
|     <ProductVersion>8.0.50727</ProductVersion> | ||||
|     <SchemaVersion>2.0</SchemaVersion> | ||||
|     <ProjectGuid>{8FF1D8B6-9E2F-47AB-A26A-F44CED20CD0E}</ProjectGuid> | ||||
|     <OutputType>Exe</OutputType> | ||||
|     <AppDesignerFolder>Properties</AppDesignerFolder> | ||||
|     <RootNamespace>ScriptServer</RootNamespace> | ||||
|     <AssemblyName>ScriptServer</AssemblyName> | ||||
|   </PropertyGroup> | ||||
|   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||||
|     <DebugSymbols>true</DebugSymbols> | ||||
|     <DebugType>full</DebugType> | ||||
|     <Optimize>false</Optimize> | ||||
|     <OutputPath>bin\Debug\</OutputPath> | ||||
|     <DefineConstants>DEBUG;TRACE</DefineConstants> | ||||
|     <ErrorReport>prompt</ErrorReport> | ||||
|     <WarningLevel>4</WarningLevel> | ||||
|   </PropertyGroup> | ||||
|   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||||
|     <DebugType>pdbonly</DebugType> | ||||
|     <Optimize>true</Optimize> | ||||
|     <OutputPath>bin\Release\</OutputPath> | ||||
|     <DefineConstants>TRACE</DefineConstants> | ||||
|     <ErrorReport>prompt</ErrorReport> | ||||
|     <WarningLevel>4</WarningLevel> | ||||
|   </PropertyGroup> | ||||
|   <ItemGroup> | ||||
|     <Reference Include="System" /> | ||||
|     <Reference Include="System.Data" /> | ||||
|     <Reference Include="System.Xml" /> | ||||
|   </ItemGroup> | ||||
|   <ItemGroup> | ||||
|     <Compile Include="Program.cs" /> | ||||
|     <Compile Include="Properties\AssemblyInfo.cs" /> | ||||
|   </ItemGroup> | ||||
|   <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> | ||||
|   <!-- To modify your build process, add your task inside one of the targets below and uncomment it.  | ||||
|        Other similar extension points exist, see Microsoft.Common.targets. | ||||
|   <Target Name="BeforeBuild"> | ||||
|   </Target> | ||||
|   <Target Name="AfterBuild"> | ||||
|   </Target> | ||||
|   --> | ||||
| </Project> | ||||
|  | @ -13,7 +13,7 @@ | |||
| *       names of its contributors may be used to endorse or promote products | ||||
| *       derived from this software without specific prior written permission. | ||||
| * | ||||
| * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY | ||||
| * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||||
| * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||||
| * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||||
| * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||||
|  |  | |||
|  | @ -13,7 +13,7 @@ | |||
| *       names of its contributors may be used to endorse or promote products | ||||
| *       derived from this software without specific prior written permission. | ||||
| * | ||||
| * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY | ||||
| * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||||
| * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||||
| * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||||
| * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||||
|  | @ -33,14 +33,12 @@ namespace OpenSim.Grid.ScriptServer | |||
|     // Maintains connection and communication to a region | ||||
|     public class RegionConnectionManager : RegionBase | ||||
|     { | ||||
|         private LogBase m_log; | ||||
|         private ScriptServerMain m_ScriptServerMain; | ||||
|         private object m_Connection; | ||||
| 
 | ||||
|         public RegionConnectionManager(ScriptServerMain scm, LogBase logger, object Connection) | ||||
|         public RegionConnectionManager(ScriptServerMain scm, object Connection) | ||||
|         { | ||||
|             m_ScriptServerMain = scm; | ||||
|             m_log = logger; | ||||
|             m_Connection = Connection; | ||||
|         } | ||||
| 
 | ||||
|  |  | |||
|  | @ -38,13 +38,11 @@ namespace OpenSim.Grid.ScriptServer | |||
| 
 | ||||
|         private List<RegionConnectionManager> Regions = new List<RegionConnectionManager>(); | ||||
| 
 | ||||
|         private LogBase m_log; | ||||
|         private ScriptServerMain m_ScriptServerMain; | ||||
| 
 | ||||
|         public RegionCommManager(ScriptServerMain scm, LogBase logger) | ||||
|         public RegionCommManager(ScriptServerMain scm) | ||||
|         { | ||||
|             m_ScriptServerMain = scm; | ||||
|             m_log = logger; | ||||
|         } | ||||
| 
 | ||||
|         ~RegionCommManager() | ||||
|  | @ -60,9 +58,10 @@ namespace OpenSim.Grid.ScriptServer | |||
|             // Start listener | ||||
|             Stop(); | ||||
|             listenThread = new Thread(ListenThreadLoop); | ||||
|             listenThread.Name = "listenThread"; | ||||
|             listenThread.Name = "ListenThread"; | ||||
|             listenThread.IsBackground = true; | ||||
|             listenThread.Start(); | ||||
|             OpenSim.Framework.ThreadTracker.Add(listenThread); | ||||
|         } | ||||
| 
 | ||||
|         /// <summary> | ||||
|  | @ -96,9 +95,8 @@ namespace OpenSim.Grid.ScriptServer | |||
|             //   ~ ask scriptengines if they will accept script? | ||||
|             //  - Add script to shared communication channel towards that region | ||||
| 
 | ||||
| 
 | ||||
|             // TODO: FAKING A CONNECTION | ||||
|             Regions.Add(new RegionConnectionManager(m_ScriptServerMain, m_log, null)); | ||||
|             Regions.Add(new RegionConnectionManager(m_ScriptServerMain, null)); | ||||
|         } | ||||
|     } | ||||
| } | ||||
|  | @ -29,22 +29,17 @@ using System; | |||
| using System.IO; | ||||
| using System.Reflection; | ||||
| using OpenSim.Framework.Console; | ||||
| using OpenSim.Region.ScriptEngine.Common; | ||||
| 
 | ||||
| namespace OpenSim.Grid.ScriptServer | ||||
| namespace OpenSim.Grid.ScriptServer.ScriptServer | ||||
| { | ||||
|     internal class ScriptEngineLoader | ||||
|     { | ||||
|         private LogBase m_log; | ||||
|         private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); | ||||
| 
 | ||||
| 
 | ||||
|         public ScriptEngineLoader(LogBase logger) | ||||
|         public ScriptServerInterfaces.ScriptEngine LoadScriptEngine(string EngineName) | ||||
|         { | ||||
|             m_log = logger; | ||||
|         } | ||||
| 
 | ||||
|         public ScriptEngineInterface LoadScriptEngine(string EngineName) | ||||
|         { | ||||
|             ScriptEngineInterface ret = null; | ||||
|             ScriptServerInterfaces.ScriptEngine ret = null; | ||||
|             try | ||||
|             { | ||||
|                 ret = | ||||
|  | @ -54,7 +49,7 @@ namespace OpenSim.Grid.ScriptServer | |||
|             } | ||||
|             catch (Exception e) | ||||
|             { | ||||
|                 m_log.Error("ScriptEngine", | ||||
|                 m_log.Error("[ScriptEngine]: " + | ||||
|                             "Error loading assembly \"" + EngineName + "\": " + e.Message + ", " + | ||||
|                             e.StackTrace.ToString()); | ||||
|             } | ||||
|  | @ -64,10 +59,8 @@ namespace OpenSim.Grid.ScriptServer | |||
|         /// <summary> | ||||
|         /// Does actual loading and initialization of script Assembly | ||||
|         /// </summary> | ||||
|         /// <param name="FreeAppDomain">AppDomain to load script into</param> | ||||
|         /// <param name="FileName">FileName of script assembly (.dll)</param> | ||||
|         /// <returns></returns> | ||||
|         private ScriptEngineInterface LoadAndInitAssembly(string FileName, string NameSpace) | ||||
|         private ScriptServerInterfaces.ScriptEngine LoadAndInitAssembly(string FileName, string NameSpace) | ||||
|         { | ||||
|             //Common.SendToDebug("Loading ScriptEngine Assembly " + FileName); | ||||
|             // Load .Net Assembly (.dll) | ||||
|  | @ -88,7 +81,7 @@ namespace OpenSim.Grid.ScriptServer | |||
|             //} | ||||
|             //catch (Exception e) | ||||
|             //{ | ||||
|             //    m_log.Error("ScriptEngine", "Error loading assembly \"" + FileName + "\": " + e.ToString()); | ||||
|             //    m_log.Error("[ScriptEngine]: Error loading assembly \String.Empty + FileName + "\": " + e.ToString()); | ||||
|             //} | ||||
| 
 | ||||
| 
 | ||||
|  | @ -105,17 +98,17 @@ namespace OpenSim.Grid.ScriptServer | |||
|             //} | ||||
|             //catch (Exception e) | ||||
|             //{ | ||||
|             //    m_log.Error("ScriptEngine", "Error initializing type \"" + NameSpace + "\" from \"" + FileName + "\": " + e.ToString()); | ||||
|             //    m_log.Error("[ScriptEngine]: Error initializing type \String.Empty + NameSpace + "\" from \String.Empty + FileName + "\": " + e.ToString()); | ||||
|             //} | ||||
| 
 | ||||
|             ScriptEngineInterface ret; | ||||
|             ScriptServerInterfaces.ScriptEngine ret; | ||||
|             //try | ||||
|             //{ | ||||
|             ret = (ScriptEngineInterface) Activator.CreateInstance(t); | ||||
|             ret = (ScriptServerInterfaces.ScriptEngine)Activator.CreateInstance(t); | ||||
|             //} | ||||
|             //catch (Exception e) | ||||
|             //{ | ||||
|             //    m_log.Error("ScriptEngine", "Error initializing type \"" + NameSpace + "\" from \"" + FileName + "\": " + e.ToString()); | ||||
|             //    m_log.Error("[ScriptEngine]: Error initializing type \String.Empty + NameSpace + "\" from \String.Empty + FileName + "\": " + e.ToString()); | ||||
|             //} | ||||
| 
 | ||||
|             return ret; | ||||
|  | @ -13,7 +13,7 @@ | |||
| *       names of its contributors may be used to endorse or promote products | ||||
| *       derived from this software without specific prior written permission. | ||||
| * | ||||
| * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY | ||||
| * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||||
| * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||||
| * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||||
| * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||||
|  | @ -28,39 +28,36 @@ | |||
| 
 | ||||
| using System.Collections.Generic; | ||||
| using OpenSim.Framework.Console; | ||||
| using OpenSim.Region.ScriptEngine.Common; | ||||
| 
 | ||||
| namespace OpenSim.Grid.ScriptServer | ||||
| namespace OpenSim.Grid.ScriptServer.ScriptServer | ||||
| { | ||||
|     internal class ScriptEngineManager | ||||
|     { | ||||
|         private LogBase m_log; | ||||
|         private ScriptEngineLoader ScriptEngineLoader; | ||||
|         private List<ScriptEngineInterface> scriptEngines = new List<ScriptEngineInterface>(); | ||||
|         private List<ScriptServerInterfaces.ScriptEngine> scriptEngines = new List<ScriptServerInterfaces.ScriptEngine>(); | ||||
|         private ScriptServerMain m_ScriptServerMain; | ||||
| 
 | ||||
|         // Initialize | ||||
|         public ScriptEngineManager(ScriptServerMain scm, LogBase logger) | ||||
|         public ScriptEngineManager(ScriptServerMain scm) | ||||
|         { | ||||
|             m_ScriptServerMain = scm; | ||||
|             m_log = logger; | ||||
|             ScriptEngineLoader = new ScriptEngineLoader(m_log); | ||||
| 
 | ||||
|             // Temp - we should not load during initialize... Loading should be done later. | ||||
|             LoadEngine("DotNetScriptEngine"); | ||||
|             ScriptEngineLoader = new ScriptEngineLoader(); | ||||
|         } | ||||
| 
 | ||||
|         ~ScriptEngineManager() | ||||
|         { | ||||
|         } | ||||
| 
 | ||||
|         public void LoadEngine(string engineName) | ||||
|         public ScriptServerInterfaces.ScriptEngine LoadEngine(string engineName) | ||||
|         { | ||||
|             // Load and add to list of ScriptEngines | ||||
|             ScriptEngineInterface sei = ScriptEngineLoader.LoadScriptEngine(engineName); | ||||
|             ScriptServerInterfaces.ScriptEngine sei = ScriptEngineLoader.LoadScriptEngine(engineName); | ||||
|             if (sei != null) | ||||
|             { | ||||
|                 scriptEngines.Add(sei); | ||||
|             } | ||||
|             return sei; | ||||
|         } | ||||
|     } | ||||
| } | ||||
|  | @ -13,7 +13,7 @@ | |||
| *       names of its contributors may be used to endorse or promote products | ||||
| *       derived from this software without specific prior written permission. | ||||
| * | ||||
| * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY | ||||
| * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||||
| * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||||
| * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||||
| * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||||
|  | @ -27,56 +27,84 @@ | |||
| */ | ||||
| 
 | ||||
| using System.IO; | ||||
| using libsecondlife; | ||||
| using Nini.Config; | ||||
| using OpenSim.Framework; | ||||
| using OpenSim.Framework.Console; | ||||
| using OpenSim.Framework.Servers; | ||||
| using OpenSim.Grid.ScriptServer.ScriptServer; | ||||
| using OpenSim.Region.ScriptEngine.Common; | ||||
| using OpenSim.Region.ScriptEngine.Common.TRPC; | ||||
| 
 | ||||
| namespace OpenSim.Grid.ScriptServer | ||||
| { | ||||
|     public class ScriptServerMain : conscmd_callback | ||||
|     public class ScriptServerMain : BaseOpenSimServer, conscmd_callback | ||||
|     { | ||||
|         private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); | ||||
| 
 | ||||
|         // | ||||
|         // Root object. Creates objects used. | ||||
|         // | ||||
|         private int listenPort = 1234; | ||||
|         private readonly string m_logFilename = ("region-console.log"); | ||||
|         private LogBase m_log; | ||||
|         private int listenPort = 8010; | ||||
| 
 | ||||
|         // TEMP | ||||
|         public static ScriptServerInterfaces.ScriptEngine Engine; | ||||
|         //public static FakeScene m_Scene = new FakeScene(null,null,null,null,null,null,null,null,null,false, false, false); | ||||
| 
 | ||||
|         // Objects we use | ||||
|         internal RegionCommManager RegionScriptDaemon; // Listen for incoming from region | ||||
|         //internal ScriptEngineManager ScriptEngines; // Loads scriptengines | ||||
|         internal RemotingServer m_RemotingServer; | ||||
|         internal ScriptEngineManager ScriptEngines; // Loads scriptengines | ||||
|         //internal RemotingServer m_RemotingServer; | ||||
|         internal TCPServer m_TCPServer; | ||||
|         internal TRPC_Remote RPC; | ||||
| 
 | ||||
|         public ScriptServerMain() | ||||
|                 public ScriptServerMain() | ||||
|         { | ||||
|             m_log = CreateLog(); | ||||
|             m_console = CreateConsole(); | ||||
| 
 | ||||
|             // Set up script engine mananger | ||||
|             ScriptEngines = new ScriptEngineManager(this); | ||||
| 
 | ||||
|             // Load DotNetEngine | ||||
|             Engine = ScriptEngines.LoadEngine("DotNetEngine"); | ||||
|                     IConfigSource config = null; | ||||
|             Engine.InitializeEngine(null, null, false, Engine.GetScriptManager()); | ||||
|                      | ||||
| 
 | ||||
|             // Set up server | ||||
|             //m_RemotingServer = new RemotingServer(listenPort, "DotNetEngine"); | ||||
|             m_TCPServer = new TCPServer(listenPort); | ||||
|             RPC = new TRPC_Remote(m_TCPServer); | ||||
|                     RPC.ReceiveCommand += new TRPC_Remote.ReceiveCommandDelegate(RPC_ReceiveCommand); | ||||
|             m_TCPServer.StartListen(); | ||||
| 
 | ||||
|             RegionScriptDaemon = new RegionCommManager(this, m_log); | ||||
|             //ScriptEngines = new ScriptEngineManager(this, m_log); | ||||
|             m_RemotingServer = new RemotingServer(); | ||||
|             m_RemotingServer.CreateServer(listenPort, "DotNetEngine"); | ||||
|             System.Console.ReadLine(); | ||||
|         } | ||||
| 
 | ||||
|         private void RPC_ReceiveCommand(int ID, string Command, object[] p) | ||||
|         { | ||||
|             m_log.Info("[SERVER]: Received command: '" + Command + "'"); | ||||
|             if (p != null) | ||||
|             { | ||||
|                 for (int i = 0; i < p.Length; i++) | ||||
|                 { | ||||
|                     m_log.Info("[SERVER]: Param " + i + ": " + p[i].ToString()); | ||||
|                 } | ||||
|             } | ||||
| 
 | ||||
|             if (Command == "OnRezScript") | ||||
|             { | ||||
|                 Engine.EventManager().OnRezScript((uint)p[0], new LLUUID((string)p[1]), (string)p[2]); | ||||
|             } | ||||
|         } | ||||
| 
 | ||||
|         ~ScriptServerMain() | ||||
|         { | ||||
|         } | ||||
| 
 | ||||
|         protected LogBase CreateLog() | ||||
|         { | ||||
|             if (!Directory.Exists(Util.logDir())) | ||||
|             { | ||||
|                 Directory.CreateDirectory(Util.logDir()); | ||||
|             } | ||||
| 
 | ||||
|             return new LogBase((Path.Combine(Util.logDir(), m_logFilename)), "Region", this, true); | ||||
|         } | ||||
| 
 | ||||
|         public void RunCmd(string command, string[] cmdparams) | ||||
|         { | ||||
|         } | ||||
| 
 | ||||
|         public void Show(string ShowWhat) | ||||
|         protected ConsoleBase CreateConsole() | ||||
|         { | ||||
|             return new ConsoleBase("ScriptServer", this); | ||||
|         } | ||||
|     } | ||||
| } | ||||
		Loading…
	
		Reference in New Issue
	
	 Adam Frisby
						Adam Frisby