*Moved region loading into its own interface IRegionLoader
*Added ability to load regioninfo remotely from a webserver from a single file. See share/RegionLoading/HOWTO_REMOTE_REGION_LOADING.txt for more info and an example file.afrisby
parent
91c2c3c096
commit
51488ee7f4
|
@ -27,49 +27,57 @@
|
|||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Net;
|
||||
using System.Reflection;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Net;
|
||||
using System.Xml;
|
||||
|
||||
using libsecondlife;
|
||||
|
||||
using OpenSim.Framework.Console;
|
||||
using OpenSim.Framework;
|
||||
using System.Globalization;
|
||||
|
||||
namespace OpenSim.Framework
|
||||
{
|
||||
public class ConfigurationMember
|
||||
{
|
||||
public delegate bool ConfigurationOptionResult(string configuration_key, object configuration_result);
|
||||
|
||||
public delegate void ConfigurationOptionsLoad();
|
||||
|
||||
private List<ConfigurationOption> configurationOptions = new List<ConfigurationOption>();
|
||||
private string configurationFilename = "";
|
||||
private string configurationDescription = "";
|
||||
|
||||
private XmlNode configurationFromXMLNode = null;
|
||||
private ConfigurationOptionsLoad loadFunction;
|
||||
private ConfigurationOptionResult resultFunction;
|
||||
|
||||
private IGenericConfig configurationPlugin = null;
|
||||
|
||||
/// <summary>
|
||||
/// This is the default configuration DLL loaded
|
||||
/// </summary>
|
||||
private string configurationPluginFilename = "OpenSim.Framework.Configuration.XML.dll";
|
||||
|
||||
public ConfigurationMember(string configuration_filename, string configuration_description,
|
||||
ConfigurationOptionsLoad load_function, ConfigurationOptionResult result_function)
|
||||
public ConfigurationMember(string configuration_filename, string configuration_description, ConfigurationOptionsLoad load_function, ConfigurationOptionResult result_function)
|
||||
{
|
||||
configurationFilename = configuration_filename;
|
||||
configurationDescription = configuration_description;
|
||||
loadFunction = load_function;
|
||||
resultFunction = result_function;
|
||||
this.configurationFilename = configuration_filename;
|
||||
this.configurationDescription = configuration_description;
|
||||
this.loadFunction = load_function;
|
||||
this.resultFunction = result_function;
|
||||
}
|
||||
public ConfigurationMember(XmlNode configuration_xml, string configuration_description, ConfigurationOptionsLoad load_function, ConfigurationOptionResult result_function)
|
||||
{
|
||||
this.configurationFilename = "";
|
||||
this.configurationFromXMLNode = configuration_xml;
|
||||
this.configurationDescription = configuration_description;
|
||||
this.loadFunction = load_function;
|
||||
this.resultFunction = result_function;
|
||||
}
|
||||
|
||||
public void setConfigurationFilename(string filename)
|
||||
{
|
||||
configurationFilename = filename;
|
||||
}
|
||||
|
||||
public void setConfigurationDescription(string desc)
|
||||
{
|
||||
configurationDescription = desc;
|
||||
|
@ -84,11 +92,7 @@ namespace OpenSim.Framework
|
|||
{
|
||||
configurationPluginFilename = dll_filename;
|
||||
}
|
||||
|
||||
public void addConfigurationOption(string configuration_key,
|
||||
ConfigurationOption.ConfigurationTypes configuration_type,
|
||||
string configuration_question, string configuration_default,
|
||||
bool use_default_no_prompt)
|
||||
public void addConfigurationOption(string configuration_key, ConfigurationOption.ConfigurationTypes configuration_type, string configuration_question, string configuration_default, bool use_default_no_prompt)
|
||||
{
|
||||
ConfigurationOption configOption = new ConfigurationOption();
|
||||
configOption.configurationKey = configuration_key;
|
||||
|
@ -97,8 +101,7 @@ namespace OpenSim.Framework
|
|||
configOption.configurationType = configuration_type;
|
||||
configOption.configurationUseDefaultNoPrompt = use_default_no_prompt;
|
||||
|
||||
if ((configuration_key != "" && configuration_question != "") ||
|
||||
(configuration_key != "" && use_default_no_prompt))
|
||||
if ((configuration_key != "" && configuration_question != "") || (configuration_key != "" && use_default_no_prompt))
|
||||
{
|
||||
if (!configurationOptions.Contains(configOption))
|
||||
{
|
||||
|
@ -107,37 +110,32 @@ namespace OpenSim.Framework
|
|||
}
|
||||
else
|
||||
{
|
||||
MainLog.Instance.Notice(
|
||||
"Required fields for adding a configuration option is invalid. Will not add this option (" +
|
||||
configuration_key + ")");
|
||||
MainLog.Instance.Notice("Required fields for adding a configuration option is invalid. Will not add this option (" + configuration_key + ")");
|
||||
}
|
||||
}
|
||||
|
||||
public void performConfigurationRetrieve()
|
||||
{
|
||||
configurationPlugin = LoadConfigDll(configurationPluginFilename);
|
||||
configurationPlugin = this.LoadConfigDll(configurationPluginFilename);
|
||||
configurationOptions.Clear();
|
||||
if(loadFunction == null)
|
||||
{
|
||||
MainLog.Instance.Error("Load Function for '" + configurationDescription +
|
||||
"' is null. Refusing to run configuration.");
|
||||
MainLog.Instance.Error("Load Function for '" + this.configurationDescription + "' is null. Refusing to run configuration.");
|
||||
return;
|
||||
}
|
||||
|
||||
if(resultFunction == null)
|
||||
{
|
||||
MainLog.Instance.Error("Result Function for '" + configurationDescription +
|
||||
"' is null. Refusing to run configuration.");
|
||||
MainLog.Instance.Error("Result Function for '" + this.configurationDescription + "' is null. Refusing to run configuration.");
|
||||
return;
|
||||
}
|
||||
|
||||
MainLog.Instance.Verbose("Calling Configuration Load Function...");
|
||||
loadFunction();
|
||||
this.loadFunction();
|
||||
|
||||
if(configurationOptions.Count <= 0)
|
||||
{
|
||||
MainLog.Instance.Error("No configuration options were specified for '" + configurationOptions +
|
||||
"'. Refusing to continue configuration.");
|
||||
MainLog.Instance.Error("No configuration options were specified for '" + this.configurationOptions + "'. Refusing to continue configuration.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -156,6 +154,12 @@ namespace OpenSim.Framework
|
|||
}
|
||||
else
|
||||
{
|
||||
if (this.configurationFromXMLNode != null)
|
||||
{
|
||||
MainLog.Instance.Notice("Loading from XML Node, will not save to the file");
|
||||
configurationPlugin.LoadDataFromString(configurationFromXMLNode.OuterXml);
|
||||
}
|
||||
|
||||
MainLog.Instance.Notice("XML Configuration Filename is not valid; will not save to the file.");
|
||||
useFile = false;
|
||||
}
|
||||
|
@ -168,9 +172,10 @@ namespace OpenSim.Framework
|
|||
bool ignoreNextFromConfig = false;
|
||||
while (convertSuccess == false)
|
||||
{
|
||||
|
||||
string console_result = "";
|
||||
string attribute = null;
|
||||
if (useFile)
|
||||
if (useFile || (!useFile && configurationFromXMLNode != null))
|
||||
{
|
||||
if (!ignoreNextFromConfig)
|
||||
{
|
||||
|
@ -190,18 +195,14 @@ namespace OpenSim.Framework
|
|||
}
|
||||
else
|
||||
{
|
||||
|
||||
if (configurationDescription.Trim() != "")
|
||||
{
|
||||
console_result =
|
||||
MainLog.Instance.CmdPrompt(
|
||||
configurationDescription + ": " + configOption.configurationQuestion,
|
||||
configOption.configurationDefault);
|
||||
console_result = MainLog.Instance.CmdPrompt(configurationDescription + ": " + configOption.configurationQuestion, configOption.configurationDefault);
|
||||
}
|
||||
else
|
||||
{
|
||||
console_result =
|
||||
MainLog.Instance.CmdPrompt(configOption.configurationQuestion,
|
||||
configOption.configurationDefault);
|
||||
console_result = MainLog.Instance.CmdPrompt(configOption.configurationQuestion, configOption.configurationDefault);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -266,6 +267,7 @@ namespace OpenSim.Framework
|
|||
{
|
||||
convertSuccess = true;
|
||||
return_result = intResult;
|
||||
|
||||
}
|
||||
errorMessage = "a signed 32 bit integer (int)";
|
||||
break;
|
||||
|
@ -320,6 +322,7 @@ namespace OpenSim.Framework
|
|||
{
|
||||
convertSuccess = true;
|
||||
return_result = uintResult;
|
||||
|
||||
}
|
||||
errorMessage = "an unsigned 32 bit integer (uint)";
|
||||
break;
|
||||
|
@ -334,9 +337,7 @@ namespace OpenSim.Framework
|
|||
break;
|
||||
case ConfigurationOption.ConfigurationTypes.TYPE_FLOAT:
|
||||
float floatResult;
|
||||
if (
|
||||
float.TryParse(console_result, NumberStyles.AllowDecimalPoint, Culture.NumberFormatInfo,
|
||||
out floatResult))
|
||||
if (float.TryParse(console_result, NumberStyles.AllowDecimalPoint, Culture.NumberFormatInfo, out floatResult))
|
||||
{
|
||||
convertSuccess = true;
|
||||
return_result = floatResult;
|
||||
|
@ -345,9 +346,7 @@ namespace OpenSim.Framework
|
|||
break;
|
||||
case ConfigurationOption.ConfigurationTypes.TYPE_DOUBLE:
|
||||
double doubleResult;
|
||||
if (
|
||||
Double.TryParse(console_result, NumberStyles.AllowDecimalPoint, Culture.NumberFormatInfo,
|
||||
out doubleResult))
|
||||
if (Double.TryParse(console_result, NumberStyles.AllowDecimalPoint, Culture.NumberFormatInfo, out doubleResult))
|
||||
{
|
||||
convertSuccess = true;
|
||||
return_result = doubleResult;
|
||||
|
@ -364,10 +363,9 @@ namespace OpenSim.Framework
|
|||
}
|
||||
|
||||
|
||||
if (!resultFunction(configOption.configurationKey, return_result))
|
||||
if (!this.resultFunction(configOption.configurationKey, return_result))
|
||||
{
|
||||
MainLog.Instance.Notice(
|
||||
"The handler for the last configuration option denied that input, please try again.");
|
||||
Console.MainLog.Instance.Notice("The handler for the last configuration option denied that input, please try again.");
|
||||
convertSuccess = false;
|
||||
ignoreNextFromConfig = true;
|
||||
}
|
||||
|
@ -376,20 +374,12 @@ namespace OpenSim.Framework
|
|||
{
|
||||
if (configOption.configurationUseDefaultNoPrompt)
|
||||
{
|
||||
MainLog.Instance.Error("CONFIG",
|
||||
string.Format(
|
||||
"[{3}]:[{1}] is not valid default for parameter [{0}].\nThe configuration result must be parsable to {2}.\n",
|
||||
configOption.configurationKey, console_result, errorMessage,
|
||||
configurationFilename));
|
||||
MainLog.Instance.Error("CONFIG", string.Format("[{3}]:[{1}] is not valid default for parameter [{0}].\nThe configuration result must be parsable to {2}.\n", configOption.configurationKey, console_result, errorMessage, configurationFilename));
|
||||
convertSuccess = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
MainLog.Instance.Warn("CONFIG",
|
||||
string.Format(
|
||||
"[{3}]:[{1}] is not a valid value [{0}].\nThe configuration result must be parsable to {2}.\n",
|
||||
configOption.configurationKey, console_result, errorMessage,
|
||||
configurationFilename));
|
||||
MainLog.Instance.Warn("CONFIG", string.Format("[{3}]:[{1}] is not a valid value [{0}].\nThe configuration result must be parsable to {2}.\n", configOption.configurationKey, console_result, errorMessage, configurationFilename));
|
||||
ignoreNextFromConfig = true;
|
||||
}
|
||||
}
|
||||
|
@ -418,8 +408,7 @@ namespace OpenSim.Framework
|
|||
|
||||
if (typeInterface != null)
|
||||
{
|
||||
plug =
|
||||
(IGenericConfig) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
|
||||
plug = (IGenericConfig)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -431,10 +420,10 @@ namespace OpenSim.Framework
|
|||
|
||||
public void forceSetConfigurationOption(string configuration_key, string configuration_value)
|
||||
{
|
||||
configurationPlugin.LoadData();
|
||||
configurationPlugin.SetAttribute(configuration_key, configuration_value);
|
||||
configurationPlugin.Commit();
|
||||
configurationPlugin.Close();
|
||||
this.configurationPlugin.LoadData();
|
||||
this.configurationPlugin.SetAttribute(configuration_key, configuration_value);
|
||||
this.configurationPlugin.Commit();
|
||||
this.configurationPlugin.Close();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
/*
|
||||
* 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.Framework;
|
||||
using Nini.Config;
|
||||
namespace OpenSim.Framework
|
||||
{
|
||||
public interface IRegionLoader
|
||||
{
|
||||
void SetIniConfigSource(IniConfigSource configSource);
|
||||
RegionInfo[] LoadRegions();
|
||||
}
|
||||
}
|
|
@ -26,10 +26,16 @@
|
|||
*
|
||||
*/
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Net;
|
||||
using System.Xml;
|
||||
using System.Net.Sockets;
|
||||
using libsecondlife;
|
||||
using Nini.Config;
|
||||
using libsecondlife;
|
||||
using OpenSim.Framework.Console;
|
||||
using OpenSim.Framework;
|
||||
|
||||
|
||||
|
||||
namespace OpenSim.Framework
|
||||
{
|
||||
|
@ -41,6 +47,7 @@ namespace OpenSim.Framework
|
|||
|
||||
public SimpleRegionInfo(uint regionLocX, uint regionLocY, IPEndPoint internalEndPoint, string externalUri)
|
||||
{
|
||||
|
||||
m_regionLocX = regionLocX;
|
||||
m_regionLocY = regionLocY;
|
||||
|
||||
|
@ -50,6 +57,7 @@ namespace OpenSim.Framework
|
|||
|
||||
public SimpleRegionInfo(uint regionLocX, uint regionLocY, string externalUri, int port)
|
||||
{
|
||||
|
||||
m_regionLocX = regionLocX;
|
||||
m_regionLocY = regionLocY;
|
||||
|
||||
|
@ -61,11 +69,16 @@ namespace OpenSim.Framework
|
|||
public LLUUID RegionID = new LLUUID();
|
||||
|
||||
private uint m_remotingPort;
|
||||
|
||||
public uint RemotingPort
|
||||
{
|
||||
get { return m_remotingPort; }
|
||||
set { m_remotingPort = value; }
|
||||
get
|
||||
{
|
||||
return m_remotingPort;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_remotingPort = value;
|
||||
}
|
||||
}
|
||||
|
||||
public string RemotingAddress;
|
||||
|
@ -98,49 +111,76 @@ namespace OpenSim.Framework
|
|||
ia = Adr;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return new IPEndPoint(ia, m_internalEndPoint.Port);
|
||||
}
|
||||
|
||||
set { m_externalHostName = value.ToString(); }
|
||||
set
|
||||
{
|
||||
m_externalHostName = value.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
protected string m_externalHostName;
|
||||
|
||||
public string ExternalHostName
|
||||
{
|
||||
get { return m_externalHostName; }
|
||||
set { m_externalHostName = value; }
|
||||
get
|
||||
{
|
||||
return m_externalHostName;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_externalHostName = value;
|
||||
}
|
||||
}
|
||||
|
||||
protected IPEndPoint m_internalEndPoint;
|
||||
|
||||
public IPEndPoint InternalEndPoint
|
||||
{
|
||||
get { return m_internalEndPoint; }
|
||||
set { m_internalEndPoint = value; }
|
||||
get
|
||||
{
|
||||
return m_internalEndPoint;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_internalEndPoint = value;
|
||||
}
|
||||
}
|
||||
|
||||
protected uint? m_regionLocX;
|
||||
|
||||
public uint RegionLocX
|
||||
{
|
||||
get { return m_regionLocX.Value; }
|
||||
set { m_regionLocX = value; }
|
||||
get
|
||||
{
|
||||
return m_regionLocX.Value;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_regionLocX = value;
|
||||
}
|
||||
}
|
||||
|
||||
protected uint? m_regionLocY;
|
||||
|
||||
public uint RegionLocY
|
||||
{
|
||||
get { return m_regionLocY.Value; }
|
||||
set { m_regionLocY = value; }
|
||||
get
|
||||
{
|
||||
return m_regionLocY.Value;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_regionLocY = value;
|
||||
}
|
||||
}
|
||||
|
||||
public ulong RegionHandle
|
||||
{
|
||||
get { return Util.UIntsToLong((RegionLocX*256), (RegionLocY*256)); }
|
||||
get
|
||||
{
|
||||
return Util.UIntsToLong((RegionLocX * 256), (RegionLocY * 256));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -158,7 +198,6 @@ namespace OpenSim.Framework
|
|||
|
||||
// Apparently, we're applying the same estatesettings regardless of whether it's local or remote.
|
||||
private static EstateSettings m_estateSettings;
|
||||
|
||||
public EstateSettings EstateSettings
|
||||
{
|
||||
get
|
||||
|
@ -170,69 +209,73 @@ namespace OpenSim.Framework
|
|||
|
||||
return m_estateSettings;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public ConfigurationMember configMember;
|
||||
|
||||
public RegionInfo(string description, string filename)
|
||||
{
|
||||
configMember =
|
||||
new ConfigurationMember(filename, description, loadConfigurationOptions, handleIncomingConfiguration);
|
||||
configMember = new ConfigurationMember(filename, description, loadConfigurationOptions, handleIncomingConfiguration);
|
||||
configMember.performConfigurationRetrieve();
|
||||
}
|
||||
public RegionInfo(string description, XmlNode xmlNode)
|
||||
{
|
||||
configMember = new ConfigurationMember(xmlNode, description, loadConfigurationOptions, handleIncomingConfiguration);
|
||||
configMember.performConfigurationRetrieve();
|
||||
}
|
||||
|
||||
public RegionInfo(uint regionLocX, uint regionLocY, IPEndPoint internalEndPoint, string externalUri) :
|
||||
base(regionLocX, regionLocY, internalEndPoint, externalUri)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
public RegionInfo()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//not in use, should swap to nini though.
|
||||
public void LoadFromNiniSource(IConfigSource source)
|
||||
{
|
||||
LoadFromNiniSource(source, "RegionInfo");
|
||||
this.LoadFromNiniSource(source, "RegionInfo");
|
||||
}
|
||||
|
||||
//not in use, should swap to nini though.
|
||||
public void LoadFromNiniSource(IConfigSource source, string sectionName)
|
||||
{
|
||||
string errorMessage = "";
|
||||
RegionID =
|
||||
new LLUUID(source.Configs[sectionName].GetString("Region_ID", LLUUID.Random().ToStringHyphenated()));
|
||||
RegionName = source.Configs[sectionName].GetString("sim_name", "OpenSim Test");
|
||||
m_regionLocX = Convert.ToUInt32(source.Configs[sectionName].GetString("sim_location_x", "1000"));
|
||||
m_regionLocY = Convert.ToUInt32(source.Configs[sectionName].GetString("sim_location_y", "1000"));
|
||||
DataStore = source.Configs[sectionName].GetString("datastore", "OpenSim.db");
|
||||
this.RegionID = new LLUUID(source.Configs[sectionName].GetString("Region_ID", LLUUID.Random().ToStringHyphenated()));
|
||||
this.RegionName = source.Configs[sectionName].GetString("sim_name", "OpenSim Test");
|
||||
this.m_regionLocX = Convert.ToUInt32(source.Configs[sectionName].GetString("sim_location_x", "1000"));
|
||||
this.m_regionLocY = Convert.ToUInt32(source.Configs[sectionName].GetString("sim_location_y", "1000"));
|
||||
this.DataStore = source.Configs[sectionName].GetString("datastore", "OpenSim.db");
|
||||
|
||||
string ipAddress = source.Configs[sectionName].GetString("internal_ip_address", "0.0.0.0");
|
||||
IPAddress ipAddressResult;
|
||||
if (IPAddress.TryParse(ipAddress, out ipAddressResult))
|
||||
{
|
||||
m_internalEndPoint = new IPEndPoint(ipAddressResult, 0);
|
||||
this.m_internalEndPoint = new IPEndPoint(ipAddressResult, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
errorMessage = "needs an IP Address (IPAddress)";
|
||||
}
|
||||
m_internalEndPoint.Port =
|
||||
source.Configs[sectionName].GetInt("internal_ip_port", NetworkServersInfo.DefaultHttpListenerPort);
|
||||
this.m_internalEndPoint.Port = source.Configs[sectionName].GetInt("internal_ip_port", NetworkServersInfo.DefaultHttpListenerPort);
|
||||
|
||||
string externalHost = source.Configs[sectionName].GetString("external_host_name", "127.0.0.1");
|
||||
if (externalHost != "SYSTEMIP")
|
||||
{
|
||||
m_externalHostName = externalHost;
|
||||
this.m_externalHostName = externalHost;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_externalHostName = Util.GetLocalHost().ToString();
|
||||
this.m_externalHostName = Util.GetLocalHost().ToString();
|
||||
}
|
||||
|
||||
MasterAvatarFirstName = source.Configs[sectionName].GetString("master_avatar_first", "Test");
|
||||
MasterAvatarLastName = source.Configs[sectionName].GetString("master_avatar_last", "User");
|
||||
MasterAvatarSandboxPassword = source.Configs[sectionName].GetString("master_avatar_pass", "test");
|
||||
this.MasterAvatarFirstName = source.Configs[sectionName].GetString("master_avatar_first", "Test");
|
||||
this.MasterAvatarLastName = source.Configs[sectionName].GetString("master_avatar_last", "User");
|
||||
this.MasterAvatarSandboxPassword = source.Configs[sectionName].GetString("master_avatar_pass", "test");
|
||||
|
||||
if (errorMessage != "")
|
||||
{
|
||||
|
@ -242,36 +285,17 @@ namespace OpenSim.Framework
|
|||
|
||||
public void loadConfigurationOptions()
|
||||
{
|
||||
configMember.addConfigurationOption("sim_UUID", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID,
|
||||
"UUID of Region (Default is recommended, random UUID)",
|
||||
LLUUID.Random().ToString(), true);
|
||||
configMember.addConfigurationOption("sim_name", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY,
|
||||
"Region Name", "OpenSim Test", false);
|
||||
configMember.addConfigurationOption("sim_location_x", ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
|
||||
"Grid Location (X Axis)", "1000", false);
|
||||
configMember.addConfigurationOption("sim_location_y", ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
|
||||
"Grid Location (Y Axis)", "1000", false);
|
||||
configMember.addConfigurationOption("datastore",
|
||||
ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY,
|
||||
"Filename for local storage", "OpenSim.db", false);
|
||||
configMember.addConfigurationOption("internal_ip_address",
|
||||
ConfigurationOption.ConfigurationTypes.TYPE_IP_ADDRESS,
|
||||
"Internal IP Address for incoming UDP client connections", "0.0.0.0",
|
||||
false);
|
||||
configMember.addConfigurationOption("internal_ip_port", ConfigurationOption.ConfigurationTypes.TYPE_INT32,
|
||||
"Internal IP Port for incoming UDP client connections",
|
||||
NetworkServersInfo.DefaultHttpListenerPort.ToString(), false);
|
||||
configMember.addConfigurationOption("external_host_name",
|
||||
ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY,
|
||||
"External Host Name", "127.0.0.1", false);
|
||||
configMember.addConfigurationOption("master_avatar_first",
|
||||
ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY,
|
||||
"First Name of Master Avatar", "Test", false);
|
||||
configMember.addConfigurationOption("master_avatar_last",
|
||||
ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY,
|
||||
"Last Name of Master Avatar", "User", false);
|
||||
configMember.addConfigurationOption("master_avatar_pass", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
|
||||
"(Sandbox Mode Only)Password for Master Avatar account", "test", false);
|
||||
configMember.addConfigurationOption("sim_UUID", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, "UUID of Region (Default is recommended, random UUID)", LLUUID.Random().ToString(), true);
|
||||
configMember.addConfigurationOption("sim_name", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "Region Name", "OpenSim Test", false);
|
||||
configMember.addConfigurationOption("sim_location_x", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, "Grid Location (X Axis)", "1000", false);
|
||||
configMember.addConfigurationOption("sim_location_y", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, "Grid Location (Y Axis)", "1000", false);
|
||||
configMember.addConfigurationOption("datastore", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "Filename for local storage", "OpenSim.db", false);
|
||||
configMember.addConfigurationOption("internal_ip_address", ConfigurationOption.ConfigurationTypes.TYPE_IP_ADDRESS, "Internal IP Address for incoming UDP client connections", "0.0.0.0", false);
|
||||
configMember.addConfigurationOption("internal_ip_port", ConfigurationOption.ConfigurationTypes.TYPE_INT32, "Internal IP Port for incoming UDP client connections", NetworkServersInfo.DefaultHttpListenerPort.ToString(), false);
|
||||
configMember.addConfigurationOption("external_host_name", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "External Host Name", "127.0.0.1", false);
|
||||
configMember.addConfigurationOption("master_avatar_first", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "First Name of Master Avatar", "Test", false);
|
||||
configMember.addConfigurationOption("master_avatar_last", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "Last Name of Master Avatar", "User", false);
|
||||
configMember.addConfigurationOption("master_avatar_pass", ConfigurationOption.ConfigurationTypes.TYPE_STRING, "(Sandbox Mode Only)Password for Master Avatar account", "test", false);
|
||||
}
|
||||
|
||||
public bool handleIncomingConfiguration(string configuration_key, object configuration_result)
|
||||
|
@ -279,50 +303,51 @@ namespace OpenSim.Framework
|
|||
switch (configuration_key)
|
||||
{
|
||||
case "sim_UUID":
|
||||
RegionID = (LLUUID) configuration_result;
|
||||
this.RegionID = (LLUUID)configuration_result;
|
||||
break;
|
||||
case "sim_name":
|
||||
RegionName = (string) configuration_result;
|
||||
this.RegionName = (string)configuration_result;
|
||||
break;
|
||||
case "sim_location_x":
|
||||
m_regionLocX = (uint) configuration_result;
|
||||
this.m_regionLocX = (uint)configuration_result;
|
||||
break;
|
||||
case "sim_location_y":
|
||||
m_regionLocY = (uint) configuration_result;
|
||||
this.m_regionLocY = (uint)configuration_result;
|
||||
break;
|
||||
case "datastore":
|
||||
DataStore = (string) configuration_result;
|
||||
this.DataStore = (string)configuration_result;
|
||||
break;
|
||||
case "internal_ip_address":
|
||||
IPAddress address = (IPAddress)configuration_result;
|
||||
m_internalEndPoint = new IPEndPoint(address, 0);
|
||||
this.m_internalEndPoint = new IPEndPoint(address, 0);
|
||||
break;
|
||||
case "internal_ip_port":
|
||||
m_internalEndPoint.Port = (int) configuration_result;
|
||||
this.m_internalEndPoint.Port = (int)configuration_result;
|
||||
break;
|
||||
case "external_host_name":
|
||||
if ((string)configuration_result != "SYSTEMIP")
|
||||
{
|
||||
m_externalHostName = (string) configuration_result;
|
||||
this.m_externalHostName = (string)configuration_result;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_externalHostName = Util.GetLocalHost().ToString();
|
||||
this.m_externalHostName = Util.GetLocalHost().ToString();
|
||||
}
|
||||
break;
|
||||
case "master_avatar_first":
|
||||
MasterAvatarFirstName = (string) configuration_result;
|
||||
this.MasterAvatarFirstName = (string)configuration_result;
|
||||
break;
|
||||
case "master_avatar_last":
|
||||
MasterAvatarLastName = (string) configuration_result;
|
||||
this.MasterAvatarLastName = (string)configuration_result;
|
||||
break;
|
||||
case "master_avatar_pass":
|
||||
string tempMD5Passwd = (string)configuration_result;
|
||||
MasterAvatarSandboxPassword = Util.Md5Hash(Util.Md5Hash(tempMD5Passwd) + ":" + "");
|
||||
this.MasterAvatarSandboxPassword = Util.Md5Hash(Util.Md5Hash(tempMD5Passwd) + ":" + "");
|
||||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,112 @@
|
|||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<ProjectType>Local</ProjectType>
|
||||
<ProductVersion>8.0.50727</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{9A0DA098-0000-0000-0000-000000000000}</ProjectGuid>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ApplicationIcon></ApplicationIcon>
|
||||
<AssemblyKeyContainerName>
|
||||
</AssemblyKeyContainerName>
|
||||
<AssemblyName>OpenSim.Framework.RegionLoader.Filesystem</AssemblyName>
|
||||
<DefaultClientScript>JScript</DefaultClientScript>
|
||||
<DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
|
||||
<DefaultTargetSchema>IE50</DefaultTargetSchema>
|
||||
<DelaySign>false</DelaySign>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder></AppDesignerFolder>
|
||||
<RootNamespace>OpenSim.Framework.RegionLoader.Filesystem</RootNamespace>
|
||||
<StartupObject></StartupObject>
|
||||
<FileUpgradeFlags>
|
||||
</FileUpgradeFlags>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<AllowUnsafeBlocks>False</AllowUnsafeBlocks>
|
||||
<BaseAddress>285212672</BaseAddress>
|
||||
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
|
||||
<ConfigurationOverrideFile>
|
||||
</ConfigurationOverrideFile>
|
||||
<DefineConstants>TRACE;DEBUG</DefineConstants>
|
||||
<DocumentationFile></DocumentationFile>
|
||||
<DebugSymbols>True</DebugSymbols>
|
||||
<FileAlignment>4096</FileAlignment>
|
||||
<Optimize>False</Optimize>
|
||||
<OutputPath>..\..\..\..\bin\</OutputPath>
|
||||
<RegisterForComInterop>False</RegisterForComInterop>
|
||||
<RemoveIntegerChecks>False</RemoveIntegerChecks>
|
||||
<TreatWarningsAsErrors>False</TreatWarningsAsErrors>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<NoWarn></NoWarn>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<AllowUnsafeBlocks>False</AllowUnsafeBlocks>
|
||||
<BaseAddress>285212672</BaseAddress>
|
||||
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
|
||||
<ConfigurationOverrideFile>
|
||||
</ConfigurationOverrideFile>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<DocumentationFile></DocumentationFile>
|
||||
<DebugSymbols>False</DebugSymbols>
|
||||
<FileAlignment>4096</FileAlignment>
|
||||
<Optimize>True</Optimize>
|
||||
<OutputPath>..\..\..\..\bin\</OutputPath>
|
||||
<RegisterForComInterop>False</RegisterForComInterop>
|
||||
<RemoveIntegerChecks>False</RemoveIntegerChecks>
|
||||
<TreatWarningsAsErrors>False</TreatWarningsAsErrors>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<NoWarn></NoWarn>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Db4objects.Db4o.dll" >
|
||||
<HintPath>..\..\..\..\bin\Db4objects.Db4o.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="libsecondlife.dll" >
|
||||
<HintPath>..\..\..\..\bin\libsecondlife.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="Nini.dll" >
|
||||
<HintPath>..\..\..\..\bin\Nini.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="System" >
|
||||
<HintPath>System.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Xml" >
|
||||
<HintPath>System.Xml.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="XMLRPC.dll" >
|
||||
<HintPath>..\..\..\..\bin\XMLRPC.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\OpenSim.Framework.csproj">
|
||||
<Name>OpenSim.Framework</Name>
|
||||
<Project>{8ACA2445-0000-0000-0000-000000000000}</Project>
|
||||
<Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
|
||||
<Private>False</Private>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Console\OpenSim.Framework.Console.csproj">
|
||||
<Name>OpenSim.Framework.Console</Name>
|
||||
<Project>{A7CD0630-0000-0000-0000-000000000000}</Project>
|
||||
<Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
|
||||
<Private>False</Private>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="RegionLoaderFileSystem.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
|
||||
<PropertyGroup>
|
||||
<PreBuildEvent>
|
||||
</PreBuildEvent>
|
||||
<PostBuildEvent>
|
||||
</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
</Project>
|
|
@ -0,0 +1,72 @@
|
|||
/*
|
||||
* 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 Nini.Config;
|
||||
using OpenSim.Framework;
|
||||
using System.IO;
|
||||
|
||||
namespace OpenSim.Framework.RegionLoader.Filesystem
|
||||
{
|
||||
public class RegionLoaderFileSystem : IRegionLoader
|
||||
{
|
||||
public void SetIniConfigSource(IniConfigSource configSource)
|
||||
{
|
||||
}
|
||||
public RegionInfo[] LoadRegions()
|
||||
{
|
||||
string regionConfigPath = Path.Combine(Util.configDir(), "Regions");
|
||||
|
||||
if (!Directory.Exists(regionConfigPath))
|
||||
{
|
||||
Directory.CreateDirectory(regionConfigPath);
|
||||
}
|
||||
|
||||
string[] configFiles = Directory.GetFiles(regionConfigPath, "*.xml");
|
||||
|
||||
if (configFiles.Length == 0)
|
||||
{
|
||||
new RegionInfo("DEFAULT REGION CONFIG", Path.Combine(regionConfigPath, "default.xml"));
|
||||
configFiles = Directory.GetFiles(regionConfigPath, "*.xml");
|
||||
}
|
||||
|
||||
RegionInfo[] regionInfos = new RegionInfo[configFiles.Length];
|
||||
for (int i = 0; i < configFiles.Length; i++)
|
||||
{
|
||||
|
||||
RegionInfo regionInfo = new RegionInfo("REGION CONFIG #" + (i + 1), configFiles[i]);
|
||||
regionInfos[i] = regionInfo;
|
||||
}
|
||||
|
||||
|
||||
return regionInfos;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,112 @@
|
|||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<ProjectType>Local</ProjectType>
|
||||
<ProductVersion>8.0.50727</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{CA806165-0000-0000-0000-000000000000}</ProjectGuid>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ApplicationIcon></ApplicationIcon>
|
||||
<AssemblyKeyContainerName>
|
||||
</AssemblyKeyContainerName>
|
||||
<AssemblyName>OpenSim.Framework.RegionLoader.Web</AssemblyName>
|
||||
<DefaultClientScript>JScript</DefaultClientScript>
|
||||
<DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
|
||||
<DefaultTargetSchema>IE50</DefaultTargetSchema>
|
||||
<DelaySign>false</DelaySign>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder></AppDesignerFolder>
|
||||
<RootNamespace>OpenSim.Framework.RegionLoader.Web</RootNamespace>
|
||||
<StartupObject></StartupObject>
|
||||
<FileUpgradeFlags>
|
||||
</FileUpgradeFlags>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<AllowUnsafeBlocks>False</AllowUnsafeBlocks>
|
||||
<BaseAddress>285212672</BaseAddress>
|
||||
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
|
||||
<ConfigurationOverrideFile>
|
||||
</ConfigurationOverrideFile>
|
||||
<DefineConstants>TRACE;DEBUG</DefineConstants>
|
||||
<DocumentationFile></DocumentationFile>
|
||||
<DebugSymbols>True</DebugSymbols>
|
||||
<FileAlignment>4096</FileAlignment>
|
||||
<Optimize>False</Optimize>
|
||||
<OutputPath>..\..\..\..\bin\</OutputPath>
|
||||
<RegisterForComInterop>False</RegisterForComInterop>
|
||||
<RemoveIntegerChecks>False</RemoveIntegerChecks>
|
||||
<TreatWarningsAsErrors>False</TreatWarningsAsErrors>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<NoWarn></NoWarn>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<AllowUnsafeBlocks>False</AllowUnsafeBlocks>
|
||||
<BaseAddress>285212672</BaseAddress>
|
||||
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
|
||||
<ConfigurationOverrideFile>
|
||||
</ConfigurationOverrideFile>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<DocumentationFile></DocumentationFile>
|
||||
<DebugSymbols>False</DebugSymbols>
|
||||
<FileAlignment>4096</FileAlignment>
|
||||
<Optimize>True</Optimize>
|
||||
<OutputPath>..\..\..\..\bin\</OutputPath>
|
||||
<RegisterForComInterop>False</RegisterForComInterop>
|
||||
<RemoveIntegerChecks>False</RemoveIntegerChecks>
|
||||
<TreatWarningsAsErrors>False</TreatWarningsAsErrors>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<NoWarn></NoWarn>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Db4objects.Db4o.dll" >
|
||||
<HintPath>..\..\..\..\bin\Db4objects.Db4o.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="libsecondlife.dll" >
|
||||
<HintPath>..\..\..\..\bin\libsecondlife.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="Nini.dll" >
|
||||
<HintPath>..\..\..\..\bin\Nini.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="System" >
|
||||
<HintPath>System.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Xml" >
|
||||
<HintPath>System.Xml.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="XMLRPC.dll" >
|
||||
<HintPath>..\..\..\..\bin\XMLRPC.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\OpenSim.Framework.csproj">
|
||||
<Name>OpenSim.Framework</Name>
|
||||
<Project>{8ACA2445-0000-0000-0000-000000000000}</Project>
|
||||
<Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
|
||||
<Private>False</Private>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Console\OpenSim.Framework.Console.csproj">
|
||||
<Name>OpenSim.Framework.Console</Name>
|
||||
<Project>{A7CD0630-0000-0000-0000-000000000000}</Project>
|
||||
<Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
|
||||
<Private>False</Private>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="RegionLoaderWebServer.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
|
||||
<PropertyGroup>
|
||||
<PreBuildEvent>
|
||||
</PreBuildEvent>
|
||||
<PostBuildEvent>
|
||||
</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
</Project>
|
|
@ -0,0 +1,98 @@
|
|||
/*
|
||||
* 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.Net;
|
||||
using System.IO;
|
||||
using System.Xml;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using Nini.Config;
|
||||
using OpenSim.Framework;
|
||||
|
||||
namespace OpenSim.Framework.RegionLoader.Web
|
||||
{
|
||||
public class RegionLoaderWebServer : IRegionLoader
|
||||
{
|
||||
private IniConfigSource m_configSouce;
|
||||
public void SetIniConfigSource(IniConfigSource configSource)
|
||||
{
|
||||
m_configSouce = configSource;
|
||||
}
|
||||
public RegionInfo[] LoadRegions()
|
||||
{
|
||||
if (m_configSouce == null)
|
||||
{
|
||||
Console.MainLog.Instance.Error("Unable to load configuration source! (WebServer Region Loader)");
|
||||
return null;
|
||||
}
|
||||
else
|
||||
{
|
||||
IniConfig startupConfig = (IniConfig)m_configSouce.Configs["Startup"];
|
||||
string url = startupConfig.GetString("regionload_webserver_url","").Trim();
|
||||
if (url == "")
|
||||
{
|
||||
Console.MainLog.Instance.Error("Unable to load webserver URL - URL was empty (WebServer Region Loader");
|
||||
return null;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(url);
|
||||
webRequest.Timeout = 30000; //30 Second Timeout
|
||||
Console.MainLog.Instance.Debug("Sending Download Request...");
|
||||
HttpWebResponse webResponse = (HttpWebResponse)webRequest.GetResponse();
|
||||
Console.MainLog.Instance.Debug("Downloading Region Information From Remote Server...");
|
||||
StreamReader reader = new StreamReader(webResponse.GetResponseStream());
|
||||
string xmlSource = "";
|
||||
string tempStr = reader.ReadLine();
|
||||
while (tempStr != null)
|
||||
{
|
||||
xmlSource = xmlSource + tempStr;
|
||||
tempStr = reader.ReadLine();
|
||||
}
|
||||
Console.MainLog.Instance.Debug("Done downloading region information from server. Total Bytes: " + xmlSource.Length);
|
||||
XmlDocument xmlDoc = new XmlDocument();
|
||||
xmlDoc.LoadXml(xmlSource);
|
||||
if (xmlDoc.FirstChild.Name == "Regions")
|
||||
{
|
||||
RegionInfo[] regionInfos = new RegionInfo[xmlDoc.FirstChild.ChildNodes.Count];
|
||||
int i;
|
||||
for (i = 0; i < xmlDoc.FirstChild.ChildNodes.Count; i++)
|
||||
{
|
||||
Console.MainLog.Instance.Debug(xmlDoc.FirstChild.ChildNodes[i].OuterXml);
|
||||
regionInfos[i] = new RegionInfo("REGION CONFIG #" + (i + 1), xmlDoc.FirstChild.ChildNodes[i]);
|
||||
}
|
||||
|
||||
return regionInfos;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -35,6 +35,8 @@ 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;
|
||||
|
@ -43,6 +45,7 @@ using OpenSim.Region.Environment.Interfaces;
|
|||
using OpenSim.Region.Environment.Scenes;
|
||||
using OpenSim.Region.Physics.Manager;
|
||||
|
||||
|
||||
namespace OpenSim
|
||||
{
|
||||
public delegate void ConsoleCommand(string[] comParams);
|
||||
|
@ -272,20 +275,20 @@ namespace OpenSim
|
|||
m_httpServer.AddStreamHandler(new SimStatusHandler());
|
||||
}
|
||||
|
||||
string regionConfigPath = Path.Combine(Util.configDir(), "Regions");
|
||||
|
||||
if (!Directory.Exists(regionConfigPath))
|
||||
IRegionLoader regionLoader;
|
||||
if (m_config.Configs["Startup"].GetString("region_info_source", "filesystem") == "filesystem")
|
||||
{
|
||||
Directory.CreateDirectory(regionConfigPath);
|
||||
MainLog.Instance.Notice("Loading Region Info from filesystem");
|
||||
regionLoader = new RegionLoaderFileSystem();
|
||||
}
|
||||
else
|
||||
{
|
||||
MainLog.Instance.Notice("Loading Region Info from web");
|
||||
regionLoader = new RegionLoaderWebServer();
|
||||
}
|
||||
|
||||
string[] configFiles = Directory.GetFiles(regionConfigPath, "*.xml");
|
||||
|
||||
if (configFiles.Length == 0)
|
||||
{
|
||||
CreateDefaultRegionInfoXml(Path.Combine(regionConfigPath, "default.xml"));
|
||||
configFiles = Directory.GetFiles(regionConfigPath, "*.xml");
|
||||
}
|
||||
regionLoader.SetIniConfigSource(m_config);
|
||||
RegionInfo[] regionsToLoad = regionLoader.LoadRegions();
|
||||
|
||||
m_moduleLoader = new ModuleLoader(m_log, m_config);
|
||||
MainLog.Instance.Verbose("Loading Shared Modules");
|
||||
|
@ -294,12 +297,10 @@ namespace OpenSim
|
|||
// 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 < configFiles.Length; i++)
|
||||
for (int i = 0; i < regionsToLoad.Length; i++)
|
||||
{
|
||||
//Console.WriteLine("Loading region config file");
|
||||
RegionInfo regionInfo = new RegionInfo("REGION CONFIG #" + (i + 1), configFiles[i]);
|
||||
|
||||
CreateRegion(regionInfo);
|
||||
MainLog.Instance.Debug("Creating Region: " + regionsToLoad[i].RegionName);
|
||||
CreateRegion(regionsToLoad[i]);
|
||||
}
|
||||
|
||||
m_moduleLoader.PostInitialise();
|
||||
|
|
50
prebuild.xml
50
prebuild.xml
|
@ -155,6 +155,56 @@
|
|||
<Match pattern="*.cs" recurse="true"/>
|
||||
</Files>
|
||||
</Project>
|
||||
<Project name="OpenSim.Framework.RegionLoader.Web" path="OpenSim/Framework/RegionLoader/Web" type="Library">
|
||||
<Configuration name="Debug">
|
||||
<Options>
|
||||
<OutputPath>../../../../bin/</OutputPath>
|
||||
</Options>
|
||||
</Configuration>
|
||||
<Configuration name="Release">
|
||||
<Options>
|
||||
<OutputPath>../../../../bin/</OutputPath>
|
||||
</Options>
|
||||
</Configuration>
|
||||
|
||||
<ReferencePath>../../../../bin/</ReferencePath>
|
||||
<Reference name="System"/>
|
||||
<Reference name="System.Xml"/>
|
||||
<Reference name="libsecondlife.dll"/>
|
||||
<Reference name="Db4objects.Db4o.dll"/>
|
||||
<Reference name="XMLRPC.dll"/>
|
||||
<Reference name="OpenSim.Framework"/>
|
||||
<Reference name="OpenSim.Framework.Console"/>
|
||||
<Reference name="Nini.dll" />
|
||||
<Files>
|
||||
<Match pattern="*.cs" recurse="true"/>
|
||||
</Files>
|
||||
</Project>
|
||||
<Project name="OpenSim.Framework.RegionLoader.Filesystem" path="OpenSim/Framework/RegionLoader/Filesystem" type="Library">
|
||||
<Configuration name="Debug">
|
||||
<Options>
|
||||
<OutputPath>../../../../bin/</OutputPath>
|
||||
</Options>
|
||||
</Configuration>
|
||||
<Configuration name="Release">
|
||||
<Options>
|
||||
<OutputPath>../../../../bin/</OutputPath>
|
||||
</Options>
|
||||
</Configuration>
|
||||
|
||||
<ReferencePath>../../../../bin/</ReferencePath>
|
||||
<Reference name="System"/>
|
||||
<Reference name="System.Xml"/>
|
||||
<Reference name="libsecondlife.dll"/>
|
||||
<Reference name="Db4objects.Db4o.dll"/>
|
||||
<Reference name="XMLRPC.dll"/>
|
||||
<Reference name="OpenSim.Framework"/>
|
||||
<Reference name="OpenSim.Framework.Console"/>
|
||||
<Reference name="Nini.dll" />
|
||||
<Files>
|
||||
<Match pattern="*.cs" recurse="true"/>
|
||||
</Files>
|
||||
</Project>
|
||||
|
||||
<Project name="OpenSim.Framework.Servers" path="OpenSim/Framework/Servers" type="Library">
|
||||
<Configuration name="Debug">
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
The remote region loading ability allows easier management of what regions a simulator run s from a webserver.
|
||||
In OpenSim.ini, change the 'region_info_source = filesystem' under [Startup] to 'region_info_source = web'.
|
||||
Then change the line 'regionload_webserver_url = ' to 'regionload_webserver_url = http://127.0.0.1/default.xml'
|
||||
replacing 'http://127.0.0.1/default.xml' with the URL of the region XML file.
|
||||
|
||||
The XML file of a remote region is similar to the filesystem version, except it is in one file instead of multiple
|
||||
region_xxx.xml files.
|
||||
|
||||
See example_web.xml for an example on how to make a web version for region loading.
|
|
@ -0,0 +1,8 @@
|
|||
<Regions>
|
||||
<Root>
|
||||
<Config sim_UUID="18fb66dbf6274279885228f1c4064f8c" sim_name="OpenSim Test" sim_location_x="1000" sim_location_y="1000" datastore="OpenSim.db" internal_ip_address="0.0.0.0" internal_ip_port="9000" external_host_name="127.0.0.1" master_avatar_first="Test" master_avatar_last="User" master_avatar_pass="test" />
|
||||
</Root>
|
||||
<Root>
|
||||
<Config sim_UUID="111111dbf6274219881228f1c1061f8c" sim_name="OpenSim Test2" sim_location_x="1001" sim_location_y="1000" datastore="OpenSim2.db" internal_ip_address="0.0.0.0" internal_ip_port="9001" external_host_name="127.0.0.1" master_avatar_first="Test" master_avatar_last="User" master_avatar_pass="test" />
|
||||
</Root>
|
||||
</Regions>
|
Loading…
Reference in New Issue