diff options
author | mingchen | 2007-07-18 23:15:08 +0000 |
---|---|---|
committer | mingchen | 2007-07-18 23:15:08 +0000 |
commit | 222becc8795d8abd8263c8abf8212de91faa4748 (patch) | |
tree | ac0eb1b420c2f60975b759296c94813f41925798 /OpenSim | |
parent | * Reverting 1371 (diff) | |
download | opensim-SC-222becc8795d8abd8263c8abf8212de91faa4748.zip opensim-SC-222becc8795d8abd8263c8abf8212de91faa4748.tar.gz opensim-SC-222becc8795d8abd8263c8abf8212de91faa4748.tar.bz2 opensim-SC-222becc8795d8abd8263c8abf8212de91faa4748.tar.xz |
*New Configuration System, much easier and less buggy compared to the original system in place
*View RegionInfo.cs for an example on how it works!
*This hopefully copies all the files over, but who knows :)
Diffstat (limited to '')
19 files changed, 788 insertions, 599 deletions
diff --git a/OpenSim/Framework/General/AgentCircuitManager.cs b/OpenSim/Framework/General/AgentCircuitManager.cs index c19d6b1..10b0430 100644 --- a/OpenSim/Framework/General/AgentCircuitManager.cs +++ b/OpenSim/Framework/General/AgentCircuitManager.cs | |||
@@ -30,7 +30,7 @@ using libsecondlife; | |||
30 | using OpenSim.Framework.Interfaces; | 30 | using OpenSim.Framework.Interfaces; |
31 | using OpenSim.Framework.Types; | 31 | using OpenSim.Framework.Types; |
32 | 32 | ||
33 | namespace OpenSim.Framework | 33 | namespace OpenSim.Framework.Types |
34 | { | 34 | { |
35 | public class AgentCircuitManager | 35 | public class AgentCircuitManager |
36 | { | 36 | { |
diff --git a/OpenSim/Framework/General/Configuration/ConfigurationMember.cs b/OpenSim/Framework/General/Configuration/ConfigurationMember.cs new file mode 100644 index 0000000..2d945b5 --- /dev/null +++ b/OpenSim/Framework/General/Configuration/ConfigurationMember.cs | |||
@@ -0,0 +1,311 @@ | |||
1 | using System; | ||
2 | using System.Collections; | ||
3 | using System.Collections.Generic; | ||
4 | using System.Text; | ||
5 | using System.Net; | ||
6 | |||
7 | using libsecondlife; | ||
8 | |||
9 | using OpenSim.Framework.Console; | ||
10 | |||
11 | namespace OpenSim.Framework.Configuration | ||
12 | { | ||
13 | public class ConfigurationMember | ||
14 | { | ||
15 | public delegate void ConfigurationOptionResult(string configuration_key, object configuration_result); | ||
16 | public delegate void ConfigurationOptionsLoad(); | ||
17 | |||
18 | private List<ConfigurationOption> configurationOptions = new List<ConfigurationOption>(); | ||
19 | private string configurationFilename = ""; | ||
20 | private string configurationDescription = ""; | ||
21 | |||
22 | private ConfigurationOptionsLoad loadFunction; | ||
23 | private ConfigurationOptionResult resultFunction; | ||
24 | |||
25 | public ConfigurationMember(string configuration_filename, string configuration_description, ConfigurationOptionsLoad load_function, ConfigurationOptionResult result_function) | ||
26 | { | ||
27 | this.configurationFilename = configuration_filename; | ||
28 | this.configurationDescription = configuration_description; | ||
29 | this.loadFunction = load_function; | ||
30 | this.resultFunction = result_function; | ||
31 | } | ||
32 | |||
33 | public void setConfigurationFilename(string filename) | ||
34 | { | ||
35 | configurationFilename = filename; | ||
36 | } | ||
37 | public void setConfigurationDescription(string desc) | ||
38 | { | ||
39 | configurationDescription = desc; | ||
40 | } | ||
41 | |||
42 | public void setConfigurationResultFunction(ConfigurationOptionResult result) | ||
43 | { | ||
44 | resultFunction = result; | ||
45 | } | ||
46 | |||
47 | public void addConfigurationOption(string configuration_key, ConfigurationOption.ConfigurationTypes configuration_type, string configuration_question, string configuration_default) | ||
48 | { | ||
49 | ConfigurationOption configOption = new ConfigurationOption(); | ||
50 | configOption.configurationKey = configuration_key; | ||
51 | configOption.configurationQuestion = configuration_question; | ||
52 | configOption.configurationDefault = configuration_default; | ||
53 | configOption.configurationType = configuration_type; | ||
54 | |||
55 | if (configuration_key != "" && configuration_question != "" && configuration_type != null) | ||
56 | { | ||
57 | if (!configurationOptions.Contains(configOption)) | ||
58 | { | ||
59 | configurationOptions.Add(configOption); | ||
60 | } | ||
61 | } | ||
62 | else | ||
63 | { | ||
64 | MainLog.Instance.Notice("Required fields for adding a configuration option is invalid. Will not add this option (" + configuration_key + ")"); | ||
65 | } | ||
66 | } | ||
67 | |||
68 | public void performConfigurationRetrieve() | ||
69 | { | ||
70 | configurationOptions.Clear(); | ||
71 | if(loadFunction == null) | ||
72 | { | ||
73 | MainLog.Instance.Error("Load Function for '" + this.configurationDescription + "' is null. Refusing to run configuration."); | ||
74 | return; | ||
75 | } | ||
76 | |||
77 | if(resultFunction == null) | ||
78 | { | ||
79 | MainLog.Instance.Error("Result Function for '" + this.configurationDescription + "' is null. Refusing to run configuration."); | ||
80 | return; | ||
81 | } | ||
82 | |||
83 | MainLog.Instance.Verbose("Calling Configuration Load Function..."); | ||
84 | this.loadFunction(); | ||
85 | |||
86 | if(configurationOptions.Count <= 0) | ||
87 | { | ||
88 | MainLog.Instance.Error("No configuration options were specified for '" + this.configurationOptions + "'. Refusing to continue configuration."); | ||
89 | return; | ||
90 | } | ||
91 | |||
92 | bool useFile = true; | ||
93 | XmlConfiguration xmlConfig = null; | ||
94 | if (configurationFilename.Trim() != "") | ||
95 | { | ||
96 | xmlConfig = new XmlConfiguration(configurationFilename); | ||
97 | |||
98 | } | ||
99 | |||
100 | if(xmlConfig != null) | ||
101 | { | ||
102 | xmlConfig.LoadData(); | ||
103 | useFile = true; | ||
104 | } | ||
105 | else | ||
106 | { | ||
107 | MainLog.Instance.Notice("XML Configuration Filename is not valid; will not save to the file."); | ||
108 | useFile = false; | ||
109 | } | ||
110 | |||
111 | foreach (ConfigurationOption configOption in configurationOptions) | ||
112 | { | ||
113 | bool convertSuccess = false; | ||
114 | object return_result = null; | ||
115 | string errorMessage = ""; | ||
116 | bool ignoreNextFromConfig = false; | ||
117 | while (convertSuccess == false) | ||
118 | { | ||
119 | |||
120 | string attribute = null; | ||
121 | if (useFile) | ||
122 | { | ||
123 | if (!ignoreNextFromConfig) | ||
124 | { | ||
125 | attribute = xmlConfig.GetAttribute(configOption.configurationKey); | ||
126 | } | ||
127 | else | ||
128 | { | ||
129 | ignoreNextFromConfig = false; | ||
130 | } | ||
131 | } | ||
132 | |||
133 | string console_result = ""; | ||
134 | if (attribute == null) | ||
135 | { | ||
136 | if (configurationDescription.Trim() != "") | ||
137 | { | ||
138 | console_result = MainLog.Instance.CmdPrompt(configurationDescription + ": " + configOption.configurationQuestion, configOption.configurationDefault); | ||
139 | } | ||
140 | else | ||
141 | { | ||
142 | console_result = MainLog.Instance.CmdPrompt(configOption.configurationQuestion, configOption.configurationDefault); | ||
143 | } | ||
144 | } | ||
145 | else | ||
146 | { | ||
147 | console_result = attribute; | ||
148 | } | ||
149 | |||
150 | switch (configOption.configurationType) | ||
151 | { | ||
152 | case ConfigurationOption.ConfigurationTypes.TYPE_STRING: | ||
153 | return_result = console_result; | ||
154 | convertSuccess = true; | ||
155 | break; | ||
156 | case ConfigurationOption.ConfigurationTypes.TYPE_BOOLEAN: | ||
157 | bool boolResult; | ||
158 | if (Boolean.TryParse(console_result, out boolResult)) | ||
159 | { | ||
160 | convertSuccess = true; | ||
161 | return_result = boolResult; | ||
162 | } | ||
163 | errorMessage = "'true' or 'false' (Boolean)"; | ||
164 | break; | ||
165 | case ConfigurationOption.ConfigurationTypes.TYPE_BYTE: | ||
166 | byte byteResult; | ||
167 | if (Byte.TryParse(console_result, out byteResult)) | ||
168 | { | ||
169 | convertSuccess = true; | ||
170 | return_result = byteResult; | ||
171 | } | ||
172 | errorMessage = "a byte (Byte)"; | ||
173 | break; | ||
174 | case ConfigurationOption.ConfigurationTypes.TYPE_CHARACTER: | ||
175 | char charResult; | ||
176 | if (Char.TryParse(console_result, out charResult)) | ||
177 | { | ||
178 | convertSuccess = true; | ||
179 | return_result = charResult; | ||
180 | } | ||
181 | errorMessage = "a character (Char)"; | ||
182 | break; | ||
183 | case ConfigurationOption.ConfigurationTypes.TYPE_INT16: | ||
184 | short shortResult; | ||
185 | if (Int16.TryParse(console_result, out shortResult)) | ||
186 | { | ||
187 | convertSuccess = true; | ||
188 | return_result = shortResult; | ||
189 | } | ||
190 | errorMessage = "a signed 32 bit integer (short)"; | ||
191 | break; | ||
192 | case ConfigurationOption.ConfigurationTypes.TYPE_INT32: | ||
193 | int intResult; | ||
194 | if (Int32.TryParse(console_result, out intResult)) | ||
195 | { | ||
196 | convertSuccess = true; | ||
197 | return_result = intResult; | ||
198 | |||
199 | } | ||
200 | errorMessage = "a signed 32 bit integer (int)"; | ||
201 | break; | ||
202 | case ConfigurationOption.ConfigurationTypes.TYPE_INT64: | ||
203 | long longResult; | ||
204 | if (Int64.TryParse(console_result, out longResult)) | ||
205 | { | ||
206 | convertSuccess = true; | ||
207 | return_result = longResult; | ||
208 | } | ||
209 | errorMessage = "a signed 32 bit integer (long)"; | ||
210 | break; | ||
211 | case ConfigurationOption.ConfigurationTypes.TYPE_IP_ADDRESS: | ||
212 | IPAddress ipAddressResult; | ||
213 | if (IPAddress.TryParse(console_result, out ipAddressResult)) | ||
214 | { | ||
215 | convertSuccess = true; | ||
216 | return_result = ipAddressResult; | ||
217 | } | ||
218 | errorMessage = "an IP Address (IPAddress)"; | ||
219 | break; | ||
220 | case ConfigurationOption.ConfigurationTypes.TYPE_LLUUID: | ||
221 | LLUUID uuidResult; | ||
222 | if (LLUUID.TryParse(console_result, out uuidResult)) | ||
223 | { | ||
224 | convertSuccess = true; | ||
225 | return_result = uuidResult; | ||
226 | } | ||
227 | errorMessage = "a UUID (LLUUID)"; | ||
228 | break; | ||
229 | case ConfigurationOption.ConfigurationTypes.TYPE_LLVECTOR3: | ||
230 | LLVector3 vectorResult; | ||
231 | if (LLVector3.TryParse(console_result, out vectorResult)) | ||
232 | { | ||
233 | convertSuccess = true; | ||
234 | return_result = vectorResult; | ||
235 | } | ||
236 | errorMessage = "a vector (LLVector3)"; | ||
237 | break; | ||
238 | case ConfigurationOption.ConfigurationTypes.TYPE_UINT16: | ||
239 | ushort ushortResult; | ||
240 | if (UInt16.TryParse(console_result, out ushortResult)) | ||
241 | { | ||
242 | convertSuccess = true; | ||
243 | return_result = ushortResult; | ||
244 | } | ||
245 | errorMessage = "an unsigned 16 bit integer (ushort)"; | ||
246 | break; | ||
247 | case ConfigurationOption.ConfigurationTypes.TYPE_UINT32: | ||
248 | uint uintResult; | ||
249 | if (UInt32.TryParse(console_result, out uintResult)) | ||
250 | { | ||
251 | convertSuccess = true; | ||
252 | return_result = uintResult; | ||
253 | |||
254 | } | ||
255 | errorMessage = "an unsigned 32 bit integer (uint)"; | ||
256 | break; | ||
257 | case ConfigurationOption.ConfigurationTypes.TYPE_UINT64: | ||
258 | ulong ulongResult; | ||
259 | if (UInt64.TryParse(console_result, out ulongResult)) | ||
260 | { | ||
261 | convertSuccess = true; | ||
262 | return_result = ulongResult; | ||
263 | } | ||
264 | errorMessage = "an unsigned 64 bit integer (ulong)"; | ||
265 | break; | ||
266 | case ConfigurationOption.ConfigurationTypes.TYPE_FLOAT: | ||
267 | float floatResult; | ||
268 | if (float.TryParse(console_result, out floatResult)) | ||
269 | { | ||
270 | convertSuccess = true; | ||
271 | return_result = floatResult; | ||
272 | } | ||
273 | errorMessage = "a single-precision floating point number (float)"; | ||
274 | break; | ||
275 | case ConfigurationOption.ConfigurationTypes.TYPE_DOUBLE: | ||
276 | double doubleResult; | ||
277 | if (Double.TryParse(console_result, out doubleResult)) | ||
278 | { | ||
279 | convertSuccess = true; | ||
280 | return_result = doubleResult; | ||
281 | } | ||
282 | errorMessage = "an double-precision floating point number (double)"; | ||
283 | break; | ||
284 | } | ||
285 | |||
286 | if (convertSuccess) | ||
287 | { | ||
288 | if (useFile) | ||
289 | { | ||
290 | xmlConfig.SetAttribute(configOption.configurationKey, console_result); | ||
291 | } | ||
292 | |||
293 | |||
294 | this.resultFunction(configOption.configurationKey, return_result); | ||
295 | } | ||
296 | else | ||
297 | { | ||
298 | MainLog.Instance.Warn("Incorrect result given, the configuration option must be " + errorMessage + ". Prompting for same option..."); | ||
299 | ignoreNextFromConfig = true; | ||
300 | } | ||
301 | } | ||
302 | } | ||
303 | |||
304 | if(useFile) | ||
305 | { | ||
306 | xmlConfig.Commit(); | ||
307 | xmlConfig.Close(); | ||
308 | } | ||
309 | } | ||
310 | } | ||
311 | } | ||
diff --git a/OpenSim/Framework/General/Configuration/ConfigurationOption.cs b/OpenSim/Framework/General/Configuration/ConfigurationOption.cs new file mode 100644 index 0000000..15da1aa --- /dev/null +++ b/OpenSim/Framework/General/Configuration/ConfigurationOption.cs | |||
@@ -0,0 +1,34 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | |||
5 | namespace OpenSim.Framework.Configuration | ||
6 | { | ||
7 | public class ConfigurationOption | ||
8 | { | ||
9 | public enum ConfigurationTypes | ||
10 | { | ||
11 | TYPE_STRING, | ||
12 | TYPE_UINT16, | ||
13 | TYPE_UINT32, | ||
14 | TYPE_UINT64, | ||
15 | TYPE_INT16, | ||
16 | TYPE_INT32, | ||
17 | TYPE_INT64, | ||
18 | TYPE_IP_ADDRESS, | ||
19 | TYPE_CHARACTER, | ||
20 | TYPE_BOOLEAN, | ||
21 | TYPE_BYTE, | ||
22 | TYPE_LLUUID, | ||
23 | TYPE_LLVECTOR3, | ||
24 | TYPE_FLOAT, | ||
25 | TYPE_DOUBLE | ||
26 | }; | ||
27 | |||
28 | public string configurationKey = ""; | ||
29 | public string configurationQuestion = ""; | ||
30 | public string configurationDefault = ""; | ||
31 | |||
32 | public ConfigurationTypes configurationType = ConfigurationTypes.TYPE_STRING; | ||
33 | } | ||
34 | } | ||
diff --git a/OpenSim/Framework/General/Configuration/GridConfig.cs b/OpenSim/Framework/General/Configuration/GridConfig.cs new file mode 100644 index 0000000..97dd699 --- /dev/null +++ b/OpenSim/Framework/General/Configuration/GridConfig.cs | |||
@@ -0,0 +1,78 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | |||
5 | namespace OpenSim.Framework.Configuration | ||
6 | { | ||
7 | public class GridConfig | ||
8 | { | ||
9 | public string GridOwner = ""; | ||
10 | public string DefaultAssetServer = ""; | ||
11 | public string AssetSendKey = ""; | ||
12 | public string AssetRecvKey = ""; | ||
13 | |||
14 | public string DefaultUserServer = ""; | ||
15 | public string UserSendKey = ""; | ||
16 | public string UserRecvKey = ""; | ||
17 | |||
18 | public string SimSendKey = ""; | ||
19 | public string SimRecvKey = ""; | ||
20 | |||
21 | private ConfigurationMember configMember; | ||
22 | public GridConfig(string description, string filename) | ||
23 | { | ||
24 | configMember = new ConfigurationMember(filename, description, this.loadConfigurationOptions, this.handleIncomingConfiguration); | ||
25 | configMember.performConfigurationRetrieve(); | ||
26 | } | ||
27 | |||
28 | public void loadConfigurationOptions() | ||
29 | { | ||
30 | configMember.addConfigurationOption("grid_owner",ConfigurationOption.ConfigurationTypes.TYPE_STRING,"OGS Grid Owner","OGS development team"); | ||
31 | configMember.addConfigurationOption("default_asset_server",ConfigurationOption.ConfigurationTypes.TYPE_STRING,"Default Asset Server URI","http://127.0.0.1:8003/"); | ||
32 | configMember.addConfigurationOption("asset_send_key",ConfigurationOption.ConfigurationTypes.TYPE_STRING,"Key to send to asset server","null"); | ||
33 | configMember.addConfigurationOption("asset_recv_key",ConfigurationOption.ConfigurationTypes.TYPE_STRING,"Key to expect from asset server","null"); | ||
34 | |||
35 | configMember.addConfigurationOption("default_user_server",ConfigurationOption.ConfigurationTypes.TYPE_STRING,"Default User Server URI","http://127.0.0.1:8002/"); | ||
36 | configMember.addConfigurationOption("user_send_key",ConfigurationOption.ConfigurationTypes.TYPE_STRING,"Key to send to user server","null"); | ||
37 | configMember.addConfigurationOption("user_recv_key",ConfigurationOption.ConfigurationTypes.TYPE_STRING,"Key to expect from user server","null"); | ||
38 | |||
39 | configMember.addConfigurationOption("sim_send_key",ConfigurationOption.ConfigurationTypes.TYPE_STRING,"Key to send to a simulator","null"); | ||
40 | configMember.addConfigurationOption("sim_recv_key",ConfigurationOption.ConfigurationTypes.TYPE_STRING,"Key to expect from a simulator","null"); | ||
41 | |||
42 | } | ||
43 | |||
44 | public void handleIncomingConfiguration(string configuration_key, object configuration_result) | ||
45 | { | ||
46 | switch (configuration_key) | ||
47 | { | ||
48 | case "grid_owner": | ||
49 | this.GridOwner = (string)configuration_result; | ||
50 | break; | ||
51 | case "default_asset_server": | ||
52 | this.DefaultAssetServer = (string)configuration_result; | ||
53 | break; | ||
54 | case "asset_send_key": | ||
55 | this.AssetSendKey = (string)configuration_result; | ||
56 | break; | ||
57 | case "asset_recv_key": | ||
58 | this.AssetRecvKey = (string)configuration_result; | ||
59 | break; | ||
60 | case "default_user_server": | ||
61 | this.DefaultUserServer = (string)configuration_result; | ||
62 | break; | ||
63 | case "user_send_key": | ||
64 | this.UserSendKey = (string)configuration_result; | ||
65 | break; | ||
66 | case "user_recv_key": | ||
67 | this.UserRecvKey = (string)configuration_result; | ||
68 | break; | ||
69 | case "sim_send_key": | ||
70 | this.SimSendKey = (string)configuration_result; | ||
71 | break; | ||
72 | case "sim_recv_key": | ||
73 | this.SimRecvKey = (string)configuration_result; | ||
74 | break; | ||
75 | } | ||
76 | } | ||
77 | } | ||
78 | } | ||
diff --git a/OpenSim/Framework/General/Configuration/Interfaces/IGenericConfig.cs b/OpenSim/Framework/General/Configuration/Interfaces/IGenericConfig.cs new file mode 100644 index 0000000..2c379dd --- /dev/null +++ b/OpenSim/Framework/General/Configuration/Interfaces/IGenericConfig.cs | |||
@@ -0,0 +1,38 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | namespace OpenSim.Framework.Interfaces | ||
29 | { | ||
30 | public interface IGenericConfig | ||
31 | { | ||
32 | void LoadData(); | ||
33 | string GetAttribute(string attributeName); | ||
34 | bool SetAttribute(string attributeName, string attributeValue); | ||
35 | void Commit(); | ||
36 | void Close(); | ||
37 | } | ||
38 | } | ||
diff --git a/OpenSim/Framework/General/Configuration/UserConfig.cs b/OpenSim/Framework/General/Configuration/UserConfig.cs new file mode 100644 index 0000000..9d607b3 --- /dev/null +++ b/OpenSim/Framework/General/Configuration/UserConfig.cs | |||
@@ -0,0 +1,55 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | |||
5 | namespace OpenSim.Framework.Configuration | ||
6 | { | ||
7 | /// <summary> | ||
8 | /// UserConfig -- For User Server Configuration | ||
9 | /// </summary> | ||
10 | public class UserConfig | ||
11 | { | ||
12 | public string DefaultStartupMsg = ""; | ||
13 | public string GridServerURL = ""; | ||
14 | public string GridSendKey = ""; | ||
15 | public string GridRecvKey = ""; | ||
16 | |||
17 | private ConfigurationMember configMember; | ||
18 | |||
19 | public UserConfig(string description, string filename) | ||
20 | { | ||
21 | configMember = new ConfigurationMember(filename, description, this.loadConfigurationOptions, this.handleIncomingConfiguration); | ||
22 | configMember.performConfigurationRetrieve(); | ||
23 | } | ||
24 | |||
25 | public void loadConfigurationOptions() | ||
26 | { | ||
27 | configMember.addConfigurationOption("default_startup_message",ConfigurationOption.ConfigurationTypes.TYPE_STRING,"Default Startup Message","Welcome to OGS"); | ||
28 | |||
29 | configMember.addConfigurationOption("default_grid_server",ConfigurationOption.ConfigurationTypes.TYPE_STRING,"Default Grid Server URI","http://127.0.0.1:8001/"); | ||
30 | configMember.addConfigurationOption("grid_send_key",ConfigurationOption.ConfigurationTypes.TYPE_STRING,"Key to send to grid server","null"); | ||
31 | configMember.addConfigurationOption("grid_recv_key",ConfigurationOption.ConfigurationTypes.TYPE_STRING,"Key to expect from grid server","null"); | ||
32 | |||
33 | |||
34 | } | ||
35 | |||
36 | public void handleIncomingConfiguration(string configuration_key, object configuration_result) | ||
37 | { | ||
38 | switch (configuration_key) | ||
39 | { | ||
40 | case "default_startup_message": | ||
41 | this.DefaultStartupMsg = (string)configuration_result; | ||
42 | break; | ||
43 | case "default_grid_server": | ||
44 | this.GridServerURL = (string)configuration_result; | ||
45 | break; | ||
46 | case "grid_send_key": | ||
47 | this.GridSendKey = (string)configuration_result; | ||
48 | break; | ||
49 | case "grid_recv_key": | ||
50 | this.GridRecvKey = (string)configuration_result; | ||
51 | break; | ||
52 | } | ||
53 | } | ||
54 | } | ||
55 | } | ||
diff --git a/OpenSim/Framework/GenericConfig/Xml/XmlConfig.cs b/OpenSim/Framework/General/Configuration/XmlConfiguration.cs index 2ed8d28..e1f3816 100644 --- a/OpenSim/Framework/GenericConfig/Xml/XmlConfig.cs +++ b/OpenSim/Framework/General/Configuration/XmlConfiguration.cs | |||
@@ -1,122 +1,123 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | 2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSim Project nor the | 12 | * * Neither the name of the OpenSim Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | using System; | 28 | using System; |
29 | using System.IO; | 29 | using System.IO; |
30 | using System.Xml; | 30 | using System.Xml; |
31 | using OpenSim.Framework.Interfaces; | 31 | |
32 | 32 | using OpenSim.Framework.Interfaces; | |
33 | namespace OpenSim.GenericConfig | 33 | |
34 | { | 34 | namespace OpenSim.Framework.Configuration |
35 | public class XmlConfig : IGenericConfig | 35 | { |
36 | { | 36 | public class XmlConfiguration : IGenericConfig |
37 | private XmlDocument doc; | 37 | { |
38 | private XmlNode rootNode; | 38 | private XmlDocument doc; |
39 | private XmlNode configNode; | 39 | private XmlNode rootNode; |
40 | private string fileName; | 40 | private XmlNode configNode; |
41 | private bool createdFile = false; | 41 | private string fileName; |
42 | 42 | private bool createdFile = false; | |
43 | public XmlConfig(string filename) | 43 | |
44 | { | 44 | public XmlConfiguration(string filename) |
45 | fileName = filename; | 45 | { |
46 | } | 46 | fileName = filename; |
47 | 47 | } | |
48 | public void LoadData() | 48 | |
49 | { | 49 | public void LoadData() |
50 | doc = new XmlDocument(); | 50 | { |
51 | 51 | doc = new XmlDocument(); | |
52 | if (File.Exists(fileName)) | 52 | |
53 | { | 53 | if (File.Exists(fileName)) |
54 | XmlTextReader reader = new XmlTextReader(fileName); | 54 | { |
55 | reader.WhitespaceHandling = WhitespaceHandling.None; | 55 | XmlTextReader reader = new XmlTextReader(fileName); |
56 | doc.Load(reader); | 56 | reader.WhitespaceHandling = WhitespaceHandling.None; |
57 | reader.Close(); | 57 | doc.Load(reader); |
58 | } | 58 | reader.Close(); |
59 | else | 59 | } |
60 | { | 60 | else |
61 | createdFile = true; | 61 | { |
62 | rootNode = doc.CreateNode(XmlNodeType.Element, "Root", ""); | 62 | createdFile = true; |
63 | doc.AppendChild(rootNode); | 63 | rootNode = doc.CreateNode(XmlNodeType.Element, "Root", ""); |
64 | configNode = doc.CreateNode(XmlNodeType.Element, "Config", ""); | 64 | doc.AppendChild(rootNode); |
65 | rootNode.AppendChild(configNode); | 65 | configNode = doc.CreateNode(XmlNodeType.Element, "Config", ""); |
66 | } | 66 | rootNode.AppendChild(configNode); |
67 | 67 | } | |
68 | 68 | ||
69 | rootNode = doc.FirstChild; | 69 | |
70 | if (rootNode.Name != "Root") | 70 | rootNode = doc.FirstChild; |
71 | throw new Exception("Error: Invalid .xml File. Missing <Root>"); | 71 | if (rootNode.Name != "Root") |
72 | 72 | throw new Exception("Error: Invalid .xml File. Missing <Root>"); | |
73 | configNode = rootNode.FirstChild; | 73 | |
74 | if (configNode.Name != "Config") | 74 | configNode = rootNode.FirstChild; |
75 | throw new Exception("Error: Invalid .xml File. <Root> first child should be <Config>"); | 75 | if (configNode.Name != "Config") |
76 | 76 | throw new Exception("Error: Invalid .xml File. <Root> first child should be <Config>"); | |
77 | if (createdFile) | 77 | |
78 | { | 78 | if (createdFile) |
79 | this.Commit(); | 79 | { |
80 | } | 80 | this.Commit(); |
81 | } | 81 | } |
82 | 82 | } | |
83 | public string GetAttribute(string attributeName) | 83 | |
84 | { | 84 | public string GetAttribute(string attributeName) |
85 | string result = ""; | 85 | { |
86 | if (configNode.Attributes[attributeName] != null) | 86 | string result = null; |
87 | { | 87 | if (configNode.Attributes[attributeName] != null) |
88 | result = ((XmlAttribute)configNode.Attributes.GetNamedItem(attributeName)).Value; | 88 | { |
89 | } | 89 | result = ((XmlAttribute)configNode.Attributes.GetNamedItem(attributeName)).Value; |
90 | return result; | 90 | } |
91 | } | 91 | return result; |
92 | 92 | } | |
93 | public bool SetAttribute(string attributeName, string attributeValue) | 93 | |
94 | { | 94 | public bool SetAttribute(string attributeName, string attributeValue) |
95 | if (configNode.Attributes[attributeName] != null) | 95 | { |
96 | { | 96 | if (configNode.Attributes[attributeName] != null) |
97 | ((XmlAttribute)configNode.Attributes.GetNamedItem(attributeName)).Value = attributeValue; | 97 | { |
98 | } | 98 | ((XmlAttribute)configNode.Attributes.GetNamedItem(attributeName)).Value = attributeValue; |
99 | else | 99 | } |
100 | { | 100 | else |
101 | XmlAttribute attri; | 101 | { |
102 | attri = doc.CreateAttribute(attributeName); | 102 | XmlAttribute attri; |
103 | attri.Value = attributeValue; | 103 | attri = doc.CreateAttribute(attributeName); |
104 | configNode.Attributes.Append(attri); | 104 | attri.Value = attributeValue; |
105 | } | 105 | configNode.Attributes.Append(attri); |
106 | return true; | 106 | } |
107 | } | 107 | return true; |
108 | 108 | } | |
109 | public void Commit() | 109 | |
110 | { | 110 | public void Commit() |
111 | doc.Save(fileName); | 111 | { |
112 | } | 112 | doc.Save(fileName); |
113 | 113 | } | |
114 | public void Close() | 114 | |
115 | { | 115 | public void Close() |
116 | configNode = null; | 116 | { |
117 | rootNode = null; | 117 | configNode = null; |
118 | doc = null; | 118 | rootNode = null; |
119 | } | 119 | doc = null; |
120 | 120 | } | |
121 | } | 121 | |
122 | } | 122 | } |
123 | } | ||
diff --git a/OpenSim/Framework/General/Types/NetworkServersInfo.cs b/OpenSim/Framework/General/Types/NetworkServersInfo.cs index 6259d7b..40557be 100644 --- a/OpenSim/Framework/General/Types/NetworkServersInfo.cs +++ b/OpenSim/Framework/General/Types/NetworkServersInfo.cs | |||
@@ -28,6 +28,7 @@ | |||
28 | using System; | 28 | using System; |
29 | using OpenSim.Framework.Console; | 29 | using OpenSim.Framework.Console; |
30 | using OpenSim.Framework.Interfaces; | 30 | using OpenSim.Framework.Interfaces; |
31 | using OpenSim.Framework.Configuration; | ||
31 | 32 | ||
32 | namespace OpenSim.Framework.Types | 33 | namespace OpenSim.Framework.Types |
33 | { | 34 | { |
@@ -44,175 +45,76 @@ namespace OpenSim.Framework.Types | |||
44 | public string UserRecvKey = ""; | 45 | public string UserRecvKey = ""; |
45 | public bool isSandbox; | 46 | public bool isSandbox; |
46 | 47 | ||
47 | public uint DefaultHomeLocX = 1000; | 48 | public uint DefaultHomeLocX = 0; |
48 | public uint DefaultHomeLocY = 1000; | 49 | public uint DefaultHomeLocY = 0; |
49 | 50 | ||
50 | public int HttpListenerPort = 9000; | 51 | public int HttpListenerPort = 9000; |
51 | public int RemotingListenerPort = 8895; | 52 | public int RemotingListenerPort = 8895; |
52 | 53 | ||
53 | public void InitConfig(bool sandboxMode, IGenericConfig configData) | 54 | private ConfigurationMember configMember; |
54 | { | ||
55 | this.isSandbox = sandboxMode; | ||
56 | |||
57 | try | ||
58 | { | ||
59 | string attri = ""; | ||
60 | |||
61 | attri = ""; | ||
62 | attri = configData.GetAttribute("HttpListenerPort"); | ||
63 | if (attri == "") | ||
64 | { | ||
65 | string location = MainLog.Instance.CmdPrompt("Http Listener Port", "9000"); | ||
66 | configData.SetAttribute("HttpListenerPort", location); | ||
67 | this.HttpListenerPort = Convert.ToInt32(location); | ||
68 | } | ||
69 | else | ||
70 | { | ||
71 | this.HttpListenerPort = Convert.ToInt32(attri); | ||
72 | } | ||
73 | |||
74 | attri = ""; | ||
75 | attri = configData.GetAttribute("RemotingListenerPort"); | ||
76 | if (attri == "") | ||
77 | { | ||
78 | string location = MainLog.Instance.CmdPrompt("Remoting Listener Port", "8895"); | ||
79 | configData.SetAttribute("RemotingListenerPort", location); | ||
80 | this.RemotingListenerPort = Convert.ToInt32(location); | ||
81 | } | ||
82 | else | ||
83 | { | ||
84 | this.RemotingListenerPort = Convert.ToInt32(attri); | ||
85 | } | ||
86 | |||
87 | if (sandboxMode) | ||
88 | { | ||
89 | // default home location X | ||
90 | attri = ""; | ||
91 | attri = configData.GetAttribute("DefaultLocationX"); | ||
92 | if (attri == "") | ||
93 | { | ||
94 | string location = MainLog.Instance.CmdPrompt("Default Home Location X", "1000"); | ||
95 | configData.SetAttribute("DefaultLocationX", location); | ||
96 | this.DefaultHomeLocX = (uint)Convert.ToUInt32(location); | ||
97 | } | ||
98 | else | ||
99 | { | ||
100 | this.DefaultHomeLocX = (uint)Convert.ToUInt32(attri); | ||
101 | } | ||
102 | |||
103 | // default home location Y | ||
104 | attri = ""; | ||
105 | attri = configData.GetAttribute("DefaultLocationY"); | ||
106 | if (attri == "") | ||
107 | { | ||
108 | string location = MainLog.Instance.CmdPrompt("Default Home Location Y", "1000"); | ||
109 | configData.SetAttribute("DefaultLocationY", location); | ||
110 | this.DefaultHomeLocY = (uint)Convert.ToUInt32(location); | ||
111 | } | ||
112 | else | ||
113 | { | ||
114 | this.DefaultHomeLocY = (uint)Convert.ToUInt32(attri); | ||
115 | } | ||
116 | } | ||
117 | if (!isSandbox) | ||
118 | { | ||
119 | //Grid Server | ||
120 | attri = ""; | ||
121 | attri = configData.GetAttribute("GridServerURL"); | ||
122 | if (attri == "") | ||
123 | { | ||
124 | this.GridURL = MainLog.Instance.CmdPrompt("Grid server URL", "http://127.0.0.1:8001/"); | ||
125 | configData.SetAttribute("GridServerURL", this.GridURL); | ||
126 | } | ||
127 | else | ||
128 | { | ||
129 | this.GridURL = attri; | ||
130 | } | ||
131 | 55 | ||
132 | //Grid Send Key | 56 | public NetworkServersInfo(string description, string filename) |
133 | attri = ""; | 57 | { |
134 | attri = configData.GetAttribute("GridSendKey"); | 58 | configMember = new ConfigurationMember(filename, description, loadConfigurationOptions, handleConfigurationItem); |
135 | if (attri == "") | 59 | configMember.performConfigurationRetrieve(); |
136 | { | 60 | } |
137 | this.GridSendKey = MainLog.Instance.CmdPrompt("Key to send to grid server", "null"); | ||
138 | configData.SetAttribute("GridSendKey", this.GridSendKey); | ||
139 | } | ||
140 | else | ||
141 | { | ||
142 | this.GridSendKey = attri; | ||
143 | } | ||
144 | 61 | ||
145 | //Grid Receive Key | 62 | public void loadConfigurationOptions() |
146 | attri = ""; | 63 | { |
147 | attri = configData.GetAttribute("GridRecvKey"); | ||
148 | if (attri == "") | ||
149 | { | ||
150 | this.GridRecvKey = MainLog.Instance.CmdPrompt("Key to expect from grid server", "null"); | ||
151 | configData.SetAttribute("GridRecvKey", this.GridRecvKey); | ||
152 | } | ||
153 | else | ||
154 | { | ||
155 | this.GridRecvKey = attri; | ||
156 | } | ||
157 | 64 | ||
158 | //Grid Server | 65 | configMember.addConfigurationOption("HttpListenerPort", ConfigurationOption.ConfigurationTypes.TYPE_INT32, "HTTP Listener Port", "9000"); |
159 | attri = ""; | 66 | configMember.addConfigurationOption("RemotingListenerPort", ConfigurationOption.ConfigurationTypes.TYPE_INT32, "Remoting Listener Port", "8895"); |
160 | attri = configData.GetAttribute("UserServerURL"); | 67 | configMember.addConfigurationOption("DefaultLocationX", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, "Default Home Location (X Axis)", "1000"); |
161 | if (attri == "") | 68 | configMember.addConfigurationOption("DefaultLocationY", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, "Default Home Location (Y Axis)", "1000"); |
162 | { | ||
163 | this.UserURL= MainLog.Instance.CmdPrompt("User server URL", "http://127.0.0.1:8002/"); | ||
164 | configData.SetAttribute("UserServerURL", this.UserURL); | ||
165 | } | ||
166 | else | ||
167 | { | ||
168 | this.UserURL = attri; | ||
169 | } | ||
170 | 69 | ||
171 | //Grid Send Key | 70 | configMember.addConfigurationOption("GridServerURL", ConfigurationOption.ConfigurationTypes.TYPE_STRING, "Grid Server URL", "http://127.0.0.1:8001"); |
172 | attri = ""; | 71 | configMember.addConfigurationOption("GridSendKey", ConfigurationOption.ConfigurationTypes.TYPE_STRING, "Key to send to grid server", "null"); |
173 | attri = configData.GetAttribute("UserSendKey"); | 72 | configMember.addConfigurationOption("GridRecvKey", ConfigurationOption.ConfigurationTypes.TYPE_STRING, "Key to expect from grid server", "null"); |
174 | if (attri == "") | ||
175 | { | ||
176 | this.UserSendKey = MainLog.Instance.CmdPrompt("Key to send to user server", "null"); | ||
177 | configData.SetAttribute("UserSendKey", this.UserSendKey); | ||
178 | } | ||
179 | else | ||
180 | { | ||
181 | this.UserSendKey = attri; | ||
182 | } | ||
183 | 73 | ||
184 | //Grid Receive Key | 74 | configMember.addConfigurationOption("UserServerURL", ConfigurationOption.ConfigurationTypes.TYPE_STRING, "User Server URL", "http://127.0.0.1:8002"); |
185 | attri = ""; | 75 | configMember.addConfigurationOption("UserSendKey", ConfigurationOption.ConfigurationTypes.TYPE_STRING, "Key to send to user server", "null"); |
186 | attri = configData.GetAttribute("UserRecvKey"); | 76 | configMember.addConfigurationOption("UserRecvKey", ConfigurationOption.ConfigurationTypes.TYPE_STRING, "Key to expect from user server", "null"); |
187 | if (attri == "") | ||
188 | { | ||
189 | this.UserRecvKey = MainLog.Instance.CmdPrompt("Key to expect from user server", "null"); | ||
190 | configData.SetAttribute("UserRecvKey", this.UserRecvKey); | ||
191 | } | ||
192 | else | ||
193 | { | ||
194 | this.UserRecvKey = attri; | ||
195 | } | ||
196 | 77 | ||
197 | attri = ""; | 78 | configMember.addConfigurationOption("AssetServerURL", ConfigurationOption.ConfigurationTypes.TYPE_STRING, "Asset Server URL", "http://127.0.0.1:8003"); |
198 | attri = configData.GetAttribute("AssetServerURL"); | 79 | } |
199 | if (attri == "") | ||
200 | { | ||
201 | this.AssetURL = MainLog.Instance.CmdPrompt("Asset server URL", "http://127.0.0.1:8003/"); | ||
202 | configData.SetAttribute("AssetServerURL", this.GridURL); | ||
203 | } | ||
204 | else | ||
205 | { | ||
206 | this.AssetURL = attri; | ||
207 | } | ||
208 | 80 | ||
209 | } | 81 | public void handleConfigurationItem(string configuration_key, object configuration_object) |
210 | configData.Commit(); | 82 | { |
211 | } | 83 | switch (configuration_key) |
212 | catch (Exception e) | ||
213 | { | 84 | { |
214 | MainLog.Instance.Warn("Config.cs:InitConfig() - Exception occured"); | 85 | case "HttpListenerPort": |
215 | MainLog.Instance.Warn(e.ToString()); | 86 | this.HttpListenerPort = (int)configuration_object; |
87 | break; | ||
88 | case "RemotingListenerPort": | ||
89 | this.RemotingListenerPort = (int)configuration_object; | ||
90 | break; | ||
91 | case "DefaultLocationX": | ||
92 | this.DefaultHomeLocX = (uint)configuration_object; | ||
93 | break; | ||
94 | case "DefaultLocationY": | ||
95 | this.DefaultHomeLocY = (uint)configuration_object; | ||
96 | break; | ||
97 | case "GridServerURL": | ||
98 | this.GridURL = (string)configuration_object; | ||
99 | break; | ||
100 | case "GridSendKey": | ||
101 | this.GridSendKey = (string)configuration_object; | ||
102 | break; | ||
103 | case "GridRecvKey": | ||
104 | this.GridRecvKey = (string)configuration_object; | ||
105 | break; | ||
106 | case "UserServerURL": | ||
107 | this.UserURL = (string)configuration_object; | ||
108 | break; | ||
109 | case "UserSendKey": | ||
110 | this.UserSendKey = (string)configuration_object; | ||
111 | break; | ||
112 | case "UserRecvKey": | ||
113 | this.UserRecvKey = (string)configuration_object; | ||
114 | break; | ||
115 | case "AssetServerURL": | ||
116 | this.AssetURL = (string)configuration_object; | ||
117 | break; | ||
216 | } | 118 | } |
217 | } | 119 | } |
218 | } | 120 | } |
diff --git a/OpenSim/Framework/General/Types/RegionInfo.cs b/OpenSim/Framework/General/Types/RegionInfo.cs index 251d7f8..b7c35c7 100644 --- a/OpenSim/Framework/General/Types/RegionInfo.cs +++ b/OpenSim/Framework/General/Types/RegionInfo.cs | |||
@@ -34,6 +34,8 @@ using OpenSim.Framework.Console; | |||
34 | using OpenSim.Framework.Interfaces; | 34 | using OpenSim.Framework.Interfaces; |
35 | using OpenSim.Framework.Utilities; | 35 | using OpenSim.Framework.Utilities; |
36 | 36 | ||
37 | using OpenSim.Framework.Configuration; | ||
38 | |||
37 | namespace OpenSim.Framework.Types | 39 | namespace OpenSim.Framework.Types |
38 | { | 40 | { |
39 | public class RegionInfo | 41 | public class RegionInfo |
@@ -71,11 +73,11 @@ namespace OpenSim.Framework.Types | |||
71 | } | 73 | } |
72 | 74 | ||
73 | } | 75 | } |
74 | 76 | ||
75 | return new IPEndPoint(ia, m_internalEndPoint.Port); | 77 | return new IPEndPoint(ia, m_internalEndPoint.Port); |
76 | } | 78 | } |
77 | } | 79 | } |
78 | 80 | ||
79 | private string m_externalHostName; | 81 | private string m_externalHostName; |
80 | public string ExternalHostName | 82 | public string ExternalHostName |
81 | { | 83 | { |
@@ -117,7 +119,6 @@ namespace OpenSim.Framework.Types | |||
117 | } | 119 | } |
118 | } | 120 | } |
119 | 121 | ||
120 | // Only used for remote regions , ie ones not in the current instance | ||
121 | private uint m_remotingPort; | 122 | private uint m_remotingPort; |
122 | public uint RemotingPort | 123 | public uint RemotingPort |
123 | { | 124 | { |
@@ -142,14 +143,18 @@ namespace OpenSim.Framework.Types | |||
142 | 143 | ||
143 | public EstateSettings estateSettings; | 144 | public EstateSettings estateSettings; |
144 | 145 | ||
145 | public RegionInfo() | 146 | public ConfigurationMember configMember; |
147 | public RegionInfo(string description, string filename) | ||
146 | { | 148 | { |
147 | estateSettings = new EstateSettings(); | 149 | estateSettings = new EstateSettings(); |
150 | configMember = new ConfigurationMember(filename, description, loadConfigurationOptions, handleIncomingConfiguration); | ||
151 | configMember.performConfigurationRetrieve(); | ||
148 | } | 152 | } |
149 | 153 | ||
150 | public RegionInfo(uint regionLocX, uint regionLocY, IPEndPoint internalEndPoint, string externalUri) | 154 | public RegionInfo(uint regionLocX, uint regionLocY, IPEndPoint internalEndPoint, string externalUri) |
151 | : this() | ||
152 | { | 155 | { |
156 | |||
157 | estateSettings = new EstateSettings(); | ||
153 | m_regionLocX = regionLocX; | 158 | m_regionLocX = regionLocX; |
154 | m_regionLocY = regionLocY; | 159 | m_regionLocY = regionLocY; |
155 | 160 | ||
@@ -157,187 +162,70 @@ namespace OpenSim.Framework.Types | |||
157 | m_externalHostName = externalUri; | 162 | m_externalHostName = externalUri; |
158 | } | 163 | } |
159 | 164 | ||
160 | public void InitConfig(bool sandboxMode, IGenericConfig configData) | 165 | public void loadConfigurationOptions() |
161 | { | ||
162 | this.isSandbox = sandboxMode; | ||
163 | try | ||
164 | { | ||
165 | string attri = ""; | ||
166 | |||
167 | // Sim UUID | ||
168 | string simId = configData.GetAttribute("SimUUID"); | ||
169 | if (String.IsNullOrEmpty( simId )) | ||
170 | { | ||
171 | this.SimUUID = LLUUID.Random(); | ||
172 | } | ||
173 | else | ||
174 | { | ||
175 | this.SimUUID = new LLUUID(simId); | ||
176 | } | ||
177 | configData.SetAttribute("SimUUID", this.SimUUID.ToString()); | ||
178 | |||
179 | this.RegionName = GetString(configData, "SimName", "OpenSim test", "Region Name"); | ||
180 | |||
181 | //m_regionLocX = (uint) GetInt(configData, "SimLocationX", 1000, "Grid Location X"); | ||
182 | |||
183 | attri = ""; | ||
184 | attri = configData.GetAttribute("SimLocationX"); | ||
185 | if (attri == "") | ||
186 | { | ||
187 | string location = MainLog.Instance.CmdPrompt("Grid Location X", "1000"); | ||
188 | configData.SetAttribute("SimLocationX", location); | ||
189 | m_regionLocX = (uint)Convert.ToUInt32(location); | ||
190 | } | ||
191 | else | ||
192 | { | ||
193 | m_regionLocX = (uint)Convert.ToUInt32(attri); | ||
194 | } | ||
195 | // Sim/Grid location Y | ||
196 | attri = ""; | ||
197 | attri = configData.GetAttribute("SimLocationY"); | ||
198 | if (attri == "") | ||
199 | { | ||
200 | string location = MainLog.Instance.CmdPrompt("Grid Location Y", "1000"); | ||
201 | configData.SetAttribute("SimLocationY", location); | ||
202 | m_regionLocY = (uint)Convert.ToUInt32(location); | ||
203 | } | ||
204 | else | ||
205 | { | ||
206 | m_regionLocY = (uint)Convert.ToUInt32(attri); | ||
207 | } | ||
208 | |||
209 | m_regionHandle = null; | ||
210 | |||
211 | this.DataStore = GetString(configData, "Datastore", "localworld.yap", "Filename for local storage"); | ||
212 | |||
213 | string internalAddress = GetString(configData, "InternalIPAddress", "0.0.0.0", "Internal IP Address for UDP client connections").ToString(); | ||
214 | int internalPort = GetIPPort(configData, "InternalIPPort", "9000", "Internal IP Port for UDP client connections"); | ||
215 | IPAddress internalIPAddress = Util.GetHostFromDNS(internalAddress); | ||
216 | m_internalEndPoint = new IPEndPoint(internalIPAddress, internalPort); | ||
217 | |||
218 | m_externalHostName = GetString(configData, "ExternalHostName", "127.0.0.1", "External Host Name"); | ||
219 | |||
220 | estateSettings.terrainFile = | ||
221 | GetString(configData, "TerrainFile", "default.r32", "GENERAL SETTING: Default Terrain File"); | ||
222 | |||
223 | attri = ""; | ||
224 | attri = configData.GetAttribute("TerrainMultiplier"); | ||
225 | if (attri == "") | ||
226 | { | ||
227 | string re = MainLog.Instance.CmdPrompt("GENERAL SETTING: Terrain Height Multiplier", "60.0"); | ||
228 | this.estateSettings.terrainMultiplier = Convert.ToDouble(re, CultureInfo.InvariantCulture); | ||
229 | configData.SetAttribute("TerrainMultiplier", this.estateSettings.terrainMultiplier.ToString()); | ||
230 | } | ||
231 | else | ||
232 | { | ||
233 | this.estateSettings.terrainMultiplier = Convert.ToDouble(attri); | ||
234 | } | ||
235 | |||
236 | attri = ""; | ||
237 | attri = configData.GetAttribute("MasterAvatarFirstName"); | ||
238 | if (attri == "") | ||
239 | { | ||
240 | this.MasterAvatarFirstName = MainLog.Instance.CmdPrompt("First name of Master Avatar (Land and Region Owner)", "Test"); | ||
241 | |||
242 | configData.SetAttribute("MasterAvatarFirstName", this.MasterAvatarFirstName); | ||
243 | } | ||
244 | else | ||
245 | { | ||
246 | this.MasterAvatarFirstName = attri; | ||
247 | } | ||
248 | |||
249 | attri = ""; | ||
250 | attri = configData.GetAttribute("MasterAvatarLastName"); | ||
251 | if (attri == "") | ||
252 | { | ||
253 | this.MasterAvatarLastName = MainLog.Instance.CmdPrompt("Last name of Master Avatar (Land and Region Owner)", "User"); | ||
254 | |||
255 | configData.SetAttribute("MasterAvatarLastName", this.MasterAvatarLastName); | ||
256 | } | ||
257 | else | ||
258 | { | ||
259 | this.MasterAvatarLastName = attri; | ||
260 | } | ||
261 | |||
262 | if (isSandbox) //Sandbox Mode Specific Settings | ||
263 | { | ||
264 | attri = ""; | ||
265 | attri = configData.GetAttribute("MasterAvatarSandboxPassword"); | ||
266 | if (attri == "") | ||
267 | { | ||
268 | this.MasterAvatarSandboxPassword = MainLog.Instance.CmdPrompt("Password of Master Avatar (Needed for sandbox mode account creation only)", "test"); | ||
269 | |||
270 | //Should I store this? | ||
271 | configData.SetAttribute("MasterAvatarSandboxPassword", this.MasterAvatarSandboxPassword); | ||
272 | } | ||
273 | else | ||
274 | { | ||
275 | this.MasterAvatarSandboxPassword = attri; | ||
276 | } | ||
277 | } | ||
278 | |||
279 | configData.Commit(); | ||
280 | } | ||
281 | catch (Exception e) | ||
282 | { | ||
283 | MainLog.Instance.Warn("Config.cs:InitConfig() - Exception occured"); | ||
284 | MainLog.Instance.Warn(e.ToString()); | ||
285 | } | ||
286 | |||
287 | MainLog.Instance.Verbose("Sim settings loaded:"); | ||
288 | MainLog.Instance.Verbose("UUID: " + this.SimUUID.ToStringHyphenated()); | ||
289 | MainLog.Instance.Verbose("Name: " + this.RegionName); | ||
290 | MainLog.Instance.Verbose("Region Location: [" + this.RegionLocX.ToString() + "," + this.RegionLocY + "]"); | ||
291 | MainLog.Instance.Verbose("Region Handle: " + this.RegionHandle.ToString()); | ||
292 | MainLog.Instance.Verbose("Listening on IP end point: " + m_internalEndPoint.ToString() ); | ||
293 | MainLog.Instance.Verbose("Sandbox Mode? " + isSandbox.ToString()); | ||
294 | |||
295 | } | ||
296 | |||
297 | private uint GetInt(IGenericConfig configData, string p, int p_3, string p_4) | ||
298 | { | 166 | { |
299 | throw new Exception("The method or operation is not implemented."); | 167 | configMember.addConfigurationOption("sim_UUID", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, "UUID of Simulator (Default is recommended, random UUID)", LLUUID.Random().ToString()); |
300 | } | 168 | configMember.addConfigurationOption("sim_name", ConfigurationOption.ConfigurationTypes.TYPE_STRING, "Simulator Name", "OpenSim Test"); |
301 | 169 | configMember.addConfigurationOption("sim_location_x", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, "Grid Location (X Axis)", "1000"); | |
302 | private string GetString(IGenericConfig configData, string attrName, string defaultvalue, string prompt) | 170 | configMember.addConfigurationOption("sim_location_y", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, "Grid Location (Y Axis)", "1000"); |
303 | { | 171 | configMember.addConfigurationOption("datastore", ConfigurationOption.ConfigurationTypes.TYPE_STRING, "Filename for local storage", "localworld.yap"); |
304 | string s = configData.GetAttribute(attrName); | 172 | configMember.addConfigurationOption("internal_ip_address", ConfigurationOption.ConfigurationTypes.TYPE_IP_ADDRESS, "Internal IP Address for incoming UDP client connections", "0.0.0.0"); |
173 | configMember.addConfigurationOption("internal_ip_port", ConfigurationOption.ConfigurationTypes.TYPE_INT32, "Internal IP Port for incoming UDP client connections", "9000"); | ||
174 | configMember.addConfigurationOption("external_host_name", ConfigurationOption.ConfigurationTypes.TYPE_STRING, "External Host Name", "127.0.0.1"); | ||
175 | configMember.addConfigurationOption("terrain_file", ConfigurationOption.ConfigurationTypes.TYPE_STRING, "Default Terrain File", "default.r32"); | ||
176 | configMember.addConfigurationOption("terrain_multiplier", ConfigurationOption.ConfigurationTypes.TYPE_DOUBLE, "Terrain Height Multiplier", "60.0"); | ||
177 | configMember.addConfigurationOption("master_avatar_first", ConfigurationOption.ConfigurationTypes.TYPE_STRING, "First Name of Master Avatar", "Test"); | ||
178 | configMember.addConfigurationOption("master_avatar_last", ConfigurationOption.ConfigurationTypes.TYPE_STRING, "Last Name of Master Avatar", "User"); | ||
179 | configMember.addConfigurationOption("master_avatar_pass", ConfigurationOption.ConfigurationTypes.TYPE_STRING, "(Sandbox Mode Only)Password for Master Avatar account", "test"); | ||
305 | 180 | ||
306 | if (String.IsNullOrEmpty( s )) | ||
307 | { | ||
308 | s = MainLog.Instance.CmdPrompt(prompt, defaultvalue); | ||
309 | configData.SetAttribute(attrName, s ); | ||
310 | } | ||
311 | return s; | ||
312 | } | 181 | } |
313 | 182 | ||
314 | private IPAddress GetIPAddress(IGenericConfig configData, string attrName, string defaultvalue, string prompt) | 183 | public void handleIncomingConfiguration(string configuration_key, object configuration_result) |
315 | { | 184 | { |
316 | string addressStr = configData.GetAttribute(attrName); | 185 | switch (configuration_key) |
317 | |||
318 | IPAddress address; | ||
319 | |||
320 | if (!IPAddress.TryParse(addressStr, out address)) | ||
321 | { | 186 | { |
322 | address = MainLog.Instance.CmdPromptIPAddress(prompt, defaultvalue); | 187 | case "sim_UUID": |
323 | configData.SetAttribute(attrName, address.ToString()); | 188 | this.SimUUID = (LLUUID)configuration_result; |
189 | break; | ||
190 | case "sim_name": | ||
191 | this.RegionName = (string)configuration_result; | ||
192 | break; | ||
193 | case "sim_location_x": | ||
194 | this.m_regionLocX = (uint)configuration_result; | ||
195 | break; | ||
196 | case "sim_location_y": | ||
197 | this.m_regionLocY = (uint)configuration_result; | ||
198 | break; | ||
199 | case "datastore": | ||
200 | this.DataStore = (string)configuration_result; | ||
201 | break; | ||
202 | case "internal_ip_address": | ||
203 | IPAddress address = (IPAddress)configuration_result; | ||
204 | this.m_internalEndPoint = new IPEndPoint(address, 0); | ||
205 | break; | ||
206 | case "internal_ip_port": | ||
207 | this.m_internalEndPoint.Port = (int)configuration_result; | ||
208 | break; | ||
209 | case "external_host_name": | ||
210 | this.m_externalHostName = (string)configuration_result; | ||
211 | break; | ||
212 | case "terrain_file": | ||
213 | this.estateSettings.terrainFile = (string)configuration_result; | ||
214 | break; | ||
215 | case "terrain_multiplier": | ||
216 | this.estateSettings.terrainMultiplier = (double)configuration_result; | ||
217 | break; | ||
218 | case "master_avatar_first": | ||
219 | this.MasterAvatarFirstName = (string)configuration_result; | ||
220 | break; | ||
221 | case "master_avatar_last": | ||
222 | this.MasterAvatarLastName = (string)configuration_result; | ||
223 | break; | ||
224 | case "master_avatar_pass": | ||
225 | this.MasterAvatarSandboxPassword = (string)configuration_result; | ||
226 | break; | ||
324 | } | 227 | } |
325 | return address; | ||
326 | } | 228 | } |
327 | |||
328 | private int GetIPPort(IGenericConfig configData, string attrName, string defaultvalue, string prompt) | ||
329 | { | ||
330 | string portStr = configData.GetAttribute(attrName); | ||
331 | 229 | ||
332 | int port; | ||
333 | |||
334 | if (!int.TryParse(portStr, out port)) | ||
335 | { | ||
336 | port = MainLog.Instance.CmdPromptIPPort(prompt, defaultvalue); | ||
337 | configData.SetAttribute(attrName, port.ToString()); | ||
338 | } | ||
339 | |||
340 | return port; | ||
341 | } | ||
342 | } | 230 | } |
343 | } | 231 | } |
diff --git a/OpenSim/Framework/GenericConfig/Xml/Properties/AssemblyInfo.cs b/OpenSim/Framework/GenericConfig/Xml/Properties/AssemblyInfo.cs deleted file mode 100644 index 28779ee..0000000 --- a/OpenSim/Framework/GenericConfig/Xml/Properties/AssemblyInfo.cs +++ /dev/null | |||
@@ -1,33 +0,0 @@ | |||
1 | using System.Reflection; | ||
2 | using System.Runtime.InteropServices; | ||
3 | // General Information about an assembly is controlled through the following | ||
4 | // set of attributes. Change these attribute values to modify the information | ||
5 | // associated with an assembly. | ||
6 | [assembly: AssemblyTitle("OpenSim.GenericConfig")] | ||
7 | [assembly: AssemblyDescription("")] | ||
8 | [assembly: AssemblyConfiguration("")] | ||
9 | [assembly: AssemblyCompany("")] | ||
10 | [assembly: AssemblyProduct("OpenSim.GenericConfig")] | ||
11 | [assembly: AssemblyCopyright("Copyright © 2007")] | ||
12 | [assembly: AssemblyTrademark("")] | ||
13 | [assembly: AssemblyCulture("")] | ||
14 | |||
15 | // Setting ComVisible to false makes the types in this assembly not visible | ||
16 | // to COM components. If you need to access a type in this assembly from | ||
17 | // COM, set the ComVisible attribute to true on that type. | ||
18 | [assembly: ComVisible(false)] | ||
19 | |||
20 | // The following GUID is for the ID of the typelib if this project is exposed to COM | ||
21 | [assembly: Guid("285a3047-f165-46c8-8767-b51428738a09")] | ||
22 | |||
23 | // Version information for an assembly consists of the following four values: | ||
24 | // | ||
25 | // Major Version | ||
26 | // Minor Version | ||
27 | // Build Number | ||
28 | // Revision | ||
29 | // | ||
30 | // You can specify all the values or you can default the Revision and Build Numbers | ||
31 | // by using the '*' as shown below: | ||
32 | [assembly: AssemblyVersion("1.0.0.0")] | ||
33 | [assembly: AssemblyFileVersion("1.0.0.0")] | ||
diff --git a/OpenSim/Framework/UserManager/UserManagerBase.cs b/OpenSim/Framework/UserManager/UserManagerBase.cs index fe45d1b..865adbe 100644 --- a/OpenSim/Framework/UserManager/UserManagerBase.cs +++ b/OpenSim/Framework/UserManager/UserManagerBase.cs | |||
@@ -38,6 +38,8 @@ using OpenSim.Framework.Interfaces; | |||
38 | using OpenSim.Framework.Inventory; | 38 | using OpenSim.Framework.Inventory; |
39 | using OpenSim.Framework.Utilities; | 39 | using OpenSim.Framework.Utilities; |
40 | 40 | ||
41 | using OpenSim.Framework.Configuration; | ||
42 | |||
41 | namespace OpenSim.Framework.UserManagement | 43 | namespace OpenSim.Framework.UserManagement |
42 | { | 44 | { |
43 | public abstract class UserManagerBase | 45 | public abstract class UserManagerBase |
diff --git a/OpenSim/Grid/GridServer/GridManager.cs b/OpenSim/Grid/GridServer/GridManager.cs index b3ba4e5..2e7f9f7 100644 --- a/OpenSim/Grid/GridServer/GridManager.cs +++ b/OpenSim/Grid/GridServer/GridManager.cs | |||
@@ -38,6 +38,8 @@ using OpenSim.Framework.Data; | |||
38 | using OpenSim.Framework.Interfaces; | 38 | using OpenSim.Framework.Interfaces; |
39 | using OpenSim.Framework.Utilities; | 39 | using OpenSim.Framework.Utilities; |
40 | 40 | ||
41 | using OpenSim.Framework.Configuration; | ||
42 | |||
41 | namespace OpenSim.Grid.GridServer | 43 | namespace OpenSim.Grid.GridServer |
42 | { | 44 | { |
43 | class GridManager | 45 | class GridManager |
diff --git a/OpenSim/Grid/GridServer/Main.cs b/OpenSim/Grid/GridServer/Main.cs index 09aeab5..85bd918 100644 --- a/OpenSim/Grid/GridServer/Main.cs +++ b/OpenSim/Grid/GridServer/Main.cs | |||
@@ -33,7 +33,8 @@ using System.Timers; | |||
33 | using OpenSim.Framework.Console; | 33 | using OpenSim.Framework.Console; |
34 | using OpenSim.Framework.Interfaces; | 34 | using OpenSim.Framework.Interfaces; |
35 | using OpenSim.Framework.Servers; | 35 | using OpenSim.Framework.Servers; |
36 | using OpenSim.GenericConfig; | 36 | using OpenSim.Framework.Configuration; |
37 | |||
37 | using Timer=System.Timers.Timer; | 38 | using Timer=System.Timers.Timer; |
38 | 39 | ||
39 | namespace OpenSim.Grid.GridServer | 40 | namespace OpenSim.Grid.GridServer |
@@ -47,7 +48,6 @@ namespace OpenSim.Grid.GridServer | |||
47 | public GridConfig Cfg; | 48 | public GridConfig Cfg; |
48 | 49 | ||
49 | public static OpenGrid_Main thegrid; | 50 | public static OpenGrid_Main thegrid; |
50 | protected IGenericConfig localXMLConfig; | ||
51 | 51 | ||
52 | public static bool setuponly; | 52 | public static bool setuponly; |
53 | 53 | ||
@@ -105,14 +105,8 @@ namespace OpenSim.Grid.GridServer | |||
105 | 105 | ||
106 | public void Startup() | 106 | public void Startup() |
107 | { | 107 | { |
108 | this.localXMLConfig = new XmlConfig("GridServerConfig.xml"); | 108 | |
109 | this.localXMLConfig.LoadData(); | 109 | this.Cfg = new GridConfig("GRID SERVER","GridServer_Config.xml"); //Yeah srsly, that's it. |
110 | this.ConfigDB(this.localXMLConfig); | ||
111 | this.localXMLConfig.Close(); | ||
112 | |||
113 | m_console.Verbose( "Main.cs:Startup() - Loading configuration"); | ||
114 | Cfg = this.LoadConfigDll(this.ConfigDll); | ||
115 | Cfg.InitConfig(); | ||
116 | if (setuponly) Environment.Exit(0); | 110 | if (setuponly) Environment.Exit(0); |
117 | 111 | ||
118 | m_console.Verbose( "Main.cs:Startup() - Connecting to Storage Server"); | 112 | m_console.Verbose( "Main.cs:Startup() - Connecting to Storage Server"); |
@@ -148,34 +142,6 @@ namespace OpenSim.Grid.GridServer | |||
148 | simCheckTimer.Enabled = true; | 142 | simCheckTimer.Enabled = true; |
149 | } | 143 | } |
150 | 144 | ||
151 | private GridConfig LoadConfigDll(string dllName) | ||
152 | { | ||
153 | Assembly pluginAssembly = Assembly.LoadFrom(dllName); | ||
154 | GridConfig config = null; | ||
155 | |||
156 | foreach (Type pluginType in pluginAssembly.GetTypes()) | ||
157 | { | ||
158 | if (pluginType.IsPublic) | ||
159 | { | ||
160 | if (!pluginType.IsAbstract) | ||
161 | { | ||
162 | Type typeInterface = pluginType.GetInterface("IGridConfig", true); | ||
163 | |||
164 | if (typeInterface != null) | ||
165 | { | ||
166 | IGridConfig plug = (IGridConfig)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); | ||
167 | config = plug.GetConfigObject(); | ||
168 | break; | ||
169 | } | ||
170 | |||
171 | typeInterface = null; | ||
172 | } | ||
173 | } | ||
174 | } | ||
175 | pluginAssembly = null; | ||
176 | return config; | ||
177 | } | ||
178 | |||
179 | public void CheckSims(object sender, ElapsedEventArgs e) | 145 | public void CheckSims(object sender, ElapsedEventArgs e) |
180 | { | 146 | { |
181 | /* | 147 | /* |
diff --git a/OpenSim/Grid/UserServer/Main.cs b/OpenSim/Grid/UserServer/Main.cs index 9bdf8d7..b702beb 100644 --- a/OpenSim/Grid/UserServer/Main.cs +++ b/OpenSim/Grid/UserServer/Main.cs | |||
@@ -35,7 +35,7 @@ using OpenSim.Framework.Interfaces; | |||
35 | using OpenSim.Framework.Servers; | 35 | using OpenSim.Framework.Servers; |
36 | using OpenSim.Framework.User; | 36 | using OpenSim.Framework.User; |
37 | using OpenSim.Framework.Utilities; | 37 | using OpenSim.Framework.Utilities; |
38 | using OpenSim.GenericConfig; | 38 | using OpenSim.Framework.Configuration; |
39 | 39 | ||
40 | namespace OpenSim.Grid.UserServer | 40 | namespace OpenSim.Grid.UserServer |
41 | { | 41 | { |
@@ -46,7 +46,6 @@ namespace OpenSim.Grid.UserServer | |||
46 | private string ConfigDll = "OpenSim.Grid.UserServer.Config.dll"; | 46 | private string ConfigDll = "OpenSim.Grid.UserServer.Config.dll"; |
47 | private string StorageDll = "OpenSim.Framework.Data.MySQL.dll"; | 47 | private string StorageDll = "OpenSim.Framework.Data.MySQL.dll"; |
48 | private UserConfig Cfg; | 48 | private UserConfig Cfg; |
49 | protected IGenericConfig localXMLConfig; | ||
50 | 49 | ||
51 | public UserManager m_userManager; | 50 | public UserManager m_userManager; |
52 | 51 | ||
@@ -83,14 +82,7 @@ namespace OpenSim.Grid.UserServer | |||
83 | 82 | ||
84 | public void Startup() | 83 | public void Startup() |
85 | { | 84 | { |
86 | this.localXMLConfig = new XmlConfig("UserServerConfig.xml"); | 85 | this.Cfg = new UserConfig("USER SERVER", "UserServer_Config.xml"); |
87 | this.localXMLConfig.LoadData(); | ||
88 | this.ConfigDB(this.localXMLConfig); | ||
89 | this.localXMLConfig.Close(); | ||
90 | |||
91 | MainLog.Instance.Verbose("Main.cs:Startup() - Loading configuration"); | ||
92 | Cfg = this.LoadConfigDll(this.ConfigDll); | ||
93 | Cfg.InitConfig(); | ||
94 | 86 | ||
95 | MainLog.Instance.Verbose("Main.cs:Startup() - Establishing data connection"); | 87 | MainLog.Instance.Verbose("Main.cs:Startup() - Establishing data connection"); |
96 | m_userManager = new UserManager(); | 88 | m_userManager = new UserManager(); |
@@ -179,34 +171,6 @@ namespace OpenSim.Grid.UserServer | |||
179 | } | 171 | } |
180 | } | 172 | } |
181 | 173 | ||
182 | private UserConfig LoadConfigDll(string dllName) | ||
183 | { | ||
184 | Assembly pluginAssembly = Assembly.LoadFrom(dllName); | ||
185 | UserConfig config = null; | ||
186 | |||
187 | foreach (Type pluginType in pluginAssembly.GetTypes()) | ||
188 | { | ||
189 | if (pluginType.IsPublic) | ||
190 | { | ||
191 | if (!pluginType.IsAbstract) | ||
192 | { | ||
193 | Type typeInterface = pluginType.GetInterface("IUserConfig", true); | ||
194 | |||
195 | if (typeInterface != null) | ||
196 | { | ||
197 | IUserConfig plug = (IUserConfig)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); | ||
198 | config = plug.GetConfigObject(); | ||
199 | break; | ||
200 | } | ||
201 | |||
202 | typeInterface = null; | ||
203 | } | ||
204 | } | ||
205 | } | ||
206 | pluginAssembly = null; | ||
207 | return config; | ||
208 | } | ||
209 | |||
210 | public void Show(string ShowWhat) | 174 | public void Show(string ShowWhat) |
211 | { | 175 | { |
212 | } | 176 | } |
diff --git a/OpenSim/Region/Application/OpenSimMain.cs b/OpenSim/Region/Application/OpenSimMain.cs index c333e0e..81523e0 100644 --- a/OpenSim/Region/Application/OpenSimMain.cs +++ b/OpenSim/Region/Application/OpenSimMain.cs | |||
@@ -37,7 +37,7 @@ using OpenSim.Framework.Data; | |||
37 | using OpenSim.Framework.Interfaces; | 37 | using OpenSim.Framework.Interfaces; |
38 | using OpenSim.Framework.Servers; | 38 | using OpenSim.Framework.Servers; |
39 | using OpenSim.Framework.Types; | 39 | using OpenSim.Framework.Types; |
40 | using OpenSim.GenericConfig; | 40 | using OpenSim.Framework.Configuration; |
41 | using OpenSim.Physics.Manager; | 41 | using OpenSim.Physics.Manager; |
42 | using OpenSim.Region.Caches; | 42 | using OpenSim.Region.Caches; |
43 | using OpenSim.Region.ClientStack; | 43 | using OpenSim.Region.ClientStack; |
@@ -85,6 +85,9 @@ namespace OpenSim | |||
85 | /// </summary> | 85 | /// </summary> |
86 | public override void StartUp() | 86 | public override void StartUp() |
87 | { | 87 | { |
88 | m_log = new LogBase(m_logFilename, "Region", this, m_silent); | ||
89 | MainLog.Instance = m_log; | ||
90 | |||
88 | base.StartUp(); | 91 | base.StartUp(); |
89 | 92 | ||
90 | if (!m_sandbox) | 93 | if (!m_sandbox) |
@@ -108,27 +111,16 @@ namespace OpenSim | |||
108 | { | 111 | { |
109 | string path2 = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Regions"); | 112 | string path2 = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Regions"); |
110 | string path3 = Path.Combine(path2, "default.xml"); | 113 | string path3 = Path.Combine(path2, "default.xml"); |
111 | Console.WriteLine("Creating default region config file"); | 114 | |
112 | //TODO create default region | 115 | RegionInfo regionInfo = new RegionInfo("DEFAULT REGION CONFIG", path3); |
113 | IGenericConfig defaultConfig = new XmlConfig(path3); | ||
114 | defaultConfig.LoadData(); | ||
115 | defaultConfig.Commit(); | ||
116 | defaultConfig.Close(); | ||
117 | defaultConfig = null; | ||
118 | configFiles = Directory.GetFiles(path, "*.xml"); | 116 | configFiles = Directory.GetFiles(path, "*.xml"); |
119 | } | 117 | } |
120 | 118 | ||
121 | for (int i = 0; i < configFiles.Length; i++) | 119 | for (int i = 0; i < configFiles.Length; i++) |
122 | { | 120 | { |
123 | Console.WriteLine("Loading region config file"); | 121 | Console.WriteLine("Loading region config file"); |
124 | 122 | RegionInfo regionInfo = new RegionInfo("REGION CONFIG #" + (i + 1), configFiles[i]); | |
125 | IGenericConfig regionConfig = new XmlConfig(configFiles[i]); | 123 | |
126 | RegionInfo regionInfo = new RegionInfo(); | ||
127 | regionConfig.LoadData(); | ||
128 | regionInfo.InitConfig(this.m_sandbox, regionConfig); | ||
129 | regionConfig.Close(); | ||
130 | |||
131 | |||
132 | UDPServer udpServer; | 124 | UDPServer udpServer; |
133 | Scene scene = SetupScene(regionInfo, out udpServer); | 125 | Scene scene = SetupScene(regionInfo, out udpServer); |
134 | 126 | ||
@@ -159,21 +151,7 @@ namespace OpenSim | |||
159 | 151 | ||
160 | protected override void Initialize() | 152 | protected override void Initialize() |
161 | { | 153 | { |
162 | IGenericConfig localConfig = new XmlConfig(m_configFileName); | ||
163 | localConfig.LoadData(); | ||
164 | |||
165 | if (m_useConfigFile) | ||
166 | { | ||
167 | SetupFromConfigFile(localConfig); | ||
168 | } | ||
169 | |||
170 | StartLog(); | ||
171 | |||
172 | m_networkServersInfo.InitConfig(m_sandbox, localConfig); | ||
173 | m_httpServerPort = m_networkServersInfo.HttpListenerPort; | 154 | m_httpServerPort = m_networkServersInfo.HttpListenerPort; |
174 | |||
175 | localConfig.Close(); | ||
176 | |||
177 | m_assetCache = new AssetCache("OpenSim.Region.GridInterfaces.Local.dll", m_networkServersInfo.AssetURL, m_networkServersInfo.AssetSendKey); | 155 | m_assetCache = new AssetCache("OpenSim.Region.GridInterfaces.Local.dll", m_networkServersInfo.AssetURL, m_networkServersInfo.AssetSendKey); |
178 | } | 156 | } |
179 | 157 | ||
diff --git a/OpenSim/Region/ClientStack/PacketServer.cs b/OpenSim/Region/ClientStack/PacketServer.cs index 41aaf3a..7b15ab4 100644 --- a/OpenSim/Region/ClientStack/PacketServer.cs +++ b/OpenSim/Region/ClientStack/PacketServer.cs | |||
@@ -31,6 +31,7 @@ using System.Net.Sockets; | |||
31 | using libsecondlife.Packets; | 31 | using libsecondlife.Packets; |
32 | using OpenSim.Assets; | 32 | using OpenSim.Assets; |
33 | using OpenSim.Framework; | 33 | using OpenSim.Framework; |
34 | using OpenSim.Framework.Types; | ||
34 | using OpenSim.Framework.Interfaces; | 35 | using OpenSim.Framework.Interfaces; |
35 | using OpenSim.Region.Caches; | 36 | using OpenSim.Region.Caches; |
36 | 37 | ||
diff --git a/OpenSim/Region/ClientStack/RegionApplicationBase.cs b/OpenSim/Region/ClientStack/RegionApplicationBase.cs index 1bb383f..375306d 100644 --- a/OpenSim/Region/ClientStack/RegionApplicationBase.cs +++ b/OpenSim/Region/ClientStack/RegionApplicationBase.cs | |||
@@ -65,9 +65,9 @@ namespace OpenSim.Region.ClientStack | |||
65 | 65 | ||
66 | virtual public void StartUp() | 66 | virtual public void StartUp() |
67 | { | 67 | { |
68 | |||
68 | ClientView.TerrainManager = new TerrainManager(new SecondLife()); | 69 | ClientView.TerrainManager = new TerrainManager(new SecondLife()); |
69 | m_networkServersInfo = new NetworkServersInfo(); | 70 | m_networkServersInfo = new NetworkServersInfo("NETWORK SERVERS INFO", "network_servers_information.xml"); |
70 | RegionInfo m_regionInfo = new RegionInfo(); | ||
71 | 71 | ||
72 | Initialize(); | 72 | Initialize(); |
73 | 73 | ||
diff --git a/OpenSim/Region/ClientStack/UDPServer.cs b/OpenSim/Region/ClientStack/UDPServer.cs index ac17720..f90a213 100644 --- a/OpenSim/Region/ClientStack/UDPServer.cs +++ b/OpenSim/Region/ClientStack/UDPServer.cs | |||
@@ -32,6 +32,7 @@ using System.Net.Sockets; | |||
32 | using libsecondlife.Packets; | 32 | using libsecondlife.Packets; |
33 | using OpenSim.Assets; | 33 | using OpenSim.Assets; |
34 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
35 | using OpenSim.Framework.Types; | ||
35 | using OpenSim.Framework.Console; | 36 | using OpenSim.Framework.Console; |
36 | using OpenSim.Framework.Interfaces; | 37 | using OpenSim.Framework.Interfaces; |
37 | using OpenSim.Region.Caches; | 38 | using OpenSim.Region.Caches; |
diff --git a/OpenSim/Region/Environment/RegionManager.cs b/OpenSim/Region/Environment/RegionManager.cs index e75ee60..255aa45 100644 --- a/OpenSim/Region/Environment/RegionManager.cs +++ b/OpenSim/Region/Environment/RegionManager.cs | |||
@@ -1,5 +1,6 @@ | |||
1 | using System.Collections.Generic; | 1 | using System.Collections.Generic; |
2 | using OpenSim.Framework; | 2 | using OpenSim.Framework; |
3 | using OpenSim.Framework.Types; | ||
3 | using OpenSim.Framework.Communications; | 4 | using OpenSim.Framework.Communications; |
4 | using OpenSim.Framework.Servers; | 5 | using OpenSim.Framework.Servers; |
5 | using OpenSim.Region.Capabilities; | 6 | using OpenSim.Region.Capabilities; |