diff options
author | Adam Frisby | 2007-06-01 23:34:37 +0000 |
---|---|---|
committer | Adam Frisby | 2007-06-01 23:34:37 +0000 |
commit | a7fe1b63f31fdfe438ed52512ccd277f9e33ff2e (patch) | |
tree | bbb2b2468742b6c9b9b077b4aee6b1fd610790d8 /OpenGridServices/OpenGrid.Config/GridConfigDb4o/DbGridConfig.cs | |
parent | * Zomg inventory server (incomplete shell) (diff) | |
download | opensim-SC_OLD-a7fe1b63f31fdfe438ed52512ccd277f9e33ff2e.zip opensim-SC_OLD-a7fe1b63f31fdfe438ed52512ccd277f9e33ff2e.tar.gz opensim-SC_OLD-a7fe1b63f31fdfe438ed52512ccd277f9e33ff2e.tar.bz2 opensim-SC_OLD-a7fe1b63f31fdfe438ed52512ccd277f9e33ff2e.tar.xz |
* ZOMG Wtf Comments?
* OpenGrid.Framework.Data is now well documented
Diffstat (limited to '')
-rw-r--r-- | OpenGridServices/OpenGrid.Config/GridConfigDb4o/DbGridConfig.cs | 68 |
1 files changed, 58 insertions, 10 deletions
diff --git a/OpenGridServices/OpenGrid.Config/GridConfigDb4o/DbGridConfig.cs b/OpenGridServices/OpenGrid.Config/GridConfigDb4o/DbGridConfig.cs index 2d00ca6..cbe64e6 100644 --- a/OpenGridServices/OpenGrid.Config/GridConfigDb4o/DbGridConfig.cs +++ b/OpenGridServices/OpenGrid.Config/GridConfigDb4o/DbGridConfig.cs | |||
@@ -12,7 +12,7 @@ | |||
12 | * names of its contributors may be used to endorse or promote products | 12 | * names of its contributors may be used to endorse or promote products |
13 | * derived from this software without specific prior written permission. | 13 | * derived from this software without specific prior written permission. |
14 | * | 14 | * |
15 | * THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY | 15 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY |
16 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 16 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
17 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 17 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
18 | * DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY | 18 | * DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY |
@@ -32,8 +32,15 @@ using Db4objects.Db4o; | |||
32 | 32 | ||
33 | namespace OpenGrid.Config.GridConfigDb4o | 33 | namespace OpenGrid.Config.GridConfigDb4o |
34 | { | 34 | { |
35 | /// <summary> | ||
36 | /// A grid configuration interface for returning the DB4o Config Provider | ||
37 | /// </summary> | ||
35 | public class Db40ConfigPlugin: IGridConfig | 38 | public class Db40ConfigPlugin: IGridConfig |
36 | { | 39 | { |
40 | /// <summary> | ||
41 | /// Loads and returns a configuration objeect | ||
42 | /// </summary> | ||
43 | /// <returns>A grid configuration object</returns> | ||
37 | public GridConfig GetConfigObject() | 44 | public GridConfig GetConfigObject() |
38 | { | 45 | { |
39 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Loading Db40Config dll"); | 46 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Loading Db40Config dll"); |
@@ -41,49 +48,81 @@ namespace OpenGrid.Config.GridConfigDb4o | |||
41 | } | 48 | } |
42 | } | 49 | } |
43 | 50 | ||
51 | /// <summary> | ||
52 | /// A DB4o based Gridserver configuration object | ||
53 | /// </summary> | ||
44 | public class DbGridConfig : GridConfig | 54 | public class DbGridConfig : GridConfig |
45 | { | 55 | { |
56 | /// <summary> | ||
57 | /// The DB4o Database | ||
58 | /// </summary> | ||
46 | private IObjectContainer db; | 59 | private IObjectContainer db; |
47 | 60 | ||
61 | /// <summary> | ||
62 | /// User configuration for the Grid Config interfaces | ||
63 | /// </summary> | ||
48 | public void LoadDefaults() { | 64 | public void LoadDefaults() { |
49 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH,"Config.cs:LoadDefaults() - Please press enter to retain default or enter new settings"); | 65 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH,"Config.cs:LoadDefaults() - Please press enter to retain default or enter new settings"); |
50 | 66 | ||
67 | // About the grid options | ||
51 | this.GridOwner = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Grid owner", "OGS development team"); | 68 | this.GridOwner = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Grid owner", "OGS development team"); |
52 | 69 | ||
70 | // Asset Options | ||
53 | this.DefaultAssetServer = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Default asset server","http://127.0.0.1:8003/"); | 71 | this.DefaultAssetServer = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Default asset server","http://127.0.0.1:8003/"); |
54 | this.AssetSendKey = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Key to send to asset server","null"); | 72 | this.AssetSendKey = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Key to send to asset server","null"); |
55 | this.AssetRecvKey = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Key to expect from asset server","null"); | 73 | this.AssetRecvKey = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Key to expect from asset server","null"); |
56 | 74 | ||
57 | this.DefaultUserServer = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Default user server","http://127.0.0.1:8002/"); | 75 | // User Server Options |
58 | this.UserSendKey = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Key to send to user server","null"); | 76 | this.DefaultUserServer = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Default user server","http://127.0.0.1:8002/"); |
59 | this.UserRecvKey = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Key to expect from user server","null"); | 77 | this.UserSendKey = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Key to send to user server","null"); |
78 | this.UserRecvKey = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Key to expect from user server","null"); | ||
60 | 79 | ||
61 | this.SimSendKey = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Key to send to sims","null"); | 80 | // Region Server Options |
62 | this.SimRecvKey = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Key to expect from sims","null"); | 81 | this.SimSendKey = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Key to send to sims","null"); |
82 | this.SimRecvKey = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Key to expect from sims","null"); | ||
63 | } | 83 | } |
64 | 84 | ||
85 | /// <summary> | ||
86 | /// Initialises a new configuration object | ||
87 | /// </summary> | ||
65 | public override void InitConfig() { | 88 | public override void InitConfig() { |
66 | try { | 89 | try { |
90 | // Perform Db4o initialisation | ||
67 | db = Db4oFactory.OpenFile("opengrid.yap"); | 91 | db = Db4oFactory.OpenFile("opengrid.yap"); |
92 | |||
93 | // Locate the grid configuration object | ||
68 | IObjectSet result = db.Get(typeof(DbGridConfig)); | 94 | IObjectSet result = db.Get(typeof(DbGridConfig)); |
95 | // Found? | ||
69 | if(result.Count==1) { | 96 | if(result.Count==1) { |
70 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Config.cs:InitConfig() - Found a GridConfig object in the local database, loading"); | 97 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Config.cs:InitConfig() - Found a GridConfig object in the local database, loading"); |
71 | foreach (DbGridConfig cfg in result) { | 98 | foreach (DbGridConfig cfg in result) { |
99 | // Import each setting into this class | ||
100 | // Grid Settings | ||
72 | this.GridOwner=cfg.GridOwner; | 101 | this.GridOwner=cfg.GridOwner; |
102 | // Asset Settings | ||
73 | this.DefaultAssetServer=cfg.DefaultAssetServer; | 103 | this.DefaultAssetServer=cfg.DefaultAssetServer; |
74 | this.AssetSendKey=cfg.AssetSendKey; | 104 | this.AssetSendKey=cfg.AssetSendKey; |
75 | this.AssetRecvKey=cfg.AssetRecvKey; | 105 | this.AssetRecvKey=cfg.AssetRecvKey; |
106 | // User Settings | ||
76 | this.DefaultUserServer=cfg.DefaultUserServer; | 107 | this.DefaultUserServer=cfg.DefaultUserServer; |
77 | this.UserSendKey=cfg.UserSendKey; | 108 | this.UserSendKey=cfg.UserSendKey; |
78 | this.UserRecvKey=cfg.UserRecvKey; | 109 | this.UserRecvKey=cfg.UserRecvKey; |
110 | // Region Settings | ||
79 | this.SimSendKey=cfg.SimSendKey; | 111 | this.SimSendKey=cfg.SimSendKey; |
80 | this.SimRecvKey=cfg.SimRecvKey; | 112 | this.SimRecvKey=cfg.SimRecvKey; |
81 | } | 113 | } |
114 | // Create a new configuration object from this class | ||
82 | } else { | 115 | } else { |
83 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Config.cs:InitConfig() - Could not find object in database, loading precompiled defaults"); | 116 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Config.cs:InitConfig() - Could not find object in database, loading precompiled defaults"); |
117 | |||
118 | // Load default settings into this class | ||
84 | LoadDefaults(); | 119 | LoadDefaults(); |
85 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Writing out default settings to local database"); | 120 | |
121 | // Saves to the database file... | ||
122 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Writing out default settings to local database"); | ||
86 | db.Set(this); | 123 | db.Set(this); |
124 | |||
125 | // Closes file locks | ||
87 | db.Close(); | 126 | db.Close(); |
88 | } | 127 | } |
89 | } catch(Exception e) { | 128 | } catch(Exception e) { |
@@ -91,19 +130,28 @@ namespace OpenGrid.Config.GridConfigDb4o | |||
91 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM,e.ToString()); | 130 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM,e.ToString()); |
92 | } | 131 | } |
93 | 132 | ||
133 | // Grid Settings | ||
94 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Grid settings loaded:"); | 134 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Grid settings loaded:"); |
95 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Grid owner: " + this.GridOwner); | 135 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Grid owner: " + this.GridOwner); |
136 | |||
137 | // Asset Settings | ||
96 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Default asset server: " + this.DefaultAssetServer); | 138 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Default asset server: " + this.DefaultAssetServer); |
97 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Key to send to asset server: " + this.AssetSendKey); | 139 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Key to send to asset server: " + this.AssetSendKey); |
98 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Key to expect from asset server: " + this.AssetRecvKey); | 140 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Key to expect from asset server: " + this.AssetRecvKey); |
141 | |||
142 | // User Settings | ||
99 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Default user server: " + this.DefaultUserServer); | 143 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Default user server: " + this.DefaultUserServer); |
100 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Key to send to user server: " + this.UserSendKey); | 144 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Key to send to user server: " + this.UserSendKey); |
101 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Key to expect from user server: " + this.UserRecvKey); | 145 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Key to expect from user server: " + this.UserRecvKey); |
146 | |||
147 | // Region Settings | ||
102 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Key to send to sims: " + this.SimSendKey); | 148 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Key to send to sims: " + this.SimSendKey); |
103 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Key to expect from sims: " + this.SimRecvKey); | 149 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Key to expect from sims: " + this.SimRecvKey); |
104 | } | 150 | } |
105 | 151 | ||
106 | 152 | /// <summary> | |
153 | /// Closes down the database and releases filesystem locks | ||
154 | /// </summary> | ||
107 | public void Shutdown() { | 155 | public void Shutdown() { |
108 | db.Close(); | 156 | db.Close(); |
109 | } | 157 | } |