diff options
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs | 26 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/UuidGatherer.cs | 38 |
2 files changed, 48 insertions, 16 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs b/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs index 24de56e..d9fe87c 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs | |||
@@ -85,5 +85,31 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
85 | // We count the uuid as gathered even if the asset itself is missing. | 85 | // We count the uuid as gathered even if the asset itself is missing. |
86 | Assert.That(foundAssetUuids.Count, Is.EqualTo(1)); | 86 | Assert.That(foundAssetUuids.Count, Is.EqualTo(1)); |
87 | } | 87 | } |
88 | |||
89 | [Test] | ||
90 | public void TestNotecardAsset() | ||
91 | { | ||
92 | TestHelpers.InMethod(); | ||
93 | // log4net.Config.XmlConfigurator.Configure(); | ||
94 | |||
95 | UUID ownerId = TestHelpers.ParseTail(0x10); | ||
96 | UUID soAssetId = TestHelpers.ParseTail(0x20); | ||
97 | UUID ncAssetId = TestHelpers.ParseTail(0x30); | ||
98 | |||
99 | SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, ownerId); | ||
100 | AssetBase soAsset = AssetHelpers.CreateAsset(soAssetId, so); | ||
101 | m_assetService.Store(soAsset); | ||
102 | |||
103 | AssetBase ncAsset = AssetHelpers.CreateNotecardAsset(ncAssetId, soAssetId.ToString()); | ||
104 | m_assetService.Store(ncAsset); | ||
105 | |||
106 | IDictionary<UUID, AssetType> foundAssetUuids = new Dictionary<UUID, AssetType>(); | ||
107 | m_uuidGatherer.GatherAssetUuids(ncAssetId, AssetType.Notecard, foundAssetUuids); | ||
108 | |||
109 | // We count the uuid as gathered even if the asset itself is corrupt. | ||
110 | Assert.That(foundAssetUuids.Count, Is.EqualTo(2)); | ||
111 | Assert.That(foundAssetUuids.ContainsKey(ncAssetId)); | ||
112 | Assert.That(foundAssetUuids.ContainsKey(soAssetId)); | ||
113 | } | ||
88 | } | 114 | } |
89 | } | 115 | } |
diff --git a/OpenSim/Region/Framework/Scenes/UuidGatherer.cs b/OpenSim/Region/Framework/Scenes/UuidGatherer.cs index 8d41f00..313dc99 100644 --- a/OpenSim/Region/Framework/Scenes/UuidGatherer.cs +++ b/OpenSim/Region/Framework/Scenes/UuidGatherer.cs | |||
@@ -62,12 +62,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
62 | /// Used as a temporary store of an asset which represents an object. This can be a null if no appropriate | 62 | /// Used as a temporary store of an asset which represents an object. This can be a null if no appropriate |
63 | /// asset was found by the asset service. | 63 | /// asset was found by the asset service. |
64 | /// </summary> | 64 | /// </summary> |
65 | protected AssetBase m_requestedObjectAsset; | 65 | private AssetBase m_requestedObjectAsset; |
66 | 66 | ||
67 | /// <summary> | 67 | /// <summary> |
68 | /// Signal whether we are currently waiting for the asset service to deliver an asset. | 68 | /// Signal whether we are currently waiting for the asset service to deliver an asset. |
69 | /// </summary> | 69 | /// </summary> |
70 | protected bool m_waitingForObjectAsset; | 70 | private bool m_waitingForObjectAsset; |
71 | 71 | ||
72 | public UuidGatherer(IAssetService assetCache) | 72 | public UuidGatherer(IAssetService assetCache) |
73 | { | 73 | { |
@@ -99,9 +99,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
99 | { | 99 | { |
100 | GetGestureAssetUuids(assetUuid, assetUuids); | 100 | GetGestureAssetUuids(assetUuid, assetUuids); |
101 | } | 101 | } |
102 | else if (AssetType.Notecard == assetType) | ||
103 | { | ||
104 | GetTextEmbeddedAssetUuids(assetUuid, assetUuids); | ||
105 | } | ||
102 | else if (AssetType.LSLText == assetType) | 106 | else if (AssetType.LSLText == assetType) |
103 | { | 107 | { |
104 | GetScriptAssetUuids(assetUuid, assetUuids); | 108 | GetTextEmbeddedAssetUuids(assetUuid, assetUuids); |
105 | } | 109 | } |
106 | else if (AssetType.Object == assetType) | 110 | else if (AssetType.Object == assetType) |
107 | { | 111 | { |
@@ -190,7 +194,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
190 | /// <summary> | 194 | /// <summary> |
191 | /// The callback made when we request the asset for an object from the asset service. | 195 | /// The callback made when we request the asset for an object from the asset service. |
192 | /// </summary> | 196 | /// </summary> |
193 | protected void AssetReceived(string id, Object sender, AssetBase asset) | 197 | private void AssetReceived(string id, Object sender, AssetBase asset) |
194 | { | 198 | { |
195 | lock (this) | 199 | lock (this) |
196 | { | 200 | { |
@@ -234,23 +238,25 @@ namespace OpenSim.Region.Framework.Scenes | |||
234 | /// </summary> | 238 | /// </summary> |
235 | /// <param name="scriptUuid"></param> | 239 | /// <param name="scriptUuid"></param> |
236 | /// <param name="assetUuids">Dictionary in which to record the references</param> | 240 | /// <param name="assetUuids">Dictionary in which to record the references</param> |
237 | protected void GetScriptAssetUuids(UUID scriptUuid, IDictionary<UUID, AssetType> assetUuids) | 241 | private void GetTextEmbeddedAssetUuids(UUID embeddingAssetId, IDictionary<UUID, AssetType> assetUuids) |
238 | { | 242 | { |
239 | AssetBase scriptAsset = GetAsset(scriptUuid); | 243 | m_log.DebugFormat("[ASSET GATHERER]: Getting assets for asset {0}", embeddingAssetId); |
244 | |||
245 | AssetBase embeddingAsset = GetAsset(embeddingAssetId); | ||
240 | 246 | ||
241 | if (null != scriptAsset) | 247 | if (null != embeddingAsset) |
242 | { | 248 | { |
243 | string script = Utils.BytesToString(scriptAsset.Data); | 249 | string script = Utils.BytesToString(embeddingAsset.Data); |
244 | //m_log.DebugFormat("[ARCHIVER]: Script {0}", script); | 250 | m_log.DebugFormat("[ARCHIVER]: Script {0}", script); |
245 | MatchCollection uuidMatches = Util.UUIDPattern.Matches(script); | 251 | MatchCollection uuidMatches = Util.PermissiveUUIDPattern.Matches(script); |
246 | //m_log.DebugFormat("[ARCHIVER]: Found {0} matches in script", uuidMatches.Count); | 252 | m_log.DebugFormat("[ARCHIVER]: Found {0} matches in text", uuidMatches.Count); |
247 | 253 | ||
248 | foreach (Match uuidMatch in uuidMatches) | 254 | foreach (Match uuidMatch in uuidMatches) |
249 | { | 255 | { |
250 | UUID uuid = new UUID(uuidMatch.Value); | 256 | UUID uuid = new UUID(uuidMatch.Value); |
251 | //m_log.DebugFormat("[ARCHIVER]: Recording {0} in script", uuid); | 257 | m_log.DebugFormat("[ARCHIVER]: Recording {0} in text", uuid); |
252 | 258 | ||
253 | // Assume AssetIDs embedded in scripts are textures | 259 | // Assume AssetIDs embedded are textures. |
254 | assetUuids[uuid] = AssetType.Texture; | 260 | assetUuids[uuid] = AssetType.Texture; |
255 | } | 261 | } |
256 | } | 262 | } |
@@ -261,7 +267,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
261 | /// </summary> | 267 | /// </summary> |
262 | /// <param name="wearableAssetUuid"></param> | 268 | /// <param name="wearableAssetUuid"></param> |
263 | /// <param name="assetUuids">Dictionary in which to record the references</param> | 269 | /// <param name="assetUuids">Dictionary in which to record the references</param> |
264 | protected void GetWearableAssetUuids(UUID wearableAssetUuid, IDictionary<UUID, AssetType> assetUuids) | 270 | private void GetWearableAssetUuids(UUID wearableAssetUuid, IDictionary<UUID, AssetType> assetUuids) |
265 | { | 271 | { |
266 | AssetBase assetBase = GetAsset(wearableAssetUuid); | 272 | AssetBase assetBase = GetAsset(wearableAssetUuid); |
267 | 273 | ||
@@ -288,7 +294,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
288 | /// </summary> | 294 | /// </summary> |
289 | /// <param name="sceneObject"></param> | 295 | /// <param name="sceneObject"></param> |
290 | /// <param name="assetUuids"></param> | 296 | /// <param name="assetUuids"></param> |
291 | protected void GetSceneObjectAssetUuids(UUID sceneObjectUuid, IDictionary<UUID, AssetType> assetUuids) | 297 | private void GetSceneObjectAssetUuids(UUID sceneObjectUuid, IDictionary<UUID, AssetType> assetUuids) |
292 | { | 298 | { |
293 | AssetBase objectAsset = GetAsset(sceneObjectUuid); | 299 | AssetBase objectAsset = GetAsset(sceneObjectUuid); |
294 | 300 | ||
@@ -317,7 +323,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
317 | /// </summary> | 323 | /// </summary> |
318 | /// <param name="gestureUuid"></param> | 324 | /// <param name="gestureUuid"></param> |
319 | /// <param name="assetUuids"></param> | 325 | /// <param name="assetUuids"></param> |
320 | protected void GetGestureAssetUuids(UUID gestureUuid, IDictionary<UUID, AssetType> assetUuids) | 326 | private void GetGestureAssetUuids(UUID gestureUuid, IDictionary<UUID, AssetType> assetUuids) |
321 | { | 327 | { |
322 | AssetBase assetBase = GetAsset(gestureUuid); | 328 | AssetBase assetBase = GetAsset(gestureUuid); |
323 | if (null == assetBase) | 329 | if (null == assetBase) |