aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/Config
diff options
context:
space:
mode:
authorgareth2007-03-22 10:11:15 +0000
committergareth2007-03-22 10:11:15 +0000
commit7daa3955bc3a1918e40962851f9e8d38597a245e (patch)
treebee3e1372a7eed0c1b220a8a49f7bee7d29a6b91 /src/Config
parentLoad XML for neighbourinfo from grid (diff)
downloadopensim-SC_OLD-7daa3955bc3a1918e40962851f9e8d38597a245e.zip
opensim-SC_OLD-7daa3955bc3a1918e40962851f9e8d38597a245e.tar.gz
opensim-SC_OLD-7daa3955bc3a1918e40962851f9e8d38597a245e.tar.bz2
opensim-SC_OLD-7daa3955bc3a1918e40962851f9e8d38597a245e.tar.xz
brought zircon branch into trunk
Diffstat (limited to '')
-rw-r--r--OpenSim.Framework/IConfig.cs (renamed from src/Config.cs)81
-rw-r--r--src/Config/SimConfig/AssemblyInfo.cs21
-rw-r--r--src/Config/SimConfig/Db4SimConfig.cs177
-rw-r--r--src/Config/SimConfig/SimConfig.csproj52
-rw-r--r--src/Config/default.build53
5 files changed, 40 insertions, 344 deletions
diff --git a/src/Config.cs b/OpenSim.Framework/IConfig.cs
index 1c0a6cc..ca7f645 100644
--- a/src/Config.cs
+++ b/OpenSim.Framework/IConfig.cs
@@ -31,49 +31,48 @@ using System;
31using System.Collections.Generic; 31using System.Collections.Generic;
32using System.IO; 32using System.IO;
33using libsecondlife; 33using libsecondlife;
34using OpenSim.world; 34//using OpenSim.world;
35 35
36namespace OpenSim 36namespace OpenSim.Framework.Interfaces
37{ 37{
38 /// <summary> 38 /// <summary>
39 /// This class handles connection to the underlying database used for configuration of the region. 39 /// This class handles connection to the underlying database used for configuration of the region.
40 /// Region content is also stored by this class. The main entry point is InitConfig() which attempts to locate 40 /// Region content is also stored by this class. The main entry point is InitConfig() which attempts to locate
41 /// opensim.yap in the current working directory. If opensim.yap can not be found, default settings are loaded from 41 /// opensim.yap in the current working directory. If opensim.yap can not be found, default settings are loaded from
42 /// what is hardcoded here and then saved into opensim.yap for future startups. 42 /// what is hardcoded here and then saved into opensim.yap for future startups.
43 /// </summary> 43 /// </summary>
44 44
45 45
46 public abstract class SimConfig 46 public abstract class SimConfig
47 { 47 {
48 public string RegionName; 48 public string RegionName;
49 49
50 public uint RegionLocX; 50 public uint RegionLocX;
51 public uint RegionLocY; 51 public uint RegionLocY;
52 public ulong RegionHandle; 52 public ulong RegionHandle;
53 53
54 public int IPListenPort; 54 public int IPListenPort;
55 public string IPListenAddr; 55 public string IPListenAddr;
56 56
57 public string AssetURL; 57 public string AssetURL;
58 public string AssetSendKey; 58 public string AssetSendKey;
59 59
60 public string GridURL; 60 public string GridURL;
61 public string GridSendKey; 61 public string GridSendKey;
62 public string GridRecvKey; 62 public string GridRecvKey;
63 public string UserURL; 63 public string UserURL;
64 public string UserSendKey; 64 public string UserSendKey;
65 public string UserRecvKey; 65 public string UserRecvKey;
66
67 public abstract void InitConfig(bool sandboxMode);
68 public abstract void LoadFromGrid();
69 public abstract float[] LoadWorld();
70 public abstract void SaveMap(float[] heightmap);
71
72 }
66 73
67 74 public interface ISimConfig
68 public abstract void InitConfig(); 75 {
69 public abstract void LoadFromGrid(); 76 SimConfig GetConfigObject();
70 public abstract World LoadWorld(); 77 }
71 public abstract void SaveMap();
72
73 }
74
75 public interface ISimConfig
76 {
77 SimConfig GetConfigObject();
78 }
79} 78}
diff --git a/src/Config/SimConfig/AssemblyInfo.cs b/src/Config/SimConfig/AssemblyInfo.cs
deleted file mode 100644
index 7fabd63..0000000
--- a/src/Config/SimConfig/AssemblyInfo.cs
+++ /dev/null
@@ -1,21 +0,0 @@
1using System;
2using System.Reflection;
3using System.Runtime.InteropServices;
4
5// ------------------------------------------------------------------------------
6// <autogenerated>
7// This code was generated by a tool.
8// Mono Runtime Version: 2.0.50727.42
9//
10// Changes to this file may cause incorrect behavior and will be lost if
11// the code is regenerated.
12// </autogenerated>
13// ------------------------------------------------------------------------------
14
15[assembly: ComVisibleAttribute(false)]
16[assembly: CLSCompliantAttribute(false)]
17[assembly: AssemblyVersionAttribute("0.1.0.240")]
18[assembly: AssemblyTitleAttribute("opensim-simconfig")]
19[assembly: AssemblyDescriptionAttribute("The default configuration handler")]
20[assembly: AssemblyCopyrightAttribute("Copyright © OGS development team 2007")]
21
diff --git a/src/Config/SimConfig/Db4SimConfig.cs b/src/Config/SimConfig/Db4SimConfig.cs
deleted file mode 100644
index 1b696fe..0000000
--- a/src/Config/SimConfig/Db4SimConfig.cs
+++ /dev/null
@@ -1,177 +0,0 @@
1/*
2* Copyright (c) OpenSim project, http://sim.opensecondlife.org/
3*
4* Redistribution and use in source and binary forms, with or without
5* modification, are permitted provided that the following conditions are met:
6* * Redistributions of source code must retain the above copyright
7* notice, this list of conditions and the following disclaimer.
8* * Redistributions in binary form must reproduce the above copyright
9* notice, this list of conditions and the following disclaimer in the
10* documentation and/or other materials provided with the distribution.
11* * Neither the name of the <organization> nor the
12* names of its contributors may be used to endorse or promote products
13* derived from this software without specific prior written permission.
14*
15* THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY
16* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18* DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
19* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25*
26*/
27using System;
28using System.Collections.Generic;
29using OpenSim;
30using OpenSim.world;
31using Db4objects.Db4o;
32
33namespace Db40SimConfig
34{
35 public class Db40ConfigPlugin: ISimConfig
36 {
37 public SimConfig GetConfigObject()
38 {
39 ServerConsole.MainConsole.Instance.WriteLine("Loading Db40Config dll");
40 return ( new DbSimConfig());
41 }
42 }
43
44 public class DbSimConfig :SimConfig
45 {
46 private IObjectContainer db;
47
48 public void LoadDefaults() {
49 ServerConsole.MainConsole.Instance.WriteLine("Config.cs:LoadDefaults() - Please press enter to retain default or enter new settings");
50
51 this.RegionName=ServerConsole.MainConsole.Instance.CmdPrompt("Name [OpenSim test]: ","OpenSim test");
52 this.RegionLocX=(uint)Convert.ToInt32(ServerConsole.MainConsole.Instance.CmdPrompt("Grid Location X [997]: ","997"));
53 this.RegionLocY=(uint)Convert.ToInt32(ServerConsole.MainConsole.Instance.CmdPrompt("Grid Location Y [996]: ","996"));
54 this.IPListenPort=Convert.ToInt32(ServerConsole.MainConsole.Instance.CmdPrompt("UDP port for client connections [9000]: ","9000"));
55 this.IPListenAddr=ServerConsole.MainConsole.Instance.CmdPrompt("IP Address to listen on for client connections [127.0.0.1]: ","127.0.0.1");
56
57 if(!OpenSim_Main.sim.sandbox)
58 {
59 this.AssetURL=ServerConsole.MainConsole.Instance.CmdPrompt("Asset server URL: ");
60 this.AssetSendKey=ServerConsole.MainConsole.Instance.CmdPrompt("Asset server key: ");
61 this.GridURL=ServerConsole.MainConsole.Instance.CmdPrompt("Grid server URL: ");
62 this.GridSendKey=ServerConsole.MainConsole.Instance.CmdPrompt("Key to send to grid server: ");
63 this.GridRecvKey=ServerConsole.MainConsole.Instance.CmdPrompt("Key to expect from grid server: ");
64 this.UserURL=ServerConsole.MainConsole.Instance.CmdPrompt("User server URL: ");
65 this.UserSendKey=ServerConsole.MainConsole.Instance.CmdPrompt("Key to send to user server: ");
66 this.UserRecvKey=ServerConsole.MainConsole.Instance.CmdPrompt("Key to expect from user server: ");
67 }
68 this.RegionHandle = Util.UIntsToLong((RegionLocX*256), (RegionLocY*256));
69 }
70
71 public override void InitConfig() {
72 try {
73 db = Db4oFactory.OpenFile("opensim.yap");
74 IObjectSet result = db.Get(typeof(DbSimConfig));
75 if(result.Count==1) {
76 ServerConsole.MainConsole.Instance.WriteLine("Config.cs:InitConfig() - Found a SimConfig object in the local database, loading");
77 foreach (DbSimConfig cfg in result) {
78 this.RegionName = cfg.RegionName;
79 this.RegionLocX = cfg.RegionLocX;
80 this.RegionLocY = cfg.RegionLocY;
81 this.RegionHandle = Util.UIntsToLong((RegionLocX*256), (RegionLocY*256));
82 this.IPListenPort = cfg.IPListenPort;
83 this.IPListenAddr = cfg.IPListenAddr;
84 this.AssetURL = cfg.AssetURL;
85 this.AssetSendKey = cfg.AssetSendKey;
86 this.GridURL = cfg.GridURL;
87 this.GridSendKey = cfg.GridSendKey;
88 }
89 } else {
90 ServerConsole.MainConsole.Instance.WriteLine("Config.cs:InitConfig() - Could not find object in database, loading precompiled defaults");
91 LoadDefaults();
92 ServerConsole.MainConsole.Instance.WriteLine("Writing out default settings to local database");
93 db.Set(this);
94 }
95 } catch(Exception e) {
96 db.Close();
97 ServerConsole.MainConsole.Instance.WriteLine("Config.cs:InitConfig() - Exception occured");
98 ServerConsole.MainConsole.Instance.WriteLine(e.ToString());
99 }
100
101 ServerConsole.MainConsole.Instance.WriteLine("Sim settings loaded:");
102 ServerConsole.MainConsole.Instance.WriteLine("Name: " + this.RegionName);
103 ServerConsole.MainConsole.Instance.WriteLine("Region Location: [" + this.RegionLocX.ToString() + "," + this.RegionLocY + "]");
104 ServerConsole.MainConsole.Instance.WriteLine("Region Handle: " + this.RegionHandle.ToString());
105 ServerConsole.MainConsole.Instance.WriteLine("Listening on IP: " + this.IPListenAddr + ":" + this.IPListenPort);
106 ServerConsole.MainConsole.Instance.WriteLine("Sandbox Mode? " + OpenSim_Main.sim.sandbox.ToString());
107 ServerConsole.MainConsole.Instance.WriteLine("Asset URL: " + this.AssetURL);
108 ServerConsole.MainConsole.Instance.WriteLine("Asset key: " + this.AssetSendKey);
109 ServerConsole.MainConsole.Instance.WriteLine("Grid URL: " + this.GridURL);
110 ServerConsole.MainConsole.Instance.WriteLine("Grid key: " + this.GridSendKey);
111 }
112
113 public override World LoadWorld()
114 {
115 ServerConsole.MainConsole.Instance.WriteLine("Config.cs:LoadWorld() - Loading world....");
116 World blank = new World();
117 ServerConsole.MainConsole.Instance.WriteLine("Config.cs:LoadWorld() - Looking for a heightmap in local DB");
118 IObjectSet world_result = db.Get(typeof(MapStorage));
119 if(world_result.Count>0) {
120 ServerConsole.MainConsole.Instance.WriteLine("Config.cs:LoadWorld() - Found a heightmap in local database, loading");
121 MapStorage map=(MapStorage)world_result.Next();
122 blank.LandMap = map.Map;
123 } else {
124 ServerConsole.MainConsole.Instance.WriteLine("Config.cs:LoadWorld() - No heightmap found, generating new one");
125 HeightmapGenHills hills = new HeightmapGenHills();
126 blank.LandMap = hills.GenerateHeightmap(200, 4.0f, 80.0f, false);
127 ServerConsole.MainConsole.Instance.WriteLine("Config.cs:LoadWorld() - Saving heightmap to local database");
128 MapStorage map= new MapStorage();
129 map.Map = blank.LandMap;
130 db.Set(map);
131 db.Commit();
132 }
133 return blank;
134 }
135
136 public override void SaveMap()
137 {
138 IObjectSet world_result = db.Get(typeof(MapStorage));
139 if(world_result.Count>0) {
140 ServerConsole.MainConsole.Instance.WriteLine("Config.cs:LoadWorld() - updating saved copy of heightmap in local database");
141 MapStorage map=(MapStorage)world_result.Next();
142 db.Delete(map);
143 }
144 MapStorage map1= new MapStorage();
145 map1.Map = OpenSim_Main.local_world.LandMap;
146 db.Set(map1);
147 db.Commit();
148 }
149
150 public override void LoadFromGrid() {
151 ServerConsole.MainConsole.Instance.WriteLine("Config.cs:LoadFromGrid() - dummy function, DOING ABSOLUTELY NOTHING AT ALL!!!");
152 // TODO: Make this crap work
153 /* WebRequest GridLogin = WebRequest.Create(this.GridURL + "regions/" + this.RegionHandle.ToString() + "/login");
154 WebResponse GridResponse = GridLogin.GetResponse();
155 byte[] idata = new byte[(int)GridResponse.ContentLength];
156 BinaryReader br = new BinaryReader(GridResponse.GetResponseStream());
157
158 br.Close();
159 GridResponse.Close();
160 */
161 }
162
163 public void Shutdown() {
164 db.Close();
165 }
166 }
167
168 public class MapStorage
169 {
170 public float[] Map;
171
172 public MapStorage()
173 {
174
175 }
176 }
177}
diff --git a/src/Config/SimConfig/SimConfig.csproj b/src/Config/SimConfig/SimConfig.csproj
deleted file mode 100644
index 43e9499..0000000
--- a/src/Config/SimConfig/SimConfig.csproj
+++ /dev/null
@@ -1,52 +0,0 @@
1<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2 <PropertyGroup>
3 <OutputType>Library</OutputType>
4 <RootNamespace>SimConfig</RootNamespace>
5 <AssemblyName>SimConfig</AssemblyName>
6 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
7 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
8 <ProjectGuid>{B063760D-DB8D-4F64-B6FE-335FAD1E650A}</ProjectGuid>
9 </PropertyGroup>
10 <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
11 <OutputPath>..\..\..\bin\</OutputPath>
12 <Optimize>False</Optimize>
13 <DefineConstants>DEBUG;TRACE</DefineConstants>
14 <DebugSymbols>True</DebugSymbols>
15 <DebugType>Full</DebugType>
16 <CheckForOverflowUnderflow>True</CheckForOverflowUnderflow>
17 </PropertyGroup>
18 <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
19 <OutputPath>..\..\..\bin\</OutputPath>
20 <Optimize>True</Optimize>
21 <DefineConstants>TRACE</DefineConstants>
22 <DebugSymbols>False</DebugSymbols>
23 <DebugType>None</DebugType>
24 <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
25 </PropertyGroup>
26 <ItemGroup>
27 <Reference Include="System" />
28 <Reference Include="System.Xml" />
29 <Reference Include="Db4objects.Db4o">
30 <HintPath>..\..\..\bin\Db4objects.Db4o.dll</HintPath>
31 <SpecificVersion>False</SpecificVersion>
32 </Reference>
33 </ItemGroup>
34 <ItemGroup>
35 <Compile Include="Db4SimConfig.cs" />
36 </ItemGroup>
37 <ItemGroup>
38 <ProjectReference Include="..\..\ServerConsole\ServerConsole\ServerConsole.csproj">
39 <Project>{C9A6026D-8E0C-4FE4-8691-FB2A566AA245}</Project>
40 <Name>ServerConsole</Name>
41 </ProjectReference>
42 <ProjectReference Include="..\..\Second-server.csproj">
43 <Project>{132A6E3E-8F2D-4BF5-BDFB-8555F53F334E}</Project>
44 <Name>Second-server</Name>
45 </ProjectReference>
46 <ProjectReference Include="..\..\GridInterfaces\GridInterfaces.csproj">
47 <Project>{5DA3174D-42F9-416D-9F0B-AF41FA2BE2F9}</Project>
48 <Name>GridInterfaces</Name>
49 </ProjectReference>
50 </ItemGroup>
51 <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
52</Project> \ No newline at end of file
diff --git a/src/Config/default.build b/src/Config/default.build
deleted file mode 100644
index 9e13ca6..0000000
--- a/src/Config/default.build
+++ /dev/null
@@ -1,53 +0,0 @@
1<?xml version="1.0"?>
2 <project name="OpenSim" default="build" basedir=".">
3 <description>nant buildfile for OpenSim</description>
4 <property name="debug" value="true" overwrite="false" />
5 <target name="clean" description="remove all generated files">
6 <delete file="../bin/SimConfig.dll" failonerror="false" />
7 </target>
8
9 <target name="svnupdate" description="updates to latest SVN">
10 <exec program="svn">
11 <arg value="update" />
12 </exec>
13 </target>
14
15 <target name="upgrade" description="updates from SVN and then builds" depends="clean,svnupdate,build">
16
17 </target>
18
19 <target name="build" description="compiles the source code">
20
21 <loadfile file="../../VERSION" property="svnver"/>
22 <asminfo output="SimConfig/AssemblyInfo.cs" language="CSharp">
23 <imports>
24 <import namespace="System" />
25 <import namespace="System.Reflection" />
26 <import namespace="System.Runtime.InteropServices" />
27 </imports>
28 <attributes>
29 <attribute type="ComVisibleAttribute" value="false" />
30 <attribute type="CLSCompliantAttribute" value="false" />
31 <attribute type="AssemblyVersionAttribute" value="${svnver}" />
32 <attribute type="AssemblyTitleAttribute" value="opensim-simconfig" />
33 <attribute type="AssemblyDescriptionAttribute" value="The default configuration handler" />
34 <attribute type="AssemblyCopyrightAttribute" value="Copyright © OGS development team 2007"/>
35 </attributes>
36 </asminfo>
37
38 <csc target="library" output="../../bin/SimConfig.dll" debug="${debug}" verbose="true" warninglevel="4">
39 <references basedir="../../bin/" failonempty="true">
40 <include name="System.dll" />
41 <include name="System.Data.dll" />
42 <include name="System.Xml.dll" />
43 <include name="ServerConsole.dll" />
44 <include name="GridInterfaces.dll" />
45 <include name="OpenSim.exe" />
46 <include name="Db4objects.Db4o.dll" />
47 </references>
48 <sources basedir="SimConfig/">
49 <include name="*.cs" />
50 </sources>
51 </csc>
52 </target>
53</project>