aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Grid
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Grid/GridServer.Config/DbGridConfig.cs135
-rw-r--r--OpenSim/Grid/UserServer.Config/DbUserConfig.cs164
2 files changed, 158 insertions, 141 deletions
diff --git a/OpenSim/Grid/GridServer.Config/DbGridConfig.cs b/OpenSim/Grid/GridServer.Config/DbGridConfig.cs
index 050df83..c04132a 100644
--- a/OpenSim/Grid/GridServer.Config/DbGridConfig.cs
+++ b/OpenSim/Grid/GridServer.Config/DbGridConfig.cs
@@ -36,126 +36,135 @@ namespace OpenGrid.Config.GridConfigDb4o
36 /// <summary> 36 /// <summary>
37 /// A grid configuration interface for returning the DB4o Config Provider 37 /// A grid configuration interface for returning the DB4o Config Provider
38 /// </summary> 38 /// </summary>
39 public class Db40ConfigPlugin: IGridConfig 39 public class Db40ConfigPlugin: IGridConfig
40 { 40 {
41 /// <summary> 41 /// <summary>
42 /// Loads and returns a configuration objeect 42 /// Loads and returns a configuration objeect
43 /// </summary> 43 /// </summary>
44 /// <returns>A grid configuration object</returns> 44 /// <returns>A grid configuration object</returns>
45 public GridConfig GetConfigObject() 45 public GridConfig GetConfigObject()
46 { 46 {
47 MainLog.Instance.Verbose("Loading Db40Config dll"); 47 MainLog.Instance.Verbose("DBGRIDCONFIG", "Loading Db40Config dll");
48 return ( new DbGridConfig()); 48 return new DbGridConfig();
49 } 49 }
50 } 50 }
51 51
52 /// <summary> 52 /// <summary>
53 /// A DB4o based Gridserver configuration object 53 /// A DB4o based Gridserver configuration object
54 /// </summary> 54 /// </summary>
55 public class DbGridConfig : GridConfig 55 public class DbGridConfig : GridConfig
56 { 56 {
57 /// <summary> 57 /// <summary>
58 /// The DB4o Database 58 /// The DB4o Database
59 /// </summary> 59 /// </summary>
60 private IObjectContainer db; 60 private IObjectContainer db;
61 61
62 /// <summary> 62 /// <summary>
63 /// User configuration for the Grid Config interfaces 63 /// User configuration for the Grid Config interfaces
64 /// </summary> 64 /// </summary>
65 public void LoadDefaults() { 65 public void LoadDefaults()
66 MainLog.Instance.Notice("DbGridConfig.cs:LoadDefaults() - Please press enter to retain default or enter new settings"); 66 {
67 MainLog.Instance.Notice("DbGridConfig.cs:LoadDefaults() - Please press enter to retain default or enter new settings");
67 68
68 // About the grid options 69 // About the grid options
69 this.GridOwner = MainLog.Instance.CmdPrompt("Grid owner", "OGS development team"); 70 this.GridOwner = MainLog.Instance.CmdPrompt("Grid owner", "OGS development team");
70 71
71 // Asset Options 72 // Asset Options
72 this.DefaultAssetServer = MainLog.Instance.CmdPrompt("Default asset server","http://127.0.0.1:" + AssetConfig.DefaultHttpPort.ToString() + "/"); 73 this.DefaultAssetServer = MainLog.Instance.CmdPrompt("Default asset server","http://127.0.0.1:" + AssetConfig.DefaultHttpPort.ToString() + "/");
73 this.AssetSendKey = MainLog.Instance.CmdPrompt("Key to send to asset server","null"); 74 this.AssetSendKey = MainLog.Instance.CmdPrompt("Key to send to asset server","null");
74 this.AssetRecvKey = MainLog.Instance.CmdPrompt("Key to expect from asset server","null"); 75 this.AssetRecvKey = MainLog.Instance.CmdPrompt("Key to expect from asset server","null");
75 76
76 // User Server Options 77 // User Server Options
77 this.DefaultUserServer = MainLog.Instance.CmdPrompt("Default user server","http://127.0.0.1:" + UserConfig.DefaultHttpPort.ToString() + "/"); 78 this.DefaultUserServer = MainLog.Instance.CmdPrompt("Default user server","http://127.0.0.1:" + UserConfig.DefaultHttpPort.ToString() + "/");
78 this.UserSendKey = MainLog.Instance.CmdPrompt("Key to send to user server","null"); 79 this.UserSendKey = MainLog.Instance.CmdPrompt("Key to send to user server","null");
79 this.UserRecvKey = MainLog.Instance.CmdPrompt("Key to expect from user server","null"); 80 this.UserRecvKey = MainLog.Instance.CmdPrompt("Key to expect from user server","null");
80 81
81 // Region Server Options 82 // Region Server Options
82 this.SimSendKey = MainLog.Instance.CmdPrompt("Key to send to sims","null"); 83 this.SimSendKey = MainLog.Instance.CmdPrompt("Key to send to sims","null");
83 this.SimRecvKey = MainLog.Instance.CmdPrompt("Key to expect from sims","null"); 84 this.SimRecvKey = MainLog.Instance.CmdPrompt("Key to expect from sims","null");
84 } 85 }
85 86
86 /// <summary> 87 /// <summary>
87 /// Initialises a new configuration object 88 /// Initialises a new configuration object
88 /// </summary> 89 /// </summary>
89 public override void InitConfig() { 90 public override void InitConfig()
90 try { 91 {
92 try
93 {
91 // Perform Db4o initialisation 94 // Perform Db4o initialisation
92 db = Db4oFactory.OpenFile("opengrid.yap"); 95 db = Db4oFactory.OpenFile("opengrid.yap");
93 96
94 // Locate the grid configuration object 97 // Locate the grid configuration object
95 IObjectSet result = db.Get(typeof(DbGridConfig)); 98 IObjectSet result = db.Get(typeof(DbGridConfig));
96 // Found? 99 // Found?
97 if(result.Count==1) { 100 if (result.Count==1)
98 MainLog.Instance.Verbose("DbGridConfig.cs:InitConfig() - Found a GridConfig object in the local database, loading"); 101 {
99 foreach (DbGridConfig cfg in result) { 102 MainLog.Instance.Verbose("DBGRIDCONFIG", "Found a GridConfig object in the local database, loading");
103 foreach (DbGridConfig cfg in result)
104 {
100 // Import each setting into this class 105 // Import each setting into this class
101 // Grid Settings 106 // Grid Settings
102 this.GridOwner=cfg.GridOwner; 107 this.GridOwner=cfg.GridOwner;
103 // Asset Settings 108 // Asset Settings
104 this.DefaultAssetServer=cfg.DefaultAssetServer; 109 this.DefaultAssetServer=cfg.DefaultAssetServer;
105 this.AssetSendKey=cfg.AssetSendKey; 110 this.AssetSendKey=cfg.AssetSendKey;
106 this.AssetRecvKey=cfg.AssetRecvKey; 111 this.AssetRecvKey=cfg.AssetRecvKey;
107 // User Settings 112 // User Settings
108 this.DefaultUserServer=cfg.DefaultUserServer; 113 this.DefaultUserServer=cfg.DefaultUserServer;
109 this.UserSendKey=cfg.UserSendKey; 114 this.UserSendKey=cfg.UserSendKey;
110 this.UserRecvKey=cfg.UserRecvKey; 115 this.UserRecvKey=cfg.UserRecvKey;
111 // Region Settings 116 // Region Settings
112 this.SimSendKey=cfg.SimSendKey; 117 this.SimSendKey=cfg.SimSendKey;
113 this.SimRecvKey=cfg.SimRecvKey; 118 this.SimRecvKey=cfg.SimRecvKey;
114 } 119 }
115 // Create a new configuration object from this class 120 // Create a new configuration object from this class
116 } else { 121 }
117 MainLog.Instance.Verbose("DbGridConfig.cs:InitConfig() - Could not find object in database, loading precompiled defaults"); 122 else
123 {
124 MainLog.Instance.Verbose("DBGRIDCONFIG", "Could not find object in database, loading precompiled defaults");
118 125
119 // Load default settings into this class 126 // Load default settings into this class
120 LoadDefaults(); 127 LoadDefaults();
121 128
122 // Saves to the database file... 129 // Saves to the database file...
123 MainLog.Instance.Verbose( "Writing out default settings to local database"); 130 MainLog.Instance.Verbose("DBGRIDCONFIG", "Writing out default settings to local database");
124 db.Set(this); 131 db.Set(this);
125 132
126 // Closes file locks 133 // Closes file locks
127 db.Close(); 134 db.Close();
128 } 135 }
129 } catch(Exception e) { 136 }
130 MainLog.Instance.Warn("DbGridConfig.cs:InitConfig() - Exception occured"); 137 catch(Exception e)
138 {
139 MainLog.Instance.Warn("DbGridConfig.cs:InitConfig() - Exception occured");
131 MainLog.Instance.Warn(e.ToString()); 140 MainLog.Instance.Warn(e.ToString());
132 } 141 }
133 142
134 // Grid Settings 143 // Grid Settings
135 MainLog.Instance.Verbose("Grid settings loaded:"); 144 MainLog.Instance.Verbose("DBGRIDCONFIG", "Grid settings loaded:");
136 MainLog.Instance.Verbose("Grid owner: " + this.GridOwner); 145 MainLog.Instance.Verbose("DBGRIDCONFIG", "Grid owner: " + this.GridOwner);
137 146
138 // Asset Settings 147 // Asset Settings
139 MainLog.Instance.Verbose("Default asset server: " + this.DefaultAssetServer); 148 MainLog.Instance.Verbose("DBGRIDCONFIG", "Default asset server: " + this.DefaultAssetServer);
140 MainLog.Instance.Verbose("Key to send to asset server: " + this.AssetSendKey); 149 MainLog.Instance.Verbose("DBGRIDCONFIG", "Key to send to asset server: " + this.AssetSendKey);
141 MainLog.Instance.Verbose("Key to expect from asset server: " + this.AssetRecvKey); 150 MainLog.Instance.Verbose("DBGRIDCONFIG", "Key to expect from asset server: " + this.AssetRecvKey);
142 151
143 // User Settings 152 // User Settings
144 MainLog.Instance.Verbose("Default user server: " + this.DefaultUserServer); 153 MainLog.Instance.Verbose("DBGRIDCONFIG", "Default user server: " + this.DefaultUserServer);
145 MainLog.Instance.Verbose("Key to send to user server: " + this.UserSendKey); 154 MainLog.Instance.Verbose("DBGRIDCONFIG", "Key to send to user server: " + this.UserSendKey);
146 MainLog.Instance.Verbose("Key to expect from user server: " + this.UserRecvKey); 155 MainLog.Instance.Verbose("DBGRIDCONFIG", "Key to expect from user server: " + this.UserRecvKey);
147 156
148 // Region Settings 157 // Region Settings
149 MainLog.Instance.Verbose("Key to send to sims: " + this.SimSendKey); 158 MainLog.Instance.Verbose("DBGRIDCONFIG", "Key to send to sims: " + this.SimSendKey);
150 MainLog.Instance.Verbose("Key to expect from sims: " + this.SimRecvKey); 159 MainLog.Instance.Verbose("DBGRIDCONFIG", "Key to expect from sims: " + this.SimRecvKey);
151 } 160 }
152 161
153 /// <summary> 162 /// <summary>
154 /// Closes down the database and releases filesystem locks 163 /// Closes down the database and releases filesystem locks
155 /// </summary> 164 /// </summary>
156 public void Shutdown() { 165 public void Shutdown()
157 db.Close(); 166 {
158 } 167 db.Close();
159 } 168 }
160 169 }
161} 170}
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}