diff options
Diffstat (limited to 'OpenSim/Grid')
-rw-r--r-- | OpenSim/Grid/GridServer.Config/AssemblyInfo.cs | 57 | ||||
-rw-r--r-- | OpenSim/Grid/GridServer.Config/DbGridConfig.cs | 172 |
2 files changed, 0 insertions, 229 deletions
diff --git a/OpenSim/Grid/GridServer.Config/AssemblyInfo.cs b/OpenSim/Grid/GridServer.Config/AssemblyInfo.cs deleted file mode 100644 index 34247f3..0000000 --- a/OpenSim/Grid/GridServer.Config/AssemblyInfo.cs +++ /dev/null | |||
@@ -1,57 +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 | |||
28 | using System.Reflection; | ||
29 | using System.Runtime.InteropServices; | ||
30 | |||
31 | // Information about this assembly is defined by the following | ||
32 | // attributes. | ||
33 | // | ||
34 | // change them to the information which is associated with the assembly | ||
35 | // you compile. | ||
36 | |||
37 | [assembly: AssemblyTitle("GridConfig")] | ||
38 | [assembly: AssemblyDescription("")] | ||
39 | [assembly: AssemblyConfiguration("")] | ||
40 | [assembly: AssemblyCompany("")] | ||
41 | [assembly: AssemblyProduct("GridConfig")] | ||
42 | [assembly: AssemblyCopyright("")] | ||
43 | [assembly: AssemblyTrademark("")] | ||
44 | [assembly: AssemblyCulture("")] | ||
45 | |||
46 | // This sets the default COM visibility of types in the assembly to invisible. | ||
47 | // If you need to expose a type to COM, use [ComVisible(true)] on that type. | ||
48 | [assembly: ComVisible(false)] | ||
49 | |||
50 | // The assembly version has following format : | ||
51 | // | ||
52 | // Major.Minor.Build.Revision | ||
53 | // | ||
54 | // You can specify all values by your own or you can build default build and revision | ||
55 | // numbers with the '*' character (the default): | ||
56 | |||
57 | [assembly: AssemblyVersion("1.0.*")] | ||
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 | |||
28 | using System; | ||
29 | using Db4objects.Db4o; | ||
30 | using OpenSim.Framework.Configuration; | ||
31 | using OpenSim.Framework.Console; | ||
32 | using OpenSim.Framework.Interfaces; | ||
33 | |||
34 | namespace 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 | } | ||