aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Grid/GridServer.Config/DbGridConfig.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Grid/GridServer.Config/DbGridConfig.cs')
-rw-r--r--OpenSim/Grid/GridServer.Config/DbGridConfig.cs135
1 files changed, 72 insertions, 63 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}