From 76c0935ec744f2d230489398f879eb7f42b11d37 Mon Sep 17 00:00:00 2001 From: Mike Mazur Date: Tue, 17 Feb 2009 01:36:44 +0000 Subject: [PATCH] - remove the Metadata property from AssetBase and return all previous properties as before - prefix private variables with m_ in AssetBase.cs - related to Mantis #3122, as mentioned in https://lists.berlios.de/pipermail/opensim-dev/2009-February/005088.html - all services will likely need to be upgraded after this commit --- .../Rest/Inventory/RestAssetServices.cs | 56 +++--- .../Rest/Inventory/RestInventoryServices.cs | 24 +-- OpenSim/Data/MSSQL/MSSQLAssetData.cs | 40 ++-- OpenSim/Data/MySQL/MySQLAssetData.cs | 34 ++-- .../Data/NHibernate/NHibernateAssetData.cs | 6 +- .../NHibernate/Resources/AssetBase.hbm.xml | 18 +- OpenSim/Data/SQLite/SQLiteAssetData.cs | 46 ++--- OpenSim/Data/Tests/BasicAssetTest.cs | 12 +- OpenSim/Framework/AssetBase.cs | 188 +++++++++++------- OpenSim/Framework/AssetLandmark.cs | 8 +- .../Filesystem/AssetLoaderFileSystem.cs | 2 +- .../Communications/Cache/AssetCache.cs | 46 ++--- .../Cache/CryptoGridAssetClient.cs | 18 +- .../Communications/Cache/FileAssetClient.cs | 4 +- .../Communications/Cache/GridAssetClient.cs | 2 +- .../Communications/Capabilities/Caps.cs | 8 +- .../OpenSim/OpenSimAssetStoragePlugin.cs | 2 +- .../Simple/SimpleAssetStoragePlugin.cs | 15 +- OpenSim/Grid/AssetServer/RestService.cs | 2 +- .../ClientStack/LindenUDP/LLClientView.cs | 2 +- .../ClientStack/LindenUDP/LLFileTransfer.cs | 22 +- .../ClientStack/LindenUDP/LLImageManager.cs | 2 +- .../Hypergrid/HGGridServices.cs | 6 +- .../AgentAssetsTransactions.cs | 20 +- .../AssetTransaction/AssetXferUploader.cs | 26 +-- .../Agent/TextureSender/TextureSender.cs | 12 +- .../Archiver/InventoryArchiveReadRequest.cs | 2 +- .../DynamicTexture/DynamicTextureModule.cs | 18 +- .../Scripting/EMailModules/EmailModule.cs | 2 - .../World/Archiver/ArchiveReadRequest.cs | 2 +- .../World/Archiver/AssetsArchiver.cs | 16 +- .../World/Archiver/AssetsDearchiver.cs | 4 +- .../World/Estate/EstateTerrainXferHandler.cs | 16 +- .../World/WorldMap/WorldMapModule.cs | 10 +- .../Scenes/Hypergrid/HGAssetMapper.cs | 28 +-- .../Framework/Scenes/Scene.Inventory.cs | 54 ++--- OpenSim/Region/Framework/Scenes/Scene.cs | 8 +- .../Shared/Api/Implementation/OSSL_Api.cs | 14 +- 38 files changed, 415 insertions(+), 380 deletions(-) diff --git a/OpenSim/ApplicationPlugins/Rest/Inventory/RestAssetServices.cs b/OpenSim/ApplicationPlugins/Rest/Inventory/RestAssetServices.cs index 299603080d..3475d3237b 100644 --- a/OpenSim/ApplicationPlugins/Rest/Inventory/RestAssetServices.cs +++ b/OpenSim/ApplicationPlugins/Rest/Inventory/RestAssetServices.cs @@ -212,12 +212,12 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory rdata.writer.WriteStartElement(String.Empty,"Asset",String.Empty); - rdata.writer.WriteAttributeString("id", asset.Metadata.ID); - rdata.writer.WriteAttributeString("name", asset.Metadata.Name); - rdata.writer.WriteAttributeString("desc", asset.Metadata.Description); - rdata.writer.WriteAttributeString("type", asset.Metadata.Type.ToString()); - rdata.writer.WriteAttributeString("local", asset.Metadata.Local.ToString()); - rdata.writer.WriteAttributeString("temporary", asset.Metadata.Temporary.ToString()); + rdata.writer.WriteAttributeString("id", asset.ID); + rdata.writer.WriteAttributeString("name", asset.Name); + rdata.writer.WriteAttributeString("desc", asset.Description); + rdata.writer.WriteAttributeString("type", asset.Type.ToString()); + rdata.writer.WriteAttributeString("local", asset.Local.ToString()); + rdata.writer.WriteAttributeString("temporary", asset.Temporary.ToString()); rdata.writer.WriteBase64(asset.Data,0,asset.Data.Length); @@ -268,19 +268,19 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory modified = (asset != null); created = !modified; - asset = new AssetBase(); - asset.Metadata.FullID = uuid; - asset.Metadata.Name = xml.GetAttribute("name"); - asset.Metadata.Description = xml.GetAttribute("desc"); - asset.Metadata.Type = SByte.Parse(xml.GetAttribute("type")); - asset.Metadata.Local = Int32.Parse(xml.GetAttribute("local")) != 0; - asset.Metadata.Temporary = Int32.Parse(xml.GetAttribute("temporary")) != 0; - asset.Data = Convert.FromBase64String(xml.ReadElementContentAsString("Asset", "")); + asset = new AssetBase(); + asset.FullID = uuid; + asset.Name = xml.GetAttribute("name"); + asset.Description = xml.GetAttribute("desc"); + asset.Type = SByte.Parse(xml.GetAttribute("type")); + asset.Local = Int32.Parse(xml.GetAttribute("local")) != 0; + asset.Temporary = Int32.Parse(xml.GetAttribute("temporary")) != 0; + asset.Data = Convert.FromBase64String(xml.ReadElementContentAsString("Asset", "")); - if (asset.Metadata.ID != rdata.Parameters[0]) + if (asset.ID != rdata.Parameters[0]) { Rest.Log.WarnFormat("{0} URI and payload disagree on UUID U:{1} vs P:{2}", - MsgId, rdata.Parameters[0], asset.Metadata.ID); + MsgId, rdata.Parameters[0], asset.ID); } Rest.AssetServices.AddAsset(asset); @@ -294,14 +294,14 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory if (created) { - rdata.appendStatus(String.Format("

Created asset {0}, UUID {1}

", asset.Metadata.Name, asset.Metadata.FullID)); + rdata.appendStatus(String.Format("

Created asset {0}, UUID {1}

", asset.Name, asset.FullID)); rdata.Complete(Rest.HttpStatusCodeCreated); } else { if (modified) { - rdata.appendStatus(String.Format("

Modified asset {0}, UUID {1}

", asset.Metadata.Name, asset.Metadata.FullID)); + rdata.appendStatus(String.Format("

Modified asset {0}, UUID {1}

", asset.Name, asset.FullID)); rdata.Complete(Rest.HttpStatusCodeOK); } else @@ -348,27 +348,27 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory modified = (asset != null); created = !modified; - asset = new AssetBase(); - asset.Metadata.FullID = uuid; - asset.Metadata.Name = xml.GetAttribute("name"); - asset.Metadata.Description = xml.GetAttribute("desc"); - asset.Metadata.Type = SByte.Parse(xml.GetAttribute("type")); - asset.Metadata.Local = Int32.Parse(xml.GetAttribute("local")) != 0; - asset.Metadata.Temporary = Int32.Parse(xml.GetAttribute("temporary")) != 0; - asset.Data = Convert.FromBase64String(xml.ReadElementContentAsString("Asset", "")); + asset = new AssetBase(); + asset.FullID = uuid; + asset.Name = xml.GetAttribute("name"); + asset.Description = xml.GetAttribute("desc"); + asset.Type = SByte.Parse(xml.GetAttribute("type")); + asset.Local = Int32.Parse(xml.GetAttribute("local")) != 0; + asset.Temporary = Int32.Parse(xml.GetAttribute("temporary")) != 0; + asset.Data = Convert.FromBase64String(xml.ReadElementContentAsString("Asset", "")); Rest.AssetServices.AddAsset(asset); if (created) { - rdata.appendStatus(String.Format("

Created asset {0}, UUID {1}

", asset.Metadata.Name, asset.Metadata.FullID)); + rdata.appendStatus(String.Format("

Created asset {0}, UUID {1}

", asset.Name, asset.FullID)); rdata.Complete(Rest.HttpStatusCodeCreated); } else { if (modified) { - rdata.appendStatus(String.Format("

Modified asset {0}, UUID {1}

", asset.Metadata.Name, asset.Metadata.FullID)); + rdata.appendStatus(String.Format("

Modified asset {0}, UUID {1}

", asset.Name, asset.FullID)); rdata.Complete(Rest.HttpStatusCodeOK); } else diff --git a/OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs b/OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs index 853b0043e4..99350461a5 100644 --- a/OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs +++ b/OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs @@ -488,12 +488,12 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory foreach (AssetBase asset in entity.Assets) { Rest.Log.DebugFormat("{0} Rest asset: {1} {2} {3}", - MsgId, asset.Metadata.ID, asset.Metadata.Type, asset.Metadata.Name); + MsgId, asset.ID, asset.Type, asset.Name); Rest.AssetServices.AddAsset(asset); created = true; rdata.appendStatus(String.Format("

Created asset {0}, UUID {1}

", - asset.Metadata.Name, asset.Metadata.ID)); + asset.Name, asset.ID)); if (Rest.DEBUG && Rest.DumpAsset) { @@ -691,14 +691,14 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory foreach (AssetBase asset in entity.Assets) { Rest.Log.DebugFormat("{0} Rest asset: {1} {2} {3}", - MsgId, asset.Metadata.ID, asset.Metadata.Type, asset.Metadata.Name); + MsgId, asset.ID, asset.Type, asset.Name); // The asset was validated during the collection process Rest.AssetServices.AddAsset(asset); created = true; - rdata.appendStatus(String.Format("

Created asset {0}, UUID {1}

", asset.Metadata.Name, asset.Metadata.ID)); + rdata.appendStatus(String.Format("

Created asset {0}, UUID {1}

", asset.Name, asset.ID)); if (Rest.DEBUG && Rest.DumpAsset) { @@ -1884,10 +1884,10 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory asset = new AssetBase(uuid, name); - asset.Metadata.Description = desc; - asset.Metadata.Type = type; // type == 0 == texture - asset.Metadata.Local = local; - asset.Metadata.Temporary = temp; + asset.Description = desc; + asset.Type = type; // type == 0 == texture + asset.Local = local; + asset.Temporary = temp; b64string = ic.xml.ReadElementContentAsString(); @@ -2039,10 +2039,10 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory if (ic.Asset != null) { - if (ic.Asset.Metadata.Name == String.Empty) - ic.Asset.Metadata.Name = ic.Item.Name; - if (ic.Asset.Metadata.Description == String.Empty) - ic.Asset.Metadata.Description = ic.Item.Description; + if (ic.Asset.Name == String.Empty) + ic.Asset.Name = ic.Item.Name; + if (ic.Asset.Description == String.Empty) + ic.Asset.Description = ic.Item.Description; } // Assign permissions diff --git a/OpenSim/Data/MSSQL/MSSQLAssetData.cs b/OpenSim/Data/MSSQL/MSSQLAssetData.cs index 27deef70f3..0361a7d5b4 100644 --- a/OpenSim/Data/MSSQL/MSSQLAssetData.cs +++ b/OpenSim/Data/MSSQL/MSSQLAssetData.cs @@ -132,12 +132,12 @@ namespace OpenSim.Data.MSSQL { AssetBase asset = new AssetBase(); // Region Main - asset.Metadata.FullID = new UUID((string)reader["id"]); - asset.Metadata.Name = (string)reader["name"]; - asset.Metadata.Description = (string)reader["description"]; - asset.Metadata.Type = Convert.ToSByte(reader["assetType"]); - asset.Metadata.Local = Convert.ToBoolean(reader["local"]); - asset.Metadata.Temporary = Convert.ToBoolean(reader["temporary"]); + asset.FullID = new UUID((string)reader["id"]); + asset.Name = (string)reader["name"]; + asset.Description = (string)reader["description"]; + asset.Type = Convert.ToSByte(reader["assetType"]); + asset.Local = Convert.ToBoolean(reader["local"]); + asset.Temporary = Convert.ToBoolean(reader["temporary"]); asset.Data = (byte[])reader["data"]; return asset; } @@ -152,7 +152,7 @@ namespace OpenSim.Data.MSSQL /// the asset override public void CreateAsset(AssetBase asset) { - if (ExistsAsset(asset.Metadata.FullID)) + if (ExistsAsset(asset.FullID)) { return; } @@ -163,12 +163,12 @@ namespace OpenSim.Data.MSSQL "(@id, @name, @description, @assetType, @local, @temporary, @create_time, @access_time, @data)")) { int now = (int)((DateTime.Now.Ticks - TicksToEpoch) / 10000000); - command.Parameters.Add(database.CreateParameter("id", asset.Metadata.FullID)); - command.Parameters.Add(database.CreateParameter("name", asset.Metadata.Name)); - command.Parameters.Add(database.CreateParameter("description", asset.Metadata.Description)); - command.Parameters.Add(database.CreateParameter("assetType", asset.Metadata.Type)); - command.Parameters.Add(database.CreateParameter("local", asset.Metadata.Local)); - command.Parameters.Add(database.CreateParameter("temporary", asset.Metadata.Temporary)); + command.Parameters.Add(database.CreateParameter("id", asset.FullID)); + command.Parameters.Add(database.CreateParameter("name", asset.Name)); + command.Parameters.Add(database.CreateParameter("description", asset.Description)); + command.Parameters.Add(database.CreateParameter("assetType", asset.Type)); + command.Parameters.Add(database.CreateParameter("local", asset.Local)); + command.Parameters.Add(database.CreateParameter("temporary", asset.Temporary)); command.Parameters.Add(database.CreateParameter("access_time", now)); command.Parameters.Add(database.CreateParameter("create_time", now)); command.Parameters.Add(database.CreateParameter("data", asset.Data)); @@ -192,14 +192,14 @@ namespace OpenSim.Data.MSSQL "data = @data where " + "id = @keyId;")) { - command.Parameters.Add(database.CreateParameter("id", asset.Metadata.FullID)); - command.Parameters.Add(database.CreateParameter("name", asset.Metadata.Name)); - command.Parameters.Add(database.CreateParameter("description", asset.Metadata.Description)); - command.Parameters.Add(database.CreateParameter("assetType", asset.Metadata.Type)); - command.Parameters.Add(database.CreateParameter("local", asset.Metadata.Local)); - command.Parameters.Add(database.CreateParameter("temporary", asset.Metadata.Temporary)); + command.Parameters.Add(database.CreateParameter("id", asset.FullID)); + command.Parameters.Add(database.CreateParameter("name", asset.Name)); + command.Parameters.Add(database.CreateParameter("description", asset.Description)); + command.Parameters.Add(database.CreateParameter("assetType", asset.Type)); + command.Parameters.Add(database.CreateParameter("local", asset.Local)); + command.Parameters.Add(database.CreateParameter("temporary", asset.Temporary)); command.Parameters.Add(database.CreateParameter("data", asset.Data)); - command.Parameters.Add(database.CreateParameter("@keyId", asset.Metadata.FullID)); + command.Parameters.Add(database.CreateParameter("@keyId", asset.FullID)); try { diff --git a/OpenSim/Data/MySQL/MySQLAssetData.cs b/OpenSim/Data/MySQL/MySQLAssetData.cs index 508e053e4d..2211d4cafa 100644 --- a/OpenSim/Data/MySQL/MySQLAssetData.cs +++ b/OpenSim/Data/MySQL/MySQLAssetData.cs @@ -137,18 +137,18 @@ namespace OpenSim.Data.MySQL { asset = new AssetBase(); asset.Data = (byte[]) dbReader["data"]; - asset.Metadata.Description = (string) dbReader["description"]; - asset.Metadata.FullID = assetID; + asset.Description = (string) dbReader["description"]; + asset.FullID = assetID; try { - asset.Metadata.Local = (bool)dbReader["local"]; + asset.Local = (bool)dbReader["local"]; } catch (InvalidCastException) { - asset.Metadata.Local = false; + asset.Local = false; } - asset.Metadata.Name = (string) dbReader["name"]; - asset.Metadata.Type = (sbyte) dbReader["assetType"]; + asset.Name = (string) dbReader["name"]; + asset.Type = (sbyte) dbReader["assetType"]; } dbReader.Close(); cmd.Dispose(); @@ -176,8 +176,8 @@ namespace OpenSim.Data.MySQL { lock (_dbConnection) { - //m_log.Info("[ASSET DB]: Creating Asset " + Util.ToRawUuidString(asset.Metadata.FullID)); - if (ExistsAsset(asset.Metadata.FullID)) + //m_log.Info("[ASSET DB]: Creating Asset " + Util.ToRawUuidString(asset.FullID)); + if (ExistsAsset(asset.FullID)) { //m_log.Info("[ASSET DB]: Asset exists already, ignoring."); return; @@ -198,12 +198,12 @@ namespace OpenSim.Data.MySQL { // create unix epoch time int now = (int)((DateTime.Now.Ticks - TicksToEpoch) / 10000000); - cmd.Parameters.AddWithValue("?id", asset.Metadata.ID); - cmd.Parameters.AddWithValue("?name", asset.Metadata.Name); - cmd.Parameters.AddWithValue("?description", asset.Metadata.Description); - cmd.Parameters.AddWithValue("?assetType", asset.Metadata.Type); - cmd.Parameters.AddWithValue("?local", asset.Metadata.Local); - cmd.Parameters.AddWithValue("?temporary", asset.Metadata.Temporary); + cmd.Parameters.AddWithValue("?id", asset.ID); + cmd.Parameters.AddWithValue("?name", asset.Name); + cmd.Parameters.AddWithValue("?description", asset.Description); + cmd.Parameters.AddWithValue("?assetType", asset.Type); + cmd.Parameters.AddWithValue("?local", asset.Local); + cmd.Parameters.AddWithValue("?temporary", asset.Temporary); cmd.Parameters.AddWithValue("?create_time", now); cmd.Parameters.AddWithValue("?access_time", now); cmd.Parameters.AddWithValue("?data", asset.Data); @@ -216,7 +216,7 @@ namespace OpenSim.Data.MySQL m_log.ErrorFormat( "[ASSETS DB]: " + "MySql failure creating asset {0} with name {1}" + Environment.NewLine + e.ToString() - + Environment.NewLine + "Attempting reconnection", asset.Metadata.FullID, asset.Metadata.Name); + + Environment.NewLine + "Attempting reconnection", asset.FullID, asset.Name); _dbConnection.Reconnect(); } } @@ -239,7 +239,7 @@ namespace OpenSim.Data.MySQL { // create unix epoch time int now = (int)((DateTime.Now.Ticks - TicksToEpoch) / 10000000); - cmd.Parameters.AddWithValue("?id", asset.Metadata.ID); + cmd.Parameters.AddWithValue("?id", asset.ID); cmd.Parameters.AddWithValue("?access_time", now); cmd.ExecuteNonQuery(); cmd.Dispose(); @@ -250,7 +250,7 @@ namespace OpenSim.Data.MySQL m_log.ErrorFormat( "[ASSETS DB]: " + "MySql failure updating access_time for asset {0} with name {1}" + Environment.NewLine + e.ToString() - + Environment.NewLine + "Attempting reconnection", asset.Metadata.FullID, asset.Metadata.Name); + + Environment.NewLine + "Attempting reconnection", asset.FullID, asset.Name); _dbConnection.Reconnect(); } } diff --git a/OpenSim/Data/NHibernate/NHibernateAssetData.cs b/OpenSim/Data/NHibernate/NHibernateAssetData.cs index 8f4877d434..95595db3ab 100644 --- a/OpenSim/Data/NHibernate/NHibernateAssetData.cs +++ b/OpenSim/Data/NHibernate/NHibernateAssetData.cs @@ -64,7 +64,7 @@ namespace OpenSim.Data.NHibernate private void Save(AssetBase asset) { - AssetBase temp = (AssetBase)manager.Get(typeof(AssetBase), asset.Metadata.FullID); + AssetBase temp = (AssetBase)manager.Get(typeof(AssetBase), asset.FullID); if (temp == null) { manager.Insert(asset); @@ -73,13 +73,13 @@ namespace OpenSim.Data.NHibernate override public void CreateAsset(AssetBase asset) { - m_log.InfoFormat("[NHIBERNATE] inserting asset {0}", asset.Metadata.FullID); + m_log.InfoFormat("[NHIBERNATE] inserting asset {0}", asset.FullID); Save(asset); } override public void UpdateAsset(AssetBase asset) { - m_log.InfoFormat("[NHIBERNATE] updating asset {0}", asset.Metadata.FullID); + m_log.InfoFormat("[NHIBERNATE] updating asset {0}", asset.FullID); manager.Update(asset); } diff --git a/OpenSim/Data/NHibernate/Resources/AssetBase.hbm.xml b/OpenSim/Data/NHibernate/Resources/AssetBase.hbm.xml index db400ea733..cb8b36d10e 100644 --- a/OpenSim/Data/NHibernate/Resources/AssetBase.hbm.xml +++ b/OpenSim/Data/NHibernate/Resources/AssetBase.hbm.xml @@ -1,16 +1,14 @@ - - - + + + + + + + + - - - - - - - diff --git a/OpenSim/Data/SQLite/SQLiteAssetData.cs b/OpenSim/Data/SQLite/SQLiteAssetData.cs index f6f62a7d75..1b42198691 100644 --- a/OpenSim/Data/SQLite/SQLiteAssetData.cs +++ b/OpenSim/Data/SQLite/SQLiteAssetData.cs @@ -125,8 +125,8 @@ namespace OpenSim.Data.SQLite /// Asset Base override public void CreateAsset(AssetBase asset) { - //m_log.Info("[ASSET DB]: Creating Asset " + Util.ToRawUuidString(asset.Metadata.FullID)); - if (ExistsAsset(asset.Metadata.FullID)) + //m_log.Info("[ASSET DB]: Creating Asset " + Util.ToRawUuidString(asset.FullID)); + if (ExistsAsset(asset.FullID)) { //m_log.Info("[ASSET DB]: Asset exists already, ignoring."); } @@ -136,12 +136,12 @@ namespace OpenSim.Data.SQLite { using (SqliteCommand cmd = new SqliteCommand(InsertAssetSQL, m_conn)) { - cmd.Parameters.Add(new SqliteParameter(":UUID", Util.ToRawUuidString(asset.Metadata.FullID))); - cmd.Parameters.Add(new SqliteParameter(":Name", asset.Metadata.Name)); - cmd.Parameters.Add(new SqliteParameter(":Description", asset.Metadata.Description)); - cmd.Parameters.Add(new SqliteParameter(":Type", asset.Metadata.Type)); - cmd.Parameters.Add(new SqliteParameter(":Local", asset.Metadata.Local)); - cmd.Parameters.Add(new SqliteParameter(":Temporary", asset.Metadata.Temporary)); + cmd.Parameters.Add(new SqliteParameter(":UUID", Util.ToRawUuidString(asset.FullID))); + cmd.Parameters.Add(new SqliteParameter(":Name", asset.Name)); + cmd.Parameters.Add(new SqliteParameter(":Description", asset.Description)); + cmd.Parameters.Add(new SqliteParameter(":Type", asset.Type)); + cmd.Parameters.Add(new SqliteParameter(":Local", asset.Local)); + cmd.Parameters.Add(new SqliteParameter(":Temporary", asset.Temporary)); cmd.Parameters.Add(new SqliteParameter(":Data", asset.Data)); cmd.ExecuteNonQuery(); @@ -162,12 +162,12 @@ namespace OpenSim.Data.SQLite { using (SqliteCommand cmd = new SqliteCommand(UpdateAssetSQL, m_conn)) { - cmd.Parameters.Add(new SqliteParameter(":UUID", Util.ToRawUuidString(asset.Metadata.FullID))); - cmd.Parameters.Add(new SqliteParameter(":Name", asset.Metadata.Name)); - cmd.Parameters.Add(new SqliteParameter(":Description", asset.Metadata.Description)); - cmd.Parameters.Add(new SqliteParameter(":Type", asset.Metadata.Type)); - cmd.Parameters.Add(new SqliteParameter(":Local", asset.Metadata.Local)); - cmd.Parameters.Add(new SqliteParameter(":Temporary", asset.Metadata.Temporary)); + cmd.Parameters.Add(new SqliteParameter(":UUID", Util.ToRawUuidString(asset.FullID))); + cmd.Parameters.Add(new SqliteParameter(":Name", asset.Name)); + cmd.Parameters.Add(new SqliteParameter(":Description", asset.Description)); + cmd.Parameters.Add(new SqliteParameter(":Type", asset.Type)); + cmd.Parameters.Add(new SqliteParameter(":Local", asset.Local)); + cmd.Parameters.Add(new SqliteParameter(":Temporary", asset.Temporary)); cmd.Parameters.Add(new SqliteParameter(":Data", asset.Data)); cmd.ExecuteNonQuery(); @@ -181,14 +181,14 @@ namespace OpenSim.Data.SQLite /// private static void LogAssetLoad(AssetBase asset) { - string temporary = asset.Metadata.Temporary ? "Temporary" : "Stored"; - string local = asset.Metadata.Local ? "Local" : "Remote"; + string temporary = asset.Temporary ? "Temporary" : "Stored"; + string local = asset.Local ? "Local" : "Remote"; int assetLength = (asset.Data != null) ? asset.Data.Length : 0; m_log.Info("[ASSET DB]: " + string.Format("Loaded {6} {5} Asset: [{0}][{3}] \"{1}\":{2} ({7} bytes)", - asset.Metadata.FullID, asset.Metadata.Name, asset.Metadata.Description, asset.Metadata.Type, + asset.FullID, asset.Name, asset.Description, asset.Type, temporary, local, assetLength)); } @@ -246,12 +246,12 @@ namespace OpenSim.Data.SQLite // back out. Not enough time to figure it out yet. AssetBase asset = new AssetBase(); - asset.Metadata.FullID = new UUID((String) row["UUID"]); - asset.Metadata.Name = (String) row["Name"]; - asset.Metadata.Description = (String) row["Description"]; - asset.Metadata.Type = Convert.ToSByte(row["Type"]); - asset.Metadata.Local = Convert.ToBoolean(row["Local"]); - asset.Metadata.Temporary = Convert.ToBoolean(row["Temporary"]); + asset.FullID = new UUID((String) row["UUID"]); + asset.Name = (String) row["Name"]; + asset.Description = (String) row["Description"]; + asset.Type = Convert.ToSByte(row["Type"]); + asset.Local = Convert.ToBoolean(row["Local"]); + asset.Temporary = Convert.ToBoolean(row["Temporary"]); asset.Data = (byte[]) row["Data"]; return asset; } diff --git a/OpenSim/Data/Tests/BasicAssetTest.cs b/OpenSim/Data/Tests/BasicAssetTest.cs index 4d2bbc7180..500b646539 100644 --- a/OpenSim/Data/Tests/BasicAssetTest.cs +++ b/OpenSim/Data/Tests/BasicAssetTest.cs @@ -83,16 +83,16 @@ namespace OpenSim.Data.Tests db.CreateAsset(a3); AssetBase a1a = db.FetchAsset(uuid1); - Assert.That(a1.Metadata.ID, Is.EqualTo(a1a.Metadata.ID)); - Assert.That(a1.Metadata.Name, Is.EqualTo(a1a.Metadata.Name)); + Assert.That(a1.ID, Is.EqualTo(a1a.ID)); + Assert.That(a1.Name, Is.EqualTo(a1a.Name)); AssetBase a2a = db.FetchAsset(uuid2); - Assert.That(a2.Metadata.ID, Is.EqualTo(a2a.Metadata.ID)); - Assert.That(a2.Metadata.Name, Is.EqualTo(a2a.Metadata.Name)); + Assert.That(a2.ID, Is.EqualTo(a2a.ID)); + Assert.That(a2.Name, Is.EqualTo(a2a.Name)); AssetBase a3a = db.FetchAsset(uuid3); - Assert.That(a3.Metadata.ID, Is.EqualTo(a3a.Metadata.ID)); - Assert.That(a3.Metadata.Name, Is.EqualTo(a3a.Metadata.Name)); + Assert.That(a3.ID, Is.EqualTo(a3a.ID)); + Assert.That(a3.Name, Is.EqualTo(a3a.Name)); } [Test] diff --git a/OpenSim/Framework/AssetBase.cs b/OpenSim/Framework/AssetBase.cs index dfe559e985..f3dd70a4ae 100644 --- a/OpenSim/Framework/AssetBase.cs +++ b/OpenSim/Framework/AssetBase.cs @@ -33,128 +33,166 @@ namespace OpenSim.Framework [Serializable] public class AssetBase { - private byte[] _data; - private AssetMetadata _metadata; + private byte[] m_data; + private AssetMetadata m_metadata; public AssetBase() { - Metadata = new AssetMetadata(); + m_metadata = new AssetMetadata(); } public AssetBase(UUID assetId, string name) { - Metadata = new AssetMetadata(); - Metadata.FullID = assetId; - Metadata.Name = name; + m_metadata = new AssetMetadata(); + m_metadata.FullID = assetId; + m_metadata.Name = name; } public virtual byte[] Data { - get { return _data; } - set { _data = value; } + get { return m_data; } + set { m_data = value; } } - public virtual AssetMetadata Metadata - { - get { return _metadata; } - set { _metadata = value; } - } - - // We expose FullID here because the NHibernate mappers require a - // property on the AssetBase class for its primary key (see - // OpenSim/Data/NHibernate/Resources/AssetBase.hbm.xml). - public UUID FullID - { - get { return Metadata.FullID; } - set { Metadata.FullID = value; } - } - } - - [Serializable] - public class AssetMetadata - { - private UUID _fullid; - private string _name = String.Empty; - private string _description = String.Empty; - private DateTime _creation_date; - private sbyte _type; - private string _content_type; - private byte[] _sha1; - private bool _local = false; - private bool _temporary = false; - //private Dictionary _methods = new Dictionary(); - //private OSDMap _extra_data; - public UUID FullID { - get { return _fullid; } - set { _fullid = value; } + get { return m_metadata.FullID; } + set { m_metadata.FullID = value; } } public string ID { - get { return _fullid.ToString(); } - set { _fullid = new UUID(value); } + get { return m_metadata.ID; } + set { m_metadata.ID = value; } } public string Name { - get { return _name; } - set { _name = value; } + get { return m_metadata.Name; } + set { m_metadata.Name = value; } } public string Description { - get { return _description; } - set { _description = value; } - } - - public DateTime CreationDate - { - get { return _creation_date; } - set { _creation_date = value; } + get { return m_metadata.Description; } + set { m_metadata.Description = value; } } public sbyte Type { - get { return _type; } - set { _type = value; } - } - - public string ContentType - { - get { return _content_type; } - set { _content_type = value; } - } - - public byte[] SHA1 - { - get { return _sha1; } - set { _sha1 = value; } + get { return m_metadata.Type; } + set { m_metadata.Type = value; } } public bool Local { - get { return _local; } - set { _local = value; } + get { return m_metadata.Local; } + set { m_metadata.Local = value; } } public bool Temporary { - get { return _temporary; } - set { _temporary = value; } + get { return m_metadata.Temporary; } + set { m_metadata.Temporary = value; } + } + + // We have methods here because properties are serialized, and we don't + // want that. + public virtual AssetMetadata getMetadata() + { + return m_metadata; + } + + public virtual void setMetadata(AssetMetadata metadata) + { + m_metadata = metadata; + } + } + + public class AssetMetadata + { + private UUID m_fullid; + private string m_name = String.Empty; + private string m_description = String.Empty; + private DateTime m_creation_date; + private sbyte m_type; + private string m_content_type; + private byte[] m_sha1; + private bool m_local = false; + private bool m_temporary = false; + //private Dictionary m_methods = new Dictionary(); + //private OSDMap m_extra_data; + + public UUID FullID + { + get { return m_fullid; } + set { m_fullid = value; } + } + + public string ID + { + get { return m_fullid.ToString(); } + set { m_fullid = new UUID(value); } + } + + public string Name + { + get { return m_name; } + set { m_name = value; } + } + + public string Description + { + get { return m_description; } + set { m_description = value; } + } + + public DateTime CreationDate + { + get { return m_creation_date; } + set { m_creation_date = value; } + } + + public sbyte Type + { + get { return m_type; } + set { m_type = value; } + } + + public string ContentType + { + get { return m_content_type; } + set { m_content_type = value; } + } + + public byte[] SHA1 + { + get { return m_sha1; } + set { m_sha1 = value; } + } + + public bool Local + { + get { return m_local; } + set { m_local = value; } + } + + public bool Temporary + { + get { return m_temporary; } + set { m_temporary = value; } } //public Dictionary Methods //{ - // get { return _methods; } - // set { _methods = value; } + // get { return m_methods; } + // set { m_methods = value; } //} //public OSDMap ExtraData //{ - // get { return _extra_data; } - // set { _extra_data = value; } + // get { return m_extra_data; } + // set { m_extra_data = value; } //} } } diff --git a/OpenSim/Framework/AssetLandmark.cs b/OpenSim/Framework/AssetLandmark.cs index bbf25d847d..d636d34ea0 100644 --- a/OpenSim/Framework/AssetLandmark.cs +++ b/OpenSim/Framework/AssetLandmark.cs @@ -40,10 +40,10 @@ namespace OpenSim.Framework public AssetLandmark(AssetBase a) { Data = a.Data; - Metadata.FullID = a.Metadata.FullID; - Metadata.Type = a.Metadata.Type; - Metadata.Name = a.Metadata.Name; - Metadata.Description = a.Metadata.Description; + FullID = a.FullID; + Type = a.Type; + Name = a.Name; + Description = a.Description; InternData(); } diff --git a/OpenSim/Framework/AssetLoader/Filesystem/AssetLoaderFileSystem.cs b/OpenSim/Framework/AssetLoader/Filesystem/AssetLoaderFileSystem.cs index 01cbfcee77..378eff5bc8 100644 --- a/OpenSim/Framework/AssetLoader/Filesystem/AssetLoaderFileSystem.cs +++ b/OpenSim/Framework/AssetLoader/Filesystem/AssetLoaderFileSystem.cs @@ -145,7 +145,7 @@ namespace OpenSim.Framework.AssetLoader.Filesystem AssetBase newAsset = CreateAsset(assetIdStr, name, assetPath, false); - newAsset.Metadata.Type = type; + newAsset.Type = type; assets.Add(newAsset); } } diff --git a/OpenSim/Framework/Communications/Cache/AssetCache.cs b/OpenSim/Framework/Communications/Cache/AssetCache.cs index 76c6045bc7..0e1f9485e5 100644 --- a/OpenSim/Framework/Communications/Cache/AssetCache.cs +++ b/OpenSim/Framework/Communications/Cache/AssetCache.cs @@ -341,11 +341,11 @@ namespace OpenSim.Framework.Communications.Cache /// public void AddAsset(AssetBase asset) { - if (!m_memcache.Contains(asset.Metadata.FullID)) + if (!m_memcache.Contains(asset.FullID)) { - m_log.Info("[CACHE] Caching " + asset.Metadata.FullID + " for 24 hours from last access"); + m_log.Info("[CACHE] Caching " + asset.FullID + " for 24 hours from last access"); // Use 24 hour rolling asset cache. - m_memcache.AddOrUpdate(asset.Metadata.FullID, asset, TimeSpan.FromHours(24)); + m_memcache.AddOrUpdate(asset.FullID, asset, TimeSpan.FromHours(24)); // According to http://wiki.secondlife.com/wiki/AssetUploadRequest, Local signifies that the // information is stored locally. It could disappear, in which case we could send the @@ -365,7 +365,7 @@ namespace OpenSim.Framework.Communications.Cache // But for now, we're going to take the easy way out and store local assets globally. // // TODO: Also, Temporary is now deprecated. We should start ignoring it and not passing it out from LLClientView. - if (!asset.Metadata.Temporary || asset.Metadata.Local) + if (!asset.Temporary || asset.Local) { m_assetServer.StoreAsset(asset); } @@ -396,25 +396,25 @@ namespace OpenSim.Framework.Communications.Cache { AssetInfo assetInf = new AssetInfo(asset); - if (!m_memcache.Contains(assetInf.Metadata.FullID)) + if (!m_memcache.Contains(assetInf.FullID)) { - m_memcache.AddOrUpdate(assetInf.Metadata.FullID, assetInf, TimeSpan.FromHours(24)); + m_memcache.AddOrUpdate(assetInf.FullID, assetInf, TimeSpan.FromHours(24)); if (StatsManager.SimExtraStats != null) { StatsManager.SimExtraStats.AddAsset(assetInf); } - if (RequestedAssets.ContainsKey(assetInf.Metadata.FullID)) + if (RequestedAssets.ContainsKey(assetInf.FullID)) { - AssetRequest req = RequestedAssets[assetInf.Metadata.FullID]; + AssetRequest req = RequestedAssets[assetInf.FullID]; req.AssetInf = assetInf; req.NumPackets = CalculateNumPackets(assetInf.Data); - RequestedAssets.Remove(assetInf.Metadata.FullID); + RequestedAssets.Remove(assetInf.FullID); // If it's a direct request for a script, drop it // because it's a hacked client - if (req.AssetRequestSource != 2 || assetInf.Metadata.Type != 10) + if (req.AssetRequestSource != 2 || assetInf.Type != 10) AssetRequests.Add(req); } } @@ -424,8 +424,8 @@ namespace OpenSim.Framework.Communications.Cache lock (RequestLists) { - if (RequestLists.TryGetValue(asset.Metadata.FullID, out reqList)) - RequestLists.Remove(asset.Metadata.FullID); + if (RequestLists.TryGetValue(asset.FullID, out reqList)) + RequestLists.Remove(asset.FullID); } if (reqList != null) @@ -436,8 +436,8 @@ namespace OpenSim.Framework.Communications.Cache foreach (NewAssetRequest req in reqList.Requests) { // Xantor 20080526 are we really calling all the callbacks if multiple queued for 1 request? -- Yes, checked - // m_log.DebugFormat("[ASSET CACHE]: Callback for asset {0}", asset.Metadata.FullID); - req.Callback(asset.Metadata.FullID, asset); + // m_log.DebugFormat("[ASSET CACHE]: Callback for asset {0}", asset.FullID); + req.Callback(asset.FullID, asset); } } } @@ -545,7 +545,7 @@ namespace OpenSim.Framework.Communications.Cache } // Scripts cannot be retrieved by direct request - if (transferRequest.TransferInfo.SourceType == 2 && asset.Metadata.Type == 10) + if (transferRequest.TransferInfo.SourceType == 2 && asset.Type == 10) return; // The asset is knosn to exist and is in our cache, so add it to the AssetRequests list @@ -631,10 +631,10 @@ namespace OpenSim.Framework.Communications.Cache public AssetInfo(AssetBase aBase) { Data = aBase.Data; - Metadata.FullID = aBase.Metadata.FullID; - Metadata.Type = aBase.Metadata.Type; - Metadata.Name = aBase.Metadata.Name; - Metadata.Description = aBase.Metadata.Description; + FullID = aBase.FullID; + Type = aBase.Type; + Name = aBase.Name; + Description = aBase.Description; } } @@ -643,10 +643,10 @@ namespace OpenSim.Framework.Communications.Cache public TextureImage(AssetBase aBase) { Data = aBase.Data; - Metadata.FullID = aBase.Metadata.FullID; - Metadata.Type = aBase.Metadata.Type; - Metadata.Name = aBase.Metadata.Name; - Metadata.Description = aBase.Metadata.Description; + FullID = aBase.FullID; + Type = aBase.Type; + Name = aBase.Name; + Description = aBase.Description; } } diff --git a/OpenSim/Framework/Communications/Cache/CryptoGridAssetClient.cs b/OpenSim/Framework/Communications/Cache/CryptoGridAssetClient.cs index 0f4e8acab8..f1c19fa5a5 100644 --- a/OpenSim/Framework/Communications/Cache/CryptoGridAssetClient.cs +++ b/OpenSim/Framework/Communications/Cache/CryptoGridAssetClient.cs @@ -441,17 +441,17 @@ namespace OpenSim.Framework.Communications.Cache string salt = Convert.ToBase64String(rand); x.Data = UtilRijndael.Encrypt(x.Data, file.Secret, salt, "SHA1", 2, file.IVBytes, file.Keysize); - x.Metadata.Description = String.Format("ENCASS#:~:#{0}#:~:#{1}#:~:#{2}#:~:#{3}", - "OPENSIM_AES_AF1", - file.AlsoKnownAs, - salt, - x.Metadata.Description); + x.Description = String.Format("ENCASS#:~:#{0}#:~:#{1}#:~:#{2}#:~:#{3}", + "OPENSIM_AES_AF1", + file.AlsoKnownAs, + salt, + x.Description); } private bool DecryptAssetBase(AssetBase x) { // Check it's encrypted first. - if (!x.Metadata.Description.Contains("ENCASS")) + if (!x.Description.Contains("ENCASS")) return true; // ENCASS:ALG:AKA:SALT:Description @@ -459,7 +459,7 @@ namespace OpenSim.Framework.Communications.Cache string[] splitchars = new string[1]; splitchars[0] = "#:~:#"; - string[] meta = x.Metadata.Description.Split(splitchars, StringSplitOptions.None); + string[] meta = x.Description.Split(splitchars, StringSplitOptions.None); if (meta.Length < 5) { m_log.Warn("[ENCASSETS] Recieved Encrypted Asset, but header is corrupt"); @@ -470,7 +470,7 @@ namespace OpenSim.Framework.Communications.Cache if (m_keyfiles.ContainsKey(meta[2])) { RjinKeyfile deckey = m_keyfiles[meta[2]]; - x.Metadata.Description = meta[4]; + x.Description = meta[4]; switch (meta[1]) { case "OPENSIM_AES_AF1": @@ -544,7 +544,7 @@ namespace OpenSim.Framework.Communications.Cache { string assetUrl = _assetServerUrl + "/assets/"; - m_log.InfoFormat("[CRYPTO GRID ASSET CLIENT]: Sending store request for asset {0}", asset.Metadata.FullID); + m_log.InfoFormat("[CRYPTO GRID ASSET CLIENT]: Sending store request for asset {0}", asset.FullID); RestObjectPoster.BeginPostObject(assetUrl, asset); } diff --git a/OpenSim/Framework/Communications/Cache/FileAssetClient.cs b/OpenSim/Framework/Communications/Cache/FileAssetClient.cs index e6574a1804..8d03f56c5a 100644 --- a/OpenSim/Framework/Communications/Cache/FileAssetClient.cs +++ b/OpenSim/Framework/Communications/Cache/FileAssetClient.cs @@ -79,7 +79,7 @@ namespace OpenSim.Framework.Communications.Cache public override void StoreAsset(AssetBase asset) { - byte[] idBytes = asset.Metadata.FullID.Guid.ToByteArray(); + byte[] idBytes = asset.FullID.Guid.ToByteArray(); string cdir = m_dir + Path.DirectorySeparatorChar + idBytes[0] + Path.DirectorySeparatorChar + idBytes[1]; @@ -90,7 +90,7 @@ namespace OpenSim.Framework.Communications.Cache if (!Directory.Exists(cdir)) Directory.CreateDirectory(cdir); - FileStream x = new FileStream(cdir + Path.DirectorySeparatorChar + asset.Metadata.FullID + ".xml", FileMode.Create); + FileStream x = new FileStream(cdir + Path.DirectorySeparatorChar + asset.FullID + ".xml", FileMode.Create); m_xs.Serialize(x, asset); x.Flush(); diff --git a/OpenSim/Framework/Communications/Cache/GridAssetClient.cs b/OpenSim/Framework/Communications/Cache/GridAssetClient.cs index 6522ad00f7..3b6dc52967 100644 --- a/OpenSim/Framework/Communications/Cache/GridAssetClient.cs +++ b/OpenSim/Framework/Communications/Cache/GridAssetClient.cs @@ -126,7 +126,7 @@ namespace OpenSim.Framework.Communications.Cache // rc.Request(s); //m_log.InfoFormat("[ASSET]: Stored {0}", rc); - m_log.InfoFormat("[GRID ASSET CLIENT]: Sending store request for asset {0}", asset.Metadata.FullID); + m_log.InfoFormat("[GRID ASSET CLIENT]: Sending store request for asset {0}", asset.FullID); RestObjectPoster.BeginPostObject(assetUrl, asset); } diff --git a/OpenSim/Framework/Communications/Capabilities/Caps.cs b/OpenSim/Framework/Communications/Capabilities/Caps.cs index b68083e923..a4c847d005 100644 --- a/OpenSim/Framework/Communications/Capabilities/Caps.cs +++ b/OpenSim/Framework/Communications/Capabilities/Caps.cs @@ -740,9 +740,9 @@ namespace OpenSim.Framework.Communications.Capabilities AssetBase asset; asset = new AssetBase(); - asset.Metadata.FullID = assetID; - asset.Metadata.Type = assType; - asset.Metadata.Name = assetName; + asset.FullID = assetID; + asset.Type = assType; + asset.Name = assetName; asset.Data = data; m_assetCache.AddAsset(asset); @@ -750,7 +750,7 @@ namespace OpenSim.Framework.Communications.Capabilities item.Owner = m_agentID; item.Creator = m_agentID; item.ID = inventoryItem; - item.AssetID = asset.Metadata.FullID; + item.AssetID = asset.FullID; item.Description = assetDescription; item.Name = assetName; item.AssetType = assType; diff --git a/OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/OpenSimAssetStoragePlugin.cs b/OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/OpenSimAssetStoragePlugin.cs index 8fa8474cde..dcacab2155 100644 --- a/OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/OpenSimAssetStoragePlugin.cs +++ b/OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/OpenSimAssetStoragePlugin.cs @@ -61,7 +61,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim if (asset == null) ret = BackendResponse.NotFound; else { - metadata = asset.Metadata; + metadata = asset.getMetadata(); ret = BackendResponse.Success; } diff --git a/OpenSim/Grid/AssetInventoryServer/Plugins/Simple/SimpleAssetStoragePlugin.cs b/OpenSim/Grid/AssetInventoryServer/Plugins/Simple/SimpleAssetStoragePlugin.cs index e7e898b6a0..890a6a09cf 100644 --- a/OpenSim/Grid/AssetInventoryServer/Plugins/Simple/SimpleAssetStoragePlugin.cs +++ b/OpenSim/Grid/AssetInventoryServer/Plugins/Simple/SimpleAssetStoragePlugin.cs @@ -97,7 +97,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.Simple public BackendResponse TryFetchDataMetadata(UUID assetID, out AssetBase asset) { asset = new AssetBase(); - AssetMetadata metadata = asset.Metadata; + AssetMetadata metadata = asset.getMetadata(); string filename; BackendResponse ret; @@ -116,8 +116,8 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.Simple ret = BackendResponse.Failure; } - asset.Metadata.Type = (sbyte) Utils.ContentTypeToSLAssetType(asset.Metadata.ContentType); - asset.Metadata.Local = false; + asset.Type = (sbyte) Utils.ContentTypeToSLAssetType(metadata.ContentType); + asset.Local = false; } else { @@ -139,11 +139,12 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.Simple public BackendResponse TryCreateAsset(AssetBase asset) { BackendResponse ret; + AssetMetadata metadata = asset.getMetadata(); string path; - string filename = String.Format("{0}.{1}", asset.FullID, Utils.ContentTypeToExtension(asset.Metadata.ContentType)); + string filename = String.Format("{0}.{1}", asset.FullID, Utils.ContentTypeToExtension(metadata.ContentType)); - if (asset.Metadata.Temporary) + if (asset.Temporary) path = Path.Combine(TEMP_DATA_DIR, filename); else path = Path.Combine(DEFAULT_DATA_DIR, filename); @@ -154,10 +155,10 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.Simple lock (filenames) filenames[asset.FullID] = path; // Set the creation date to right now - asset.Metadata.CreationDate = DateTime.Now; + metadata.CreationDate = DateTime.Now; lock (metadataStorage) - metadataStorage[asset.FullID] = asset.Metadata; + metadataStorage[asset.FullID] = metadata; ret = BackendResponse.Success; } diff --git a/OpenSim/Grid/AssetServer/RestService.cs b/OpenSim/Grid/AssetServer/RestService.cs index ba62c55dca..1e01c44d11 100644 --- a/OpenSim/Grid/AssetServer/RestService.cs +++ b/OpenSim/Grid/AssetServer/RestService.cs @@ -140,7 +140,7 @@ namespace OpenSim.Grid.AssetServer XmlSerializer xs = new XmlSerializer(typeof (AssetBase)); AssetBase asset = (AssetBase) xs.Deserialize(request); - m_log.InfoFormat("[REST]: Creating asset {0}", asset.Metadata.FullID); + m_log.InfoFormat("[REST]: Creating asset {0}", asset.FullID); m_assetProvider.CreateAsset(asset); return new byte[] {}; diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 3b8b48f022..dd0f6ac6a4 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -7679,7 +7679,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP { Transfer.TransferInfo.Params = new byte[20]; Array.Copy(req.RequestAssetID.GetBytes(), 0, Transfer.TransferInfo.Params, 0, 16); - int assType = req.AssetInf.Metadata.Type; + int assType = req.AssetInf.Type; Array.Copy(Utils.IntToBytes(assType), 0, Transfer.TransferInfo.Params, 16, 4); } else if (req.AssetRequestSource == 3) diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLFileTransfer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLFileTransfer.cs index f79f62e8f2..697bbe6325 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLFileTransfer.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLFileTransfer.cs @@ -198,13 +198,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP private void Initialise(UUID fileID, string fileName) { m_asset = new AssetBase(); - m_asset.Metadata.FullID = fileID; - m_asset.Metadata.Type = type; + m_asset.FullID = fileID; + m_asset.Type = type; m_asset.Data = new byte[0]; - m_asset.Metadata.Name = fileName; - m_asset.Metadata.Description = "empty"; - m_asset.Metadata.Local = true; - m_asset.Metadata.Temporary = true; + m_asset.Name = fileName; + m_asset.Description = "empty"; + m_asset.Local = true; + m_asset.Temporary = true; mXferID = Util.GetNextXferID(); } @@ -215,13 +215,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP public void RequestStartXfer(IClientAPI pRemoteClient) { - if (!String.IsNullOrEmpty(m_asset.Metadata.Name)) + if (!String.IsNullOrEmpty(m_asset.Name)) { - pRemoteClient.SendXferRequest(mXferID, m_asset.Metadata.Type, m_asset.Metadata.FullID, 0, Utils.StringToBytes(m_asset.Metadata.Name)); + pRemoteClient.SendXferRequest(mXferID, m_asset.Type, m_asset.FullID, 0, Utils.StringToBytes(m_asset.Name)); } else { - pRemoteClient.SendXferRequest(mXferID, m_asset.Metadata.Type, m_asset.Metadata.FullID, 0, new byte[0]); + pRemoteClient.SendXferRequest(mXferID, m_asset.Type, m_asset.FullID, 0, new byte[0]); } } @@ -265,7 +265,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP handlerUploadDone = UploadDone; if (handlerUploadDone != null) { - handlerUploadDone(m_asset.Metadata.Name, m_asset.Metadata.FullID, mXferID, m_asset.Data, remoteClient); + handlerUploadDone(m_asset.Name, m_asset.FullID, mXferID, m_asset.Data, remoteClient); } } @@ -274,7 +274,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP handlerAbort = UploadAborted; if (handlerAbort != null) { - handlerAbort(m_asset.Metadata.Name, m_asset.Metadata.FullID, mXferID, remoteClient); + handlerAbort(m_asset.Name, m_asset.FullID, mXferID, remoteClient); } } } diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLImageManager.cs b/OpenSim/Region/ClientStack/LindenUDP/LLImageManager.cs index 6efe3e18b3..23ed798054 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLImageManager.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLImageManager.cs @@ -405,7 +405,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// public UUID AssetId { - get { return m_asset_ref.Metadata.FullID; } + get { return m_asset_ref.FullID; } } ///

diff --git a/OpenSim/Region/Communications/Hypergrid/HGGridServices.cs b/OpenSim/Region/Communications/Hypergrid/HGGridServices.cs index 72c0f425bc..a61c07a941 100644 --- a/OpenSim/Region/Communications/Hypergrid/HGGridServices.cs +++ b/OpenSim/Region/Communications/Hypergrid/HGGridServices.cs @@ -318,9 +318,9 @@ namespace OpenSim.Region.Communications.Hypergrid //Console.WriteLine("Size: " + m.PhysicalDimension.Height + "-" + m.PhysicalDimension.Width); byte[] imageData = OpenJPEG.EncodeFromImage(m, true); AssetBase ass = new AssetBase(UUID.Random(), "region " + info.RegionID.ToString()); - info.RegionSettings.TerrainImageID = ass.Metadata.FullID; - ass.Metadata.Type = (int)AssetType.Texture; - ass.Metadata.Temporary = false; + info.RegionSettings.TerrainImageID = ass.FullID; + ass.Type = (int)AssetType.Texture; + ass.Temporary = false; ass.Data = imageData; m_assetcache.AddAsset(ass); diff --git a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AgentAssetsTransactions.cs b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AgentAssetsTransactions.cs index 0bf91e0391..eefcfe856a 100644 --- a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AgentAssetsTransactions.cs +++ b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AgentAssetsTransactions.cs @@ -172,10 +172,10 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction "[ASSET TRANSACTIONS]: Updating task item {0} in {1} with asset in transaction {2}", item.Name, part.Name, transactionID); - asset.Metadata.Name = item.Name; - asset.Metadata.Description = item.Description; - asset.Metadata.Type = (sbyte)item.Type; - item.AssetID = asset.Metadata.FullID; + asset.Name = item.Name; + asset.Description = item.Description; + asset.Type = (sbyte)item.Type; + item.AssetID = asset.FullID; Manager.MyScene.CommsManager.AssetCache.AddAsset(asset); @@ -207,14 +207,14 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction asset = GetTransactionAsset(transactionID); } - if (asset != null && asset.Metadata.FullID == assetID) + if (asset != null && asset.FullID == assetID) { // Assets never get updated, new ones get created - asset.Metadata.FullID = UUID.Random(); - asset.Metadata.Name = item.Name; - asset.Metadata.Description = item.Description; - asset.Metadata.Type = (sbyte)item.AssetType; - item.AssetID = asset.Metadata.FullID; + asset.FullID = UUID.Random(); + asset.Name = item.Name; + asset.Description = item.Description; + asset.Type = (sbyte)item.AssetType; + item.AssetID = asset.FullID; Manager.MyScene.CommsManager.AssetCache.AddAsset(asset); } diff --git a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs index 9af764f223..b71c2a6e39 100644 --- a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs +++ b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs @@ -111,13 +111,13 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction { ourClient = remoteClient; m_asset = new AssetBase(); - m_asset.Metadata.FullID = assetID; - m_asset.Metadata.Type = type; + m_asset.FullID = assetID; + m_asset.Type = type; m_asset.Data = data; - m_asset.Metadata.Name = "blank"; - m_asset.Metadata.Description = "empty"; - m_asset.Metadata.Local = storeLocal; - m_asset.Metadata.Temporary = tempFile; + m_asset.Name = "blank"; + m_asset.Description = "empty"; + m_asset.Local = storeLocal; + m_asset.Temporary = tempFile; TransactionID = transaction; m_storeLocal = storeLocal; @@ -138,12 +138,12 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction protected void RequestStartXfer() { XferID = Util.GetNextXferID(); - ourClient.SendXferRequest(XferID, m_asset.Metadata.Type, m_asset.Metadata.FullID, 0, new byte[0]); + ourClient.SendXferRequest(XferID, m_asset.Type, m_asset.FullID, 0, new byte[0]); } protected void SendCompleteMessage() { - ourClient.SendAssetUploadCompleteMessage(m_asset.Metadata.Type, true, m_asset.Metadata.FullID); + ourClient.SendAssetUploadCompleteMessage(m_asset.Type, true, m_asset.FullID); m_finished = true; if (m_createItem) @@ -162,7 +162,7 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction DateTime now = DateTime.Now; string filename = String.Format("{6}_{7}_{0:d2}{1:d2}{2:d2}_{3:d2}{4:d2}{5:d2}.dat", now.Year, now.Month, now.Day, - now.Hour, now.Minute, now.Second, m_asset.Metadata.Name, m_asset.Metadata.Type); + now.Hour, now.Minute, now.Second, m_asset.Name, m_asset.Type); SaveAssetToFile(filename, m_asset.Data); } } @@ -194,9 +194,9 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction this.invType = invType; this.wearableType = wearableType; nextPerm = nextOwnerMask; - m_asset.Metadata.Name = name; - m_asset.Metadata.Description = description; - m_asset.Metadata.Type = type; + m_asset.Name = name; + m_asset.Description = description; + m_asset.Type = type; if (m_finished) { @@ -223,7 +223,7 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction item.Owner = ourClient.AgentId; item.Creator = ourClient.AgentId; item.ID = UUID.Random(); - item.AssetID = m_asset.Metadata.FullID; + item.AssetID = m_asset.FullID; item.Description = m_description; item.Name = m_name; item.AssetType = type; diff --git a/OpenSim/Region/CoreModules/Agent/TextureSender/TextureSender.cs b/OpenSim/Region/CoreModules/Agent/TextureSender/TextureSender.cs index dde8566eb9..e02ea6dd9b 100644 --- a/OpenSim/Region/CoreModules/Agent/TextureSender/TextureSender.cs +++ b/OpenSim/Region/CoreModules/Agent/TextureSender/TextureSender.cs @@ -54,7 +54,7 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender /// private AssetBase m_asset; - //public UUID assetID { get { return m_asset.Metadata.FullID; } } + //public UUID assetID { get { return m_asset.FullID; } } // private bool m_cancel = false; @@ -116,7 +116,7 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender // See ITextureSender public bool SendTexturePacket() { - //m_log.DebugFormat("[TEXTURE SENDER]: Sending packet for {0}", m_asset.Metadata.FullID); + //m_log.DebugFormat("[TEXTURE SENDER]: Sending packet for {0}", m_asset.FullID); SendPacket(); counter++; @@ -153,7 +153,7 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender { if (NumPackets == 0) { - RequestUser.SendImageFirstPart(1, m_asset.Metadata.FullID, (uint)m_asset.Data.Length, m_asset.Data, 2); + RequestUser.SendImageFirstPart(1, m_asset.FullID, (uint)m_asset.Data.Length, m_asset.Data, 2); PacketCounter++; } else @@ -162,7 +162,7 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender Array.Copy(m_asset.Data, 0, ImageData1, 0, 600); RequestUser.SendImageFirstPart( - (ushort)(NumPackets), m_asset.Metadata.FullID, (uint)m_asset.Data.Length, ImageData1, 2); + (ushort)(NumPackets), m_asset.FullID, (uint)m_asset.Data.Length, ImageData1, 2); PacketCounter++; } } @@ -178,11 +178,11 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender catch (ArgumentOutOfRangeException) { m_log.Error("[TEXTURE SENDER]: Unable to separate texture into multiple packets: Array bounds failure on asset:" + - m_asset.Metadata.ID); + m_asset.ID); return; } - RequestUser.SendImageNextPart((ushort)PacketCounter, m_asset.Metadata.FullID, imageData); + RequestUser.SendImageNextPart((ushort)PacketCounter, m_asset.FullID, imageData); PacketCounter++; } } diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs index 7189e367fe..6b57ac5536 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs @@ -281,7 +281,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver AssetBase asset = new AssetBase(new UUID(uuid), "RandomName"); - asset.Metadata.Type = assetType; + asset.Type = assetType; asset.Data = data; commsManager.AssetCache.AddAsset(asset); diff --git a/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs b/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs index d6f0713ebd..a8f841bf92 100644 --- a/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs @@ -231,21 +231,21 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture // Create a new asset for user AssetBase asset = new AssetBase(); - asset.Metadata.FullID = UUID.Random(); + asset.FullID = UUID.Random(); asset.Data = assetData; - asset.Metadata.Name = "DynamicImage" + Util.RandomClass.Next(1, 10000); - asset.Metadata.Type = 0; - asset.Metadata.Description = "dynamic image"; - asset.Metadata.Local = false; - asset.Metadata.Temporary = true; + asset.Name = "DynamicImage" + Util.RandomClass.Next(1, 10000); + asset.Type = 0; + asset.Description = "dynamic image"; + asset.Local = false; + asset.Temporary = true; scene.CommsManager.AssetCache.AddAsset(asset); - LastAssetID = asset.Metadata.FullID; + LastAssetID = asset.FullID; IJ2KDecoder cacheLayerDecode = scene.RequestModuleInterface(); if (cacheLayerDecode != null) { - cacheLayerDecode.syncdecode(asset.Metadata.FullID, asset.Data); + cacheLayerDecode.syncdecode(asset.FullID, asset.Data); } cacheLayerDecode = null; @@ -256,7 +256,7 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture UUID oldID = tmptex.DefaultTexture.TextureID; scene.CommsManager.AssetCache.ExpireAsset(oldID); - tmptex.DefaultTexture.TextureID = asset.Metadata.FullID; + tmptex.DefaultTexture.TextureID = asset.FullID; // I'm pretty sure we always want to force this to true tmptex.DefaultTexture.Fullbright = true; diff --git a/OpenSim/Region/CoreModules/Scripting/EMailModules/EmailModule.cs b/OpenSim/Region/CoreModules/Scripting/EMailModules/EmailModule.cs index 43eccf3054..f788433c45 100644 --- a/OpenSim/Region/CoreModules/Scripting/EMailModules/EmailModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/EMailModules/EmailModule.cs @@ -326,8 +326,6 @@ namespace OpenSim.Region.CoreModules.Scripting.EmailModules UUID toID = new UUID(address.Substring(0, address.IndexOf("@"))); - String unused; - if (IsLocal(toID)) // TODO FIX check to see if it is local { // object in this region diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs index 66fc43b6bf..d7ab5fd761 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs @@ -294,7 +294,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver //m_log.DebugFormat("[ARCHIVER]: Importing asset {0}, type {1}", uuid, assetType); AssetBase asset = new AssetBase(new UUID(uuid), String.Empty); - asset.Metadata.Type = assetType; + asset.Type = assetType; asset.Data = data; m_scene.CommsManager.AssetCache.AddAsset(asset); diff --git a/OpenSim/Region/CoreModules/World/Archiver/AssetsArchiver.cs b/OpenSim/Region/CoreModules/World/Archiver/AssetsArchiver.cs index b3286f6c5f..abd90de7a9 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/AssetsArchiver.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/AssetsArchiver.cs @@ -86,16 +86,16 @@ namespace OpenSim.Region.CoreModules.World.Archiver string extension = string.Empty; - if (ArchiveConstants.ASSET_TYPE_TO_EXTENSION.ContainsKey(asset.Metadata.Type)) + if (ArchiveConstants.ASSET_TYPE_TO_EXTENSION.ContainsKey(asset.Type)) { - extension = ArchiveConstants.ASSET_TYPE_TO_EXTENSION[asset.Metadata.Type]; + extension = ArchiveConstants.ASSET_TYPE_TO_EXTENSION[asset.Type]; } xtw.WriteElementString("filename", uuid.ToString() + extension); - xtw.WriteElementString("name", asset.Metadata.Name); - xtw.WriteElementString("description", asset.Metadata.Description); - xtw.WriteElementString("asset-type", asset.Metadata.Type.ToString()); + xtw.WriteElementString("name", asset.Name); + xtw.WriteElementString("description", asset.Description); + xtw.WriteElementString("asset-type", asset.Type.ToString()); xtw.WriteEndElement(); } @@ -123,15 +123,15 @@ namespace OpenSim.Region.CoreModules.World.Archiver string extension = string.Empty; - if (ArchiveConstants.ASSET_TYPE_TO_EXTENSION.ContainsKey(asset.Metadata.Type)) + if (ArchiveConstants.ASSET_TYPE_TO_EXTENSION.ContainsKey(asset.Type)) { - extension = ArchiveConstants.ASSET_TYPE_TO_EXTENSION[asset.Metadata.Type]; + extension = ArchiveConstants.ASSET_TYPE_TO_EXTENSION[asset.Type]; } else { m_log.ErrorFormat( "[ARCHIVER]: Unrecognized asset type {0} with uuid {1}. This asset will be saved but not reloaded", - asset.Metadata.Type, asset.Metadata.ID); + asset.Type, asset.ID); } archive.AddFile( diff --git a/OpenSim/Region/CoreModules/World/Archiver/AssetsDearchiver.cs b/OpenSim/Region/CoreModules/World/Archiver/AssetsDearchiver.cs index 743f9a1a96..cb267d7f9b 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/AssetsDearchiver.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/AssetsDearchiver.cs @@ -157,8 +157,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver m_log.DebugFormat("[ARCHIVER]: Importing asset {0}", filename); AssetBase asset = new AssetBase(new UUID(filename), metadata.Name); - asset.Metadata.Description = metadata.Description; - asset.Metadata.Type = metadata.AssetType; + asset.Description = metadata.Description; + asset.Type = metadata.AssetType; asset.Data = data; m_cache.AddAsset(asset); diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateTerrainXferHandler.cs b/OpenSim/Region/CoreModules/World/Estate/EstateTerrainXferHandler.cs index 1f2d5db87d..93e79f018a 100644 --- a/OpenSim/Region/CoreModules/World/Estate/EstateTerrainXferHandler.cs +++ b/OpenSim/Region/CoreModules/World/Estate/EstateTerrainXferHandler.cs @@ -54,13 +54,13 @@ namespace OpenSim.Region.CoreModules.World.Estate { m_asset = new AssetBase(); - m_asset.Metadata.FullID = UUID.Zero; - m_asset.Metadata.Type = type; + m_asset.FullID = UUID.Zero; + m_asset.Type = type; m_asset.Data = new byte[0]; - m_asset.Metadata.Name = pClientFilename; - m_asset.Metadata.Description = "empty"; - m_asset.Metadata.Local = true; - m_asset.Metadata.Temporary = true; + m_asset.Name = pClientFilename; + m_asset.Description = "empty"; + m_asset.Local = true; + m_asset.Temporary = true; } @@ -72,7 +72,7 @@ namespace OpenSim.Region.CoreModules.World.Estate public void RequestStartXfer(IClientAPI pRemoteClient) { mXferID = Util.GetNextXferID(); - pRemoteClient.SendXferRequest(mXferID, m_asset.Metadata.Type, m_asset.Metadata.FullID, 0, Utils.StringToBytes(m_asset.Metadata.Name)); + pRemoteClient.SendXferRequest(mXferID, m_asset.Type, m_asset.FullID, 0, Utils.StringToBytes(m_asset.Name)); } /// @@ -114,7 +114,7 @@ namespace OpenSim.Region.CoreModules.World.Estate handlerTerrainUploadDone = TerrainUploadDone; if (handlerTerrainUploadDone != null) { - handlerTerrainUploadDone(m_asset.Metadata.Name, m_asset.Data, remoteClient); + handlerTerrainUploadDone(m_asset.Name, m_asset.Data, remoteClient); } } } diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs index e1c3d85190..4f98e8b0db 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs @@ -985,14 +985,14 @@ namespace OpenSim.Region.CoreModules.World.WorldMap m_scene.RegionInfo.RegionSettings.TerrainImageID = TerrainImageUUID; AssetBase asset = new AssetBase(); - asset.Metadata.FullID = m_scene.RegionInfo.RegionSettings.TerrainImageID; + asset.FullID = m_scene.RegionInfo.RegionSettings.TerrainImageID; asset.Data = data; - asset.Metadata.Name + asset.Name = "terrainImage_" + m_scene.RegionInfo.RegionID.ToString() + "_" + lastMapRefresh.ToString(); - asset.Metadata.Description = m_scene.RegionInfo.RegionName; + asset.Description = m_scene.RegionInfo.RegionName; - asset.Metadata.Type = 0; - asset.Metadata.Temporary = temporary; + asset.Type = 0; + asset.Temporary = temporary; m_scene.CommsManager.AssetCache.AddAsset(asset); } diff --git a/OpenSim/Region/Framework/Scenes/Hypergrid/HGAssetMapper.cs b/OpenSim/Region/Framework/Scenes/Hypergrid/HGAssetMapper.cs index 1f01fa2bf1..1a3c4c8774 100644 --- a/OpenSim/Region/Framework/Scenes/Hypergrid/HGAssetMapper.cs +++ b/OpenSim/Region/Framework/Scenes/Hypergrid/HGAssetMapper.cs @@ -120,12 +120,12 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid if (m_scene.CommsManager.AssetCache.TryGetCachedAsset(assetID, out asset) && (asset != null)) { - m_log.Debug("[HGScene]: Asset made it to asset cache. " + asset.Metadata.Name + " " + assetID); + m_log.Debug("[HGScene]: Asset made it to asset cache. " + asset.Name + " " + assetID); // I think I need to store it in the asset DB too. // For now, let me just do it for textures and scripts - if (((AssetType)asset.Metadata.Type == AssetType.Texture) || - ((AssetType)asset.Metadata.Type == AssetType.LSLBytecode) || - ((AssetType)asset.Metadata.Type == AssetType.LSLText)) + if (((AssetType)asset.Type == AssetType.Texture) || + ((AssetType)asset.Type == AssetType.LSLBytecode) || + ((AssetType)asset.Type == AssetType.LSLText)) { AssetBase asset1 = new AssetBase(); Copy(asset, asset1); @@ -149,7 +149,7 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid if (asset1 != null) { // See long comment in AssetCache.AddAsset - if (!asset1.Metadata.Temporary || asset1.Metadata.Local) + if (!asset1.Temporary || asset1.Local) { // The asset cache returns instances of subclasses of AssetBase: // TextureImage or AssetInfo. So in passing them to the remote @@ -170,14 +170,14 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid private void Copy(AssetBase from, AssetBase to) { - to.Data = from.Data; - to.Metadata.Description = from.Metadata.Description; - to.Metadata.FullID = from.Metadata.FullID; - to.Metadata.ID = from.Metadata.ID; - to.Metadata.Local = from.Metadata.Local; - to.Metadata.Name = from.Metadata.Name; - to.Metadata.Temporary = from.Metadata.Temporary; - to.Metadata.Type = from.Metadata.Type; + to.Data = from.Data; + to.Description = from.Description; + to.FullID = from.FullID; + to.ID = from.ID; + to.Local = from.Local; + to.Name = from.Name; + to.Temporary = from.Temporary; + to.Type = from.Type; } @@ -235,7 +235,7 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid private Dictionary SniffUUIDs(AssetBase asset) { Dictionary uuids = new Dictionary(); - if ((asset != null) && ((AssetType)asset.Metadata.Type == AssetType.Object)) + if ((asset != null) && ((AssetType)asset.Type == AssetType.Object)) { string ass_str = Utils.BytesToString(asset.Data); SceneObjectGroup sog = new SceneObjectGroup(ass_str, true); diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index c98629bdcf..2800e9ec92 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -193,11 +193,11 @@ namespace OpenSim.Region.Framework.Scenes CreateAsset(item.Name, item.Description, (sbyte)item.AssetType, data); CommsManager.AssetCache.AddAsset(asset); - item.AssetID = asset.Metadata.FullID; + item.AssetID = asset.FullID; userInfo.UpdateItem(item); // remoteClient.SendInventoryItemCreateUpdate(item); - return (asset.Metadata.FullID); + return (asset.FullID); } } } @@ -285,7 +285,7 @@ namespace OpenSim.Region.Framework.Scenes } // Update item with new asset - item.AssetID = asset.Metadata.FullID; + item.AssetID = asset.FullID; group.UpdateInventoryItem(item); part.GetProperties(remoteClient); @@ -688,7 +688,7 @@ namespace OpenSim.Region.Framework.Scenes { if (newName != String.Empty) { - asset.Metadata.Name = newName; + asset.Name = newName; } else { @@ -728,10 +728,10 @@ namespace OpenSim.Region.Framework.Scenes private AssetBase CreateAsset(string name, string description, sbyte assetType, byte[] data) { AssetBase asset = new AssetBase(); - asset.Metadata.Name = name; - asset.Metadata.Description = description; - asset.Metadata.Type = assetType; - asset.Metadata.FullID = UUID.Random(); + asset.Name = name; + asset.Description = description; + asset.Type = assetType; + asset.FullID = UUID.Random(); asset.Data = (data == null) ? new byte[1] : data; return asset; @@ -831,11 +831,11 @@ namespace OpenSim.Region.Framework.Scenes item.Owner = remoteClient.AgentId; item.Creator = remoteClient.AgentId; item.ID = UUID.Random(); - item.AssetID = asset.Metadata.FullID; - item.Description = asset.Metadata.Description; + item.AssetID = asset.FullID; + item.Description = asset.Description; item.Name = name; item.Flags = flags; - item.AssetType = asset.Metadata.Type; + item.AssetType = asset.Type; item.InvType = invType; item.Folder = folderID; item.CurrentPermissions = currentMask; @@ -905,7 +905,7 @@ namespace OpenSim.Region.Framework.Scenes AssetBase asset = CreateAsset(name, description, assetType, data); CommsManager.AssetCache.AddAsset(asset); - CreateNewInventoryItem(remoteClient, folderID, asset.Metadata.Name, 0, callbackID, asset, invType, nextOwnerMask, creationDate); + CreateNewInventoryItem(remoteClient, folderID, asset.Name, 0, callbackID, asset, invType, nextOwnerMask, creationDate); } else { @@ -1553,7 +1553,7 @@ namespace OpenSim.Region.Framework.Scenes taskItem.Flags = itemBase.Flags; taskItem.PermsGranter = UUID.Zero; taskItem.PermsMask = 0; - taskItem.AssetID = asset.Metadata.FullID; + taskItem.AssetID = asset.FullID; part.Inventory.AddInventoryItem(taskItem, false); part.GetProperties(remoteClient); @@ -1953,16 +1953,16 @@ namespace OpenSim.Region.Framework.Scenes (sbyte)AssetType.Object, Utils.StringToBytes(sceneObjectXml)); CommsManager.AssetCache.AddAsset(asset); - assetID = asset.Metadata.FullID; + assetID = asset.FullID; if (DeRezAction.SaveToExistingUserInventoryItem == action) { - item.AssetID = asset.Metadata.FullID; + item.AssetID = asset.FullID; userInfo.UpdateItem(item); } else { - item.AssetID = asset.Metadata.FullID; + item.AssetID = asset.FullID; if (remoteClient != null && (remoteClient.AgentId != objectGroup.RootPart.OwnerID) && Permissions.PropagatePermissions()) { @@ -1995,9 +1995,9 @@ namespace OpenSim.Region.Framework.Scenes // TODO: add the new fields (Flags, Sale info, etc) item.CreationDate = Util.UnixTimeSinceEpoch(); - item.Description = asset.Metadata.Description; - item.Name = asset.Metadata.Name; - item.AssetType = asset.Metadata.Type; + item.Description = asset.Description; + item.Name = asset.Name; + item.AssetType = asset.Type; userInfo.AddItem(item); @@ -2080,10 +2080,10 @@ namespace OpenSim.Region.Framework.Scenes Utils.StringToBytes(sceneObjectXml)); CommsManager.AssetCache.AddAsset(asset); - item.AssetID = asset.Metadata.FullID; - item.Description = asset.Metadata.Description; - item.Name = asset.Metadata.Name; - item.AssetType = asset.Metadata.Type; + item.AssetID = asset.FullID; + item.Description = asset.Description; + item.Name = asset.Name; + item.AssetType = asset.Type; item.InvType = (int)InventoryType.Object; item.Folder = foundFolder; @@ -2121,10 +2121,10 @@ namespace OpenSim.Region.Framework.Scenes item.Creator = grp.RootPart.CreatorID; item.Owner = remoteClient.AgentId; item.ID = UUID.Random(); - item.AssetID = asset.Metadata.FullID; - item.Description = asset.Metadata.Description; - item.Name = asset.Metadata.Name; - item.AssetType = asset.Metadata.Type; + item.AssetID = asset.FullID; + item.Description = asset.Description; + item.Name = asset.Name; + item.AssetType = asset.Type; item.InvType = (int)InventoryType.Object; item.Folder = UUID.Zero; // Objects folder! diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 5badd2d897..1d2f37ad0a 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -3555,10 +3555,10 @@ namespace OpenSim.Region.Framework.Scenes item.ID = UUID.Random(); item.Owner = remoteClient.AgentId; - item.AssetID = asset.Metadata.FullID; - item.Description = asset.Metadata.Description; - item.Name = asset.Metadata.Name; - item.AssetType = asset.Metadata.Type; + item.AssetID = asset.FullID; + item.Description = asset.Description; + item.Name = asset.Name; + item.AssetType = asset.Type; item.InvType = (int)InventoryType.Object; item.Folder = categoryID; diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index e4ef236748..eeef58bbac 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -1025,10 +1025,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api // Create new asset AssetBase asset = new AssetBase(); - asset.Metadata.Name = notecardName; - asset.Metadata.Description = "Script Generated Notecard"; - asset.Metadata.Type = 7; - asset.Metadata.FullID = UUID.Random(); + asset.Name = notecardName; + asset.Description = "Script Generated Notecard"; + asset.Type = 7; + asset.FullID = UUID.Random(); string notecardData = ""; for (int i = 0; i < contents.Length; i++) { @@ -1048,8 +1048,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api taskItem.ResetIDs(m_host.UUID); taskItem.ParentID = m_host.UUID; taskItem.CreationDate = (uint)Util.UnixTimeSinceEpoch(); - taskItem.Name = asset.Metadata.Name; - taskItem.Description = asset.Metadata.Description; + taskItem.Name = asset.Name; + taskItem.Description = asset.Description; taskItem.Type = 7; taskItem.InvType = 7; taskItem.OwnerID = m_host.OwnerID; @@ -1063,7 +1063,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api taskItem.Flags = 0; taskItem.PermsGranter = UUID.Zero; taskItem.PermsMask = 0; - taskItem.AssetID = asset.Metadata.FullID; + taskItem.AssetID = asset.FullID; m_host.Inventory.AddInventoryItem(taskItem, false); }