diff options
author | Mike Mazur | 2009-02-04 00:01:36 +0000 |
---|---|---|
committer | Mike Mazur | 2009-02-04 00:01:36 +0000 |
commit | 0c03a48fb2060eda4d288e2d2ca4e650ce000b4b (patch) | |
tree | a90465075960c92367b0a5e62db3121e4e3a139d /OpenSim/Framework | |
parent | * Add another object to the existing save oar test (diff) | |
download | opensim-SC-0c03a48fb2060eda4d288e2d2ca4e650ce000b4b.zip opensim-SC-0c03a48fb2060eda4d288e2d2ca4e650ce000b4b.tar.gz opensim-SC-0c03a48fb2060eda4d288e2d2ca4e650ce000b4b.tar.bz2 opensim-SC-0c03a48fb2060eda4d288e2d2ca4e650ce000b4b.tar.xz |
- add OpenSim.Framework.AssetMetadata class. AssetBase is now composed of it
- trim trailing whitespace
Diffstat (limited to '')
8 files changed, 155 insertions, 104 deletions
diff --git a/OpenSim/Framework/AssetBase.cs b/OpenSim/Framework/AssetBase.cs index 48ef2ff..f9c9457 100644 --- a/OpenSim/Framework/AssetBase.cs +++ b/OpenSim/Framework/AssetBase.cs | |||
@@ -26,7 +26,9 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | ||
29 | using OpenMetaverse; | 30 | using OpenMetaverse; |
31 | using OpenMetaverse.StructuredData; | ||
30 | 32 | ||
31 | namespace OpenSim.Framework | 33 | namespace OpenSim.Framework |
32 | { | 34 | { |
@@ -34,69 +36,118 @@ namespace OpenSim.Framework | |||
34 | public class AssetBase | 36 | public class AssetBase |
35 | { | 37 | { |
36 | private byte[] _data; | 38 | private byte[] _data; |
37 | private string _description = String.Empty; | 39 | private AssetMetadata _metadata; |
38 | private UUID _fullid; | ||
39 | private bool _local = false; | ||
40 | private string _name = String.Empty; | ||
41 | private bool _temporary = false; | ||
42 | private sbyte _type; | ||
43 | 40 | ||
44 | public AssetBase() | 41 | public AssetBase() |
45 | { | 42 | { |
43 | Metadata = new AssetMetadata(); | ||
46 | } | 44 | } |
47 | 45 | ||
48 | public AssetBase(UUID assetId, string name) | 46 | public AssetBase(UUID assetId, string name) |
49 | { | 47 | { |
50 | FullID = assetId; | 48 | Metadata = new AssetMetadata(); |
51 | Name = name; | 49 | Metadata.FullID = assetId; |
50 | Metadata.Name = name; | ||
51 | } | ||
52 | |||
53 | public virtual byte[] Data | ||
54 | { | ||
55 | get { return _data; } | ||
56 | set { _data = value; } | ||
57 | } | ||
58 | |||
59 | public virtual AssetMetadata Metadata | ||
60 | { | ||
61 | get { return _metadata; } | ||
62 | set { _metadata = value; } | ||
52 | } | 63 | } |
64 | } | ||
65 | |||
66 | [Serializable] | ||
67 | public class AssetMetadata | ||
68 | { | ||
69 | private UUID _fullid; | ||
70 | private string _name = String.Empty; | ||
71 | private string _description = String.Empty; | ||
72 | private DateTime _creation_date; | ||
73 | private sbyte _type; | ||
74 | private string _content_type; | ||
75 | private byte[] _sha1; | ||
76 | private bool _local = false; | ||
77 | private bool _temporary = false; | ||
78 | //private Dictionary<string, Uri> _methods = new Dictionary<string, Uri>(); | ||
79 | //private OSDMap _extra_data; | ||
53 | 80 | ||
54 | public virtual UUID FullID | 81 | public UUID FullID |
55 | { | 82 | { |
56 | get { return _fullid; } | 83 | get { return _fullid; } |
57 | set { _fullid = value; } | 84 | set { _fullid = value; } |
58 | } | 85 | } |
59 | 86 | ||
60 | public virtual string ID | 87 | public string ID |
61 | { | 88 | { |
62 | get { return _fullid.ToString(); } | 89 | get { return _fullid.ToString(); } |
63 | set { _fullid = new UUID(value); } | 90 | set { _fullid = new UUID(value); } |
64 | } | 91 | } |
65 | 92 | ||
66 | public virtual byte[] Data | 93 | public string Name |
67 | { | 94 | { |
68 | get { return _data; } | 95 | get { return _name; } |
69 | set { _data = value; } | 96 | set { _name = value; } |
97 | } | ||
98 | |||
99 | public string Description | ||
100 | { | ||
101 | get { return _description; } | ||
102 | set { _description = value; } | ||
103 | } | ||
104 | |||
105 | public DateTime CreationDate | ||
106 | { | ||
107 | get { return _creation_date; } | ||
108 | set { _creation_date = value; } | ||
70 | } | 109 | } |
71 | 110 | ||
72 | public virtual sbyte Type | 111 | public sbyte Type |
73 | { | 112 | { |
74 | get { return _type; } | 113 | get { return _type; } |
75 | set { _type = value; } | 114 | set { _type = value; } |
76 | } | 115 | } |
77 | 116 | ||
78 | public virtual string Name | 117 | public string ContentType |
79 | { | 118 | { |
80 | get { return _name; } | 119 | get { return _content_type; } |
81 | set { _name = value; } | 120 | set { _content_type = value; } |
82 | } | 121 | } |
83 | 122 | ||
84 | public virtual string Description | 123 | public byte[] SHA1 |
85 | { | 124 | { |
86 | get { return _description; } | 125 | get { return _sha1; } |
87 | set { _description = value; } | 126 | set { _sha1 = value; } |
88 | } | 127 | } |
89 | 128 | ||
90 | public virtual bool Local | 129 | public bool Local |
91 | { | 130 | { |
92 | get { return _local; } | 131 | get { return _local; } |
93 | set { _local = value; } | 132 | set { _local = value; } |
94 | } | 133 | } |
95 | 134 | ||
96 | public virtual bool Temporary | 135 | public bool Temporary |
97 | { | 136 | { |
98 | get { return _temporary; } | 137 | get { return _temporary; } |
99 | set { _temporary = value; } | 138 | set { _temporary = value; } |
100 | } | 139 | } |
140 | |||
141 | //public Dictionary<string, Uri> Methods | ||
142 | //{ | ||
143 | // get { return _methods; } | ||
144 | // set { _methods = value; } | ||
145 | //} | ||
146 | |||
147 | //public OSDMap ExtraData | ||
148 | //{ | ||
149 | // get { return _extra_data; } | ||
150 | // set { _extra_data = value; } | ||
151 | //} | ||
101 | } | 152 | } |
102 | } | 153 | } |
diff --git a/OpenSim/Framework/AssetLandmark.cs b/OpenSim/Framework/AssetLandmark.cs index d636d34..bbf25d8 100644 --- a/OpenSim/Framework/AssetLandmark.cs +++ b/OpenSim/Framework/AssetLandmark.cs | |||
@@ -40,10 +40,10 @@ namespace OpenSim.Framework | |||
40 | public AssetLandmark(AssetBase a) | 40 | public AssetLandmark(AssetBase a) |
41 | { | 41 | { |
42 | Data = a.Data; | 42 | Data = a.Data; |
43 | FullID = a.FullID; | 43 | Metadata.FullID = a.Metadata.FullID; |
44 | Type = a.Type; | 44 | Metadata.Type = a.Metadata.Type; |
45 | Name = a.Name; | 45 | Metadata.Name = a.Metadata.Name; |
46 | Description = a.Description; | 46 | Metadata.Description = a.Metadata.Description; |
47 | InternData(); | 47 | InternData(); |
48 | } | 48 | } |
49 | 49 | ||
diff --git a/OpenSim/Framework/AssetLoader/Filesystem/AssetLoaderFileSystem.cs b/OpenSim/Framework/AssetLoader/Filesystem/AssetLoaderFileSystem.cs index 9d0f697..55b4ebd 100644 --- a/OpenSim/Framework/AssetLoader/Filesystem/AssetLoaderFileSystem.cs +++ b/OpenSim/Framework/AssetLoader/Filesystem/AssetLoaderFileSystem.cs | |||
@@ -145,7 +145,7 @@ namespace OpenSim.Framework.AssetLoader.Filesystem | |||
145 | 145 | ||
146 | AssetBase newAsset = CreateAsset(assetIdStr, name, assetPath, false); | 146 | AssetBase newAsset = CreateAsset(assetIdStr, name, assetPath, false); |
147 | 147 | ||
148 | newAsset.Type = type; | 148 | newAsset.Metadata.Type = type; |
149 | assets.Add(newAsset); | 149 | assets.Add(newAsset); |
150 | } | 150 | } |
151 | } | 151 | } |
diff --git a/OpenSim/Framework/Communications/Cache/AssetCache.cs b/OpenSim/Framework/Communications/Cache/AssetCache.cs index 653597b..2b2467c 100644 --- a/OpenSim/Framework/Communications/Cache/AssetCache.cs +++ b/OpenSim/Framework/Communications/Cache/AssetCache.cs | |||
@@ -42,7 +42,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
42 | /// <summary> | 42 | /// <summary> |
43 | /// Manages local cache of assets and their sending to viewers. | 43 | /// Manages local cache of assets and their sending to viewers. |
44 | /// </summary> | 44 | /// </summary> |
45 | /// | 45 | /// |
46 | /// This class actually encapsulates two largely separate mechanisms. One mechanism fetches assets either | 46 | /// This class actually encapsulates two largely separate mechanisms. One mechanism fetches assets either |
47 | /// synchronously or async and passes the data back to the requester. The second mechanism fetches assets and | 47 | /// synchronously or async and passes the data back to the requester. The second mechanism fetches assets and |
48 | /// sends packetised data directly back to the client. The only point where they meet is AssetReceived() and | 48 | /// sends packetised data directly back to the client. The only point where they meet is AssetReceived() and |
@@ -80,7 +80,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
80 | private Dictionary<UUID, AssetRequestsList> RequestLists; | 80 | private Dictionary<UUID, AssetRequestsList> RequestLists; |
81 | 81 | ||
82 | /// <summary> | 82 | /// <summary> |
83 | /// The 'server' from which assets can be requested and to which assets are persisted. | 83 | /// The 'server' from which assets can be requested and to which assets are persisted. |
84 | /// </summary> | 84 | /// </summary> |
85 | private readonly IAssetServer m_assetServer; | 85 | private readonly IAssetServer m_assetServer; |
86 | 86 | ||
@@ -211,7 +211,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
211 | else | 211 | else |
212 | { | 212 | { |
213 | // m_log.DebugFormat("[ASSET CACHE]: Adding request for {0} {1}", isTexture ? "texture" : "asset", assetId); | 213 | // m_log.DebugFormat("[ASSET CACHE]: Adding request for {0} {1}", isTexture ? "texture" : "asset", assetId); |
214 | 214 | ||
215 | NewAssetRequest req = new NewAssetRequest(callback); | 215 | NewAssetRequest req = new NewAssetRequest(callback); |
216 | AssetRequestsList requestList; | 216 | AssetRequestsList requestList; |
217 | 217 | ||
@@ -228,10 +228,10 @@ namespace OpenSim.Framework.Communications.Cache | |||
228 | // m_log.DebugFormat("[ASSET CACHE]: Adding request for {0} {1}", isTexture ? "texture" : "asset", assetId); | 228 | // m_log.DebugFormat("[ASSET CACHE]: Adding request for {0} {1}", isTexture ? "texture" : "asset", assetId); |
229 | requestList = new AssetRequestsList(); | 229 | requestList = new AssetRequestsList(); |
230 | requestList.TimeRequested = DateTime.Now; | 230 | requestList.TimeRequested = DateTime.Now; |
231 | requestList.Requests.Add(req); | 231 | requestList.Requests.Add(req); |
232 | 232 | ||
233 | RequestLists.Add(assetId, requestList); | 233 | RequestLists.Add(assetId, requestList); |
234 | 234 | ||
235 | m_assetServer.RequestAsset(assetId, isTexture); | 235 | m_assetServer.RequestAsset(assetId, isTexture); |
236 | } | 236 | } |
237 | } | 237 | } |
@@ -247,7 +247,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
247 | /// the allowed number of polls. This isn't a very good way of doing things since a single thread | 247 | /// the allowed number of polls. This isn't a very good way of doing things since a single thread |
248 | /// is processing inbound packets, so if the asset server is slow, we could block this for up to | 248 | /// is processing inbound packets, so if the asset server is slow, we could block this for up to |
249 | /// the timeout period. Whereever possible we want to use the asynchronous callback GetAsset() | 249 | /// the timeout period. Whereever possible we want to use the asynchronous callback GetAsset() |
250 | /// | 250 | /// |
251 | /// <param name="assetID"></param> | 251 | /// <param name="assetID"></param> |
252 | /// <param name="isTexture"></param> | 252 | /// <param name="isTexture"></param> |
253 | /// <returns>null if the asset could not be retrieved</returns> | 253 | /// <returns>null if the asset could not be retrieved</returns> |
@@ -264,7 +264,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
264 | { | 264 | { |
265 | return asset; | 265 | return asset; |
266 | } | 266 | } |
267 | 267 | ||
268 | m_assetServer.RequestAsset(assetID, isTexture); | 268 | m_assetServer.RequestAsset(assetID, isTexture); |
269 | 269 | ||
270 | do | 270 | do |
@@ -275,7 +275,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
275 | { | 275 | { |
276 | return asset; | 276 | return asset; |
277 | } | 277 | } |
278 | } | 278 | } |
279 | while (--maxPolls > 0); | 279 | while (--maxPolls > 0); |
280 | 280 | ||
281 | m_log.WarnFormat("[ASSET CACHE]: {0} {1} was not received before the retrieval timeout was reached", | 281 | m_log.WarnFormat("[ASSET CACHE]: {0} {1} was not received before the retrieval timeout was reached", |
@@ -290,17 +290,17 @@ namespace OpenSim.Framework.Communications.Cache | |||
290 | /// <param name="asset"></param> | 290 | /// <param name="asset"></param> |
291 | public void AddAsset(AssetBase asset) | 291 | public void AddAsset(AssetBase asset) |
292 | { | 292 | { |
293 | if (!m_memcache.Contains(asset.FullID)) | 293 | if (!m_memcache.Contains(asset.Metadata.FullID)) |
294 | { | 294 | { |
295 | m_log.Info("[CACHE] Caching " + asset.FullID + " for 24 hours from last access"); | 295 | m_log.Info("[CACHE] Caching " + asset.Metadata.FullID + " for 24 hours from last access"); |
296 | // Use 24 hour rolling asset cache. | 296 | // Use 24 hour rolling asset cache. |
297 | m_memcache.AddOrUpdate(asset.FullID, asset, TimeSpan.FromHours(24)); | 297 | m_memcache.AddOrUpdate(asset.Metadata.FullID, asset, TimeSpan.FromHours(24)); |
298 | 298 | ||
299 | // According to http://wiki.secondlife.com/wiki/AssetUploadRequest, Local signifies that the | 299 | // According to http://wiki.secondlife.com/wiki/AssetUploadRequest, Local signifies that the |
300 | // information is stored locally. It could disappear, in which case we could send the | 300 | // information is stored locally. It could disappear, in which case we could send the |
301 | // ImageNotInDatabase packet to tell the client this. | 301 | // ImageNotInDatabase packet to tell the client this. |
302 | // | 302 | // |
303 | // However, this doesn't quite appear to work with local textures that are part of an avatar's | 303 | // However, this doesn't quite appear to work with local textures that are part of an avatar's |
304 | // appearance texture set. Whilst sending an ImageNotInDatabase does trigger an automatic rebake | 304 | // appearance texture set. Whilst sending an ImageNotInDatabase does trigger an automatic rebake |
305 | // and reupload by the client, if those assets aren't pushed to the asset server anyway, then | 305 | // and reupload by the client, if those assets aren't pushed to the asset server anyway, then |
306 | // on crossing onto another region server, other avatars can no longer get the required textures. | 306 | // on crossing onto another region server, other avatars can no longer get the required textures. |
@@ -314,7 +314,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
314 | // But for now, we're going to take the easy way out and store local assets globally. | 314 | // But for now, we're going to take the easy way out and store local assets globally. |
315 | // | 315 | // |
316 | // TODO: Also, Temporary is now deprecated. We should start ignoring it and not passing it out from LLClientView. | 316 | // TODO: Also, Temporary is now deprecated. We should start ignoring it and not passing it out from LLClientView. |
317 | if (!asset.Temporary || asset.Local) | 317 | if (!asset.Metadata.Temporary || asset.Metadata.Local) |
318 | { | 318 | { |
319 | m_assetServer.StoreAsset(asset); | 319 | m_assetServer.StoreAsset(asset); |
320 | } | 320 | } |
@@ -345,25 +345,25 @@ namespace OpenSim.Framework.Communications.Cache | |||
345 | { | 345 | { |
346 | 346 | ||
347 | AssetInfo assetInf = new AssetInfo(asset); | 347 | AssetInfo assetInf = new AssetInfo(asset); |
348 | if (!m_memcache.Contains(assetInf.FullID)) | 348 | if (!m_memcache.Contains(assetInf.Metadata.FullID)) |
349 | { | 349 | { |
350 | m_memcache.AddOrUpdate(assetInf.FullID, assetInf, TimeSpan.FromHours(24)); | 350 | m_memcache.AddOrUpdate(assetInf.Metadata.FullID, assetInf, TimeSpan.FromHours(24)); |
351 | 351 | ||
352 | if (StatsManager.SimExtraStats != null) | 352 | if (StatsManager.SimExtraStats != null) |
353 | { | 353 | { |
354 | StatsManager.SimExtraStats.AddAsset(assetInf); | 354 | StatsManager.SimExtraStats.AddAsset(assetInf); |
355 | } | 355 | } |
356 | 356 | ||
357 | if (RequestedAssets.ContainsKey(assetInf.FullID)) | 357 | if (RequestedAssets.ContainsKey(assetInf.Metadata.FullID)) |
358 | { | 358 | { |
359 | AssetRequest req = RequestedAssets[assetInf.FullID]; | 359 | AssetRequest req = RequestedAssets[assetInf.Metadata.FullID]; |
360 | req.AssetInf = assetInf; | 360 | req.AssetInf = assetInf; |
361 | req.NumPackets = CalculateNumPackets(assetInf.Data); | 361 | req.NumPackets = CalculateNumPackets(assetInf.Data); |
362 | 362 | ||
363 | RequestedAssets.Remove(assetInf.FullID); | 363 | RequestedAssets.Remove(assetInf.Metadata.FullID); |
364 | // If it's a direct request for a script, drop it | 364 | // If it's a direct request for a script, drop it |
365 | // because it's a hacked client | 365 | // because it's a hacked client |
366 | if (req.AssetRequestSource != 2 || assetInf.Type != 10) | 366 | if (req.AssetRequestSource != 2 || assetInf.Metadata.Type != 10) |
367 | AssetRequests.Add(req); | 367 | AssetRequests.Add(req); |
368 | } | 368 | } |
369 | } | 369 | } |
@@ -373,8 +373,8 @@ namespace OpenSim.Framework.Communications.Cache | |||
373 | 373 | ||
374 | lock (RequestLists) | 374 | lock (RequestLists) |
375 | { | 375 | { |
376 | if (RequestLists.TryGetValue(asset.FullID, out reqList)) | 376 | if (RequestLists.TryGetValue(asset.Metadata.FullID, out reqList)) |
377 | RequestLists.Remove(asset.FullID); | 377 | RequestLists.Remove(asset.Metadata.FullID); |
378 | } | 378 | } |
379 | 379 | ||
380 | if (reqList != null) | 380 | if (reqList != null) |
@@ -385,8 +385,8 @@ namespace OpenSim.Framework.Communications.Cache | |||
385 | foreach (NewAssetRequest req in reqList.Requests) | 385 | foreach (NewAssetRequest req in reqList.Requests) |
386 | { | 386 | { |
387 | // Xantor 20080526 are we really calling all the callbacks if multiple queued for 1 request? -- Yes, checked | 387 | // Xantor 20080526 are we really calling all the callbacks if multiple queued for 1 request? -- Yes, checked |
388 | // m_log.DebugFormat("[ASSET CACHE]: Callback for asset {0}", asset.FullID); | 388 | // m_log.DebugFormat("[ASSET CACHE]: Callback for asset {0}", asset.Metadata.FullID); |
389 | req.Callback(asset.FullID, asset); | 389 | req.Callback(asset.Metadata.FullID, asset); |
390 | } | 390 | } |
391 | } | 391 | } |
392 | } | 392 | } |
@@ -398,12 +398,12 @@ namespace OpenSim.Framework.Communications.Cache | |||
398 | 398 | ||
399 | // Remember the fact that this asset could not be found to prevent delays from repeated requests | 399 | // Remember the fact that this asset could not be found to prevent delays from repeated requests |
400 | m_memcache.Add(assetID, null, TimeSpan.FromHours(24)); | 400 | m_memcache.Add(assetID, null, TimeSpan.FromHours(24)); |
401 | 401 | ||
402 | // Notify requesters for this asset | 402 | // Notify requesters for this asset |
403 | AssetRequestsList reqList; | 403 | AssetRequestsList reqList; |
404 | lock (RequestLists) | 404 | lock (RequestLists) |
405 | { | 405 | { |
406 | if (RequestLists.TryGetValue(assetID, out reqList)) | 406 | if (RequestLists.TryGetValue(assetID, out reqList)) |
407 | RequestLists.Remove(assetID); | 407 | RequestLists.Remove(assetID); |
408 | } | 408 | } |
409 | 409 | ||
@@ -411,7 +411,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
411 | { | 411 | { |
412 | if (StatsManager.SimExtraStats != null) | 412 | if (StatsManager.SimExtraStats != null) |
413 | StatsManager.SimExtraStats.AddAssetRequestTimeAfterCacheMiss(DateTime.Now - reqList.TimeRequested); | 413 | StatsManager.SimExtraStats.AddAssetRequestTimeAfterCacheMiss(DateTime.Now - reqList.TimeRequested); |
414 | 414 | ||
415 | foreach (NewAssetRequest req in reqList.Requests) | 415 | foreach (NewAssetRequest req in reqList.Requests) |
416 | { | 416 | { |
417 | req.Callback(assetID, null); | 417 | req.Callback(assetID, null); |
@@ -461,7 +461,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
461 | source = 3; | 461 | source = 3; |
462 | //Console.WriteLine("asset request " + requestID); | 462 | //Console.WriteLine("asset request " + requestID); |
463 | } | 463 | } |
464 | 464 | ||
465 | //check to see if asset is in local cache, if not we need to request it from asset server. | 465 | //check to see if asset is in local cache, if not we need to request it from asset server. |
466 | //Console.WriteLine("asset request " + requestID); | 466 | //Console.WriteLine("asset request " + requestID); |
467 | if (!m_memcache.Contains(requestID)) | 467 | if (!m_memcache.Contains(requestID)) |
@@ -494,7 +494,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
494 | } | 494 | } |
495 | 495 | ||
496 | // Scripts cannot be retrieved by direct request | 496 | // Scripts cannot be retrieved by direct request |
497 | if (transferRequest.TransferInfo.SourceType == 2 && asset.Type == 10) | 497 | if (transferRequest.TransferInfo.SourceType == 2 && asset.Metadata.Type == 10) |
498 | return; | 498 | return; |
499 | 499 | ||
500 | // The asset is knosn to exist and is in our cache, so add it to the AssetRequests list | 500 | // The asset is knosn to exist and is in our cache, so add it to the AssetRequests list |
@@ -520,7 +520,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
520 | //no requests waiting | 520 | //no requests waiting |
521 | return; | 521 | return; |
522 | } | 522 | } |
523 | 523 | ||
524 | // if less than 5, do all of them | 524 | // if less than 5, do all of them |
525 | int num = Math.Min(5, AssetRequests.Count); | 525 | int num = Math.Min(5, AssetRequests.Count); |
526 | 526 | ||
@@ -580,10 +580,10 @@ namespace OpenSim.Framework.Communications.Cache | |||
580 | public AssetInfo(AssetBase aBase) | 580 | public AssetInfo(AssetBase aBase) |
581 | { | 581 | { |
582 | Data = aBase.Data; | 582 | Data = aBase.Data; |
583 | FullID = aBase.FullID; | 583 | Metadata.FullID = aBase.Metadata.FullID; |
584 | Type = aBase.Type; | 584 | Metadata.Type = aBase.Metadata.Type; |
585 | Name = aBase.Name; | 585 | Metadata.Name = aBase.Metadata.Name; |
586 | Description = aBase.Description; | 586 | Metadata.Description = aBase.Metadata.Description; |
587 | } | 587 | } |
588 | } | 588 | } |
589 | 589 | ||
@@ -592,10 +592,10 @@ namespace OpenSim.Framework.Communications.Cache | |||
592 | public TextureImage(AssetBase aBase) | 592 | public TextureImage(AssetBase aBase) |
593 | { | 593 | { |
594 | Data = aBase.Data; | 594 | Data = aBase.Data; |
595 | FullID = aBase.FullID; | 595 | Metadata.FullID = aBase.Metadata.FullID; |
596 | Type = aBase.Type; | 596 | Metadata.Type = aBase.Metadata.Type; |
597 | Name = aBase.Name; | 597 | Metadata.Name = aBase.Metadata.Name; |
598 | Description = aBase.Description; | 598 | Metadata.Description = aBase.Metadata.Description; |
599 | } | 599 | } |
600 | } | 600 | } |
601 | 601 | ||
@@ -608,7 +608,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
608 | /// A list of requests for assets | 608 | /// A list of requests for assets |
609 | /// </summary> | 609 | /// </summary> |
610 | public List<NewAssetRequest> Requests = new List<NewAssetRequest>(); | 610 | public List<NewAssetRequest> Requests = new List<NewAssetRequest>(); |
611 | 611 | ||
612 | /// <summary> | 612 | /// <summary> |
613 | /// Record the time that this request was first made. | 613 | /// Record the time that this request was first made. |
614 | /// </summary> | 614 | /// </summary> |
diff --git a/OpenSim/Framework/Communications/Cache/CryptoGridAssetClient.cs b/OpenSim/Framework/Communications/Cache/CryptoGridAssetClient.cs index 3ed9172..1b3e70d 100644 --- a/OpenSim/Framework/Communications/Cache/CryptoGridAssetClient.cs +++ b/OpenSim/Framework/Communications/Cache/CryptoGridAssetClient.cs | |||
@@ -86,11 +86,11 @@ namespace OpenSim.Framework.Communications.Cache | |||
86 | 86 | ||
87 | #region Rjindael | 87 | #region Rjindael |
88 | /// <summary> | 88 | /// <summary> |
89 | /// This class uses a symmetric key algorithm (Rijndael/AES) to encrypt and | 89 | /// This class uses a symmetric key algorithm (Rijndael/AES) to encrypt and |
90 | /// decrypt data. As long as encryption and decryption routines use the same | 90 | /// decrypt data. As long as encryption and decryption routines use the same |
91 | /// parameters to generate the keys, the keys are guaranteed to be the same. | 91 | /// parameters to generate the keys, the keys are guaranteed to be the same. |
92 | /// The class uses static functions with duplicate code to make it easier to | 92 | /// The class uses static functions with duplicate code to make it easier to |
93 | /// demonstrate encryption and decryption logic. In a real-life application, | 93 | /// demonstrate encryption and decryption logic. In a real-life application, |
94 | /// this may not be the most efficient way of handling encryption, so - as | 94 | /// this may not be the most efficient way of handling encryption, so - as |
95 | /// soon as you feel comfortable with it - you may want to redesign this class. | 95 | /// soon as you feel comfortable with it - you may want to redesign this class. |
96 | /// </summary> | 96 | /// </summary> |
@@ -123,11 +123,11 @@ namespace OpenSim.Framework.Communications.Cache | |||
123 | /// </param> | 123 | /// </param> |
124 | /// <param name="initVector"> | 124 | /// <param name="initVector"> |
125 | /// Initialization vector (or IV). This value is required to encrypt the | 125 | /// Initialization vector (or IV). This value is required to encrypt the |
126 | /// first block of plaintext data. For RijndaelManaged class IV must be | 126 | /// first block of plaintext data. For RijndaelManaged class IV must be |
127 | /// exactly 16 ASCII characters long. | 127 | /// exactly 16 ASCII characters long. |
128 | /// </param> | 128 | /// </param> |
129 | /// <param name="keySize"> | 129 | /// <param name="keySize"> |
130 | /// Size of encryption key in bits. Allowed values are: 128, 192, and 256. | 130 | /// Size of encryption key in bits. Allowed values are: 128, 192, and 256. |
131 | /// Longer keys are more secure than shorter keys. | 131 | /// Longer keys are more secure than shorter keys. |
132 | /// </param> | 132 | /// </param> |
133 | /// <returns> | 133 | /// <returns> |
@@ -143,7 +143,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
143 | { | 143 | { |
144 | // Convert strings into byte arrays. | 144 | // Convert strings into byte arrays. |
145 | // Let us assume that strings only contain ASCII codes. | 145 | // Let us assume that strings only contain ASCII codes. |
146 | // If strings include Unicode characters, use Unicode, UTF7, or UTF8 | 146 | // If strings include Unicode characters, use Unicode, UTF7, or UTF8 |
147 | // encoding. | 147 | // encoding. |
148 | byte[] initVectorBytes = Encoding.ASCII.GetBytes(initVector); | 148 | byte[] initVectorBytes = Encoding.ASCII.GetBytes(initVector); |
149 | byte[] saltValueBytes = Encoding.ASCII.GetBytes(saltValue); | 149 | byte[] saltValueBytes = Encoding.ASCII.GetBytes(saltValue); |
@@ -153,8 +153,8 @@ namespace OpenSim.Framework.Communications.Cache | |||
153 | byte[] plainTextBytes = plainText; | 153 | byte[] plainTextBytes = plainText; |
154 | 154 | ||
155 | // First, we must create a password, from which the key will be derived. | 155 | // First, we must create a password, from which the key will be derived. |
156 | // This password will be generated from the specified passphrase and | 156 | // This password will be generated from the specified passphrase and |
157 | // salt value. The password will be created using the specified hash | 157 | // salt value. The password will be created using the specified hash |
158 | // algorithm. Password creation can be done in several iterations. | 158 | // algorithm. Password creation can be done in several iterations. |
159 | PasswordDeriveBytes password = new PasswordDeriveBytes( | 159 | PasswordDeriveBytes password = new PasswordDeriveBytes( |
160 | passPhrase, | 160 | passPhrase, |
@@ -173,8 +173,8 @@ namespace OpenSim.Framework.Communications.Cache | |||
173 | // (CBC). Use default options for other symmetric key parameters. | 173 | // (CBC). Use default options for other symmetric key parameters. |
174 | symmetricKey.Mode = CipherMode.CBC; | 174 | symmetricKey.Mode = CipherMode.CBC; |
175 | 175 | ||
176 | // Generate encryptor from the existing key bytes and initialization | 176 | // Generate encryptor from the existing key bytes and initialization |
177 | // vector. Key size will be defined based on the number of the key | 177 | // vector. Key size will be defined based on the number of the key |
178 | // bytes. | 178 | // bytes. |
179 | ICryptoTransform encryptor = symmetricKey.CreateEncryptor( | 179 | ICryptoTransform encryptor = symmetricKey.CreateEncryptor( |
180 | keyBytes, | 180 | keyBytes, |
@@ -265,8 +265,8 @@ namespace OpenSim.Framework.Communications.Cache | |||
265 | // Convert our ciphertext into a byte array. | 265 | // Convert our ciphertext into a byte array. |
266 | byte[] cipherTextBytes = cipherText; | 266 | byte[] cipherTextBytes = cipherText; |
267 | 267 | ||
268 | // First, we must create a password, from which the key will be | 268 | // First, we must create a password, from which the key will be |
269 | // derived. This password will be generated from the specified | 269 | // derived. This password will be generated from the specified |
270 | // passphrase and salt value. The password will be created using | 270 | // passphrase and salt value. The password will be created using |
271 | // the specified hash algorithm. Password creation can be done in | 271 | // the specified hash algorithm. Password creation can be done in |
272 | // several iterations. | 272 | // several iterations. |
@@ -286,8 +286,8 @@ namespace OpenSim.Framework.Communications.Cache | |||
286 | // (CBC). Use default options for other symmetric key parameters. | 286 | // (CBC). Use default options for other symmetric key parameters. |
287 | symmetricKey.Mode = CipherMode.CBC; | 287 | symmetricKey.Mode = CipherMode.CBC; |
288 | 288 | ||
289 | // Generate decryptor from the existing key bytes and initialization | 289 | // Generate decryptor from the existing key bytes and initialization |
290 | // vector. Key size will be defined based on the number of the key | 290 | // vector. Key size will be defined based on the number of the key |
291 | // bytes. | 291 | // bytes. |
292 | ICryptoTransform decryptor = symmetricKey.CreateDecryptor( | 292 | ICryptoTransform decryptor = symmetricKey.CreateDecryptor( |
293 | keyBytes, | 293 | keyBytes, |
@@ -320,7 +320,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
320 | for (i = 0; i < decryptedByteCount; i++) | 320 | for (i = 0; i < decryptedByteCount; i++) |
321 | plainText[i] = plainTextBytes[i]; | 321 | plainText[i] = plainTextBytes[i]; |
322 | 322 | ||
323 | // Return decrypted string. | 323 | // Return decrypted string. |
324 | return plainText; | 324 | return plainText; |
325 | } | 325 | } |
326 | } | 326 | } |
@@ -403,17 +403,17 @@ namespace OpenSim.Framework.Communications.Cache | |||
403 | string salt = Convert.ToBase64String(rand); | 403 | string salt = Convert.ToBase64String(rand); |
404 | 404 | ||
405 | x.Data = UtilRijndael.Encrypt(x.Data, file.Secret, salt, "SHA1", 2, file.IVBytes, file.Keysize); | 405 | x.Data = UtilRijndael.Encrypt(x.Data, file.Secret, salt, "SHA1", 2, file.IVBytes, file.Keysize); |
406 | x.Description = String.Format("ENCASS#:~:#{0}#:~:#{1}#:~:#{2}#:~:#{3}", | 406 | x.Metadata.Description = String.Format("ENCASS#:~:#{0}#:~:#{1}#:~:#{2}#:~:#{3}", |
407 | "OPENSIM_AES_AF1", | 407 | "OPENSIM_AES_AF1", |
408 | file.AlsoKnownAs, | 408 | file.AlsoKnownAs, |
409 | salt, | 409 | salt, |
410 | x.Description); | 410 | x.Metadata.Description); |
411 | } | 411 | } |
412 | 412 | ||
413 | private bool DecryptAssetBase(AssetBase x) | 413 | private bool DecryptAssetBase(AssetBase x) |
414 | { | 414 | { |
415 | // Check it's encrypted first. | 415 | // Check it's encrypted first. |
416 | if (!x.Description.Contains("ENCASS")) | 416 | if (!x.Metadata.Description.Contains("ENCASS")) |
417 | return true; | 417 | return true; |
418 | 418 | ||
419 | // ENCASS:ALG:AKA:SALT:Description | 419 | // ENCASS:ALG:AKA:SALT:Description |
@@ -421,7 +421,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
421 | string[] splitchars = new string[1]; | 421 | string[] splitchars = new string[1]; |
422 | splitchars[0] = "#:~:#"; | 422 | splitchars[0] = "#:~:#"; |
423 | 423 | ||
424 | string[] meta = x.Description.Split(splitchars, StringSplitOptions.None); | 424 | string[] meta = x.Metadata.Description.Split(splitchars, StringSplitOptions.None); |
425 | if (meta.Length < 5) | 425 | if (meta.Length < 5) |
426 | { | 426 | { |
427 | m_log.Warn("[ENCASSETS] Recieved Encrypted Asset, but header is corrupt"); | 427 | m_log.Warn("[ENCASSETS] Recieved Encrypted Asset, but header is corrupt"); |
@@ -432,7 +432,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
432 | if (m_keyfiles.ContainsKey(meta[2])) | 432 | if (m_keyfiles.ContainsKey(meta[2])) |
433 | { | 433 | { |
434 | RjinKeyfile deckey = m_keyfiles[meta[2]]; | 434 | RjinKeyfile deckey = m_keyfiles[meta[2]]; |
435 | x.Description = meta[4]; | 435 | x.Metadata.Description = meta[4]; |
436 | switch (meta[1]) | 436 | switch (meta[1]) |
437 | { | 437 | { |
438 | case "OPENSIM_AES_AF1": | 438 | case "OPENSIM_AES_AF1": |
@@ -506,7 +506,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
506 | { | 506 | { |
507 | string assetUrl = _assetServerUrl + "/assets/"; | 507 | string assetUrl = _assetServerUrl + "/assets/"; |
508 | 508 | ||
509 | m_log.InfoFormat("[CRYPTO GRID ASSET CLIENT]: Sending store request for asset {0}", asset.FullID); | 509 | m_log.InfoFormat("[CRYPTO GRID ASSET CLIENT]: Sending store request for asset {0}", asset.Metadata.FullID); |
510 | 510 | ||
511 | RestObjectPoster.BeginPostObject<AssetBase>(assetUrl, asset); | 511 | RestObjectPoster.BeginPostObject<AssetBase>(assetUrl, asset); |
512 | } | 512 | } |
diff --git a/OpenSim/Framework/Communications/Cache/FileAssetClient.cs b/OpenSim/Framework/Communications/Cache/FileAssetClient.cs index 5f15c3e..8b8172e 100644 --- a/OpenSim/Framework/Communications/Cache/FileAssetClient.cs +++ b/OpenSim/Framework/Communications/Cache/FileAssetClient.cs | |||
@@ -45,7 +45,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
45 | } | 45 | } |
46 | public override void StoreAsset(AssetBase asset) | 46 | public override void StoreAsset(AssetBase asset) |
47 | { | 47 | { |
48 | byte[] idBytes = asset.FullID.Guid.ToByteArray(); | 48 | byte[] idBytes = asset.Metadata.FullID.Guid.ToByteArray(); |
49 | 49 | ||
50 | string cdir = m_dir + Path.DirectorySeparatorChar + idBytes[0] | 50 | string cdir = m_dir + Path.DirectorySeparatorChar + idBytes[0] |
51 | + Path.DirectorySeparatorChar + idBytes[1]; | 51 | + Path.DirectorySeparatorChar + idBytes[1]; |
@@ -56,7 +56,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
56 | if (!Directory.Exists(cdir)) | 56 | if (!Directory.Exists(cdir)) |
57 | Directory.CreateDirectory(cdir); | 57 | Directory.CreateDirectory(cdir); |
58 | 58 | ||
59 | FileStream x = new FileStream(cdir + Path.DirectorySeparatorChar + asset.FullID + ".xml", FileMode.Create); | 59 | FileStream x = new FileStream(cdir + Path.DirectorySeparatorChar + asset.Metadata.FullID + ".xml", FileMode.Create); |
60 | m_xs.Serialize(x, asset); | 60 | m_xs.Serialize(x, asset); |
61 | 61 | ||
62 | x.Flush(); | 62 | x.Flush(); |
diff --git a/OpenSim/Framework/Communications/Cache/GridAssetClient.cs b/OpenSim/Framework/Communications/Cache/GridAssetClient.cs index e27c4f4..1cc9833 100644 --- a/OpenSim/Framework/Communications/Cache/GridAssetClient.cs +++ b/OpenSim/Framework/Communications/Cache/GridAssetClient.cs | |||
@@ -97,7 +97,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
97 | // rc.Request(s); | 97 | // rc.Request(s); |
98 | //m_log.InfoFormat("[ASSET]: Stored {0}", rc); | 98 | //m_log.InfoFormat("[ASSET]: Stored {0}", rc); |
99 | 99 | ||
100 | m_log.InfoFormat("[GRID ASSET CLIENT]: Sending store request for asset {0}", asset.FullID); | 100 | m_log.InfoFormat("[GRID ASSET CLIENT]: Sending store request for asset {0}", asset.Metadata.FullID); |
101 | 101 | ||
102 | RestObjectPoster.BeginPostObject<AssetBase>(assetUrl, asset); | 102 | RestObjectPoster.BeginPostObject<AssetBase>(assetUrl, asset); |
103 | } | 103 | } |
diff --git a/OpenSim/Framework/Communications/Capabilities/Caps.cs b/OpenSim/Framework/Communications/Capabilities/Caps.cs index a6acd68..a370eea 100644 --- a/OpenSim/Framework/Communications/Capabilities/Caps.cs +++ b/OpenSim/Framework/Communications/Capabilities/Caps.cs | |||
@@ -159,7 +159,7 @@ namespace OpenSim.Framework.Communications.Capabilities | |||
159 | m_capsHandlers["SEED"] = new RestStreamHandler("POST", capsBase + m_requestPath, CapsRequest); | 159 | m_capsHandlers["SEED"] = new RestStreamHandler("POST", capsBase + m_requestPath, CapsRequest); |
160 | m_log.DebugFormat( | 160 | m_log.DebugFormat( |
161 | "[CAPS]: Registered seed capability {0} for {1}", capsBase + m_requestPath, m_agentID); | 161 | "[CAPS]: Registered seed capability {0} for {1}", capsBase + m_requestPath, m_agentID); |
162 | 162 | ||
163 | //m_capsHandlers["MapLayer"] = | 163 | //m_capsHandlers["MapLayer"] = |
164 | // new LLSDStreamhandler<OSDMapRequest, OSDMapLayerResponse>("POST", | 164 | // new LLSDStreamhandler<OSDMapRequest, OSDMapLayerResponse>("POST", |
165 | // capsBase + m_mapLayerPath, | 165 | // capsBase + m_mapLayerPath, |
@@ -247,9 +247,9 @@ namespace OpenSim.Framework.Communications.Capabilities | |||
247 | //m_log.Debug("[CAPS]: Seed Caps Request in region: " + m_regionName); | 247 | //m_log.Debug("[CAPS]: Seed Caps Request in region: " + m_regionName); |
248 | 248 | ||
249 | string result = LLSDHelpers.SerialiseLLSDReply(m_capsHandlers.CapsDetails); | 249 | string result = LLSDHelpers.SerialiseLLSDReply(m_capsHandlers.CapsDetails); |
250 | 250 | ||
251 | //m_log.DebugFormat("[CAPS] CapsRequest {0}", result); | 251 | //m_log.DebugFormat("[CAPS] CapsRequest {0}", result); |
252 | 252 | ||
253 | return result; | 253 | return result; |
254 | } | 254 | } |
255 | 255 | ||
@@ -569,7 +569,7 @@ namespace OpenSim.Framework.Communications.Capabilities | |||
569 | 569 | ||
570 | m_httpListener.AddStreamHandler( | 570 | m_httpListener.AddStreamHandler( |
571 | new BinaryStreamHandler("POST", capsBase + uploaderPath, uploader.uploaderCaps)); | 571 | new BinaryStreamHandler("POST", capsBase + uploaderPath, uploader.uploaderCaps)); |
572 | 572 | ||
573 | string protocol = "http://"; | 573 | string protocol = "http://"; |
574 | 574 | ||
575 | if (m_httpListener.UseSSL) | 575 | if (m_httpListener.UseSSL) |
@@ -648,7 +648,7 @@ namespace OpenSim.Framework.Communications.Capabilities | |||
648 | /// <returns></returns> | 648 | /// <returns></returns> |
649 | public LLSDAssetUploadResponse NewAgentInventoryRequest(LLSDAssetUploadRequest llsdRequest) | 649 | public LLSDAssetUploadResponse NewAgentInventoryRequest(LLSDAssetUploadRequest llsdRequest) |
650 | { | 650 | { |
651 | if (llsdRequest.asset_type == "texture" || | 651 | if (llsdRequest.asset_type == "texture" || |
652 | llsdRequest.asset_type == "animation" || | 652 | llsdRequest.asset_type == "animation" || |
653 | llsdRequest.asset_type == "sound") | 653 | llsdRequest.asset_type == "sound") |
654 | { | 654 | { |
@@ -741,9 +741,9 @@ namespace OpenSim.Framework.Communications.Capabilities | |||
741 | 741 | ||
742 | AssetBase asset; | 742 | AssetBase asset; |
743 | asset = new AssetBase(); | 743 | asset = new AssetBase(); |
744 | asset.FullID = assetID; | 744 | asset.Metadata.FullID = assetID; |
745 | asset.Type = assType; | 745 | asset.Metadata.Type = assType; |
746 | asset.Name = assetName; | 746 | asset.Metadata.Name = assetName; |
747 | asset.Data = data; | 747 | asset.Data = data; |
748 | m_assetCache.AddAsset(asset); | 748 | m_assetCache.AddAsset(asset); |
749 | 749 | ||
@@ -751,7 +751,7 @@ namespace OpenSim.Framework.Communications.Capabilities | |||
751 | item.Owner = m_agentID; | 751 | item.Owner = m_agentID; |
752 | item.Creator = m_agentID; | 752 | item.Creator = m_agentID; |
753 | item.ID = inventoryItem; | 753 | item.ID = inventoryItem; |
754 | item.AssetID = asset.FullID; | 754 | item.AssetID = asset.Metadata.FullID; |
755 | item.Description = assetDescription; | 755 | item.Description = assetDescription; |
756 | item.Name = assetName; | 756 | item.Name = assetName; |
757 | item.AssetType = assType; | 757 | item.AssetType = assType; |