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.MonoSqliteafrisby
parent
a5aedc0896
commit
615487a756
OpenSim/Region
Environment/Scenes
Storage/OpenSim.DataStore.MonoSqlite
|
@ -108,13 +108,6 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Called at a set interval to inform entities that they should back themsleves up to the DB
|
|
||||||
/// </summary>
|
|
||||||
public virtual void BackUp()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Copies the entity
|
/// Copies the entity
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -149,6 +149,15 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
/// saying what prim(s) that user has selected.
|
/// saying what prim(s) that user has selected.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected bool m_isSelected = false;
|
protected bool m_isSelected = false;
|
||||||
|
|
||||||
|
protected virtual bool InSceneBackup
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public bool IsSelected
|
public bool IsSelected
|
||||||
{
|
{
|
||||||
get { return m_isSelected; }
|
get { return m_isSelected; }
|
||||||
|
@ -218,10 +227,20 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
this.m_rootPart.ParentID = 0;
|
this.m_rootPart.ParentID = 0;
|
||||||
this.m_rootPart.RegionHandle = m_regionHandle;
|
this.m_rootPart.RegionHandle = m_regionHandle;
|
||||||
this.UpdateParentIDs();
|
this.UpdateParentIDs();
|
||||||
m_scene.EventManager.OnBackup += this.ProcessBackup;
|
|
||||||
|
AttachToBackup();
|
||||||
|
|
||||||
this.ScheduleGroupForFullUpdate();
|
this.ScheduleGroupForFullUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void AttachToBackup()
|
||||||
|
{
|
||||||
|
if (InSceneBackup)
|
||||||
|
{
|
||||||
|
m_scene.EventManager.OnBackup += this.ProcessBackup;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -243,7 +262,8 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
SceneObjectPart newPart = new SceneObjectPart(m_regionHandle, this, ownerID, localID, shape, pos, rootOffset);
|
SceneObjectPart newPart = new SceneObjectPart(m_regionHandle, this, ownerID, localID, shape, pos, rootOffset);
|
||||||
this.m_parts.Add(newPart.UUID, newPart);
|
this.m_parts.Add(newPart.UUID, newPart);
|
||||||
this.SetPartAsRoot(newPart);
|
this.SetPartAsRoot(newPart);
|
||||||
m_scene.EventManager.OnBackup += this.ProcessBackup;
|
|
||||||
|
AttachToBackup();
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
@ -307,7 +327,8 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
}
|
}
|
||||||
dupe.UpdateParentIDs();
|
dupe.UpdateParentIDs();
|
||||||
|
|
||||||
m_scene.EventManager.OnBackup += dupe.ProcessBackup;
|
dupe.AttachToBackup();
|
||||||
|
|
||||||
return dupe;
|
return dupe;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -523,13 +544,19 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_scene.EventManager.OnBackup -= objectGroup.ProcessBackup;
|
DetachFromBackup(objectGroup);
|
||||||
|
|
||||||
m_scene.DeleteEntity(objectGroup.UUID);
|
m_scene.DeleteEntity(objectGroup.UUID);
|
||||||
|
|
||||||
objectGroup.DeleteParts();
|
objectGroup.DeleteParts();
|
||||||
this.ScheduleGroupForFullUpdate();
|
this.ScheduleGroupForFullUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void DetachFromBackup(SceneObjectGroup objectGroup)
|
||||||
|
{
|
||||||
|
m_scene.EventManager.OnBackup -= objectGroup.ProcessBackup;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private void LinkNonRootPart(SceneObjectPart part, Vector3 oldGroupPosition, Quaternion oldGroupRotation)
|
private void LinkNonRootPart(SceneObjectPart part, Vector3 oldGroupPosition, Quaternion oldGroupRotation)
|
||||||
{
|
{
|
||||||
|
@ -583,7 +610,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
proper.ObjectData[0].FolderID = LLUUID.Zero;
|
proper.ObjectData[0].FolderID = LLUUID.Zero;
|
||||||
proper.ObjectData[0].FromTaskID = LLUUID.Zero;
|
proper.ObjectData[0].FromTaskID = LLUUID.Zero;
|
||||||
proper.ObjectData[0].GroupID = LLUUID.Zero;
|
proper.ObjectData[0].GroupID = LLUUID.Zero;
|
||||||
proper.ObjectData[0].InventorySerial = (short) this.m_rootPart.InventorySerial;
|
proper.ObjectData[0].InventorySerial = (short)this.m_rootPart.InventorySerial;
|
||||||
proper.ObjectData[0].LastOwnerID = this.m_rootPart.LastOwnerID;
|
proper.ObjectData[0].LastOwnerID = this.m_rootPart.LastOwnerID;
|
||||||
proper.ObjectData[0].ObjectID = this.UUID;
|
proper.ObjectData[0].ObjectID = this.UUID;
|
||||||
proper.ObjectData[0].OwnerID = this.m_rootPart.OwnerID;
|
proper.ObjectData[0].OwnerID = this.m_rootPart.OwnerID;
|
||||||
|
@ -672,7 +699,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
SceneObjectPart part = this.GetChildPart(localID);
|
SceneObjectPart part = this.GetChildPart(localID);
|
||||||
if (part != null)
|
if (part != null)
|
||||||
{
|
{
|
||||||
return part.GetInventoryFileName(remoteClient, localID);
|
return part.GetInventoryFileName(remoteClient, localID);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -682,7 +709,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
SceneObjectPart part = this.GetChildPart(localID);
|
SceneObjectPart part = this.GetChildPart(localID);
|
||||||
if (part != null)
|
if (part != null)
|
||||||
{
|
{
|
||||||
part.RequestInventoryFile(xferManager);
|
part.RequestInventoryFile(xferManager);
|
||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
@ -705,7 +732,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool AddInventoryItem(IClientAPI remoteClient, uint localID, InventoryItemBase item, LLUUID copyItemID)
|
public bool AddInventoryItem(IClientAPI remoteClient, uint localID, InventoryItemBase item, LLUUID copyItemID)
|
||||||
|
@ -730,19 +757,19 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return AddInventoryItem(remoteClient, localID, item);
|
return AddInventoryItem(remoteClient, localID, item);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int RemoveInventoryItem(IClientAPI remoteClient, uint localID, LLUUID itemID)
|
public int RemoveInventoryItem(IClientAPI remoteClient, uint localID, LLUUID itemID)
|
||||||
{
|
{
|
||||||
SceneObjectPart part = this.GetChildPart(localID);
|
SceneObjectPart part = this.GetChildPart(localID);
|
||||||
if (part != null)
|
if (part != null)
|
||||||
{
|
{
|
||||||
return part.RemoveInventoryItem(remoteClient, localID, itemID);
|
return part.RemoveInventoryItem(remoteClient, localID, itemID);
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -1077,7 +1104,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
public void SetScene(Scene scene)
|
public void SetScene(Scene scene)
|
||||||
{
|
{
|
||||||
m_scene = scene;
|
m_scene = scene;
|
||||||
m_scene.EventManager.OnBackup += this.ProcessBackup;
|
AttachToBackup();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -1153,7 +1180,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
|
|
||||||
public void DeleteGroup()
|
public void DeleteGroup()
|
||||||
{
|
{
|
||||||
m_scene.EventManager.OnBackup -= this.ProcessBackup;
|
DetachFromBackup( this );
|
||||||
foreach (SceneObjectPart part in this.m_parts.Values)
|
foreach (SceneObjectPart part in this.m_parts.Values)
|
||||||
{
|
{
|
||||||
List<ScenePresence> avatars = this.RequestSceneAvatars();
|
List<ScenePresence> avatars = this.RequestSceneAvatars();
|
||||||
|
|
|
@ -1,25 +1,15 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.Data;
|
||||||
using System.Xml;
|
using libsecondlife;
|
||||||
using System.Xml.Serialization;
|
using Mono.Data.SqliteClient;
|
||||||
using System.IO;
|
|
||||||
|
|
||||||
using OpenSim.Region.Environment.Scenes;
|
|
||||||
using OpenSim.Region.Environment.LandManagement;
|
|
||||||
using OpenSim.Region.Environment;
|
|
||||||
using OpenSim.Region.Environment.Interfaces;
|
|
||||||
using OpenSim.Framework.Console;
|
using OpenSim.Framework.Console;
|
||||||
using OpenSim.Framework.Types;
|
using OpenSim.Framework.Types;
|
||||||
using OpenSim.Framework.Utilities;
|
using OpenSim.Region.Environment.Interfaces;
|
||||||
using libsecondlife;
|
using OpenSim.Region.Environment.LandManagement;
|
||||||
|
using OpenSim.Region.Environment.Scenes;
|
||||||
|
|
||||||
using System.Data;
|
namespace OpenSim.DataStore.MonoSqlite
|
||||||
using System.Data.SqlTypes;
|
|
||||||
|
|
||||||
using Mono.Data.SqliteClient;
|
|
||||||
|
|
||||||
namespace OpenSim.DataStore.MonoSqliteStorage
|
|
||||||
{
|
{
|
||||||
public class MonoSqliteDataStore : IRegionDataStore
|
public class MonoSqliteDataStore : IRegionDataStore
|
||||||
{
|
{
|
||||||
|
@ -402,37 +392,37 @@ namespace OpenSim.DataStore.MonoSqliteStorage
|
||||||
prim.BaseMask = Convert.ToUInt32(row["BaseMask"]);
|
prim.BaseMask = Convert.ToUInt32(row["BaseMask"]);
|
||||||
// vectors
|
// vectors
|
||||||
prim.OffsetPosition = new LLVector3(
|
prim.OffsetPosition = new LLVector3(
|
||||||
Convert.ToSingle(row["PositionX"]),
|
Convert.ToSingle(row["PositionX"]),
|
||||||
Convert.ToSingle(row["PositionY"]),
|
Convert.ToSingle(row["PositionY"]),
|
||||||
Convert.ToSingle(row["PositionZ"])
|
Convert.ToSingle(row["PositionZ"])
|
||||||
);
|
);
|
||||||
prim.GroupPosition = new LLVector3(
|
prim.GroupPosition = new LLVector3(
|
||||||
Convert.ToSingle(row["GroupPositionX"]),
|
Convert.ToSingle(row["GroupPositionX"]),
|
||||||
Convert.ToSingle(row["GroupPositionY"]),
|
Convert.ToSingle(row["GroupPositionY"]),
|
||||||
Convert.ToSingle(row["GroupPositionZ"])
|
Convert.ToSingle(row["GroupPositionZ"])
|
||||||
);
|
);
|
||||||
prim.Velocity = new LLVector3(
|
prim.Velocity = new LLVector3(
|
||||||
Convert.ToSingle(row["VelocityX"]),
|
Convert.ToSingle(row["VelocityX"]),
|
||||||
Convert.ToSingle(row["VelocityY"]),
|
Convert.ToSingle(row["VelocityY"]),
|
||||||
Convert.ToSingle(row["VelocityZ"])
|
Convert.ToSingle(row["VelocityZ"])
|
||||||
);
|
);
|
||||||
prim.AngularVelocity = new LLVector3(
|
prim.AngularVelocity = new LLVector3(
|
||||||
Convert.ToSingle(row["AngularVelocityX"]),
|
Convert.ToSingle(row["AngularVelocityX"]),
|
||||||
Convert.ToSingle(row["AngularVelocityY"]),
|
Convert.ToSingle(row["AngularVelocityY"]),
|
||||||
Convert.ToSingle(row["AngularVelocityZ"])
|
Convert.ToSingle(row["AngularVelocityZ"])
|
||||||
);
|
);
|
||||||
prim.Acceleration = new LLVector3(
|
prim.Acceleration = new LLVector3(
|
||||||
Convert.ToSingle(row["AccelerationX"]),
|
Convert.ToSingle(row["AccelerationX"]),
|
||||||
Convert.ToSingle(row["AccelerationY"]),
|
Convert.ToSingle(row["AccelerationY"]),
|
||||||
Convert.ToSingle(row["AccelerationZ"])
|
Convert.ToSingle(row["AccelerationZ"])
|
||||||
);
|
);
|
||||||
// quaternions
|
// quaternions
|
||||||
prim.RotationOffset = new LLQuaternion(
|
prim.RotationOffset = new LLQuaternion(
|
||||||
Convert.ToSingle(row["RotationX"]),
|
Convert.ToSingle(row["RotationX"]),
|
||||||
Convert.ToSingle(row["RotationY"]),
|
Convert.ToSingle(row["RotationY"]),
|
||||||
Convert.ToSingle(row["RotationZ"]),
|
Convert.ToSingle(row["RotationZ"]),
|
||||||
Convert.ToSingle(row["RotationW"])
|
Convert.ToSingle(row["RotationW"])
|
||||||
);
|
);
|
||||||
|
|
||||||
return prim;
|
return prim;
|
||||||
}
|
}
|
||||||
|
@ -488,10 +478,10 @@ namespace OpenSim.DataStore.MonoSqliteStorage
|
||||||
{
|
{
|
||||||
PrimitiveBaseShape s = new PrimitiveBaseShape();
|
PrimitiveBaseShape s = new PrimitiveBaseShape();
|
||||||
s.Scale = new LLVector3(
|
s.Scale = new LLVector3(
|
||||||
Convert.ToSingle(row["ScaleX"]),
|
Convert.ToSingle(row["ScaleX"]),
|
||||||
Convert.ToSingle(row["ScaleY"]),
|
Convert.ToSingle(row["ScaleY"]),
|
||||||
Convert.ToSingle(row["ScaleZ"])
|
Convert.ToSingle(row["ScaleZ"])
|
||||||
);
|
);
|
||||||
// paths
|
// paths
|
||||||
s.PCode = Convert.ToByte(row["PCode"]);
|
s.PCode = Convert.ToByte(row["PCode"]);
|
||||||
s.PathBegin = Convert.ToUInt16(row["PathBegin"]);
|
s.PathBegin = Convert.ToUInt16(row["PathBegin"]);
|
||||||
|
@ -876,4 +866,4 @@ namespace OpenSim.DataStore.MonoSqliteStorage
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue