From cfa022700d3d099eee7cd25d18da875639506ea8 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Fri, 21 Sep 2012 16:45:16 -0700 Subject: Moved the small HGUuidGatherer class to the file where its parent class is. No need to keep 2 separate files. --- OpenSim/Region/Framework/Scenes/UuidGatherer.cs | 36 +++++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'OpenSim/Region/Framework/Scenes/UuidGatherer.cs') diff --git a/OpenSim/Region/Framework/Scenes/UuidGatherer.cs b/OpenSim/Region/Framework/Scenes/UuidGatherer.cs index dc4a082..383604d 100644 --- a/OpenSim/Region/Framework/Scenes/UuidGatherer.cs +++ b/OpenSim/Region/Framework/Scenes/UuidGatherer.cs @@ -366,4 +366,40 @@ namespace OpenSim.Region.Framework.Scenes } } } + + public class HGUuidGatherer : UuidGatherer + { + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + + protected string m_assetServerURL; + + public HGUuidGatherer(IAssetService assetService, string assetServerURL) + : base(assetService) + { + m_assetServerURL = assetServerURL; + } + + protected override AssetBase GetAsset(UUID uuid) + { + if (string.Empty == m_assetServerURL) + return base.GetAsset(uuid); + else + return FetchAsset(m_assetServerURL, uuid); + } + + public AssetBase FetchAsset(string url, UUID assetID) + { + if (!url.EndsWith("/") && !url.EndsWith("=")) + url = url + "/"; + + AssetBase asset = m_assetService.Get(url + assetID.ToString()); + + if (asset != null) + { + m_log.DebugFormat("[HGUUIDGatherer]: Copied asset {0} from {1} to local asset server. ", asset.ID, url); + return asset; + } + return null; + } + } } -- cgit v1.1