aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorCharles Krinke2009-01-11 18:24:16 +0000
committerCharles Krinke2009-01-11 18:24:16 +0000
commit40f34aeffd64e2aa81cecb2e861f60d6e8886198 (patch)
tree5d0059eb7aa70799c8239bb273efc997138cabb5
parentThank you kindly, Tlaukkan (Tommil) for a patch that: (diff)
downloadopensim-SC-40f34aeffd64e2aa81cecb2e861f60d6e8886198.zip
opensim-SC-40f34aeffd64e2aa81cecb2e861f60d6e8886198.tar.gz
opensim-SC-40f34aeffd64e2aa81cecb2e861f60d6e8886198.tar.bz2
opensim-SC-40f34aeffd64e2aa81cecb2e861f60d6e8886198.tar.xz
Thank you kindly, Tlaukkan (Tommil) for a patch that:
Fixed all NHibernate unit tests by implementing missing persistency methods, tables, columns and fixing bugs in the existing implementation. Two minor changes to classes outside NHibernate module: Added Scene instantiation for SceneObjectGroup in OpenSim.Data.Tests.BasicRegionTest as this was required by the NHibernate persistency. In the process added also mock constructor to Scene which only populates RegionInfo in the scene which is used by ScenePart.RegionUUID. NHibernate module is still in experimental state and has not been tested at opensim region or ugaim runtime configuration. Adding unit tests to build is not yet advisable nor using NHibernate module in any production setup.
-rw-r--r--OpenSim/Data/NHibernate/ColorUserType.cs106
-rw-r--r--OpenSim/Data/NHibernate/NHibernateInventoryData.cs7
-rw-r--r--OpenSim/Data/NHibernate/NHibernateRegionData.cs37
-rw-r--r--OpenSim/Data/NHibernate/NHibernateUserData.cs188
-rw-r--r--OpenSim/Data/NHibernate/Resources/MySQLDialect/001_RegionStore.sql80
-rw-r--r--OpenSim/Data/NHibernate/Resources/MySQLDialect/001_UserStore.sql102
-rw-r--r--OpenSim/Data/NHibernate/Resources/MySQLDialect/003_RegionStore.sql72
-rw-r--r--OpenSim/Data/NHibernate/Resources/RegionSettings.hbm.xml56
-rw-r--r--OpenSim/Data/NHibernate/Resources/RegionStore.hbm.xml12
-rw-r--r--OpenSim/Data/NHibernate/Resources/SQLiteDialect/001_RegionStore.sql60
-rw-r--r--OpenSim/Data/NHibernate/Resources/SQLiteDialect/001_UserStore.sql39
-rw-r--r--OpenSim/Data/NHibernate/Resources/UserAgentData.hbm.xml17
-rw-r--r--OpenSim/Data/NHibernate/Resources/UserAppearance.hbm.xml1
-rw-r--r--OpenSim/Data/NHibernate/Resources/UserFriend.hbm.xml11
-rw-r--r--OpenSim/Data/NHibernate/Resources/UserProfileData.hbm.xml16
-rw-r--r--OpenSim/Data/NHibernate/UserFriend.cs28
-rw-r--r--OpenSim/Data/Tests/BasicRegionTest.cs48
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs11
-rw-r--r--prebuild.xml1
19 files changed, 762 insertions, 130 deletions
diff --git a/OpenSim/Data/NHibernate/ColorUserType.cs b/OpenSim/Data/NHibernate/ColorUserType.cs
new file mode 100644
index 0000000..4676585
--- /dev/null
+++ b/OpenSim/Data/NHibernate/ColorUserType.cs
@@ -0,0 +1,106 @@
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 OpenMetaverse;
31using OpenSim.Framework;
32using NHibernate;
33using NHibernate.SqlTypes;
34using NHibernate.UserTypes;
35using System.Drawing;
36
37namespace OpenSim.Data.NHibernate
38{
39 [Serializable]
40 public class ColorUserType : IUserType
41 {
42 public object Assemble(object cached, object owner)
43 {
44 return cached;
45 }
46
47 bool IUserType.Equals(object color1, object color2)
48 {
49 return color1.Equals(color2);
50 }
51
52 public object DeepCopy(object color)
53 {
54 return color;
55 }
56
57 public object Disassemble(object color)
58 {
59 return color;
60 }
61
62 public int GetHashCode(object color)
63 {
64 return (color == null) ? 0 : color.GetHashCode();
65 }
66
67 public bool IsMutable
68 {
69 get { return false; }
70 }
71
72 public object NullSafeGet(IDataReader rs, string[] names, object owner)
73 {
74 Color color=Color.Empty;
75
76 int ord = rs.GetOrdinal(names[0]);
77 if (!rs.IsDBNull(ord))
78 {
79 color = Color.FromArgb(rs.GetInt32(ord));
80 }
81
82 return color;
83 }
84
85 public void NullSafeSet(IDbCommand cmd, object obj, int index)
86 {
87 Color color = (Color)obj;
88 ((IDataParameter)cmd.Parameters[index]).Value = color.ToArgb();
89 }
90
91 public object Replace(object original, object target, object owner)
92 {
93 return original;
94 }
95
96 public Type ReturnedType
97 {
98 get { return typeof(Color); }
99 }
100
101 public SqlType[] SqlTypes
102 {
103 get { return new SqlType [] { NHibernateUtil.Int32.SqlType }; }
104 }
105 }
106}
diff --git a/OpenSim/Data/NHibernate/NHibernateInventoryData.cs b/OpenSim/Data/NHibernate/NHibernateInventoryData.cs
index dc98d11..e648396 100644
--- a/OpenSim/Data/NHibernate/NHibernateInventoryData.cs
+++ b/OpenSim/Data/NHibernate/NHibernateInventoryData.cs
@@ -344,7 +344,14 @@ namespace OpenSim.Data.NHibernate
344 // See IInventoryDataPlugin 344 // See IInventoryDataPlugin
345 public List<InventoryFolderBase> getFolderHierarchy(UUID parentID) 345 public List<InventoryFolderBase> getFolderHierarchy(UUID parentID)
346 { 346 {
347 if (parentID == UUID.Zero)
348 {
349 // Zero UUID is not a real parent folder.
350 return new List<InventoryFolderBase>();
351 }
352
347 List<InventoryFolderBase> folders = new List<InventoryFolderBase>(); 353 List<InventoryFolderBase> folders = new List<InventoryFolderBase>();
354
348 getInventoryFolders(ref folders, parentID); 355 getInventoryFolders(ref folders, parentID);
349 356
350 for (int i = 0; i < folders.Count; i++) 357 for (int i = 0; i < folders.Count; i++)
diff --git a/OpenSim/Data/NHibernate/NHibernateRegionData.cs b/OpenSim/Data/NHibernate/NHibernateRegionData.cs
index 871013b..b8b1863 100644
--- a/OpenSim/Data/NHibernate/NHibernateRegionData.cs
+++ b/OpenSim/Data/NHibernate/NHibernateRegionData.cs
@@ -67,11 +67,31 @@ namespace OpenSim.Data.NHibernate
67 67
68 public void StoreRegionSettings(RegionSettings rs) 68 public void StoreRegionSettings(RegionSettings rs)
69 { 69 {
70 RegionSettings oldRegionSettings = (RegionSettings)manager.Load(typeof(RegionSettings), rs.RegionUUID);
71 if (oldRegionSettings != null)
72 {
73 manager.Update(rs);
74 }
75 else
76 {
77 manager.Save(rs);
78 }
70 } 79 }
71 80
72 public RegionSettings LoadRegionSettings(UUID regionUUID) 81 public RegionSettings LoadRegionSettings(UUID regionUUID)
73 { 82 {
74 return null; 83 RegionSettings regionSettings = (RegionSettings) manager.Load(typeof(RegionSettings), regionUUID);
84
85 if (regionSettings == null)
86 {
87 regionSettings = new RegionSettings();
88 regionSettings.RegionUUID = regionUUID;
89 manager.Save(regionSettings);
90 }
91
92 regionSettings.OnSave += StoreRegionSettings;
93
94 return regionSettings;
75 } 95 }
76 96
77 // This looks inefficient, but it turns out that it isn't 97 // This looks inefficient, but it turns out that it isn't
@@ -84,7 +104,7 @@ namespace OpenSim.Data.NHibernate
84 if (old != null) 104 if (old != null)
85 { 105 {
86 m_log.InfoFormat("[NHIBERNATE] updating object {0}", p.UUID); 106 m_log.InfoFormat("[NHIBERNATE] updating object {0}", p.UUID);
87 manager.Update(old); 107 manager.Update(p);
88 } 108 }
89 else 109 else
90 { 110 {
@@ -108,7 +128,7 @@ namespace OpenSim.Data.NHibernate
108 if (old != null) 128 if (old != null)
109 { 129 {
110 m_log.InfoFormat("[NHIBERNATE] updating terrain {0}", t.RegionID); 130 m_log.InfoFormat("[NHIBERNATE] updating terrain {0}", t.RegionID);
111 manager.Update(old); 131 manager.Update(t);
112 } 132 }
113 else 133 else
114 { 134 {
@@ -131,6 +151,14 @@ namespace OpenSim.Data.NHibernate
131 /// <param name="regionUUID">the region UUID</param> 151 /// <param name="regionUUID">the region UUID</param>
132 public void StoreObject(SceneObjectGroup obj, UUID regionUUID) 152 public void StoreObject(SceneObjectGroup obj, UUID regionUUID)
133 { 153 {
154 uint flags = obj.RootPart.GetEffectiveObjectFlags();
155
156 // Eligibility check
157 if ((flags & (uint)PrimFlags.Temporary) != 0)
158 return;
159 if ((flags & (uint)PrimFlags.TemporaryOnRez) != 0)
160 return;
161
134 try 162 try
135 { 163 {
136 foreach (SceneObjectPart part in obj.Children.Values) 164 foreach (SceneObjectPart part in obj.Children.Values)
@@ -199,7 +227,8 @@ namespace OpenSim.Data.NHibernate
199 227
200 ICriteria criteria = manager.GetSession().CreateCriteria(typeof(SceneObjectPart)); 228 ICriteria criteria = manager.GetSession().CreateCriteria(typeof(SceneObjectPart));
201 criteria.Add(Expression.Eq("RegionID", regionUUID)); 229 criteria.Add(Expression.Eq("RegionID", regionUUID));
202 criteria.AddOrder( Order.Asc("ParentID") ); 230 criteria.AddOrder(Order.Asc("ParentID"));
231 criteria.AddOrder(Order.Asc("LinkNum"));
203 foreach (SceneObjectPart p in criteria.List()) 232 foreach (SceneObjectPart p in criteria.List())
204 { 233 {
205 // root part 234 // root part
diff --git a/OpenSim/Data/NHibernate/NHibernateUserData.cs b/OpenSim/Data/NHibernate/NHibernateUserData.cs
index e0f6db7..6076f90 100644
--- a/OpenSim/Data/NHibernate/NHibernateUserData.cs
+++ b/OpenSim/Data/NHibernate/NHibernateUserData.cs
@@ -97,11 +97,18 @@ namespace OpenSim.Data.NHibernate
97 97
98 override public void AddNewUserProfile(UserProfileData profile) 98 override public void AddNewUserProfile(UserProfileData profile)
99 { 99 {
100 if (profile.ID == UUID.Zero)
101 {
102 m_log.ErrorFormat("[NHIBERNATE] Attempted to add User {0} {1} with zero UUID, throwintg exception as this is programming error ", profile.FirstName, profile.SurName);
103 return;
104 }
105
100 if (!ExistsUser(profile.ID)) 106 if (!ExistsUser(profile.ID))
101 { 107 {
102 m_log.InfoFormat("[NHIBERNATE] AddNewUserProfile {0}", profile.ID); 108 m_log.InfoFormat("[NHIBERNATE] AddNewUserProfile {0}", profile.ID);
103 manager.Save(profile); 109 manager.Save(profile);
104 SetAgentData(profile.ID, profile.CurrentAgent); 110 // Agent should not be saved according to BasicUserTest.T015_UserPersistency()
111 // SetAgentData(profile.ID, profile.CurrentAgent);
105 112
106 } 113 }
107 else 114 else
@@ -131,7 +138,8 @@ namespace OpenSim.Data.NHibernate
131 if (ExistsUser(profile.ID)) 138 if (ExistsUser(profile.ID))
132 { 139 {
133 manager.Update(profile); 140 manager.Update(profile);
134 SetAgentData(profile.ID, profile.CurrentAgent); 141 // Agent should not be saved according to BasicUserTest.T015_UserPersistency()
142 // SetAgentData(profile.ID, profile.CurrentAgent);
135 return true; 143 return true;
136 } 144 }
137 else 145 else
@@ -144,6 +152,19 @@ namespace OpenSim.Data.NHibernate
144 152
145 override public void AddNewUserAgent(UserAgentData agent) 153 override public void AddNewUserAgent(UserAgentData agent)
146 { 154 {
155 if (agent.ProfileID == UUID.Zero)
156 {
157 m_log.ErrorFormat("[NHIBERNATE] Attempted to add new user agent with zero user id. Agent session id: {0}", agent.SessionID);
158 return;
159 }
160
161 if (agent.SessionID == UUID.Zero)
162 {
163 m_log.ErrorFormat("[NHIBERNATE] Attempted to add new user agent with zero session id. User profile id: {0}", agent.SessionID);
164 return;
165 }
166
167
147 UserAgentData old = (UserAgentData)manager.Load(typeof(UserAgentData), agent.ProfileID); 168 UserAgentData old = (UserAgentData)manager.Load(typeof(UserAgentData), agent.ProfileID);
148 if (old != null) 169 if (old != null)
149 { 170 {
@@ -214,12 +235,163 @@ namespace OpenSim.Data.NHibernate
214 } 235 }
215 236
216 // TODO: actually implement these 237 // TODO: actually implement these
217 public override void StoreWebLoginKey(UUID agentID, UUID webLoginKey) { return; } 238 public override void StoreWebLoginKey(UUID agentID, UUID webLoginKey)
218 public override void AddNewUserFriend(UUID friendlistowner, UUID friend, uint perms) { return; } 239 {
219 public override void RemoveUserFriend(UUID friendlistowner, UUID friend) { return; } 240 UserProfileData user=GetUserByUUID(agentID);
220 public override void UpdateUserFriendPerms(UUID friendlistowner, UUID friend, uint perms) { return; } 241 user.WebLoginKey = webLoginKey;
221 public override List<FriendListItem> GetUserFriendList(UUID friendlistowner) { return new List<FriendListItem>(); } 242 UpdateUserProfile(user);
222 public override Dictionary<UUID, FriendRegionInfo> GetFriendRegionInfos (List<UUID> uuids) { return new Dictionary<UUID, FriendRegionInfo>(); } 243 return;
244 }
245
246 public override void AddNewUserFriend(UUID ownerId, UUID friendId, uint perms)
247 {
248 if (!FriendRelationExists(ownerId,friendId))
249 {
250 manager.Save(new UserFriend(UUID.Random(), ownerId, friendId, perms));
251 }
252 if (!FriendRelationExists(friendId, ownerId))
253 {
254 manager.Save(new UserFriend(UUID.Random(), friendId, ownerId, perms));
255 }
256 return;
257 }
258
259 private bool FriendRelationExists(UUID ownerId, UUID friendId)
260 {
261 using (ISession session = manager.GetSession())
262 {
263 ICriteria criteria = session.CreateCriteria(typeof(UserFriend));
264 criteria.Add(Expression.Eq("OwnerID", ownerId));
265 criteria.Add(Expression.Eq("FriendID", friendId));
266 return criteria.List().Count > 0;
267 }
268 }
269
270 public override void RemoveUserFriend(UUID ownerId, UUID friendId)
271 {
272 using (ISession session = manager.GetSession())
273 {
274 using (ITransaction transaction = session.BeginTransaction())
275 {
276
277 {
278 ICriteria criteria = session.CreateCriteria(typeof(UserFriend));
279 criteria.Add(Expression.Eq("OwnerID", ownerId));
280 criteria.Add(Expression.Eq("FriendID", friendId));
281
282 foreach (UserFriend userFriend in criteria.List())
283 {
284 session.Delete(userFriend);
285 }
286 }
287
288 {
289 ICriteria criteria = session.CreateCriteria(typeof(UserFriend));
290 criteria.Add(Expression.Eq("OwnerID", friendId));
291 criteria.Add(Expression.Eq("FriendID", ownerId));
292
293 foreach (UserFriend userFriend in criteria.List())
294 {
295 session.Delete(userFriend);
296 }
297 }
298
299 transaction.Commit();
300 }
301 }
302 return;
303 }
304
305
306 public override void UpdateUserFriendPerms(UUID ownerId, UUID friendId, uint perms)
307 {
308 using (ISession session = manager.GetSession())
309 {
310 using (ITransaction transaction = session.BeginTransaction())
311 {
312 {
313 ICriteria criteria = session.CreateCriteria(typeof(UserFriend));
314 criteria.Add(Expression.Eq("OwnerID", ownerId));
315 criteria.Add(Expression.Eq("FriendID", friendId));
316
317 foreach (UserFriend userFriend in criteria.List())
318 {
319 userFriend.FriendPermissions = perms;
320 session.Update(userFriend);
321 }
322 }
323 transaction.Commit();
324 }
325 }
326 return;
327 }
328
329 public override List<FriendListItem> GetUserFriendList(UUID ownerId)
330 {
331 List<FriendListItem> friendList=new List<FriendListItem>();
332 Dictionary<UUID, FriendListItem> friendListItemDictionary = new Dictionary<UUID, FriendListItem>();
333
334 using (ISession session = manager.GetSession())
335 {
336 ICriteria criteria = session.CreateCriteria(typeof(UserFriend));
337 criteria.Add(Expression.Or(
338 Expression.Eq("OwnerID", ownerId),
339 Expression.Eq("FriendID", ownerId)
340 ));
341
342 foreach (UserFriend userFriend in criteria.List())
343 {
344 if (userFriend.OwnerID == ownerId)
345 {
346 FriendListItem friendListItem = new FriendListItem();
347 friendListItem.FriendListOwner = userFriend.OwnerID;
348 friendListItem.Friend = userFriend.FriendID;
349 friendListItem.FriendPerms = userFriend.FriendPermissions;
350 friendListItemDictionary.Add(userFriend.FriendID, friendListItem);
351 friendList.Add(friendListItem);
352 }
353 }
354
355 // Reading permissions to other direction
356 foreach (UserFriend userFriend in criteria.List())
357 {
358 if (userFriend.FriendID == ownerId)
359 {
360 //Ignore if there is no reverse relation existing.
361 //if (friendListItemDictionary.ContainsKey(userFriend.OwnerID))
362 {
363 FriendListItem friendListItem = friendListItemDictionary[userFriend.OwnerID];
364 friendListItem.FriendListOwnerPerms = userFriend.FriendPermissions;
365 }
366 }
367 }
368
369 }
370
371 return friendList;
372 }
373
374
375 public override Dictionary<UUID, FriendRegionInfo> GetFriendRegionInfos (List<UUID> friendsIds)
376 {
377 Dictionary<UUID, FriendRegionInfo> friendRegionInfos=new Dictionary<UUID, FriendRegionInfo>();
378
379 foreach(UUID friendId in friendsIds)
380 {
381 UserAgentData agent=GetAgentByUUID(friendId);
382 if (agent != null)
383 {
384 FriendRegionInfo fri = new FriendRegionInfo();
385 fri.isOnline = agent.AgentOnline;
386 fri.regionHandle = agent.Handle;
387
388 friendRegionInfos[friendId] = fri;
389 }
390 }
391
392 return friendRegionInfos;
393 }
394
223 public override bool MoneyTransferRequest(UUID from, UUID to, uint amount) { return true; } 395 public override bool MoneyTransferRequest(UUID from, UUID to, uint amount) { return true; }
224 public override bool InventoryTransferRequest(UUID from, UUID to, UUID inventory) { return true; } 396 public override bool InventoryTransferRequest(UUID from, UUID to, UUID inventory) { return true; }
225 397
diff --git a/OpenSim/Data/NHibernate/Resources/MySQLDialect/001_RegionStore.sql b/OpenSim/Data/NHibernate/Resources/MySQLDialect/001_RegionStore.sql
index 99a5227..158ebb4 100644
--- a/OpenSim/Data/NHibernate/Resources/MySQLDialect/001_RegionStore.sql
+++ b/OpenSim/Data/NHibernate/Resources/MySQLDialect/001_RegionStore.sql
@@ -1,8 +1,15 @@
1CREATE TABLE `Prims` ( 1CREATE TABLE `Prims` (
2 `UUID` char(36) NOT NULL default '',
3 `RegionID` char(36) default NULL,
4 `GroupID` char(36) default NULL,
2 `ParentID` int(11) default NULL, 5 `ParentID` int(11) default NULL,
6 `ParentUUID` char(36) default NULL,
7 `OwnerID` char(36) default NULL,
8 `LastOwnerID` char(36) default NULL,
9 `CreatorID` char(36) default NULL,
3 `CreationDate` int(11) default NULL, 10 `CreationDate` int(11) default NULL,
11 `LinkNum` int(11) default NULL,
4 `Name` varchar(255) default NULL, 12 `Name` varchar(255) default NULL,
5 `ParentUUID` char(36) default NULL,
6 `Text` varchar(255) default NULL, 13 `Text` varchar(255) default NULL,
7 `Description` varchar(255) default NULL, 14 `Description` varchar(255) default NULL,
8 `SitName` varchar(255) default NULL, 15 `SitName` varchar(255) default NULL,
@@ -13,43 +20,43 @@ CREATE TABLE `Prims` (
13 `GroupMask` int(11) default NULL, 20 `GroupMask` int(11) default NULL,
14 `EveryoneMask` int(11) default NULL, 21 `EveryoneMask` int(11) default NULL,
15 `BaseMask` int(11) default NULL, 22 `BaseMask` int(11) default NULL,
16 `PositionX` float default NULL, 23 `Material` int(1) default NULL,
17 `PositionY` float default NULL, 24 `ScriptAccessPin` int(11) default NULL,
18 `PositionZ` float default NULL, 25 `TextureAnimation` blob,
19 `GroupPositionX` float default NULL, 26 `ParticleSystem` blob,
20 `GroupPositionY` float default NULL, 27 `ClickAction` int(1) default NULL,
21 `GroupPositionZ` float default NULL, 28 `Color` int(11) default NULL,
22 `VelocityX` float default NULL, 29 `PositionX` double default NULL,
23 `VelocityY` float default NULL, 30 `PositionY` double default NULL,
24 `VelocityZ` float default NULL, 31 `PositionZ` double default NULL,
25 `AngularVelocityX` float default NULL, 32 `GroupPositionX` double default NULL,
26 `AngularVelocityY` float default NULL, 33 `GroupPositionY` double default NULL,
27 `AngularVelocityZ` float default NULL, 34 `GroupPositionZ` double default NULL,
28 `AccelerationX` float default NULL, 35 `VelocityX` double default NULL,
29 `AccelerationY` float default NULL, 36 `VelocityY` double default NULL,
30 `AccelerationZ` float default NULL, 37 `VelocityZ` double default NULL,
31 `RotationX` float default NULL, 38 `AngularVelocityX` double default NULL,
32 `RotationY` float default NULL, 39 `AngularVelocityY` double default NULL,
33 `RotationZ` float default NULL, 40 `AngularVelocityZ` double default NULL,
34 `RotationW` float default NULL, 41 `AccelerationX` double default NULL,
35 `SitTargetOffsetX` float default NULL, 42 `AccelerationY` double default NULL,
36 `SitTargetOffsetY` float default NULL, 43 `AccelerationZ` double default NULL,
37 `SitTargetOffsetZ` float default NULL, 44 `RotationX` double default NULL,
38 `SitTargetOrientW` float default NULL, 45 `RotationY` double default NULL,
39 `SitTargetOrientX` float default NULL, 46 `RotationZ` double default NULL,
40 `SitTargetOrientY` float default NULL, 47 `RotationW` double default NULL,
41 `SitTargetOrientZ` float default NULL, 48 `SitTargetOffsetX` double default NULL,
42 `UUID` char(36) NOT NULL default '', 49 `SitTargetOffsetY` double default NULL,
43 `RegionID` char(36) default NULL, 50 `SitTargetOffsetZ` double default NULL,
44 `CreatorID` char(36) default NULL, 51 `SitTargetOrientW` double default NULL,
45 `OwnerID` char(36) default NULL, 52 `SitTargetOrientX` double default NULL,
46 `GroupID` char(36) default NULL, 53 `SitTargetOrientY` double default NULL,
47 `LastOwnerID` char(36) default NULL, 54 `SitTargetOrientZ` double default NULL,
48 -- this is the shape 55 -- this is the shape
49 `Shape` int(11) default NULL, 56 `Shape` int(11) default NULL,
50 `ScaleX` float default NULL, 57 `ScaleX` double default NULL,
51 `ScaleY` float default NULL, 58 `ScaleY` double default NULL,
52 `ScaleZ` float default NULL, 59 `ScaleZ` double default NULL,
53 `PCode` int(11) default NULL, 60 `PCode` int(11) default NULL,
54 `PathBegin` int(11) default NULL, 61 `PathBegin` int(11) default NULL,
55 `PathEnd` int(11) default NULL, 62 `PathEnd` int(11) default NULL,
@@ -77,3 +84,4 @@ CREATE TABLE `Prims` (
77 KEY `prims_parentuuid` (`ParentUUID`) 84 KEY `prims_parentuuid` (`ParentUUID`)
78) ENGINE=InnoDB DEFAULT CHARSET=utf8; 85) ENGINE=InnoDB DEFAULT CHARSET=utf8;
79 86
87
diff --git a/OpenSim/Data/NHibernate/Resources/MySQLDialect/001_UserStore.sql b/OpenSim/Data/NHibernate/Resources/MySQLDialect/001_UserStore.sql
index 5db5d29..a66f5b8 100644
--- a/OpenSim/Data/NHibernate/Resources/MySQLDialect/001_UserStore.sql
+++ b/OpenSim/Data/NHibernate/Resources/MySQLDialect/001_UserStore.sql
@@ -1,12 +1,12 @@
1START TRANSACTION; 1START TRANSACTION;
2 2
3CREATE TABLE `UserAgents` ( 3CREATE TABLE `UserAgents` (
4 `ProfileID` varchar(255) NOT NULL, 4 `ProfileID` varchar(36) NOT NULL,
5 `AgentIP` varchar(24) default NULL, 5 `AgentIP` varchar(24) default NULL,
6 `AgentPort` int(11) default NULL, 6 `AgentPort` int(11) default NULL,
7 `AgentOnline` tinyint(1) default NULL, 7 `AgentOnline` tinyint(1) default NULL,
8 `SessionID` varchar(255) default NULL, 8 `SessionID` varchar(36) default NULL,
9 `SecureSessionID` varchar(255) default NULL, 9 `SecureSessionID` varchar(36) default NULL,
10 `InitialRegion` varchar(255) default NULL, 10 `InitialRegion` varchar(255) default NULL,
11 `Region` varchar(255) default NULL, 11 `Region` varchar(255) default NULL,
12 `LoginTime` int(11) default NULL, 12 `LoginTime` int(11) default NULL,
@@ -15,16 +15,21 @@ CREATE TABLE `UserAgents` (
15 `PositionX` float default NULL, 15 `PositionX` float default NULL,
16 `PositionY` float default NULL, 16 `PositionY` float default NULL,
17 `PositionZ` float default NULL, 17 `PositionZ` float default NULL,
18 `LookAtX` float default NULL,
19 `LookAtY` float default NULL,
20 `LookAtZ` float default NULL,
18 PRIMARY KEY (`ProfileID`) 21 PRIMARY KEY (`ProfileID`)
19) ENGINE=InnoDB DEFAULT CHARSET=utf8; 22) ENGINE=InnoDB DEFAULT CHARSET=utf8;
20 23
21CREATE TABLE `UserProfiles` ( 24CREATE TABLE `UserProfiles` (
22 `ID` varchar(255) NOT NULL, 25 `ID` varchar(36) NOT NULL,
26 `WebLoginKey` varchar(36) default NULL,
23 `FirstName` varchar(32) default NULL, 27 `FirstName` varchar(32) default NULL,
24 `SurName` varchar(32) default NULL, 28 `SurName` varchar(32) default NULL,
29 `Email` varchar(250) default NULL,
25 `PasswordHash` varchar(32) default NULL, 30 `PasswordHash` varchar(32) default NULL,
26 `PasswordSalt` varchar(32) default NULL, 31 `PasswordSalt` varchar(32) default NULL,
27 `WebLoginKey` varchar(255) default NULL, 32 `HomeRegionID` varchar(36) default NULL,
28 `HomeRegionX` int(11) default NULL, 33 `HomeRegionX` int(11) default NULL,
29 `HomeRegionY` int(11) default NULL, 34 `HomeRegionY` int(11) default NULL,
30 `HomeLocationX` float default NULL, 35 `HomeLocationX` float default NULL,
@@ -35,50 +40,67 @@ CREATE TABLE `UserProfiles` (
35 `HomeLookAtZ` float default NULL, 40 `HomeLookAtZ` float default NULL,
36 `Created` int(11) default NULL, 41 `Created` int(11) default NULL,
37 `LastLogin` int(11) default NULL, 42 `LastLogin` int(11) default NULL,
38 `RootInventoryFolderID` varchar(255) default NULL,
39 `UserInventoryURI` varchar(255) default NULL, 43 `UserInventoryURI` varchar(255) default NULL,
40 `UserAssetURI` varchar(255) default NULL, 44 `UserAssetURI` varchar(255) default NULL,
41 `Image` varchar(255) default NULL, 45 `Image` varchar(36) default NULL,
42 `FirstLifeImage` varchar(255) default NULL, 46 `FirstLifeImage` varchar(36) default NULL,
43 `AboutText` varchar(255) default NULL, 47 `AboutText` text default NULL,
44 `FirstLifeAboutText` varchar(255) default NULL, 48 `FirstLifeAboutText` text default NULL,
49 `CanDoMask` int(11) default NULL,
50 `WantDoMask` int(11) default NULL,
51 `UserFlags` int(11) default NULL,
52 `GodLevel` int(11) default NULL,
53 `CustomType` varchar(32) default NULL,
54 `Partner` varchar(36) default NULL,
55 `RootInventoryFolderID` varchar(36) default NULL,
45 PRIMARY KEY (`ID`), 56 PRIMARY KEY (`ID`),
46 KEY `user_surname` (`SurName`), 57 INDEX `UserSurnameIndex` (`SurName`),
47 KEY `user_firstname` (`FirstName`) 58 INDEX `UserFirstNameIndex` (`FirstName`),
59 UNIQUE INDEX `UserFullNameIndex` (`SurName`,`FirstName`)
48) ENGINE=InnoDB DEFAULT CHARSET=utf8; 60) ENGINE=InnoDB DEFAULT CHARSET=utf8;
49 61
50CREATE TABLE `UserAppearances` ( 62CREATE TABLE `UserAppearances` (
51 `Owner` varchar(255) NOT NULL, 63 `Owner` varchar(36) NOT NULL,
52 `BodyItem` varchar(255) default NULL, 64 `BodyItem` varchar(36) default NULL,
53 `BodyAsset` varchar(255) default NULL, 65 `BodyAsset` varchar(36) default NULL,
54 `SkinItem` varchar(255) default NULL, 66 `SkinItem` varchar(36) default NULL,
55 `SkinAsset` varchar(255) default NULL, 67 `SkinAsset` varchar(36) default NULL,
56 `HairItem` varchar(255) default NULL, 68 `HairItem` varchar(36) default NULL,
57 `HairAsset` varchar(255) default NULL, 69 `HairAsset` varchar(36) default NULL,
58 `EyesItem` varchar(255) default NULL, 70 `EyesItem` varchar(36) default NULL,
59 `EyesAsset` varchar(255) default NULL, 71 `EyesAsset` varchar(36) default NULL,
60 `ShirtItem` varchar(255) default NULL, 72 `ShirtItem` varchar(36) default NULL,
61 `ShirtAsset` varchar(255) default NULL, 73 `ShirtAsset` varchar(36) default NULL,
62 `PantsItem` varchar(255) default NULL, 74 `PantsItem` varchar(36) default NULL,
63 `PantsAsset` varchar(255) default NULL, 75 `PantsAsset` varchar(36) default NULL,
64 `ShoesItem` varchar(255) default NULL, 76 `ShoesItem` varchar(36) default NULL,
65 `ShoesAsset` varchar(255) default NULL, 77 `ShoesAsset` varchar(36) default NULL,
66 `SocksItem` varchar(255) default NULL, 78 `SocksItem` varchar(36) default NULL,
67 `SocksAsset` varchar(255) default NULL, 79 `SocksAsset` varchar(36) default NULL,
68 `JacketItem` varchar(255) default NULL, 80 `JacketItem` varchar(36) default NULL,
69 `JacketAsset` varchar(255) default NULL, 81 `JacketAsset` varchar(36) default NULL,
70 `GlovesItem` varchar(255) default NULL, 82 `GlovesItem` varchar(36) default NULL,
71 `GlovesAsset` varchar(255) default NULL, 83 `GlovesAsset` varchar(36) default NULL,
72 `UnderShirtItem` varchar(255) default NULL, 84 `UnderShirtItem` varchar(36) default NULL,
73 `UnderShirtAsset` varchar(255) default NULL, 85 `UnderShirtAsset` varchar(36) default NULL,
74 `UnderPantsItem` varchar(255) default NULL, 86 `UnderPantsItem` varchar(36) default NULL,
75 `UnderPantsAsset` varchar(255) default NULL, 87 `UnderPantsAsset` varchar(36) default NULL,
76 `SkirtItem` varchar(255) default NULL, 88 `SkirtItem` varchar(36) default NULL,
77 `SkirtAsset` varchar(255) default NULL, 89 `SkirtAsset` varchar(36) default NULL,
78 `Texture` longblob, 90 `Texture` longblob,
79 `VisualParams` longblob, 91 `VisualParams` longblob,
80 `Serial` int(11) default NULL, 92 `Serial` int(11) default NULL,
93 `AvatarHeight` float default NULL,
81 PRIMARY KEY (`Owner`) 94 PRIMARY KEY (`Owner`)
82) ENGINE=InnoDB DEFAULT CHARSET=utf8; 95) ENGINE=InnoDB DEFAULT CHARSET=utf8;
83 96
84COMMIT; \ No newline at end of file 97CREATE TABLE `UserFriends` (
98 `UserFriendID` VARCHAR(36) NOT NULL,
99 `OwnerID` VARCHAR(36) NOT NULL,
100 `FriendID` VARCHAR(36) NOT NULL,
101 `FriendPermissions` INT(11) NOT NULL,
102 PRIMARY KEY (`UserFriendID`),
103 UNIQUE INDEX (`OwnerID`,`FriendID`)
104) ENGINE=InnoDB DEFAULT CHARSET=utf8;
105
106COMMIT;
diff --git a/OpenSim/Data/NHibernate/Resources/MySQLDialect/003_RegionStore.sql b/OpenSim/Data/NHibernate/Resources/MySQLDialect/003_RegionStore.sql
index 230e93c..e30287b 100644
--- a/OpenSim/Data/NHibernate/Resources/MySQLDialect/003_RegionStore.sql
+++ b/OpenSim/Data/NHibernate/Resources/MySQLDialect/003_RegionStore.sql
@@ -1,26 +1,78 @@
1BEGIN; 1BEGIN;
2 2
3CREATE TABLE `PrimItems` ( 3CREATE TABLE `PrimItems` (
4 `ItemID` char(36) NOT NULL default '',
5 `GroupID` char(36) default NULL,
6 `PrimID` char(36) default NULL,
7 `ParentFolderID` char(36) default NULL,
8 `AssetID` char(36) default NULL,
9 `OwnerID` char(36) default NULL,
10 `LastOwnerID` char(36) default NULL,
11 `CreatorID` char(36) default NULL,
12 `CreationDate` bigint(20) default NULL,
4 `InvType` int(11) default NULL, 13 `InvType` int(11) default NULL,
5 `Name` varchar(255) default NULL, 14 `Name` varchar(255) default NULL,
6 `Description` varchar(255) default NULL, 15 `Description` varchar(255) default NULL,
7 `CreationDate` bigint(20) default NULL,
8 `NextPermissions` int(11) default NULL, 16 `NextPermissions` int(11) default NULL,
9 `CurrentPermissions` int(11) default NULL, 17 `CurrentPermissions` int(11) default NULL,
10 `BasePermissions` int(11) default NULL, 18 `BasePermissions` int(11) default NULL,
11 `EveryonePermissions` int(11) default NULL, 19 `EveryonePermissions` int(11) default NULL,
12 `GroupPermissions` int(11) default NULL, 20 `GroupPermissions` int(11) default NULL,
13 `Flags` int(11) NOT NULL default '0', 21 `Flags` int(11) NOT NULL default '0',
14 `ItemID` char(36) NOT NULL default '',
15 `PrimID` char(36) default NULL,
16 `AssetID` char(36) default NULL,
17 `ParentFolderID` char(36) default NULL,
18 `CreatorID` char(36) default NULL,
19 `OwnerID` char(36) default NULL,
20 `GroupID` char(36) default NULL,
21 `LastOwnerID` char(36) default NULL,
22 PRIMARY KEY (`ItemID`), 22 PRIMARY KEY (`ItemID`),
23 KEY `primitems_primid` (`PrimID`) 23 KEY `primitems_primid` (`PrimID`)
24) ENGINE=InnoDB DEFAULT CHARSET=utf8; 24) ENGINE=InnoDB DEFAULT CHARSET=utf8;
25 25
26COMMIT; \ No newline at end of file 26CREATE TABLE RegionSettings (
27 `RegionID` char(36) default NULL,
28
29 `BlockTerraform` bit(1) default NULL,
30 `BlockFly` bit(1) default NULL,
31 `AllowDamage` bit(1) default NULL,
32 `RestrictPushing` bit(1) default NULL,
33 `AllowLandResell` bit(1) default NULL,
34 `AllowLandJoinDivide` bit(1) default NULL,
35 `BlockShowInSearch` bit(1) default NULL,
36
37 `AgentLimit` int(11) default NULL,
38 `ObjectBonus` double default NULL,
39 `Maturity` int(11) default NULL,
40
41 `DisableScripts` bit(1) default NULL,
42 `DisableCollisions` bit(1) default NULL,
43 `DisablePhysics` bit(1) default NULL,
44
45 `TerrainTexture1` char(36) default NULL,
46 `TerrainTexture2` char(36) default NULL,
47 `TerrainTexture3` char(36) default NULL,
48 `TerrainTexture4` char(36) default NULL,
49
50 `Elevation1NW` double default NULL,
51 `Elevation2NW` double default NULL,
52 `Elevation1NE` double default NULL,
53 `Elevation2NE` double default NULL,
54 `Elevation1SE` double default NULL,
55 `Elevation2SE` double default NULL,
56 `Elevation1SW` double default NULL,
57 `Elevation2SW` double default NULL,
58
59 `WaterHeight` double default NULL,
60 `TerrainRaiseLimit` double default NULL,
61 `TerrainLowerLimit` double default NULL,
62
63 `UseEstateSun` bit(1) default NULL,
64 `Sandbox` bit(1) default NULL,
65
66 `SunVectorX` double default NULL,
67 `SunVectorY` double default NULL,
68 `SunVectorZ` double default NULL,
69
70 `FixedSun` bit(1) default NULL,
71 `SunPosition` double default NULL,
72
73 `Covenant` char(36) default NULL,
74
75 PRIMARY KEY (RegionID)
76) ENGINE=InnoDB DEFAULT CHARSET=utf8;
77
78COMMIT;
diff --git a/OpenSim/Data/NHibernate/Resources/RegionSettings.hbm.xml b/OpenSim/Data/NHibernate/Resources/RegionSettings.hbm.xml
new file mode 100644
index 0000000..5cfccba
--- /dev/null
+++ b/OpenSim/Data/NHibernate/Resources/RegionSettings.hbm.xml
@@ -0,0 +1,56 @@
1<?xml version="1.0" encoding="utf-8" ?>
2<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
3 <class name="OpenSim.Framework.RegionSettings, OpenSim.Framework" table="RegionSettings" lazy="false">
4 <id name="RegionUUID" column="RegionId" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate">
5 <generator class="assigned" />
6 </id>
7
8 <property name="BlockTerraform" type="System.Boolean" />
9 <property name="BlockFly" type="System.Boolean" />
10 <property name="AllowDamage" type="System.Boolean" />
11 <property name="RestrictPushing" type="System.Boolean" />
12 <property name="AllowLandResell" type="System.Boolean" />
13 <property name="AllowLandJoinDivide" type="System.Boolean" />
14 <property name="BlockShowInSearch" type="System.Boolean" />
15
16 <property name="AgentLimit" type="System.Int32" />
17 <property name="ObjectBonus" type="System.Double" />
18 <property name="Maturity" type="System.Int32" />
19
20 <property name="DisableScripts" type="System.Boolean" />
21 <property name="DisableCollisions" type="System.Boolean" />
22 <property name="DisablePhysics" type="System.Boolean" />
23
24 <property name="TerrainTexture1" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate" />
25 <property name="TerrainTexture2" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate" />
26 <property name="TerrainTexture3" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate" />
27 <property name="TerrainTexture4" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate" />
28
29 <property name="Elevation1NW" type="System.Double" />
30 <property name="Elevation2NW" type="System.Double" />
31 <property name="Elevation1NE" type="System.Double" />
32 <property name="Elevation2NE" type="System.Double" />
33 <property name="Elevation1SE" type="System.Double" />
34 <property name="Elevation2SE" type="System.Double" />
35 <property name="Elevation1SW" type="System.Double" />
36 <property name="Elevation2SW" type="System.Double" />
37
38 <property name="WaterHeight" type="System.Double" />
39 <property name="TerrainRaiseLimit" type="System.Double" />
40 <property name="TerrainLowerLimit" type="System.Double" />
41
42 <property name="UseEstateSun" type="System.Boolean" />
43 <property name="Sandbox" type="System.Boolean" />
44
45 <property name="SunVector" type="OpenSim.Data.NHibernate.Vector3UserType, OpenSim.Data.NHibernate" >
46 <column name="SunVectorX" />
47 <column name="SunVectorY" />
48 <column name="SunVectorZ" />
49 </property>
50
51 <property name="FixedSun" type="System.Boolean" />
52 <property name="SunPosition" type="System.Double" />
53 <property name="Covenant" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate" />
54
55 </class>
56</hibernate-mapping>
diff --git a/OpenSim/Data/NHibernate/Resources/RegionStore.hbm.xml b/OpenSim/Data/NHibernate/Resources/RegionStore.hbm.xml
index 1851904..3144b0b 100644
--- a/OpenSim/Data/NHibernate/Resources/RegionStore.hbm.xml
+++ b/OpenSim/Data/NHibernate/Resources/RegionStore.hbm.xml
@@ -13,12 +13,14 @@
13 <property name="Description" type="String" length="255" /> 13 <property name="Description" type="String" length="255" />
14 <property name="SitName" type="String" length="255" /> 14 <property name="SitName" type="String" length="255" />
15 <property name="TouchName" type="String" length="255" /> 15 <property name="TouchName" type="String" length="255" />
16 16 <property name="Color" type="OpenSim.Data.NHibernate.ColorUserType, OpenSim.Data.NHibernate" />
17
17 <property name="ObjectFlags" type="OpenSim.Data.NHibernate.UInt32Type, OpenSim.Data.NHibernate" /> 18 <property name="ObjectFlags" type="OpenSim.Data.NHibernate.UInt32Type, OpenSim.Data.NHibernate" />
18 <property name="CreatorID" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate" /> 19 <property name="CreatorID" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate" />
19 <property name="OwnerID" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate" /> 20 <property name="OwnerID" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate" />
20 <property name="GroupID" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate" /> 21 <property name="GroupID" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate" />
21 <property name="LastOwnerID" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate" /> 22 <property name="LastOwnerID" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate" />
23 <property name="LinkNum" type="System.Int32" />
22 24
23 <property name="OwnerMask" type="OpenSim.Data.NHibernate.UInt32Type, OpenSim.Data.NHibernate" /> 25 <property name="OwnerMask" type="OpenSim.Data.NHibernate.UInt32Type, OpenSim.Data.NHibernate" />
24 <property name="NextOwnerMask" type="OpenSim.Data.NHibernate.UInt32Type, OpenSim.Data.NHibernate" /> 26 <property name="NextOwnerMask" type="OpenSim.Data.NHibernate.UInt32Type, OpenSim.Data.NHibernate" />
@@ -26,6 +28,12 @@
26 <property name="EveryoneMask" type="OpenSim.Data.NHibernate.UInt32Type, OpenSim.Data.NHibernate" /> 28 <property name="EveryoneMask" type="OpenSim.Data.NHibernate.UInt32Type, OpenSim.Data.NHibernate" />
27 <property name="BaseMask" type="OpenSim.Data.NHibernate.UInt32Type, OpenSim.Data.NHibernate" /> 29 <property name="BaseMask" type="OpenSim.Data.NHibernate.UInt32Type, OpenSim.Data.NHibernate" />
28 30
31 <property name="Material" type="Byte" />
32 <property name="ScriptAccessPin" type="System.Int32" />
33 <property name="TextureAnimation" type="binary" />
34 <property name="ParticleSystem" type="binary" />
35 <property name="ClickAction" type="Byte" />
36
29 <property name="OffsetPosition" type="OpenSim.Data.NHibernate.Vector3UserType, OpenSim.Data.NHibernate" > 37 <property name="OffsetPosition" type="OpenSim.Data.NHibernate.Vector3UserType, OpenSim.Data.NHibernate" >
30 <column name="PositionX" /> 38 <column name="PositionX" />
31 <column name="PositionY" /> 39 <column name="PositionY" />
diff --git a/OpenSim/Data/NHibernate/Resources/SQLiteDialect/001_RegionStore.sql b/OpenSim/Data/NHibernate/Resources/SQLiteDialect/001_RegionStore.sql
index d557b9a..eaa0964 100644
--- a/OpenSim/Data/NHibernate/Resources/SQLiteDialect/001_RegionStore.sql
+++ b/OpenSim/Data/NHibernate/Resources/SQLiteDialect/001_RegionStore.sql
@@ -2,25 +2,32 @@ BEGIN TRANSACTION;
2 2
3create table Prims ( 3create table Prims (
4 UUID TEXT not null, 4 UUID TEXT not null,
5 RegionID TEXT,
6 GroupID TEXT,
5 ParentID INTEGER, 7 ParentID INTEGER,
6 ParentUUID TEXT, 8 ParentUUID TEXT,
7 RegionID TEXT, 9 OwnerID TEXT,
10 LastOwnerID TEXT,
11 CreatorID TEXT,
8 CreationDate INTEGER, 12 CreationDate INTEGER,
13 LinkNum INTEGER,
9 Name TEXT, 14 Name TEXT,
10 Text TEXT, 15 Text TEXT,
11 Description TEXT, 16 Description TEXT,
12 SitName TEXT, 17 SitName TEXT,
13 TouchName TEXT, 18 TouchName TEXT,
14 ObjectFlags INTEGER, 19 ObjectFlags INTEGER,
15 CreatorID TEXT,
16 OwnerID TEXT,
17 GroupID TEXT,
18 LastOwnerID TEXT,
19 OwnerMask INTEGER, 20 OwnerMask INTEGER,
20 NextOwnerMask INTEGER, 21 NextOwnerMask INTEGER,
21 GroupMask INTEGER, 22 GroupMask INTEGER,
22 EveryoneMask INTEGER, 23 EveryoneMask INTEGER,
23 BaseMask INTEGER, 24 BaseMask INTEGER,
25 Material INTEGER,
26 ScriptAccessPin INTEGER,
27 TextureAnimation BLOB,
28 ParticleSystem BLOB,
29 ClickAction INTEGER,
30 Color INTEGER,
24 PositionX NUMERIC, 31 PositionX NUMERIC,
25 PositionY NUMERIC, 32 PositionY NUMERIC,
26 PositionZ NUMERIC, 33 PositionZ NUMERIC,
@@ -99,4 +106,45 @@ create table PrimItems (
99 primary key (ItemID) 106 primary key (ItemID)
100); 107);
101 108
102COMMIT; \ No newline at end of file 109CREATE TABLE RegionSettings (
110 RegionID TEXT not null,
111 BlockTerraform BIT,
112 BlockFly BIT,
113 AllowDamage BIT,
114 RestrictPushing BIT,
115 AllowLandResell BIT,
116 AllowLandJoinDivide BIT,
117 BlockShowInSearch BIT,
118 AgentLimit INTEGER,
119 ObjectBonus NUMERIC,
120 Maturity INTEGER,
121 DisableScripts BIT,
122 DisableCollisions BIT,
123 DisablePhysics BIT,
124 TerrainTexture1 TEXT,
125 TerrainTexture2 TEXT,
126 TerrainTexture3 TEXT,
127 TerrainTexture4 TEXT,
128 Elevation1NW NUMERIC,
129 Elevation2NW NUMERIC,
130 Elevation1NE NUMERIC,
131 Elevation2NE NUMERIC,
132 Elevation1SE NUMERIC,
133 Elevation2SE NUMERIC,
134 Elevation1SW NUMERIC,
135 Elevation2SW NUMERIC,
136 WaterHeight NUMERIC,
137 TerrainRaiseLimit NUMERIC,
138 TerrainLowerLimit NUMERIC,
139 UseEstateSun BIT,
140 Sandbox BIT,
141 SunVectorX NUMERIC,
142 SunVectorY NUMERIC,
143 SunVectorZ NUMERIC,
144 FixedSun BIT,
145 SunPosition NUMERIC,
146 Covenant TEXT,
147 primary key (RegionID)
148);
149
150COMMIT;
diff --git a/OpenSim/Data/NHibernate/Resources/SQLiteDialect/001_UserStore.sql b/OpenSim/Data/NHibernate/Resources/SQLiteDialect/001_UserStore.sql
index 8d1ba5c..c5e42d5 100644
--- a/OpenSim/Data/NHibernate/Resources/SQLiteDialect/001_UserStore.sql
+++ b/OpenSim/Data/NHibernate/Resources/SQLiteDialect/001_UserStore.sql
@@ -12,15 +12,24 @@ create table UserAgents (
12 LoginTime INTEGER, 12 LoginTime INTEGER,
13 LogoutTime INTEGER, 13 LogoutTime INTEGER,
14 Handle INTEGER, 14 Handle INTEGER,
15 PositionX NUMERIC,
16 PositionY NUMERIC,
17 PositionZ NUMERIC,
18 LookAtX NUMERIC,
19 LookAtY NUMERIC,
20 LookAtZ NUMERIC,
15 primary key (ProfileID) 21 primary key (ProfileID)
16); 22);
23
17create table UserProfiles ( 24create table UserProfiles (
18 ID TEXT not null, 25 ID TEXT not null,
26 WebLoginKey TEXT,
19 FirstName TEXT, 27 FirstName TEXT,
20 SurName TEXT, 28 SurName TEXT,
29 Email TEXT,
21 PasswordHash TEXT, 30 PasswordHash TEXT,
22 PasswordSalt TEXT, 31 PasswordSalt TEXT,
23 WebLoginKey TEXT, 32 HomeRegionID TEXT,
24 HomeRegionX INTEGER, 33 HomeRegionX INTEGER,
25 HomeRegionY INTEGER, 34 HomeRegionY INTEGER,
26 HomeLocationX NUMERIC, 35 HomeLocationX NUMERIC,
@@ -31,15 +40,22 @@ create table UserProfiles (
31 HomeLookAtZ NUMERIC, 40 HomeLookAtZ NUMERIC,
32 Created INTEGER, 41 Created INTEGER,
33 LastLogin INTEGER, 42 LastLogin INTEGER,
34 RootInventoryFolderID TEXT,
35 UserInventoryURI TEXT, 43 UserInventoryURI TEXT,
36 UserAssetURI TEXT, 44 UserAssetURI TEXT,
37 Image TEXT, 45 Image TEXT,
38 FirstLifeImage TEXT, 46 FirstLifeImage TEXT,
39 AboutText TEXT, 47 AboutText TEXT,
40 FirstLifeAboutText TEXT, 48 FirstLifeAboutText TEXT,
49 RootInventoryFolderID TEXT,
50 `CanDoMask` INTEGER,
51 `WantDoMask` INTEGER,
52 `UserFlags` INTEGER,
53 `GodLevel` INTEGER,
54 `CustomType` TEXT,
55 `Partner` TEXT,
41 primary key (ID) 56 primary key (ID)
42); 57);
58
43create table UserAppearances ( 59create table UserAppearances (
44 Owner TEXT not null, 60 Owner TEXT not null,
45 BodyItem TEXT, 61 BodyItem TEXT,
@@ -71,9 +87,22 @@ create table UserAppearances (
71 Texture BLOB, 87 Texture BLOB,
72 VisualParams BLOB, 88 VisualParams BLOB,
73 Serial INTEGER, 89 Serial INTEGER,
90 AvatarHeight NUMERIC,
74 primary key (Owner) 91 primary key (Owner)
75); 92);
76create index user_firstname on UserProfiles (FirstName);
77create index user_surname on UserProfiles (SurName);
78 93
79COMMIT; \ No newline at end of file 94
95CREATE TABLE UserFriends (
96 UserFriendID TEXT,
97 OwnerID TEXT,
98 FriendID TEXT,
99 FriendPermissions INTEGER,
100 primary key (UserFriendID)
101);
102
103create index UserFirstNameIndex on UserProfiles (FirstName);
104create index UserSurnameIndex on UserProfiles (SurName);
105create unique index UserFullNameIndex on UserProfiles (FirstName,SurName);
106create unique index UserFriendsOwnerFriendIndex on UserFriends (OwnerID,FriendID);
107
108COMMIT;
diff --git a/OpenSim/Data/NHibernate/Resources/UserAgentData.hbm.xml b/OpenSim/Data/NHibernate/Resources/UserAgentData.hbm.xml
index e10fb8f..70b6998 100644
--- a/OpenSim/Data/NHibernate/Resources/UserAgentData.hbm.xml
+++ b/OpenSim/Data/NHibernate/Resources/UserAgentData.hbm.xml
@@ -4,6 +4,7 @@
4 <id name="ProfileID" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate"> 4 <id name="ProfileID" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate">
5 <generator class="assigned" /> 5 <generator class="assigned" />
6 </id> 6 </id>
7
7 <property name="AgentIP" type="String" length="24" /> 8 <property name="AgentIP" type="String" length="24" />
8 <property name="AgentPort" type="OpenSim.Data.NHibernate.UInt32Type, OpenSim.Data.NHibernate" /> 9 <property name="AgentPort" type="OpenSim.Data.NHibernate.UInt32Type, OpenSim.Data.NHibernate" />
9 <property name="AgentOnline" type="boolean" /> 10 <property name="AgentOnline" type="boolean" />
@@ -14,8 +15,18 @@
14 <property name="LoginTime" type="Int32" /> 15 <property name="LoginTime" type="Int32" />
15 <property name="LogoutTime" type="Int32" /> 16 <property name="LogoutTime" type="Int32" />
16 <property name="Handle" type="OpenSim.Data.NHibernate.UInt64Type, OpenSim.Data.NHibernate" /> 17 <property name="Handle" type="OpenSim.Data.NHibernate.UInt64Type, OpenSim.Data.NHibernate" />
17 <!-- <property name="PositionX" type="Single" /> 18
18 <property name="PositionY" type="Single" /> 19 <property name="Position" type="OpenSim.Data.NHibernate.Vector3UserType, OpenSim.Data.NHibernate" >
19 <property name="PositionZ" type="Single" /> --> 20 <column name="PositionX" />
21 <column name="PositionY" />
22 <column name="PositionZ" />
23 </property>
24
25 <property name="LookAt" type="OpenSim.Data.NHibernate.Vector3UserType, OpenSim.Data.NHibernate" >
26 <column name="LookAtX" />
27 <column name="LookAtY" />
28 <column name="LookAtZ" />
29 </property>
30
20 </class> 31 </class>
21</hibernate-mapping> 32</hibernate-mapping>
diff --git a/OpenSim/Data/NHibernate/Resources/UserAppearance.hbm.xml b/OpenSim/Data/NHibernate/Resources/UserAppearance.hbm.xml
index b633c34..21e547f 100644
--- a/OpenSim/Data/NHibernate/Resources/UserAppearance.hbm.xml
+++ b/OpenSim/Data/NHibernate/Resources/UserAppearance.hbm.xml
@@ -33,5 +33,6 @@
33 <property name="Texture" type="OpenSim.Data.NHibernate.TextureUserType, OpenSim.Data.NHibernate" /> 33 <property name="Texture" type="OpenSim.Data.NHibernate.TextureUserType, OpenSim.Data.NHibernate" />
34 <property name="VisualParams" type="binary" /> 34 <property name="VisualParams" type="binary" />
35 <property name="Serial" type="Int32" /> 35 <property name="Serial" type="Int32" />
36 <property name="AvatarHeight" type="Single" />
36 </class> 37 </class>
37</hibernate-mapping> 38</hibernate-mapping>
diff --git a/OpenSim/Data/NHibernate/Resources/UserFriend.hbm.xml b/OpenSim/Data/NHibernate/Resources/UserFriend.hbm.xml
new file mode 100644
index 0000000..70961b0
--- /dev/null
+++ b/OpenSim/Data/NHibernate/Resources/UserFriend.hbm.xml
@@ -0,0 +1,11 @@
1<?xml version="1.0" encoding="utf-8" ?>
2<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
3 <class name="OpenSim.Data.NHibernate.UserFriend, OpenSim.Data.NHibernate" table="UserFriends" lazy="false">
4 <id name="UserFriendID" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate">
5 <generator class="assigned" />
6 </id>
7 <property name="OwnerID" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate" />
8 <property name="FriendID" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate" />
9 <property name="FriendPermissions" type="OpenSim.Data.NHibernate.UInt32Type, OpenSim.Data.NHibernate" />
10 </class>
11</hibernate-mapping>
diff --git a/OpenSim/Data/NHibernate/Resources/UserProfileData.hbm.xml b/OpenSim/Data/NHibernate/Resources/UserProfileData.hbm.xml
index 740a9f1..5b1f9b0 100644
--- a/OpenSim/Data/NHibernate/Resources/UserProfileData.hbm.xml
+++ b/OpenSim/Data/NHibernate/Resources/UserProfileData.hbm.xml
@@ -4,11 +4,13 @@
4 <id name="ID" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate"> 4 <id name="ID" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate">
5 <generator class="assigned" /> 5 <generator class="assigned" />
6 </id> 6 </id>
7 <property name="FirstName" index="user_firstname" type="String" length="32" /> 7 <property name="WebLoginKey" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate" />
8 <property name="SurName" index="user_surname" type="String" length="32" /> 8 <property name="FirstName" index="UserFirstNameIndex" type="String" length="32" />
9 <property name="SurName" index="UserSurnameIndex" type="String" length="32" />
10 <property name="Email" type="String" length="250" />
9 <property name="PasswordHash" type="String" length="32" /> 11 <property name="PasswordHash" type="String" length="32" />
10 <property name="PasswordSalt" type="String" length="32" /> 12 <property name="PasswordSalt" type="String" length="32" />
11 <property name="WebLoginKey" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate" /> 13 <property name="HomeRegionID" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate" />
12 <property name="HomeRegionX" type="OpenSim.Data.NHibernate.UInt32Type, OpenSim.Data.NHibernate" /> 14 <property name="HomeRegionX" type="OpenSim.Data.NHibernate.UInt32Type, OpenSim.Data.NHibernate" />
13 <property name="HomeRegionY" type="OpenSim.Data.NHibernate.UInt32Type, OpenSim.Data.NHibernate" /> 15 <property name="HomeRegionY" type="OpenSim.Data.NHibernate.UInt32Type, OpenSim.Data.NHibernate" />
14 <property name="HomeLocationX" type="Single" /> 16 <property name="HomeLocationX" type="Single" />
@@ -19,12 +21,18 @@
19 <property name="HomeLookAtZ" type="Single" /> 21 <property name="HomeLookAtZ" type="Single" />
20 <property name="Created" type="Int32" /> 22 <property name="Created" type="Int32" />
21 <property name="LastLogin" type="Int32" /> 23 <property name="LastLogin" type="Int32" />
22 <property name="RootInventoryFolderID" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate" />
23 <property name="UserInventoryURI" type="String" length="255"/> 24 <property name="UserInventoryURI" type="String" length="255"/>
24 <property name="UserAssetURI" type="String" length="255"/> 25 <property name="UserAssetURI" type="String" length="255"/>
25 <property name="Image" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate" /> 26 <property name="Image" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate" />
26 <property name="FirstLifeImage" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate" /> 27 <property name="FirstLifeImage" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate" />
27 <property name="AboutText" type="String" length="255" /> 28 <property name="AboutText" type="String" length="255" />
28 <property name="FirstLifeAboutText" type="String" length="255" /> 29 <property name="FirstLifeAboutText" type="String" length="255" />
30 <property name="CanDoMask" type="OpenSim.Data.NHibernate.UInt32Type, OpenSim.Data.NHibernate" />
31 <property name="WantDoMask" type="OpenSim.Data.NHibernate.UInt32Type, OpenSim.Data.NHibernate" />
32 <property name="UserFlags" type="Int32" />
33 <property name="GodLevel" type="Int32" />
34 <property name="CustomType" type="String" length="32" />
35 <property name="Partner" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate" />
36 <property name="RootInventoryFolderID" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate" />
29 </class> 37 </class>
30</hibernate-mapping> 38</hibernate-mapping>
diff --git a/OpenSim/Data/NHibernate/UserFriend.cs b/OpenSim/Data/NHibernate/UserFriend.cs
new file mode 100644
index 0000000..c16b3c8
--- /dev/null
+++ b/OpenSim/Data/NHibernate/UserFriend.cs
@@ -0,0 +1,28 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using OpenMetaverse;
5
6namespace OpenSim.Data.NHibernate
7{
8 public class UserFriend
9 {
10 public UserFriend()
11 {
12 }
13
14 public UserFriend(UUID userFriendID, UUID ownerID, UUID friendID, uint friendPermissions)
15 {
16 this.UserFriendID = userFriendID;
17 this.OwnerID = ownerID;
18 this.FriendID = friendID;
19 this.FriendPermissions = friendPermissions;
20 }
21
22 public UUID UserFriendID { get; set; }
23 public UUID OwnerID { get; set; }
24 public UUID FriendID { get; set; }
25 public uint FriendPermissions { get; set; }
26
27 }
28}
diff --git a/OpenSim/Data/Tests/BasicRegionTest.cs b/OpenSim/Data/Tests/BasicRegionTest.cs
index e5c6132..a0591fa 100644
--- a/OpenSim/Data/Tests/BasicRegionTest.cs
+++ b/OpenSim/Data/Tests/BasicRegionTest.cs
@@ -130,8 +130,8 @@ namespace OpenSim.Data.Tests
130 [Test] 130 [Test]
131 public void T010_StoreSimpleObject() 131 public void T010_StoreSimpleObject()
132 { 132 {
133 SceneObjectGroup sog = NewSOG("object1", prim1); 133 SceneObjectGroup sog = NewSOG("object1", prim1, region1);
134 SceneObjectGroup sog2 = NewSOG("object2", prim2); 134 SceneObjectGroup sog2 = NewSOG("object2", prim2, region1);
135 135
136 // in case the objects don't store 136 // in case the objects don't store
137 try 137 try
@@ -183,7 +183,7 @@ namespace OpenSim.Data.Tests
183 SceneObjectPart p1 = NewSOP("SoP 1",tmp1); 183 SceneObjectPart p1 = NewSOP("SoP 1",tmp1);
184 SceneObjectPart p2 = NewSOP("SoP 2",tmp2); 184 SceneObjectPart p2 = NewSOP("SoP 2",tmp2);
185 SceneObjectPart p3 = NewSOP("SoP 3",tmp3); 185 SceneObjectPart p3 = NewSOP("SoP 3",tmp3);
186 SceneObjectGroup sog = NewSOG("Sop 0",tmp0); 186 SceneObjectGroup sog = NewSOG("Sop 0", tmp0, newregion);
187 sog.AddPart(p1); 187 sog.AddPart(p1);
188 sog.AddPart(p2); 188 sog.AddPart(p2);
189 sog.AddPart(p3); 189 sog.AddPart(p3);
@@ -246,7 +246,14 @@ namespace OpenSim.Data.Tests
246 pbshap = PrimitiveBaseShape.Default; 246 pbshap = PrimitiveBaseShape.Default;
247 Vector3 scale = new Vector3(random.Next(),random.Next(),random.Next()); 247 Vector3 scale = new Vector3(random.Next(),random.Next(),random.Next());
248 byte updatef = (byte) random.Next(127); 248 byte updatef = (byte) random.Next(127);
249 249
250 RegionInfo regionInfo = new RegionInfo();
251 regionInfo.RegionID = region3;
252 regionInfo.RegionLocX = 0;
253 regionInfo.RegionLocY = 0;
254
255 Scene scene = new Scene(regionInfo);
256
250 SceneObjectPart sop = new SceneObjectPart(); 257 SceneObjectPart sop = new SceneObjectPart();
251 sop.RegionHandle = regionh; 258 sop.RegionHandle = regionh;
252 sop.UUID = uuid; 259 sop.UUID = uuid;
@@ -313,9 +320,10 @@ namespace OpenSim.Data.Tests
313 Assert.That(updatef,Is.EqualTo(sop.UpdateFlag)); 320 Assert.That(updatef,Is.EqualTo(sop.UpdateFlag));
314 321
315 // This is necessary or object will not be inserted in DB 322 // This is necessary or object will not be inserted in DB
316 sop.ObjectFlags = 0; 323 sop.ObjectFlags = 0;
317 324
318 SceneObjectGroup sog = new SceneObjectGroup(); 325 SceneObjectGroup sog = new SceneObjectGroup();
326 sog.SetScene(scene); // Reguired by nhibernate database module.
319 sog.SetRootPart(sop); 327 sog.SetRootPart(sop);
320 328
321 // Inserts group in DB 329 // Inserts group in DB
@@ -365,7 +373,6 @@ namespace OpenSim.Data.Tests
365 [Test] 373 [Test]
366 public void T014_UpdateObject() 374 public void T014_UpdateObject()
367 { 375 {
368
369 string text1 = "object1 text"; 376 string text1 = "object1 text";
370 SceneObjectGroup sog = FindSOG("object1", region1); 377 SceneObjectGroup sog = FindSOG("object1", region1);
371 sog.RootPart.Text = text1; 378 sog.RootPart.Text = text1;
@@ -373,8 +380,7 @@ namespace OpenSim.Data.Tests
373 380
374 sog = FindSOG("object1", region1); 381 sog = FindSOG("object1", region1);
375 Assert.That(text1, Is.EqualTo(sog.RootPart.Text)); 382 Assert.That(text1, Is.EqualTo(sog.RootPart.Text));
376 383
377
378 // Creates random values 384 // Creates random values
379 UUID creator = new UUID(); 385 UUID creator = new UUID();
380 creator = UUID.Random(); 386 creator = UUID.Random();
@@ -474,7 +480,7 @@ namespace OpenSim.Data.Tests
474 { 480 {
475 UUID id = UUID.Random(); 481 UUID id = UUID.Random();
476 Dictionary<UUID, SceneObjectPart> mydic = new Dictionary<UUID, SceneObjectPart>(); 482 Dictionary<UUID, SceneObjectPart> mydic = new Dictionary<UUID, SceneObjectPart>();
477 SceneObjectGroup sog = NewSOG("Test SOG",id); 483 SceneObjectGroup sog = NewSOG("Test SOG", id, region4);
478 mydic.Add(sog.RootPart.UUID,sog.RootPart); 484 mydic.Add(sog.RootPart.UUID,sog.RootPart);
479 for (int i=0;i<30;i++) 485 for (int i=0;i<30;i++)
480 { 486 {
@@ -888,9 +894,18 @@ namespace OpenSim.Data.Tests
888 { 894 {
889 SceneObjectPart p = sog.RootPart; 895 SceneObjectPart p = sog.RootPart;
890 if (p.Name == name) { 896 if (p.Name == name) {
897 RegionInfo regionInfo = new RegionInfo();
898 regionInfo.RegionID = r;
899 regionInfo.RegionLocX = 0;
900 regionInfo.RegionLocY = 0;
901
902 Scene scene = new Scene(regionInfo);
903 sog.SetScene(scene);
904
891 return sog; 905 return sog;
892 } 906 }
893 } 907 }
908
894 return null; 909 return null;
895 } 910 }
896 911
@@ -906,8 +921,15 @@ namespace OpenSim.Data.Tests
906 // causes the application to crash at the database layer because of null values 921 // causes the application to crash at the database layer because of null values
907 // in NOT NULL fields 922 // in NOT NULL fields
908 // 923 //
909 private SceneObjectGroup NewSOG(string name, UUID uuid) 924 private SceneObjectGroup NewSOG(string name, UUID uuid, UUID regionId)
910 { 925 {
926 RegionInfo regionInfo = new RegionInfo();
927 regionInfo.RegionID = regionId;
928 regionInfo.RegionLocX = 0;
929 regionInfo.RegionLocY = 0;
930
931 Scene scene = new Scene(regionInfo);
932
911 SceneObjectPart sop = new SceneObjectPart(); 933 SceneObjectPart sop = new SceneObjectPart();
912 sop.Name = name; 934 sop.Name = name;
913 sop.Description = name; 935 sop.Description = name;
@@ -916,9 +938,11 @@ namespace OpenSim.Data.Tests
916 sop.TouchName = RandomName(); 938 sop.TouchName = RandomName();
917 sop.UUID = uuid; 939 sop.UUID = uuid;
918 sop.Shape = PrimitiveBaseShape.Default; 940 sop.Shape = PrimitiveBaseShape.Default;
919 941
920 SceneObjectGroup sog = new SceneObjectGroup(); 942 SceneObjectGroup sog = new SceneObjectGroup();
943 sog.SetScene(scene);
921 sog.SetRootPart(sop); 944 sog.SetRootPart(sop);
945
922 return sog; 946 return sog;
923 } 947 }
924 948
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index 3b4b719..37ff645 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -404,6 +404,17 @@ namespace OpenSim.Region.Environment.Scenes
404 } 404 }
405 } 405 }
406 406
407 /// <summary>
408 /// Mock constructor for scene group persistency unit tests.
409 /// SceneObjectGroup RegionId property is delegated to Scene.
410 /// </summary>
411 /// <param name="regInfo"></param>
412 public Scene(RegionInfo regInfo)
413 {
414 m_regInfo = regInfo;
415 m_eventManager = new EventManager();
416 }
417
407 #endregion 418 #endregion
408 419
409 #region Startup / Close Methods 420 #region Startup / Close Methods
diff --git a/prebuild.xml b/prebuild.xml
index c4be734..64c9588 100644
--- a/prebuild.xml
+++ b/prebuild.xml
@@ -1588,6 +1588,7 @@
1588 <Reference name="System" localCopy="false"/> 1588 <Reference name="System" localCopy="false"/>
1589 <Reference name="System.Xml"/> 1589 <Reference name="System.Xml"/>
1590 <Reference name="System.Data"/> 1590 <Reference name="System.Data"/>
1591 <Reference name="System.Drawing"/>
1591 <Reference name="OpenSim.Data"/> 1592 <Reference name="OpenSim.Data"/>
1592 <Reference name="OpenSim.Framework"/> 1593 <Reference name="OpenSim.Framework"/>
1593 <Reference name="OpenSim.Framework.Console"/> 1594 <Reference name="OpenSim.Framework.Console"/>