aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenGrid.Config
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenGrid.Config/GridConfigDb4o/DbGridConfig.cs148
-rw-r--r--OpenGrid.Config/GridConfigDb4o/OpenGrid.Config.GridConfigDb4o.csproj111
-rw-r--r--OpenGrid.Config/GridConfigDb4o/OpenGrid.Config.GridConfigDb4o.dll.build46
3 files changed, 199 insertions, 106 deletions
diff --git a/OpenGrid.Config/GridConfigDb4o/DbGridConfig.cs b/OpenGrid.Config/GridConfigDb4o/DbGridConfig.cs
index 250f3fd..f3ad2cb 100644
--- a/OpenGrid.Config/GridConfigDb4o/DbGridConfig.cs
+++ b/OpenGrid.Config/GridConfigDb4o/DbGridConfig.cs
@@ -26,70 +26,58 @@
26*/ 26*/
27using System; 27using System;
28using System.Collections.Generic; 28using System.Collections.Generic;
29using OpenSim; 29using OpenSim.Framework.Console;
30using OpenSim.Framework.Utilities;
31using OpenSim.Framework.Interfaces; 30using OpenSim.Framework.Interfaces;
32using OpenSim.Framework.Terrain;
33//using OpenSim.world;
34using Db4objects.Db4o; 31using Db4objects.Db4o;
35 32
36namespace OpenSim.Config.SimConfigDb4o 33namespace OpenGrid.Config.GridConfigDb4o
37{ 34{
38 public class Db40ConfigPlugin: ISimConfig 35 public class Db40ConfigPlugin: IGridConfig
39 { 36 {
40 public SimConfig GetConfigObject() 37 public GridConfig GetConfigObject()
41 { 38 {
42 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Loading Db40Config dll"); 39 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Loading Db40Config dll");
43 return ( new DbSimConfig()); 40 return ( new DbGridConfig());
44 } 41 }
45 } 42 }
46 43
47 public class DbSimConfig : SimConfig 44 public class DbGridConfig : GridConfig
48 { 45 {
49 private bool isSandbox;
50 private IObjectContainer db; 46 private IObjectContainer db;
51 47
52 public void LoadDefaults() { 48 public void LoadDefaults() {
53 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Config.cs:LoadDefaults() - Please press enter to retain default or enter new settings"); 49 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Config.cs:LoadDefaults() - Please press enter to retain default or enter new settings");
54 50
55 this.RegionName=OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Name [OpenSim test]: ","OpenSim test"); 51 this.GridOwner = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Grid owner [OGS development team]: ", "OGS development team");
56 this.RegionLocX=(uint)Convert.ToInt32(OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Grid Location X [997]: ","997")); 52
57 this.RegionLocY=(uint)Convert.ToInt32(OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Grid Location Y [996]: ","996")); 53 this.DefaultAssetServer = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Default asset server [no default]: ");
58 this.IPListenPort=Convert.ToInt32(OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("UDP port for client connections [9000]: ","9000")); 54 this.AssetSendKey = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Key to send to asset server: ");
59 this.IPListenAddr=OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("IP Address to listen on for client connections [127.0.0.1]: ","127.0.0.1"); 55 this.AssetRecvKey = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Key to expect from asset server: ");
60 56
61 if(!isSandbox) 57 this.DefaultUserServer = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Default user server [no default]: ");
62 { 58 this.UserSendKey = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Key to send to user server: ");
63 this.AssetURL=OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Asset server URL: "); 59 this.UserRecvKey = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Key to expect from user server: ");
64 this.AssetSendKey=OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Asset server key: "); 60
65 this.GridURL=OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Grid server URL: "); 61 this.SimSendKey = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Key to send to sims: ");
66 this.GridSendKey = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Key to send to grid server: "); 62 this.SimRecvKey = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Key to expect from sims: ");
67 this.GridRecvKey = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Key to expect from grid server: ");
68 this.UserURL = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("User server URL: ");
69 this.UserSendKey = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Key to send to user server: ");
70 this.UserRecvKey = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Key to expect from user server: ");
71 }
72 this.RegionHandle = Util.UIntsToLong((RegionLocX*256), (RegionLocY*256));
73 } 63 }
74 64
75 public override void InitConfig(bool sandboxMode) { 65 public override void InitConfig() {
76 this.isSandbox = sandboxMode;
77 try { 66 try {
78 db = Db4oFactory.OpenFile("opensim.yap"); 67 db = Db4oFactory.OpenFile("opengrid.yap");
79 IObjectSet result = db.Get(typeof(DbSimConfig)); 68 IObjectSet result = db.Get(typeof(DbGridConfig));
80 if(result.Count==1) { 69 if(result.Count==1) {
81 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Config.cs:InitConfig() - Found a SimConfig object in the local database, loading"); 70 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Config.cs:InitConfig() - Found a GridConfig object in the local database, loading");
82 foreach (DbSimConfig cfg in result) { 71 foreach (DbGridConfig cfg in result) {
83 this.RegionName = cfg.RegionName; 72 this.GridOwner=cfg.GridOwner;
84 this.RegionLocX = cfg.RegionLocX; 73 this.DefaultAssetServer=cfg.DefaultAssetServer;
85 this.RegionLocY = cfg.RegionLocY; 74 this.AssetSendKey=cfg.AssetSendKey;
86 this.RegionHandle = Util.UIntsToLong((RegionLocX*256), (RegionLocY*256)); 75 this.AssetRecvKey=cfg.AssetRecvKey;
87 this.IPListenPort = cfg.IPListenPort; 76 this.DefaultUserServer=cfg.DefaultUserServer;
88 this.IPListenAddr = cfg.IPListenAddr; 77 this.UserSendKey=cfg.UserSendKey;
89 this.AssetURL = cfg.AssetURL; 78 this.UserRecvKey=cfg.UserRecvKey;
90 this.AssetSendKey = cfg.AssetSendKey; 79 this.SimSendKey=cfg.SimSendKey;
91 this.GridURL = cfg.GridURL; 80 this.SimRecvKey=cfg.SimRecvKey;
92 this.GridSendKey = cfg.GridSendKey;
93 } 81 }
94 } else { 82 } else {
95 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Config.cs:InitConfig() - Could not find object in database, loading precompiled defaults"); 83 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Config.cs:InitConfig() - Could not find object in database, loading precompiled defaults");
@@ -103,70 +91,18 @@ namespace OpenSim.Config.SimConfigDb4o
103 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(e.ToString()); 91 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(e.ToString());
104 } 92 }
105 93
106 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Sim settings loaded:"); 94 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Grid settings loaded:");
107 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Name: " + this.RegionName); 95 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Grid owner: " + this.GridOwner);
108 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Region Location: [" + this.RegionLocX.ToString() + "," + this.RegionLocY + "]"); 96 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Default asset server: " + this.DefaultAssetServer);
109 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Region Handle: " + this.RegionHandle.ToString()); 97 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Key to send to asset server: " + this.AssetSendKey);
110 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Listening on IP: " + this.IPListenAddr + ":" + this.IPListenPort); 98 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Key to expect from asset server: " + this.AssetRecvKey);
111 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Sandbox Mode? " + isSandbox.ToString()); 99 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Default user server: " + this.DefaultUserServer);
112 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Asset URL: " + this.AssetURL); 100 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Key to send to user server: " + this.UserSendKey);
113 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Asset key: " + this.AssetSendKey); 101 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Key to expect from user server: " + this.UserRecvKey);
114 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Grid URL: " + this.GridURL); 102 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Key to send to sims: " + this.SimSendKey);
115 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Grid key: " + this.GridSendKey); 103 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Key to expect from sims: " + this.SimRecvKey);
116 } 104 }
117 105
118 public override float[] LoadWorld()
119 {
120 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Config.cs:LoadWorld() - Loading world....");
121 //World blank = new World();
122 float[] heightmap = null;
123 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Config.cs:LoadWorld() - Looking for a heightmap in local DB");
124 IObjectSet world_result = db.Get(typeof(MapStorage));
125 if(world_result.Count>0) {
126 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Config.cs:LoadWorld() - Found a heightmap in local database, loading");
127 MapStorage map=(MapStorage)world_result.Next();
128 //blank.LandMap = map.Map;
129 heightmap = map.Map;
130 } else {
131 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Config.cs:LoadWorld() - No heightmap found, generating new one");
132 HeightmapGenHills hills = new HeightmapGenHills();
133 // blank.LandMap = hills.GenerateHeightmap(200, 4.0f, 80.0f, false);
134 heightmap = hills.GenerateHeightmap(200, 4.0f, 80.0f, false);
135 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Config.cs:LoadWorld() - Saving heightmap to local database");
136 MapStorage map= new MapStorage();
137 map.Map = heightmap; //blank.LandMap;
138 db.Set(map);
139 db.Commit();
140 }
141 return heightmap;
142 }
143
144 public override void SaveMap(float[] heightmap)
145 {
146 IObjectSet world_result = db.Get(typeof(MapStorage));
147 if(world_result.Count>0) {
148 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Config.cs:LoadWorld() - updating saved copy of heightmap in local database");
149 MapStorage map=(MapStorage)world_result.Next();
150 db.Delete(map);
151 }
152 MapStorage map1= new MapStorage();
153 map1.Map = heightmap; //OpenSim_Main.local_world.LandMap;
154 db.Set(map1);
155 db.Commit();
156 }
157
158 public override void LoadFromGrid() {
159 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Config.cs:LoadFromGrid() - dummy function, DOING ABSOLUTELY NOTHING AT ALL!!!");
160 // TODO: Make this crap work
161 /* WebRequest GridLogin = WebRequest.Create(this.GridURL + "regions/" + this.RegionHandle.ToString() + "/login");
162 WebResponse GridResponse = GridLogin.GetResponse();
163 byte[] idata = new byte[(int)GridResponse.ContentLength];
164 BinaryReader br = new BinaryReader(GridResponse.GetResponseStream());
165
166 br.Close();
167 GridResponse.Close();
168 */
169 }
170 106
171 public void Shutdown() { 107 public void Shutdown() {
172 db.Close(); 108 db.Close();
diff --git a/OpenGrid.Config/GridConfigDb4o/OpenGrid.Config.GridConfigDb4o.csproj b/OpenGrid.Config/GridConfigDb4o/OpenGrid.Config.GridConfigDb4o.csproj
new file mode 100644
index 0000000..ecad2a2
--- /dev/null
+++ b/OpenGrid.Config/GridConfigDb4o/OpenGrid.Config.GridConfigDb4o.csproj
@@ -0,0 +1,111 @@
1<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2 <PropertyGroup>
3 <ProjectType>Local</ProjectType>
4 <ProductVersion>8.0.50727</ProductVersion>
5 <SchemaVersion>2.0</SchemaVersion>
6 <ProjectGuid>{0E19DF8F-0000-0000-0000-000000000000}</ProjectGuid>
7 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
8 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
9 <ApplicationIcon></ApplicationIcon>
10 <AssemblyKeyContainerName>
11 </AssemblyKeyContainerName>
12 <AssemblyName>OpenGrid.Config.GridConfigDb4o</AssemblyName>
13 <DefaultClientScript>JScript</DefaultClientScript>
14 <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
15 <DefaultTargetSchema>IE50</DefaultTargetSchema>
16 <DelaySign>false</DelaySign>
17 <OutputType>Library</OutputType>
18 <AppDesignerFolder></AppDesignerFolder>
19 <RootNamespace>OpenGrid.Config.GridConfigDb4o</RootNamespace>
20 <StartupObject></StartupObject>
21 <FileUpgradeFlags>
22 </FileUpgradeFlags>
23 </PropertyGroup>
24 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
25 <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
26 <BaseAddress>285212672</BaseAddress>
27 <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
28 <ConfigurationOverrideFile>
29 </ConfigurationOverrideFile>
30 <DefineConstants>TRACE</DefineConstants>
31 <DocumentationFile></DocumentationFile>
32 <DebugSymbols>False</DebugSymbols>
33 <FileAlignment>4096</FileAlignment>
34 <Optimize>True</Optimize>
35 <OutputPath>../../bin/</OutputPath>
36 <RegisterForComInterop>False</RegisterForComInterop>
37 <RemoveIntegerChecks>False</RemoveIntegerChecks>
38 <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
39 <WarningLevel>4</WarningLevel>
40 <NoWarn></NoWarn>
41 </PropertyGroup>
42 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
43 <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
44 <BaseAddress>285212672</BaseAddress>
45 <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
46 <ConfigurationOverrideFile>
47 </ConfigurationOverrideFile>
48 <DefineConstants>TRACE;DEBUG</DefineConstants>
49 <DocumentationFile></DocumentationFile>
50 <DebugSymbols>True</DebugSymbols>
51 <FileAlignment>4096</FileAlignment>
52 <Optimize>False</Optimize>
53 <OutputPath>../../bin/</OutputPath>
54 <RegisterForComInterop>False</RegisterForComInterop>
55 <RemoveIntegerChecks>False</RemoveIntegerChecks>
56 <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
57 <WarningLevel>4</WarningLevel>
58 <NoWarn></NoWarn>
59 </PropertyGroup>
60 <ItemGroup>
61 <Reference Include="System" >
62 <HintPath>System.dll</HintPath>
63 <Private>False</Private>
64 </Reference>
65 <Reference Include="System.Data.dll" >
66 <HintPath>..\..\bin\System.Data.dll</HintPath>
67 <Private>False</Private>
68 </Reference>
69 <Reference Include="System.Xml" >
70 <HintPath>System.Xml.dll</HintPath>
71 <Private>False</Private>
72 </Reference>
73 <Reference Include="libsecondlife.dll" >
74 <HintPath>..\..\bin\libsecondlife.dll</HintPath>
75 <Private>False</Private>
76 </Reference>
77 <Reference Include="Db4objects.Db4o.dll" >
78 <HintPath>..\..\bin\Db4objects.Db4o.dll</HintPath>
79 <Private>False</Private>
80 </Reference>
81 </ItemGroup>
82 <ItemGroup>
83 <ProjectReference Include="../../OpenSim.Framework/OpenSim.Framework.csproj">
84 <Name>OpenSim.Framework</Name>
85 <Project>{7404933D-0000-0000-0000-000000000000}</Project>
86 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
87 <Private>False</Private>
88 </ProjectReference>
89 <ProjectReference Include="../../OpenSim.Framework.Console/OpenSim.Framework.Console.csproj">
90 <Name>OpenSim.Framework.Console</Name>
91 <Project>{16759386-0000-0000-0000-000000000000}</Project>
92 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
93 <Private>False</Private>
94 </ProjectReference>
95 </ItemGroup>
96 <ItemGroup>
97 <Compile Include="AssemblyInfo.cs">
98 <SubType>Code</SubType>
99 </Compile>
100 <Compile Include="DbGridConfig.cs">
101 <SubType>Code</SubType>
102 </Compile>
103 </ItemGroup>
104 <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
105 <PropertyGroup>
106 <PreBuildEvent>
107 </PreBuildEvent>
108 <PostBuildEvent>
109 </PostBuildEvent>
110 </PropertyGroup>
111</Project>
diff --git a/OpenGrid.Config/GridConfigDb4o/OpenGrid.Config.GridConfigDb4o.dll.build b/OpenGrid.Config/GridConfigDb4o/OpenGrid.Config.GridConfigDb4o.dll.build
new file mode 100644
index 0000000..73e09ce
--- /dev/null
+++ b/OpenGrid.Config/GridConfigDb4o/OpenGrid.Config.GridConfigDb4o.dll.build
@@ -0,0 +1,46 @@
1<?xml version="1.0" ?>
2<project name="OpenGrid.Config.GridConfigDb4o" default="build">
3 <target name="build">
4 <echo message="Build Directory is ${project::get-base-directory()}/${build.dir}" />
5 <mkdir dir="${project::get-base-directory()}/${build.dir}" />
6 <copy todir="${project::get-base-directory()}/${build.dir}">
7 <fileset basedir="${project::get-base-directory()}">
8 </fileset>
9 </copy>
10 <csc target="library" debug="${build.debug}" unsafe="False" define="TRACE" output="${project::get-base-directory()}/${build.dir}/${project::get-name()}.dll">
11 <resources prefix="OpenGrid.Config.GridConfigDb4o" dynamicprefix="true" >
12 </resources>
13 <sources failonempty="true">
14 <include name="AssemblyInfo.cs" />
15 <include name="DbGridConfig.cs" />
16 </sources>
17 <references basedir="${project::get-base-directory()}">
18 <lib>
19 <include name="${project::get-base-directory()}" />
20 <include name="${project::get-base-directory()}/${build.dir}" />
21 </lib>
22 <include name="System.dll" />
23 <include name="System.Data.dll.dll" />
24 <include name="System.Xml.dll" />
25 <include name="../../bin/libsecondlife.dll" />
26 <include name="../../bin/Db4objects.Db4o.dll" />
27 <include name="../../bin/OpenSim.Framework.dll" />
28 <include name="../../bin/OpenSim.Framework.Console.dll" />
29 </references>
30 </csc>
31 <echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../../bin/" />
32 <mkdir dir="${project::get-base-directory()}/../../bin/"/>
33 <copy todir="${project::get-base-directory()}/../../bin/">
34 <fileset basedir="${project::get-base-directory()}/${build.dir}/" >
35 <include name="*.dll"/>
36 <include name="*.exe"/>
37 </fileset>
38 </copy>
39 </target>
40 <target name="clean">
41 <delete dir="${bin.dir}" failonerror="false" />
42 <delete dir="${obj.dir}" failonerror="false" />
43 </target>
44 <target name="doc" description="Creates documentation.">
45 </target>
46</project>