* Adds CreatorID to asset metadata. This is just the plumbing to support CreatorID, it doesn't modify database backends or OAR files to support storing/loading it

slimupdates
John Hurliman 2010-02-22 13:27:17 -08:00
parent 845a390e93
commit 7665aad002
34 changed files with 74 additions and 78 deletions

View File

@ -1564,7 +1564,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
assets = doc.GetElementsByTagName("RequiredAsset"); assets = doc.GetElementsByTagName("RequiredAsset");
foreach (XmlNode asset in assets) foreach (XmlNode asset in assets)
{ {
AssetBase rass = new AssetBase(UUID.Random(), GetStringAttribute(asset,"name",""), SByte.Parse(GetStringAttribute(asset,"type",""))); AssetBase rass = new AssetBase(UUID.Random(), GetStringAttribute(asset,"name",""), SByte.Parse(GetStringAttribute(asset,"type","")), UUID.Zero);
rass.Description = GetStringAttribute(asset,"desc",""); rass.Description = GetStringAttribute(asset,"desc","");
rass.Local = Boolean.Parse(GetStringAttribute(asset,"local","")); rass.Local = Boolean.Parse(GetStringAttribute(asset,"local",""));
rass.Temporary = Boolean.Parse(GetStringAttribute(asset,"temporary","")); rass.Temporary = Boolean.Parse(GetStringAttribute(asset,"temporary",""));

View File

@ -261,7 +261,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
modified = (asset != null); modified = (asset != null);
created = !modified; created = !modified;
asset = new AssetBase(uuid, xml.GetAttribute("name"), SByte.Parse(xml.GetAttribute("type"))); asset = new AssetBase(uuid, xml.GetAttribute("name"), SByte.Parse(xml.GetAttribute("type")), UUID.Zero);
asset.Description = xml.GetAttribute("desc"); asset.Description = xml.GetAttribute("desc");
asset.Local = Int32.Parse(xml.GetAttribute("local")) != 0; asset.Local = Int32.Parse(xml.GetAttribute("local")) != 0;
asset.Temporary = Int32.Parse(xml.GetAttribute("temporary")) != 0; asset.Temporary = Int32.Parse(xml.GetAttribute("temporary")) != 0;
@ -338,7 +338,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
modified = (asset != null); modified = (asset != null);
created = !modified; created = !modified;
asset = new AssetBase(uuid, xml.GetAttribute("name"), SByte.Parse(xml.GetAttribute("type"))); asset = new AssetBase(uuid, xml.GetAttribute("name"), SByte.Parse(xml.GetAttribute("type")), UUID.Zero);
asset.Description = xml.GetAttribute("desc"); asset.Description = xml.GetAttribute("desc");
asset.Local = Int32.Parse(xml.GetAttribute("local")) != 0; asset.Local = Int32.Parse(xml.GetAttribute("local")) != 0;
asset.Temporary = Int32.Parse(xml.GetAttribute("temporary")) != 0; asset.Temporary = Int32.Parse(xml.GetAttribute("temporary")) != 0;

View File

@ -1871,7 +1871,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
// Create AssetBase entity to hold the inlined asset // Create AssetBase entity to hold the inlined asset
asset = new AssetBase(uuid, name, type); asset = new AssetBase(uuid, name, type, UUID.Zero);
asset.Description = desc; asset.Description = desc;
asset.Local = local; asset.Local = local;

View File

@ -135,7 +135,8 @@ namespace OpenSim.Data.MSSQL
AssetBase asset = new AssetBase( AssetBase asset = new AssetBase(
new UUID((Guid)reader["id"]), new UUID((Guid)reader["id"]),
(string)reader["name"], (string)reader["name"],
Convert.ToSByte(reader["assetType"]) Convert.ToSByte(reader["assetType"]),
UUID.Zero
); );
// Region Main // Region Main
asset.Description = (string)reader["description"]; asset.Description = (string)reader["description"];

View File

@ -122,7 +122,7 @@ namespace OpenSim.Data.MySQL
{ {
if (dbReader.Read()) if (dbReader.Read())
{ {
asset = new AssetBase(assetID, (string)dbReader["name"], (sbyte)dbReader["assetType"]); asset = new AssetBase(assetID, (string)dbReader["name"], (sbyte)dbReader["assetType"], UUID.Zero);
asset.Data = (byte[])dbReader["data"]; asset.Data = (byte[])dbReader["data"];
asset.Description = (string)dbReader["description"]; asset.Description = (string)dbReader["description"];

View File

@ -234,7 +234,8 @@ namespace OpenSim.Data.SQLite
AssetBase asset = new AssetBase( AssetBase asset = new AssetBase(
new UUID((String)row["UUID"]), new UUID((String)row["UUID"]),
(String)row["Name"], (String)row["Name"],
Convert.ToSByte(row["Type"]) Convert.ToSByte(row["Type"]),
UUID.Zero
); );
asset.Description = (String) row["Description"]; asset.Description = (String) row["Description"];

View File

@ -66,9 +66,9 @@ namespace OpenSim.Data.Tests
[Test] [Test]
public void T010_StoreSimpleAsset() public void T010_StoreSimpleAsset()
{ {
AssetBase a1 = new AssetBase(uuid1, "asset one", (sbyte)AssetType.Texture); AssetBase a1 = new AssetBase(uuid1, "asset one", (sbyte)AssetType.Texture, UUID.Zero);
AssetBase a2 = new AssetBase(uuid2, "asset two", (sbyte)AssetType.Texture); AssetBase a2 = new AssetBase(uuid2, "asset two", (sbyte)AssetType.Texture, UUID.Zero);
AssetBase a3 = new AssetBase(uuid3, "asset three", (sbyte)AssetType.Texture); AssetBase a3 = new AssetBase(uuid3, "asset three", (sbyte)AssetType.Texture, UUID.Zero);
a1.Data = asset1; a1.Data = asset1;
a2.Data = asset1; a2.Data = asset1;
a3.Data = asset1; a3.Data = asset1;

View File

@ -297,8 +297,8 @@ namespace OpenSim.Data.Tests
public void AssetShouldMatch() public void AssetShouldMatch()
{ {
UUID uuid1 = UUID.Random(); UUID uuid1 = UUID.Random();
AssetBase actual = new AssetBase(uuid1, "asset one", (sbyte)AssetType.Texture); AssetBase actual = new AssetBase(uuid1, "asset one", (sbyte)AssetType.Texture, UUID.Zero);
AssetBase expected = new AssetBase(uuid1, "asset one", (sbyte)AssetType.Texture); AssetBase expected = new AssetBase(uuid1, "asset one", (sbyte)AssetType.Texture, UUID.Zero);
var constraint = Constraints.PropertyCompareConstraint(expected); var constraint = Constraints.PropertyCompareConstraint(expected);
@ -309,8 +309,8 @@ namespace OpenSim.Data.Tests
public void AssetShouldNotMatch() public void AssetShouldNotMatch()
{ {
UUID uuid1 = UUID.Random(); UUID uuid1 = UUID.Random();
AssetBase actual = new AssetBase(uuid1, "asset one", (sbyte)AssetType.Texture); AssetBase actual = new AssetBase(uuid1, "asset one", (sbyte)AssetType.Texture, UUID.Zero);
AssetBase expected = new AssetBase(UUID.Random(), "asset one", (sbyte)AssetType.Texture); AssetBase expected = new AssetBase(UUID.Random(), "asset one", (sbyte)AssetType.Texture, UUID.Zero);
var constraint = Constraints.PropertyCompareConstraint(expected); var constraint = Constraints.PropertyCompareConstraint(expected);
@ -321,8 +321,8 @@ namespace OpenSim.Data.Tests
public void AssetShouldNotMatch2() public void AssetShouldNotMatch2()
{ {
UUID uuid1 = UUID.Random(); UUID uuid1 = UUID.Random();
AssetBase actual = new AssetBase(uuid1, "asset one", (sbyte)AssetType.Texture); AssetBase actual = new AssetBase(uuid1, "asset one", (sbyte)AssetType.Texture, UUID.Zero);
AssetBase expected = new AssetBase(uuid1, "asset two", (sbyte)AssetType.Texture); AssetBase expected = new AssetBase(uuid1, "asset two", (sbyte)AssetType.Texture, UUID.Zero);
var constraint = Constraints.PropertyCompareConstraint(expected); var constraint = Constraints.PropertyCompareConstraint(expected);

View File

@ -165,7 +165,7 @@ namespace OpenSim.Data.Tests
[Test] [Test]
public void TestScramble() public void TestScramble()
{ {
AssetBase actual = new AssetBase(UUID.Random(), "asset one", (sbyte)AssetType.Texture); AssetBase actual = new AssetBase(UUID.Random(), "asset one", (sbyte)AssetType.Texture, UUID.Zero);
new PropertyScrambler<AssetBase>().Scramble(actual); new PropertyScrambler<AssetBase>().Scramble(actual);
} }
@ -173,7 +173,7 @@ namespace OpenSim.Data.Tests
public void DontScramble() public void DontScramble()
{ {
UUID uuid = UUID.Random(); UUID uuid = UUID.Random();
AssetBase asset = new AssetBase(uuid, "asset", (sbyte)AssetType.Texture); AssetBase asset = new AssetBase(uuid, "asset", (sbyte)AssetType.Texture, UUID.Zero);
new PropertyScrambler<AssetBase>() new PropertyScrambler<AssetBase>()
.DontScramble(x => x.Metadata) .DontScramble(x => x.Metadata)
.DontScramble(x => x.FullID) .DontScramble(x => x.FullID)

View File

@ -61,7 +61,7 @@ namespace OpenSim.Framework
m_metadata.Type = (sbyte)AssetType.Unknown; m_metadata.Type = (sbyte)AssetType.Unknown;
} }
public AssetBase(UUID assetID, string name, sbyte assetType) public AssetBase(UUID assetID, string name, sbyte assetType, UUID creatorID)
{ {
if (assetType == (sbyte)AssetType.Unknown) if (assetType == (sbyte)AssetType.Unknown)
{ {
@ -76,7 +76,7 @@ namespace OpenSim.Framework
m_metadata.Type = assetType; m_metadata.Type = assetType;
} }
public AssetBase(string assetID, string name, sbyte assetType) public AssetBase(string assetID, string name, sbyte assetType, UUID creatorID)
{ {
if (assetType == (sbyte)AssetType.Unknown) if (assetType == (sbyte)AssetType.Unknown)
{ {
@ -220,7 +220,6 @@ namespace OpenSim.Framework
public class AssetMetadata public class AssetMetadata
{ {
private UUID m_fullid; private UUID m_fullid;
// m_id added as a dirty hack to transition from FullID to ID
private string m_id; private string m_id;
private string m_name = String.Empty; private string m_name = String.Empty;
private string m_description = String.Empty; private string m_description = String.Empty;
@ -230,8 +229,7 @@ namespace OpenSim.Framework
private byte[] m_sha1; private byte[] m_sha1;
private bool m_local; private bool m_local;
private bool m_temporary; private bool m_temporary;
//private Dictionary<string, Uri> m_methods = new Dictionary<string, Uri>(); private UUID m_creatorid;
//private OSDMap m_extra_data;
public UUID FullID public UUID FullID
{ {
@ -324,16 +322,10 @@ namespace OpenSim.Framework
set { m_temporary = value; } set { m_temporary = value; }
} }
//public Dictionary<string, Uri> Methods public UUID CreatorID
//{ {
// get { return m_methods; } get { return m_creatorid; }
// set { m_methods = value; } set { m_creatorid = value; }
//} }
//public OSDMap ExtraData
//{
// get { return m_extra_data; }
// set { m_extra_data = value; }
//}
} }
} }

View File

@ -38,7 +38,7 @@ namespace OpenSim.Framework
public int Version; public int Version;
public AssetLandmark(AssetBase a) public AssetLandmark(AssetBase a)
: base(a.FullID, a.Name, a.Type) : base(a.FullID, a.Name, a.Type, a.Metadata.CreatorID)
{ {
Data = a.Data; Data = a.Data;
Description = a.Description; Description = a.Description;

View File

@ -41,11 +41,12 @@ namespace OpenSim.Framework.AssetLoader.Filesystem
{ {
public class AssetLoaderFileSystem : IAssetLoader public class AssetLoaderFileSystem : IAssetLoader
{ {
private static readonly UUID LIBRARY_OWNER_ID = new UUID("11111111-1111-0000-0000-000100bba000");
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
protected static AssetBase CreateAsset(string assetIdStr, string name, string path, sbyte type) protected static AssetBase CreateAsset(string assetIdStr, string name, string path, sbyte type)
{ {
AssetBase asset = new AssetBase(new UUID(assetIdStr), name, type); AssetBase asset = new AssetBase(new UUID(assetIdStr), name, type, LIBRARY_OWNER_ID);
if (!String.IsNullOrEmpty(path)) if (!String.IsNullOrEmpty(path))
{ {

View File

@ -888,7 +888,7 @@ namespace OpenSim.Framework.Capabilities
} }
AssetBase asset; AssetBase asset;
asset = new AssetBase(assetID, assetName, assType); asset = new AssetBase(assetID, assetName, assType, m_agentID);
asset.Data = data; asset.Data = data;
if (AddNewAsset != null) if (AddNewAsset != null)
AddNewAsset(asset); AddNewAsset(asset);

View File

@ -67,7 +67,7 @@ namespace OpenSim.Framework.Tests
private void CheckContainsReferences(AssetType assetType, bool expected) private void CheckContainsReferences(AssetType assetType, bool expected)
{ {
AssetBase asset = new AssetBase(UUID.Zero, String.Empty, (sbyte)assetType); AssetBase asset = new AssetBase(UUID.Zero, String.Empty, (sbyte)assetType, UUID.Zero);
bool actual = asset.ContainsReferences; bool actual = asset.ContainsReferences;
Assert.AreEqual(expected, actual, "Expected "+assetType+".ContainsReferences to be "+expected+" but was "+actual+"."); Assert.AreEqual(expected, actual, "Expected "+assetType+".ContainsReferences to be "+expected+" but was "+actual+".");
} }

View File

@ -197,7 +197,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
private void Initialise(UUID fileID, string fileName) private void Initialise(UUID fileID, string fileName)
{ {
m_asset = new AssetBase(fileID, fileName, type); m_asset = new AssetBase(fileID, fileName, type, UUID.Zero);
m_asset.Data = new byte[0]; m_asset.Data = new byte[0];
m_asset.Description = "empty"; m_asset.Description = "empty";
m_asset.Local = true; m_asset.Local = true;
@ -212,6 +212,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
public void RequestStartXfer(IClientAPI pRemoteClient) public void RequestStartXfer(IClientAPI pRemoteClient)
{ {
m_asset.Metadata.CreatorID = pRemoteClient.AgentId;
if (!String.IsNullOrEmpty(m_asset.Name)) if (!String.IsNullOrEmpty(m_asset.Name))
{ {
pRemoteClient.SendXferRequest(mXferID, m_asset.Type, m_asset.FullID, 0, Utils.StringToBytes(m_asset.Name)); pRemoteClient.SendXferRequest(mXferID, m_asset.Type, m_asset.FullID, 0, Utils.StringToBytes(m_asset.Name));

View File

@ -112,7 +112,7 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
bool storeLocal, bool tempFile) bool storeLocal, bool tempFile)
{ {
ourClient = remoteClient; ourClient = remoteClient;
m_asset = new AssetBase(assetID, "blank", type); m_asset = new AssetBase(assetID, "blank", type, remoteClient.AgentId);
m_asset.Data = data; m_asset.Data = data;
m_asset.Description = "empty"; m_asset.Description = "empty";
m_asset.Local = storeLocal; m_asset.Local = storeLocal;

View File

@ -240,7 +240,7 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender
{ {
string assetID = "j2kCache_" + AssetId.ToString(); string assetID = "j2kCache_" + AssetId.ToString();
AssetBase layerDecodeAsset = new AssetBase(assetID, assetID, (sbyte)AssetType.Notecard); AssetBase layerDecodeAsset = new AssetBase(assetID, assetID, (sbyte)AssetType.Notecard, m_scene.RegionInfo.RegionID);
layerDecodeAsset.Local = true; layerDecodeAsset.Local = true;
layerDecodeAsset.Temporary = true; layerDecodeAsset.Temporary = true;

View File

@ -416,7 +416,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
//m_log.DebugFormat("[INVENTORY ARCHIVER]: Importing asset {0}, type {1}", uuid, assetType); //m_log.DebugFormat("[INVENTORY ARCHIVER]: Importing asset {0}, type {1}", uuid, assetType);
AssetBase asset = new AssetBase(new UUID(uuid), "RandomName", assetType); AssetBase asset = new AssetBase(new UUID(uuid), "RandomName", assetType, UUID.Zero);
asset.Data = data; asset.Data = data;
m_scene.AssetService.Store(asset); m_scene.AssetService.Store(asset);

View File

@ -90,7 +90,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
// HGAssetService dispatches it to the remote grid. // HGAssetService dispatches it to the remote grid.
// It's not pretty, but the best that can be done while // It's not pretty, but the best that can be done while
// not having a global naming infrastructure // not having a global naming infrastructure
AssetBase asset1 = new AssetBase(asset.FullID, asset.Name, asset.Type); AssetBase asset1 = new AssetBase(asset.FullID, asset.Name, asset.Type, asset.Metadata.CreatorID);
Copy(asset, asset1); Copy(asset, asset1);
try try
{ {

View File

@ -161,7 +161,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
} }
AssetBase asset = AssetBase asset =
CreateAsset(item.Name, item.Description, (sbyte)item.AssetType, data); CreateAsset(item.Name, item.Description, (sbyte)item.AssetType, data, remoteClient.AgentId);
item.AssetID = asset.FullID; item.AssetID = asset.FullID;
m_Scene.AssetService.Store(asset); m_Scene.AssetService.Store(asset);
@ -339,7 +339,8 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
objectGroup.GetPartName(objectGroup.RootPart.LocalId), objectGroup.GetPartName(objectGroup.RootPart.LocalId),
objectGroup.GetPartDescription(objectGroup.RootPart.LocalId), objectGroup.GetPartDescription(objectGroup.RootPart.LocalId),
(sbyte)AssetType.Object, (sbyte)AssetType.Object,
Utils.StringToBytes(sceneObjectXml)); Utils.StringToBytes(sceneObjectXml),
objectGroup.OwnerID);
m_Scene.AssetService.Store(asset); m_Scene.AssetService.Store(asset);
assetID = asset.FullID; assetID = asset.FullID;
@ -640,9 +641,9 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
/// <param name="assetType"></param> /// <param name="assetType"></param>
/// <param name="data"></param> /// <param name="data"></param>
/// <returns></returns> /// <returns></returns>
private AssetBase CreateAsset(string name, string description, sbyte assetType, byte[] data) private AssetBase CreateAsset(string name, string description, sbyte assetType, byte[] data, UUID creatorID)
{ {
AssetBase asset = new AssetBase(UUID.Random(), name, assetType); AssetBase asset = new AssetBase(UUID.Random(), name, assetType, creatorID);
asset.Description = description; asset.Description = description;
asset.Data = (data == null) ? new byte[1] : data; asset.Data = (data == null) ? new byte[1] : data;

View File

@ -309,7 +309,8 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
} }
// Create a new asset for user // Create a new asset for user
AssetBase asset = new AssetBase(UUID.Random(), "DynamicImage" + Util.RandomClass.Next(1, 10000), (sbyte)AssetType.Texture); AssetBase asset = new AssetBase(UUID.Random(), "DynamicImage" + Util.RandomClass.Next(1, 10000), (sbyte)AssetType.Texture,
scene.RegionInfo.RegionID);
asset.Data = assetData; asset.Data = assetData;
asset.Description = String.Format("URL image : {0}", Url); asset.Description = String.Format("URL image : {0}", Url);
asset.Local = false; asset.Local = false;

View File

@ -335,7 +335,7 @@ namespace OpenSim.Region.CoreModules.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, assetType); AssetBase asset = new AssetBase(new UUID(uuid), String.Empty, assetType, UUID.Zero);
asset.Data = data; asset.Data = data;
// We're relying on the asset service to do the sensible thing and not store the asset if it already // We're relying on the asset service to do the sensible thing and not store the asset if it already

View File

@ -158,7 +158,7 @@ namespace OpenSim.Region.CoreModules.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, metadata.AssetType); AssetBase asset = new AssetBase(new UUID(filename), metadata.Name, metadata.AssetType, UUID.Zero);
asset.Description = metadata.Description; asset.Description = metadata.Description;
asset.Data = data; asset.Data = data;

View File

@ -52,7 +52,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
public EstateTerrainXferHandler(IClientAPI pRemoteClient, string pClientFilename) public EstateTerrainXferHandler(IClientAPI pRemoteClient, string pClientFilename)
{ {
m_asset = new AssetBase(UUID.Zero, pClientFilename, type); m_asset = new AssetBase(UUID.Zero, pClientFilename, type, pRemoteClient.AgentId);
m_asset.Data = new byte[0]; m_asset.Data = new byte[0];
m_asset.Description = "empty"; m_asset.Description = "empty";
m_asset.Local = true; m_asset.Local = true;

View File

@ -1080,7 +1080,8 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
AssetBase asset = new AssetBase( AssetBase asset = new AssetBase(
m_scene.RegionInfo.RegionSettings.TerrainImageID, m_scene.RegionInfo.RegionSettings.TerrainImageID,
"terrainImage_" + m_scene.RegionInfo.RegionID.ToString() + "_" + lastMapRefresh.ToString(), "terrainImage_" + m_scene.RegionInfo.RegionID.ToString() + "_" + lastMapRefresh.ToString(),
(sbyte)AssetType.Texture); (sbyte)AssetType.Texture,
m_scene.RegionInfo.RegionID);
asset.Data = data; asset.Data = data;
asset.Description = m_scene.RegionInfo.RegionName; asset.Description = m_scene.RegionInfo.RegionName;
asset.Temporary = temporary; asset.Temporary = temporary;

View File

@ -384,7 +384,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation
} }
} }
AssetBase Animasset = new AssetBase(UUID.Random(), "Random Animation", (sbyte)AssetType.Animation); AssetBase Animasset = new AssetBase(UUID.Random(), "Random Animation", (sbyte)AssetType.Animation, m_scenePresence.UUID);
Animasset.Data = anim.ToBytes(); Animasset.Data = anim.ToBytes();
Animasset.Temporary = true; Animasset.Temporary = true;
Animasset.Local = true; Animasset.Local = true;

View File

@ -192,7 +192,7 @@ namespace OpenSim.Region.Framework.Scenes
return new ArrayList(); return new ArrayList();
} }
AssetBase asset = CreateAsset(item.Name, item.Description, (sbyte)AssetType.LSLText, data); AssetBase asset = CreateAsset(item.Name, item.Description, (sbyte)AssetType.LSLText, data, remoteClient.AgentId);
AssetService.Store(asset); AssetService.Store(asset);
if (isScriptRunning) if (isScriptRunning)
@ -570,15 +570,9 @@ namespace OpenSim.Region.Framework.Scenes
/// <summary> /// <summary>
/// Create a new asset data structure. /// Create a new asset data structure.
/// </summary> /// </summary>
/// <param name="name"></param> private AssetBase CreateAsset(string name, string description, sbyte assetType, byte[] data, UUID creatorID)
/// <param name="description"></param>
/// <param name="invType"></param>
/// <param name="assetType"></param>
/// <param name="data"></param>
/// <returns></returns>
private AssetBase CreateAsset(string name, string description, sbyte assetType, byte[] data)
{ {
AssetBase asset = new AssetBase(UUID.Random(), name, assetType); AssetBase asset = new AssetBase(UUID.Random(), name, assetType, creatorID);
asset.Description = description; asset.Description = description;
asset.Data = (data == null) ? new byte[1] : data; asset.Data = (data == null) ? new byte[1] : data;
@ -704,7 +698,7 @@ namespace OpenSim.Region.Framework.Scenes
data = Encoding.ASCII.GetBytes(strdata); data = Encoding.ASCII.GetBytes(strdata);
} }
AssetBase asset = CreateAsset(name, description, assetType, data); AssetBase asset = CreateAsset(name, description, assetType, data, remoteClient.AgentId);
AssetService.Store(asset); AssetService.Store(asset);
CreateNewInventoryItem(remoteClient, remoteClient.AgentId.ToString(), folderID, asset.Name, 0, callbackID, asset, invType, nextOwnerMask, creationDate); CreateNewInventoryItem(remoteClient, remoteClient.AgentId.ToString(), folderID, asset.Name, 0, callbackID, asset, invType, nextOwnerMask, creationDate);
@ -1289,7 +1283,9 @@ namespace OpenSim.Region.Framework.Scenes
itemBase.InvType, part.UUID, remoteClient.AgentId)) itemBase.InvType, part.UUID, remoteClient.AgentId))
return; return;
AssetBase asset = CreateAsset(itemBase.Name, itemBase.Description, (sbyte)itemBase.AssetType, Encoding.ASCII.GetBytes("default\n{\n state_entry()\n {\n llSay(0, \"Script running\");\n }\n}")); AssetBase asset = CreateAsset(itemBase.Name, itemBase.Description, (sbyte)itemBase.AssetType,
Encoding.ASCII.GetBytes("default\n{\n state_entry()\n {\n llSay(0, \"Script running\");\n }\n}"),
remoteClient.AgentId);
AssetService.Store(asset); AssetService.Store(asset);
TaskInventoryItem taskItem = new TaskInventoryItem(); TaskInventoryItem taskItem = new TaskInventoryItem();
@ -1583,7 +1579,8 @@ namespace OpenSim.Region.Framework.Scenes
objectGroup.GetPartName(objectGroup.LocalId), objectGroup.GetPartName(objectGroup.LocalId),
objectGroup.GetPartDescription(objectGroup.LocalId), objectGroup.GetPartDescription(objectGroup.LocalId),
(sbyte)AssetType.Object, (sbyte)AssetType.Object,
Utils.StringToBytes(sceneObjectXml)); Utils.StringToBytes(sceneObjectXml),
remoteClient.AgentId);
AssetService.Store(asset); AssetService.Store(asset);
item.AssetID = asset.FullID; item.AssetID = asset.FullID;
@ -1630,7 +1627,8 @@ namespace OpenSim.Region.Framework.Scenes
grp.GetPartName(grp.LocalId), grp.GetPartName(grp.LocalId),
grp.GetPartDescription(grp.LocalId), grp.GetPartDescription(grp.LocalId),
(sbyte)AssetType.Object, (sbyte)AssetType.Object,
Utils.StringToBytes(sceneObjectXml)); Utils.StringToBytes(sceneObjectXml),
remoteClient.AgentId);
AssetService.Store(asset); AssetService.Store(asset);
InventoryItemBase item = new InventoryItemBase(); InventoryItemBase item = new InventoryItemBase();

View File

@ -4389,7 +4389,8 @@ namespace OpenSim.Region.Framework.Scenes
group.GetPartName(localID), group.GetPartName(localID),
group.GetPartDescription(localID), group.GetPartDescription(localID),
(sbyte)AssetType.Object, (sbyte)AssetType.Object,
Utils.StringToBytes(sceneObjectXml)); Utils.StringToBytes(sceneObjectXml),
group.OwnerID);
AssetService.Store(asset); AssetService.Store(asset);
InventoryItemBase item = new InventoryItemBase(); InventoryItemBase item = new InventoryItemBase();

View File

@ -58,7 +58,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
TestHelper.InMethod(); TestHelper.InMethod();
UUID corruptAssetUuid = UUID.Parse("00000000-0000-0000-0000-000000000666"); UUID corruptAssetUuid = UUID.Parse("00000000-0000-0000-0000-000000000666");
AssetBase corruptAsset = AssetHelpers.CreateAsset(corruptAssetUuid, "CORRUPT ASSET"); AssetBase corruptAsset = AssetHelpers.CreateAsset(corruptAssetUuid, "CORRUPT ASSET", UUID.Zero);
m_assetService.Store(corruptAsset); m_assetService.Store(corruptAsset);
IDictionary<UUID, int> foundAssetUuids = new Dictionary<UUID, int>(); IDictionary<UUID, int> foundAssetUuids = new Dictionary<UUID, int>();

View File

@ -49,7 +49,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
public UUID SaveBitmap(Bitmap data, bool lossless, bool temporary) public UUID SaveBitmap(Bitmap data, bool lossless, bool temporary)
{ {
AssetBase asset = new AssetBase(UUID.Random(), "MRMDynamicImage", (sbyte)AssetType.Texture); AssetBase asset = new AssetBase(UUID.Random(), "MRMDynamicImage", (sbyte)AssetType.Texture, m_scene.RegionInfo.RegionID);
asset.Data = OpenJPEG.EncodeFromImage(data, lossless); asset.Data = OpenJPEG.EncodeFromImage(data, lossless);
asset.Description = "MRM Image"; asset.Description = "MRM Image";
asset.Local = false; asset.Local = false;

View File

@ -1474,7 +1474,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
// Create new asset // Create new asset
AssetBase asset = new AssetBase(UUID.Random(), notecardName, (sbyte)AssetType.Notecard); AssetBase asset = new AssetBase(UUID.Random(), notecardName, (sbyte)AssetType.Notecard, m_host.OwnerID);
asset.Description = "Script Generated Notecard"; asset.Description = "Script Generated Notecard";
string notecardData = String.Empty; string notecardData = String.Empty;

View File

@ -243,7 +243,7 @@ namespace OpenSim.Services.Connectors
if (metadata == null) if (metadata == null)
return false; return false;
asset = new AssetBase(metadata.FullID, metadata.Name, metadata.Type); asset = new AssetBase(metadata.FullID, metadata.Name, metadata.Type, UUID.Zero);
asset.Metadata = metadata; asset.Metadata = metadata;
} }
asset.Data = data; asset.Data = data;

View File

@ -131,7 +131,7 @@ namespace OpenSim.Services.Connectors.Hypergrid
Bitmap m = new Bitmap(filename + ".jpg"); Bitmap m = new Bitmap(filename + ".jpg");
//m_log.Debug("Size: " + m.PhysicalDimension.Height + "-" + m.PhysicalDimension.Width); //m_log.Debug("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 " + filename, (sbyte)AssetType.Texture); AssetBase ass = new AssetBase(UUID.Random(), "region " + filename, (sbyte)AssetType.Texture, regionID);
// !!! for now // !!! for now
//info.RegionSettings.TerrainImageID = ass.FullID; //info.RegionSettings.TerrainImageID = ass.FullID;

View File

@ -38,12 +38,9 @@ namespace OpenSim.Tests.Common
/// <summary> /// <summary>
/// Create an asset from the given data /// Create an asset from the given data
/// </summary> /// </summary>
/// <param name="assetUuid"></param> public static AssetBase CreateAsset(UUID assetUuid, string data, UUID creatorID)
/// <param name="data"></param>
/// <returns></returns>
public static AssetBase CreateAsset(UUID assetUuid, string data)
{ {
AssetBase asset = new AssetBase(assetUuid, assetUuid.ToString(), (sbyte)AssetType.Object); AssetBase asset = new AssetBase(assetUuid, assetUuid.ToString(), (sbyte)AssetType.Object, creatorID);
asset.Data = Encoding.ASCII.GetBytes(data); asset.Data = Encoding.ASCII.GetBytes(data);
return asset; return asset;
} }
@ -56,7 +53,7 @@ namespace OpenSim.Tests.Common
/// <returns></returns> /// <returns></returns>
public static AssetBase CreateAsset(UUID assetUuid, SceneObjectGroup sog) public static AssetBase CreateAsset(UUID assetUuid, SceneObjectGroup sog)
{ {
AssetBase asset = new AssetBase(assetUuid, assetUuid.ToString(), (sbyte)AssetType.Object); AssetBase asset = new AssetBase(assetUuid, assetUuid.ToString(), (sbyte)AssetType.Object, sog.OwnerID);
asset.Data = Encoding.ASCII.GetBytes(SceneObjectSerializer.ToXml2Format(sog)); asset.Data = Encoding.ASCII.GetBytes(SceneObjectSerializer.ToXml2Format(sog));
return asset; return asset;
} }