*Added ability to skip any use of the console when configuring and assume default value. This is useful when the server is running by itself and a new region request is added without sufficient information

afrisby
mingchen 2008-01-04 14:14:15 +00:00
parent f0b149dfc1
commit 81b4c7be3e
12 changed files with 22 additions and 20 deletions

View File

@ -45,7 +45,7 @@ namespace OpenSim.Framework
public AssetConfig(string description, string filename) public AssetConfig(string description, string filename)
{ {
configMember = configMember =
new ConfigurationMember(filename, description, loadConfigurationOptions, handleIncomingConfiguration); new ConfigurationMember(filename, description, loadConfigurationOptions, handleIncomingConfiguration, true);
configMember.performConfigurationRetrieve(); configMember.performConfigurationRetrieve();
} }

View File

@ -38,7 +38,7 @@ namespace OpenSim.Framework.Configuration.HTTP
{ {
configMember = configMember =
new ConfigurationMember(filename, "REMOTE CONFIG SETTINGS", loadConfigurationOptions, new ConfigurationMember(filename, "REMOTE CONFIG SETTINGS", loadConfigurationOptions,
handleIncomingConfiguration); handleIncomingConfiguration,true);
configMember.forceConfigurationPluginLibrary("OpenSim.Framework.Configuration.XML.dll"); configMember.forceConfigurationPluginLibrary("OpenSim.Framework.Configuration.XML.dll");
configMember.performConfigurationRetrieve(); configMember.performConfigurationRetrieve();
} }

View File

@ -51,29 +51,31 @@ namespace OpenSim.Framework
private ConfigurationOptionResult resultFunction; private ConfigurationOptionResult resultFunction;
private IGenericConfig configurationPlugin = null; private IGenericConfig configurationPlugin = null;
private bool useConsoleToPromptOnError = true;
/// <summary> /// <summary>
/// This is the default configuration DLL loaded /// This is the default configuration DLL loaded
/// </summary> /// </summary>
private string configurationPluginFilename = "OpenSim.Framework.Configuration.XML.dll"; private string configurationPluginFilename = "OpenSim.Framework.Configuration.XML.dll";
public ConfigurationMember(string configuration_filename, string configuration_description, public ConfigurationMember(string configuration_filename, string configuration_description,
ConfigurationOptionsLoad load_function, ConfigurationOptionResult result_function) ConfigurationOptionsLoad load_function, ConfigurationOptionResult result_function, bool use_console_to_prompt_on_error)
{ {
configurationFilename = configuration_filename; configurationFilename = configuration_filename;
configurationDescription = configuration_description; configurationDescription = configuration_description;
loadFunction = load_function; loadFunction = load_function;
resultFunction = result_function; resultFunction = result_function;
useConsoleToPromptOnError = use_console_to_prompt_on_error;
} }
public ConfigurationMember(XmlNode configuration_xml, string configuration_description, public ConfigurationMember(XmlNode configuration_xml, string configuration_description,
ConfigurationOptionsLoad load_function, ConfigurationOptionResult result_function) ConfigurationOptionsLoad load_function, ConfigurationOptionResult result_function, bool use_console_to_prompt_on_error)
{ {
configurationFilename = ""; configurationFilename = "";
configurationFromXMLNode = configuration_xml; configurationFromXMLNode = configuration_xml;
configurationDescription = configuration_description; configurationDescription = configuration_description;
loadFunction = load_function; loadFunction = load_function;
resultFunction = result_function; resultFunction = result_function;
useConsoleToPromptOnError = use_console_to_prompt_on_error;
} }
public void setConfigurationFilename(string filename) public void setConfigurationFilename(string filename)
@ -231,7 +233,7 @@ namespace OpenSim.Framework
if (attribute == null) if (attribute == null)
{ {
if (configOption.configurationUseDefaultNoPrompt) if (configOption.configurationUseDefaultNoPrompt || useConsoleToPromptOnError == false)
{ {
console_result = configOption.configurationDefault; console_result = configOption.configurationDefault;
} }

View File

@ -749,7 +749,7 @@ namespace OpenSim.Framework
{ {
configMember = configMember =
new ConfigurationMember(Path.Combine(Util.configDir(), "estate_settings.xml"), "ESTATE SETTINGS", new ConfigurationMember(Path.Combine(Util.configDir(), "estate_settings.xml"), "ESTATE SETTINGS",
loadConfigurationOptions, handleIncomingConfiguration); loadConfigurationOptions, handleIncomingConfiguration,true);
configMember.performConfigurationRetrieve(); configMember.performConfigurationRetrieve();
} }
} }

View File

@ -55,7 +55,7 @@ namespace OpenSim.Framework
public GridConfig(string description, string filename) public GridConfig(string description, string filename)
{ {
configMember = configMember =
new ConfigurationMember(filename, description, loadConfigurationOptions, handleIncomingConfiguration); new ConfigurationMember(filename, description, loadConfigurationOptions, handleIncomingConfiguration, true);
configMember.performConfigurationRetrieve(); configMember.performConfigurationRetrieve();
} }

View File

@ -48,7 +48,7 @@ namespace OpenSim.Framework
public InventoryConfig(string description, string filename) public InventoryConfig(string description, string filename)
{ {
configMember = configMember =
new ConfigurationMember(filename, description, loadConfigurationOptions, handleIncomingConfiguration); new ConfigurationMember(filename, description, loadConfigurationOptions, handleIncomingConfiguration, true);
configMember.performConfigurationRetrieve(); configMember.performConfigurationRetrieve();
} }

View File

@ -187,17 +187,17 @@ namespace OpenSim.Framework
public ConfigurationMember configMember; public ConfigurationMember configMember;
public RegionInfo(string description, string filename) public RegionInfo(string description, string filename, bool skipConsoleConfig)
{ {
configMember = configMember =
new ConfigurationMember(filename, description, loadConfigurationOptions, handleIncomingConfiguration); new ConfigurationMember(filename, description, loadConfigurationOptions, handleIncomingConfiguration,!skipConsoleConfig);
configMember.performConfigurationRetrieve(); configMember.performConfigurationRetrieve();
} }
public RegionInfo(string description, XmlNode xmlNode) public RegionInfo(string description, XmlNode xmlNode, bool skipConsoleConfig)
{ {
configMember = configMember =
new ConfigurationMember(xmlNode, description, loadConfigurationOptions, handleIncomingConfiguration); new ConfigurationMember(xmlNode, description, loadConfigurationOptions, handleIncomingConfiguration, !skipConsoleConfig);
configMember.performConfigurationRetrieve(); configMember.performConfigurationRetrieve();
} }

View File

@ -49,14 +49,14 @@ namespace OpenSim.Framework.RegionLoader.Filesystem
if (configFiles.Length == 0) if (configFiles.Length == 0)
{ {
new RegionInfo("DEFAULT REGION CONFIG", Path.Combine(regionConfigPath, "default.xml")); new RegionInfo("DEFAULT REGION CONFIG", Path.Combine(regionConfigPath, "default.xml"),false);
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]); RegionInfo regionInfo = new RegionInfo("REGION CONFIG #" + (i + 1), configFiles[i],false);
regionInfos[i] = regionInfo; regionInfos[i] = regionInfo;
} }

View File

@ -86,7 +86,7 @@ namespace OpenSim.Framework.RegionLoader.Web
{ {
MainLog.Instance.Debug(xmlDoc.FirstChild.ChildNodes[i].OuterXml); MainLog.Instance.Debug(xmlDoc.FirstChild.ChildNodes[i].OuterXml);
regionInfos[i] = regionInfos[i] =
new RegionInfo("REGION CONFIG #" + (i + 1), xmlDoc.FirstChild.ChildNodes[i]); new RegionInfo("REGION CONFIG #" + (i + 1), xmlDoc.FirstChild.ChildNodes[i],false);
} }
return regionInfos; return regionInfos;

View File

@ -54,7 +54,7 @@ namespace OpenSim.Framework
public UserConfig(string description, string filename) public UserConfig(string description, string filename)
{ {
configMember = configMember =
new ConfigurationMember(filename, description, loadConfigurationOptions, handleIncomingConfiguration); new ConfigurationMember(filename, description, loadConfigurationOptions, handleIncomingConfiguration,true);
configMember.performConfigurationRetrieve(); configMember.performConfigurationRetrieve();
} }

View File

@ -394,7 +394,7 @@ namespace OpenSim
private static void CreateDefaultRegionInfoXml(string fileName) private static void CreateDefaultRegionInfoXml(string fileName)
{ {
new RegionInfo("DEFAULT REGION CONFIG", fileName); new RegionInfo("DEFAULT REGION CONFIG", fileName,false);
} }
protected override StorageManager CreateStorageManager(string connectionstring) protected override StorageManager CreateStorageManager(string connectionstring)
@ -771,7 +771,7 @@ namespace OpenSim
break; break;
case "create-region": case "create-region":
CreateRegion(new RegionInfo(cmdparams[0], "Regions/" + cmdparams[1])); CreateRegion(new RegionInfo(cmdparams[0], "Regions/" + cmdparams[1],false));
break; break;
case "remove-region": case "remove-region":

View File

@ -61,7 +61,7 @@ namespace OpenSim.Tools.Export
public static void Main(string[] args) public static void Main(string[] args)
{ {
OpenSimExport export = new OpenSimExport(InitConfig(args)); OpenSimExport export = new OpenSimExport(InitConfig(args));
RegionInfo reg = new RegionInfo("Sara Jane", "Regions/1000-1000.xml"); RegionInfo reg = new RegionInfo("Sara Jane", "Regions/1000-1000.xml",false);
Console.WriteLine("This application does nothing useful yet: " + reg.RegionID); Console.WriteLine("This application does nothing useful yet: " + reg.RegionID);
foreach (SceneObjectGroup group in export.sman.DataStore.LoadObjects(reg.RegionID)) foreach (SceneObjectGroup group in export.sman.DataStore.LoadObjects(reg.RegionID))