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