aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/OpenSim.Storage/LocalStorageDb4o
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/OpenSim.Storage/LocalStorageDb4o')
-rw-r--r--OpenSim/OpenSim.Storage/LocalStorageDb4o/AssemblyInfo.cs31
-rw-r--r--OpenSim/OpenSim.Storage/LocalStorageDb4o/Db4LocalStorage.cs182
-rw-r--r--OpenSim/OpenSim.Storage/LocalStorageDb4o/MapStorage.cs16
-rw-r--r--OpenSim/OpenSim.Storage/LocalStorageDb4o/OpenSim.Storage.LocalStorageDb4o.csproj113
-rw-r--r--OpenSim/OpenSim.Storage/LocalStorageDb4o/OpenSim.Storage.LocalStorageDb4o.csproj.user12
-rw-r--r--OpenSim/OpenSim.Storage/LocalStorageDb4o/OpenSim.Storage.LocalStorageDb4o.dll.build47
-rw-r--r--OpenSim/OpenSim.Storage/LocalStorageDb4o/UUIDQuery.cs25
7 files changed, 426 insertions, 0 deletions
diff --git a/OpenSim/OpenSim.Storage/LocalStorageDb4o/AssemblyInfo.cs b/OpenSim/OpenSim.Storage/LocalStorageDb4o/AssemblyInfo.cs
new file mode 100644
index 0000000..6610606
--- /dev/null
+++ b/OpenSim/OpenSim.Storage/LocalStorageDb4o/AssemblyInfo.cs
@@ -0,0 +1,31 @@
1using System.Reflection;
2using System.Runtime.CompilerServices;
3using System.Runtime.InteropServices;
4
5// Information about this assembly is defined by the following
6// attributes.
7//
8// change them to the information which is associated with the assembly
9// you compile.
10
11[assembly: AssemblyTitle("Db4LocalStorage")]
12[assembly: AssemblyDescription("")]
13[assembly: AssemblyConfiguration("")]
14[assembly: AssemblyCompany("")]
15[assembly: AssemblyProduct("Db4LocalStorage")]
16[assembly: AssemblyCopyright("")]
17[assembly: AssemblyTrademark("")]
18[assembly: AssemblyCulture("")]
19
20// This sets the default COM visibility of types in the assembly to invisible.
21// If you need to expose a type to COM, use [ComVisible(true)] on that type.
22[assembly: ComVisible(false)]
23
24// The assembly version has following format :
25//
26// Major.Minor.Build.Revision
27//
28// You can specify all values by your own or you can build default build and revision
29// numbers with the '*' character (the default):
30
31[assembly: AssemblyVersion("1.0.*")]
diff --git a/OpenSim/OpenSim.Storage/LocalStorageDb4o/Db4LocalStorage.cs b/OpenSim/OpenSim.Storage/LocalStorageDb4o/Db4LocalStorage.cs
new file mode 100644
index 0000000..5dceb7f
--- /dev/null
+++ b/OpenSim/OpenSim.Storage/LocalStorageDb4o/Db4LocalStorage.cs
@@ -0,0 +1,182 @@
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 Db4objects.Db4o;
30using Db4objects.Db4o.Query;
31using libsecondlife;
32using OpenSim.Framework.Interfaces;
33using OpenSim.Framework.Types;
34using OpenSim.Framework.Terrain;
35
36namespace OpenSim.Storage.LocalStorageDb4o
37{
38 /// <summary>
39 ///
40 /// </summary>
41 public class Db4LocalStorage : ILocalStorage
42 {
43 private IObjectContainer db;
44 private string datastore;
45
46 public Db4LocalStorage()
47 {
48
49 }
50
51 public void Initialise(string dfile)
52 {
53 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM,"Db4LocalStorage Opening " + dfile);
54 datastore = dfile;
55 try
56 {
57 db = Db4oFactory.OpenFile(datastore);
58 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Db4LocalStorage creation");
59 }
60 catch (Exception e)
61 {
62 db.Close();
63 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM,"Db4LocalStorage :Constructor - Exception occured");
64 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM,e.ToString());
65 }
66 }
67
68 public void StorePrim(PrimData prim)
69 {
70 IObjectSet result = db.Query(new UUIDQuery(prim.FullID));
71 if(result.Count>0)
72 {
73 //prim already in storage
74 //so update it
75 PrimData found = (PrimData) result.Next();
76 found.PathBegin = prim.PathBegin;
77 found.PathCurve= prim.PathCurve;
78 found.PathEnd = prim.PathEnd;
79 found.PathRadiusOffset = prim.PathRadiusOffset;
80 found.PathRevolutions = prim.PathRevolutions;
81 found.PathScaleX= prim.PathScaleX;
82 found.PathScaleY = prim.PathScaleY;
83 found.PathShearX = prim.PathShearX;
84 found.PathShearY = prim.PathShearY;
85 found.PathSkew = prim.PathSkew;
86 found.PathTaperX = prim.PathTaperX;
87 found.PathTaperY = prim.PathTaperY;
88 found.PathTwist = prim.PathTwist;
89 found.PathTwistBegin = prim.PathTwistBegin;
90 found.PCode = prim.PCode;
91 found.ProfileBegin = prim.ProfileBegin;
92 found.ProfileCurve = prim.ProfileCurve;
93 found.ProfileEnd = prim.ProfileEnd;
94 found.ProfileHollow = prim.ProfileHollow;
95 found.Position = prim.Position;
96 found.Rotation = prim.Rotation;
97 found.Texture = prim.Texture;
98 db.Set(found);
99 db.Commit();
100 }
101 else
102 {
103 //not in storage
104 db.Set(prim);
105 db.Commit();
106 }
107 }
108
109 public void RemovePrim(LLUUID primID)
110 {
111 IObjectSet result = db.Query(new UUIDQuery(primID));
112 if(result.Count>0)
113 {
114 PrimData found = (PrimData) result.Next();
115 db.Delete(found);
116 }
117 }
118
119
120 public void LoadPrimitives(ILocalStorageReceiver receiver)
121 {
122 IObjectSet result = db.Get(typeof(PrimData));
123 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Db4LocalStorage.cs: LoadPrimitives() - number of prims in storages is "+result.Count);
124 foreach (PrimData prim in result) {
125 receiver.PrimFromStorage(prim);
126 }
127 }
128
129 public float[] LoadWorld()
130 {
131 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"LoadWorld() - Loading world....");
132 //World blank = new World();
133 float[] heightmap = null;
134 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"LoadWorld() - Looking for a heightmap in local DB");
135 IObjectSet world_result = db.Get(typeof(MapStorage));
136 if (world_result.Count > 0)
137 {
138 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"LoadWorld() - Found a heightmap in local database, loading");
139 MapStorage map = (MapStorage)world_result.Next();
140 //blank.LandMap = map.Map;
141 heightmap = map.Map;
142 }
143 else
144 {
145 /*
146 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("LoadWorld() - No heightmap found, generating new one");
147 HeightmapGenHills hills = new HeightmapGenHills();
148 // blank.LandMap = hills.GenerateHeightmap(200, 4.0f, 80.0f, false);
149 // heightmap = hills.GenerateHeightmap(200, 4.0f, 80.0f, false);
150 heightmap = new float[256, 256];
151 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("LoadWorld() - Saving heightmap to local database");
152 MapStorage map = new MapStorage();
153 map.Map = heightmap; //blank.LandMap;
154 db.Set(map);
155 db.Commit();
156 */
157 }
158 return heightmap;
159 }
160
161 public void SaveMap(float[] heightmap)
162 {
163 IObjectSet world_result = db.Get(typeof(MapStorage));
164 if (world_result.Count > 0)
165 {
166 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"SaveWorld() - updating saved copy of heightmap in local database");
167 MapStorage map = (MapStorage)world_result.Next();
168 db.Delete(map);
169 }
170 MapStorage map1 = new MapStorage();
171 map1.Map = heightmap; //OpenSim_Main.local_world.LandMap;
172 db.Set(map1);
173 db.Commit();
174 }
175
176 public void ShutDown()
177 {
178 db.Commit();
179 db.Close();
180 }
181 }
182}
diff --git a/OpenSim/OpenSim.Storage/LocalStorageDb4o/MapStorage.cs b/OpenSim/OpenSim.Storage/LocalStorageDb4o/MapStorage.cs
new file mode 100644
index 0000000..db590ff
--- /dev/null
+++ b/OpenSim/OpenSim.Storage/LocalStorageDb4o/MapStorage.cs
@@ -0,0 +1,16 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4
5namespace OpenSim.Storage.LocalStorageDb4o
6{
7 public class MapStorage
8 {
9 public float[] Map;
10
11 public MapStorage()
12 {
13
14 }
15 }
16} \ No newline at end of file
diff --git a/OpenSim/OpenSim.Storage/LocalStorageDb4o/OpenSim.Storage.LocalStorageDb4o.csproj b/OpenSim/OpenSim.Storage/LocalStorageDb4o/OpenSim.Storage.LocalStorageDb4o.csproj
new file mode 100644
index 0000000..6504b77
--- /dev/null
+++ b/OpenSim/OpenSim.Storage/LocalStorageDb4o/OpenSim.Storage.LocalStorageDb4o.csproj
@@ -0,0 +1,113 @@
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>{E1B79ECF-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>OpenSim.Storage.LocalStorageDb4o</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>OpenSim.Storage.LocalStorageDb4o</RootNamespace>
20 <StartupObject></StartupObject>
21 <FileUpgradeFlags>
22 </FileUpgradeFlags>
23 </PropertyGroup>
24 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
25 <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
26 <BaseAddress>285212672</BaseAddress>
27 <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
28 <ConfigurationOverrideFile>
29 </ConfigurationOverrideFile>
30 <DefineConstants>TRACE;DEBUG</DefineConstants>
31 <DocumentationFile></DocumentationFile>
32 <DebugSymbols>True</DebugSymbols>
33 <FileAlignment>4096</FileAlignment>
34 <Optimize>False</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)' == 'Release|AnyCPU' ">
43 <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
44 <BaseAddress>285212672</BaseAddress>
45 <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
46 <ConfigurationOverrideFile>
47 </ConfigurationOverrideFile>
48 <DefineConstants>TRACE</DefineConstants>
49 <DocumentationFile></DocumentationFile>
50 <DebugSymbols>False</DebugSymbols>
51 <FileAlignment>4096</FileAlignment>
52 <Optimize>True</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.Xml" >
66 <HintPath>System.Xml.dll</HintPath>
67 <Private>False</Private>
68 </Reference>
69 <Reference Include="Db4objects.Db4o.dll" >
70 <HintPath>..\..\bin\Db4objects.Db4o.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 </ItemGroup>
78 <ItemGroup>
79 <ProjectReference Include="..\..\OpenSim.Framework\OpenSim.Framework.csproj">
80 <Name>OpenSim.Framework</Name>
81 <Project>{8ACA2445-0000-0000-0000-000000000000}</Project>
82 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
83 <Private>False</Private>
84 </ProjectReference>
85 <ProjectReference Include="..\..\OpenSim.Framework.Console\OpenSim.Framework.Console.csproj">
86 <Name>OpenSim.Framework.Console</Name>
87 <Project>{A7CD0630-0000-0000-0000-000000000000}</Project>
88 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
89 <Private>False</Private>
90 </ProjectReference>
91 </ItemGroup>
92 <ItemGroup>
93 <Compile Include="AssemblyInfo.cs">
94 <SubType>Code</SubType>
95 </Compile>
96 <Compile Include="Db4LocalStorage.cs">
97 <SubType>Code</SubType>
98 </Compile>
99 <Compile Include="MapStorage.cs">
100 <SubType>Code</SubType>
101 </Compile>
102 <Compile Include="UUIDQuery.cs">
103 <SubType>Code</SubType>
104 </Compile>
105 </ItemGroup>
106 <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
107 <PropertyGroup>
108 <PreBuildEvent>
109 </PreBuildEvent>
110 <PostBuildEvent>
111 </PostBuildEvent>
112 </PropertyGroup>
113</Project>
diff --git a/OpenSim/OpenSim.Storage/LocalStorageDb4o/OpenSim.Storage.LocalStorageDb4o.csproj.user b/OpenSim/OpenSim.Storage/LocalStorageDb4o/OpenSim.Storage.LocalStorageDb4o.csproj.user
new file mode 100644
index 0000000..d47d65d
--- /dev/null
+++ b/OpenSim/OpenSim.Storage/LocalStorageDb4o/OpenSim.Storage.LocalStorageDb4o.csproj.user
@@ -0,0 +1,12 @@
1<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2 <PropertyGroup>
3 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
4 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
5 <ReferencePath>C:\New Folder\second-life-viewer\opensim-dailys2\opensim15-07\bin\</ReferencePath>
6 <LastOpenVersion>8.0.50727</LastOpenVersion>
7 <ProjectView>ProjectFiles</ProjectView>
8 <ProjectTrust>0</ProjectTrust>
9 </PropertyGroup>
10 <PropertyGroup Condition = " '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' " />
11 <PropertyGroup Condition = " '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
12</Project>
diff --git a/OpenSim/OpenSim.Storage/LocalStorageDb4o/OpenSim.Storage.LocalStorageDb4o.dll.build b/OpenSim/OpenSim.Storage/LocalStorageDb4o/OpenSim.Storage.LocalStorageDb4o.dll.build
new file mode 100644
index 0000000..8be321d
--- /dev/null
+++ b/OpenSim/OpenSim.Storage/LocalStorageDb4o/OpenSim.Storage.LocalStorageDb4o.dll.build
@@ -0,0 +1,47 @@
1<?xml version="1.0" ?>
2<project name="OpenSim.Storage.LocalStorageDb4o" 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;DEBUG" output="${project::get-base-directory()}/${build.dir}/${project::get-name()}.dll">
11 <resources prefix="OpenSim.Storage.LocalStorageDb4o" dynamicprefix="true" >
12 </resources>
13 <sources failonempty="true">
14 <include name="AssemblyInfo.cs" />
15 <include name="Db4LocalStorage.cs" />
16 <include name="MapStorage.cs" />
17 <include name="UUIDQuery.cs" />
18 </sources>
19 <references basedir="${project::get-base-directory()}">
20 <lib>
21 <include name="${project::get-base-directory()}" />
22 <include name="${project::get-base-directory()}/${build.dir}" />
23 </lib>
24 <include name="System.dll" />
25 <include name="System.Xml.dll" />
26 <include name="../../bin/Db4objects.Db4o.dll" />
27 <include name="../../bin/libsecondlife.dll" />
28 <include name="../../bin/OpenSim.Framework.dll" />
29 <include name="../../bin/OpenSim.Framework.Console.dll" />
30 </references>
31 </csc>
32 <echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../../bin/" />
33 <mkdir dir="${project::get-base-directory()}/../../bin/"/>
34 <copy todir="${project::get-base-directory()}/../../bin/">
35 <fileset basedir="${project::get-base-directory()}/${build.dir}/" >
36 <include name="*.dll"/>
37 <include name="*.exe"/>
38 </fileset>
39 </copy>
40 </target>
41 <target name="clean">
42 <delete dir="${bin.dir}" failonerror="false" />
43 <delete dir="${obj.dir}" failonerror="false" />
44 </target>
45 <target name="doc" description="Creates documentation.">
46 </target>
47</project>
diff --git a/OpenSim/OpenSim.Storage/LocalStorageDb4o/UUIDQuery.cs b/OpenSim/OpenSim.Storage/LocalStorageDb4o/UUIDQuery.cs
new file mode 100644
index 0000000..ba9e139
--- /dev/null
+++ b/OpenSim/OpenSim.Storage/LocalStorageDb4o/UUIDQuery.cs
@@ -0,0 +1,25 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using Db4objects.Db4o;
5using Db4objects.Db4o.Query;
6using libsecondlife;
7using OpenSim.Framework.Interfaces;
8using OpenSim.Framework.Types;
9
10namespace OpenSim.Storage.LocalStorageDb4o
11{
12 public class UUIDQuery : Predicate
13 {
14 private LLUUID _findID;
15
16 public UUIDQuery(LLUUID find)
17 {
18 _findID = find;
19 }
20 public bool Match(PrimData prim)
21 {
22 return (prim.FullID == _findID);
23 }
24 }
25}