aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules
diff options
context:
space:
mode:
authorJohn Hurliman2010-03-15 14:17:17 -0700
committerJohn Hurliman2010-03-15 14:17:17 -0700
commit33f5d0d1e90c3e63e06a200043a01c32768335c1 (patch)
tree8be352ceace25400a51c3a26ca1c2ce654788e55 /OpenSim/Region/CoreModules
parentMerge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff)
downloadopensim-SC_OLD-33f5d0d1e90c3e63e06a200043a01c32768335c1.zip
opensim-SC_OLD-33f5d0d1e90c3e63e06a200043a01c32768335c1.tar.gz
opensim-SC_OLD-33f5d0d1e90c3e63e06a200043a01c32768335c1.tar.bz2
opensim-SC_OLD-33f5d0d1e90c3e63e06a200043a01c32768335c1.tar.xz
* UuidGatherer now tracks asset types for assets it discovers. The asset types are inferred from context
* OAR saving will attempt to correct unknown asset types before writing broken assets to the OAR file
Diffstat (limited to 'OpenSim/Region/CoreModules')
-rw-r--r--OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs2
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs4
-rw-r--r--OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs4
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs14
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs23
5 files changed, 30 insertions, 17 deletions
diff --git a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs
index 967c0a1..37cdaae 100644
--- a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs
+++ b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs
@@ -642,7 +642,7 @@ namespace Flotsam.RegionModules.AssetCache
642 { 642 {
643 UuidGatherer gatherer = new UuidGatherer(m_AssetService); 643 UuidGatherer gatherer = new UuidGatherer(m_AssetService);
644 644
645 Dictionary<UUID, int> assets = new Dictionary<UUID, int>(); 645 Dictionary<UUID, AssetType> assets = new Dictionary<UUID, AssetType>();
646 foreach (Scene s in m_Scenes) 646 foreach (Scene s in m_Scenes)
647 { 647 {
648 StampRegionStatusFile(s.RegionInfo.RegionID); 648 StampRegionStatusFile(s.RegionInfo.RegionID);
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs
index ef10104..cfe3caa 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs
@@ -73,7 +73,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
73 /// <value> 73 /// <value>
74 /// Used to collect the uuids of the assets that we need to save into the archive 74 /// Used to collect the uuids of the assets that we need to save into the archive
75 /// </value> 75 /// </value>
76 protected Dictionary<UUID, int> m_assetUuids = new Dictionary<UUID, int>(); 76 protected Dictionary<UUID, AssetType> m_assetUuids = new Dictionary<UUID, AssetType>();
77 77
78 /// <value> 78 /// <value>
79 /// Used to collect the uuids of the users that we need to save into the archive 79 /// Used to collect the uuids of the users that we need to save into the archive
@@ -305,7 +305,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
305 } 305 }
306 306
307 new AssetsRequest( 307 new AssetsRequest(
308 new AssetsArchiver(m_archiveWriter), m_assetUuids.Keys, 308 new AssetsArchiver(m_archiveWriter), m_assetUuids,
309 m_scene.AssetService, ReceivedAllAssets).Execute(); 309 m_scene.AssetService, ReceivedAllAssets).Execute();
310 } 310 }
311 311
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs
index 664f38d..58ce550 100644
--- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs
+++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs
@@ -150,7 +150,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
150 if (asset != null) 150 if (asset != null)
151 { 151 {
152 // OK, now fetch the inside. 152 // OK, now fetch the inside.
153 Dictionary<UUID, int> ids = new Dictionary<UUID, int>(); 153 Dictionary<UUID, AssetType> ids = new Dictionary<UUID, AssetType>();
154 HGUuidGatherer uuidGatherer = new HGUuidGatherer(this, m_scene.AssetService, userAssetURL); 154 HGUuidGatherer uuidGatherer = new HGUuidGatherer(this, m_scene.AssetService, userAssetURL);
155 uuidGatherer.GatherAssetUuids(asset.FullID, (AssetType)asset.Type, ids); 155 uuidGatherer.GatherAssetUuids(asset.FullID, (AssetType)asset.Type, ids);
156 foreach (UUID uuid in ids.Keys) 156 foreach (UUID uuid in ids.Keys)
@@ -173,7 +173,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
173 AssetBase asset = m_scene.AssetService.Get(assetID.ToString()); 173 AssetBase asset = m_scene.AssetService.Get(assetID.ToString());
174 if (asset != null) 174 if (asset != null)
175 { 175 {
176 Dictionary<UUID, int> ids = new Dictionary<UUID, int>(); 176 Dictionary<UUID, AssetType> ids = new Dictionary<UUID, AssetType>();
177 HGUuidGatherer uuidGatherer = new HGUuidGatherer(this, m_scene.AssetService, string.Empty); 177 HGUuidGatherer uuidGatherer = new HGUuidGatherer(this, m_scene.AssetService, string.Empty);
178 uuidGatherer.GatherAssetUuids(asset.FullID, (AssetType)asset.Type, ids); 178 uuidGatherer.GatherAssetUuids(asset.FullID, (AssetType)asset.Type, ids);
179 foreach (UUID uuid in ids.Keys) 179 foreach (UUID uuid in ids.Keys)
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs
index b61b341..b25636f 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs
@@ -100,7 +100,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
100 /// <exception cref="System.IO.IOException">if there was an io problem with creating the file</exception> 100 /// <exception cref="System.IO.IOException">if there was an io problem with creating the file</exception>
101 public void ArchiveRegion() 101 public void ArchiveRegion()
102 { 102 {
103 Dictionary<UUID, int> assetUuids = new Dictionary<UUID, int>(); 103 Dictionary<UUID, AssetType> assetUuids = new Dictionary<UUID, AssetType>();
104 104
105 List<EntityBase> entities = m_scene.GetEntities(); 105 List<EntityBase> entities = m_scene.GetEntities();
106 List<SceneObjectGroup> sceneObjects = new List<SceneObjectGroup>(); 106 List<SceneObjectGroup> sceneObjects = new List<SceneObjectGroup>();
@@ -142,18 +142,18 @@ namespace OpenSim.Region.CoreModules.World.Archiver
142 142
143 // Make sure that we also request terrain texture assets 143 // Make sure that we also request terrain texture assets
144 RegionSettings regionSettings = m_scene.RegionInfo.RegionSettings; 144 RegionSettings regionSettings = m_scene.RegionInfo.RegionSettings;
145 145
146 if (regionSettings.TerrainTexture1 != RegionSettings.DEFAULT_TERRAIN_TEXTURE_1) 146 if (regionSettings.TerrainTexture1 != RegionSettings.DEFAULT_TERRAIN_TEXTURE_1)
147 assetUuids[regionSettings.TerrainTexture1] = 1; 147 assetUuids[regionSettings.TerrainTexture1] = AssetType.Texture;
148 148
149 if (regionSettings.TerrainTexture2 != RegionSettings.DEFAULT_TERRAIN_TEXTURE_2) 149 if (regionSettings.TerrainTexture2 != RegionSettings.DEFAULT_TERRAIN_TEXTURE_2)
150 assetUuids[regionSettings.TerrainTexture2] = 1; 150 assetUuids[regionSettings.TerrainTexture2] = AssetType.Texture;
151 151
152 if (regionSettings.TerrainTexture3 != RegionSettings.DEFAULT_TERRAIN_TEXTURE_3) 152 if (regionSettings.TerrainTexture3 != RegionSettings.DEFAULT_TERRAIN_TEXTURE_3)
153 assetUuids[regionSettings.TerrainTexture3] = 1; 153 assetUuids[regionSettings.TerrainTexture3] = AssetType.Texture;
154 154
155 if (regionSettings.TerrainTexture4 != RegionSettings.DEFAULT_TERRAIN_TEXTURE_4) 155 if (regionSettings.TerrainTexture4 != RegionSettings.DEFAULT_TERRAIN_TEXTURE_4)
156 assetUuids[regionSettings.TerrainTexture4] = 1; 156 assetUuids[regionSettings.TerrainTexture4] = AssetType.Texture;
157 157
158 TarArchiveWriter archiveWriter = new TarArchiveWriter(m_saveStream); 158 TarArchiveWriter archiveWriter = new TarArchiveWriter(m_saveStream);
159 159
@@ -168,7 +168,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
168 m_requestId); 168 m_requestId);
169 169
170 new AssetsRequest( 170 new AssetsRequest(
171 new AssetsArchiver(archiveWriter), assetUuids.Keys, 171 new AssetsArchiver(archiveWriter), assetUuids,
172 m_scene.AssetService, awre.ReceivedAllAssets).Execute(); 172 m_scene.AssetService, awre.ReceivedAllAssets).Execute();
173 } 173 }
174 } 174 }
diff --git a/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs
index c9fce91..4215f97 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs
@@ -74,7 +74,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
74 /// <value> 74 /// <value>
75 /// uuids to request 75 /// uuids to request
76 /// </value> 76 /// </value>
77 protected ICollection<UUID> m_uuids; 77 protected IDictionary<UUID, AssetType> m_uuids;
78 78
79 /// <value> 79 /// <value>
80 /// Callback used when all the assets requested have been received. 80 /// Callback used when all the assets requested have been received.
@@ -104,7 +104,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
104 protected AssetsArchiver m_assetsArchiver; 104 protected AssetsArchiver m_assetsArchiver;
105 105
106 protected internal AssetsRequest( 106 protected internal AssetsRequest(
107 AssetsArchiver assetsArchiver, ICollection<UUID> uuids, 107 AssetsArchiver assetsArchiver, IDictionary<UUID, AssetType> uuids,
108 IAssetService assetService, AssetsRequestCallback assetsRequestCallback) 108 IAssetService assetService, AssetsRequestCallback assetsRequestCallback)
109 { 109 {
110 m_assetsArchiver = assetsArchiver; 110 m_assetsArchiver = assetsArchiver;
@@ -132,9 +132,9 @@ namespace OpenSim.Region.CoreModules.World.Archiver
132 return; 132 return;
133 } 133 }
134 134
135 foreach (UUID uuid in m_uuids) 135 foreach (KeyValuePair<UUID, AssetType> kvp in m_uuids)
136 { 136 {
137 m_assetService.Get(uuid.ToString(), this, AssetRequestCallback); 137 m_assetService.Get(kvp.Key.ToString(), kvp.Value, PreAssetRequestCallback);
138 } 138 }
139 139
140 m_requestCallbackTimer.Enabled = true; 140 m_requestCallbackTimer.Enabled = true;
@@ -157,7 +157,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
157 // Calculate which uuids were not found. This is an expensive way of doing it, but this is a failure 157 // Calculate which uuids were not found. This is an expensive way of doing it, but this is a failure
158 // case anyway. 158 // case anyway.
159 List<UUID> uuids = new List<UUID>(); 159 List<UUID> uuids = new List<UUID>();
160 foreach (UUID uuid in m_uuids) 160 foreach (UUID uuid in m_uuids.Keys)
161 { 161 {
162 uuids.Add(uuid); 162 uuids.Add(uuid);
163 } 163 }
@@ -200,6 +200,19 @@ namespace OpenSim.Region.CoreModules.World.Archiver
200 } 200 }
201 } 201 }
202 202
203 protected void PreAssetRequestCallback(string fetchedAssetID, object assetType, AssetBase fetchedAsset)
204 {
205 // Check for broken asset types and fix them with the AssetType gleaned by UuidGatherer
206 if (fetchedAsset != null && fetchedAsset.Type == (sbyte)AssetType.Unknown)
207 {
208 AssetType type = (AssetType)assetType;
209 m_log.InfoFormat("[ARCHIVER]: Rewriting broken asset type for {0} to {1}", fetchedAsset.ID, type);
210 fetchedAsset.Type = (sbyte)type;
211 }
212
213 AssetRequestCallback(fetchedAssetID, this, fetchedAsset);
214 }
215
203 /// <summary> 216 /// <summary>
204 /// Called back by the asset cache when it has the asset 217 /// Called back by the asset cache when it has the asset
205 /// </summary> 218 /// </summary>