* Rex merges, more grid script server.

afrisby-3
Adam Frisby 2008-02-23 02:54:41 +00:00
parent 6f00175d89
commit 7caa40e301
12 changed files with 975 additions and 910 deletions

View File

@ -1,56 +1,60 @@
/* /*
* Copyright (c) Contributors, http://opensimulator.org/ * Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders. * See CONTRIBUTORS.TXT for a full list of copyright holders.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met: * modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright * * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer. * notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright * * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the * notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution. * documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSim Project nor the * * Neither the name of the OpenSim Project nor the
* names of its contributors may be used to endorse or promote products * names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission. * 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 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * 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 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
*/ */
using System;
namespace OpenSim.Grid.ScriptServer using System;
{
internal class OpenScript_Main namespace OpenSim.Grid.ScriptServer
{ {
public static ScriptServerMain SE; internal class OpenScript_Main
{
private static void Main(string[] args) public static ScriptServerMain SE;
{
AppDomain.CurrentDomain.UnhandledException += private static void Main(string[] args)
new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); {
log4net.Config.XmlConfigurator.Configure();
// Application is starting
SE = new ScriptServerMain(); AppDomain.CurrentDomain.UnhandledException +=
new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
}
// Application is starting
private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) SE = new ScriptServerMain();
{
Console.WriteLine(""); }
Console.WriteLine("APPLICATION EXCEPTION DETECTED");
Console.WriteLine(""); private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
Console.WriteLine("Application is terminating: " + e.IsTerminating.ToString()); {
Console.WriteLine("Exception:"); Console.WriteLine(String.Empty);
Console.WriteLine(e.ExceptionObject.ToString()); Console.WriteLine("APPLICATION EXCEPTION DETECTED");
} Console.WriteLine(String.Empty);
} Console.WriteLine("Application is terminating: " + e.IsTerminating.ToString());
} //Console.WriteLine("Exception:");
//Console.WriteLine(e.ExceptionObject.ToString());
}
}
}

View File

@ -1,38 +1,55 @@
/* /*
* Copyright (c) Contributors, http://opensimulator.org/ * Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders. * See CONTRIBUTORS.TXT for a full list of copyright holders.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met: * modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright * * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer. * notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright * * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the * notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution. * documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSim Project nor the * * Neither the name of the OpenSim Project nor the
* names of its contributors may be used to endorse or promote products * names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission. * 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 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * 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 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
*/ */
using OpenSim.Framework.Console;
using System;
namespace OpenSim.Grid.ScriptServer using System.Collections.Generic;
{ using System.Text;
public interface ScriptEngineInterface using OpenSim.Framework;
{ using OpenSim.Framework.Communications;
void InitializeEngine(RegionConnectionManager Region, LogBase logger); using OpenSim.Framework.Communications.Cache;
void Shutdown(); using OpenSim.Framework.Servers;
// void StartScript(string ScriptID, IScriptHost ObjectID); using OpenSim.Region.Environment;
} using OpenSim.Region.Environment.Scenes;
}
namespace OpenSim.Grid.ScriptServer
{
public class FakeScene: Scene
{
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
}
}

View File

@ -1,36 +1,64 @@
using System.Reflection; /*
using System.Runtime.InteropServices; * Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
// General Information about an assembly is controlled through the following *
// set of attributes. Change these attribute values to modify the information * Redistribution and use in source and binary forms, with or without
// associated with an assembly. * modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
[assembly : AssemblyTitle("OpenSim.Grid.ScriptServer")] * notice, this list of conditions and the following disclaimer.
[assembly : AssemblyDescription("")] * * Redistributions in binary form must reproduce the above copyright
[assembly : AssemblyConfiguration("")] * notice, this list of conditions and the following disclaimer in the
[assembly : AssemblyCompany("")] * documentation and/or other materials provided with the distribution.
[assembly : AssemblyProduct("OpenSim.Grid.ScriptServer")] * * Neither the name of the OpenSim Project nor the
[assembly : AssemblyCopyright("Copyright © 2007")] * names of its contributors may be used to endorse or promote products
[assembly : AssemblyTrademark("")] * derived from this software without specific prior written permission.
[assembly : AssemblyCulture("")] *
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
// Setting ComVisible to false makes the types in this assembly not visible * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// to COM components. If you need to access a type in this assembly from * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// COM, set the ComVisible attribute to true on that type. * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
[assembly : ComVisible(false)] * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
// The following GUID is for the ID of the typelib if this project is exposed to COM * 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
[assembly : Guid("b6861b87-5203-4040-b756-fd4774932f82")] * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
// Version information for an assembly consists of the following four values: */
//
// Major Version using System.Reflection;
// Minor Version using System.Runtime.InteropServices;
// Build Number
// Revision // General Information about an assembly is controlled through the following
// // set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly : AssemblyVersion("1.0.0.0")]
[assembly : AssemblyFileVersion("1.0.0.0")] [assembly : AssemblyTitle("OpenSim.Grid.ScriptServer")]
[assembly : AssemblyDescription("")]
[assembly : AssemblyConfiguration("")]
[assembly : AssemblyCompany("")]
[assembly : AssemblyProduct("OpenSim.Grid.ScriptServer")]
[assembly : AssemblyCopyright("Copyright © OpenSimulator.org Developers 2007-2008")]
[assembly : AssemblyTrademark("")]
[assembly : AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly : ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly : Guid("b6861b87-5203-4040-b756-fd4774932f82")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
[assembly : AssemblyVersion("1.0.0.0")]
[assembly : AssemblyFileVersion("1.0.0.0")]

View File

@ -1,27 +1,47 @@
using System; /*
using System.Collections.Generic; * Copyright (c) Contributors, http://opensimulator.org/
using System.Text; * See CONTRIBUTORS.TXT for a full list of copyright holders.
using OpenSim.Region.Environment.Interfaces; *
using OpenSim.Region.ScriptEngine.Common; * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
namespace OpenSim.Grid.ScriptServer * * Redistributions of source code must retain the above copyright
{ * notice, this list of conditions and the following disclaimer.
public class RemotingObject : MarshalByRefObject, ScriptServerInterfaces.ServerRemotingObject * * Redistributions in binary form must reproduce the above copyright
{ * notice, this list of conditions and the following disclaimer in the
// This object will be exposed over remoting. It is a singleton, so it exists only in as one instance. * documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSim Project nor the
// Expose ScriptEngine directly for now ... this is not very secure :) * names of its contributors may be used to endorse or promote products
// NOTE! CURRENTLY JUST HARDWIRED DOTNETENGINE! * derived from this software without specific prior written permission.
//private OpenSim.Region.ScriptEngine.DotNetEngine.ScriptEngine SE = *
// new OpenSim.Region.ScriptEngine.DotNetEngine.ScriptEngine(); * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
//public OpenSim.Region.ScriptEngine.Common.ScriptServerInterfaces.RemoteEvents Events = * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// (OpenSim.Region.ScriptEngine.Common.ScriptServerInterfaces.RemoteEvents)SE.m_EventManager; * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
//private ScriptServerInterfaces.RemoteEvents _events = new abc; * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
ScriptServerInterfaces.RemoteEvents ScriptServerInterfaces.ServerRemotingObject.Events() * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
{ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
return null; * (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;
using OpenSim.Region.ScriptEngine.Common;
namespace OpenSim.Grid.ScriptServer
{
public class RemotingObject : MarshalByRefObject, ScriptServerInterfaces.ServerRemotingObject
{
// This object will be exposed over remoting. It is a singleton, so it exists only in as one instance.
ScriptServerInterfaces.RemoteEvents ScriptServerInterfaces.ServerRemotingObject.Events()
{
return ScriptServerMain.Engine.EventManager();
}
}
}

View File

@ -1,28 +1,57 @@
using System; /*
using System.Collections.Generic; * Copyright (c) Contributors, http://opensimulator.org/
using System.Text; * See CONTRIBUTORS.TXT for a full list of copyright holders.
using System.Runtime.Remoting; *
using System.Runtime.Remoting.Channels; * Redistribution and use in source and binary forms, with or without
using System.Runtime.Remoting.Channels.Tcp; * 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.
namespace OpenSim.Grid.ScriptServer * * Redistributions in binary form must reproduce the above copyright
{ * notice, this list of conditions and the following disclaimer in the
class RemotingServer * 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
public void CreateServer(int port, string instanceName) * derived from this software without specific prior written permission.
{ *
// Create an instance of a channel * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
TcpChannel channel = new TcpChannel(port); * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
ChannelServices.RegisterChannel(channel, true); * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
// Register as an available service with the name HelloWorld * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
RemotingConfiguration.RegisterWellKnownServiceType( * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
typeof(RemotingObject), * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
instanceName, * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
WellKnownObjectMode.Singleton); * (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
{
TcpChannel channel;
public RemotingServer(int port, string instanceName)
{
// Create an instance of a channel
channel = new TcpChannel(port);
ChannelServices.RegisterChannel(channel, true);
// Register as an available service with the name HelloWorld
RemotingConfiguration.RegisterWellKnownServiceType(
typeof(RemotingObject),
instanceName,
WellKnownObjectMode.Singleton);
}
}
}

View File

@ -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>

View File

@ -1,244 +1,244 @@
/* /*
* Copyright (c) Contributors, http://opensimulator.org/ * Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders. * See CONTRIBUTORS.TXT for a full list of copyright holders.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met: * modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright * * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer. * notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright * * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the * notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution. * documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSim Project nor the * * Neither the name of the OpenSim Project nor the
* names of its contributors may be used to endorse or promote products * names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission. * 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 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * 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 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
*/ */
namespace OpenSim.Grid.ScriptServer namespace OpenSim.Grid.ScriptServer
{ {
public abstract class RegionBase public abstract class RegionBase
{ {
// These are events that the region needs to have // These are events that the region needs to have
// TEMP: Using System.Delegate -- needs replacing with a real delegate // TEMP: Using System.Delegate -- needs replacing with a real delegate
public delegate void DefaultDelegate(); public delegate void DefaultDelegate();
public event DefaultDelegate onScriptRez; public event DefaultDelegate onScriptRez;
public event DefaultDelegate onstate_entry; public event DefaultDelegate onstate_entry;
public event DefaultDelegate onstate_exit; public event DefaultDelegate onstate_exit;
public event DefaultDelegate ontouch_start; public event DefaultDelegate ontouch_start;
public event DefaultDelegate ontouch; public event DefaultDelegate ontouch;
public event DefaultDelegate ontouch_end; public event DefaultDelegate ontouch_end;
public event DefaultDelegate oncollision_start; public event DefaultDelegate oncollision_start;
public event DefaultDelegate oncollision; public event DefaultDelegate oncollision;
public event DefaultDelegate oncollision_end; public event DefaultDelegate oncollision_end;
public event DefaultDelegate onland_collision_start; public event DefaultDelegate onland_collision_start;
public event DefaultDelegate onland_collision; public event DefaultDelegate onland_collision;
public event DefaultDelegate onland_collision_end; public event DefaultDelegate onland_collision_end;
public event DefaultDelegate ontimer; public event DefaultDelegate ontimer;
public event DefaultDelegate onlisten; public event DefaultDelegate onlisten;
public event DefaultDelegate onon_rez; public event DefaultDelegate onon_rez;
public event DefaultDelegate onsensor; public event DefaultDelegate onsensor;
public event DefaultDelegate onno_sensor; public event DefaultDelegate onno_sensor;
public event DefaultDelegate oncontrol; public event DefaultDelegate oncontrol;
public event DefaultDelegate onmoney; public event DefaultDelegate onmoney;
public event DefaultDelegate onemail; public event DefaultDelegate onemail;
public event DefaultDelegate onat_target; public event DefaultDelegate onat_target;
public event DefaultDelegate onnot_at_target; public event DefaultDelegate onnot_at_target;
public event DefaultDelegate onat_rot_target; public event DefaultDelegate onat_rot_target;
public event DefaultDelegate onnot_at_rot_target; public event DefaultDelegate onnot_at_rot_target;
public event DefaultDelegate onrun_time_permissions; public event DefaultDelegate onrun_time_permissions;
public event DefaultDelegate onchanged; public event DefaultDelegate onchanged;
public event DefaultDelegate onattach; public event DefaultDelegate onattach;
public event DefaultDelegate ondataserver; public event DefaultDelegate ondataserver;
public event DefaultDelegate onlink_message; public event DefaultDelegate onlink_message;
public event DefaultDelegate onmoving_start; public event DefaultDelegate onmoving_start;
public event DefaultDelegate onmoving_end; public event DefaultDelegate onmoving_end;
public event DefaultDelegate onobject_rez; public event DefaultDelegate onobject_rez;
public event DefaultDelegate onremote_data; public event DefaultDelegate onremote_data;
public event DefaultDelegate onhttp_response; public event DefaultDelegate onhttp_response;
public void ScriptRez() public void ScriptRez()
{ {
onScriptRez(); onScriptRez();
} }
public void state_entry() public void state_entry()
{ {
onstate_entry(); onstate_entry();
} }
public void state_exit() public void state_exit()
{ {
onstate_exit(); onstate_exit();
} }
public void touch_start() public void touch_start()
{ {
ontouch_start(); ontouch_start();
} }
public void touch() public void touch()
{ {
ontouch(); ontouch();
} }
public void touch_end() public void touch_end()
{ {
ontouch_end(); ontouch_end();
} }
public void collision_start() public void collision_start()
{ {
oncollision_start(); oncollision_start();
} }
public void collision() public void collision()
{ {
oncollision(); oncollision();
} }
public void collision_end() public void collision_end()
{ {
oncollision_end(); oncollision_end();
} }
public void land_collision_start() public void land_collision_start()
{ {
onland_collision_start(); onland_collision_start();
} }
public void land_collision() public void land_collision()
{ {
onland_collision(); onland_collision();
} }
public void land_collision_end() public void land_collision_end()
{ {
onland_collision_end(); onland_collision_end();
} }
public void timer() public void timer()
{ {
ontimer(); ontimer();
} }
public void listen() public void listen()
{ {
onlisten(); onlisten();
} }
public void on_rez() public void on_rez()
{ {
onon_rez(); onon_rez();
} }
public void sensor() public void sensor()
{ {
onsensor(); onsensor();
} }
public void no_sensor() public void no_sensor()
{ {
onno_sensor(); onno_sensor();
} }
public void control() public void control()
{ {
oncontrol(); oncontrol();
} }
public void money() public void money()
{ {
onmoney(); onmoney();
} }
public void email() public void email()
{ {
onemail(); onemail();
} }
public void at_target() public void at_target()
{ {
onat_target(); onat_target();
} }
public void not_at_target() public void not_at_target()
{ {
onnot_at_target(); onnot_at_target();
} }
public void at_rot_target() public void at_rot_target()
{ {
onat_rot_target(); onat_rot_target();
} }
public void not_at_rot_target() public void not_at_rot_target()
{ {
onnot_at_rot_target(); onnot_at_rot_target();
} }
public void run_time_permissions() public void run_time_permissions()
{ {
onrun_time_permissions(); onrun_time_permissions();
} }
public void changed() public void changed()
{ {
onchanged(); onchanged();
} }
public void attach() public void attach()
{ {
onattach(); onattach();
} }
public void dataserver() public void dataserver()
{ {
ondataserver(); ondataserver();
} }
public void link_message() public void link_message()
{ {
onlink_message(); onlink_message();
} }
public void moving_start() public void moving_start()
{ {
onmoving_start(); onmoving_start();
} }
public void moving_end() public void moving_end()
{ {
onmoving_end(); onmoving_end();
} }
public void object_rez() public void object_rez()
{ {
onobject_rez(); onobject_rez();
} }
public void remote_data() public void remote_data()
{ {
onremote_data(); onremote_data();
} }
public void http_response() public void http_response()
{ {
onhttp_response(); onhttp_response();
} }
} }
} }

View File

@ -1,59 +1,57 @@
/* /*
* Copyright (c) Contributors, http://opensimulator.org/ * Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders. * See CONTRIBUTORS.TXT for a full list of copyright holders.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met: * modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright * * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer. * notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright * * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the * notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution. * documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSim Project nor the * * Neither the name of the OpenSim Project nor the
* names of its contributors may be used to endorse or promote products * names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission. * 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 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * 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 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
*/ */
using OpenSim.Framework.Console; using OpenSim.Framework.Console;
namespace OpenSim.Grid.ScriptServer namespace OpenSim.Grid.ScriptServer
{ {
// Maintains connection and communication to a region // Maintains connection and communication to a region
public class RegionConnectionManager : RegionBase public class RegionConnectionManager : RegionBase
{ {
private LogBase m_log; private ScriptServerMain m_ScriptServerMain;
private ScriptServerMain m_ScriptServerMain; private object m_Connection;
private object m_Connection;
public RegionConnectionManager(ScriptServerMain scm, object Connection)
public RegionConnectionManager(ScriptServerMain scm, LogBase logger, object Connection) {
{ m_ScriptServerMain = scm;
m_ScriptServerMain = scm; m_Connection = Connection;
m_log = logger; }
m_Connection = Connection;
} private void DataReceived(object objectID, object scriptID)
{
private void DataReceived(object objectID, object scriptID) // TODO: HOW DO WE RECEIVE DATA? ASYNC?
{ // ANYHOW WE END UP HERE?
// TODO: HOW DO WE RECEIVE DATA? ASYNC?
// ANYHOW WE END UP HERE? // NEW SCRIPT? ASK SCRIPTENGINE TO INITIALIZE IT
ScriptRez();
// NEW SCRIPT? ASK SCRIPTENGINE TO INITIALIZE IT
ScriptRez(); // EVENT? DELIVER EVENT DIRECTLY TO SCRIPTENGINE
touch_start();
// EVENT? DELIVER EVENT DIRECTLY TO SCRIPTENGINE }
touch_start(); }
} }
}
}

View File

@ -1,104 +1,102 @@
/* /*
* Copyright (c) Contributors, http://opensimulator.org/ * Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders. * See CONTRIBUTORS.TXT for a full list of copyright holders.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met: * modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright * * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer. * notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright * * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the * notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution. * documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSim Project nor the * * Neither the name of the OpenSim Project nor the
* names of its contributors may be used to endorse or promote products * names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission. * 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 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * 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 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
*/ */
using System.Collections.Generic; using System.Collections.Generic;
using System.Threading; using System.Threading;
using OpenSim.Framework.Console; using OpenSim.Framework.Console;
namespace OpenSim.Grid.ScriptServer namespace OpenSim.Grid.ScriptServer
{ {
// Waiting for incoming script requests from region // Waiting for incoming script requests from region
internal class RegionCommManager internal class RegionCommManager
{ {
private Thread listenThread; private Thread listenThread;
private List<RegionConnectionManager> Regions = new List<RegionConnectionManager>(); private List<RegionConnectionManager> Regions = new List<RegionConnectionManager>();
private LogBase m_log; private ScriptServerMain m_ScriptServerMain;
private ScriptServerMain m_ScriptServerMain;
public RegionCommManager(ScriptServerMain scm)
public RegionCommManager(ScriptServerMain scm, LogBase logger) {
{ m_ScriptServerMain = scm;
m_ScriptServerMain = scm; }
m_log = logger;
} ~RegionCommManager()
{
~RegionCommManager() Stop();
{ }
Stop();
} /// <summary>
/// Starts listening for region requests
/// <summary> /// </summary>
/// Starts listening for region requests public void Start()
/// </summary> {
public void Start() // Start listener
{ Stop();
// Start listener listenThread = new Thread(ListenThreadLoop);
Stop(); listenThread.Name = "ListenThread";
listenThread = new Thread(ListenThreadLoop); listenThread.IsBackground = true;
listenThread.Name = "listenThread"; listenThread.Start();
listenThread.IsBackground = true; OpenSim.Framework.ThreadTracker.Add(listenThread);
listenThread.Start(); }
}
/// <summary>
/// <summary> /// Stops listening for region requests
/// Stops listening for region requests /// </summary>
/// </summary> public void Stop()
public void Stop() {
{ // Stop listener, clean up
// Stop listener, clean up if (listenThread != null)
if (listenThread != null) {
{ try
try {
{ if (listenThread.IsAlive)
if (listenThread.IsAlive) listenThread.Abort();
listenThread.Abort(); listenThread.Join(1000); // Wait 1 second for thread to shut down
listenThread.Join(1000); // Wait 1 second for thread to shut down }
} catch
catch {
{ }
} listenThread = null;
listenThread = null; }
} }
}
private void ListenThreadLoop()
private void ListenThreadLoop() {
{ // * Listen for requests from regions
// * Listen for requests from regions // * When a request is received:
// * When a request is received: // - Authenticate region
// - Authenticate region // - Authenticate user
// - Authenticate user // - Have correct scriptengine load script
// - Have correct scriptengine load script // ~ ask scriptengines if they will accept script?
// ~ ask scriptengines if they will accept script? // - Add script to shared communication channel towards that region
// - Add script to shared communication channel towards that region
// TODO: FAKING A CONNECTION
Regions.Add(new RegionConnectionManager(m_ScriptServerMain, null));
// TODO: FAKING A CONNECTION }
Regions.Add(new RegionConnectionManager(m_ScriptServerMain, m_log, null)); }
} }
}
}

View File

@ -1,124 +1,117 @@
/* /*
* Copyright (c) Contributors, http://opensimulator.org/ * Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders. * See CONTRIBUTORS.TXT for a full list of copyright holders.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met: * modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright * * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer. * notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright * * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the * notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution. * documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSim Project nor the * * Neither the name of the OpenSim Project nor the
* names of its contributors may be used to endorse or promote products * names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission. * 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 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * 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 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
*/ */
using System; using System;
using System.IO; using System.IO;
using System.Reflection; using System.Reflection;
using OpenSim.Framework.Console; using OpenSim.Framework.Console;
using OpenSim.Region.ScriptEngine.Common;
namespace OpenSim.Grid.ScriptServer
{ namespace OpenSim.Grid.ScriptServer.ScriptServer
internal class ScriptEngineLoader {
{ 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; ScriptServerInterfaces.ScriptEngine ret = null;
} try
{
public ScriptEngineInterface LoadScriptEngine(string EngineName) ret =
{ LoadAndInitAssembly(
ScriptEngineInterface ret = null; Path.Combine("ScriptEngines", "OpenSim.Region.ScriptEngine." + EngineName + ".dll"),
try "OpenSim.Region.ScriptEngine." + EngineName + ".ScriptEngine");
{ }
ret = catch (Exception e)
LoadAndInitAssembly( {
Path.Combine("ScriptEngines", "OpenSim.Region.ScriptEngine." + EngineName + ".dll"), m_log.Error("[ScriptEngine]: " +
"OpenSim.Region.ScriptEngine." + EngineName + ".ScriptEngine"); "Error loading assembly \"" + EngineName + "\": " + e.Message + ", " +
} e.StackTrace.ToString());
catch (Exception e) }
{ return ret;
m_log.Error("ScriptEngine", }
"Error loading assembly \"" + EngineName + "\": " + e.Message + ", " +
e.StackTrace.ToString()); /// <summary>
} /// Does actual loading and initialization of script Assembly
return ret; /// </summary>
} /// <returns></returns>
private ScriptServerInterfaces.ScriptEngine LoadAndInitAssembly(string FileName, string NameSpace)
/// <summary> {
/// Does actual loading and initialization of script Assembly //Common.SendToDebug("Loading ScriptEngine Assembly " + FileName);
/// </summary> // Load .Net Assembly (.dll)
/// <param name="FreeAppDomain">AppDomain to load script into</param> // Initialize and return it
/// <param name="FileName">FileName of script assembly (.dll)</param>
/// <returns></returns> // TODO: Add error handling
private ScriptEngineInterface LoadAndInitAssembly(string FileName, string NameSpace)
{ Assembly a;
//Common.SendToDebug("Loading ScriptEngine Assembly " + FileName); //try
// Load .Net Assembly (.dll) //{
// Initialize and return it
// TODO: Add error handling // Load to default appdomain (temporary)
a = Assembly.LoadFrom(FileName);
Assembly a; // Load to specified appdomain
//try // TODO: Insert security
//{ //a = FreeAppDomain.Load(FileName);
//}
//catch (Exception e)
// Load to default appdomain (temporary) //{
a = Assembly.LoadFrom(FileName); // m_log.Error("[ScriptEngine]: Error loading assembly \String.Empty + FileName + "\": " + e.ToString());
// Load to specified appdomain //}
// TODO: Insert security
//a = FreeAppDomain.Load(FileName);
//} //Console.WriteLine("Loading: " + FileName);
//catch (Exception e) //foreach (Type _t in a.GetTypes())
//{ //{
// m_log.Error("ScriptEngine", "Error loading assembly \"" + FileName + "\": " + e.ToString()); // Console.WriteLine("Type: " + _t.ToString());
//} //}
Type t;
//Console.WriteLine("Loading: " + FileName); //try
//foreach (Type _t in a.GetTypes()) //{
//{ t = a.GetType(NameSpace, true);
// Console.WriteLine("Type: " + _t.ToString()); //}
//} //catch (Exception e)
//{
Type t; // m_log.Error("[ScriptEngine]: Error initializing type \String.Empty + NameSpace + "\" from \String.Empty + FileName + "\": " + e.ToString());
//try //}
//{
t = a.GetType(NameSpace, true); ScriptServerInterfaces.ScriptEngine ret;
//} //try
//catch (Exception e) //{
//{ ret = (ScriptServerInterfaces.ScriptEngine)Activator.CreateInstance(t);
// m_log.Error("ScriptEngine", "Error initializing type \"" + NameSpace + "\" from \"" + FileName + "\": " + e.ToString()); //}
//} //catch (Exception e)
//{
ScriptEngineInterface ret; // m_log.Error("[ScriptEngine]: Error initializing type \String.Empty + NameSpace + "\" from \String.Empty + FileName + "\": " + e.ToString());
//try //}
//{
ret = (ScriptEngineInterface) Activator.CreateInstance(t); return ret;
//} }
//catch (Exception e) }
//{
// m_log.Error("ScriptEngine", "Error initializing type \"" + NameSpace + "\" from \"" + FileName + "\": " + e.ToString());
//}
return ret;
}
}
} }

View File

@ -1,66 +1,63 @@
/* /*
* Copyright (c) Contributors, http://opensimulator.org/ * Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders. * See CONTRIBUTORS.TXT for a full list of copyright holders.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met: * modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright * * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer. * notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright * * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the * notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution. * documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSim Project nor the * * Neither the name of the OpenSim Project nor the
* names of its contributors may be used to endorse or promote products * names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission. * 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 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * 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 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
*/ */
using System.Collections.Generic; using System.Collections.Generic;
using OpenSim.Framework.Console; using OpenSim.Framework.Console;
using OpenSim.Region.ScriptEngine.Common;
namespace OpenSim.Grid.ScriptServer
{ namespace OpenSim.Grid.ScriptServer.ScriptServer
internal class ScriptEngineManager {
{ internal class ScriptEngineManager
private LogBase m_log; {
private ScriptEngineLoader ScriptEngineLoader; private ScriptEngineLoader ScriptEngineLoader;
private List<ScriptEngineInterface> scriptEngines = new List<ScriptEngineInterface>(); private List<ScriptServerInterfaces.ScriptEngine> scriptEngines = new List<ScriptServerInterfaces.ScriptEngine>();
private ScriptServerMain m_ScriptServerMain; private ScriptServerMain m_ScriptServerMain;
// Initialize // Initialize
public ScriptEngineManager(ScriptServerMain scm, LogBase logger) public ScriptEngineManager(ScriptServerMain scm)
{ {
m_ScriptServerMain = scm; m_ScriptServerMain = scm;
m_log = logger; ScriptEngineLoader = new ScriptEngineLoader();
ScriptEngineLoader = new ScriptEngineLoader(m_log); }
// Temp - we should not load during initialize... Loading should be done later. ~ScriptEngineManager()
LoadEngine("DotNetScriptEngine"); {
} }
~ScriptEngineManager() public ScriptServerInterfaces.ScriptEngine LoadEngine(string engineName)
{ {
} // Load and add to list of ScriptEngines
ScriptServerInterfaces.ScriptEngine sei = ScriptEngineLoader.LoadScriptEngine(engineName);
public void LoadEngine(string engineName) if (sei != null)
{ {
// Load and add to list of ScriptEngines scriptEngines.Add(sei);
ScriptEngineInterface sei = ScriptEngineLoader.LoadScriptEngine(engineName); }
if (sei != null) return sei;
{ }
scriptEngines.Add(sei); }
} }
}
}
}

View File

@ -1,82 +1,110 @@
/* /*
* Copyright (c) Contributors, http://opensimulator.org/ * Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders. * See CONTRIBUTORS.TXT for a full list of copyright holders.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met: * modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright * * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer. * notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright * * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the * notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution. * documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSim Project nor the * * Neither the name of the OpenSim Project nor the
* names of its contributors may be used to endorse or promote products * names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission. * 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 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * 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 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
*/ */
using System.IO; using System.IO;
using OpenSim.Framework; using libsecondlife;
using OpenSim.Framework.Console; using Nini.Config;
using OpenSim.Framework;
namespace OpenSim.Grid.ScriptServer using OpenSim.Framework.Console;
{ using OpenSim.Framework.Servers;
public class ScriptServerMain : conscmd_callback using OpenSim.Grid.ScriptServer.ScriptServer;
{ using OpenSim.Region.ScriptEngine.Common;
// using OpenSim.Region.ScriptEngine.Common.TRPC;
// Root object. Creates objects used.
// namespace OpenSim.Grid.ScriptServer
private int listenPort = 1234; {
private readonly string m_logFilename = ("region-console.log"); public class ScriptServerMain : BaseOpenSimServer, conscmd_callback
private LogBase m_log; {
private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
// Objects we use
internal RegionCommManager RegionScriptDaemon; // Listen for incoming from region //
//internal ScriptEngineManager ScriptEngines; // Loads scriptengines // Root object. Creates objects used.
internal RemotingServer m_RemotingServer; //
private int listenPort = 8010;
public ScriptServerMain()
{ // TEMP
m_log = CreateLog(); public static ScriptServerInterfaces.ScriptEngine Engine;
//public static FakeScene m_Scene = new FakeScene(null,null,null,null,null,null,null,null,null,false, false, false);
RegionScriptDaemon = new RegionCommManager(this, m_log);
//ScriptEngines = new ScriptEngineManager(this, m_log); // Objects we use
m_RemotingServer = new RemotingServer(); internal RegionCommManager RegionScriptDaemon; // Listen for incoming from region
m_RemotingServer.CreateServer(listenPort, "DotNetEngine"); internal ScriptEngineManager ScriptEngines; // Loads scriptengines
System.Console.ReadLine(); //internal RemotingServer m_RemotingServer;
} internal TCPServer m_TCPServer;
internal TRPC_Remote RPC;
~ScriptServerMain()
{ public ScriptServerMain()
} {
m_console = CreateConsole();
protected LogBase CreateLog()
{ // Set up script engine mananger
if (!Directory.Exists(Util.logDir())) ScriptEngines = new ScriptEngineManager(this);
{
Directory.CreateDirectory(Util.logDir()); // Load DotNetEngine
} Engine = ScriptEngines.LoadEngine("DotNetEngine");
IConfigSource config = null;
return new LogBase((Path.Combine(Util.logDir(), m_logFilename)), "Region", this, true); Engine.InitializeEngine(null, null, false, Engine.GetScriptManager());
}
public void RunCmd(string command, string[] cmdparams) // Set up server
{ //m_RemotingServer = new RemotingServer(listenPort, "DotNetEngine");
} m_TCPServer = new TCPServer(listenPort);
RPC = new TRPC_Remote(m_TCPServer);
public void Show(string ShowWhat) RPC.ReceiveCommand += new TRPC_Remote.ReceiveCommandDelegate(RPC_ReceiveCommand);
{ m_TCPServer.StartListen();
}
} 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 ConsoleBase CreateConsole()
{
return new ConsoleBase("ScriptServer", this);
}
}
}