diff options
Diffstat (limited to 'OpenSim/Region/CoreModules/Framework')
4 files changed, 72 insertions, 101 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs index 4c786ff..a1d8d5a 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs | |||
@@ -150,6 +150,34 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
150 | 150 | ||
151 | if (m_Enabled) | 151 | if (m_Enabled) |
152 | scene.RegisterModuleInterface<IUserAgentVerificationModule>(this); | 152 | scene.RegisterModuleInterface<IUserAgentVerificationModule>(this); |
153 | |||
154 | scene.EventManager.OnIncomingSceneObject += OnIncomingSceneObject; | ||
155 | } | ||
156 | |||
157 | void OnIncomingSceneObject(SceneObjectGroup so) | ||
158 | { | ||
159 | if (!so.IsAttachment) | ||
160 | return; | ||
161 | |||
162 | if (so.Scene.UserManagementModule.IsLocalGridUser(so.AttachedAvatar)) | ||
163 | return; | ||
164 | |||
165 | // foreign user | ||
166 | AgentCircuitData aCircuit = so.Scene.AuthenticateHandler.GetAgentCircuitData(so.AttachedAvatar); | ||
167 | if (aCircuit != null && (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0) | ||
168 | { | ||
169 | if (aCircuit.ServiceURLs != null && aCircuit.ServiceURLs.ContainsKey("AssetServerURI")) | ||
170 | { | ||
171 | string url = aCircuit.ServiceURLs["AssetServerURI"].ToString(); | ||
172 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Incoming attachement {0} for HG user {1} with asset server {2}", so.Name, so.AttachedAvatar, url); | ||
173 | Dictionary<UUID, AssetType> ids = new Dictionary<UUID, AssetType>(); | ||
174 | HGUuidGatherer uuidGatherer = new HGUuidGatherer(so.Scene.AssetService, url); | ||
175 | uuidGatherer.GatherAssetUuids(so, ids); | ||
176 | |||
177 | foreach (KeyValuePair<UUID, AssetType> kvp in ids) | ||
178 | uuidGatherer.FetchAsset(kvp.Key); | ||
179 | } | ||
180 | } | ||
153 | } | 181 | } |
154 | 182 | ||
155 | protected override void OnNewClient(IClientAPI client) | 183 | protected override void OnNewClient(IClientAPI client) |
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs index eaadc1b..6f62856 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs | |||
@@ -71,19 +71,19 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
71 | 71 | ||
72 | #region Internal functions | 72 | #region Internal functions |
73 | 73 | ||
74 | public AssetBase FetchAsset(string url, UUID assetID) | 74 | public AssetMetadata FetchMetadata(string url, UUID assetID) |
75 | { | 75 | { |
76 | if (!url.EndsWith("/") && !url.EndsWith("=")) | 76 | if (!url.EndsWith("/") && !url.EndsWith("=")) |
77 | url = url + "/"; | 77 | url = url + "/"; |
78 | 78 | ||
79 | AssetBase asset = m_scene.AssetService.Get(url + assetID.ToString()); | 79 | AssetMetadata meta = m_scene.AssetService.GetMetadata(url + assetID.ToString()); |
80 | 80 | ||
81 | if (asset != null) | 81 | if (meta != null) |
82 | { | 82 | m_log.DebugFormat("[HG ASSET MAPPER]: Fetched metadata for asset {0} of type {1} from {2} ", assetID, meta.Type, url); |
83 | m_log.DebugFormat("[HG ASSET MAPPER]: Copied asset {0} from {1} to local asset server. ", asset.ID, url); | 83 | else |
84 | return asset; | 84 | m_log.DebugFormat("[HG ASSET MAPPER]: Unable to fetched metadata for asset {0} from {1} ", assetID, url); |
85 | } | 85 | |
86 | return null; | 86 | return meta; |
87 | } | 87 | } |
88 | 88 | ||
89 | public bool PostAsset(string url, AssetBase asset) | 89 | public bool PostAsset(string url, AssetBase asset) |
@@ -93,6 +93,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
93 | if (!url.EndsWith("/") && !url.EndsWith("=")) | 93 | if (!url.EndsWith("/") && !url.EndsWith("=")) |
94 | url = url + "/"; | 94 | url = url + "/"; |
95 | 95 | ||
96 | bool success = true; | ||
96 | // See long comment in AssetCache.AddAsset | 97 | // See long comment in AssetCache.AddAsset |
97 | if (!asset.Temporary || asset.Local) | 98 | if (!asset.Temporary || asset.Local) |
98 | { | 99 | { |
@@ -103,14 +104,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
103 | // not having a global naming infrastructure | 104 | // not having a global naming infrastructure |
104 | AssetBase asset1 = new AssetBase(asset.FullID, asset.Name, asset.Type, asset.Metadata.CreatorID); | 105 | AssetBase asset1 = new AssetBase(asset.FullID, asset.Name, asset.Type, asset.Metadata.CreatorID); |
105 | Copy(asset, asset1); | 106 | Copy(asset, asset1); |
106 | try | 107 | asset1.ID = url + asset.ID; |
107 | { | ||
108 | asset1.ID = url + asset.ID; | ||
109 | } | ||
110 | catch | ||
111 | { | ||
112 | m_log.Warn("[HG ASSET MAPPER]: Oops."); | ||
113 | } | ||
114 | 108 | ||
115 | AdjustIdentifiers(asset1.Metadata); | 109 | AdjustIdentifiers(asset1.Metadata); |
116 | if (asset1.Metadata.Type == (sbyte)AssetType.Object) | 110 | if (asset1.Metadata.Type == (sbyte)AssetType.Object) |
@@ -118,11 +112,17 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
118 | else | 112 | else |
119 | asset1.Data = asset.Data; | 113 | asset1.Data = asset.Data; |
120 | 114 | ||
121 | m_scene.AssetService.Store(asset1); | 115 | string id = m_scene.AssetService.Store(asset1); |
122 | m_log.DebugFormat("[HG ASSET MAPPER]: Posted copy of asset {0} from local asset server to {1}", asset1.ID, url); | 116 | if (id == string.Empty) |
117 | { | ||
118 | m_log.DebugFormat("[HG ASSET MAPPER]: Asset server {0} did not accept {1}", url, asset.ID); | ||
119 | success = false; | ||
120 | } | ||
121 | else | ||
122 | m_log.DebugFormat("[HG ASSET MAPPER]: Posted copy of asset {0} from local asset server to {1}", asset1.ID, url); | ||
123 | } | 123 | } |
124 | return true; | 124 | return success; |
125 | } | 125 | } |
126 | else | 126 | else |
127 | m_log.Warn("[HG ASSET MAPPER]: Tried to post asset to remote server, but asset not in local cache."); | 127 | m_log.Warn("[HG ASSET MAPPER]: Tried to post asset to remote server, but asset not in local cache."); |
128 | 128 | ||
@@ -222,28 +222,19 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
222 | 222 | ||
223 | public void Get(UUID assetID, UUID ownerID, string userAssetURL) | 223 | public void Get(UUID assetID, UUID ownerID, string userAssetURL) |
224 | { | 224 | { |
225 | // Get the item from the remote asset server onto the local AssetCache | 225 | // Get the item from the remote asset server onto the local AssetService |
226 | // and place an entry in m_assetMap | ||
227 | 226 | ||
228 | m_log.Debug("[HG ASSET MAPPER]: Fetching object " + assetID + " from asset server " + userAssetURL); | 227 | AssetMetadata meta = FetchMetadata(userAssetURL, assetID); |
229 | AssetBase asset = FetchAsset(userAssetURL, assetID); | 228 | if (meta == null) |
229 | return; | ||
230 | 230 | ||
231 | if (asset != null) | 231 | // The act of gathering UUIDs downloads the assets from the remote server |
232 | { | 232 | Dictionary<UUID, AssetType> ids = new Dictionary<UUID, AssetType>(); |
233 | // OK, now fetch the inside. | 233 | HGUuidGatherer uuidGatherer = new HGUuidGatherer(m_scene.AssetService, userAssetURL); |
234 | Dictionary<UUID, AssetType> ids = new Dictionary<UUID, AssetType>(); | 234 | uuidGatherer.GatherAssetUuids(assetID, (AssetType)meta.Type, ids); |
235 | HGUuidGatherer uuidGatherer = new HGUuidGatherer(this, m_scene.AssetService, userAssetURL); | ||
236 | uuidGatherer.GatherAssetUuids(asset.FullID, (AssetType)asset.Type, ids); | ||
237 | if (ids.ContainsKey(assetID)) | ||
238 | ids.Remove(assetID); | ||
239 | foreach (UUID uuid in ids.Keys) | ||
240 | FetchAsset(userAssetURL, uuid); | ||
241 | 235 | ||
242 | m_log.DebugFormat("[HG ASSET MAPPER]: Successfully fetched asset {0} from asset server {1}", asset.ID, userAssetURL); | 236 | m_log.DebugFormat("[HG ASSET MAPPER]: Successfully fetched asset {0} from asset server {1}", assetID, userAssetURL); |
243 | 237 | ||
244 | } | ||
245 | else | ||
246 | m_log.Warn("[HG ASSET MAPPER]: Could not fetch asset from remote asset server " + userAssetURL); | ||
247 | } | 238 | } |
248 | 239 | ||
249 | 240 | ||
@@ -257,19 +248,23 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
257 | if (asset != null) | 248 | if (asset != null) |
258 | { | 249 | { |
259 | Dictionary<UUID, AssetType> ids = new Dictionary<UUID, AssetType>(); | 250 | Dictionary<UUID, AssetType> ids = new Dictionary<UUID, AssetType>(); |
260 | HGUuidGatherer uuidGatherer = new HGUuidGatherer(this, m_scene.AssetService, string.Empty); | 251 | HGUuidGatherer uuidGatherer = new HGUuidGatherer(m_scene.AssetService, string.Empty); |
261 | uuidGatherer.GatherAssetUuids(asset.FullID, (AssetType)asset.Type, ids); | 252 | uuidGatherer.GatherAssetUuids(asset.FullID, (AssetType)asset.Type, ids); |
253 | bool success = false; | ||
262 | foreach (UUID uuid in ids.Keys) | 254 | foreach (UUID uuid in ids.Keys) |
263 | { | 255 | { |
264 | asset = m_scene.AssetService.Get(uuid.ToString()); | 256 | asset = m_scene.AssetService.Get(uuid.ToString()); |
265 | if (asset == null) | 257 | if (asset == null) |
266 | m_log.DebugFormat("[HG ASSET MAPPER]: Could not find asset {0}", uuid); | 258 | m_log.DebugFormat("[HG ASSET MAPPER]: Could not find asset {0}", uuid); |
267 | else | 259 | else |
268 | PostAsset(userAssetURL, asset); | 260 | success = PostAsset(userAssetURL, asset); |
269 | } | 261 | } |
270 | 262 | ||
271 | // maybe all pieces got there... | 263 | // maybe all pieces got there... |
272 | m_log.DebugFormat("[HG ASSET MAPPER]: Successfully posted item {0} to asset server {1}", assetID, userAssetURL); | 264 | if (!success) |
265 | m_log.DebugFormat("[HG ASSET MAPPER]: Problems posting item {0} to asset server {1}", assetID, userAssetURL); | ||
266 | else | ||
267 | m_log.DebugFormat("[HG ASSET MAPPER]: Successfully posted item {0} to asset server {1}", assetID, userAssetURL); | ||
273 | 268 | ||
274 | } | 269 | } |
275 | else | 270 | else |
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs index a0cad40..80257bd 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs | |||
@@ -263,8 +263,13 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
263 | //} | 263 | //} |
264 | 264 | ||
265 | // OK, we're done fetching. Pass it up to the default RezObject | 265 | // OK, we're done fetching. Pass it up to the default RezObject |
266 | return base.RezObject(remoteClient, itemID, RayEnd, RayStart, RayTargetID, BypassRayCast, RayEndIsIntersection, | 266 | SceneObjectGroup sog = base.RezObject(remoteClient, itemID, RayEnd, RayStart, RayTargetID, BypassRayCast, RayEndIsIntersection, |
267 | RezSelected, RemoveItem, fromTaskID, attachment); | 267 | RezSelected, RemoveItem, fromTaskID, attachment); |
268 | |||
269 | if (sog == null) | ||
270 | remoteClient.SendAgentAlertMessage("Unable to rez: problem accessing inventory or locating assets", false); | ||
271 | |||
272 | return sog; | ||
268 | 273 | ||
269 | } | 274 | } |
270 | 275 | ||
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGUuidGatherer.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGUuidGatherer.cs deleted file mode 100644 index fcb544f..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 assetCache, string assetServerURL) : base(assetCache) | ||
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 m_assetCache.Get(uuid.ToString()); | ||
53 | else | ||
54 | return m_assetMapper.FetchAsset(m_assetServerURL, uuid); | ||
55 | } | ||
56 | } | ||
57 | } | ||