From 9208fb5d543e5dd226d8d900c78a5056fea4f022 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 4 Dec 2014 23:55:59 +0000 Subject: refactor: Make IteratingUUIDGatherer take a dictionary in its constructor like UUIDGatherer, so we can deal with future cases where the dictionary may already be pre-populated. --- OpenSim/Region/Framework/Scenes/UuidGatherer.cs | 32 ++++++++++++++++++------- 1 file changed, 23 insertions(+), 9 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/UuidGatherer.cs b/OpenSim/Region/Framework/Scenes/UuidGatherer.cs index 2450cdb..cacacf8 100644 --- a/OpenSim/Region/Framework/Scenes/UuidGatherer.cs +++ b/OpenSim/Region/Framework/Scenes/UuidGatherer.cs @@ -648,6 +648,15 @@ namespace OpenSim.Region.Framework.Scenes } } + /// + /// Gather uuids for a given entity. + /// + /// + /// This does a deep inspection of the entity to retrieve all the assets it uses (whether as textures, as scripts + /// contained in inventory, as scripts contained in objects contained in another object's inventory, etc. Assets + /// are only retrieved when they are necessary to carry out the inspection (i.e. a serialized object needs to be + /// retrieved to work out which assets it references). + /// public class IteratingUuidGatherer { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -678,20 +687,25 @@ namespace OpenSim.Region.Framework.Scenes protected Queue m_assetUuidsToInspect; - public IteratingUuidGatherer(IAssetService assetService) + /// + /// Initializes a new instance of the class. + /// + /// + /// Asset service. + /// + /// + /// Gathered UUIDs will be collected in this dictinaory. + /// It can be pre-populated if you want to stop the gatherer from analyzing assets that have already been fetched and inspected. + /// + public IteratingUuidGatherer(IAssetService assetService, IDictionary collector) { m_assetService = assetService; - m_gatheredAssetUuids = new Dictionary(); + m_gatheredAssetUuids = collector; // FIXME: Not efficient for searching, can improve. m_assetUuidsToInspect = new Queue(); } - public IDictionary GetGatheredUuids() - { - return new Dictionary(m_gatheredAssetUuids); - } - public bool AddAssetUuidToInspect(UUID uuid) { if (m_assetUuidsToInspect.Contains(uuid)) @@ -1147,8 +1161,8 @@ namespace OpenSim.Region.Framework.Scenes protected string m_assetServerURL; - public IteratingHGUuidGatherer(IAssetService assetService, string assetServerURL) - : base(assetService) + public IteratingHGUuidGatherer(IAssetService assetService, string assetServerURL, IDictionary collector) + : base(assetService, collector) { m_assetServerURL = assetServerURL; if (!m_assetServerURL.EndsWith("/") && !m_assetServerURL.EndsWith("=")) -- cgit v1.1