From 76c0935ec744f2d230489398f879eb7f42b11d37 Mon Sep 17 00:00:00 2001 From: Mike Mazur Date: Tue, 17 Feb 2009 01:36:44 +0000 Subject: - remove the Metadata property from AssetBase and return all previous properties as before - prefix private variables with m_ in AssetBase.cs - related to Mantis #3122, as mentioned in https://lists.berlios.de/pipermail/opensim-dev/2009-February/005088.html - all services will likely need to be upgraded after this commit --- .../Framework/Communications/Cache/AssetCache.cs | 46 +++++++++++----------- .../Communications/Cache/CryptoGridAssetClient.cs | 18 ++++----- .../Communications/Cache/FileAssetClient.cs | 4 +- .../Communications/Cache/GridAssetClient.cs | 2 +- .../Framework/Communications/Capabilities/Caps.cs | 8 ++-- 5 files changed, 39 insertions(+), 39 deletions(-) (limited to 'OpenSim/Framework/Communications') diff --git a/OpenSim/Framework/Communications/Cache/AssetCache.cs b/OpenSim/Framework/Communications/Cache/AssetCache.cs index 76c6045..0e1f948 100644 --- a/OpenSim/Framework/Communications/Cache/AssetCache.cs +++ b/OpenSim/Framework/Communications/Cache/AssetCache.cs @@ -341,11 +341,11 @@ namespace OpenSim.Framework.Communications.Cache /// public void AddAsset(AssetBase asset) { - if (!m_memcache.Contains(asset.Metadata.FullID)) + if (!m_memcache.Contains(asset.FullID)) { - m_log.Info("[CACHE] Caching " + asset.Metadata.FullID + " for 24 hours from last access"); + m_log.Info("[CACHE] Caching " + asset.FullID + " for 24 hours from last access"); // Use 24 hour rolling asset cache. - m_memcache.AddOrUpdate(asset.Metadata.FullID, asset, TimeSpan.FromHours(24)); + m_memcache.AddOrUpdate(asset.FullID, asset, TimeSpan.FromHours(24)); // According to http://wiki.secondlife.com/wiki/AssetUploadRequest, Local signifies that the // information is stored locally. It could disappear, in which case we could send the @@ -365,7 +365,7 @@ namespace OpenSim.Framework.Communications.Cache // But for now, we're going to take the easy way out and store local assets globally. // // TODO: Also, Temporary is now deprecated. We should start ignoring it and not passing it out from LLClientView. - if (!asset.Metadata.Temporary || asset.Metadata.Local) + if (!asset.Temporary || asset.Local) { m_assetServer.StoreAsset(asset); } @@ -396,25 +396,25 @@ namespace OpenSim.Framework.Communications.Cache { AssetInfo assetInf = new AssetInfo(asset); - if (!m_memcache.Contains(assetInf.Metadata.FullID)) + if (!m_memcache.Contains(assetInf.FullID)) { - m_memcache.AddOrUpdate(assetInf.Metadata.FullID, assetInf, TimeSpan.FromHours(24)); + m_memcache.AddOrUpdate(assetInf.FullID, assetInf, TimeSpan.FromHours(24)); if (StatsManager.SimExtraStats != null) { StatsManager.SimExtraStats.AddAsset(assetInf); } - if (RequestedAssets.ContainsKey(assetInf.Metadata.FullID)) + if (RequestedAssets.ContainsKey(assetInf.FullID)) { - AssetRequest req = RequestedAssets[assetInf.Metadata.FullID]; + AssetRequest req = RequestedAssets[assetInf.FullID]; req.AssetInf = assetInf; req.NumPackets = CalculateNumPackets(assetInf.Data); - RequestedAssets.Remove(assetInf.Metadata.FullID); + RequestedAssets.Remove(assetInf.FullID); // If it's a direct request for a script, drop it // because it's a hacked client - if (req.AssetRequestSource != 2 || assetInf.Metadata.Type != 10) + if (req.AssetRequestSource != 2 || assetInf.Type != 10) AssetRequests.Add(req); } } @@ -424,8 +424,8 @@ namespace OpenSim.Framework.Communications.Cache lock (RequestLists) { - if (RequestLists.TryGetValue(asset.Metadata.FullID, out reqList)) - RequestLists.Remove(asset.Metadata.FullID); + if (RequestLists.TryGetValue(asset.FullID, out reqList)) + RequestLists.Remove(asset.FullID); } if (reqList != null) @@ -436,8 +436,8 @@ namespace OpenSim.Framework.Communications.Cache foreach (NewAssetRequest req in reqList.Requests) { // Xantor 20080526 are we really calling all the callbacks if multiple queued for 1 request? -- Yes, checked - // m_log.DebugFormat("[ASSET CACHE]: Callback for asset {0}", asset.Metadata.FullID); - req.Callback(asset.Metadata.FullID, asset); + // m_log.DebugFormat("[ASSET CACHE]: Callback for asset {0}", asset.FullID); + req.Callback(asset.FullID, asset); } } } @@ -545,7 +545,7 @@ namespace OpenSim.Framework.Communications.Cache } // Scripts cannot be retrieved by direct request - if (transferRequest.TransferInfo.SourceType == 2 && asset.Metadata.Type == 10) + if (transferRequest.TransferInfo.SourceType == 2 && asset.Type == 10) return; // The asset is knosn to exist and is in our cache, so add it to the AssetRequests list @@ -631,10 +631,10 @@ namespace OpenSim.Framework.Communications.Cache public AssetInfo(AssetBase aBase) { Data = aBase.Data; - Metadata.FullID = aBase.Metadata.FullID; - Metadata.Type = aBase.Metadata.Type; - Metadata.Name = aBase.Metadata.Name; - Metadata.Description = aBase.Metadata.Description; + FullID = aBase.FullID; + Type = aBase.Type; + Name = aBase.Name; + Description = aBase.Description; } } @@ -643,10 +643,10 @@ namespace OpenSim.Framework.Communications.Cache public TextureImage(AssetBase aBase) { Data = aBase.Data; - Metadata.FullID = aBase.Metadata.FullID; - Metadata.Type = aBase.Metadata.Type; - Metadata.Name = aBase.Metadata.Name; - Metadata.Description = aBase.Metadata.Description; + FullID = aBase.FullID; + Type = aBase.Type; + Name = aBase.Name; + Description = aBase.Description; } } diff --git a/OpenSim/Framework/Communications/Cache/CryptoGridAssetClient.cs b/OpenSim/Framework/Communications/Cache/CryptoGridAssetClient.cs index 0f4e8ac..f1c19fa 100644 --- a/OpenSim/Framework/Communications/Cache/CryptoGridAssetClient.cs +++ b/OpenSim/Framework/Communications/Cache/CryptoGridAssetClient.cs @@ -441,17 +441,17 @@ namespace OpenSim.Framework.Communications.Cache string salt = Convert.ToBase64String(rand); x.Data = UtilRijndael.Encrypt(x.Data, file.Secret, salt, "SHA1", 2, file.IVBytes, file.Keysize); - x.Metadata.Description = String.Format("ENCASS#:~:#{0}#:~:#{1}#:~:#{2}#:~:#{3}", - "OPENSIM_AES_AF1", - file.AlsoKnownAs, - salt, - x.Metadata.Description); + x.Description = String.Format("ENCASS#:~:#{0}#:~:#{1}#:~:#{2}#:~:#{3}", + "OPENSIM_AES_AF1", + file.AlsoKnownAs, + salt, + x.Description); } private bool DecryptAssetBase(AssetBase x) { // Check it's encrypted first. - if (!x.Metadata.Description.Contains("ENCASS")) + if (!x.Description.Contains("ENCASS")) return true; // ENCASS:ALG:AKA:SALT:Description @@ -459,7 +459,7 @@ namespace OpenSim.Framework.Communications.Cache string[] splitchars = new string[1]; splitchars[0] = "#:~:#"; - string[] meta = x.Metadata.Description.Split(splitchars, StringSplitOptions.None); + string[] meta = x.Description.Split(splitchars, StringSplitOptions.None); if (meta.Length < 5) { m_log.Warn("[ENCASSETS] Recieved Encrypted Asset, but header is corrupt"); @@ -470,7 +470,7 @@ namespace OpenSim.Framework.Communications.Cache if (m_keyfiles.ContainsKey(meta[2])) { RjinKeyfile deckey = m_keyfiles[meta[2]]; - x.Metadata.Description = meta[4]; + x.Description = meta[4]; switch (meta[1]) { case "OPENSIM_AES_AF1": @@ -544,7 +544,7 @@ namespace OpenSim.Framework.Communications.Cache { string assetUrl = _assetServerUrl + "/assets/"; - m_log.InfoFormat("[CRYPTO GRID ASSET CLIENT]: Sending store request for asset {0}", asset.Metadata.FullID); + m_log.InfoFormat("[CRYPTO GRID ASSET CLIENT]: Sending store request for asset {0}", asset.FullID); RestObjectPoster.BeginPostObject(assetUrl, asset); } diff --git a/OpenSim/Framework/Communications/Cache/FileAssetClient.cs b/OpenSim/Framework/Communications/Cache/FileAssetClient.cs index e6574a1..8d03f56 100644 --- a/OpenSim/Framework/Communications/Cache/FileAssetClient.cs +++ b/OpenSim/Framework/Communications/Cache/FileAssetClient.cs @@ -79,7 +79,7 @@ namespace OpenSim.Framework.Communications.Cache public override void StoreAsset(AssetBase asset) { - byte[] idBytes = asset.Metadata.FullID.Guid.ToByteArray(); + byte[] idBytes = asset.FullID.Guid.ToByteArray(); string cdir = m_dir + Path.DirectorySeparatorChar + idBytes[0] + Path.DirectorySeparatorChar + idBytes[1]; @@ -90,7 +90,7 @@ namespace OpenSim.Framework.Communications.Cache if (!Directory.Exists(cdir)) Directory.CreateDirectory(cdir); - FileStream x = new FileStream(cdir + Path.DirectorySeparatorChar + asset.Metadata.FullID + ".xml", FileMode.Create); + FileStream x = new FileStream(cdir + Path.DirectorySeparatorChar + asset.FullID + ".xml", FileMode.Create); m_xs.Serialize(x, asset); x.Flush(); diff --git a/OpenSim/Framework/Communications/Cache/GridAssetClient.cs b/OpenSim/Framework/Communications/Cache/GridAssetClient.cs index 6522ad0..3b6dc52 100644 --- a/OpenSim/Framework/Communications/Cache/GridAssetClient.cs +++ b/OpenSim/Framework/Communications/Cache/GridAssetClient.cs @@ -126,7 +126,7 @@ namespace OpenSim.Framework.Communications.Cache // rc.Request(s); //m_log.InfoFormat("[ASSET]: Stored {0}", rc); - m_log.InfoFormat("[GRID ASSET CLIENT]: Sending store request for asset {0}", asset.Metadata.FullID); + m_log.InfoFormat("[GRID ASSET CLIENT]: Sending store request for asset {0}", asset.FullID); RestObjectPoster.BeginPostObject(assetUrl, asset); } diff --git a/OpenSim/Framework/Communications/Capabilities/Caps.cs b/OpenSim/Framework/Communications/Capabilities/Caps.cs index b68083e..a4c847d 100644 --- a/OpenSim/Framework/Communications/Capabilities/Caps.cs +++ b/OpenSim/Framework/Communications/Capabilities/Caps.cs @@ -740,9 +740,9 @@ namespace OpenSim.Framework.Communications.Capabilities AssetBase asset; asset = new AssetBase(); - asset.Metadata.FullID = assetID; - asset.Metadata.Type = assType; - asset.Metadata.Name = assetName; + asset.FullID = assetID; + asset.Type = assType; + asset.Name = assetName; asset.Data = data; m_assetCache.AddAsset(asset); @@ -750,7 +750,7 @@ namespace OpenSim.Framework.Communications.Capabilities item.Owner = m_agentID; item.Creator = m_agentID; item.ID = inventoryItem; - item.AssetID = asset.Metadata.FullID; + item.AssetID = asset.FullID; item.Description = assetDescription; item.Name = assetName; item.AssetType = assType; -- cgit v1.1