* On archive loading, tell the user how many objects we are ignoring because they already exist in the scene

* (ability to give objects new uuids will come later)
0.6.0-stable
Justin Clarke Casey 2008-07-12 22:14:38 +00:00
parent 23c4a409b7
commit a89385818d
7 changed files with 34 additions and 22 deletions

View File

@ -85,10 +85,7 @@ namespace OpenSim.Region.DataSnapshot
#region IRegionModule
public void Close()
{
m_log.Info("[DATASNAPSHOT]: Close called");
}
public void Close() {}
public void Initialise(Scene scene, IConfigSource config)
{

View File

@ -103,11 +103,14 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
m_log.InfoFormat("[ARCHIVER]: Loading {0} scene objects", serialisedSceneObjects.Count);
IRegionSerialiser serialiser = m_scene.RequestModuleInterface<IRegionSerialiser>();
ICollection<SceneObjectGroup> sceneObjects = new List<SceneObjectGroup>();
ICollection<SceneObjectGroup> sceneObjects = new List<SceneObjectGroup>();
foreach (string serialisedSceneObject in serialisedSceneObjects)
{
sceneObjects.Add(serialiser.LoadGroupFromXml2(m_scene, serialisedSceneObject));
{
SceneObjectGroup sceneObject = serialiser.LoadGroupFromXml2(m_scene, serialisedSceneObject);
if (null != sceneObject)
sceneObjects.Add(sceneObject);
}
m_log.Debug("[ARCHIVER]: Starting scripts");
@ -117,6 +120,13 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
sceneObject.CreateScriptInstances(0, true);
}
m_log.InfoFormat("[ARCHIVER]: Restored {0} objects to the scene", sceneObjects.Count);
int ignoredObjects = serialisedSceneObjects.Count - sceneObjects.Count;
if (ignoredObjects > 0)
m_log.WarnFormat("[ARCHIVER]: Ignored {0} objects that already existed in the scene", ignoredObjects);
m_log.InfoFormat("[ARCHIVER]: Successfully loaded archive");
}

View File

@ -85,7 +85,7 @@ namespace OpenSim.Region.Environment.Modules.World.Serialiser
/// </summary>
/// <param name="scene"></param>
/// <param name="xmlString"></param>
/// <returns>The scene object created</returns>
/// <returns>The scene object created. null if the scene object already existed</returns>
SceneObjectGroup LoadGroupFromXml2(Scene scene, string xmlString);
/// <summary>

View File

@ -180,14 +180,15 @@ namespace OpenSim.Region.Environment.Scenes
/// </summary>
/// <param name="scene"></param>
/// <param name="xmlData"></param>
/// <returns>The scene object created</returns>
/// <returns>The scene object created. null if the scene object already existed</returns>
protected static SceneObjectGroup CreatePrimFromXml2(Scene scene, string xmlData)
{
SceneObjectGroup obj = new SceneObjectGroup(xmlData);
scene.AddRestoredSceneObject(obj, true);
return obj;
if (scene.AddRestoredSceneObject(obj, true))
return obj;
else
return null;
}
public static void SavePrimsToXml2(Scene scene, string fileName)

View File

@ -196,7 +196,10 @@ namespace OpenSim.Region.Environment.Scenes
/// If true, changes to the object will be reflected in its persisted data
/// If false, the persisted data will not be changed even if the object in the scene is changed
/// </param>
protected internal void AddRestoredSceneObject(SceneObjectGroup sceneObject, bool attachToBackup)
/// <returns>
/// true if the object was added, false if an object with the same uuid was already in the scene
/// </returns>
protected internal bool AddRestoredSceneObject(SceneObjectGroup sceneObject, bool attachToBackup)
{
sceneObject.RegionHandle = m_regInfo.RegionHandle;
sceneObject.SetScene(m_parentScene);
@ -208,7 +211,7 @@ namespace OpenSim.Region.Environment.Scenes
sceneObject.UpdateParentIDs();
AddSceneObject(sceneObject, attachToBackup);
return AddSceneObject(sceneObject, attachToBackup);
}
/// <summary>
@ -220,14 +223,15 @@ namespace OpenSim.Region.Environment.Scenes
/// If true, the object is made persistent into the scene.
/// If false, the object will not persist over server restarts
/// </param>
/// <returns>true if the object was added, false if an object with the same uuid was already in the scene
/// <returns>
/// true if the object was added, false if an object with the same uuid was already in the scene
/// </returns>
protected internal void AddNewSceneObject(SceneObjectGroup sceneObject, bool attachToBackup)
protected internal bool AddNewSceneObject(SceneObjectGroup sceneObject, bool attachToBackup)
{
// Ensure that we persist this new scene object
sceneObject.HasGroupChanged = true;
AddSceneObject(sceneObject, attachToBackup);
return AddSceneObject(sceneObject, attachToBackup);
}
/// <summary>

View File

@ -1665,9 +1665,9 @@ namespace OpenSim.Region.Environment.Scenes
/// Add an object into the scene that has come from storage
/// </summary>
/// <param name="sceneObject"></param>
public void AddRestoredSceneObject(SceneObjectGroup sceneObject, bool attachToBackup)
public bool AddRestoredSceneObject(SceneObjectGroup sceneObject, bool attachToBackup)
{
m_innerScene.AddRestoredSceneObject(sceneObject, attachToBackup);
return m_innerScene.AddRestoredSceneObject(sceneObject, attachToBackup);
}
/// <summary>
@ -1678,9 +1678,9 @@ namespace OpenSim.Region.Environment.Scenes
/// If true, the object is made persistent into the scene.
/// If false, the object will not persist over server restarts
/// </param>
public void AddNewSceneObject(SceneObjectGroup sceneObject, bool attachToBackup)
public bool AddNewSceneObject(SceneObjectGroup sceneObject, bool attachToBackup)
{
m_innerScene.AddNewSceneObject(sceneObject, attachToBackup);
return m_innerScene.AddNewSceneObject(sceneObject, attachToBackup);
}
/// <summary>

View File

@ -77,7 +77,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
if (null == m_host)
{
m_log.ErrorFormat(
"[{0}]: Could not get scene object part corresponding to localID {1} to start script",
"[{0}]: Could not find scene object part corresponding to localID {1} to start script",
m_scriptEngine.ScriptEngineName, localID);
return;