aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Modules/World
diff options
context:
space:
mode:
authorMike Mazur2009-02-04 00:01:36 +0000
committerMike Mazur2009-02-04 00:01:36 +0000
commit0c03a48fb2060eda4d288e2d2ca4e650ce000b4b (patch)
treea90465075960c92367b0a5e62db3121e4e3a139d /OpenSim/Region/Environment/Modules/World
parent* Add another object to the existing save oar test (diff)
downloadopensim-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 'OpenSim/Region/Environment/Modules/World')
-rw-r--r--OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs46
-rw-r--r--OpenSim/Region/Environment/Modules/World/Archiver/AssetsArchiver.cs16
-rw-r--r--OpenSim/Region/Environment/Modules/World/Archiver/AssetsDearchiver.cs4
-rw-r--r--OpenSim/Region/Environment/Modules/World/Estate/EstateTerrainXferHandler.cs28
4 files changed, 47 insertions, 47 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);
diff --git a/OpenSim/Region/Environment/Modules/World/Estate/EstateTerrainXferHandler.cs b/OpenSim/Region/Environment/Modules/World/Estate/EstateTerrainXferHandler.cs
index 6d69443..2ba4e34 100644
--- a/OpenSim/Region/Environment/Modules/World/Estate/EstateTerrainXferHandler.cs
+++ b/OpenSim/Region/Environment/Modules/World/Estate/EstateTerrainXferHandler.cs
@@ -37,13 +37,13 @@ using OpenSim.Region.Environment.Scenes;
37 37
38namespace OpenSim.Region.Environment.Modules.World.Estate 38namespace OpenSim.Region.Environment.Modules.World.Estate
39{ 39{
40 40
41 public class EstateTerrainXferHandler 41 public class EstateTerrainXferHandler
42 { 42 {
43 //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 43 //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
44 44
45 private AssetBase m_asset; 45 private AssetBase m_asset;
46 46
47 public delegate void TerrainUploadComplete(string name, byte[] filedata, IClientAPI remoteClient); 47 public delegate void TerrainUploadComplete(string name, byte[] filedata, IClientAPI remoteClient);
48 48
49 public event TerrainUploadComplete TerrainUploadDone; 49 public event TerrainUploadComplete TerrainUploadDone;
@@ -52,21 +52,21 @@ namespace OpenSim.Region.Environment.Modules.World.Estate
52 //private string m_name = String.Empty; 52 //private string m_name = String.Empty;
53 //private UUID TransactionID = UUID.Zero; 53 //private UUID TransactionID = UUID.Zero;
54 private sbyte type = 0; 54 private sbyte type = 0;
55 55
56 public ulong mXferID; 56 public ulong mXferID;
57 private TerrainUploadComplete handlerTerrainUploadDone; 57 private TerrainUploadComplete handlerTerrainUploadDone;
58 58
59 public EstateTerrainXferHandler(IClientAPI pRemoteClient, string pClientFilename) 59 public EstateTerrainXferHandler(IClientAPI pRemoteClient, string pClientFilename)
60 { 60 {
61 61
62 m_asset = new AssetBase(); 62 m_asset = new AssetBase();
63 m_asset.FullID = UUID.Zero; 63 m_asset.Metadata.FullID = UUID.Zero;
64 m_asset.Type = type; 64 m_asset.Metadata.Type = type;
65 m_asset.Data = new byte[0]; 65 m_asset.Data = new byte[0];
66 m_asset.Name = pClientFilename; 66 m_asset.Metadata.Name = pClientFilename;
67 m_asset.Description = "empty"; 67 m_asset.Metadata.Description = "empty";
68 m_asset.Local = true; 68 m_asset.Metadata.Local = true;
69 m_asset.Temporary = true; 69 m_asset.Metadata.Temporary = true;
70 70
71 } 71 }
72 72
@@ -78,7 +78,7 @@ namespace OpenSim.Region.Environment.Modules.World.Estate
78 public void RequestStartXfer(IClientAPI pRemoteClient) 78 public void RequestStartXfer(IClientAPI pRemoteClient)
79 { 79 {
80 mXferID = Util.GetNextXferID(); 80 mXferID = Util.GetNextXferID();
81 pRemoteClient.SendXferRequest(mXferID, m_asset.Type, m_asset.FullID, 0, Utils.StringToBytes(m_asset.Name)); 81 pRemoteClient.SendXferRequest(mXferID, m_asset.Metadata.Type, m_asset.Metadata.FullID, 0, Utils.StringToBytes(m_asset.Metadata.Name));
82 } 82 }
83 83
84 /// <summary> 84 /// <summary>
@@ -86,7 +86,7 @@ namespace OpenSim.Region.Environment.Modules.World.Estate
86 /// </summary> 86 /// </summary>
87 /// <param name="xferID"></param> 87 /// <param name="xferID"></param>
88 /// <param name="packetID"></param> 88 /// <param name="packetID"></param>
89 /// <param name="data"></param> 89 /// <param name="data"></param>
90 public void XferReceive(IClientAPI remoteClient, ulong xferID, uint packetID, byte[] data) 90 public void XferReceive(IClientAPI remoteClient, ulong xferID, uint packetID, byte[] data)
91 { 91 {
92 if (mXferID == xferID) 92 if (mXferID == xferID)
@@ -110,7 +110,7 @@ namespace OpenSim.Region.Environment.Modules.World.Estate
110 if ((packetID & 0x80000000) != 0) 110 if ((packetID & 0x80000000) != 0)
111 { 111 {
112 SendCompleteMessage(remoteClient); 112 SendCompleteMessage(remoteClient);
113 113
114 } 114 }
115 } 115 }
116 } 116 }
@@ -120,7 +120,7 @@ namespace OpenSim.Region.Environment.Modules.World.Estate
120 handlerTerrainUploadDone = TerrainUploadDone; 120 handlerTerrainUploadDone = TerrainUploadDone;
121 if (handlerTerrainUploadDone != null) 121 if (handlerTerrainUploadDone != null)
122 { 122 {
123 handlerTerrainUploadDone(m_asset.Name,m_asset.Data, remoteClient); 123 handlerTerrainUploadDone(m_asset.Metadata.Name, m_asset.Data, remoteClient);
124 } 124 }
125 } 125 }
126 } 126 }