aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Grid/GridServer.Config/DbGridConfig.cs
diff options
context:
space:
mode:
authorSean Dague2008-05-28 17:35:34 +0000
committerSean Dague2008-05-28 17:35:34 +0000
commitc4868b0eda3ce61c1d0d1be7475fad7a4676fd2f (patch)
tree2137c81d145e4ad2987b3b6d9d5239c2a62e907c /OpenSim/Grid/GridServer.Config/DbGridConfig.cs
parent* Put textures into a separate assets/ directory in the opensim archive (diff)
downloadopensim-SC_OLD-c4868b0eda3ce61c1d0d1be7475fad7a4676fd2f.zip
opensim-SC_OLD-c4868b0eda3ce61c1d0d1be7475fad7a4676fd2f.tar.gz
opensim-SC_OLD-c4868b0eda3ce61c1d0d1be7475fad7a4676fd2f.tar.bz2
opensim-SC_OLD-c4868b0eda3ce61c1d0d1be7475fad7a4676fd2f.tar.xz
spring cleaning, remove a bit of db4o grid server
code that was still in tree.
Diffstat (limited to '')
-rw-r--r--OpenSim/Grid/GridServer.Config/DbGridConfig.cs172
1 files changed, 0 insertions, 172 deletions
diff --git a/OpenSim/Grid/GridServer.Config/DbGridConfig.cs b/OpenSim/Grid/GridServer.Config/DbGridConfig.cs
deleted file mode 100644
index fbfc56f..0000000
--- a/OpenSim/Grid/GridServer.Config/DbGridConfig.cs
+++ /dev/null
@@ -1,172 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.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
28using System;
29using Db4objects.Db4o;
30using OpenSim.Framework.Configuration;
31using OpenSim.Framework.Console;
32using OpenSim.Framework.Interfaces;
33
34namespace OpenGrid.Config.GridConfigDb4o
35{
36 /// <summary>
37 /// A grid configuration interface for returning the DB4o Config Provider
38 /// </summary>
39 public class Db40ConfigPlugin: IGridConfig
40 {
41 private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
42
43 /// <summary>
44 /// Loads and returns a configuration objeect
45 /// </summary>
46 /// <returns>A grid configuration object</returns>
47 public GridConfig GetConfigObject()
48 {
49 m_log.Info("[DBGRIDCONFIG]: Loading Db40Config dll");
50 return new DbGridConfig();
51 }
52 }
53
54 /// <summary>
55 /// A DB4o based Gridserver configuration object
56 /// </summary>
57 public class DbGridConfig : GridConfig
58 {
59 /// <summary>
60 /// The DB4o Database
61 /// </summary>
62 private IObjectContainer db;
63
64 /// <summary>
65 /// User configuration for the Grid Config interfaces
66 /// </summary>
67 public void LoadDefaults()
68 {
69 MainConsole.Instance.Info("DbGridConfig.cs:LoadDefaults() - Please press enter to retain default or enter new settings");
70
71 // About the grid options
72 this.GridOwner = MainConsole.Instance.CmdPrompt("Grid owner", "OGS development team");
73
74 // Asset Options
75 this.DefaultAssetServer = MainConsole.Instance.CmdPrompt("Default asset server","http://127.0.0.1:" + AssetConfig.DefaultHttpPort.ToString() + "/");
76 this.AssetSendKey = MainConsole.Instance.CmdPrompt("Key to send to asset server","null");
77 this.AssetRecvKey = MainConsole.Instance.CmdPrompt("Key to expect from asset server","null");
78
79 // User Server Options
80 this.DefaultUserServer = MainConsole.Instance.CmdPrompt("Default user server","http://127.0.0.1:" + UserConfig.DefaultHttpPort.ToString() + "/");
81 this.UserSendKey = MainConsole.Instance.CmdPrompt("Key to send to user server","null");
82 this.UserRecvKey = MainConsole.Instance.CmdPrompt("Key to expect from user server","null");
83
84 // Region Server Options
85 this.SimSendKey = MainConsole.Instance.CmdPrompt("Key to send to sims","null");
86 this.SimRecvKey = MainConsole.Instance.CmdPrompt("Key to expect from sims","null");
87 }
88
89 /// <summary>
90 /// Initialises a new configuration object
91 /// </summary>
92 public override void InitConfig()
93 {
94 try
95 {
96 // Perform Db4o initialisation
97 db = Db4oFactory.OpenFile("opengrid.yap");
98
99 // Locate the grid configuration object
100 IObjectSet result = db.Get(typeof(DbGridConfig));
101 // Found?
102 if (result.Count==1)
103 {
104 m_log.Info("[DBGRIDCONFIG]: Found a GridConfig object in the local database, loading");
105 foreach (DbGridConfig cfg in result)
106 {
107 // Import each setting into this class
108 // Grid Settings
109 this.GridOwner=cfg.GridOwner;
110 // Asset Settings
111 this.DefaultAssetServer=cfg.DefaultAssetServer;
112 this.AssetSendKey=cfg.AssetSendKey;
113 this.AssetRecvKey=cfg.AssetRecvKey;
114 // User Settings
115 this.DefaultUserServer=cfg.DefaultUserServer;
116 this.UserSendKey=cfg.UserSendKey;
117 this.UserRecvKey=cfg.UserRecvKey;
118 // Region Settings
119 this.SimSendKey=cfg.SimSendKey;
120 this.SimRecvKey=cfg.SimRecvKey;
121 }
122 // Create a new configuration object from this class
123 }
124 else
125 {
126 m_log.Info("[DBGRIDCONFIG]: Could not find object in database, loading precompiled defaults");
127
128 // Load default settings into this class
129 LoadDefaults();
130
131 // Saves to the database file...
132 m_log.Info("[DBGRIDCONFIG]: Writing out default settings to local database");
133 db.Set(this);
134
135 // Closes file locks
136 db.Close();
137 }
138 }
139 catch(Exception e)
140 {
141 m_log.Warn("DbGridConfig.cs:InitConfig() - Exception occured");
142 m_log.Warn(e.ToString());
143 }
144
145 // Grid Settings
146 m_log.Info("[DBGRIDCONFIG]: Grid settings loaded:");
147 m_log.Info("[DBGRIDCONFIG]: Grid owner: " + this.GridOwner);
148
149 // Asset Settings
150 m_log.Info("[DBGRIDCONFIG]: Default asset server: " + this.DefaultAssetServer);
151 m_log.Info("[DBGRIDCONFIG]: Key to send to asset server: " + this.AssetSendKey);
152 m_log.Info("[DBGRIDCONFIG]: Key to expect from asset server: " + this.AssetRecvKey);
153
154 // User Settings
155 m_log.Info("[DBGRIDCONFIG]: Default user server: " + this.DefaultUserServer);
156 m_log.Info("[DBGRIDCONFIG]: Key to send to user server: " + this.UserSendKey);
157 m_log.Info("[DBGRIDCONFIG]: Key to expect from user server: " + this.UserRecvKey);
158
159 // Region Settings
160 m_log.Info("[DBGRIDCONFIG]: Key to send to sims: " + this.SimSendKey);
161 m_log.Info("[DBGRIDCONFIG]: Key to expect from sims: " + this.SimRecvKey);
162 }
163
164 /// <summary>
165 /// Closes down the database and releases filesystem locks
166 /// </summary>
167 public void Shutdown()
168 {
169 db.Close();
170 }
171 }
172}