diff options
Diffstat (limited to '')
4 files changed, 64 insertions, 28 deletions
diff --git a/OpenSim/Framework/General/Configuration/ConfigurationMember.cs b/OpenSim/Framework/General/Configuration/ConfigurationMember.cs index 8106d5a..e93a576 100644 --- a/OpenSim/Framework/General/Configuration/ConfigurationMember.cs +++ b/OpenSim/Framework/General/Configuration/ConfigurationMember.cs | |||
@@ -12,7 +12,7 @@ namespace OpenSim.Framework.Configuration | |||
12 | { | 12 | { |
13 | public class ConfigurationMember | 13 | public class ConfigurationMember |
14 | { | 14 | { |
15 | public delegate void ConfigurationOptionResult(string configuration_key, object configuration_result); | 15 | public delegate bool ConfigurationOptionResult(string configuration_key, object configuration_result); |
16 | public delegate void ConfigurationOptionsLoad(); | 16 | public delegate void ConfigurationOptionsLoad(); |
17 | 17 | ||
18 | private List<ConfigurationOption> configurationOptions = new List<ConfigurationOption>(); | 18 | private List<ConfigurationOption> configurationOptions = new List<ConfigurationOption>(); |
@@ -44,13 +44,14 @@ namespace OpenSim.Framework.Configuration | |||
44 | resultFunction = result; | 44 | resultFunction = result; |
45 | } | 45 | } |
46 | 46 | ||
47 | public void addConfigurationOption(string configuration_key, ConfigurationOption.ConfigurationTypes configuration_type, string configuration_question, string configuration_default) | 47 | public void addConfigurationOption(string configuration_key, ConfigurationOption.ConfigurationTypes configuration_type, string configuration_question, string configuration_default, bool use_default_no_prompt) |
48 | { | 48 | { |
49 | ConfigurationOption configOption = new ConfigurationOption(); | 49 | ConfigurationOption configOption = new ConfigurationOption(); |
50 | configOption.configurationKey = configuration_key; | 50 | configOption.configurationKey = configuration_key; |
51 | configOption.configurationQuestion = configuration_question; | 51 | configOption.configurationQuestion = configuration_question; |
52 | configOption.configurationDefault = configuration_default; | 52 | configOption.configurationDefault = configuration_default; |
53 | configOption.configurationType = configuration_type; | 53 | configOption.configurationType = configuration_type; |
54 | configOption.configurationUseDefaultNoPrompt = use_default_no_prompt; | ||
54 | 55 | ||
55 | if (configuration_key != "" && configuration_question != "") | 56 | if (configuration_key != "" && configuration_question != "") |
56 | { | 57 | { |
@@ -116,7 +117,8 @@ namespace OpenSim.Framework.Configuration | |||
116 | bool ignoreNextFromConfig = false; | 117 | bool ignoreNextFromConfig = false; |
117 | while (convertSuccess == false) | 118 | while (convertSuccess == false) |
118 | { | 119 | { |
119 | 120 | ||
121 | string console_result = ""; | ||
120 | string attribute = null; | 122 | string attribute = null; |
121 | if (useFile) | 123 | if (useFile) |
122 | { | 124 | { |
@@ -130,17 +132,24 @@ namespace OpenSim.Framework.Configuration | |||
130 | } | 132 | } |
131 | } | 133 | } |
132 | 134 | ||
133 | string console_result = ""; | ||
134 | if (attribute == null) | 135 | if (attribute == null) |
135 | { | 136 | { |
136 | if (configurationDescription.Trim() != "") | 137 | if (configOption.configurationUseDefaultNoPrompt) |
137 | { | 138 | { |
138 | console_result = MainLog.Instance.CmdPrompt(configurationDescription + ": " + configOption.configurationQuestion, configOption.configurationDefault); | 139 | console_result = configOption.configurationDefault; |
139 | } | 140 | } |
140 | else | 141 | else |
141 | { | 142 | { |
142 | console_result = MainLog.Instance.CmdPrompt(configOption.configurationQuestion, configOption.configurationDefault); | 143 | |
143 | } | 144 | if (configurationDescription.Trim() != "") |
145 | { | ||
146 | console_result = MainLog.Instance.CmdPrompt(configurationDescription + ": " + configOption.configurationQuestion, configOption.configurationDefault); | ||
147 | } | ||
148 | else | ||
149 | { | ||
150 | console_result = MainLog.Instance.CmdPrompt(configOption.configurationQuestion, configOption.configurationDefault); | ||
151 | } | ||
152 | } | ||
144 | } | 153 | } |
145 | else | 154 | else |
146 | { | 155 | { |
@@ -153,6 +162,14 @@ namespace OpenSim.Framework.Configuration | |||
153 | return_result = console_result; | 162 | return_result = console_result; |
154 | convertSuccess = true; | 163 | convertSuccess = true; |
155 | break; | 164 | break; |
165 | case ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY: | ||
166 | if (console_result.Length > 0) | ||
167 | { | ||
168 | return_result = console_result; | ||
169 | convertSuccess = true; | ||
170 | } | ||
171 | errorMessage = "a string that is not empty"; | ||
172 | break; | ||
156 | case ConfigurationOption.ConfigurationTypes.TYPE_BOOLEAN: | 173 | case ConfigurationOption.ConfigurationTypes.TYPE_BOOLEAN: |
157 | bool boolResult; | 174 | bool boolResult; |
158 | if (Boolean.TryParse(console_result, out boolResult)) | 175 | if (Boolean.TryParse(console_result, out boolResult)) |
@@ -290,13 +307,26 @@ namespace OpenSim.Framework.Configuration | |||
290 | xmlConfig.SetAttribute(configOption.configurationKey, console_result); | 307 | xmlConfig.SetAttribute(configOption.configurationKey, console_result); |
291 | } | 308 | } |
292 | 309 | ||
293 | 310 | ||
294 | this.resultFunction(configOption.configurationKey, return_result); | 311 | if (!this.resultFunction(configOption.configurationKey, return_result)) |
312 | { | ||
313 | Console.MainLog.Instance.Notice("The handler for the last configuration option denied that input, please try again."); | ||
314 | convertSuccess = false; | ||
315 | ignoreNextFromConfig = true; | ||
316 | } | ||
295 | } | 317 | } |
296 | else | 318 | else |
297 | { | 319 | { |
298 | MainLog.Instance.Warn("Incorrect result given, the configuration option must be " + errorMessage + ". Prompting for same option..."); | 320 | if (configOption.configurationUseDefaultNoPrompt) |
299 | ignoreNextFromConfig = true; | 321 | { |
322 | MainLog.Instance.Error("Default given for '" + configOption.configurationKey + "' is not valid; the configuration result must be " + errorMessage + ". Will skip this option..."); | ||
323 | convertSuccess = true; | ||
324 | } | ||
325 | else | ||
326 | { | ||
327 | MainLog.Instance.Warn("Incorrect result given, the configuration option must be " + errorMessage + ". Prompting for same option..."); | ||
328 | ignoreNextFromConfig = true; | ||
329 | } | ||
300 | } | 330 | } |
301 | } | 331 | } |
302 | } | 332 | } |
diff --git a/OpenSim/Framework/General/Configuration/ConfigurationOption.cs b/OpenSim/Framework/General/Configuration/ConfigurationOption.cs index 15da1aa..38f60a0 100644 --- a/OpenSim/Framework/General/Configuration/ConfigurationOption.cs +++ b/OpenSim/Framework/General/Configuration/ConfigurationOption.cs | |||
@@ -9,6 +9,7 @@ namespace OpenSim.Framework.Configuration | |||
9 | public enum ConfigurationTypes | 9 | public enum ConfigurationTypes |
10 | { | 10 | { |
11 | TYPE_STRING, | 11 | TYPE_STRING, |
12 | TYPE_STRING_NOT_EMPTY, | ||
12 | TYPE_UINT16, | 13 | TYPE_UINT16, |
13 | TYPE_UINT32, | 14 | TYPE_UINT32, |
14 | TYPE_UINT64, | 15 | TYPE_UINT64, |
@@ -30,5 +31,6 @@ namespace OpenSim.Framework.Configuration | |||
30 | public string configurationDefault = ""; | 31 | public string configurationDefault = ""; |
31 | 32 | ||
32 | public ConfigurationTypes configurationType = ConfigurationTypes.TYPE_STRING; | 33 | public ConfigurationTypes configurationType = ConfigurationTypes.TYPE_STRING; |
34 | public bool configurationUseDefaultNoPrompt = false; | ||
33 | } | 35 | } |
34 | } | 36 | } |
diff --git a/OpenSim/Framework/General/Configuration/GridConfig.cs b/OpenSim/Framework/General/Configuration/GridConfig.cs index 97dd699..0a7f65c 100644 --- a/OpenSim/Framework/General/Configuration/GridConfig.cs +++ b/OpenSim/Framework/General/Configuration/GridConfig.cs | |||
@@ -27,21 +27,21 @@ namespace OpenSim.Framework.Configuration | |||
27 | 27 | ||
28 | public void loadConfigurationOptions() | 28 | public void loadConfigurationOptions() |
29 | { | 29 | { |
30 | configMember.addConfigurationOption("grid_owner",ConfigurationOption.ConfigurationTypes.TYPE_STRING,"OGS Grid Owner","OGS development team"); | 30 | configMember.addConfigurationOption("grid_owner", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "OGS Grid Owner", "OGS development team", false); |
31 | configMember.addConfigurationOption("default_asset_server",ConfigurationOption.ConfigurationTypes.TYPE_STRING,"Default Asset Server URI","http://127.0.0.1:8003/"); | 31 | configMember.addConfigurationOption("default_asset_server", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "Default Asset Server URI", "http://127.0.0.1:8003/", false); |
32 | configMember.addConfigurationOption("asset_send_key",ConfigurationOption.ConfigurationTypes.TYPE_STRING,"Key to send to asset server","null"); | 32 | configMember.addConfigurationOption("asset_send_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING, "Key to send to asset server", "null", false); |
33 | configMember.addConfigurationOption("asset_recv_key",ConfigurationOption.ConfigurationTypes.TYPE_STRING,"Key to expect from asset server","null"); | 33 | configMember.addConfigurationOption("asset_recv_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING, "Key to expect from asset server", "null", false); |
34 | 34 | ||
35 | configMember.addConfigurationOption("default_user_server",ConfigurationOption.ConfigurationTypes.TYPE_STRING,"Default User Server URI","http://127.0.0.1:8002/"); | 35 | configMember.addConfigurationOption("default_user_server", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "Default User Server URI", "http://127.0.0.1:8002/", false); |
36 | configMember.addConfigurationOption("user_send_key",ConfigurationOption.ConfigurationTypes.TYPE_STRING,"Key to send to user server","null"); | 36 | configMember.addConfigurationOption("user_send_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING, "Key to send to user server", "null", false); |
37 | configMember.addConfigurationOption("user_recv_key",ConfigurationOption.ConfigurationTypes.TYPE_STRING,"Key to expect from user server","null"); | 37 | configMember.addConfigurationOption("user_recv_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING, "Key to expect from user server", "null", false); |
38 | 38 | ||
39 | configMember.addConfigurationOption("sim_send_key",ConfigurationOption.ConfigurationTypes.TYPE_STRING,"Key to send to a simulator","null"); | 39 | configMember.addConfigurationOption("sim_send_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING, "Key to send to a simulator", "null", false); |
40 | configMember.addConfigurationOption("sim_recv_key",ConfigurationOption.ConfigurationTypes.TYPE_STRING,"Key to expect from a simulator","null"); | 40 | configMember.addConfigurationOption("sim_recv_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING, "Key to expect from a simulator", "null", false); |
41 | 41 | ||
42 | } | 42 | } |
43 | 43 | ||
44 | public void handleIncomingConfiguration(string configuration_key, object configuration_result) | 44 | public bool handleIncomingConfiguration(string configuration_key, object configuration_result) |
45 | { | 45 | { |
46 | switch (configuration_key) | 46 | switch (configuration_key) |
47 | { | 47 | { |
@@ -73,6 +73,8 @@ namespace OpenSim.Framework.Configuration | |||
73 | this.SimRecvKey = (string)configuration_result; | 73 | this.SimRecvKey = (string)configuration_result; |
74 | break; | 74 | break; |
75 | } | 75 | } |
76 | |||
77 | return true; | ||
76 | } | 78 | } |
77 | } | 79 | } |
78 | } | 80 | } |
diff --git a/OpenSim/Framework/General/Configuration/UserConfig.cs b/OpenSim/Framework/General/Configuration/UserConfig.cs index 9d607b3..a027ffc 100644 --- a/OpenSim/Framework/General/Configuration/UserConfig.cs +++ b/OpenSim/Framework/General/Configuration/UserConfig.cs | |||
@@ -24,16 +24,16 @@ namespace OpenSim.Framework.Configuration | |||
24 | 24 | ||
25 | public void loadConfigurationOptions() | 25 | public void loadConfigurationOptions() |
26 | { | 26 | { |
27 | configMember.addConfigurationOption("default_startup_message",ConfigurationOption.ConfigurationTypes.TYPE_STRING,"Default Startup Message","Welcome to OGS"); | 27 | configMember.addConfigurationOption("default_startup_message", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "Default Startup Message", "Welcome to OGS",false); |
28 | 28 | ||
29 | configMember.addConfigurationOption("default_grid_server",ConfigurationOption.ConfigurationTypes.TYPE_STRING,"Default Grid Server URI","http://127.0.0.1:8001/"); | 29 | configMember.addConfigurationOption("default_grid_server", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "Default Grid Server URI", "http://127.0.0.1:8001/", false); |
30 | configMember.addConfigurationOption("grid_send_key",ConfigurationOption.ConfigurationTypes.TYPE_STRING,"Key to send to grid server","null"); | 30 | configMember.addConfigurationOption("grid_send_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING, "Key to send to grid server", "null", false); |
31 | configMember.addConfigurationOption("grid_recv_key",ConfigurationOption.ConfigurationTypes.TYPE_STRING,"Key to expect from grid server","null"); | 31 | configMember.addConfigurationOption("grid_recv_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING, "Key to expect from grid server", "null", false); |
32 | 32 | ||
33 | 33 | ||
34 | } | 34 | } |
35 | 35 | ||
36 | public void handleIncomingConfiguration(string configuration_key, object configuration_result) | 36 | public bool handleIncomingConfiguration(string configuration_key, object configuration_result) |
37 | { | 37 | { |
38 | switch (configuration_key) | 38 | switch (configuration_key) |
39 | { | 39 | { |
@@ -50,6 +50,8 @@ namespace OpenSim.Framework.Configuration | |||
50 | this.GridRecvKey = (string)configuration_result; | 50 | this.GridRecvKey = (string)configuration_result; |
51 | break; | 51 | break; |
52 | } | 52 | } |
53 | |||
54 | return true; | ||
53 | } | 55 | } |
54 | } | 56 | } |
55 | } | 57 | } |