- add OpenSim.Framework.AssetMetadata class. AssetBase is now composed of it

- trim trailing whitespace
0.6.3-post-fixes
Mike Mazur 2009-02-04 00:01:36 +00:00
parent 1adb8c33b2
commit 0c03a48fb2
33 changed files with 861 additions and 810 deletions

View File

@ -218,12 +218,12 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
rdata.writer.WriteStartElement(String.Empty,"Asset",String.Empty); rdata.writer.WriteStartElement(String.Empty,"Asset",String.Empty);
rdata.writer.WriteAttributeString("id", asset.ID.ToString()); rdata.writer.WriteAttributeString("id", asset.Metadata.ID);
rdata.writer.WriteAttributeString("name", asset.Name); rdata.writer.WriteAttributeString("name", asset.Metadata.Name);
rdata.writer.WriteAttributeString("desc", asset.Description); rdata.writer.WriteAttributeString("desc", asset.Metadata.Description);
rdata.writer.WriteAttributeString("type", asset.Type.ToString()); rdata.writer.WriteAttributeString("type", asset.Metadata.Type.ToString());
rdata.writer.WriteAttributeString("local", asset.Local.ToString()); rdata.writer.WriteAttributeString("local", asset.Metadata.Local.ToString());
rdata.writer.WriteAttributeString("temporary", asset.Temporary.ToString()); rdata.writer.WriteAttributeString("temporary", asset.Metadata.Temporary.ToString());
rdata.writer.WriteBase64(asset.Data,0,asset.Data.Length); rdata.writer.WriteBase64(asset.Data,0,asset.Data.Length);
@ -275,18 +275,18 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
created = !modified; created = !modified;
asset = new AssetBase(); asset = new AssetBase();
asset.FullID = uuid; asset.Metadata.FullID = uuid;
asset.Name = xml.GetAttribute("name"); asset.Metadata.Name = xml.GetAttribute("name");
asset.Description = xml.GetAttribute("desc"); asset.Metadata.Description = xml.GetAttribute("desc");
asset.Type = SByte.Parse(xml.GetAttribute("type")); asset.Metadata.Type = SByte.Parse(xml.GetAttribute("type"));
asset.Local = Int32.Parse(xml.GetAttribute("local")) != 0; asset.Metadata.Local = Int32.Parse(xml.GetAttribute("local")) != 0;
asset.Temporary = Int32.Parse(xml.GetAttribute("temporary")) != 0; asset.Metadata.Temporary = Int32.Parse(xml.GetAttribute("temporary")) != 0;
asset.Data = Convert.FromBase64String(xml.ReadElementContentAsString("Asset", "")); asset.Data = Convert.FromBase64String(xml.ReadElementContentAsString("Asset", ""));
if (asset.ID != rdata.Parameters[0]) if (asset.Metadata.ID != rdata.Parameters[0])
{ {
Rest.Log.WarnFormat("{0} URI and payload disagree on UUID U:{1} vs P:{2}", Rest.Log.WarnFormat("{0} URI and payload disagree on UUID U:{1} vs P:{2}",
MsgId, rdata.Parameters[0], asset.ID); MsgId, rdata.Parameters[0], asset.Metadata.ID);
} }
Rest.AssetServices.AddAsset(asset); Rest.AssetServices.AddAsset(asset);
@ -300,14 +300,14 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
if (created) if (created)
{ {
rdata.appendStatus(String.Format("<p> Created asset {0}, UUID {1} <p>", asset.Name, asset.FullID)); rdata.appendStatus(String.Format("<p> Created asset {0}, UUID {1} <p>", asset.Metadata.Name, asset.Metadata.FullID));
rdata.Complete(Rest.HttpStatusCodeCreated); rdata.Complete(Rest.HttpStatusCodeCreated);
} }
else else
{ {
if (modified) if (modified)
{ {
rdata.appendStatus(String.Format("<p> Modified asset {0}, UUID {1} <p>", asset.Name, asset.FullID)); rdata.appendStatus(String.Format("<p> Modified asset {0}, UUID {1} <p>", asset.Metadata.Name, asset.Metadata.FullID));
rdata.Complete(Rest.HttpStatusCodeOK); rdata.Complete(Rest.HttpStatusCodeOK);
} }
else else
@ -355,26 +355,26 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
created = !modified; created = !modified;
asset = new AssetBase(); asset = new AssetBase();
asset.FullID = uuid; asset.Metadata.FullID = uuid;
asset.Name = xml.GetAttribute("name"); asset.Metadata.Name = xml.GetAttribute("name");
asset.Description = xml.GetAttribute("desc"); asset.Metadata.Description = xml.GetAttribute("desc");
asset.Type = SByte.Parse(xml.GetAttribute("type")); asset.Metadata.Type = SByte.Parse(xml.GetAttribute("type"));
asset.Local = Int32.Parse(xml.GetAttribute("local")) != 0; asset.Metadata.Local = Int32.Parse(xml.GetAttribute("local")) != 0;
asset.Temporary = Int32.Parse(xml.GetAttribute("temporary")) != 0; asset.Metadata.Temporary = Int32.Parse(xml.GetAttribute("temporary")) != 0;
asset.Data = Convert.FromBase64String(xml.ReadElementContentAsString("Asset", "")); asset.Data = Convert.FromBase64String(xml.ReadElementContentAsString("Asset", ""));
Rest.AssetServices.AddAsset(asset); Rest.AssetServices.AddAsset(asset);
if (created) if (created)
{ {
rdata.appendStatus(String.Format("<p> Created asset {0}, UUID {1} <p>", asset.Name, asset.FullID)); rdata.appendStatus(String.Format("<p> Created asset {0}, UUID {1} <p>", asset.Metadata.Name, asset.Metadata.FullID));
rdata.Complete(Rest.HttpStatusCodeCreated); rdata.Complete(Rest.HttpStatusCodeCreated);
} }
else else
{ {
if (modified) if (modified)
{ {
rdata.appendStatus(String.Format("<p> Modified asset {0}, UUID {1} <p>", asset.Name, asset.FullID)); rdata.appendStatus(String.Format("<p> Modified asset {0}, UUID {1} <p>", asset.Metadata.Name, asset.Metadata.FullID));
rdata.Complete(Rest.HttpStatusCodeOK); rdata.Complete(Rest.HttpStatusCodeOK);
} }
else else

View File

@ -488,12 +488,12 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
foreach (AssetBase asset in entity.Assets) foreach (AssetBase asset in entity.Assets)
{ {
Rest.Log.DebugFormat("{0} Rest asset: {1} {2} {3}", Rest.Log.DebugFormat("{0} Rest asset: {1} {2} {3}",
MsgId, asset.ID, asset.Type, asset.Name); MsgId, asset.Metadata.ID, asset.Metadata.Type, asset.Metadata.Name);
Rest.AssetServices.AddAsset(asset); Rest.AssetServices.AddAsset(asset);
created = true; created = true;
rdata.appendStatus(String.Format("<p> Created asset {0}, UUID {1} <p>", rdata.appendStatus(String.Format("<p> Created asset {0}, UUID {1} <p>",
asset.Name, asset.ID)); asset.Metadata.Name, asset.Metadata.ID));
if (Rest.DEBUG && Rest.DumpAsset) if (Rest.DEBUG && Rest.DumpAsset)
{ {
@ -691,14 +691,14 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
foreach (AssetBase asset in entity.Assets) foreach (AssetBase asset in entity.Assets)
{ {
Rest.Log.DebugFormat("{0} Rest asset: {1} {2} {3}", Rest.Log.DebugFormat("{0} Rest asset: {1} {2} {3}",
MsgId, asset.ID, asset.Type, asset.Name); MsgId, asset.Metadata.ID, asset.Metadata.Type, asset.Metadata.Name);
// The asset was validated during the collection process // The asset was validated during the collection process
Rest.AssetServices.AddAsset(asset); Rest.AssetServices.AddAsset(asset);
created = true; created = true;
rdata.appendStatus(String.Format("<p> Created asset {0}, UUID {1} <p>", asset.Name, asset.ID)); rdata.appendStatus(String.Format("<p> Created asset {0}, UUID {1} <p>", asset.Metadata.Name, asset.Metadata.ID));
if (Rest.DEBUG && Rest.DumpAsset) if (Rest.DEBUG && Rest.DumpAsset)
{ {
@ -1884,10 +1884,10 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
asset = new AssetBase(uuid, name); asset = new AssetBase(uuid, name);
asset.Description = desc; asset.Metadata.Description = desc;
asset.Type = type; // type == 0 == texture asset.Metadata.Type = type; // type == 0 == texture
asset.Local = local; asset.Metadata.Local = local;
asset.Temporary = temp; asset.Metadata.Temporary = temp;
b64string = ic.xml.ReadElementContentAsString(); b64string = ic.xml.ReadElementContentAsString();
@ -2039,10 +2039,10 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
if (ic.Asset != null) if (ic.Asset != null)
{ {
if (ic.Asset.Name == String.Empty) if (ic.Asset.Metadata.Name == String.Empty)
ic.Asset.Name = ic.Item.Name; ic.Asset.Metadata.Name = ic.Item.Name;
if (ic.Asset.Description == String.Empty) if (ic.Asset.Metadata.Description == String.Empty)
ic.Asset.Description = ic.Item.Description; ic.Asset.Metadata.Description = ic.Item.Description;
} }
// Assign permissions // Assign permissions

View File

@ -132,12 +132,12 @@ namespace OpenSim.Data.MSSQL
{ {
AssetBase asset = new AssetBase(); AssetBase asset = new AssetBase();
// Region Main // Region Main
asset.FullID = new UUID((string)reader["id"]); asset.Metadata.FullID = new UUID((string)reader["id"]);
asset.Name = (string)reader["name"]; asset.Metadata.Name = (string)reader["name"];
asset.Description = (string)reader["description"]; asset.Metadata.Description = (string)reader["description"];
asset.Type = Convert.ToSByte(reader["assetType"]); asset.Metadata.Type = Convert.ToSByte(reader["assetType"]);
asset.Local = Convert.ToBoolean(reader["local"]); asset.Metadata.Local = Convert.ToBoolean(reader["local"]);
asset.Temporary = Convert.ToBoolean(reader["temporary"]); asset.Metadata.Temporary = Convert.ToBoolean(reader["temporary"]);
asset.Data = (byte[])reader["data"]; asset.Data = (byte[])reader["data"];
return asset; return asset;
} }
@ -152,7 +152,7 @@ namespace OpenSim.Data.MSSQL
/// <param name="asset">the asset</param> /// <param name="asset">the asset</param>
override public void CreateAsset(AssetBase asset) override public void CreateAsset(AssetBase asset)
{ {
if (ExistsAsset(asset.FullID)) if (ExistsAsset(asset.Metadata.FullID))
{ {
return; return;
} }
@ -163,12 +163,12 @@ namespace OpenSim.Data.MSSQL
"(@id, @name, @description, @assetType, @local, @temporary, @create_time, @access_time, @data)")) "(@id, @name, @description, @assetType, @local, @temporary, @create_time, @access_time, @data)"))
{ {
int now = (int)((System.DateTime.Now.Ticks - TicksToEpoch) / 10000000); int now = (int)((System.DateTime.Now.Ticks - TicksToEpoch) / 10000000);
command.Parameters.Add(database.CreateParameter("id", asset.FullID)); command.Parameters.Add(database.CreateParameter("id", asset.Metadata.FullID));
command.Parameters.Add(database.CreateParameter("name", asset.Name)); command.Parameters.Add(database.CreateParameter("name", asset.Metadata.Name));
command.Parameters.Add(database.CreateParameter("description", asset.Description)); command.Parameters.Add(database.CreateParameter("description", asset.Metadata.Description));
command.Parameters.Add(database.CreateParameter("assetType", asset.Type)); command.Parameters.Add(database.CreateParameter("assetType", asset.Metadata.Type));
command.Parameters.Add(database.CreateParameter("local", asset.Local)); command.Parameters.Add(database.CreateParameter("local", asset.Metadata.Local));
command.Parameters.Add(database.CreateParameter("temporary", asset.Temporary)); command.Parameters.Add(database.CreateParameter("temporary", asset.Metadata.Temporary));
command.Parameters.Add(database.CreateParameter("access_time", now)); command.Parameters.Add(database.CreateParameter("access_time", now));
command.Parameters.Add(database.CreateParameter("create_time", now)); command.Parameters.Add(database.CreateParameter("create_time", now));
command.Parameters.Add(database.CreateParameter("data", asset.Data)); command.Parameters.Add(database.CreateParameter("data", asset.Data));
@ -192,14 +192,14 @@ namespace OpenSim.Data.MSSQL
"data = @data where " + "data = @data where " +
"id = @keyId;")) "id = @keyId;"))
{ {
command.Parameters.Add(database.CreateParameter("id", asset.FullID)); command.Parameters.Add(database.CreateParameter("id", asset.Metadata.FullID));
command.Parameters.Add(database.CreateParameter("name", asset.Name)); command.Parameters.Add(database.CreateParameter("name", asset.Metadata.Name));
command.Parameters.Add(database.CreateParameter("description", asset.Description)); command.Parameters.Add(database.CreateParameter("description", asset.Metadata.Description));
command.Parameters.Add(database.CreateParameter("assetType", asset.Type)); command.Parameters.Add(database.CreateParameter("assetType", asset.Metadata.Type));
command.Parameters.Add(database.CreateParameter("local", asset.Local)); command.Parameters.Add(database.CreateParameter("local", asset.Metadata.Local));
command.Parameters.Add(database.CreateParameter("temporary", asset.Temporary)); command.Parameters.Add(database.CreateParameter("temporary", asset.Metadata.Temporary));
command.Parameters.Add(database.CreateParameter("data", asset.Data)); command.Parameters.Add(database.CreateParameter("data", asset.Data));
command.Parameters.Add(database.CreateParameter("@keyId", asset.FullID)); command.Parameters.Add(database.CreateParameter("@keyId", asset.Metadata.FullID));
try try
{ {

View File

@ -139,18 +139,18 @@ namespace OpenSim.Data.MySQL
{ {
asset = new AssetBase(); asset = new AssetBase();
asset.Data = (byte[]) dbReader["data"]; asset.Data = (byte[]) dbReader["data"];
asset.Description = (string) dbReader["description"]; asset.Metadata.Description = (string) dbReader["description"];
asset.FullID = assetID; asset.Metadata.FullID = assetID;
try try
{ {
asset.Local = (bool)dbReader["local"]; asset.Metadata.Local = (bool)dbReader["local"];
} }
catch (System.InvalidCastException) catch (System.InvalidCastException)
{ {
asset.Local = false; asset.Metadata.Local = false;
} }
asset.Name = (string) dbReader["name"]; asset.Metadata.Name = (string) dbReader["name"];
asset.Type = (sbyte) dbReader["assetType"]; asset.Metadata.Type = (sbyte) dbReader["assetType"];
} }
dbReader.Close(); dbReader.Close();
cmd.Dispose(); cmd.Dispose();
@ -178,8 +178,8 @@ namespace OpenSim.Data.MySQL
{ {
lock (_dbConnection) lock (_dbConnection)
{ {
//m_log.Info("[ASSET DB]: Creating Asset " + Util.ToRawUuidString(asset.FullID)); //m_log.Info("[ASSET DB]: Creating Asset " + Util.ToRawUuidString(asset.Metadata.FullID));
if (ExistsAsset(asset.FullID)) if (ExistsAsset(asset.Metadata.FullID))
{ {
//m_log.Info("[ASSET DB]: Asset exists already, ignoring."); //m_log.Info("[ASSET DB]: Asset exists already, ignoring.");
return; return;
@ -200,12 +200,12 @@ namespace OpenSim.Data.MySQL
{ {
// create unix epoch time // create unix epoch time
int now = (int)((System.DateTime.Now.Ticks - TicksToEpoch) / 10000000); int now = (int)((System.DateTime.Now.Ticks - TicksToEpoch) / 10000000);
cmd.Parameters.AddWithValue("?id", asset.FullID.ToString()); cmd.Parameters.AddWithValue("?id", asset.Metadata.ID);
cmd.Parameters.AddWithValue("?name", asset.Name); cmd.Parameters.AddWithValue("?name", asset.Metadata.Name);
cmd.Parameters.AddWithValue("?description", asset.Description); cmd.Parameters.AddWithValue("?description", asset.Metadata.Description);
cmd.Parameters.AddWithValue("?assetType", asset.Type); cmd.Parameters.AddWithValue("?assetType", asset.Metadata.Type);
cmd.Parameters.AddWithValue("?local", asset.Local); cmd.Parameters.AddWithValue("?local", asset.Metadata.Local);
cmd.Parameters.AddWithValue("?temporary", asset.Temporary); cmd.Parameters.AddWithValue("?temporary", asset.Metadata.Temporary);
cmd.Parameters.AddWithValue("?create_time", now); cmd.Parameters.AddWithValue("?create_time", now);
cmd.Parameters.AddWithValue("?access_time", now); cmd.Parameters.AddWithValue("?access_time", now);
cmd.Parameters.AddWithValue("?data", asset.Data); cmd.Parameters.AddWithValue("?data", asset.Data);
@ -218,7 +218,7 @@ namespace OpenSim.Data.MySQL
m_log.ErrorFormat( m_log.ErrorFormat(
"[ASSETS DB]: " + "[ASSETS DB]: " +
"MySql failure creating asset {0} with name {1}" + Environment.NewLine + e.ToString() "MySql failure creating asset {0} with name {1}" + Environment.NewLine + e.ToString()
+ Environment.NewLine + "Attempting reconnection", asset.FullID, asset.Name); + Environment.NewLine + "Attempting reconnection", asset.Metadata.FullID, asset.Metadata.Name);
_dbConnection.Reconnect(); _dbConnection.Reconnect();
} }
} }
@ -241,7 +241,7 @@ namespace OpenSim.Data.MySQL
{ {
// create unix epoch time // create unix epoch time
int now = (int)((System.DateTime.Now.Ticks - TicksToEpoch) / 10000000); int now = (int)((System.DateTime.Now.Ticks - TicksToEpoch) / 10000000);
cmd.Parameters.AddWithValue("?id", asset.FullID.ToString()); cmd.Parameters.AddWithValue("?id", asset.Metadata.ID);
cmd.Parameters.AddWithValue("?access_time", now); cmd.Parameters.AddWithValue("?access_time", now);
cmd.ExecuteNonQuery(); cmd.ExecuteNonQuery();
cmd.Dispose(); cmd.Dispose();
@ -252,7 +252,7 @@ namespace OpenSim.Data.MySQL
m_log.ErrorFormat( m_log.ErrorFormat(
"[ASSETS DB]: " + "[ASSETS DB]: " +
"MySql failure updating access_time for asset {0} with name {1}" + Environment.NewLine + e.ToString() "MySql failure updating access_time for asset {0} with name {1}" + Environment.NewLine + e.ToString()
+ Environment.NewLine + "Attempting reconnection", asset.FullID, asset.Name); + Environment.NewLine + "Attempting reconnection", asset.Metadata.FullID, asset.Metadata.Name);
_dbConnection.Reconnect(); _dbConnection.Reconnect();
} }
} }

View File

@ -69,7 +69,7 @@ namespace OpenSim.Data.NHibernate
private void Save(AssetBase asset) private void Save(AssetBase asset)
{ {
AssetBase temp = (AssetBase)manager.Load(typeof(AssetBase), asset.FullID); AssetBase temp = (AssetBase)manager.Load(typeof(AssetBase), asset.Metadata.FullID);
if (temp == null) if (temp == null)
{ {
manager.Save(asset); manager.Save(asset);
@ -78,13 +78,13 @@ namespace OpenSim.Data.NHibernate
override public void CreateAsset(AssetBase asset) override public void CreateAsset(AssetBase asset)
{ {
m_log.InfoFormat("[NHIBERNATE] inserting asset {0}", asset.FullID); m_log.InfoFormat("[NHIBERNATE] inserting asset {0}", asset.Metadata.FullID);
Save(asset); Save(asset);
} }
override public void UpdateAsset(AssetBase asset) override public void UpdateAsset(AssetBase asset)
{ {
m_log.InfoFormat("[NHIBERNATE] updating asset {0}", asset.FullID); m_log.InfoFormat("[NHIBERNATE] updating asset {0}", asset.Metadata.FullID);
manager.Update(asset); manager.Update(asset);
} }

View File

@ -125,8 +125,8 @@ namespace OpenSim.Data.SQLite
/// <param name="asset">Asset Base</param> /// <param name="asset">Asset Base</param>
override public void CreateAsset(AssetBase asset) override public void CreateAsset(AssetBase asset)
{ {
//m_log.Info("[ASSET DB]: Creating Asset " + Util.ToRawUuidString(asset.FullID)); //m_log.Info("[ASSET DB]: Creating Asset " + Util.ToRawUuidString(asset.Metadata.FullID));
if (ExistsAsset(asset.FullID)) if (ExistsAsset(asset.Metadata.FullID))
{ {
//m_log.Info("[ASSET DB]: Asset exists already, ignoring."); //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)) using (SqliteCommand cmd = new SqliteCommand(InsertAssetSQL, m_conn))
{ {
cmd.Parameters.Add(new SqliteParameter(":UUID", Util.ToRawUuidString(asset.FullID))); cmd.Parameters.Add(new SqliteParameter(":UUID", Util.ToRawUuidString(asset.Metadata.FullID)));
cmd.Parameters.Add(new SqliteParameter(":Name", asset.Name)); cmd.Parameters.Add(new SqliteParameter(":Name", asset.Metadata.Name));
cmd.Parameters.Add(new SqliteParameter(":Description", asset.Description)); cmd.Parameters.Add(new SqliteParameter(":Description", asset.Metadata.Description));
cmd.Parameters.Add(new SqliteParameter(":Type", asset.Type)); cmd.Parameters.Add(new SqliteParameter(":Type", asset.Metadata.Type));
cmd.Parameters.Add(new SqliteParameter(":Local", asset.Local)); cmd.Parameters.Add(new SqliteParameter(":Local", asset.Metadata.Local));
cmd.Parameters.Add(new SqliteParameter(":Temporary", asset.Temporary)); cmd.Parameters.Add(new SqliteParameter(":Temporary", asset.Metadata.Temporary));
cmd.Parameters.Add(new SqliteParameter(":Data", asset.Data)); cmd.Parameters.Add(new SqliteParameter(":Data", asset.Data));
cmd.ExecuteNonQuery(); cmd.ExecuteNonQuery();
@ -162,12 +162,12 @@ namespace OpenSim.Data.SQLite
{ {
using (SqliteCommand cmd = new SqliteCommand(UpdateAssetSQL, m_conn)) using (SqliteCommand cmd = new SqliteCommand(UpdateAssetSQL, m_conn))
{ {
cmd.Parameters.Add(new SqliteParameter(":UUID", Util.ToRawUuidString(asset.FullID))); cmd.Parameters.Add(new SqliteParameter(":UUID", Util.ToRawUuidString(asset.Metadata.FullID)));
cmd.Parameters.Add(new SqliteParameter(":Name", asset.Name)); cmd.Parameters.Add(new SqliteParameter(":Name", asset.Metadata.Name));
cmd.Parameters.Add(new SqliteParameter(":Description", asset.Description)); cmd.Parameters.Add(new SqliteParameter(":Description", asset.Metadata.Description));
cmd.Parameters.Add(new SqliteParameter(":Type", asset.Type)); cmd.Parameters.Add(new SqliteParameter(":Type", asset.Metadata.Type));
cmd.Parameters.Add(new SqliteParameter(":Local", asset.Local)); cmd.Parameters.Add(new SqliteParameter(":Local", asset.Metadata.Local));
cmd.Parameters.Add(new SqliteParameter(":Temporary", asset.Temporary)); cmd.Parameters.Add(new SqliteParameter(":Temporary", asset.Metadata.Temporary));
cmd.Parameters.Add(new SqliteParameter(":Data", asset.Data)); cmd.Parameters.Add(new SqliteParameter(":Data", asset.Data));
cmd.ExecuteNonQuery(); cmd.ExecuteNonQuery();
@ -181,14 +181,14 @@ namespace OpenSim.Data.SQLite
/// <param name="asset"></param> /// <param name="asset"></param>
private static void LogAssetLoad(AssetBase asset) private static void LogAssetLoad(AssetBase asset)
{ {
string temporary = asset.Temporary ? "Temporary" : "Stored"; string temporary = asset.Metadata.Temporary ? "Temporary" : "Stored";
string local = asset.Local ? "Local" : "Remote"; string local = asset.Metadata.Local ? "Local" : "Remote";
int assetLength = (asset.Data != null) ? asset.Data.Length : 0; int assetLength = (asset.Data != null) ? asset.Data.Length : 0;
m_log.Info("[ASSET DB]: " + m_log.Info("[ASSET DB]: " +
string.Format("Loaded {6} {5} Asset: [{0}][{3}] \"{1}\":{2} ({7} bytes)", string.Format("Loaded {6} {5} Asset: [{0}][{3}] \"{1}\":{2} ({7} bytes)",
asset.FullID, asset.Name, asset.Description, asset.Type, asset.Metadata.FullID, asset.Metadata.Name, asset.Metadata.Description, asset.Metadata.Type,
temporary, local, assetLength)); temporary, local, assetLength));
} }
@ -246,12 +246,12 @@ namespace OpenSim.Data.SQLite
// back out. Not enough time to figure it out yet. // back out. Not enough time to figure it out yet.
AssetBase asset = new AssetBase(); AssetBase asset = new AssetBase();
asset.FullID = new UUID((String) row["UUID"]); asset.Metadata.FullID = new UUID((String) row["UUID"]);
asset.Name = (String) row["Name"]; asset.Metadata.Name = (String) row["Name"];
asset.Description = (String) row["Description"]; asset.Metadata.Description = (String) row["Description"];
asset.Type = Convert.ToSByte(row["Type"]); asset.Metadata.Type = Convert.ToSByte(row["Type"]);
asset.Local = Convert.ToBoolean(row["Local"]); asset.Metadata.Local = Convert.ToBoolean(row["Local"]);
asset.Temporary = Convert.ToBoolean(row["Temporary"]); asset.Metadata.Temporary = Convert.ToBoolean(row["Temporary"]);
asset.Data = (byte[]) row["Data"]; asset.Data = (byte[]) row["Data"];
return asset; return asset;
} }

View File

@ -85,16 +85,16 @@ namespace OpenSim.Data.Tests
db.CreateAsset(a3); db.CreateAsset(a3);
AssetBase a1a = db.FetchAsset(uuid1); AssetBase a1a = db.FetchAsset(uuid1);
Assert.That(a1.ID, Is.EqualTo(a1a.ID)); Assert.That(a1.Metadata.ID, Is.EqualTo(a1a.Metadata.ID));
Assert.That(a1.Name, Is.EqualTo(a1a.Name)); Assert.That(a1.Metadata.Name, Is.EqualTo(a1a.Metadata.Name));
AssetBase a2a = db.FetchAsset(uuid2); AssetBase a2a = db.FetchAsset(uuid2);
Assert.That(a2.ID, Is.EqualTo(a2a.ID)); Assert.That(a2.Metadata.ID, Is.EqualTo(a2a.Metadata.ID));
Assert.That(a2.Name, Is.EqualTo(a2a.Name)); Assert.That(a2.Metadata.Name, Is.EqualTo(a2a.Metadata.Name));
AssetBase a3a = db.FetchAsset(uuid3); AssetBase a3a = db.FetchAsset(uuid3);
Assert.That(a3.ID, Is.EqualTo(a3a.ID)); Assert.That(a3.Metadata.ID, Is.EqualTo(a3a.Metadata.ID));
Assert.That(a3.Name, Is.EqualTo(a3a.Name)); Assert.That(a3.Metadata.Name, Is.EqualTo(a3a.Metadata.Name));
} }
[Test] [Test]

View File

@ -26,7 +26,9 @@
*/ */
using System; using System;
using System.Collections.Generic;
using OpenMetaverse; using OpenMetaverse;
using OpenMetaverse.StructuredData;
namespace OpenSim.Framework namespace OpenSim.Framework
{ {
@ -34,33 +36,18 @@ namespace OpenSim.Framework
public class AssetBase public class AssetBase
{ {
private byte[] _data; private byte[] _data;
private string _description = String.Empty; private AssetMetadata _metadata;
private UUID _fullid;
private bool _local = false;
private string _name = String.Empty;
private bool _temporary = false;
private sbyte _type;
public AssetBase() public AssetBase()
{ {
Metadata = new AssetMetadata();
} }
public AssetBase(UUID assetId, string name) public AssetBase(UUID assetId, string name)
{ {
FullID = assetId; Metadata = new AssetMetadata();
Name = name; Metadata.FullID = assetId;
} Metadata.Name = name;
public virtual UUID FullID
{
get { return _fullid; }
set { _fullid = value; }
}
public virtual string ID
{
get { return _fullid.ToString(); }
set { _fullid = new UUID(value); }
} }
public virtual byte[] Data public virtual byte[] Data
@ -69,34 +56,98 @@ namespace OpenSim.Framework
set { _data = value; } set { _data = value; }
} }
public virtual sbyte Type public virtual AssetMetadata Metadata
{ {
get { return _type; } get { return _metadata; }
set { _type = value; } set { _metadata = value; }
}
} }
public virtual string Name [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<string, Uri> _methods = new Dictionary<string, Uri>();
//private OSDMap _extra_data;
public UUID FullID
{
get { return _fullid; }
set { _fullid = value; }
}
public string ID
{
get { return _fullid.ToString(); }
set { _fullid = new UUID(value); }
}
public string Name
{ {
get { return _name; } get { return _name; }
set { _name = value; } set { _name = value; }
} }
public virtual string Description public string Description
{ {
get { return _description; } get { return _description; }
set { _description = value; } set { _description = value; }
} }
public virtual bool Local public DateTime CreationDate
{
get { return _creation_date; }
set { _creation_date = 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; }
}
public bool Local
{ {
get { return _local; } get { return _local; }
set { _local = value; } set { _local = value; }
} }
public virtual bool Temporary public bool Temporary
{ {
get { return _temporary; } get { return _temporary; }
set { _temporary = value; } set { _temporary = value; }
} }
//public Dictionary<string, Uri> Methods
//{
// get { return _methods; }
// set { _methods = value; }
//}
//public OSDMap ExtraData
//{
// get { return _extra_data; }
// set { _extra_data = value; }
//}
} }
} }

View File

@ -40,10 +40,10 @@ namespace OpenSim.Framework
public AssetLandmark(AssetBase a) public AssetLandmark(AssetBase a)
{ {
Data = a.Data; Data = a.Data;
FullID = a.FullID; Metadata.FullID = a.Metadata.FullID;
Type = a.Type; Metadata.Type = a.Metadata.Type;
Name = a.Name; Metadata.Name = a.Metadata.Name;
Description = a.Description; Metadata.Description = a.Metadata.Description;
InternData(); InternData();
} }

View File

@ -145,7 +145,7 @@ namespace OpenSim.Framework.AssetLoader.Filesystem
AssetBase newAsset = CreateAsset(assetIdStr, name, assetPath, false); AssetBase newAsset = CreateAsset(assetIdStr, name, assetPath, false);
newAsset.Type = type; newAsset.Metadata.Type = type;
assets.Add(newAsset); assets.Add(newAsset);
} }
} }

View File

@ -290,11 +290,11 @@ namespace OpenSim.Framework.Communications.Cache
/// <param name="asset"></param> /// <param name="asset"></param>
public void AddAsset(AssetBase asset) public void AddAsset(AssetBase asset)
{ {
if (!m_memcache.Contains(asset.FullID)) if (!m_memcache.Contains(asset.Metadata.FullID))
{ {
m_log.Info("[CACHE] Caching " + asset.FullID + " for 24 hours from last access"); m_log.Info("[CACHE] Caching " + asset.Metadata.FullID + " for 24 hours from last access");
// Use 24 hour rolling asset cache. // Use 24 hour rolling asset cache.
m_memcache.AddOrUpdate(asset.FullID, asset, TimeSpan.FromHours(24)); m_memcache.AddOrUpdate(asset.Metadata.FullID, asset, TimeSpan.FromHours(24));
// According to http://wiki.secondlife.com/wiki/AssetUploadRequest, Local signifies that the // 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 // information is stored locally. It could disappear, in which case we could send the
@ -314,7 +314,7 @@ namespace OpenSim.Framework.Communications.Cache
// But for now, we're going to take the easy way out and store local assets globally. // 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. // TODO: Also, Temporary is now deprecated. We should start ignoring it and not passing it out from LLClientView.
if (!asset.Temporary || asset.Local) if (!asset.Metadata.Temporary || asset.Metadata.Local)
{ {
m_assetServer.StoreAsset(asset); m_assetServer.StoreAsset(asset);
} }
@ -345,25 +345,25 @@ namespace OpenSim.Framework.Communications.Cache
{ {
AssetInfo assetInf = new AssetInfo(asset); AssetInfo assetInf = new AssetInfo(asset);
if (!m_memcache.Contains(assetInf.FullID)) if (!m_memcache.Contains(assetInf.Metadata.FullID))
{ {
m_memcache.AddOrUpdate(assetInf.FullID, assetInf, TimeSpan.FromHours(24)); m_memcache.AddOrUpdate(assetInf.Metadata.FullID, assetInf, TimeSpan.FromHours(24));
if (StatsManager.SimExtraStats != null) if (StatsManager.SimExtraStats != null)
{ {
StatsManager.SimExtraStats.AddAsset(assetInf); StatsManager.SimExtraStats.AddAsset(assetInf);
} }
if (RequestedAssets.ContainsKey(assetInf.FullID)) if (RequestedAssets.ContainsKey(assetInf.Metadata.FullID))
{ {
AssetRequest req = RequestedAssets[assetInf.FullID]; AssetRequest req = RequestedAssets[assetInf.Metadata.FullID];
req.AssetInf = assetInf; req.AssetInf = assetInf;
req.NumPackets = CalculateNumPackets(assetInf.Data); req.NumPackets = CalculateNumPackets(assetInf.Data);
RequestedAssets.Remove(assetInf.FullID); RequestedAssets.Remove(assetInf.Metadata.FullID);
// If it's a direct request for a script, drop it // If it's a direct request for a script, drop it
// because it's a hacked client // because it's a hacked client
if (req.AssetRequestSource != 2 || assetInf.Type != 10) if (req.AssetRequestSource != 2 || assetInf.Metadata.Type != 10)
AssetRequests.Add(req); AssetRequests.Add(req);
} }
} }
@ -373,8 +373,8 @@ namespace OpenSim.Framework.Communications.Cache
lock (RequestLists) lock (RequestLists)
{ {
if (RequestLists.TryGetValue(asset.FullID, out reqList)) if (RequestLists.TryGetValue(asset.Metadata.FullID, out reqList))
RequestLists.Remove(asset.FullID); RequestLists.Remove(asset.Metadata.FullID);
} }
if (reqList != null) if (reqList != null)
@ -385,8 +385,8 @@ namespace OpenSim.Framework.Communications.Cache
foreach (NewAssetRequest req in reqList.Requests) foreach (NewAssetRequest req in reqList.Requests)
{ {
// Xantor 20080526 are we really calling all the callbacks if multiple queued for 1 request? -- Yes, checked // 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.FullID); // m_log.DebugFormat("[ASSET CACHE]: Callback for asset {0}", asset.Metadata.FullID);
req.Callback(asset.FullID, asset); req.Callback(asset.Metadata.FullID, asset);
} }
} }
} }
@ -494,7 +494,7 @@ namespace OpenSim.Framework.Communications.Cache
} }
// Scripts cannot be retrieved by direct request // Scripts cannot be retrieved by direct request
if (transferRequest.TransferInfo.SourceType == 2 && asset.Type == 10) if (transferRequest.TransferInfo.SourceType == 2 && asset.Metadata.Type == 10)
return; return;
// The asset is knosn to exist and is in our cache, so add it to the AssetRequests list // The asset is knosn to exist and is in our cache, so add it to the AssetRequests list
@ -580,10 +580,10 @@ namespace OpenSim.Framework.Communications.Cache
public AssetInfo(AssetBase aBase) public AssetInfo(AssetBase aBase)
{ {
Data = aBase.Data; Data = aBase.Data;
FullID = aBase.FullID; Metadata.FullID = aBase.Metadata.FullID;
Type = aBase.Type; Metadata.Type = aBase.Metadata.Type;
Name = aBase.Name; Metadata.Name = aBase.Metadata.Name;
Description = aBase.Description; Metadata.Description = aBase.Metadata.Description;
} }
} }
@ -592,10 +592,10 @@ namespace OpenSim.Framework.Communications.Cache
public TextureImage(AssetBase aBase) public TextureImage(AssetBase aBase)
{ {
Data = aBase.Data; Data = aBase.Data;
FullID = aBase.FullID; Metadata.FullID = aBase.Metadata.FullID;
Type = aBase.Type; Metadata.Type = aBase.Metadata.Type;
Name = aBase.Name; Metadata.Name = aBase.Metadata.Name;
Description = aBase.Description; Metadata.Description = aBase.Metadata.Description;
} }
} }

View File

@ -403,17 +403,17 @@ namespace OpenSim.Framework.Communications.Cache
string salt = Convert.ToBase64String(rand); string salt = Convert.ToBase64String(rand);
x.Data = UtilRijndael.Encrypt(x.Data, file.Secret, salt, "SHA1", 2, file.IVBytes, file.Keysize); x.Data = UtilRijndael.Encrypt(x.Data, file.Secret, salt, "SHA1", 2, file.IVBytes, file.Keysize);
x.Description = String.Format("ENCASS#:~:#{0}#:~:#{1}#:~:#{2}#:~:#{3}", x.Metadata.Description = String.Format("ENCASS#:~:#{0}#:~:#{1}#:~:#{2}#:~:#{3}",
"OPENSIM_AES_AF1", "OPENSIM_AES_AF1",
file.AlsoKnownAs, file.AlsoKnownAs,
salt, salt,
x.Description); x.Metadata.Description);
} }
private bool DecryptAssetBase(AssetBase x) private bool DecryptAssetBase(AssetBase x)
{ {
// Check it's encrypted first. // Check it's encrypted first.
if (!x.Description.Contains("ENCASS")) if (!x.Metadata.Description.Contains("ENCASS"))
return true; return true;
// ENCASS:ALG:AKA:SALT:Description // ENCASS:ALG:AKA:SALT:Description
@ -421,7 +421,7 @@ namespace OpenSim.Framework.Communications.Cache
string[] splitchars = new string[1]; string[] splitchars = new string[1];
splitchars[0] = "#:~:#"; splitchars[0] = "#:~:#";
string[] meta = x.Description.Split(splitchars, StringSplitOptions.None); string[] meta = x.Metadata.Description.Split(splitchars, StringSplitOptions.None);
if (meta.Length < 5) if (meta.Length < 5)
{ {
m_log.Warn("[ENCASSETS] Recieved Encrypted Asset, but header is corrupt"); m_log.Warn("[ENCASSETS] Recieved Encrypted Asset, but header is corrupt");
@ -432,7 +432,7 @@ namespace OpenSim.Framework.Communications.Cache
if (m_keyfiles.ContainsKey(meta[2])) if (m_keyfiles.ContainsKey(meta[2]))
{ {
RjinKeyfile deckey = m_keyfiles[meta[2]]; RjinKeyfile deckey = m_keyfiles[meta[2]];
x.Description = meta[4]; x.Metadata.Description = meta[4];
switch (meta[1]) switch (meta[1])
{ {
case "OPENSIM_AES_AF1": case "OPENSIM_AES_AF1":
@ -506,7 +506,7 @@ namespace OpenSim.Framework.Communications.Cache
{ {
string assetUrl = _assetServerUrl + "/assets/"; string assetUrl = _assetServerUrl + "/assets/";
m_log.InfoFormat("[CRYPTO GRID ASSET CLIENT]: Sending store request for asset {0}", asset.FullID); m_log.InfoFormat("[CRYPTO GRID ASSET CLIENT]: Sending store request for asset {0}", asset.Metadata.FullID);
RestObjectPoster.BeginPostObject<AssetBase>(assetUrl, asset); RestObjectPoster.BeginPostObject<AssetBase>(assetUrl, asset);
} }

View File

@ -45,7 +45,7 @@ namespace OpenSim.Framework.Communications.Cache
} }
public override void StoreAsset(AssetBase asset) public override void StoreAsset(AssetBase asset)
{ {
byte[] idBytes = asset.FullID.Guid.ToByteArray(); byte[] idBytes = asset.Metadata.FullID.Guid.ToByteArray();
string cdir = m_dir + Path.DirectorySeparatorChar + idBytes[0] string cdir = m_dir + Path.DirectorySeparatorChar + idBytes[0]
+ Path.DirectorySeparatorChar + idBytes[1]; + Path.DirectorySeparatorChar + idBytes[1];
@ -56,7 +56,7 @@ namespace OpenSim.Framework.Communications.Cache
if (!Directory.Exists(cdir)) if (!Directory.Exists(cdir))
Directory.CreateDirectory(cdir); Directory.CreateDirectory(cdir);
FileStream x = new FileStream(cdir + Path.DirectorySeparatorChar + asset.FullID + ".xml", FileMode.Create); FileStream x = new FileStream(cdir + Path.DirectorySeparatorChar + asset.Metadata.FullID + ".xml", FileMode.Create);
m_xs.Serialize(x, asset); m_xs.Serialize(x, asset);
x.Flush(); x.Flush();

View File

@ -97,7 +97,7 @@ namespace OpenSim.Framework.Communications.Cache
// rc.Request(s); // rc.Request(s);
//m_log.InfoFormat("[ASSET]: Stored {0}", rc); //m_log.InfoFormat("[ASSET]: Stored {0}", rc);
m_log.InfoFormat("[GRID ASSET CLIENT]: Sending store request for asset {0}", asset.FullID); m_log.InfoFormat("[GRID ASSET CLIENT]: Sending store request for asset {0}", asset.Metadata.FullID);
RestObjectPoster.BeginPostObject<AssetBase>(assetUrl, asset); RestObjectPoster.BeginPostObject<AssetBase>(assetUrl, asset);
} }

View File

@ -741,9 +741,9 @@ namespace OpenSim.Framework.Communications.Capabilities
AssetBase asset; AssetBase asset;
asset = new AssetBase(); asset = new AssetBase();
asset.FullID = assetID; asset.Metadata.FullID = assetID;
asset.Type = assType; asset.Metadata.Type = assType;
asset.Name = assetName; asset.Metadata.Name = assetName;
asset.Data = data; asset.Data = data;
m_assetCache.AddAsset(asset); m_assetCache.AddAsset(asset);
@ -751,7 +751,7 @@ namespace OpenSim.Framework.Communications.Capabilities
item.Owner = m_agentID; item.Owner = m_agentID;
item.Creator = m_agentID; item.Creator = m_agentID;
item.ID = inventoryItem; item.ID = inventoryItem;
item.AssetID = asset.FullID; item.AssetID = asset.Metadata.FullID;
item.Description = assetDescription; item.Description = assetDescription;
item.Name = assetName; item.Name = assetName;
item.AssetType = assType; item.AssetType = assType;

View File

@ -141,7 +141,7 @@ namespace OpenSim.Grid.AssetServer
XmlSerializer xs = new XmlSerializer(typeof (AssetBase)); XmlSerializer xs = new XmlSerializer(typeof (AssetBase));
AssetBase asset = (AssetBase) xs.Deserialize(request); AssetBase asset = (AssetBase) xs.Deserialize(request);
m_log.InfoFormat("[REST]: Creating asset {0}", asset.FullID); m_log.InfoFormat("[REST]: Creating asset {0}", asset.Metadata.FullID);
m_assetProvider.CreateAsset(asset); m_assetProvider.CreateAsset(asset);
return new byte[] {}; return new byte[] {};

View File

@ -7682,7 +7682,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{ {
Transfer.TransferInfo.Params = new byte[20]; Transfer.TransferInfo.Params = new byte[20];
Array.Copy(req.RequestAssetID.GetBytes(), 0, Transfer.TransferInfo.Params, 0, 16); Array.Copy(req.RequestAssetID.GetBytes(), 0, Transfer.TransferInfo.Params, 0, 16);
int assType = req.AssetInf.Type; int assType = req.AssetInf.Metadata.Type;
Array.Copy(Utils.IntToBytes(assType), 0, Transfer.TransferInfo.Params, 16, 4); Array.Copy(Utils.IntToBytes(assType), 0, Transfer.TransferInfo.Params, 16, 4);
} }
else if (req.AssetRequestSource == 3) else if (req.AssetRequestSource == 3)

View File

@ -206,13 +206,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
private void Initialise(UUID fileID, string fileName) private void Initialise(UUID fileID, string fileName)
{ {
m_asset = new AssetBase(); m_asset = new AssetBase();
m_asset.FullID = fileID; m_asset.Metadata.FullID = fileID;
m_asset.Type = type; m_asset.Metadata.Type = type;
m_asset.Data = new byte[0]; m_asset.Data = new byte[0];
m_asset.Name = fileName; m_asset.Metadata.Name = fileName;
m_asset.Description = "empty"; m_asset.Metadata.Description = "empty";
m_asset.Local = true; m_asset.Metadata.Local = true;
m_asset.Temporary = true; m_asset.Metadata.Temporary = true;
mXferID = Util.GetNextXferID(); mXferID = Util.GetNextXferID();
} }
@ -223,13 +223,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
public void RequestStartXfer(IClientAPI pRemoteClient) public void RequestStartXfer(IClientAPI pRemoteClient)
{ {
if (!String.IsNullOrEmpty(m_asset.Name)) if (!String.IsNullOrEmpty(m_asset.Metadata.Name))
{ {
pRemoteClient.SendXferRequest(mXferID, m_asset.Type, m_asset.FullID, 0, Utils.StringToBytes(m_asset.Name)); pRemoteClient.SendXferRequest(mXferID, m_asset.Metadata.Type, m_asset.Metadata.FullID, 0, Utils.StringToBytes(m_asset.Metadata.Name));
} }
else else
{ {
pRemoteClient.SendXferRequest(mXferID, m_asset.Type, m_asset.FullID, 0, new byte[0]); pRemoteClient.SendXferRequest(mXferID, m_asset.Metadata.Type, m_asset.Metadata.FullID, 0, new byte[0]);
} }
} }
@ -273,7 +273,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
handlerUploadDone = UploadDone; handlerUploadDone = UploadDone;
if (handlerUploadDone != null) if (handlerUploadDone != null)
{ {
handlerUploadDone(m_asset.Name, m_asset.FullID, mXferID, m_asset.Data, remoteClient); handlerUploadDone(m_asset.Metadata.Name, m_asset.Metadata.FullID, mXferID, m_asset.Data, remoteClient);
} }
} }
@ -282,7 +282,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
handlerAbort = UploadAborted; handlerAbort = UploadAborted;
if (handlerAbort != null) if (handlerAbort != null)
{ {
handlerAbort(m_asset.Name, m_asset.FullID, mXferID, remoteClient); handlerAbort(m_asset.Metadata.Name, m_asset.Metadata.FullID, mXferID, remoteClient);
} }
} }
} }

View File

@ -423,7 +423,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
/// </summary> /// </summary>
public UUID AssetId public UUID AssetId
{ {
get { return m_asset_ref.FullID; } get { return m_asset_ref.Metadata.FullID; }
} }
/// <summary> /// <summary>

View File

@ -326,9 +326,9 @@ namespace OpenSim.Region.Communications.Hypergrid
//Console.WriteLine("Size: " + m.PhysicalDimension.Height + "-" + m.PhysicalDimension.Width); //Console.WriteLine("Size: " + m.PhysicalDimension.Height + "-" + m.PhysicalDimension.Width);
byte[] imageData = OpenJPEG.EncodeFromImage(m, true); byte[] imageData = OpenJPEG.EncodeFromImage(m, true);
AssetBase ass = new AssetBase(UUID.Random(), "region " + info.RegionID.ToString()); AssetBase ass = new AssetBase(UUID.Random(), "region " + info.RegionID.ToString());
info.RegionSettings.TerrainImageID = ass.FullID; info.RegionSettings.TerrainImageID = ass.Metadata.FullID;
ass.Type = (int)AssetType.Texture; ass.Metadata.Type = (int)AssetType.Texture;
ass.Temporary = false; ass.Metadata.Temporary = false;
//imageData.CopyTo(ass.Data, 0); //imageData.CopyTo(ass.Data, 0);
ass.Data = imageData; ass.Data = imageData;
m_assetcache.AddAsset(ass); m_assetcache.AddAsset(ass);

View File

@ -171,10 +171,10 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction
"[ASSET TRANSACTIONS]: Updating task item {0} in {1} with asset in transaction {2}", "[ASSET TRANSACTIONS]: Updating task item {0} in {1} with asset in transaction {2}",
item.Name, part.Name, transactionID); item.Name, part.Name, transactionID);
asset.Name = item.Name; asset.Metadata.Name = item.Name;
asset.Description = item.Description; asset.Metadata.Description = item.Description;
asset.Type = (sbyte)item.Type; asset.Metadata.Type = (sbyte)item.Type;
item.AssetID = asset.FullID; item.AssetID = asset.Metadata.FullID;
Manager.MyScene.CommsManager.AssetCache.AddAsset(asset); Manager.MyScene.CommsManager.AssetCache.AddAsset(asset);
@ -206,14 +206,14 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction
asset = GetTransactionAsset(transactionID); asset = GetTransactionAsset(transactionID);
} }
if (asset != null && asset.FullID == assetID) if (asset != null && asset.Metadata.FullID == assetID)
{ {
// Assets never get updated, new ones get created // Assets never get updated, new ones get created
asset.FullID = UUID.Random(); asset.Metadata.FullID = UUID.Random();
asset.Name = item.Name; asset.Metadata.Name = item.Name;
asset.Description = item.Description; asset.Metadata.Description = item.Description;
asset.Type = (sbyte)item.AssetType; asset.Metadata.Type = (sbyte)item.AssetType;
item.AssetID = asset.FullID; item.AssetID = asset.Metadata.FullID;
Manager.MyScene.CommsManager.AssetCache.AddAsset(asset); Manager.MyScene.CommsManager.AssetCache.AddAsset(asset);
} }

View File

@ -113,13 +113,13 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction
{ {
ourClient = remoteClient; ourClient = remoteClient;
m_asset = new AssetBase(); m_asset = new AssetBase();
m_asset.FullID = assetID; m_asset.Metadata.FullID = assetID;
m_asset.Type = type; m_asset.Metadata.Type = type;
m_asset.Data = data; m_asset.Data = data;
m_asset.Name = "blank"; m_asset.Metadata.Name = "blank";
m_asset.Description = "empty"; m_asset.Metadata.Description = "empty";
m_asset.Local = storeLocal; m_asset.Metadata.Local = storeLocal;
m_asset.Temporary = tempFile; m_asset.Metadata.Temporary = tempFile;
TransactionID = transaction; TransactionID = transaction;
m_storeLocal = storeLocal; m_storeLocal = storeLocal;
@ -140,12 +140,12 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction
protected void RequestStartXfer() protected void RequestStartXfer()
{ {
XferID = Util.GetNextXferID(); XferID = Util.GetNextXferID();
ourClient.SendXferRequest(XferID, m_asset.Type, m_asset.FullID, 0, new byte[0]); ourClient.SendXferRequest(XferID, m_asset.Metadata.Type, m_asset.Metadata.FullID, 0, new byte[0]);
} }
protected void SendCompleteMessage() protected void SendCompleteMessage()
{ {
ourClient.SendAssetUploadCompleteMessage(m_asset.Type, true, m_asset.FullID); ourClient.SendAssetUploadCompleteMessage(m_asset.Metadata.Type, true, m_asset.Metadata.FullID);
m_finished = true; m_finished = true;
if (m_createItem) if (m_createItem)
@ -164,7 +164,7 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction
DateTime now = DateTime.Now; DateTime now = DateTime.Now;
string filename = 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, 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.Name, m_asset.Type); now.Hour, now.Minute, now.Second, m_asset.Metadata.Name, m_asset.Metadata.Type);
SaveAssetToFile(filename, m_asset.Data); SaveAssetToFile(filename, m_asset.Data);
} }
} }
@ -196,9 +196,9 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction
this.invType = invType; this.invType = invType;
this.wearableType = wearableType; this.wearableType = wearableType;
nextPerm = nextOwnerMask; nextPerm = nextOwnerMask;
m_asset.Name = name; m_asset.Metadata.Name = name;
m_asset.Description = description; m_asset.Metadata.Description = description;
m_asset.Type = type; m_asset.Metadata.Type = type;
if (m_finished) if (m_finished)
{ {
@ -225,7 +225,7 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction
item.Owner = ourClient.AgentId; item.Owner = ourClient.AgentId;
item.Creator = ourClient.AgentId; item.Creator = ourClient.AgentId;
item.ID = UUID.Random(); item.ID = UUID.Random();
item.AssetID = m_asset.FullID; item.AssetID = m_asset.Metadata.FullID;
item.Description = m_description; item.Description = m_description;
item.Name = m_name; item.Name = m_name;
item.AssetType = type; item.AssetType = type;

View File

@ -55,7 +55,7 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureSender
/// </summary> /// </summary>
private AssetBase m_asset; private AssetBase m_asset;
//public UUID assetID { get { return m_asset.FullID; } } //public UUID assetID { get { return m_asset.Metadata.FullID; } }
// private bool m_cancel = false; // private bool m_cancel = false;
@ -117,7 +117,7 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureSender
// See ITextureSender // See ITextureSender
public bool SendTexturePacket() public bool SendTexturePacket()
{ {
//m_log.DebugFormat("[TEXTURE SENDER]: Sending packet for {0}", m_asset.FullID); //m_log.DebugFormat("[TEXTURE SENDER]: Sending packet for {0}", m_asset.Metadata.FullID);
SendPacket(); SendPacket();
counter++; counter++;
@ -154,7 +154,7 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureSender
{ {
if (NumPackets == 0) if (NumPackets == 0)
{ {
RequestUser.SendImageFirstPart(1, m_asset.FullID, (uint)m_asset.Data.Length, m_asset.Data, 2); RequestUser.SendImageFirstPart(1, m_asset.Metadata.FullID, (uint)m_asset.Data.Length, m_asset.Data, 2);
PacketCounter++; PacketCounter++;
} }
else else
@ -163,7 +163,7 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureSender
Array.Copy(m_asset.Data, 0, ImageData1, 0, 600); Array.Copy(m_asset.Data, 0, ImageData1, 0, 600);
RequestUser.SendImageFirstPart( RequestUser.SendImageFirstPart(
(ushort)(NumPackets), m_asset.FullID, (uint)m_asset.Data.Length, ImageData1, 2); (ushort)(NumPackets), m_asset.Metadata.FullID, (uint)m_asset.Data.Length, ImageData1, 2);
PacketCounter++; PacketCounter++;
} }
} }
@ -179,11 +179,11 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureSender
catch (ArgumentOutOfRangeException) catch (ArgumentOutOfRangeException)
{ {
m_log.Error("[TEXTURE SENDER]: Unable to separate texture into multiple packets: Array bounds failure on asset:" + m_log.Error("[TEXTURE SENDER]: Unable to separate texture into multiple packets: Array bounds failure on asset:" +
m_asset.FullID.ToString()); m_asset.Metadata.ID);
return; return;
} }
RequestUser.SendImageNextPart((ushort)PacketCounter, m_asset.FullID, imageData); RequestUser.SendImageNextPart((ushort)PacketCounter, m_asset.Metadata.FullID, imageData);
PacketCounter++; PacketCounter++;
} }
} }

View File

@ -258,7 +258,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Inventory.Archiver
AssetBase asset = new AssetBase(new UUID(uuid), "RandomName"); AssetBase asset = new AssetBase(new UUID(uuid), "RandomName");
asset.Type = assetType; asset.Metadata.Type = assetType;
asset.Data = data; asset.Data = data;
scene.AssetCache.AddAsset(asset); scene.AssetCache.AddAsset(asset);

View File

@ -231,21 +231,21 @@ namespace OpenSim.Region.Environment.Modules.Scripting.DynamicTexture
// Create a new asset for user // Create a new asset for user
AssetBase asset = new AssetBase(); AssetBase asset = new AssetBase();
asset.FullID = UUID.Random(); asset.Metadata.FullID = UUID.Random();
asset.Data = assetData; asset.Data = assetData;
asset.Name = "DynamicImage" + Util.RandomClass.Next(1, 10000); asset.Metadata.Name = "DynamicImage" + Util.RandomClass.Next(1, 10000);
asset.Type = 0; asset.Metadata.Type = 0;
asset.Description = "dynamic image"; asset.Metadata.Description = "dynamic image";
asset.Local = false; asset.Metadata.Local = false;
asset.Temporary = true; asset.Metadata.Temporary = true;
scene.AssetCache.AddAsset(asset); scene.AssetCache.AddAsset(asset);
LastAssetID = asset.FullID; LastAssetID = asset.Metadata.FullID;
IJ2KDecoder cacheLayerDecode = scene.RequestModuleInterface<IJ2KDecoder>(); IJ2KDecoder cacheLayerDecode = scene.RequestModuleInterface<IJ2KDecoder>();
if (cacheLayerDecode != null) if (cacheLayerDecode != null)
{ {
cacheLayerDecode.syncdecode(asset.FullID, asset.Data); cacheLayerDecode.syncdecode(asset.Metadata.FullID, asset.Data);
} }
cacheLayerDecode = null; cacheLayerDecode = null;
@ -256,7 +256,7 @@ namespace OpenSim.Region.Environment.Modules.Scripting.DynamicTexture
UUID oldID = tmptex.DefaultTexture.TextureID; UUID oldID = tmptex.DefaultTexture.TextureID;
scene.AssetCache.ExpireAsset(oldID); scene.AssetCache.ExpireAsset(oldID);
tmptex.DefaultTexture.TextureID = asset.FullID; tmptex.DefaultTexture.TextureID = asset.Metadata.FullID;
// I'm pretty sure we always want to force this to true // I'm pretty sure we always want to force this to true
tmptex.DefaultTexture.Fullbright = true; tmptex.DefaultTexture.Fullbright = true;

View File

@ -290,7 +290,7 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
//m_log.DebugFormat("[ARCHIVER]: Importing asset {0}, type {1}", uuid, assetType); //m_log.DebugFormat("[ARCHIVER]: Importing asset {0}, type {1}", uuid, assetType);
AssetBase asset = new AssetBase(new UUID(uuid), String.Empty); AssetBase asset = new AssetBase(new UUID(uuid), String.Empty);
asset.Type = assetType; asset.Metadata.Type = assetType;
asset.Data = data; asset.Data = data;
m_scene.AssetCache.AddAsset(asset); m_scene.AssetCache.AddAsset(asset);

View File

@ -86,16 +86,16 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
string extension = string.Empty; string extension = string.Empty;
if (ArchiveConstants.ASSET_TYPE_TO_EXTENSION.ContainsKey(asset.Type)) if (ArchiveConstants.ASSET_TYPE_TO_EXTENSION.ContainsKey(asset.Metadata.Type))
{ {
extension = ArchiveConstants.ASSET_TYPE_TO_EXTENSION[asset.Type]; extension = ArchiveConstants.ASSET_TYPE_TO_EXTENSION[asset.Metadata.Type];
} }
xtw.WriteElementString("filename", uuid.ToString() + extension); xtw.WriteElementString("filename", uuid.ToString() + extension);
xtw.WriteElementString("name", asset.Name); xtw.WriteElementString("name", asset.Metadata.Name);
xtw.WriteElementString("description", asset.Description); xtw.WriteElementString("description", asset.Metadata.Description);
xtw.WriteElementString("asset-type", asset.Type.ToString()); xtw.WriteElementString("asset-type", asset.Metadata.Type.ToString());
xtw.WriteEndElement(); xtw.WriteEndElement();
} }
@ -123,15 +123,15 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
string extension = string.Empty; string extension = string.Empty;
if (ArchiveConstants.ASSET_TYPE_TO_EXTENSION.ContainsKey(asset.Type)) if (ArchiveConstants.ASSET_TYPE_TO_EXTENSION.ContainsKey(asset.Metadata.Type))
{ {
extension = ArchiveConstants.ASSET_TYPE_TO_EXTENSION[asset.Type]; extension = ArchiveConstants.ASSET_TYPE_TO_EXTENSION[asset.Metadata.Type];
} }
else else
{ {
m_log.ErrorFormat( m_log.ErrorFormat(
"[ARCHIVER]: Unrecognized asset type {0} with uuid {1}. This asset will be saved but not reloaded", "[ARCHIVER]: Unrecognized asset type {0} with uuid {1}. This asset will be saved but not reloaded",
asset.Type, asset.ID); asset.Metadata.Type, asset.Metadata.ID);
} }
archive.AddFile( archive.AddFile(

View File

@ -157,8 +157,8 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
m_log.DebugFormat("[ARCHIVER]: Importing asset {0}", filename); m_log.DebugFormat("[ARCHIVER]: Importing asset {0}", filename);
AssetBase asset = new AssetBase(new UUID(filename), metadata.Name); AssetBase asset = new AssetBase(new UUID(filename), metadata.Name);
asset.Description = metadata.Description; asset.Metadata.Description = metadata.Description;
asset.Type = metadata.AssetType; asset.Metadata.Type = metadata.AssetType;
asset.Data = data; asset.Data = data;
m_cache.AddAsset(asset); m_cache.AddAsset(asset);

View File

@ -60,13 +60,13 @@ namespace OpenSim.Region.Environment.Modules.World.Estate
{ {
m_asset = new AssetBase(); m_asset = new AssetBase();
m_asset.FullID = UUID.Zero; m_asset.Metadata.FullID = UUID.Zero;
m_asset.Type = type; m_asset.Metadata.Type = type;
m_asset.Data = new byte[0]; m_asset.Data = new byte[0];
m_asset.Name = pClientFilename; m_asset.Metadata.Name = pClientFilename;
m_asset.Description = "empty"; m_asset.Metadata.Description = "empty";
m_asset.Local = true; m_asset.Metadata.Local = true;
m_asset.Temporary = true; m_asset.Metadata.Temporary = true;
} }
@ -78,7 +78,7 @@ namespace OpenSim.Region.Environment.Modules.World.Estate
public void RequestStartXfer(IClientAPI pRemoteClient) public void RequestStartXfer(IClientAPI pRemoteClient)
{ {
mXferID = Util.GetNextXferID(); mXferID = Util.GetNextXferID();
pRemoteClient.SendXferRequest(mXferID, m_asset.Type, m_asset.FullID, 0, Utils.StringToBytes(m_asset.Name)); pRemoteClient.SendXferRequest(mXferID, m_asset.Metadata.Type, m_asset.Metadata.FullID, 0, Utils.StringToBytes(m_asset.Metadata.Name));
} }
/// <summary> /// <summary>
@ -120,7 +120,7 @@ namespace OpenSim.Region.Environment.Modules.World.Estate
handlerTerrainUploadDone = TerrainUploadDone; handlerTerrainUploadDone = TerrainUploadDone;
if (handlerTerrainUploadDone != null) if (handlerTerrainUploadDone != null)
{ {
handlerTerrainUploadDone(m_asset.Name,m_asset.Data, remoteClient); handlerTerrainUploadDone(m_asset.Metadata.Name, m_asset.Data, remoteClient);
} }
} }
} }

View File

@ -128,12 +128,12 @@ namespace OpenSim.Region.Environment.Scenes.Hypergrid
if (m_scene.CommsManager.AssetCache.TryGetCachedAsset(assetID, out asset) && (asset != null)) if (m_scene.CommsManager.AssetCache.TryGetCachedAsset(assetID, out asset) && (asset != null))
{ {
m_log.Debug("[HGScene]: Asset made it to asset cache. " + asset.Name + " " + assetID); m_log.Debug("[HGScene]: Asset made it to asset cache. " + asset.Metadata.Name + " " + assetID);
// I think I need to store it in the asset DB too. // I think I need to store it in the asset DB too.
// For now, let me just do it for textures and scripts // For now, let me just do it for textures and scripts
if (((AssetType)asset.Type == AssetType.Texture) || if (((AssetType)asset.Metadata.Type == AssetType.Texture) ||
((AssetType)asset.Type == AssetType.LSLBytecode) || ((AssetType)asset.Metadata.Type == AssetType.LSLBytecode) ||
((AssetType)asset.Type == AssetType.LSLText)) ((AssetType)asset.Metadata.Type == AssetType.LSLText))
{ {
AssetBase asset1 = new AssetBase(); AssetBase asset1 = new AssetBase();
Copy(asset, asset1); Copy(asset, asset1);
@ -157,7 +157,7 @@ namespace OpenSim.Region.Environment.Scenes.Hypergrid
if (asset1 != null) if (asset1 != null)
{ {
// See long comment in AssetCache.AddAsset // See long comment in AssetCache.AddAsset
if (!asset1.Temporary || asset1.Local) if (!asset1.Metadata.Temporary || asset1.Metadata.Local)
{ {
// The asset cache returns instances of subclasses of AssetBase: // The asset cache returns instances of subclasses of AssetBase:
// TextureImage or AssetInfo. So in passing them to the remote // TextureImage or AssetInfo. So in passing them to the remote
@ -179,13 +179,13 @@ namespace OpenSim.Region.Environment.Scenes.Hypergrid
private void Copy(AssetBase from, AssetBase to) private void Copy(AssetBase from, AssetBase to)
{ {
to.Data = from.Data; to.Data = from.Data;
to.Description = from.Description; to.Metadata.Description = from.Metadata.Description;
to.FullID = from.FullID; to.Metadata.FullID = from.Metadata.FullID;
to.ID = from.ID; to.Metadata.ID = from.Metadata.ID;
to.Local = from.Local; to.Metadata.Local = from.Metadata.Local;
to.Name = from.Name; to.Metadata.Name = from.Metadata.Name;
to.Temporary = from.Temporary; to.Metadata.Temporary = from.Metadata.Temporary;
to.Type = from.Type; to.Metadata.Type = from.Metadata.Type;
} }
@ -243,7 +243,7 @@ namespace OpenSim.Region.Environment.Scenes.Hypergrid
private Dictionary<UUID, bool> SniffUUIDs(AssetBase asset) private Dictionary<UUID, bool> SniffUUIDs(AssetBase asset)
{ {
Dictionary<UUID, bool> uuids = new Dictionary<UUID, bool>(); Dictionary<UUID, bool> uuids = new Dictionary<UUID, bool>();
if ((asset != null) && ((AssetType)asset.Type == AssetType.Object)) if ((asset != null) && ((AssetType)asset.Metadata.Type == AssetType.Object))
{ {
string ass_str = Utils.BytesToString(asset.Data); string ass_str = Utils.BytesToString(asset.Data);
SceneObjectGroup sog = new SceneObjectGroup(ass_str, true); SceneObjectGroup sog = new SceneObjectGroup(ass_str, true);

View File

@ -193,11 +193,11 @@ namespace OpenSim.Region.Environment.Scenes
CreateAsset(item.Name, item.Description, (sbyte)item.AssetType, data); CreateAsset(item.Name, item.Description, (sbyte)item.AssetType, data);
AssetCache.AddAsset(asset); AssetCache.AddAsset(asset);
item.AssetID = asset.FullID; item.AssetID = asset.Metadata.FullID;
userInfo.UpdateItem(item); userInfo.UpdateItem(item);
// remoteClient.SendInventoryItemCreateUpdate(item); // remoteClient.SendInventoryItemCreateUpdate(item);
return (asset.FullID); return (asset.Metadata.FullID);
} }
} }
} }
@ -285,7 +285,7 @@ namespace OpenSim.Region.Environment.Scenes
} }
// Update item with new asset // Update item with new asset
item.AssetID = asset.FullID; item.AssetID = asset.Metadata.FullID;
group.UpdateInventoryItem(item); group.UpdateInventoryItem(item);
part.GetProperties(remoteClient); part.GetProperties(remoteClient);
@ -688,7 +688,7 @@ namespace OpenSim.Region.Environment.Scenes
{ {
if (newName != String.Empty) if (newName != String.Empty)
{ {
asset.Name = newName; asset.Metadata.Name = newName;
} }
else else
{ {
@ -728,10 +728,10 @@ namespace OpenSim.Region.Environment.Scenes
private AssetBase CreateAsset(string name, string description, sbyte assetType, byte[] data) private AssetBase CreateAsset(string name, string description, sbyte assetType, byte[] data)
{ {
AssetBase asset = new AssetBase(); AssetBase asset = new AssetBase();
asset.Name = name; asset.Metadata.Name = name;
asset.Description = description; asset.Metadata.Description = description;
asset.Type = assetType; asset.Metadata.Type = assetType;
asset.FullID = UUID.Random(); asset.Metadata.FullID = UUID.Random();
asset.Data = (data == null) ? new byte[1] : data; asset.Data = (data == null) ? new byte[1] : data;
return asset; return asset;
@ -831,11 +831,11 @@ namespace OpenSim.Region.Environment.Scenes
item.Owner = remoteClient.AgentId; item.Owner = remoteClient.AgentId;
item.Creator = remoteClient.AgentId; item.Creator = remoteClient.AgentId;
item.ID = UUID.Random(); item.ID = UUID.Random();
item.AssetID = asset.FullID; item.AssetID = asset.Metadata.FullID;
item.Description = asset.Description; item.Description = asset.Metadata.Description;
item.Name = name; item.Name = name;
item.Flags = flags; item.Flags = flags;
item.AssetType = asset.Type; item.AssetType = asset.Metadata.Type;
item.InvType = invType; item.InvType = invType;
item.Folder = folderID; item.Folder = folderID;
item.CurrentPermissions = currentMask; item.CurrentPermissions = currentMask;
@ -905,7 +905,7 @@ namespace OpenSim.Region.Environment.Scenes
AssetBase asset = CreateAsset(name, description, assetType, data); AssetBase asset = CreateAsset(name, description, assetType, data);
AssetCache.AddAsset(asset); AssetCache.AddAsset(asset);
CreateNewInventoryItem(remoteClient, folderID, asset.Name, 0, callbackID, asset, invType, nextOwnerMask, creationDate); CreateNewInventoryItem(remoteClient, folderID, asset.Metadata.Name, 0, callbackID, asset, invType, nextOwnerMask, creationDate);
} }
else else
{ {
@ -1550,7 +1550,7 @@ namespace OpenSim.Region.Environment.Scenes
taskItem.Flags = itemBase.Flags; taskItem.Flags = itemBase.Flags;
taskItem.PermsGranter = UUID.Zero; taskItem.PermsGranter = UUID.Zero;
taskItem.PermsMask = 0; taskItem.PermsMask = 0;
taskItem.AssetID = asset.FullID; taskItem.AssetID = asset.Metadata.FullID;
part.Inventory.AddInventoryItem(taskItem, false); part.Inventory.AddInventoryItem(taskItem, false);
part.GetProperties(remoteClient); part.GetProperties(remoteClient);
@ -1949,16 +1949,16 @@ namespace OpenSim.Region.Environment.Scenes
(sbyte)AssetType.Object, (sbyte)AssetType.Object,
Utils.StringToBytes(sceneObjectXml)); Utils.StringToBytes(sceneObjectXml));
AssetCache.AddAsset(asset); AssetCache.AddAsset(asset);
assetID = asset.FullID; assetID = asset.Metadata.FullID;
if (DeRezAction.SaveToExistingUserInventoryItem == action) if (DeRezAction.SaveToExistingUserInventoryItem == action)
{ {
item.AssetID = asset.FullID; item.AssetID = asset.Metadata.FullID;
userInfo.UpdateItem(item); userInfo.UpdateItem(item);
} }
else else
{ {
item.AssetID = asset.FullID; item.AssetID = asset.Metadata.FullID;
if (remoteClient != null && (remoteClient.AgentId != objectGroup.RootPart.OwnerID) && Permissions.PropagatePermissions()) if (remoteClient != null && (remoteClient.AgentId != objectGroup.RootPart.OwnerID) && Permissions.PropagatePermissions())
{ {
@ -1991,9 +1991,9 @@ namespace OpenSim.Region.Environment.Scenes
// TODO: add the new fields (Flags, Sale info, etc) // TODO: add the new fields (Flags, Sale info, etc)
item.CreationDate = Util.UnixTimeSinceEpoch(); item.CreationDate = Util.UnixTimeSinceEpoch();
item.Description = asset.Description; item.Description = asset.Metadata.Description;
item.Name = asset.Name; item.Name = asset.Metadata.Name;
item.AssetType = asset.Type; item.AssetType = asset.Metadata.Type;
userInfo.AddItem(item); userInfo.AddItem(item);
@ -2077,10 +2077,10 @@ namespace OpenSim.Region.Environment.Scenes
Utils.StringToBytes(sceneObjectXml)); Utils.StringToBytes(sceneObjectXml));
AssetCache.AddAsset(asset); AssetCache.AddAsset(asset);
item.AssetID = asset.FullID; item.AssetID = asset.Metadata.FullID;
item.Description = asset.Description; item.Description = asset.Metadata.Description;
item.Name = asset.Name; item.Name = asset.Metadata.Name;
item.AssetType = asset.Type; item.AssetType = asset.Metadata.Type;
item.InvType = (int)InventoryType.Object; item.InvType = (int)InventoryType.Object;
item.Folder = foundFolder; item.Folder = foundFolder;
@ -2118,10 +2118,10 @@ namespace OpenSim.Region.Environment.Scenes
item.Creator = grp.RootPart.CreatorID; item.Creator = grp.RootPart.CreatorID;
item.Owner = remoteClient.AgentId; item.Owner = remoteClient.AgentId;
item.ID = UUID.Random(); item.ID = UUID.Random();
item.AssetID = asset.FullID; item.AssetID = asset.Metadata.FullID;
item.Description = asset.Description; item.Description = asset.Metadata.Description;
item.Name = asset.Name; item.Name = asset.Metadata.Name;
item.AssetType = asset.Type; item.AssetType = asset.Metadata.Type;
item.InvType = (int)InventoryType.Object; item.InvType = (int)InventoryType.Object;
item.Folder = UUID.Zero; // Objects folder! item.Folder = UUID.Zero; // Objects folder!

View File

@ -1644,13 +1644,13 @@ namespace OpenSim.Region.Environment.Scenes
m_regInfo.RegionSettings.TerrainImageID = TerrainImageUUID; m_regInfo.RegionSettings.TerrainImageID = TerrainImageUUID;
AssetBase asset = new AssetBase(); AssetBase asset = new AssetBase();
asset.FullID = m_regInfo.RegionSettings.TerrainImageID; asset.Metadata.FullID = m_regInfo.RegionSettings.TerrainImageID;
asset.Data = data; asset.Data = data;
asset.Name = "terrainImage_" + m_regInfo.RegionID.ToString() + "_" + lastMapRefresh.ToString(); asset.Metadata.Name = "terrainImage_" + m_regInfo.RegionID.ToString() + "_" + lastMapRefresh.ToString();
asset.Description = RegionInfo.RegionName; asset.Metadata.Description = RegionInfo.RegionName;
asset.Type = 0; asset.Metadata.Type = 0;
asset.Temporary = temporary; asset.Metadata.Temporary = temporary;
AssetCache.AddAsset(asset); AssetCache.AddAsset(asset);
} }
@ -4140,10 +4140,10 @@ namespace OpenSim.Region.Environment.Scenes
item.ID = UUID.Random(); item.ID = UUID.Random();
item.Owner = remoteClient.AgentId; item.Owner = remoteClient.AgentId;
item.AssetID = asset.FullID; item.AssetID = asset.Metadata.FullID;
item.Description = asset.Description; item.Description = asset.Metadata.Description;
item.Name = asset.Name; item.Name = asset.Metadata.Name;
item.AssetType = asset.Type; item.AssetType = asset.Metadata.Type;
item.InvType = (int)InventoryType.Object; item.InvType = (int)InventoryType.Object;
item.Folder = categoryID; item.Folder = categoryID;

View File

@ -1024,10 +1024,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
// Create new asset // Create new asset
AssetBase asset = new AssetBase(); AssetBase asset = new AssetBase();
asset.Name = notecardName; asset.Metadata.Name = notecardName;
asset.Description = "Script Generated Notecard"; asset.Metadata.Description = "Script Generated Notecard";
asset.Type = 7; asset.Metadata.Type = 7;
asset.FullID = UUID.Random(); asset.Metadata.FullID = UUID.Random();
string notecardData = ""; string notecardData = "";
for (int i = 0; i < contents.Length; i++) { for (int i = 0; i < contents.Length; i++) {
@ -1047,8 +1047,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
taskItem.ResetIDs(m_host.UUID); taskItem.ResetIDs(m_host.UUID);
taskItem.ParentID = m_host.UUID; taskItem.ParentID = m_host.UUID;
taskItem.CreationDate = (uint)Util.UnixTimeSinceEpoch(); taskItem.CreationDate = (uint)Util.UnixTimeSinceEpoch();
taskItem.Name = asset.Name; taskItem.Name = asset.Metadata.Name;
taskItem.Description = asset.Description; taskItem.Description = asset.Metadata.Description;
taskItem.Type = 7; taskItem.Type = 7;
taskItem.InvType = 7; taskItem.InvType = 7;
taskItem.OwnerID = m_host.OwnerID; taskItem.OwnerID = m_host.OwnerID;
@ -1062,7 +1062,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
taskItem.Flags = 0; taskItem.Flags = 0;
taskItem.PermsGranter = UUID.Zero; taskItem.PermsGranter = UUID.Zero;
taskItem.PermsMask = 0; taskItem.PermsMask = 0;
taskItem.AssetID = asset.FullID; taskItem.AssetID = asset.Metadata.FullID;
m_host.Inventory.AddInventoryItem(taskItem, false); m_host.Inventory.AddInventoryItem(taskItem, false);
} }