diff options
author | Mike Mazur | 2009-02-04 00:01:36 +0000 |
---|---|---|
committer | Mike Mazur | 2009-02-04 00:01:36 +0000 |
commit | 0c03a48fb2060eda4d288e2d2ca4e650ce000b4b (patch) | |
tree | a90465075960c92367b0a5e62db3121e4e3a139d /OpenSim/Region/Environment/Modules/World/Archiver | |
parent | * Add another object to the existing save oar test (diff) | |
download | opensim-SC_OLD-0c03a48fb2060eda4d288e2d2ca4e650ce000b4b.zip opensim-SC_OLD-0c03a48fb2060eda4d288e2d2ca4e650ce000b4b.tar.gz opensim-SC_OLD-0c03a48fb2060eda4d288e2d2ca4e650ce000b4b.tar.bz2 opensim-SC_OLD-0c03a48fb2060eda4d288e2d2ca4e650ce000b4b.tar.xz |
- add OpenSim.Framework.AssetMetadata class. AssetBase is now composed of it
- trim trailing whitespace
Diffstat (limited to '')
3 files changed, 33 insertions, 33 deletions
diff --git a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs index 4e9fcef..c860d01 100644 --- a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs +++ b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs | |||
@@ -66,12 +66,12 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver | |||
66 | m_loadStream = new GZipStream(GetStream(loadPath), CompressionMode.Decompress); | 66 | m_loadStream = new GZipStream(GetStream(loadPath), CompressionMode.Decompress); |
67 | m_errorMessage = String.Empty; | 67 | m_errorMessage = String.Empty; |
68 | } | 68 | } |
69 | 69 | ||
70 | public ArchiveReadRequest(Scene scene, Stream loadStream) | 70 | public ArchiveReadRequest(Scene scene, Stream loadStream) |
71 | { | 71 | { |
72 | m_scene = scene; | 72 | m_scene = scene; |
73 | m_loadStream = loadStream; | 73 | m_loadStream = loadStream; |
74 | } | 74 | } |
75 | 75 | ||
76 | /// <summary> | 76 | /// <summary> |
77 | /// Dearchive the region embodied in this request. | 77 | /// Dearchive the region embodied in this request. |
@@ -81,7 +81,7 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver | |||
81 | // The same code can handle dearchiving 0.1 and 0.2 OpenSim Archive versions | 81 | // The same code can handle dearchiving 0.1 and 0.2 OpenSim Archive versions |
82 | DearchiveRegion0DotStar(); | 82 | DearchiveRegion0DotStar(); |
83 | } | 83 | } |
84 | 84 | ||
85 | private void DearchiveRegion0DotStar() | 85 | private void DearchiveRegion0DotStar() |
86 | { | 86 | { |
87 | int successfulAssetRestores = 0; | 87 | int successfulAssetRestores = 0; |
@@ -98,12 +98,12 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver | |||
98 | 98 | ||
99 | byte[] data; | 99 | byte[] data; |
100 | TarArchiveReader.TarEntryType entryType; | 100 | TarArchiveReader.TarEntryType entryType; |
101 | 101 | ||
102 | while ((data = archive.ReadEntry(out filePath, out entryType)) != null) | 102 | while ((data = archive.ReadEntry(out filePath, out entryType)) != null) |
103 | { | 103 | { |
104 | //m_log.DebugFormat( | 104 | //m_log.DebugFormat( |
105 | // "[ARCHIVER]: Successfully read {0} ({1} bytes)}", filePath, data.Length); | 105 | // "[ARCHIVER]: Successfully read {0} ({1} bytes)}", filePath, data.Length); |
106 | if (TarArchiveReader.TarEntryType.TYPE_DIRECTORY == entryType) | 106 | if (TarArchiveReader.TarEntryType.TYPE_DIRECTORY == entryType) |
107 | { | 107 | { |
108 | m_log.WarnFormat("[ARCHIVER]: Ignoring directory entry {0}", | 108 | m_log.WarnFormat("[ARCHIVER]: Ignoring directory entry {0}", |
109 | filePath); | 109 | filePath); |
@@ -133,7 +133,7 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver | |||
133 | LoadRegionSettings(filePath, data); | 133 | LoadRegionSettings(filePath, data); |
134 | } | 134 | } |
135 | } | 135 | } |
136 | 136 | ||
137 | //m_log.Debug("[ARCHIVER]: Reached end of archive"); | 137 | //m_log.Debug("[ARCHIVER]: Reached end of archive"); |
138 | 138 | ||
139 | archive.Close(); | 139 | archive.Close(); |
@@ -154,10 +154,10 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver | |||
154 | m_log.ErrorFormat("[ARCHIVER]: Failed to load {0} assets", failedAssetRestores); | 154 | m_log.ErrorFormat("[ARCHIVER]: Failed to load {0} assets", failedAssetRestores); |
155 | m_errorMessage += String.Format("Failed to load {0} assets", failedAssetRestores); | 155 | m_errorMessage += String.Format("Failed to load {0} assets", failedAssetRestores); |
156 | } | 156 | } |
157 | 157 | ||
158 | m_log.Info("[ARCHIVER]: Clearing all existing scene objects"); | 158 | m_log.Info("[ARCHIVER]: Clearing all existing scene objects"); |
159 | m_scene.DeleteAllSceneObjects(); | 159 | m_scene.DeleteAllSceneObjects(); |
160 | 160 | ||
161 | // Reload serialized prims | 161 | // Reload serialized prims |
162 | m_log.InfoFormat("[ARCHIVER]: Loading {0} scene objects. Please wait.", serialisedSceneObjects.Count); | 162 | m_log.InfoFormat("[ARCHIVER]: Loading {0} scene objects. Please wait.", serialisedSceneObjects.Count); |
163 | 163 | ||
@@ -176,10 +176,10 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver | |||
176 | // Try to retain the original creator/owner/lastowner if their uuid is present on this grid | 176 | // Try to retain the original creator/owner/lastowner if their uuid is present on this grid |
177 | // otherwise, use the master avatar uuid instead | 177 | // otherwise, use the master avatar uuid instead |
178 | UUID masterAvatarId = m_scene.RegionInfo.MasterAvatarAssignedUUID; | 178 | UUID masterAvatarId = m_scene.RegionInfo.MasterAvatarAssignedUUID; |
179 | 179 | ||
180 | if (m_scene.RegionInfo.EstateSettings.EstateOwner != UUID.Zero) | 180 | if (m_scene.RegionInfo.EstateSettings.EstateOwner != UUID.Zero) |
181 | masterAvatarId = m_scene.RegionInfo.EstateSettings.EstateOwner; | 181 | masterAvatarId = m_scene.RegionInfo.EstateSettings.EstateOwner; |
182 | 182 | ||
183 | foreach (SceneObjectPart part in sceneObject.Children.Values) | 183 | foreach (SceneObjectPart part in sceneObject.Children.Values) |
184 | { | 184 | { |
185 | if (!resolveUserUuid(part.CreatorID)) | 185 | if (!resolveUserUuid(part.CreatorID)) |
@@ -233,7 +233,7 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver | |||
233 | { | 233 | { |
234 | sceneObject.CreateScriptInstances(0, true, m_scene.DefaultScriptEngine, 0); | 234 | sceneObject.CreateScriptInstances(0, true, m_scene.DefaultScriptEngine, 0); |
235 | } | 235 | } |
236 | 236 | ||
237 | m_scene.EventManager.TriggerOarFileLoaded(m_errorMessage); | 237 | m_scene.EventManager.TriggerOarFileLoaded(m_errorMessage); |
238 | } | 238 | } |
239 | 239 | ||
@@ -290,12 +290,12 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver | |||
290 | //m_log.DebugFormat("[ARCHIVER]: Importing asset {0}, type {1}", uuid, assetType); | 290 | //m_log.DebugFormat("[ARCHIVER]: Importing asset {0}, type {1}", uuid, assetType); |
291 | 291 | ||
292 | AssetBase asset = new AssetBase(new UUID(uuid), String.Empty); | 292 | AssetBase asset = new AssetBase(new UUID(uuid), String.Empty); |
293 | asset.Type = assetType; | 293 | asset.Metadata.Type = assetType; |
294 | asset.Data = data; | 294 | asset.Data = data; |
295 | 295 | ||
296 | m_scene.AssetCache.AddAsset(asset); | 296 | m_scene.AssetCache.AddAsset(asset); |
297 | 297 | ||
298 | /** | 298 | /** |
299 | * Create layers on decode for image assets. This is likely to significantly increase the time to load archives so | 299 | * Create layers on decode for image assets. This is likely to significantly increase the time to load archives so |
300 | * it might be best done when dearchive takes place on a separate thread | 300 | * it might be best done when dearchive takes place on a separate thread |
301 | if (asset.Type=AssetType.Texture) | 301 | if (asset.Type=AssetType.Texture) |
@@ -317,7 +317,7 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver | |||
317 | return false; | 317 | return false; |
318 | } | 318 | } |
319 | } | 319 | } |
320 | 320 | ||
321 | /// <summary> | 321 | /// <summary> |
322 | /// Load region settings data | 322 | /// Load region settings data |
323 | /// </summary> | 323 | /// </summary> |
@@ -329,7 +329,7 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver | |||
329 | private bool LoadRegionSettings(string settingsPath, byte[] data) | 329 | private bool LoadRegionSettings(string settingsPath, byte[] data) |
330 | { | 330 | { |
331 | RegionSettings loadedRegionSettings; | 331 | RegionSettings loadedRegionSettings; |
332 | 332 | ||
333 | try | 333 | try |
334 | { | 334 | { |
335 | loadedRegionSettings = RegionSettingsSerializer.Deserialize(data); | 335 | loadedRegionSettings = RegionSettingsSerializer.Deserialize(data); |
@@ -337,13 +337,13 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver | |||
337 | catch (Exception e) | 337 | catch (Exception e) |
338 | { | 338 | { |
339 | m_log.ErrorFormat( | 339 | m_log.ErrorFormat( |
340 | "[ARCHIVER]: Could not parse region settings file {0}. Ignoring. Exception was {1}", | 340 | "[ARCHIVER]: Could not parse region settings file {0}. Ignoring. Exception was {1}", |
341 | settingsPath, e); | 341 | settingsPath, e); |
342 | return false; | 342 | return false; |
343 | } | 343 | } |
344 | 344 | ||
345 | RegionSettings currentRegionSettings = m_scene.RegionInfo.RegionSettings; | 345 | RegionSettings currentRegionSettings = m_scene.RegionInfo.RegionSettings; |
346 | 346 | ||
347 | currentRegionSettings.AgentLimit = loadedRegionSettings.AgentLimit; | 347 | currentRegionSettings.AgentLimit = loadedRegionSettings.AgentLimit; |
348 | currentRegionSettings.AllowDamage = loadedRegionSettings.AllowDamage; | 348 | currentRegionSettings.AllowDamage = loadedRegionSettings.AllowDamage; |
349 | currentRegionSettings.AllowLandJoinDivide = loadedRegionSettings.AllowLandJoinDivide; | 349 | currentRegionSettings.AllowLandJoinDivide = loadedRegionSettings.AllowLandJoinDivide; |
@@ -373,10 +373,10 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver | |||
373 | currentRegionSettings.TerrainTexture4 = loadedRegionSettings.TerrainTexture4; | 373 | currentRegionSettings.TerrainTexture4 = loadedRegionSettings.TerrainTexture4; |
374 | currentRegionSettings.UseEstateSun = loadedRegionSettings.UseEstateSun; | 374 | currentRegionSettings.UseEstateSun = loadedRegionSettings.UseEstateSun; |
375 | currentRegionSettings.WaterHeight = loadedRegionSettings.WaterHeight; | 375 | currentRegionSettings.WaterHeight = loadedRegionSettings.WaterHeight; |
376 | 376 | ||
377 | IEstateModule estateModule = m_scene.RequestModuleInterface<IEstateModule>(); | 377 | IEstateModule estateModule = m_scene.RequestModuleInterface<IEstateModule>(); |
378 | estateModule.sendRegionHandshakeToAll(); | 378 | estateModule.sendRegionHandshakeToAll(); |
379 | 379 | ||
380 | return true; | 380 | return true; |
381 | } | 381 | } |
382 | 382 | ||
@@ -411,11 +411,11 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver | |||
411 | if (File.Exists(path)) | 411 | if (File.Exists(path)) |
412 | { | 412 | { |
413 | return new FileStream(path, FileMode.Open); | 413 | return new FileStream(path, FileMode.Open); |
414 | } | 414 | } |
415 | else | 415 | else |
416 | { | 416 | { |
417 | Uri uri = new Uri(path); // throw exception if not valid URI | 417 | Uri uri = new Uri(path); // throw exception if not valid URI |
418 | if (uri.Scheme == "file") | 418 | if (uri.Scheme == "file") |
419 | { | 419 | { |
420 | return new FileStream(uri.AbsolutePath, FileMode.Open); | 420 | return new FileStream(uri.AbsolutePath, FileMode.Open); |
421 | } | 421 | } |
diff --git a/OpenSim/Region/Environment/Modules/World/Archiver/AssetsArchiver.cs b/OpenSim/Region/Environment/Modules/World/Archiver/AssetsArchiver.cs index 75ae474..36a60f3 100644 --- a/OpenSim/Region/Environment/Modules/World/Archiver/AssetsArchiver.cs +++ b/OpenSim/Region/Environment/Modules/World/Archiver/AssetsArchiver.cs | |||
@@ -86,16 +86,16 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver | |||
86 | 86 | ||
87 | string extension = string.Empty; | 87 | string extension = string.Empty; |
88 | 88 | ||
89 | if (ArchiveConstants.ASSET_TYPE_TO_EXTENSION.ContainsKey(asset.Type)) | 89 | if (ArchiveConstants.ASSET_TYPE_TO_EXTENSION.ContainsKey(asset.Metadata.Type)) |
90 | { | 90 | { |
91 | extension = ArchiveConstants.ASSET_TYPE_TO_EXTENSION[asset.Type]; | 91 | extension = ArchiveConstants.ASSET_TYPE_TO_EXTENSION[asset.Metadata.Type]; |
92 | } | 92 | } |
93 | 93 | ||
94 | xtw.WriteElementString("filename", uuid.ToString() + extension); | 94 | xtw.WriteElementString("filename", uuid.ToString() + extension); |
95 | 95 | ||
96 | xtw.WriteElementString("name", asset.Name); | 96 | xtw.WriteElementString("name", asset.Metadata.Name); |
97 | xtw.WriteElementString("description", asset.Description); | 97 | xtw.WriteElementString("description", asset.Metadata.Description); |
98 | xtw.WriteElementString("asset-type", asset.Type.ToString()); | 98 | xtw.WriteElementString("asset-type", asset.Metadata.Type.ToString()); |
99 | 99 | ||
100 | xtw.WriteEndElement(); | 100 | xtw.WriteEndElement(); |
101 | } | 101 | } |
@@ -123,15 +123,15 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver | |||
123 | 123 | ||
124 | string extension = string.Empty; | 124 | string extension = string.Empty; |
125 | 125 | ||
126 | if (ArchiveConstants.ASSET_TYPE_TO_EXTENSION.ContainsKey(asset.Type)) | 126 | if (ArchiveConstants.ASSET_TYPE_TO_EXTENSION.ContainsKey(asset.Metadata.Type)) |
127 | { | 127 | { |
128 | extension = ArchiveConstants.ASSET_TYPE_TO_EXTENSION[asset.Type]; | 128 | extension = ArchiveConstants.ASSET_TYPE_TO_EXTENSION[asset.Metadata.Type]; |
129 | } | 129 | } |
130 | else | 130 | else |
131 | { | 131 | { |
132 | m_log.ErrorFormat( | 132 | m_log.ErrorFormat( |
133 | "[ARCHIVER]: Unrecognized asset type {0} with uuid {1}. This asset will be saved but not reloaded", | 133 | "[ARCHIVER]: Unrecognized asset type {0} with uuid {1}. This asset will be saved but not reloaded", |
134 | asset.Type, asset.ID); | 134 | asset.Metadata.Type, asset.Metadata.ID); |
135 | } | 135 | } |
136 | 136 | ||
137 | archive.AddFile( | 137 | archive.AddFile( |
diff --git a/OpenSim/Region/Environment/Modules/World/Archiver/AssetsDearchiver.cs b/OpenSim/Region/Environment/Modules/World/Archiver/AssetsDearchiver.cs index b26fe4c..0ef1e1d 100644 --- a/OpenSim/Region/Environment/Modules/World/Archiver/AssetsDearchiver.cs +++ b/OpenSim/Region/Environment/Modules/World/Archiver/AssetsDearchiver.cs | |||
@@ -157,8 +157,8 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver | |||
157 | m_log.DebugFormat("[ARCHIVER]: Importing asset {0}", filename); | 157 | m_log.DebugFormat("[ARCHIVER]: Importing asset {0}", filename); |
158 | 158 | ||
159 | AssetBase asset = new AssetBase(new UUID(filename), metadata.Name); | 159 | AssetBase asset = new AssetBase(new UUID(filename), metadata.Name); |
160 | asset.Description = metadata.Description; | 160 | asset.Metadata.Description = metadata.Description; |
161 | asset.Type = metadata.AssetType; | 161 | asset.Metadata.Type = metadata.AssetType; |
162 | asset.Data = data; | 162 | asset.Data = data; |
163 | 163 | ||
164 | m_cache.AddAsset(asset); | 164 | m_cache.AddAsset(asset); |