diff options
author | Justin Clark-Casey (justincc) | 2012-09-22 01:05:33 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2012-09-22 01:05:33 +0100 |
commit | b36ef60aca798c0d5eaaa864668369a7ae68d404 (patch) | |
tree | ae236c4298eac9e9e0349dc5cbf8fefef70dd7dd /OpenSim | |
parent | Documenting non-LSL script-related events (diff) | |
parent | Merge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff) | |
download | opensim-SC_OLD-b36ef60aca798c0d5eaaa864668369a7ae68d404.zip opensim-SC_OLD-b36ef60aca798c0d5eaaa864668369a7ae68d404.tar.gz opensim-SC_OLD-b36ef60aca798c0d5eaaa864668369a7ae68d404.tar.bz2 opensim-SC_OLD-b36ef60aca798c0d5eaaa864668369a7ae68d404.tar.xz |
Merge branch 'master' of ssh://opensimulator.org/var/git/opensim
Diffstat (limited to 'OpenSim')
3 files changed, 38 insertions, 74 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs index dd0ea1c..6f62856 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs | |||
@@ -86,21 +86,6 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
86 | return meta; | 86 | return meta; |
87 | } | 87 | } |
88 | 88 | ||
89 | public AssetBase FetchAsset(string url, UUID assetID) | ||
90 | { | ||
91 | if (!url.EndsWith("/") && !url.EndsWith("=")) | ||
92 | url = url + "/"; | ||
93 | |||
94 | AssetBase asset = m_scene.AssetService.Get(url + assetID.ToString()); | ||
95 | |||
96 | if (asset != null) | ||
97 | { | ||
98 | m_log.DebugFormat("[HG ASSET MAPPER]: Copied asset {0} from {1} to local asset server. ", asset.ID, url); | ||
99 | return asset; | ||
100 | } | ||
101 | return null; | ||
102 | } | ||
103 | |||
104 | public bool PostAsset(string url, AssetBase asset) | 89 | public bool PostAsset(string url, AssetBase asset) |
105 | { | 90 | { |
106 | if (asset != null) | 91 | if (asset != null) |
@@ -245,7 +230,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
245 | 230 | ||
246 | // The act of gathering UUIDs downloads the assets from the remote server | 231 | // The act of gathering UUIDs downloads the assets from the remote server |
247 | Dictionary<UUID, AssetType> ids = new Dictionary<UUID, AssetType>(); | 232 | Dictionary<UUID, AssetType> ids = new Dictionary<UUID, AssetType>(); |
248 | HGUuidGatherer uuidGatherer = new HGUuidGatherer(this, m_scene.AssetService, userAssetURL); | 233 | HGUuidGatherer uuidGatherer = new HGUuidGatherer(m_scene.AssetService, userAssetURL); |
249 | uuidGatherer.GatherAssetUuids(assetID, (AssetType)meta.Type, ids); | 234 | uuidGatherer.GatherAssetUuids(assetID, (AssetType)meta.Type, ids); |
250 | 235 | ||
251 | m_log.DebugFormat("[HG ASSET MAPPER]: Successfully fetched asset {0} from asset server {1}", assetID, userAssetURL); | 236 | m_log.DebugFormat("[HG ASSET MAPPER]: Successfully fetched asset {0} from asset server {1}", assetID, userAssetURL); |
@@ -263,7 +248,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
263 | if (asset != null) | 248 | if (asset != null) |
264 | { | 249 | { |
265 | Dictionary<UUID, AssetType> ids = new Dictionary<UUID, AssetType>(); | 250 | Dictionary<UUID, AssetType> ids = new Dictionary<UUID, AssetType>(); |
266 | HGUuidGatherer uuidGatherer = new HGUuidGatherer(this, m_scene.AssetService, string.Empty); | 251 | HGUuidGatherer uuidGatherer = new HGUuidGatherer(m_scene.AssetService, string.Empty); |
267 | uuidGatherer.GatherAssetUuids(asset.FullID, (AssetType)asset.Type, ids); | 252 | uuidGatherer.GatherAssetUuids(asset.FullID, (AssetType)asset.Type, ids); |
268 | bool success = false; | 253 | bool success = false; |
269 | foreach (UUID uuid in ids.Keys) | 254 | foreach (UUID uuid in ids.Keys) |
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGUuidGatherer.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGUuidGatherer.cs deleted file mode 100644 index c7e1ef4..0000000 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGUuidGatherer.cs +++ /dev/null | |||
@@ -1,57 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | |||
31 | using OpenSim.Framework; | ||
32 | using OpenSim.Region.Framework.Scenes; | ||
33 | using OpenSim.Services.Interfaces; | ||
34 | using OpenMetaverse; | ||
35 | |||
36 | namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | ||
37 | { | ||
38 | public class HGUuidGatherer : UuidGatherer | ||
39 | { | ||
40 | protected string m_assetServerURL; | ||
41 | protected HGAssetMapper m_assetMapper; | ||
42 | |||
43 | public HGUuidGatherer(HGAssetMapper assMap, IAssetService assetService, string assetServerURL) : base(assetService) | ||
44 | { | ||
45 | m_assetMapper = assMap; | ||
46 | m_assetServerURL = assetServerURL; | ||
47 | } | ||
48 | |||
49 | protected override AssetBase GetAsset(UUID uuid) | ||
50 | { | ||
51 | if (string.Empty == m_assetServerURL) | ||
52 | return base.GetAsset(uuid); | ||
53 | else | ||
54 | return m_assetMapper.FetchAsset(m_assetServerURL, uuid); | ||
55 | } | ||
56 | } | ||
57 | } | ||
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 | |||
366 | } | 366 | } |
367 | } | 367 | } |
368 | } | 368 | } |
369 | |||
370 | public class HGUuidGatherer : UuidGatherer | ||
371 | { | ||
372 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
373 | |||
374 | protected string m_assetServerURL; | ||
375 | |||
376 | public HGUuidGatherer(IAssetService assetService, string assetServerURL) | ||
377 | : base(assetService) | ||
378 | { | ||
379 | m_assetServerURL = assetServerURL; | ||
380 | } | ||
381 | |||
382 | protected override AssetBase GetAsset(UUID uuid) | ||
383 | { | ||
384 | if (string.Empty == m_assetServerURL) | ||
385 | return base.GetAsset(uuid); | ||
386 | else | ||
387 | return FetchAsset(m_assetServerURL, uuid); | ||
388 | } | ||
389 | |||
390 | public AssetBase FetchAsset(string url, UUID assetID) | ||
391 | { | ||
392 | if (!url.EndsWith("/") && !url.EndsWith("=")) | ||
393 | url = url + "/"; | ||
394 | |||
395 | AssetBase asset = m_assetService.Get(url + assetID.ToString()); | ||
396 | |||
397 | if (asset != null) | ||
398 | { | ||
399 | m_log.DebugFormat("[HGUUIDGatherer]: Copied asset {0} from {1} to local asset server. ", asset.ID, url); | ||
400 | return asset; | ||
401 | } | ||
402 | return null; | ||
403 | } | ||
404 | } | ||
369 | } | 405 | } |