- 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.WriteAttributeString("id", asset.ID.ToString());
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.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.WriteBase64(asset.Data,0,asset.Data.Length);
@ -275,18 +275,18 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
created = !modified;
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.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", ""));
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}",
MsgId, rdata.Parameters[0], asset.ID);
MsgId, rdata.Parameters[0], asset.Metadata.ID);
}
Rest.AssetServices.AddAsset(asset);
@ -300,14 +300,14 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
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);
}
else
{
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);
}
else
@ -355,26 +355,26 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
created = !modified;
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.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", ""));
Rest.AssetServices.AddAsset(asset);
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);
}
else
{
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);
}
else

View File

@ -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.ID, asset.Type, asset.Name);
MsgId, asset.Metadata.ID, asset.Metadata.Type, asset.Metadata.Name);
Rest.AssetServices.AddAsset(asset);
created = true;
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)
{
@ -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.ID, asset.Type, asset.Name);
MsgId, asset.Metadata.ID, asset.Metadata.Type, asset.Metadata.Name);
// The asset was validated during the collection process
Rest.AssetServices.AddAsset(asset);
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)
{
@ -1884,10 +1884,10 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
asset = new AssetBase(uuid, name);
asset.Description = desc;
asset.Type = type; // type == 0 == texture
asset.Local = local;
asset.Temporary = temp;
asset.Metadata.Description = desc;
asset.Metadata.Type = type; // type == 0 == texture
asset.Metadata.Local = local;
asset.Metadata.Temporary = temp;
b64string = ic.xml.ReadElementContentAsString();
@ -2039,10 +2039,10 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
if (ic.Asset != null)
{
if (ic.Asset.Name == String.Empty)
ic.Asset.Name = ic.Item.Name;
if (ic.Asset.Description == String.Empty)
ic.Asset.Description = ic.Item.Description;
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;
}
// Assign permissions

View File

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

View File

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

View File

@ -69,7 +69,7 @@ namespace OpenSim.Data.NHibernate
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)
{
manager.Save(asset);
@ -78,13 +78,13 @@ namespace OpenSim.Data.NHibernate
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);
}
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);
}

View File

@ -125,8 +125,8 @@ namespace OpenSim.Data.SQLite
/// <param name="asset">Asset Base</param>
override public void CreateAsset(AssetBase asset)
{
//m_log.Info("[ASSET DB]: Creating Asset " + Util.ToRawUuidString(asset.FullID));
if (ExistsAsset(asset.FullID))
//m_log.Info("[ASSET DB]: Creating Asset " + Util.ToRawUuidString(asset.Metadata.FullID));
if (ExistsAsset(asset.Metadata.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.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(":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(":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.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(":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(":Data", asset.Data));
cmd.ExecuteNonQuery();
@ -181,14 +181,14 @@ namespace OpenSim.Data.SQLite
/// <param name="asset"></param>
private static void LogAssetLoad(AssetBase asset)
{
string temporary = asset.Temporary ? "Temporary" : "Stored";
string local = asset.Local ? "Local" : "Remote";
string temporary = asset.Metadata.Temporary ? "Temporary" : "Stored";
string local = asset.Metadata.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.FullID, asset.Name, asset.Description, asset.Type,
asset.Metadata.FullID, asset.Metadata.Name, asset.Metadata.Description, asset.Metadata.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.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.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.Data = (byte[]) row["Data"];
return asset;
}

View File

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

View File

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

View File

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

View File

@ -290,11 +290,11 @@ namespace OpenSim.Framework.Communications.Cache
/// <param name="asset"></param>
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.
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
// 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.
//
// 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);
}
@ -345,25 +345,25 @@ namespace OpenSim.Framework.Communications.Cache
{
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)
{
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.NumPackets = CalculateNumPackets(assetInf.Data);
RequestedAssets.Remove(assetInf.FullID);
RequestedAssets.Remove(assetInf.Metadata.FullID);
// If it's a direct request for a script, drop it
// because it's a hacked client
if (req.AssetRequestSource != 2 || assetInf.Type != 10)
if (req.AssetRequestSource != 2 || assetInf.Metadata.Type != 10)
AssetRequests.Add(req);
}
}
@ -373,8 +373,8 @@ namespace OpenSim.Framework.Communications.Cache
lock (RequestLists)
{
if (RequestLists.TryGetValue(asset.FullID, out reqList))
RequestLists.Remove(asset.FullID);
if (RequestLists.TryGetValue(asset.Metadata.FullID, out reqList))
RequestLists.Remove(asset.Metadata.FullID);
}
if (reqList != null)
@ -385,8 +385,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.FullID);
req.Callback(asset.FullID, asset);
// m_log.DebugFormat("[ASSET CACHE]: Callback for asset {0}", asset.Metadata.FullID);
req.Callback(asset.Metadata.FullID, asset);
}
}
}
@ -494,7 +494,7 @@ namespace OpenSim.Framework.Communications.Cache
}
// 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;
// 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)
{
Data = aBase.Data;
FullID = aBase.FullID;
Type = aBase.Type;
Name = aBase.Name;
Description = aBase.Description;
Metadata.FullID = aBase.Metadata.FullID;
Metadata.Type = aBase.Metadata.Type;
Metadata.Name = aBase.Metadata.Name;
Metadata.Description = aBase.Metadata.Description;
}
}
@ -592,10 +592,10 @@ namespace OpenSim.Framework.Communications.Cache
public TextureImage(AssetBase aBase)
{
Data = aBase.Data;
FullID = aBase.FullID;
Type = aBase.Type;
Name = aBase.Name;
Description = aBase.Description;
Metadata.FullID = aBase.Metadata.FullID;
Metadata.Type = aBase.Metadata.Type;
Metadata.Name = aBase.Metadata.Name;
Metadata.Description = aBase.Metadata.Description;
}
}

View File

@ -403,17 +403,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.Description = String.Format("ENCASS#:~:#{0}#:~:#{1}#:~:#{2}#:~:#{3}",
x.Metadata.Description = String.Format("ENCASS#:~:#{0}#:~:#{1}#:~:#{2}#:~:#{3}",
"OPENSIM_AES_AF1",
file.AlsoKnownAs,
salt,
x.Description);
x.Metadata.Description);
}
private bool DecryptAssetBase(AssetBase x)
{
// Check it's encrypted first.
if (!x.Description.Contains("ENCASS"))
if (!x.Metadata.Description.Contains("ENCASS"))
return true;
// ENCASS:ALG:AKA:SALT:Description
@ -421,7 +421,7 @@ namespace OpenSim.Framework.Communications.Cache
string[] splitchars = new string[1];
splitchars[0] = "#:~:#";
string[] meta = x.Description.Split(splitchars, StringSplitOptions.None);
string[] meta = x.Metadata.Description.Split(splitchars, StringSplitOptions.None);
if (meta.Length < 5)
{
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]))
{
RjinKeyfile deckey = m_keyfiles[meta[2]];
x.Description = meta[4];
x.Metadata.Description = meta[4];
switch (meta[1])
{
case "OPENSIM_AES_AF1":
@ -506,7 +506,7 @@ namespace OpenSim.Framework.Communications.Cache
{
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);
}

View File

@ -45,7 +45,7 @@ namespace OpenSim.Framework.Communications.Cache
}
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]
+ Path.DirectorySeparatorChar + idBytes[1];
@ -56,7 +56,7 @@ namespace OpenSim.Framework.Communications.Cache
if (!Directory.Exists(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);
x.Flush();

View File

@ -97,7 +97,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.FullID);
m_log.InfoFormat("[GRID ASSET CLIENT]: Sending store request for asset {0}", asset.Metadata.FullID);
RestObjectPoster.BeginPostObject<AssetBase>(assetUrl, asset);
}

View File

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

View File

@ -141,7 +141,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.FullID);
m_log.InfoFormat("[REST]: Creating asset {0}", asset.Metadata.FullID);
m_assetProvider.CreateAsset(asset);
return new byte[] {};

View File

@ -7682,7 +7682,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.Type;
int assType = req.AssetInf.Metadata.Type;
Array.Copy(Utils.IntToBytes(assType), 0, Transfer.TransferInfo.Params, 16, 4);
}
else if (req.AssetRequestSource == 3)

View File

@ -206,13 +206,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
private void Initialise(UUID fileID, string fileName)
{
m_asset = new AssetBase();
m_asset.FullID = fileID;
m_asset.Type = type;
m_asset.Metadata.FullID = fileID;
m_asset.Metadata.Type = type;
m_asset.Data = new byte[0];
m_asset.Name = fileName;
m_asset.Description = "empty";
m_asset.Local = true;
m_asset.Temporary = true;
m_asset.Metadata.Name = fileName;
m_asset.Metadata.Description = "empty";
m_asset.Metadata.Local = true;
m_asset.Metadata.Temporary = true;
mXferID = Util.GetNextXferID();
}
@ -223,13 +223,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
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
{
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;
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;
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>
public UUID AssetId
{
get { return m_asset_ref.FullID; }
get { return m_asset_ref.Metadata.FullID; }
}
/// <summary>

View File

@ -326,9 +326,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.FullID;
ass.Type = (int)AssetType.Texture;
ass.Temporary = false;
info.RegionSettings.TerrainImageID = ass.Metadata.FullID;
ass.Metadata.Type = (int)AssetType.Texture;
ass.Metadata.Temporary = false;
//imageData.CopyTo(ass.Data, 0);
ass.Data = imageData;
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}",
item.Name, part.Name, transactionID);
asset.Name = item.Name;
asset.Description = item.Description;
asset.Type = (sbyte)item.Type;
item.AssetID = asset.FullID;
asset.Metadata.Name = item.Name;
asset.Metadata.Description = item.Description;
asset.Metadata.Type = (sbyte)item.Type;
item.AssetID = asset.Metadata.FullID;
Manager.MyScene.CommsManager.AssetCache.AddAsset(asset);
@ -206,14 +206,14 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction
asset = GetTransactionAsset(transactionID);
}
if (asset != null && asset.FullID == assetID)
if (asset != null && asset.Metadata.FullID == assetID)
{
// Assets never get updated, new ones get created
asset.FullID = UUID.Random();
asset.Name = item.Name;
asset.Description = item.Description;
asset.Type = (sbyte)item.AssetType;
item.AssetID = asset.FullID;
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;
Manager.MyScene.CommsManager.AssetCache.AddAsset(asset);
}

View File

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

View File

@ -55,7 +55,7 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureSender
/// </summary>
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;
@ -117,7 +117,7 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureSender
// See ITextureSender
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();
counter++;
@ -154,7 +154,7 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureSender
{
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++;
}
else
@ -163,7 +163,7 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureSender
Array.Copy(m_asset.Data, 0, ImageData1, 0, 600);
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++;
}
}
@ -179,11 +179,11 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureSender
catch (ArgumentOutOfRangeException)
{
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;
}
RequestUser.SendImageNextPart((ushort)PacketCounter, m_asset.FullID, imageData);
RequestUser.SendImageNextPart((ushort)PacketCounter, m_asset.Metadata.FullID, imageData);
PacketCounter++;
}
}

View File

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

View File

@ -231,21 +231,21 @@ namespace OpenSim.Region.Environment.Modules.Scripting.DynamicTexture
// Create a new asset for user
AssetBase asset = new AssetBase();
asset.FullID = UUID.Random();
asset.Metadata.FullID = UUID.Random();
asset.Data = assetData;
asset.Name = "DynamicImage" + Util.RandomClass.Next(1, 10000);
asset.Type = 0;
asset.Description = "dynamic image";
asset.Local = false;
asset.Temporary = true;
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;
scene.AssetCache.AddAsset(asset);
LastAssetID = asset.FullID;
LastAssetID = asset.Metadata.FullID;
IJ2KDecoder cacheLayerDecode = scene.RequestModuleInterface<IJ2KDecoder>();
if (cacheLayerDecode != null)
{
cacheLayerDecode.syncdecode(asset.FullID, asset.Data);
cacheLayerDecode.syncdecode(asset.Metadata.FullID, asset.Data);
}
cacheLayerDecode = null;
@ -256,7 +256,7 @@ namespace OpenSim.Region.Environment.Modules.Scripting.DynamicTexture
UUID oldID = tmptex.DefaultTexture.TextureID;
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
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);
AssetBase asset = new AssetBase(new UUID(uuid), String.Empty);
asset.Type = assetType;
asset.Metadata.Type = assetType;
asset.Data = data;
m_scene.AssetCache.AddAsset(asset);

View File

@ -86,16 +86,16 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
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("name", asset.Name);
xtw.WriteElementString("description", asset.Description);
xtw.WriteElementString("asset-type", asset.Type.ToString());
xtw.WriteElementString("name", asset.Metadata.Name);
xtw.WriteElementString("description", asset.Metadata.Description);
xtw.WriteElementString("asset-type", asset.Metadata.Type.ToString());
xtw.WriteEndElement();
}
@ -123,15 +123,15 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
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
{
m_log.ErrorFormat(
"[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(

View File

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

View File

@ -60,13 +60,13 @@ namespace OpenSim.Region.Environment.Modules.World.Estate
{
m_asset = new AssetBase();
m_asset.FullID = UUID.Zero;
m_asset.Type = type;
m_asset.Metadata.FullID = UUID.Zero;
m_asset.Metadata.Type = type;
m_asset.Data = new byte[0];
m_asset.Name = pClientFilename;
m_asset.Description = "empty";
m_asset.Local = true;
m_asset.Temporary = true;
m_asset.Metadata.Name = pClientFilename;
m_asset.Metadata.Description = "empty";
m_asset.Metadata.Local = true;
m_asset.Metadata.Temporary = true;
}
@ -78,7 +78,7 @@ namespace OpenSim.Region.Environment.Modules.World.Estate
public void RequestStartXfer(IClientAPI pRemoteClient)
{
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>
@ -120,7 +120,7 @@ namespace OpenSim.Region.Environment.Modules.World.Estate
handlerTerrainUploadDone = TerrainUploadDone;
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))
{
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.
// For now, let me just do it for textures and scripts
if (((AssetType)asset.Type == AssetType.Texture) ||
((AssetType)asset.Type == AssetType.LSLBytecode) ||
((AssetType)asset.Type == AssetType.LSLText))
if (((AssetType)asset.Metadata.Type == AssetType.Texture) ||
((AssetType)asset.Metadata.Type == AssetType.LSLBytecode) ||
((AssetType)asset.Metadata.Type == AssetType.LSLText))
{
AssetBase asset1 = new AssetBase();
Copy(asset, asset1);
@ -157,7 +157,7 @@ namespace OpenSim.Region.Environment.Scenes.Hypergrid
if (asset1 != null)
{
// 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:
// 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)
{
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;
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;
}
@ -243,7 +243,7 @@ namespace OpenSim.Region.Environment.Scenes.Hypergrid
private Dictionary<UUID, bool> SniffUUIDs(AssetBase asset)
{
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);
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);
AssetCache.AddAsset(asset);
item.AssetID = asset.FullID;
item.AssetID = asset.Metadata.FullID;
userInfo.UpdateItem(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
item.AssetID = asset.FullID;
item.AssetID = asset.Metadata.FullID;
group.UpdateInventoryItem(item);
part.GetProperties(remoteClient);
@ -688,7 +688,7 @@ namespace OpenSim.Region.Environment.Scenes
{
if (newName != String.Empty)
{
asset.Name = newName;
asset.Metadata.Name = newName;
}
else
{
@ -728,10 +728,10 @@ namespace OpenSim.Region.Environment.Scenes
private AssetBase CreateAsset(string name, string description, sbyte assetType, byte[] data)
{
AssetBase asset = new AssetBase();
asset.Name = name;
asset.Description = description;
asset.Type = assetType;
asset.FullID = UUID.Random();
asset.Metadata.Name = name;
asset.Metadata.Description = description;
asset.Metadata.Type = assetType;
asset.Metadata.FullID = UUID.Random();
asset.Data = (data == null) ? new byte[1] : data;
return asset;
@ -831,11 +831,11 @@ namespace OpenSim.Region.Environment.Scenes
item.Owner = remoteClient.AgentId;
item.Creator = remoteClient.AgentId;
item.ID = UUID.Random();
item.AssetID = asset.FullID;
item.Description = asset.Description;
item.AssetID = asset.Metadata.FullID;
item.Description = asset.Metadata.Description;
item.Name = name;
item.Flags = flags;
item.AssetType = asset.Type;
item.AssetType = asset.Metadata.Type;
item.InvType = invType;
item.Folder = folderID;
item.CurrentPermissions = currentMask;
@ -905,7 +905,7 @@ namespace OpenSim.Region.Environment.Scenes
AssetBase asset = CreateAsset(name, description, assetType, data);
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
{
@ -1550,7 +1550,7 @@ namespace OpenSim.Region.Environment.Scenes
taskItem.Flags = itemBase.Flags;
taskItem.PermsGranter = UUID.Zero;
taskItem.PermsMask = 0;
taskItem.AssetID = asset.FullID;
taskItem.AssetID = asset.Metadata.FullID;
part.Inventory.AddInventoryItem(taskItem, false);
part.GetProperties(remoteClient);
@ -1949,16 +1949,16 @@ namespace OpenSim.Region.Environment.Scenes
(sbyte)AssetType.Object,
Utils.StringToBytes(sceneObjectXml));
AssetCache.AddAsset(asset);
assetID = asset.FullID;
assetID = asset.Metadata.FullID;
if (DeRezAction.SaveToExistingUserInventoryItem == action)
{
item.AssetID = asset.FullID;
item.AssetID = asset.Metadata.FullID;
userInfo.UpdateItem(item);
}
else
{
item.AssetID = asset.FullID;
item.AssetID = asset.Metadata.FullID;
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)
item.CreationDate = Util.UnixTimeSinceEpoch();
item.Description = asset.Description;
item.Name = asset.Name;
item.AssetType = asset.Type;
item.Description = asset.Metadata.Description;
item.Name = asset.Metadata.Name;
item.AssetType = asset.Metadata.Type;
userInfo.AddItem(item);
@ -2077,10 +2077,10 @@ namespace OpenSim.Region.Environment.Scenes
Utils.StringToBytes(sceneObjectXml));
AssetCache.AddAsset(asset);
item.AssetID = asset.FullID;
item.Description = asset.Description;
item.Name = asset.Name;
item.AssetType = asset.Type;
item.AssetID = asset.Metadata.FullID;
item.Description = asset.Metadata.Description;
item.Name = asset.Metadata.Name;
item.AssetType = asset.Metadata.Type;
item.InvType = (int)InventoryType.Object;
item.Folder = foundFolder;
@ -2118,10 +2118,10 @@ namespace OpenSim.Region.Environment.Scenes
item.Creator = grp.RootPart.CreatorID;
item.Owner = remoteClient.AgentId;
item.ID = UUID.Random();
item.AssetID = asset.FullID;
item.Description = asset.Description;
item.Name = asset.Name;
item.AssetType = asset.Type;
item.AssetID = asset.Metadata.FullID;
item.Description = asset.Metadata.Description;
item.Name = asset.Metadata.Name;
item.AssetType = asset.Metadata.Type;
item.InvType = (int)InventoryType.Object;
item.Folder = UUID.Zero; // Objects folder!

View File

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

View File

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