aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim.Storage/LocalStorageDb4o
diff options
context:
space:
mode:
authorgareth2007-03-22 10:11:15 +0000
committergareth2007-03-22 10:11:15 +0000
commit7daa3955bc3a1918e40962851f9e8d38597a245e (patch)
treebee3e1372a7eed0c1b220a8a49f7bee7d29a6b91 /OpenSim.Storage/LocalStorageDb4o
parentLoad XML for neighbourinfo from grid (diff)
downloadopensim-SC-7daa3955bc3a1918e40962851f9e8d38597a245e.zip
opensim-SC-7daa3955bc3a1918e40962851f9e8d38597a245e.tar.gz
opensim-SC-7daa3955bc3a1918e40962851f9e8d38597a245e.tar.bz2
opensim-SC-7daa3955bc3a1918e40962851f9e8d38597a245e.tar.xz
brought zircon branch into trunk
Diffstat (limited to 'OpenSim.Storage/LocalStorageDb4o')
-rw-r--r--OpenSim.Storage/LocalStorageDb4o/AssemblyInfo.cs31
-rw-r--r--OpenSim.Storage/LocalStorageDb4o/Db4LocalStorage.cs126
-rw-r--r--OpenSim.Storage/LocalStorageDb4o/OpenSim.Storage.LocalStorageDb4o.csproj104
-rw-r--r--OpenSim.Storage/LocalStorageDb4o/OpenSim.Storage.LocalStorageDb4o.dll.build46
-rw-r--r--OpenSim.Storage/LocalStorageDb4o/UUIDQuery.cs25
5 files changed, 332 insertions, 0 deletions
diff --git a/OpenSim.Storage/LocalStorageDb4o/AssemblyInfo.cs b/OpenSim.Storage/LocalStorageDb4o/AssemblyInfo.cs
new file mode 100644
index 0000000..6610606
--- /dev/null
+++ b/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.Storage/LocalStorageDb4o/Db4LocalStorage.cs b/OpenSim.Storage/LocalStorageDb4o/Db4LocalStorage.cs
new file mode 100644
index 0000000..93ed9cc
--- /dev/null
+++ b/OpenSim.Storage/LocalStorageDb4o/Db4LocalStorage.cs
@@ -0,0 +1,126 @@
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.Assets;
34
35namespace OpenSim.Storage.LocalStorageDb4o
36{
37 /// <summary>
38 ///
39 /// </summary>
40 public class Db4LocalStorage : ILocalStorage
41 {
42 private IObjectContainer db;
43
44 public Db4LocalStorage()
45 {
46 try
47 {
48 db = Db4oFactory.OpenFile("localworld.yap");
49 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Db4LocalStorage creation");
50 }
51 catch(Exception e)
52 {
53 db.Close();
54 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Db4LocalStorage :Constructor - Exception occured");
55 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(e.ToString());
56 }
57 }
58
59 public void StorePrim(PrimData prim)
60 {
61 IObjectSet result = db.Query(new UUIDQuery(prim.FullID));
62 if(result.Count>0)
63 {
64 //prim already in storage
65 //so update it
66 PrimData found = (PrimData) result.Next();
67 found.PathBegin = prim.PathBegin;
68 found.PathCurve= prim.PathCurve;
69 found.PathEnd = prim.PathEnd;
70 found.PathRadiusOffset = prim.PathRadiusOffset;
71 found.PathRevolutions = prim.PathRevolutions;
72 found.PathScaleX= prim.PathScaleX;
73 found.PathScaleY = prim.PathScaleY;
74 found.PathShearX = prim.PathShearX;
75 found.PathShearY = prim.PathShearY;
76 found.PathSkew = prim.PathSkew;
77 found.PathTaperX = prim.PathTaperX;
78 found.PathTaperY = prim.PathTaperY;
79 found.PathTwist = prim.PathTwist;
80 found.PathTwistBegin = prim.PathTwistBegin;
81 found.PCode = prim.PCode;
82 found.ProfileBegin = prim.ProfileBegin;
83 found.ProfileCurve = prim.ProfileCurve;
84 found.ProfileEnd = prim.ProfileEnd;
85 found.ProfileHollow = prim.ProfileHollow;
86 found.Position = prim.Position;
87 found.Rotation = prim.Rotation;
88 found.Texture = prim.Texture;
89 db.Set(found);
90 db.Commit();
91 }
92 else
93 {
94 //not in storage
95 db.Set(prim);
96 db.Commit();
97 }
98 }
99
100 public void RemovePrim(LLUUID primID)
101 {
102 IObjectSet result = db.Query(new UUIDQuery(primID));
103 if(result.Count>0)
104 {
105 PrimData found = (PrimData) result.Next();
106 db.Delete(found);
107 }
108 }
109
110
111 public void LoadPrimitives(ILocalStorageReceiver receiver)
112 {
113 IObjectSet result = db.Get(typeof(PrimData));
114 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Db4LocalStorage.cs: LoadPrimitives() - number of prims in storages is "+result.Count);
115 foreach (PrimData prim in result) {
116 receiver.PrimFromStorage(prim);
117 }
118 }
119
120 public void ShutDown()
121 {
122 db.Commit();
123 db.Close();
124 }
125 }
126}
diff --git a/OpenSim.Storage/LocalStorageDb4o/OpenSim.Storage.LocalStorageDb4o.csproj b/OpenSim.Storage/LocalStorageDb4o/OpenSim.Storage.LocalStorageDb4o.csproj
new file mode 100644
index 0000000..5c2ffa5
--- /dev/null
+++ b/OpenSim.Storage/LocalStorageDb4o/OpenSim.Storage.LocalStorageDb4o.csproj
@@ -0,0 +1,104 @@
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>{2B5E9FF0-DE71-41DA-AC6A-B8E2D2D0AE09}</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 </Reference>
64 <Reference Include="System.Xml.dll" >
65 <HintPath>\System.Xml.dll.dll</HintPath>
66 </Reference>
67 <Reference Include="Db4objects.Db4o.dll" >
68 <HintPath>\Db4objects.Db4o.dll.dll</HintPath>
69 </Reference>
70 <Reference Include="libsecondlife.dll" >
71 <HintPath>\libsecondlife.dll.dll</HintPath>
72 </Reference>
73 </ItemGroup>
74 <ItemGroup>
75 <ProjectReference Include="..\..\OpenSim.Framework\OpenSim.Framework.csproj">
76 <Name>OpenSim.Framework</Name>
77 <Project>{1D2865A9-CF8E-45F7-B96D-91ED128A32CF}</Project>
78 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
79 </ProjectReference>
80 <ProjectReference Include="..\..\OpenSim.Framework.Console\OpenSim.Framework.Console.csproj">
81 <Name>OpenSim.Framework.Console</Name>
82 <Project>{C8405E1A-EC19-48B6-9C8C-CA03624B9916}</Project>
83 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
84 </ProjectReference>
85 </ItemGroup>
86 <ItemGroup>
87 <Compile Include="AssemblyInfo.cs">
88 <SubType>Code</SubType>
89 </Compile>
90 <Compile Include="Db4LocalStorage.cs">
91 <SubType>Code</SubType>
92 </Compile>
93 <Compile Include="UUIDQuery.cs">
94 <SubType>Code</SubType>
95 </Compile>
96 </ItemGroup>
97 <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
98 <PropertyGroup>
99 <PreBuildEvent>
100 </PreBuildEvent>
101 <PostBuildEvent>
102 </PostBuildEvent>
103 </PropertyGroup>
104</Project>
diff --git a/OpenSim.Storage/LocalStorageDb4o/OpenSim.Storage.LocalStorageDb4o.dll.build b/OpenSim.Storage/LocalStorageDb4o/OpenSim.Storage.LocalStorageDb4o.dll.build
new file mode 100644
index 0000000..752d0ab
--- /dev/null
+++ b/OpenSim.Storage/LocalStorageDb4o/OpenSim.Storage.LocalStorageDb4o.dll.build
@@ -0,0 +1,46 @@
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="UUIDQuery.cs" />
17 </sources>
18 <references basedir="${project::get-base-directory()}">
19 <lib>
20 <include name="${project::get-base-directory()}" />
21 <include name="${project::get-base-directory()}/${build.dir}" />
22 </lib>
23 <include name="System.dll" />
24 <include name="System.Xml.dll.dll" />
25 <include name="../../bin/Db4objects.Db4o.dll" />
26 <include name="../../bin/libsecondlife.dll" />
27 <include name="../../OpenSim.Framework/${build.dir}/OpenSim.Framework.dll" />
28 <include name="../../OpenSim.Framework.Console/${build.dir}/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>
diff --git a/OpenSim.Storage/LocalStorageDb4o/UUIDQuery.cs b/OpenSim.Storage/LocalStorageDb4o/UUIDQuery.cs
new file mode 100644
index 0000000..16b6685
--- /dev/null
+++ b/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.Assets;
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}