diff options
Some more code refactoring, plus a restructuring of the directories so that the Grid servers can be a separate solution to the region server.
Diffstat (limited to 'OpenUser.Config/UserConfigDb4o/DbUserConfig.cs')
-rw-r--r-- | OpenUser.Config/UserConfigDb4o/DbUserConfig.cs | 95 |
1 files changed, 0 insertions, 95 deletions
diff --git a/OpenUser.Config/UserConfigDb4o/DbUserConfig.cs b/OpenUser.Config/UserConfigDb4o/DbUserConfig.cs deleted file mode 100644 index a281889..0000000 --- a/OpenUser.Config/UserConfigDb4o/DbUserConfig.cs +++ /dev/null | |||
@@ -1,95 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) OpenSim project, http://sim.opensecondlife.org/ | ||
3 | * | ||
4 | * Redistribution and use in source and binary forms, with or without | ||
5 | * modification, are permitted provided that the following conditions are met: | ||
6 | * * Redistributions of source code must retain the above copyright | ||
7 | * notice, this list of conditions and the following disclaimer. | ||
8 | * * Redistributions in binary form must reproduce the above copyright | ||
9 | * notice, this list of conditions and the following disclaimer in the | ||
10 | * documentation and/or other materials provided with the distribution. | ||
11 | * * Neither the name of the <organization> nor the | ||
12 | * names of its contributors may be used to endorse or promote products | ||
13 | * derived from this software without specific prior written permission. | ||
14 | * | ||
15 | * THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY | ||
16 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
17 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
18 | * DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY | ||
19 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
20 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
21 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
22 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
24 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
25 | * | ||
26 | */ | ||
27 | using System; | ||
28 | using System.Collections.Generic; | ||
29 | using OpenSim.Framework.Console; | ||
30 | using OpenSim.Framework.Interfaces; | ||
31 | using Db4objects.Db4o; | ||
32 | |||
33 | namespace OpenUser.Config.UserConfigDb4o | ||
34 | { | ||
35 | public class Db4oConfigPlugin: IUserConfig | ||
36 | { | ||
37 | public UserConfig GetConfigObject() | ||
38 | { | ||
39 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Loading Db40Config dll"); | ||
40 | return ( new DbUserConfig()); | ||
41 | } | ||
42 | } | ||
43 | |||
44 | public class DbUserConfig : UserConfig | ||
45 | { | ||
46 | private IObjectContainer db; | ||
47 | |||
48 | public void LoadDefaults() { | ||
49 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH,"Config.cs:LoadDefaults() - Please press enter to retain default or enter new settings"); | ||
50 | |||
51 | this.DefaultStartupMsg = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Default startup message", "Welcome to OGS"); | ||
52 | |||
53 | this.GridServerURL = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Grid server URL","http://127.0.0.1:8001/"); | ||
54 | this.GridSendKey = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Key to send to grid server","null"); | ||
55 | this.GridRecvKey = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Key to expect from grid server","null"); | ||
56 | } | ||
57 | |||
58 | public override void InitConfig() { | ||
59 | try { | ||
60 | db = Db4oFactory.OpenFile("openuser.yap"); | ||
61 | IObjectSet result = db.Get(typeof(DbUserConfig)); | ||
62 | if(result.Count==1) { | ||
63 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Config.cs:InitConfig() - Found a UserConfig object in the local database, loading"); | ||
64 | foreach (DbUserConfig cfg in result) { | ||
65 | this.GridServerURL=cfg.GridServerURL; | ||
66 | this.GridSendKey=cfg.GridSendKey; | ||
67 | this.GridRecvKey=cfg.GridRecvKey; | ||
68 | this.DefaultStartupMsg=cfg.DefaultStartupMsg; | ||
69 | } | ||
70 | } else { | ||
71 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Config.cs:InitConfig() - Could not find object in database, loading precompiled defaults"); | ||
72 | LoadDefaults(); | ||
73 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Writing out default settings to local database"); | ||
74 | db.Set(this); | ||
75 | db.Close(); | ||
76 | } | ||
77 | } catch(Exception e) { | ||
78 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM,"Config.cs:InitConfig() - Exception occured"); | ||
79 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM,e.ToString()); | ||
80 | } | ||
81 | |||
82 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"User settings loaded:"); | ||
83 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Default startup message: " + this.DefaultStartupMsg); | ||
84 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Grid server URL: " + this.GridServerURL); | ||
85 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Key to send to grid: " + this.GridSendKey); | ||
86 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Key to expect from grid: " + this.GridRecvKey); | ||
87 | } | ||
88 | |||
89 | |||
90 | public void Shutdown() { | ||
91 | db.Close(); | ||
92 | } | ||
93 | } | ||
94 | |||
95 | } | ||