Added forgotten ApplicationPlugins directory and moved the load region code out to a plugin.

To make opensim search for the new plugin, you will need to delete the "addin-db-000" and "addins" sub directories in bin if you have them.
afrisby
MW 2007-11-04 22:16:13 +00:00
parent 9f4ae7230f
commit 1467720f60
4 changed files with 121 additions and 45 deletions

View File

@ -0,0 +1,58 @@
using System;
using System.Collections.Generic;
using System.Text;
using OpenSim;
using OpenSim.Framework.Console;
using OpenSim.Framework;
using OpenSim.Framework.RegionLoader.Filesystem;
using OpenSim.Framework.RegionLoader.Web;
using Mono.Addins;
using Mono.Addins.Description;
using Nini;
using Nini.Config;
[assembly:Addin]
[assembly:AddinDependency ("OpenSim", "0.4")]
namespace OpenSim.ApplicationPlugins.Example
{
[Extension("/OpenSim/Startup")]
public class LoadRegionsPlugin : IApplicationPlugin
{
public void Initialise(OpenSimMain openSim)
{
System.Console.WriteLine("Load Regions addin being initialised");
IRegionLoader regionLoader;
if (openSim.ConfigSource.Configs["Startup"].GetString("region_info_source", "filesystem") == "filesystem")
{
MainLog.Instance.Notice("Loading Region Info from filesystem");
regionLoader = new RegionLoaderFileSystem();
}
else
{
MainLog.Instance.Notice("Loading Region Info from web");
regionLoader = new RegionLoaderWebServer();
}
regionLoader.SetIniConfigSource(openSim.ConfigSource);
RegionInfo[] regionsToLoad = regionLoader.LoadRegions();
openSim.ModuleLoader.LoadDefaultSharedModules();
for (int i = 0; i < regionsToLoad.Length; i++)
{
MainLog.Instance.Debug("Creating Region: " + regionsToLoad[i].RegionName);
openSim.CreateRegion(regionsToLoad[i]);
}
openSim.ModuleLoader.PostInitialise();
openSim.ModuleLoader.ClearCache();
}
public void Close()
{
}
}
}

View File

@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 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: AssemblyTitle("OpenSim.Addin")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("OpenSim.Addin")]
[assembly: AssemblyCopyright("Copyright © 2007")]
[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("45b979d9-d8d4-42fd-9780-fe9ac7e86cb4")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@ -35,8 +35,6 @@ using OpenSim.Framework;
using OpenSim.Framework.Communications.Cache;
using OpenSim.Framework.Console;
using OpenSim.Framework.Servers;
using OpenSim.Framework.RegionLoader.Filesystem;
using OpenSim.Framework.RegionLoader.Web;
using OpenSim.Region.ClientStack;
using OpenSim.Region.Communications.Local;
using OpenSim.Region.Communications.OGS1;
@ -63,9 +61,7 @@ namespace OpenSim
private OpenSimController m_controller;
protected ModuleLoader m_moduleLoader;
protected LocalLoginService m_loginService;
private IniConfigSource m_config;
protected string m_storageDLL = "OpenSim.DataStore.NullStorage.dll";
@ -90,6 +86,24 @@ namespace OpenSim
public ConsoleCommand CreateAccount = null;
private bool m_dumpAssetsToFile;
private List<IApplicationPlugin> m_plugins = new List<IApplicationPlugin>();
private IniConfigSource m_config;
public IniConfigSource ConfigSource
{
get { return m_config; }
set { m_config = value; }
}
private ModuleLoader m_moduleLoader;
public ModuleLoader ModuleLoader
{
get { return m_moduleLoader; }
set { m_moduleLoader = value; }
}
public OpenSimMain(IConfigSource configSource)
: base()
{
@ -278,44 +292,16 @@ namespace OpenSim
m_httpServer.AddStreamHandler(new SimStatusHandler());
}
m_moduleLoader = new ModuleLoader(m_log, m_config);
MainLog.Instance.Verbose("Plugins", "Loading OpenSim application plugins");
foreach (TypeExtensionNode node in AddinManager.GetExtensionNodes("/OpenSim/Startup"))
{
IApplicationPlugin plugin = (IApplicationPlugin)node.CreateInstance();
plugin.Initialise(this);
m_plugins.Add(plugin);
}
IRegionLoader regionLoader;
if (m_config.Configs["Startup"].GetString("region_info_source", "filesystem") == "filesystem")
{
MainLog.Instance.Notice("Loading Region Info from filesystem");
regionLoader = new RegionLoaderFileSystem();
}
else
{
MainLog.Instance.Notice("Loading Region Info from web");
regionLoader = new RegionLoaderWebServer();
}
regionLoader.SetIniConfigSource(m_config);
RegionInfo[] regionsToLoad = regionLoader.LoadRegions();
m_moduleLoader = new ModuleLoader(m_log, m_config);
MainLog.Instance.Verbose("Loading Shared Modules");
m_moduleLoader.LoadDefaultSharedModules();
// Load all script engines found (scripting engine is now a IRegionModule so loaded in the module loader
// OpenSim.Region.Environment.Scenes.Scripting.ScriptEngineLoader ScriptEngineLoader = new OpenSim.Region.Environment.Scenes.Scripting.ScriptEngineLoader(m_log);
for (int i = 0; i < regionsToLoad.Length; i++)
{
MainLog.Instance.Debug("Creating Region: " + regionsToLoad[i].RegionName);
CreateRegion(regionsToLoad[i]);
}
m_moduleLoader.PostInitialise();
m_moduleLoader.ClearCache();
// Start UDP servers
for (int i = 0; i < m_udpServers.Count; i++)
{
@ -349,13 +335,6 @@ namespace OpenSim
scene.SetModuleInterfaces();
// Check if we have a script engine to load
//if (m_scriptEngine != null && m_scriptEngine != "")
//{
// OpenSim.Region.Environment.Scenes.Scripting.ScriptEngineInterface ScriptEngine = ScriptEngineLoader.LoadScriptEngine(m_scriptEngine);
// scene.AddScriptEngine(ScriptEngine, m_log);
//}
//Server side object editing permissions checking
scene.PermissionsMngr.BypassPermissions = !m_permissions;

View File

@ -675,8 +675,6 @@
<Reference name="OpenSim.Framework.Console"/>
<Reference name="OpenSim.Region.Physics.Manager"/>
<Reference name="OpenSim.Framework.Servers"/>
<Reference name="OpenSim.Framework.RegionLoader.Filesystem"/>
<Reference name="OpenSim.Framework.RegionLoader.Web"/>
<Reference name="OpenSim.Region.Environment"/>
<Reference name="OpenSim.Region.ClientStack"/>
<Reference name="OpenSim.Framework.Communications"/>
@ -689,7 +687,7 @@
</Files>
</Project>
<Project name="OpenSim.ApplicationPlugins.Example" path="OpenSim/ApplicationPlugins/Example" type="Library">
<Project name="OpenSim.ApplicationPlugins.LoadRegions" path="OpenSim/ApplicationPlugins/LoadRegions" type="Library">
<Configuration name="Debug">
<Options>
<OutputPath>../../../bin/</OutputPath>
@ -706,9 +704,14 @@
<Reference name="System"/>
<Reference name="System.Xml"/>
<Reference name="libsecondlife.dll" />
<Reference name="Nini.dll" />
<Reference name="OpenSim"/>
<Reference name="OpenSim.Region.ClientStack"/>
<Reference name="OpenSim.Region.Environment"/>
<Reference name="OpenSim.Framework"/>
<Reference name="OpenSim.Framework.Console"/>
<Reference name="OpenSim.Framework.RegionLoader.Filesystem"/>
<Reference name="OpenSim.Framework.RegionLoader.Web"/>
<Files>
<Match pattern="*.cs" recurse="true"/>
</Files>