Allow some values that are set in OpenSim.ini to be set from region config

XML as well.
0.6.2-post-fixes
Melanie Thielker 2009-01-02 17:41:12 +00:00
parent 09378da127
commit 0138fdc5fd
5 changed files with 93 additions and 10 deletions

View File

@ -199,6 +199,7 @@ namespace OpenSim.Framework
public bool isSandbox = false; public bool isSandbox = false;
private EstateSettings m_estateSettings; private EstateSettings m_estateSettings;
private RegionSettings m_regionSettings; private RegionSettings m_regionSettings;
private IConfigSource m_configSource = null;
public UUID MasterAvatarAssignedUUID = UUID.Zero; public UUID MasterAvatarAssignedUUID = UUID.Zero;
public string MasterAvatarFirstName = String.Empty; public string MasterAvatarFirstName = String.Empty;
@ -212,6 +213,11 @@ namespace OpenSim.Framework
public UUID lastMapUUID = UUID.Zero; public UUID lastMapUUID = UUID.Zero;
public string lastMapRefresh = "0"; public string lastMapRefresh = "0";
private int m_nonphysPrimMax = 0;
private int m_physPrimMax = 0;
private bool m_clampPrimSize = false;
private int m_objectCapacity = 0;
// Apparently, we're applying the same estatesettings regardless of whether it's local or remote. // Apparently, we're applying the same estatesettings regardless of whether it's local or remote.
// MT: Yes. Estates can't span trust boundaries. Therefore, it can be // MT: Yes. Estates can't span trust boundaries. Therefore, it can be
@ -219,16 +225,18 @@ namespace OpenSim.Framework
// access the same database server. Since estate settings are lodaed // access the same database server. Since estate settings are lodaed
// from there, that should be sufficient for full remote administration // from there, that should be sufficient for full remote administration
public RegionInfo(string description, string filename, bool skipConsoleConfig) public RegionInfo(string description, string filename, bool skipConsoleConfig, IConfigSource configSource)
{ {
m_configSource = configSource;
configMember = configMember =
new ConfigurationMember(filename, description, loadConfigurationOptions, handleIncomingConfiguration, !skipConsoleConfig); new ConfigurationMember(filename, description, loadConfigurationOptions, handleIncomingConfiguration, !skipConsoleConfig);
configMember.performConfigurationRetrieve(); configMember.performConfigurationRetrieve();
RegionFile = filename; RegionFile = filename;
} }
public RegionInfo(string description, XmlNode xmlNode, bool skipConsoleConfig) public RegionInfo(string description, XmlNode xmlNode, bool skipConsoleConfig, IConfigSource configSource)
{ {
m_configSource = configSource;
configMember = configMember =
new ConfigurationMember(xmlNode, description, loadConfigurationOptions, handleIncomingConfiguration, !skipConsoleConfig); new ConfigurationMember(xmlNode, description, loadConfigurationOptions, handleIncomingConfiguration, !skipConsoleConfig);
configMember.performConfigurationRetrieve(); configMember.performConfigurationRetrieve();
@ -302,6 +310,26 @@ namespace OpenSim.Framework
set { m_regionSettings = value; } set { m_regionSettings = value; }
} }
public int NonphysPrimMax
{
get { return m_nonphysPrimMax; }
}
public int PhysPrimMax
{
get { return m_physPrimMax; }
}
public bool ClampPrimSize
{
get { return m_clampPrimSize; }
}
public int ObjectCapacity
{
get { return m_objectCapacity; }
}
public void SetEndPoint(string ipaddr, int port) public void SetEndPoint(string ipaddr, int port)
{ {
IPAddress tmpIP = IPAddress.Parse(ipaddr); IPAddress tmpIP = IPAddress.Parse(ipaddr);
@ -414,6 +442,17 @@ namespace OpenSim.Framework
configMember.addConfigurationOption("lastmap_refresh", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, configMember.addConfigurationOption("lastmap_refresh", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY,
"Last Map Refresh", Util.UnixTimeSinceEpoch().ToString(), true); "Last Map Refresh", Util.UnixTimeSinceEpoch().ToString(), true);
configMember.addConfigurationOption("nonphysical_prim_max", ConfigurationOption.ConfigurationTypes.TYPE_INT32,
"Maximum size for nonphysical prims", m_nonphysPrimMax.ToString(), true);
configMember.addConfigurationOption("physical_prim_max", ConfigurationOption.ConfigurationTypes.TYPE_INT32,
"Maximum size for physical prims", m_physPrimMax.ToString(), true);
configMember.addConfigurationOption("clamp_prim_size", ConfigurationOption.ConfigurationTypes.TYPE_BOOLEAN,
"Clamp prims to max size", m_clampPrimSize.ToString(), true);
configMember.addConfigurationOption("object_capacity", ConfigurationOption.ConfigurationTypes.TYPE_INT32,
"Max objects this sim will hold", m_objectCapacity.ToString(), true);
} }
public void loadConfigurationOptions() public void loadConfigurationOptions()
@ -462,6 +501,18 @@ namespace OpenSim.Framework
configMember.addConfigurationOption("lastmap_refresh", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, configMember.addConfigurationOption("lastmap_refresh", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY,
"Last Map Refresh", Util.UnixTimeSinceEpoch().ToString(), true); "Last Map Refresh", Util.UnixTimeSinceEpoch().ToString(), true);
configMember.addConfigurationOption("nonphysical_prim_max", ConfigurationOption.ConfigurationTypes.TYPE_INT32,
"Maximum size for nonphysical prims", "0", true);
configMember.addConfigurationOption("physical_prim_max", ConfigurationOption.ConfigurationTypes.TYPE_INT32,
"Maximum size for physical prims", "0", true);
configMember.addConfigurationOption("clamp_prim_size", ConfigurationOption.ConfigurationTypes.TYPE_BOOLEAN,
"Clamp prims to max size", "false", true);
configMember.addConfigurationOption("object_capacity", ConfigurationOption.ConfigurationTypes.TYPE_INT32,
"Max objects this sim will hold", "0", true);
} }
public bool shouldMasterAvatarDetailsBeAsked(string configuration_key) public bool shouldMasterAvatarDetailsBeAsked(string configuration_key)
@ -527,6 +578,18 @@ namespace OpenSim.Framework
case "lastmap_refresh": case "lastmap_refresh":
lastMapRefresh = (string)configuration_result; lastMapRefresh = (string)configuration_result;
break; break;
case "nonphysical_prim_max":
m_nonphysPrimMax = (int)configuration_result;
break;
case "physical_prim_max":
m_physPrimMax = (int)configuration_result;
break;
case "clamp_prim_size":
m_clampPrimSize = (bool)configuration_result;
break;
case "object_capacity":
m_objectCapacity = (int)configuration_result;
break;
} }
return true; return true;

View File

@ -63,14 +63,14 @@ namespace OpenSim.Framework.RegionLoader.Filesystem
if (configFiles.Length == 0) if (configFiles.Length == 0)
{ {
new RegionInfo("DEFAULT REGION CONFIG", Path.Combine(regionConfigPath, "default.xml"), false); new RegionInfo("DEFAULT REGION CONFIG", Path.Combine(regionConfigPath, "default.xml"), false, m_configSource);
configFiles = Directory.GetFiles(regionConfigPath, "*.xml"); configFiles = Directory.GetFiles(regionConfigPath, "*.xml");
} }
RegionInfo[] regionInfos = new RegionInfo[configFiles.Length]; RegionInfo[] regionInfos = new RegionInfo[configFiles.Length];
for (int i = 0; i < configFiles.Length; i++) for (int i = 0; i < configFiles.Length; i++)
{ {
RegionInfo regionInfo = new RegionInfo("REGION CONFIG #" + (i + 1), configFiles[i], false); RegionInfo regionInfo = new RegionInfo("REGION CONFIG #" + (i + 1), configFiles[i], false, m_configSource);
regionInfos[i] = regionInfo; regionInfos[i] = regionInfo;
} }

View File

@ -39,23 +39,23 @@ namespace OpenSim.Framework.RegionLoader.Web
{ {
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private IConfigSource m_configSouce; private IConfigSource m_configSource;
public void SetIniConfigSource(IConfigSource configSource) public void SetIniConfigSource(IConfigSource configSource)
{ {
m_configSouce = configSource; m_configSource = configSource;
} }
public RegionInfo[] LoadRegions() public RegionInfo[] LoadRegions()
{ {
if (m_configSouce == null) if (m_configSource == null)
{ {
m_log.Error("[WEBLOADER]: Unable to load configuration source!"); m_log.Error("[WEBLOADER]: Unable to load configuration source!");
return null; return null;
} }
else else
{ {
IConfig startupConfig = (IConfig) m_configSouce.Configs["Startup"]; IConfig startupConfig = (IConfig) m_configSource.Configs["Startup"];
string url = startupConfig.GetString("regionload_webserver_url", String.Empty).Trim(); string url = startupConfig.GetString("regionload_webserver_url", String.Empty).Trim();
if (url == String.Empty) if (url == String.Empty)
{ {
@ -89,7 +89,7 @@ namespace OpenSim.Framework.RegionLoader.Web
{ {
m_log.Debug(xmlDoc.FirstChild.ChildNodes[i].OuterXml); m_log.Debug(xmlDoc.FirstChild.ChildNodes[i].OuterXml);
regionInfos[i] = regionInfos[i] =
new RegionInfo("REGION CONFIG #" + (i + 1), xmlDoc.FirstChild.ChildNodes[i],false); new RegionInfo("REGION CONFIG #" + (i + 1), xmlDoc.FirstChild.ChildNodes[i],false,m_configSource);
} }
return regionInfos; return regionInfos;

View File

@ -341,7 +341,7 @@ namespace OpenSim
if (cmdparams[1].StartsWith("/") || cmdparams[1].StartsWith("\\") || cmdparams[1].StartsWith("..")) if (cmdparams[1].StartsWith("/") || cmdparams[1].StartsWith("\\") || cmdparams[1].StartsWith(".."))
regionFile = cmdparams[1]; regionFile = cmdparams[1];
CreateRegion(new RegionInfo(cmdparams[0], regionFile, false), true); CreateRegion(new RegionInfo(cmdparams[0], regionFile, false, ConfigSource.Source), true);
break; break;
case "remove-region": case "remove-region":

View File

@ -370,10 +370,25 @@ namespace OpenSim.Region.Environment.Scenes
try try
{ {
// Region config overrides global config
//
IConfig startupConfig = m_config.Configs["Startup"]; IConfig startupConfig = m_config.Configs["Startup"];
m_maxNonphys = startupConfig.GetFloat("NonPhysicalPrimMax", 65536.0f); m_maxNonphys = startupConfig.GetFloat("NonPhysicalPrimMax", 65536.0f);
if (RegionInfo.NonphysPrimMax > 0)
m_maxNonphys = RegionInfo.NonphysPrimMax;
m_maxPhys = startupConfig.GetFloat("PhysicalPrimMax", 10.0f); m_maxPhys = startupConfig.GetFloat("PhysicalPrimMax", 10.0f);
if (RegionInfo.PhysPrimMax > 0)
m_maxPhys = RegionInfo.PhysPrimMax;
// Here, if clamping is requested in either global or
// local config, it will be used
//
m_clampPrimSize = startupConfig.GetBoolean("ClampPrimSize", false); m_clampPrimSize = startupConfig.GetBoolean("ClampPrimSize", false);
if (RegionInfo.ClampPrimSize)
m_clampPrimSize = true;
m_trustBinaries = startupConfig.GetBoolean("TrustBinaries", false); m_trustBinaries = startupConfig.GetBoolean("TrustBinaries", false);
m_allowScriptCrossings = startupConfig.GetBoolean("AllowScriptCrossing", false); m_allowScriptCrossings = startupConfig.GetBoolean("AllowScriptCrossing", false);
m_dontPersistBefore = m_dontPersistBefore =
@ -3290,6 +3305,11 @@ namespace OpenSim.Region.Environment.Scenes
public void SetObjectCapacity(int objects) public void SetObjectCapacity(int objects)
{ {
// Region specific config overrides global
//
if (RegionInfo.ObjectCapacity != 0)
objects = RegionInfo.ObjectCapacity;
if (m_statsReporter != null) if (m_statsReporter != null)
{ {
m_statsReporter.SetObjectCapacity(objects); m_statsReporter.SetObjectCapacity(objects);