aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Grid/UserServer.Config/DbUserConfig.cs
diff options
context:
space:
mode:
authorJeff Ames2007-12-06 18:17:44 +0000
committerJeff Ames2007-12-06 18:17:44 +0000
commit73599c0f25f67b6a2de61a36849bb8ce0b7b5279 (patch)
tree6e653c7a057655b25b760cc6fa0ad07444718dd4 /OpenSim/Grid/UserServer.Config/DbUserConfig.cs
parentmore minor cleanup. added some command descriptions to region server help. (diff)
downloadopensim-SC-73599c0f25f67b6a2de61a36849bb8ce0b7b5279.zip
opensim-SC-73599c0f25f67b6a2de61a36849bb8ce0b7b5279.tar.gz
opensim-SC-73599c0f25f67b6a2de61a36849bb8ce0b7b5279.tar.bz2
opensim-SC-73599c0f25f67b6a2de61a36849bb8ce0b7b5279.tar.xz
removed obsolete Verbose() function
Diffstat (limited to 'OpenSim/Grid/UserServer.Config/DbUserConfig.cs')
-rw-r--r--OpenSim/Grid/UserServer.Config/DbUserConfig.cs164
1 files changed, 86 insertions, 78 deletions
diff --git a/OpenSim/Grid/UserServer.Config/DbUserConfig.cs b/OpenSim/Grid/UserServer.Config/DbUserConfig.cs
index 1f93779..748973d 100644
--- a/OpenSim/Grid/UserServer.Config/DbUserConfig.cs
+++ b/OpenSim/Grid/UserServer.Config/DbUserConfig.cs
@@ -1,30 +1,30 @@
1/* 1/*
2* Copyright (c) Contributors, http://opensimulator.org/ 2 * Copyright (c) Contributors, http://opensimulator.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 */
28using System; 28using System;
29using Db4objects.Db4o; 29using Db4objects.Db4o;
30using OpenSim.Framework.Configuration; 30using OpenSim.Framework.Configuration;
@@ -33,64 +33,72 @@ using OpenSim.Framework.Interfaces;
33 33
34namespace OpenUser.Config.UserConfigDb4o 34namespace OpenUser.Config.UserConfigDb4o
35{ 35{
36 public class Db4oConfigPlugin: IUserConfig 36 public class Db4oConfigPlugin: IUserConfig
37 { 37 {
38 public UserConfig GetConfigObject() 38 public UserConfig GetConfigObject()
39 { 39 {
40 MainLog.Instance.Verbose("Loading Db40Config dll"); 40 MainLog.Instance.Verbose("DBUSERCONFIG", "Loading Db40Config dll");
41 return ( new DbUserConfig()); 41 return ( new DbUserConfig());
42 } 42 }
43 } 43 }
44 44
45 public class DbUserConfig : UserConfig 45 public class DbUserConfig : UserConfig
46 { 46 {
47 private IObjectContainer db; 47 private IObjectContainer db;
48 48
49 public void LoadDefaults() { 49 public void LoadDefaults()
50 MainLog.Instance.Notice("DbUserConfig.cs:LoadDefaults() - Please press enter to retain default or enter new settings"); 50 {
51 MainLog.Instance.Notice("DbUserConfig.cs:LoadDefaults() - Please press enter to retain default or enter new settings");
51 52
52 this.DefaultStartupMsg = MainLog.Instance.CmdPrompt("Default startup message", "Welcome to OGS"); 53 this.DefaultStartupMsg = MainLog.Instance.CmdPrompt("Default startup message", "Welcome to OGS");
53 54
54 this.GridServerURL = MainLog.Instance.CmdPrompt("Grid server URL","http://127.0.0.1:" + GridConfig.DefaultHttpPort.ToString() + "/"); 55 this.GridServerURL = MainLog.Instance.CmdPrompt("Grid server URL","http://127.0.0.1:" + GridConfig.DefaultHttpPort.ToString() + "/");
55 this.GridSendKey = MainLog.Instance.CmdPrompt("Key to send to grid server","null"); 56 this.GridSendKey = MainLog.Instance.CmdPrompt("Key to send to grid server","null");
56 this.GridRecvKey = MainLog.Instance.CmdPrompt("Key to expect from grid server","null"); 57 this.GridRecvKey = MainLog.Instance.CmdPrompt("Key to expect from grid server","null");
57 } 58 }
58 59
59 public override void InitConfig() { 60 public override void InitConfig()
60 try { 61 {
61 db = Db4oFactory.OpenFile("openuser.yap"); 62 try
62 IObjectSet result = db.Get(typeof(DbUserConfig)); 63 {
63 if(result.Count==1) { 64 db = Db4oFactory.OpenFile("openuser.yap");
64 MainLog.Instance.Verbose("DbUserConfig.cs:InitConfig() - Found a UserConfig object in the local database, loading"); 65 IObjectSet result = db.Get(typeof(DbUserConfig));
65 foreach (DbUserConfig cfg in result) { 66 if(result.Count==1)
66 this.GridServerURL=cfg.GridServerURL; 67 {
67 this.GridSendKey=cfg.GridSendKey; 68 MainLog.Instance.Verbose("DBUSERCONFIG", "DbUserConfig.cs:InitConfig() - Found a UserConfig object in the local database, loading");
68 this.GridRecvKey=cfg.GridRecvKey; 69 foreach (DbUserConfig cfg in result)
69 this.DefaultStartupMsg=cfg.DefaultStartupMsg; 70 {
70 } 71 this.GridServerURL=cfg.GridServerURL;
71 } else { 72 this.GridSendKey=cfg.GridSendKey;
72 MainLog.Instance.Verbose("DbUserConfig.cs:InitConfig() - Could not find object in database, loading precompiled defaults"); 73 this.GridRecvKey=cfg.GridRecvKey;
73 LoadDefaults(); 74 this.DefaultStartupMsg=cfg.DefaultStartupMsg;
74 MainLog.Instance.Verbose("Writing out default settings to local database"); 75 }
75 db.Set(this); 76 }
76 db.Close(); 77 else
77 } 78 {
78 } catch(Exception e) { 79 MainLog.Instance.Verbose("DBUSERCONFIG", "DbUserConfig.cs:InitConfig() - Could not find object in database, loading precompiled defaults");
79 MainLog.Instance.Warn("DbUserConfig.cs:InitConfig() - Exception occured"); 80 LoadDefaults();
81 MainLog.Instance.Verbose("DBUSERCONFIG", "Writing out default settings to local database");
82 db.Set(this);
83 db.Close();
84 }
85 }
86 catch(Exception e)
87 {
88 MainLog.Instance.Warn("DbUserConfig.cs:InitConfig() - Exception occured");
80 MainLog.Instance.Warn(e.ToString()); 89 MainLog.Instance.Warn(e.ToString());
81 } 90 }
82 91
83 MainLog.Instance.Verbose("User settings loaded:"); 92 MainLog.Instance.Verbose("DBUSERCONFIG", "User settings loaded:");
84 MainLog.Instance.Verbose("Default startup message: " + this.DefaultStartupMsg); 93 MainLog.Instance.Verbose("DBUSERCONFIG", "Default startup message: " + this.DefaultStartupMsg);
85 MainLog.Instance.Verbose("Grid server URL: " + this.GridServerURL); 94 MainLog.Instance.Verbose("DBUSERCONFIG", "Grid server URL: " + this.GridServerURL);
86 MainLog.Instance.Verbose("Key to send to grid: " + this.GridSendKey); 95 MainLog.Instance.Verbose("DBUSERCONFIG", "Key to send to grid: " + this.GridSendKey);
87 MainLog.Instance.Verbose("Key to expect from grid: " + this.GridRecvKey); 96 MainLog.Instance.Verbose("DBUSERCONFIG", "Key to expect from grid: " + this.GridRecvKey);
88 } 97 }
89
90
91 public void Shutdown() {
92 db.Close();
93 }
94 }
95 98
99 public void Shutdown()
100 {
101 db.Close();
102 }
103 }
96} 104}