aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data
diff options
context:
space:
mode:
authorSean Dague2008-04-02 15:22:39 +0000
committerSean Dague2008-04-02 15:22:39 +0000
commit35420b21a3a0a3e8f104f7ce1c9d6c091a8f5212 (patch)
treed0ce7aab84032a1daf50aac05a58a8f55a01f301 /OpenSim/Data
parent* Add some temporary task inventory item inflation debug messages to investig... (diff)
downloadopensim-SC_OLD-35420b21a3a0a3e8f104f7ce1c9d6c091a8f5212.zip
opensim-SC_OLD-35420b21a3a0a3e8f104f7ce1c9d6c091a8f5212.tar.gz
opensim-SC_OLD-35420b21a3a0a3e8f104f7ce1c9d6c091a8f5212.tar.bz2
opensim-SC_OLD-35420b21a3a0a3e8f104f7ce1c9d6c091a8f5212.tar.xz
reorganizing namespaces to put all the Data stuff into it's own namespace
/ dir structure. This is coming in over a few changesets so consider trunk broken for the next 30 minutes as these get pulled together.
Diffstat (limited to 'OpenSim/Data')
-rw-r--r--OpenSim/Data/AssetDataBase.cs20
-rw-r--r--OpenSim/Data/DataStoreBase.cs10
-rw-r--r--OpenSim/Data/GridDataBase.cs22
-rw-r--r--OpenSim/Data/IGridData.cs118
-rw-r--r--OpenSim/Data/ILogData.cs91
-rw-r--r--OpenSim/Data/IniConfig.cs98
-rw-r--r--OpenSim/Data/InventoryDataBase.cs10
-rw-r--r--OpenSim/Data/OpenSimDataReader.cs64
-rw-r--r--OpenSim/Data/OpenSimDatabaseConnector.cs57
-rw-r--r--OpenSim/Data/OpenSimObjectFieldMapper.cs102
-rw-r--r--OpenSim/Data/OpenSimTableMapper.cs40
-rw-r--r--OpenSim/Data/PrimitiveBaseShapeTableMapper.cs170
-rw-r--r--OpenSim/Data/Properties/AssemblyInfo.cs65
-rw-r--r--OpenSim/Data/RegionProfileData.cs257
-rw-r--r--OpenSim/Data/ReservationData.cs47
-rw-r--r--OpenSim/Data/UserDataBase.cs29
16 files changed, 1200 insertions, 0 deletions
diff --git a/OpenSim/Data/AssetDataBase.cs b/OpenSim/Data/AssetDataBase.cs
new file mode 100644
index 0000000..0f3044e
--- /dev/null
+++ b/OpenSim/Data/AssetDataBase.cs
@@ -0,0 +1,20 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using libsecondlife;
5
6namespace OpenSim.Framework.Data
7{
8 public abstract class AssetDataBase : IAssetProvider
9 {
10 public abstract AssetBase FetchAsset(LLUUID uuid);
11 public abstract void CreateAsset(AssetBase asset);
12 public abstract void UpdateAsset(AssetBase asset);
13 public abstract bool ExistsAsset(LLUUID uuid);
14 public abstract void CommitAssets();
15
16 public abstract string Version { get; }
17 public abstract string Name { get; }
18 public abstract void Initialise();
19 }
20}
diff --git a/OpenSim/Data/DataStoreBase.cs b/OpenSim/Data/DataStoreBase.cs
new file mode 100644
index 0000000..92604f2
--- /dev/null
+++ b/OpenSim/Data/DataStoreBase.cs
@@ -0,0 +1,10 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4
5namespace OpenSim.Framework.Data
6{
7 public abstract class DataStoreBase
8 {
9 }
10}
diff --git a/OpenSim/Data/GridDataBase.cs b/OpenSim/Data/GridDataBase.cs
new file mode 100644
index 0000000..9d6e832
--- /dev/null
+++ b/OpenSim/Data/GridDataBase.cs
@@ -0,0 +1,22 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using libsecondlife;
5
6namespace OpenSim.Framework.Data
7{
8 public abstract class GridDataBase : IGridData
9 {
10 public abstract RegionProfileData GetProfileByHandle(ulong regionHandle);
11 public abstract RegionProfileData GetProfileByLLUUID(LLUUID UUID);
12 public abstract RegionProfileData GetProfileByString(string regionName);
13 public abstract RegionProfileData[] GetProfilesInRange(uint Xmin, uint Ymin, uint Xmax, uint Ymax);
14 public abstract bool AuthenticateSim(LLUUID UUID, ulong regionHandle, string simrecvkey);
15 public abstract void Initialise();
16 public abstract void Close();
17 public abstract string getName();
18 public abstract string getVersion();
19 public abstract DataResponse AddProfile(RegionProfileData profile);
20 public abstract ReservationData GetReservationAtPoint(uint x, uint y);
21 }
22}
diff --git a/OpenSim/Data/IGridData.cs b/OpenSim/Data/IGridData.cs
new file mode 100644
index 0000000..af51d0d
--- /dev/null
+++ b/OpenSim/Data/IGridData.cs
@@ -0,0 +1,118 @@
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
28using System.Collections.Generic;
29using libsecondlife;
30
31namespace OpenSim.Framework.Data
32{
33 public enum DataResponse
34 {
35 RESPONSE_OK,
36 RESPONSE_AUTHREQUIRED,
37 RESPONSE_INVALIDCREDENTIALS,
38 RESPONSE_ERROR
39 }
40
41 /// <summary>
42 /// A standard grid interface
43 /// </summary>
44 public interface IGridData
45 {
46 /// <summary>
47 /// Returns a sim profile from a regionHandle
48 /// </summary>
49 /// <param name="regionHandle">A 64bit Region Handle</param>
50 /// <returns>A simprofile</returns>
51 RegionProfileData GetProfileByHandle(ulong regionHandle);
52
53 /// <summary>
54 /// Returns a sim profile from a UUID
55 /// </summary>
56 /// <param name="UUID">A 128bit UUID</param>
57 /// <returns>A sim profile</returns>
58 RegionProfileData GetProfileByLLUUID(LLUUID UUID);
59
60 /// <summary>
61 /// Returns a sim profile from a string match
62 /// </summary>
63 /// <param name="regionName">A string for a partial region name match</param>
64 /// <returns>A sim profile</returns>
65 RegionProfileData GetProfileByString(string regionName);
66
67 /// <summary>
68 /// Returns all profiles within the specified range
69 /// </summary>
70 /// <param name="Xmin">Minimum sim coordinate (X)</param>
71 /// <param name="Ymin">Minimum sim coordinate (Y)</param>
72 /// <param name="Xmax">Maximum sim coordinate (X)</param>
73 /// <param name="Ymin">Maximum sim coordinate (Y)</param>
74 /// <returns>An array containing all the sim profiles in the specified range</returns>
75 RegionProfileData[] GetProfilesInRange(uint Xmin, uint Ymin, uint Xmax, uint Ymax);
76
77 /// <summary>
78 /// Authenticates a sim by use of its recv key.
79 /// WARNING: Insecure
80 /// </summary>
81 /// <param name="UUID">The UUID sent by the sim</param>
82 /// <param name="regionHandle">The regionhandle sent by the sim</param>
83 /// <param name="simrecvkey">The receiving key sent by the sim</param>
84 /// <returns>Whether the sim has been authenticated</returns>
85 bool AuthenticateSim(LLUUID UUID, ulong regionHandle, string simrecvkey);
86
87 /// <summary>
88 /// Initialises the interface
89 /// </summary>
90 void Initialise();
91
92 /// <summary>
93 /// Closes the interface
94 /// </summary>
95 void Close();
96
97 /// <summary>
98 /// The plugin being loaded
99 /// </summary>
100 /// <returns>A string containing the plugin name</returns>
101 string getName();
102
103 /// <summary>
104 /// The plugins version
105 /// </summary>
106 /// <returns>A string containing the plugin version</returns>
107 string getVersion();
108
109 /// <summary>
110 /// Adds a new profile to the database
111 /// </summary>
112 /// <param name="profile">The profile to add</param>
113 /// <returns>RESPONSE_OK if successful, error if not.</returns>
114 DataResponse AddProfile(RegionProfileData profile);
115
116 ReservationData GetReservationAtPoint(uint x, uint y);
117 }
118}
diff --git a/OpenSim/Data/ILogData.cs b/OpenSim/Data/ILogData.cs
new file mode 100644
index 0000000..1751ff5
--- /dev/null
+++ b/OpenSim/Data/ILogData.cs
@@ -0,0 +1,91 @@
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
28namespace OpenSim.Framework.Data
29{
30 /// <summary>
31 /// The severity of an individual log message
32 /// </summary>
33 public enum LogSeverity : int
34 {
35 /// <summary>
36 /// Critical: systems failure
37 /// </summary>
38 CRITICAL = 1,
39 /// <summary>
40 /// Major: warning prior to systems failure
41 /// </summary>
42 MAJOR = 2,
43 /// <summary>
44 /// Medium: an individual non-critical task failed
45 /// </summary>
46 MEDIUM = 3,
47 /// <summary>
48 /// Low: Informational warning
49 /// </summary>
50 LOW = 4,
51 /// <summary>
52 /// Info: Information
53 /// </summary>
54 INFO = 5,
55 /// <summary>
56 /// Verbose: Debug Information
57 /// </summary>
58 VERBOSE = 6
59 }
60
61 /// <summary>
62 /// An interface to a LogData storage system
63 /// </summary>
64 public interface ILogData
65 {
66 void saveLog(string serverDaemon, string target, string methodCall, string arguments, int priority,
67 string logMessage);
68
69 /// <summary>
70 /// Initialises the interface
71 /// </summary>
72 void Initialise();
73
74 /// <summary>
75 /// Closes the interface
76 /// </summary>
77 void Close();
78
79 /// <summary>
80 /// The plugin being loaded
81 /// </summary>
82 /// <returns>A string containing the plugin name</returns>
83 string getName();
84
85 /// <summary>
86 /// The plugins version
87 /// </summary>
88 /// <returns>A string containing the plugin version</returns>
89 string getVersion();
90 }
91}
diff --git a/OpenSim/Data/IniConfig.cs b/OpenSim/Data/IniConfig.cs
new file mode 100644
index 0000000..47e96c8
--- /dev/null
+++ b/OpenSim/Data/IniConfig.cs
@@ -0,0 +1,98 @@
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
28using System.IO;
29using System.Text.RegularExpressions;
30
31/*
32 Taken from public code listing at by Alex Pinsker
33 http://alexpinsker.blogspot.com/2005/12/reading-ini-file-from-c_113432097333021549.html
34 */
35
36namespace OpenSim.Framework.Data
37{
38 /// <summary>
39 /// Parse settings from ini-like files
40 /// </summary>
41 public class IniFile
42 {
43 static IniFile()
44 {
45 _iniKeyValuePatternRegex = new Regex(
46 @"((\s)*(?<Key>([^\=^\s^\n]+))[\s^\n]*
47 # key part (surrounding whitespace stripped)
48 \=
49 (\s)*(?<Value>([^\n^\s]+(\n){0,1})))
50 # value part (surrounding whitespace stripped)
51 ",
52 RegexOptions.IgnorePatternWhitespace |
53 RegexOptions.Compiled |
54 RegexOptions.CultureInvariant);
55 }
56
57 private static Regex _iniKeyValuePatternRegex;
58
59 public IniFile(string iniFileName)
60 {
61 _iniFileName = iniFileName;
62 }
63
64 public string ParseFileReadValue(string key)
65 {
66 using (StreamReader reader =
67 new StreamReader(_iniFileName))
68 {
69 do
70 {
71 string line = reader.ReadLine();
72 Match match =
73 _iniKeyValuePatternRegex.Match(line);
74 if (match.Success)
75 {
76 string currentKey =
77 match.Groups["Key"].Value as string;
78 if (currentKey != null &&
79 currentKey.Trim().CompareTo(key) == 0)
80 {
81 string value =
82 match.Groups["Value"].Value as string;
83 return value;
84 }
85 }
86 } while (reader.Peek() != -1);
87 }
88 return null;
89 }
90
91 public string IniFileName
92 {
93 get { return _iniFileName; }
94 }
95
96 private string _iniFileName;
97 }
98}
diff --git a/OpenSim/Data/InventoryDataBase.cs b/OpenSim/Data/InventoryDataBase.cs
new file mode 100644
index 0000000..afddbf1
--- /dev/null
+++ b/OpenSim/Data/InventoryDataBase.cs
@@ -0,0 +1,10 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4
5namespace OpenSim.Framework.Data
6{
7 public abstract class InventoryDataBase
8 {
9 }
10}
diff --git a/OpenSim/Data/OpenSimDataReader.cs b/OpenSim/Data/OpenSimDataReader.cs
new file mode 100644
index 0000000..538af8f
--- /dev/null
+++ b/OpenSim/Data/OpenSimDataReader.cs
@@ -0,0 +1,64 @@
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
28using System;
29using System.Data;
30using libsecondlife;
31using OpenSim.Framework.Data.Base;
32
33namespace OpenSim.Framework.Data
34{
35 public class OpenSimDataReader : BaseDataReader
36 {
37 public OpenSimDataReader(IDataReader source) : base(source)
38 {
39 }
40
41 public LLVector3 GetVector(string s)
42 {
43 float x = GetFloat(s + "X");
44 float y = GetFloat(s + "Y");
45 float z = GetFloat(s + "Z");
46
47 LLVector3 vector = new LLVector3(x, y, z);
48
49 return vector;
50 }
51
52 public LLQuaternion GetQuaternion(string s)
53 {
54 float x = GetFloat(s + "X");
55 float y = GetFloat(s + "Y");
56 float z = GetFloat(s + "Z");
57 float w = GetFloat(s + "W");
58
59 LLQuaternion quaternion = new LLQuaternion(x, y, z, w);
60
61 return quaternion;
62 }
63 }
64}
diff --git a/OpenSim/Data/OpenSimDatabaseConnector.cs b/OpenSim/Data/OpenSimDatabaseConnector.cs
new file mode 100644
index 0000000..809fd1e
--- /dev/null
+++ b/OpenSim/Data/OpenSimDatabaseConnector.cs
@@ -0,0 +1,57 @@
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
28using System.Data;
29using System.Data.Common;
30using libsecondlife;
31
32using OpenSim.Framework.Data.Base;
33
34namespace OpenSim.Framework.Data
35{
36 public abstract class OpenSimDatabaseConnector : BaseDatabaseConnector
37 {
38 public OpenSimDatabaseConnector(string connectionString) : base(connectionString)
39 {
40 }
41
42 public override object ConvertToDbType(object value)
43 {
44 if (value is LLUUID)
45 {
46 return ((LLUUID) value).UUID.ToString();
47 }
48
49 return base.ConvertToDbType(value);
50 }
51
52 public override BaseDataReader CreateReader(IDataReader reader)
53 {
54 return new OpenSimDataReader(reader);
55 }
56 }
57}
diff --git a/OpenSim/Data/OpenSimObjectFieldMapper.cs b/OpenSim/Data/OpenSimObjectFieldMapper.cs
new file mode 100644
index 0000000..dfcca1b
--- /dev/null
+++ b/OpenSim/Data/OpenSimObjectFieldMapper.cs
@@ -0,0 +1,102 @@
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
28using System;
29using System.Collections.Generic;
30using System.Data.Common;
31using System.Text;
32using libsecondlife;
33
34using OpenSim.Framework.Data.Base;
35
36namespace OpenSim.Framework.Data
37{
38 public class OpenSimObjectFieldMapper<TObject, TField> : ObjectField<TObject, TField>
39 {
40 public OpenSimObjectFieldMapper(BaseTableMapper tableMapper, string fieldName,
41 ObjectGetAccessor<TObject, TField> rowMapperGetAccessor,
42 ObjectSetAccessor<TObject, TField> rowMapperSetAccessor)
43 : base(tableMapper, fieldName, rowMapperGetAccessor, rowMapperSetAccessor)
44 {
45 }
46
47 public override void ExpandField<TObj>(TObj obj, DbCommand command, List<string> fieldNames)
48 {
49 string fieldName = FieldName;
50 object value = GetParamValue(obj);
51
52 if (ValueType == typeof(LLVector3))
53 {
54 LLVector3 vector = (LLVector3)value;
55
56 RawAddParam(command, fieldNames, fieldName + "X", vector.X);
57 RawAddParam(command, fieldNames, fieldName + "Y", vector.Y);
58 RawAddParam(command, fieldNames, fieldName + "Z", vector.Z);
59 }
60 else if (ValueType == typeof(LLQuaternion))
61 {
62 LLQuaternion quaternion = (LLQuaternion)value;
63
64 RawAddParam(command, fieldNames, fieldName + "X", quaternion.X);
65 RawAddParam(command, fieldNames, fieldName + "Y", quaternion.Y);
66 RawAddParam(command, fieldNames, fieldName + "Z", quaternion.Z);
67 RawAddParam(command, fieldNames, fieldName + "W", quaternion.W);
68 }
69 else
70 {
71 base.ExpandField(obj, command, fieldNames);
72 }
73 }
74
75 protected override object GetValue(BaseDataReader reader)
76 {
77 object value;
78
79 OpenSimDataReader osreader = (OpenSimDataReader) reader;
80
81 if (ValueType == typeof(LLVector3))
82 {
83 value = osreader.GetVector(FieldName);
84 }
85 else if (ValueType == typeof(LLQuaternion))
86 {
87 value = osreader.GetQuaternion(FieldName);
88 }
89 else if (ValueType == typeof(LLUUID))
90 {
91 Guid guid = reader.GetGuid(FieldName);
92 value = new LLUUID(guid);
93 }
94 else
95 {
96 value = base.GetValue(reader);
97 }
98
99 return value;
100 }
101 }
102}
diff --git a/OpenSim/Data/OpenSimTableMapper.cs b/OpenSim/Data/OpenSimTableMapper.cs
new file mode 100644
index 0000000..cd3d1af
--- /dev/null
+++ b/OpenSim/Data/OpenSimTableMapper.cs
@@ -0,0 +1,40 @@
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
28using System.Data;
29
30using OpenSim.Framework.Data.Base;
31
32namespace OpenSim.Framework.Data
33{
34 public abstract class OpenSimTableMapper<TRowMapper, TPrimaryKey> : BaseTableMapper<TRowMapper, TPrimaryKey>
35 {
36 public OpenSimTableMapper(BaseDatabaseConnector database, string tableName) : base(database, tableName)
37 {
38 }
39 }
40}
diff --git a/OpenSim/Data/PrimitiveBaseShapeTableMapper.cs b/OpenSim/Data/PrimitiveBaseShapeTableMapper.cs
new file mode 100644
index 0000000..51adf89
--- /dev/null
+++ b/OpenSim/Data/PrimitiveBaseShapeTableMapper.cs
@@ -0,0 +1,170 @@
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
28using System;
29using OpenSim.Framework;
30using OpenSim.Framework.Data.Base;
31using libsecondlife;
32
33namespace OpenSim.Framework.Data
34{
35 public class PrimitiveBaseShapeRowMapper : BaseRowMapper<PrimitiveBaseShape>
36 {
37 public Guid SceneObjectPartId;
38
39 public PrimitiveBaseShapeRowMapper(BaseSchema schema, PrimitiveBaseShape obj) : base(schema, obj)
40 {
41 }
42 }
43
44 public class PrimitiveBaseShapeTableMapper : OpenSimTableMapper<PrimitiveBaseShapeRowMapper, Guid>
45 {
46 public PrimitiveBaseShapeTableMapper(BaseDatabaseConnector connection, string tableName)
47 : base(connection, tableName)
48 {
49 BaseSchema<PrimitiveBaseShapeRowMapper> rowMapperSchema = new BaseSchema<PrimitiveBaseShapeRowMapper>(this);
50 m_schema = rowMapperSchema;
51
52 m_keyFieldMapper = rowMapperSchema.AddMapping<Guid>("SceneObjectPartId",
53 delegate(PrimitiveBaseShapeRowMapper shape) { return shape.SceneObjectPartId; },
54 delegate(PrimitiveBaseShapeRowMapper shape, Guid value) { shape.SceneObjectPartId = value; });
55
56 rowMapperSchema.AddMapping<byte>("PCode",
57 delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.PCode; },
58 delegate(PrimitiveBaseShapeRowMapper shape, byte value) { shape.Object.PCode = value; });
59
60 rowMapperSchema.AddMapping<ushort>("PathBegin",
61 delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.PathBegin; },
62 delegate(PrimitiveBaseShapeRowMapper shape, ushort value) { shape.Object.PathBegin = value; });
63
64 rowMapperSchema.AddMapping<ushort>("PathEnd",
65 delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.PathEnd; },
66 delegate(PrimitiveBaseShapeRowMapper shape, ushort value) { shape.Object.PathEnd = value; });
67
68 rowMapperSchema.AddMapping<byte>("PathScaleX",
69 delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.PathScaleX; },
70 delegate(PrimitiveBaseShapeRowMapper shape, byte value) { shape.Object.PathScaleX = value; });
71
72 rowMapperSchema.AddMapping<byte>("PathScaleY",
73 delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.PathScaleY; },
74 delegate(PrimitiveBaseShapeRowMapper shape, byte value) { shape.Object.PathScaleY = value; });
75
76 rowMapperSchema.AddMapping<byte>("PathShearX",
77 delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.PathShearX; },
78 delegate(PrimitiveBaseShapeRowMapper shape, byte value) { shape.Object.PathShearX = value; });
79
80 rowMapperSchema.AddMapping<byte>("PathShearY",
81 delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.PathShearY; },
82 delegate(PrimitiveBaseShapeRowMapper shape, byte value) { shape.Object.PathShearY = value; });
83
84 rowMapperSchema.AddMapping<ushort>("ProfileBegin",
85 delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.ProfileBegin; },
86 delegate(PrimitiveBaseShapeRowMapper shape, ushort value) { shape.Object.ProfileBegin = value; });
87
88 rowMapperSchema.AddMapping<ushort>("ProfileEnd",
89 delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.ProfileEnd; },
90 delegate(PrimitiveBaseShapeRowMapper shape, ushort value) { shape.Object.ProfileEnd = value; });
91
92 rowMapperSchema.AddMapping<LLVector3>("Scale",
93 delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.Scale; },
94 delegate(PrimitiveBaseShapeRowMapper shape, LLVector3 value) { shape.Object.Scale = value; });
95
96 rowMapperSchema.AddMapping<sbyte>("PathTaperX",
97 delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.PathTaperX; },
98 delegate(PrimitiveBaseShapeRowMapper shape, sbyte value) { shape.Object.PathTaperX = value; });
99
100 rowMapperSchema.AddMapping<sbyte>("PathTaperY",
101 delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.PathTaperY; },
102 delegate(PrimitiveBaseShapeRowMapper shape, sbyte value) { shape.Object.PathTaperY = value; });
103
104 rowMapperSchema.AddMapping<sbyte>("PathTwist",
105 delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.PathTwist; },
106 delegate(PrimitiveBaseShapeRowMapper shape, sbyte value) { shape.Object.PathTwist = value; });
107
108 rowMapperSchema.AddMapping<sbyte>("PathRadiusOffset",
109 delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.PathRadiusOffset; },
110 delegate(PrimitiveBaseShapeRowMapper shape, sbyte value) { shape.Object.PathRadiusOffset = value; });
111
112 rowMapperSchema.AddMapping<byte>("PathRevolutions",
113 delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.PathRevolutions; },
114 delegate(PrimitiveBaseShapeRowMapper shape, byte value) { shape.Object.PathRevolutions = value; });
115
116 rowMapperSchema.AddMapping<sbyte>("PathTwistBegin",
117 delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.PathTwistBegin; },
118 delegate(PrimitiveBaseShapeRowMapper shape, sbyte value) { shape.Object.PathTwistBegin = value; });
119
120 rowMapperSchema.AddMapping<byte>("PathCurve",
121 delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.PathCurve; },
122 delegate(PrimitiveBaseShapeRowMapper shape, byte value) { shape.Object.PathCurve = value; });
123
124 rowMapperSchema.AddMapping<byte>("ProfileCurve",
125 delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.ProfileCurve; },
126 delegate(PrimitiveBaseShapeRowMapper shape, byte value) { shape.Object.ProfileCurve = value; });
127
128 rowMapperSchema.AddMapping<ushort>("ProfileHollow",
129 delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.ProfileHollow; },
130 delegate(PrimitiveBaseShapeRowMapper shape, ushort value) { shape.Object.ProfileHollow = value; });
131
132 rowMapperSchema.AddMapping<byte[]>("TextureEntry",
133 delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.TextureEntry; },
134 delegate(PrimitiveBaseShapeRowMapper shape, byte[] value) { shape.Object.TextureEntry = value; });
135
136 rowMapperSchema.AddMapping<byte[]>("ExtraParams",
137 delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.ExtraParams; },
138 delegate(PrimitiveBaseShapeRowMapper shape, byte[] value) { shape.Object.ExtraParams = value; });
139 }
140
141 public override PrimitiveBaseShapeRowMapper FromReader(BaseDataReader reader)
142 {
143 PrimitiveBaseShape shape = new PrimitiveBaseShape();
144
145 PrimitiveBaseShapeRowMapper mapper = new PrimitiveBaseShapeRowMapper(m_schema, shape);
146 mapper.FillObject( reader );
147
148 return mapper;
149 }
150
151 public bool Update(Guid sceneObjectPartId, PrimitiveBaseShape primitiveBaseShape)
152 {
153 PrimitiveBaseShapeRowMapper mapper = CreateRowMapper(sceneObjectPartId, primitiveBaseShape);
154 return Update(sceneObjectPartId, mapper);
155 }
156
157 public bool Add(Guid sceneObjectPartId, PrimitiveBaseShape primitiveBaseShape)
158 {
159 PrimitiveBaseShapeRowMapper mapper = CreateRowMapper(sceneObjectPartId, primitiveBaseShape);
160 return Add(mapper);
161 }
162
163 private PrimitiveBaseShapeRowMapper CreateRowMapper(Guid sceneObjectPartId, PrimitiveBaseShape primitiveBaseShape)
164 {
165 PrimitiveBaseShapeRowMapper mapper = new PrimitiveBaseShapeRowMapper( m_schema, primitiveBaseShape );
166 mapper.SceneObjectPartId = sceneObjectPartId;
167 return mapper;
168 }
169 }
170}
diff --git a/OpenSim/Data/Properties/AssemblyInfo.cs b/OpenSim/Data/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..7b65a09
--- /dev/null
+++ b/OpenSim/Data/Properties/AssemblyInfo.cs
@@ -0,0 +1,65 @@
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
28using System.Reflection;
29using System.Runtime.InteropServices;
30
31// General Information about an assembly is controlled through the following
32// set of attributes. Change these attribute values to modify the information
33// associated with an assembly.
34
35[assembly : AssemblyTitle("OpenSim.Framework.Data")]
36[assembly : AssemblyDescription("")]
37[assembly : AssemblyConfiguration("")]
38[assembly : AssemblyCompany("")]
39[assembly : AssemblyProduct("OpenSim.Framework.Data")]
40[assembly : AssemblyCopyright("Copyright (c) OpenSimulator.org Developers 2007-2008")]
41[assembly : AssemblyTrademark("")]
42[assembly : AssemblyCulture("")]
43
44// Setting ComVisible to false makes the types in this assembly not visible
45// to COM components. If you need to access a type in this assembly from
46// COM, set the ComVisible attribute to true on that type.
47
48[assembly : ComVisible(false)]
49
50// The following GUID is for the ID of the typelib if this project is exposed to COM
51
52[assembly : Guid("3a711c34-b0c0-4264-b0fe-f366eabf9d7b")]
53
54// Version information for an assembly consists of the following four values:
55//
56// Major Version
57// Minor Version
58// Build Number
59// Revision
60//
61// You can specify all the values or you can default the Revision and Build Numbers
62// by using the '*' as shown below:
63
64[assembly : AssemblyVersion("1.0.0.0")]
65[assembly : AssemblyFileVersion("1.0.0.0")]
diff --git a/OpenSim/Data/RegionProfileData.cs b/OpenSim/Data/RegionProfileData.cs
new file mode 100644
index 0000000..96351e0
--- /dev/null
+++ b/OpenSim/Data/RegionProfileData.cs
@@ -0,0 +1,257 @@
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
28using System;
29using System.Collections;
30using libsecondlife;
31using Nwc.XmlRpc;
32
33namespace OpenSim.Framework.Data
34{
35 /// <summary>
36 /// A class which contains information known to the grid server about a region
37 /// </summary>
38 public class RegionProfileData
39 {
40 /// <summary>
41 /// The name of the region
42 /// </summary>
43 public string regionName = String.Empty;
44
45 /// <summary>
46 /// A 64-bit number combining map position into a (mostly) unique ID
47 /// </summary>
48 public ulong regionHandle;
49
50 /// <summary>
51 /// OGS/OpenSim Specific ID for a region
52 /// </summary>
53 public LLUUID UUID;
54
55 /// <summary>
56 /// Coordinates of the region
57 /// </summary>
58 public uint regionLocX;
59 public uint regionLocY;
60 public uint regionLocZ; // Reserved (round-robin, layers, etc)
61
62 /// <summary>
63 /// Authentication secrets
64 /// </summary>
65 /// <remarks>Not very secure, needs improvement.</remarks>
66 public string regionSendKey = String.Empty;
67 public string regionRecvKey = String.Empty;
68 public string regionSecret = String.Empty;
69
70 /// <summary>
71 /// Whether the region is online
72 /// </summary>
73 public bool regionOnline;
74
75 /// <summary>
76 /// Information about the server that the region is currently hosted on
77 /// </summary>
78 public string serverIP = String.Empty;
79 public uint serverPort;
80 public string serverURI = String.Empty;
81
82 public uint httpPort;
83 public uint remotingPort;
84 public string httpServerURI = String.Empty;
85
86 /// <summary>
87 /// Set of optional overrides. Can be used to create non-eulicidean spaces.
88 /// </summary>
89 public ulong regionNorthOverrideHandle;
90 public ulong regionSouthOverrideHandle;
91 public ulong regionEastOverrideHandle;
92 public ulong regionWestOverrideHandle;
93
94 /// <summary>
95 /// Optional: URI Location of the region database
96 /// </summary>
97 /// <remarks>Used for floating sim pools where the region data is not nessecarily coupled to a specific server</remarks>
98 public string regionDataURI = String.Empty;
99
100 /// <summary>
101 /// Region Asset Details
102 /// </summary>
103 public string regionAssetURI = String.Empty;
104
105 public string regionAssetSendKey = String.Empty;
106 public string regionAssetRecvKey = String.Empty;
107
108 /// <summary>
109 /// Region Userserver Details
110 /// </summary>
111 public string regionUserURI = String.Empty;
112
113 public string regionUserSendKey = String.Empty;
114 public string regionUserRecvKey = String.Empty;
115
116 /// <summary>
117 /// Region Map Texture Asset
118 /// </summary>
119 public LLUUID regionMapTextureID = new LLUUID("00000000-0000-1111-9999-000000000006");
120
121 /// <summary>
122 /// this particular mod to the file provides support within the spec for RegionProfileData for the
123 /// owner_uuid for the region
124 /// </summary>
125 public LLUUID owner_uuid = LLUUID.Zero;
126
127 /// <summary>
128 /// OGS/OpenSim Specific original ID for a region after move/split
129 /// </summary>
130 public LLUUID originUUID;
131
132 /// <summary>
133 /// Get Sim profile data from grid server when in grid mode
134 /// </summary>
135 /// <param name="region_uuid"></param>
136 /// <param name="gridserver_url"></param>
137 /// <param name="?"></param>
138 /// <returns></returns>
139 public RegionProfileData RequestSimProfileData(LLUUID region_uuid, string gridserver_url,
140 string gridserver_sendkey, string gridserver_recvkey)
141 {
142 Hashtable requestData = new Hashtable();
143 requestData["region_uuid"] = region_uuid.UUID.ToString();
144 requestData["authkey"] = gridserver_sendkey;
145 ArrayList SendParams = new ArrayList();
146 SendParams.Add(requestData);
147 XmlRpcRequest GridReq = new XmlRpcRequest("simulator_data_request", SendParams);
148 XmlRpcResponse GridResp = GridReq.Send(gridserver_url, 3000);
149
150 Hashtable responseData = (Hashtable) GridResp.Value;
151
152 if (responseData.ContainsKey("error"))
153 {
154 return null;
155 }
156
157 RegionProfileData simData = new RegionProfileData();
158 simData.regionLocX = Convert.ToUInt32((string) responseData["region_locx"]);
159 simData.regionLocY = Convert.ToUInt32((string) responseData["region_locy"]);
160 simData.regionHandle = Helpers.UIntsToLong((simData.regionLocX * Constants.RegionSize), (simData.regionLocY * Constants.RegionSize));
161 simData.serverIP = (string) responseData["sim_ip"];
162 simData.serverPort = Convert.ToUInt32((string) responseData["sim_port"]);
163 simData.httpPort = Convert.ToUInt32((string) responseData["http_port"]);
164 simData.remotingPort = Convert.ToUInt32((string) responseData["remoting_port"]);
165 simData.serverURI = (string)responseData["server_uri"];
166 simData.httpServerURI = "http://" + simData.serverIP + ":" + simData.httpPort.ToString() + "/";
167 simData.UUID = new LLUUID((string) responseData["region_UUID"]);
168 simData.regionName = (string) responseData["region_name"];
169
170 return simData;
171 }
172
173 /// <summary>
174 /// Request sim profile information from a grid server
175 /// </summary>
176 /// <param name="region_handle"></param>
177 /// <param name="gridserver_url"></param>
178 /// <param name="gridserver_sendkey"></param>
179 /// <param name="gridserver_recvkey"></param>
180 /// <returns>The sim profile. Null if there was a request failure</returns>
181 public static RegionProfileData RequestSimProfileData(ulong region_handle, string gridserver_url,
182 string gridserver_sendkey, string gridserver_recvkey)
183 {
184 Hashtable requestData = new Hashtable();
185 requestData["region_handle"] = region_handle.ToString();
186 requestData["authkey"] = gridserver_sendkey;
187 ArrayList SendParams = new ArrayList();
188 SendParams.Add(requestData);
189 XmlRpcRequest GridReq = new XmlRpcRequest("simulator_data_request", SendParams);
190 XmlRpcResponse GridResp = GridReq.Send(gridserver_url, 3000);
191
192 Hashtable responseData = (Hashtable) GridResp.Value;
193
194 if (responseData.ContainsKey("error"))
195 {
196 return null;
197 }
198
199 RegionProfileData simData = new RegionProfileData();
200 simData.regionLocX = Convert.ToUInt32((string) responseData["region_locx"]);
201 simData.regionLocY = Convert.ToUInt32((string) responseData["region_locy"]);
202 simData.regionHandle = Helpers.UIntsToLong((simData.regionLocX * Constants.RegionSize), (simData.regionLocY * Constants.RegionSize));
203 simData.serverIP = (string) responseData["sim_ip"];
204 simData.serverPort = Convert.ToUInt32((string) responseData["sim_port"]);
205 simData.httpPort = Convert.ToUInt32((string) responseData["http_port"]);
206 simData.remotingPort = Convert.ToUInt32((string) responseData["remoting_port"]);
207 simData.httpServerURI = "http://" + simData.serverIP + ":" + simData.httpPort.ToString() + "/";
208 simData.serverURI = (string)responseData["server_uri"];
209 simData.UUID = new LLUUID((string) responseData["region_UUID"]);
210 simData.regionName = (string) responseData["region_name"];
211
212 return simData;
213 }
214
215 /// <summary>
216 /// Request sim profile information from a grid server
217 /// </summary>
218 /// <param name="region_handle"></param>
219 /// <param name="gridserver_url"></param>
220 /// <param name="gridserver_sendkey"></param>
221 /// <param name="gridserver_recvkey"></param>
222 /// <returns>The sim profile. Null if there was a request failure</returns>
223 public static RegionProfileData RequestSimProfileData(string regionName, string gridserver_url,
224 string gridserver_sendkey, string gridserver_recvkey)
225 {
226 Hashtable requestData = new Hashtable();
227 requestData["region_name_search"] = regionName;
228 requestData["authkey"] = gridserver_sendkey;
229 ArrayList SendParams = new ArrayList();
230 SendParams.Add(requestData);
231 XmlRpcRequest GridReq = new XmlRpcRequest("simulator_data_request", SendParams);
232 XmlRpcResponse GridResp = GridReq.Send(gridserver_url, 3000);
233
234 Hashtable responseData = (Hashtable)GridResp.Value;
235
236 if (responseData.ContainsKey("error"))
237 {
238 return null;
239 }
240
241 RegionProfileData simData = new RegionProfileData();
242 simData.regionLocX = Convert.ToUInt32((string)responseData["region_locx"]);
243 simData.regionLocY = Convert.ToUInt32((string)responseData["region_locy"]);
244 simData.regionHandle = Helpers.UIntsToLong((simData.regionLocX * Constants.RegionSize), (simData.regionLocY * Constants.RegionSize));
245 simData.serverIP = (string)responseData["sim_ip"];
246 simData.serverPort = Convert.ToUInt32((string)responseData["sim_port"]);
247 simData.httpPort = Convert.ToUInt32((string)responseData["http_port"]);
248 simData.remotingPort = Convert.ToUInt32((string)responseData["remoting_port"]);
249 simData.httpServerURI = "http://" + simData.serverIP + ":" + simData.httpPort.ToString() + "/";
250 simData.serverURI = (string)responseData["server_uri"];
251 simData.UUID = new LLUUID((string)responseData["region_UUID"]);
252 simData.regionName = (string)responseData["region_name"];
253
254 return simData;
255 }
256 }
257}
diff --git a/OpenSim/Data/ReservationData.cs b/OpenSim/Data/ReservationData.cs
new file mode 100644
index 0000000..0c2cff3
--- /dev/null
+++ b/OpenSim/Data/ReservationData.cs
@@ -0,0 +1,47 @@
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
28using libsecondlife;
29
30namespace OpenSim.Framework.Data
31{
32 public class ReservationData
33 {
34 public LLUUID userUUID = LLUUID.Zero;
35 public int reservationMinX = 0;
36 public int reservationMinY = 0;
37 public int reservationMaxX = 65536;
38 public int reservationMaxY = 65536;
39
40 public string reservationName = System.String.Empty;
41 public string reservationCompany = System.String.Empty;
42 public bool status = true;
43
44 public string gridSendKey = System.String.Empty;
45 public string gridRecvKey = System.String.Empty;
46 }
47}
diff --git a/OpenSim/Data/UserDataBase.cs b/OpenSim/Data/UserDataBase.cs
new file mode 100644
index 0000000..5e0be45
--- /dev/null
+++ b/OpenSim/Data/UserDataBase.cs
@@ -0,0 +1,29 @@
1using System.Collections.Generic;
2using libsecondlife;
3
4namespace OpenSim.Framework.Data
5{
6 public abstract class UserDataBase : IUserData
7 {
8 public abstract UserProfileData GetUserByUUID(LLUUID user);
9 public abstract UserProfileData GetUserByName(string fname, string lname);
10 public abstract UserAgentData GetAgentByUUID(LLUUID user);
11 public abstract UserAgentData GetAgentByName(string name);
12 public abstract UserAgentData GetAgentByName(string fname, string lname);
13 public abstract void StoreWebLoginKey(LLUUID agentID, LLUUID webLoginKey);
14 public abstract void AddNewUserProfile(UserProfileData user);
15 public abstract bool UpdateUserProfile(UserProfileData user);
16 public abstract void UpdateUserCurrentRegion(LLUUID avatarid, LLUUID regionuuid);
17 public abstract void AddNewUserAgent(UserAgentData agent);
18 public abstract void AddNewUserFriend(LLUUID friendlistowner, LLUUID friend, uint perms);
19 public abstract void RemoveUserFriend(LLUUID friendlistowner, LLUUID friend);
20 public abstract void UpdateUserFriendPerms(LLUUID friendlistowner, LLUUID friend, uint perms);
21 public abstract List<FriendListItem> GetUserFriendList(LLUUID friendlistowner);
22 public abstract bool MoneyTransferRequest(LLUUID from, LLUUID to, uint amount);
23 public abstract bool InventoryTransferRequest(LLUUID from, LLUUID to, LLUUID inventory);
24 public abstract string GetVersion();
25 public abstract string getName();
26 public abstract void Initialise();
27 public abstract List<OpenSim.Framework.AvatarPickerAvatar> GeneratePickerResults(LLUUID queryID, string query);
28 }
29}