diff options
author | lbsa71 | 2007-09-13 05:25:26 +0000 |
---|---|---|
committer | lbsa71 | 2007-09-13 05:25:26 +0000 |
commit | 615487a756c596de7e9d0c69e95e65a015e9e4b2 (patch) | |
tree | 1a7da13294f468ced7dfe860a8b77e56abdcccd5 /OpenSim | |
parent | GUI: Added placeholders + info on what to be done (diff) | |
download | opensim-SC-615487a756c596de7e9d0c69e95e65a015e9e4b2.zip opensim-SC-615487a756c596de7e9d0c69e95e65a015e9e4b2.tar.gz opensim-SC-615487a756c596de7e9d0c69e95e65a015e9e4b2.tar.bz2 opensim-SC-615487a756c596de7e9d0c69e95e65a015e9e4b2.tar.xz |
Backup is now optional on classes
* Removed unused BackUp method on EntityBase
* Added overridable InSceneBackup property on SceneObjectGroup
* Refactored out AttachToBackup and DetachFromBackup
* Normalized namespace OpenSim.DataStore.MonoSqliteStorage to OpenSim.DataStore.MonoSqlite
Diffstat (limited to 'OpenSim')
3 files changed, 81 insertions, 71 deletions
diff --git a/OpenSim/Region/Environment/Scenes/EntityBase.cs b/OpenSim/Region/Environment/Scenes/EntityBase.cs index a7b9d75..2caab9e 100644 --- a/OpenSim/Region/Environment/Scenes/EntityBase.cs +++ b/OpenSim/Region/Environment/Scenes/EntityBase.cs | |||
@@ -109,13 +109,6 @@ namespace OpenSim.Region.Environment.Scenes | |||
109 | } | 109 | } |
110 | 110 | ||
111 | /// <summary> | 111 | /// <summary> |
112 | /// Called at a set interval to inform entities that they should back themsleves up to the DB | ||
113 | /// </summary> | ||
114 | public virtual void BackUp() | ||
115 | { | ||
116 | } | ||
117 | |||
118 | /// <summary> | ||
119 | /// Copies the entity | 112 | /// Copies the entity |
120 | /// </summary> | 113 | /// </summary> |
121 | /// <returns></returns> | 114 | /// <returns></returns> |
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs index eff622a..99f1900 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs | |||
@@ -149,6 +149,15 @@ namespace OpenSim.Region.Environment.Scenes | |||
149 | /// saying what prim(s) that user has selected. | 149 | /// saying what prim(s) that user has selected. |
150 | /// </summary> | 150 | /// </summary> |
151 | protected bool m_isSelected = false; | 151 | protected bool m_isSelected = false; |
152 | |||
153 | protected virtual bool InSceneBackup | ||
154 | { | ||
155 | get | ||
156 | { | ||
157 | return true; | ||
158 | } | ||
159 | } | ||
160 | |||
152 | public bool IsSelected | 161 | public bool IsSelected |
153 | { | 162 | { |
154 | get { return m_isSelected; } | 163 | get { return m_isSelected; } |
@@ -218,10 +227,20 @@ namespace OpenSim.Region.Environment.Scenes | |||
218 | this.m_rootPart.ParentID = 0; | 227 | this.m_rootPart.ParentID = 0; |
219 | this.m_rootPart.RegionHandle = m_regionHandle; | 228 | this.m_rootPart.RegionHandle = m_regionHandle; |
220 | this.UpdateParentIDs(); | 229 | this.UpdateParentIDs(); |
221 | m_scene.EventManager.OnBackup += this.ProcessBackup; | 230 | |
231 | AttachToBackup(); | ||
232 | |||
222 | this.ScheduleGroupForFullUpdate(); | 233 | this.ScheduleGroupForFullUpdate(); |
223 | } | 234 | } |
224 | 235 | ||
236 | private void AttachToBackup() | ||
237 | { | ||
238 | if (InSceneBackup) | ||
239 | { | ||
240 | m_scene.EventManager.OnBackup += this.ProcessBackup; | ||
241 | } | ||
242 | } | ||
243 | |||
225 | /// <summary> | 244 | /// <summary> |
226 | /// | 245 | /// |
227 | /// </summary> | 246 | /// </summary> |
@@ -243,7 +262,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
243 | SceneObjectPart newPart = new SceneObjectPart(m_regionHandle, this, ownerID, localID, shape, pos, rootOffset); | 262 | SceneObjectPart newPart = new SceneObjectPart(m_regionHandle, this, ownerID, localID, shape, pos, rootOffset); |
244 | this.m_parts.Add(newPart.UUID, newPart); | 263 | this.m_parts.Add(newPart.UUID, newPart); |
245 | this.SetPartAsRoot(newPart); | 264 | this.SetPartAsRoot(newPart); |
246 | m_scene.EventManager.OnBackup += this.ProcessBackup; | 265 | |
266 | AttachToBackup(); | ||
247 | } | 267 | } |
248 | #endregion | 268 | #endregion |
249 | 269 | ||
@@ -307,7 +327,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
307 | } | 327 | } |
308 | dupe.UpdateParentIDs(); | 328 | dupe.UpdateParentIDs(); |
309 | 329 | ||
310 | m_scene.EventManager.OnBackup += dupe.ProcessBackup; | 330 | dupe.AttachToBackup(); |
331 | |||
311 | return dupe; | 332 | return dupe; |
312 | } | 333 | } |
313 | 334 | ||
@@ -523,13 +544,19 @@ namespace OpenSim.Region.Environment.Scenes | |||
523 | } | 544 | } |
524 | } | 545 | } |
525 | 546 | ||
526 | m_scene.EventManager.OnBackup -= objectGroup.ProcessBackup; | 547 | DetachFromBackup(objectGroup); |
548 | |||
527 | m_scene.DeleteEntity(objectGroup.UUID); | 549 | m_scene.DeleteEntity(objectGroup.UUID); |
528 | 550 | ||
529 | objectGroup.DeleteParts(); | 551 | objectGroup.DeleteParts(); |
530 | this.ScheduleGroupForFullUpdate(); | 552 | this.ScheduleGroupForFullUpdate(); |
531 | } | 553 | } |
532 | 554 | ||
555 | private void DetachFromBackup(SceneObjectGroup objectGroup) | ||
556 | { | ||
557 | m_scene.EventManager.OnBackup -= objectGroup.ProcessBackup; | ||
558 | } | ||
559 | |||
533 | 560 | ||
534 | private void LinkNonRootPart(SceneObjectPart part, Vector3 oldGroupPosition, Quaternion oldGroupRotation) | 561 | private void LinkNonRootPart(SceneObjectPart part, Vector3 oldGroupPosition, Quaternion oldGroupRotation) |
535 | { | 562 | { |
@@ -583,7 +610,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
583 | proper.ObjectData[0].FolderID = LLUUID.Zero; | 610 | proper.ObjectData[0].FolderID = LLUUID.Zero; |
584 | proper.ObjectData[0].FromTaskID = LLUUID.Zero; | 611 | proper.ObjectData[0].FromTaskID = LLUUID.Zero; |
585 | proper.ObjectData[0].GroupID = LLUUID.Zero; | 612 | proper.ObjectData[0].GroupID = LLUUID.Zero; |
586 | proper.ObjectData[0].InventorySerial = (short) this.m_rootPart.InventorySerial; | 613 | proper.ObjectData[0].InventorySerial = (short)this.m_rootPart.InventorySerial; |
587 | proper.ObjectData[0].LastOwnerID = this.m_rootPart.LastOwnerID; | 614 | proper.ObjectData[0].LastOwnerID = this.m_rootPart.LastOwnerID; |
588 | proper.ObjectData[0].ObjectID = this.UUID; | 615 | proper.ObjectData[0].ObjectID = this.UUID; |
589 | proper.ObjectData[0].OwnerID = this.m_rootPart.OwnerID; | 616 | proper.ObjectData[0].OwnerID = this.m_rootPart.OwnerID; |
@@ -672,7 +699,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
672 | SceneObjectPart part = this.GetChildPart(localID); | 699 | SceneObjectPart part = this.GetChildPart(localID); |
673 | if (part != null) | 700 | if (part != null) |
674 | { | 701 | { |
675 | return part.GetInventoryFileName(remoteClient, localID); | 702 | return part.GetInventoryFileName(remoteClient, localID); |
676 | } | 703 | } |
677 | return false; | 704 | return false; |
678 | } | 705 | } |
@@ -682,7 +709,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
682 | SceneObjectPart part = this.GetChildPart(localID); | 709 | SceneObjectPart part = this.GetChildPart(localID); |
683 | if (part != null) | 710 | if (part != null) |
684 | { | 711 | { |
685 | part.RequestInventoryFile(xferManager); | 712 | part.RequestInventoryFile(xferManager); |
686 | } | 713 | } |
687 | return ""; | 714 | return ""; |
688 | } | 715 | } |
@@ -705,7 +732,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
705 | return true; | 732 | return true; |
706 | } | 733 | } |
707 | return false; | 734 | return false; |
708 | 735 | ||
709 | } | 736 | } |
710 | 737 | ||
711 | public bool AddInventoryItem(IClientAPI remoteClient, uint localID, InventoryItemBase item, LLUUID copyItemID) | 738 | public bool AddInventoryItem(IClientAPI remoteClient, uint localID, InventoryItemBase item, LLUUID copyItemID) |
@@ -730,19 +757,19 @@ namespace OpenSim.Region.Environment.Scenes | |||
730 | } | 757 | } |
731 | else | 758 | else |
732 | { | 759 | { |
733 | return AddInventoryItem(remoteClient, localID, item); | 760 | return AddInventoryItem(remoteClient, localID, item); |
734 | } | 761 | } |
735 | return false; | 762 | return false; |
736 | } | 763 | } |
737 | 764 | ||
738 | public int RemoveInventoryItem(IClientAPI remoteClient, uint localID, LLUUID itemID) | 765 | public int RemoveInventoryItem(IClientAPI remoteClient, uint localID, LLUUID itemID) |
739 | { | 766 | { |
740 | SceneObjectPart part = this.GetChildPart(localID); | 767 | SceneObjectPart part = this.GetChildPart(localID); |
741 | if (part != null) | 768 | if (part != null) |
742 | { | 769 | { |
743 | return part.RemoveInventoryItem(remoteClient, localID, itemID); | 770 | return part.RemoveInventoryItem(remoteClient, localID, itemID); |
744 | } | 771 | } |
745 | return -1; | 772 | return -1; |
746 | } | 773 | } |
747 | 774 | ||
748 | /// <summary> | 775 | /// <summary> |
@@ -1077,7 +1104,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1077 | public void SetScene(Scene scene) | 1104 | public void SetScene(Scene scene) |
1078 | { | 1105 | { |
1079 | m_scene = scene; | 1106 | m_scene = scene; |
1080 | m_scene.EventManager.OnBackup += this.ProcessBackup; | 1107 | AttachToBackup(); |
1081 | } | 1108 | } |
1082 | 1109 | ||
1083 | /// <summary> | 1110 | /// <summary> |
@@ -1153,7 +1180,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1153 | 1180 | ||
1154 | public void DeleteGroup() | 1181 | public void DeleteGroup() |
1155 | { | 1182 | { |
1156 | m_scene.EventManager.OnBackup -= this.ProcessBackup; | 1183 | DetachFromBackup( this ); |
1157 | foreach (SceneObjectPart part in this.m_parts.Values) | 1184 | foreach (SceneObjectPart part in this.m_parts.Values) |
1158 | { | 1185 | { |
1159 | List<ScenePresence> avatars = this.RequestSceneAvatars(); | 1186 | List<ScenePresence> avatars = this.RequestSceneAvatars(); |
diff --git a/OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs b/OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs index 65b03ad..6971cc8 100644 --- a/OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs +++ b/OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs | |||
@@ -1,25 +1,15 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using System.Text; | ||
4 | using System.Xml; | ||
5 | using System.Xml.Serialization; | ||
6 | using System.IO; | ||
7 | |||
8 | using OpenSim.Region.Environment.Scenes; | ||
9 | using OpenSim.Region.Environment.LandManagement; | ||
10 | using OpenSim.Region.Environment; | ||
11 | using OpenSim.Region.Environment.Interfaces; | ||
12 | using OpenSim.Framework.Console; | ||
13 | using OpenSim.Framework.Types; | ||
14 | using OpenSim.Framework.Utilities; | ||
15 | using libsecondlife; | ||
16 | |||
17 | using System.Data; | 3 | using System.Data; |
18 | using System.Data.SqlTypes; | 4 | using libsecondlife; |
19 | |||
20 | using Mono.Data.SqliteClient; | 5 | using Mono.Data.SqliteClient; |
6 | using OpenSim.Framework.Console; | ||
7 | using OpenSim.Framework.Types; | ||
8 | using OpenSim.Region.Environment.Interfaces; | ||
9 | using OpenSim.Region.Environment.LandManagement; | ||
10 | using OpenSim.Region.Environment.Scenes; | ||
21 | 11 | ||
22 | namespace OpenSim.DataStore.MonoSqliteStorage | 12 | namespace OpenSim.DataStore.MonoSqlite |
23 | { | 13 | { |
24 | public class MonoSqliteDataStore : IRegionDataStore | 14 | public class MonoSqliteDataStore : IRegionDataStore |
25 | { | 15 | { |
@@ -402,37 +392,37 @@ namespace OpenSim.DataStore.MonoSqliteStorage | |||
402 | prim.BaseMask = Convert.ToUInt32(row["BaseMask"]); | 392 | prim.BaseMask = Convert.ToUInt32(row["BaseMask"]); |
403 | // vectors | 393 | // vectors |
404 | prim.OffsetPosition = new LLVector3( | 394 | prim.OffsetPosition = new LLVector3( |
405 | Convert.ToSingle(row["PositionX"]), | 395 | Convert.ToSingle(row["PositionX"]), |
406 | Convert.ToSingle(row["PositionY"]), | 396 | Convert.ToSingle(row["PositionY"]), |
407 | Convert.ToSingle(row["PositionZ"]) | 397 | Convert.ToSingle(row["PositionZ"]) |
408 | ); | 398 | ); |
409 | prim.GroupPosition = new LLVector3( | 399 | prim.GroupPosition = new LLVector3( |
410 | Convert.ToSingle(row["GroupPositionX"]), | 400 | Convert.ToSingle(row["GroupPositionX"]), |
411 | Convert.ToSingle(row["GroupPositionY"]), | 401 | Convert.ToSingle(row["GroupPositionY"]), |
412 | Convert.ToSingle(row["GroupPositionZ"]) | 402 | Convert.ToSingle(row["GroupPositionZ"]) |
413 | ); | 403 | ); |
414 | prim.Velocity = new LLVector3( | 404 | prim.Velocity = new LLVector3( |
415 | Convert.ToSingle(row["VelocityX"]), | 405 | Convert.ToSingle(row["VelocityX"]), |
416 | Convert.ToSingle(row["VelocityY"]), | 406 | Convert.ToSingle(row["VelocityY"]), |
417 | Convert.ToSingle(row["VelocityZ"]) | 407 | Convert.ToSingle(row["VelocityZ"]) |
418 | ); | 408 | ); |
419 | prim.AngularVelocity = new LLVector3( | 409 | prim.AngularVelocity = new LLVector3( |
420 | Convert.ToSingle(row["AngularVelocityX"]), | 410 | Convert.ToSingle(row["AngularVelocityX"]), |
421 | Convert.ToSingle(row["AngularVelocityY"]), | 411 | Convert.ToSingle(row["AngularVelocityY"]), |
422 | Convert.ToSingle(row["AngularVelocityZ"]) | 412 | Convert.ToSingle(row["AngularVelocityZ"]) |
423 | ); | 413 | ); |
424 | prim.Acceleration = new LLVector3( | 414 | prim.Acceleration = new LLVector3( |
425 | Convert.ToSingle(row["AccelerationX"]), | 415 | Convert.ToSingle(row["AccelerationX"]), |
426 | Convert.ToSingle(row["AccelerationY"]), | 416 | Convert.ToSingle(row["AccelerationY"]), |
427 | Convert.ToSingle(row["AccelerationZ"]) | 417 | Convert.ToSingle(row["AccelerationZ"]) |
428 | ); | 418 | ); |
429 | // quaternions | 419 | // quaternions |
430 | prim.RotationOffset = new LLQuaternion( | 420 | prim.RotationOffset = new LLQuaternion( |
431 | Convert.ToSingle(row["RotationX"]), | 421 | Convert.ToSingle(row["RotationX"]), |
432 | Convert.ToSingle(row["RotationY"]), | 422 | Convert.ToSingle(row["RotationY"]), |
433 | Convert.ToSingle(row["RotationZ"]), | 423 | Convert.ToSingle(row["RotationZ"]), |
434 | Convert.ToSingle(row["RotationW"]) | 424 | Convert.ToSingle(row["RotationW"]) |
435 | ); | 425 | ); |
436 | 426 | ||
437 | return prim; | 427 | return prim; |
438 | } | 428 | } |
@@ -488,10 +478,10 @@ namespace OpenSim.DataStore.MonoSqliteStorage | |||
488 | { | 478 | { |
489 | PrimitiveBaseShape s = new PrimitiveBaseShape(); | 479 | PrimitiveBaseShape s = new PrimitiveBaseShape(); |
490 | s.Scale = new LLVector3( | 480 | s.Scale = new LLVector3( |
491 | Convert.ToSingle(row["ScaleX"]), | 481 | Convert.ToSingle(row["ScaleX"]), |
492 | Convert.ToSingle(row["ScaleY"]), | 482 | Convert.ToSingle(row["ScaleY"]), |
493 | Convert.ToSingle(row["ScaleZ"]) | 483 | Convert.ToSingle(row["ScaleZ"]) |
494 | ); | 484 | ); |
495 | // paths | 485 | // paths |
496 | s.PCode = Convert.ToByte(row["PCode"]); | 486 | s.PCode = Convert.ToByte(row["PCode"]); |
497 | s.PathBegin = Convert.ToUInt16(row["PathBegin"]); | 487 | s.PathBegin = Convert.ToUInt16(row["PathBegin"]); |
@@ -876,4 +866,4 @@ namespace OpenSim.DataStore.MonoSqliteStorage | |||
876 | } | 866 | } |
877 | } | 867 | } |
878 | } | 868 | } |
879 | } | 869 | } \ No newline at end of file |