From a13a4c61448380852df3fba05d2c88710c28e0a9 Mon Sep 17 00:00:00 2001
From: Justin Clarke Casey
Date: Mon, 21 Jul 2008 17:13:32 +0000
Subject: * minor: change misleading 'all assets found' message to instead tell
how many were actually located
---
.../Modules/World/Archiver/ArchiveReadRequest.cs | 7 ++++++-
.../World/Archiver/ArchiveWriteRequestExecution.cs | 14 +++++++++----
.../Modules/World/Archiver/AssetsArchiver.cs | 23 ++++++++--------------
.../Modules/World/Archiver/AssetsRequest.cs | 14 ++++++++++---
4 files changed, 35 insertions(+), 23 deletions(-)
(limited to 'OpenSim/Region/Environment/Modules/World/Archiver')
diff --git a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs
index d901b54..985b939 100644
--- a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs
+++ b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs
@@ -132,7 +132,12 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
part.CreatorID = masterAvatarId;
part.OwnerID = masterAvatarId;
part.LastOwnerID = masterAvatarId;
- }
+
+ // For now, give all incoming scene objects new uuids. This will allow scenes to be cloned
+ // on the same region server and multiple examples a single object archive to be imported
+ // to the same scene (when this is possible).
+ //part.UUID = LLUUID.Random();
+ }
if (m_scene.AddRestoredSceneObject(sceneObject, true, false))
{
diff --git a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveWriteRequestExecution.cs b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveWriteRequestExecution.cs
index e980650..0341a70 100644
--- a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveWriteRequestExecution.cs
+++ b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveWriteRequestExecution.cs
@@ -44,7 +44,7 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
///
/// Method called when all the necessary assets for an archive request have been received.
///
- public delegate void AssetsRequestCallback(IDictionary assets);
+ public delegate void AssetsRequestCallback(IDictionary assetsFound, ICollection assetsNotFoundUuids);
///
/// Execute the write of an archive once we have received all the necessary data
@@ -73,9 +73,15 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
m_savePath = savePath;
}
- protected internal void ReceivedAllAssets(IDictionary assets)
+ protected internal void ReceivedAllAssets(IDictionary assetsFound, ICollection assetsNotFoundUuids)
{
- m_log.DebugFormat("[ARCHIVER]: Received all {0} assets required", assets.Count);
+ foreach (LLUUID uuid in assetsNotFoundUuids)
+ {
+ m_log.DebugFormat("[ARCHIVER]: Could not find asset {0}", uuid);
+ }
+
+ m_log.InfoFormat(
+ "[ARCHIVER]: Received {0} of {1} assets requested", assetsFound.Count, assetsFound.Count + assetsNotFoundUuids.Count);
TarArchiveWriter archive = new TarArchiveWriter();
@@ -108,7 +114,7 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
}
// Write out assets
- AssetsArchiver assetsArchiver = new AssetsArchiver(assets);
+ AssetsArchiver assetsArchiver = new AssetsArchiver(assetsFound);
assetsArchiver.Archive(archive);
archive.WriteTar(new GZipStream(new FileStream(m_savePath, FileMode.Create), CompressionMode.Compress));
diff --git a/OpenSim/Region/Environment/Modules/World/Archiver/AssetsArchiver.cs b/OpenSim/Region/Environment/Modules/World/Archiver/AssetsArchiver.cs
index 9a1b560..81d85d2 100644
--- a/OpenSim/Region/Environment/Modules/World/Archiver/AssetsArchiver.cs
+++ b/OpenSim/Region/Environment/Modules/World/Archiver/AssetsArchiver.cs
@@ -121,23 +121,16 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
{
AssetBase asset = m_assets[uuid];
- if (asset != null)
- {
- string extension = string.Empty;
-
- if (ArchiveConstants.ASSET_TYPE_TO_EXTENSION.ContainsKey(asset.Type))
- {
- extension = ArchiveConstants.ASSET_TYPE_TO_EXTENSION[asset.Type];
- }
-
- archive.AddFile(
- ArchiveConstants.ASSETS_PATH + uuid.ToString() + extension,
- asset.Data);
- }
- else
+ string extension = string.Empty;
+
+ if (ArchiveConstants.ASSET_TYPE_TO_EXTENSION.ContainsKey(asset.Type))
{
- m_log.WarnFormat("[ARCHIVER]: Could not find asset {0} to archive", uuid);
+ extension = ArchiveConstants.ASSET_TYPE_TO_EXTENSION[asset.Type];
}
+
+ archive.AddFile(
+ ArchiveConstants.ASSETS_PATH + uuid.ToString() + extension,
+ asset.Data);
}
}
}
diff --git a/OpenSim/Region/Environment/Modules/World/Archiver/AssetsRequest.cs b/OpenSim/Region/Environment/Modules/World/Archiver/AssetsRequest.cs
index ebcbcc7..2fd79b1 100644
--- a/OpenSim/Region/Environment/Modules/World/Archiver/AssetsRequest.cs
+++ b/OpenSim/Region/Environment/Modules/World/Archiver/AssetsRequest.cs
@@ -54,6 +54,11 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
/// Assets retrieved in this request
///
protected Dictionary m_assets = new Dictionary();
+
+ ///
+ /// Maintain a list of assets that could not be found. This will be passed back to the requester.
+ ///
+ protected List m_notFoundAssetUuids = new List();
///
/// Record the number of asset replies required so we know when we've finished
@@ -77,7 +82,7 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
{
// We can stop here if there are no assets to fetch
if (m_repliesRequired == 0)
- m_assetsRequestCallback(m_assets);
+ m_assetsRequestCallback(m_assets, m_notFoundAssetUuids);
foreach (LLUUID uuid in m_uuids)
{
@@ -92,7 +97,10 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
///
public void AssetRequestCallback(LLUUID assetID, AssetBase asset)
{
- m_assets[assetID] = asset;
+ if (asset != null)
+ m_assets[assetID] = asset;
+ else
+ m_notFoundAssetUuids.Add(assetID);
if (m_assets.Count == m_repliesRequired)
{
@@ -108,7 +116,7 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
///
protected void PerformAssetsRequestCallback()
{
- m_assetsRequestCallback(m_assets);
+ m_assetsRequestCallback(m_assets, m_notFoundAssetUuids);
}
}
}
--
cgit v1.1