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/ApplicationPlugins/Rest/Inventory/RestAssetServices.cs | |
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 'OpenSim/ApplicationPlugins/Rest/Inventory/RestAssetServices.cs')
-rw-r--r-- | OpenSim/ApplicationPlugins/Rest/Inventory/RestAssetServices.cs | 60 |
1 files changed, 30 insertions, 30 deletions
diff --git a/OpenSim/ApplicationPlugins/Rest/Inventory/RestAssetServices.cs b/OpenSim/ApplicationPlugins/Rest/Inventory/RestAssetServices.cs index ba9e5b1..241bc90 100644 --- a/OpenSim/ApplicationPlugins/Rest/Inventory/RestAssetServices.cs +++ b/OpenSim/ApplicationPlugins/Rest/Inventory/RestAssetServices.cs | |||
@@ -195,7 +195,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
195 | #endregion Interface | 195 | #endregion Interface |
196 | 196 | ||
197 | /// <summary> | 197 | /// <summary> |
198 | /// The only parameter we recognize is a UUID.If an asset with this identification is | 198 | /// The only parameter we recognize is a UUID.If an asset with this identification is |
199 | /// found, it's content, base-64 encoded, is returned to the client. | 199 | /// found, it's content, base-64 encoded, is returned to the client. |
200 | /// </summary> | 200 | /// </summary> |
201 | 201 | ||
@@ -218,12 +218,12 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
218 | 218 | ||
219 | rdata.writer.WriteStartElement(String.Empty,"Asset",String.Empty); | 219 | rdata.writer.WriteStartElement(String.Empty,"Asset",String.Empty); |
220 | 220 | ||
221 | rdata.writer.WriteAttributeString("id", asset.ID.ToString()); | 221 | rdata.writer.WriteAttributeString("id", asset.Metadata.ID); |
222 | rdata.writer.WriteAttributeString("name", asset.Name); | 222 | rdata.writer.WriteAttributeString("name", asset.Metadata.Name); |
223 | rdata.writer.WriteAttributeString("desc", asset.Description); | 223 | rdata.writer.WriteAttributeString("desc", asset.Metadata.Description); |
224 | rdata.writer.WriteAttributeString("type", asset.Type.ToString()); | 224 | rdata.writer.WriteAttributeString("type", asset.Metadata.Type.ToString()); |
225 | rdata.writer.WriteAttributeString("local", asset.Local.ToString()); | 225 | rdata.writer.WriteAttributeString("local", asset.Metadata.Local.ToString()); |
226 | rdata.writer.WriteAttributeString("temporary", asset.Temporary.ToString()); | 226 | rdata.writer.WriteAttributeString("temporary", asset.Metadata.Temporary.ToString()); |
227 | 227 | ||
228 | rdata.writer.WriteBase64(asset.Data,0,asset.Data.Length); | 228 | rdata.writer.WriteBase64(asset.Data,0,asset.Data.Length); |
229 | 229 | ||
@@ -274,19 +274,19 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
274 | modified = (asset != null); | 274 | modified = (asset != null); |
275 | created = !modified; | 275 | created = !modified; |
276 | 276 | ||
277 | asset = new AssetBase(); | 277 | asset = new AssetBase(); |
278 | asset.FullID = uuid; | 278 | asset.Metadata.FullID = uuid; |
279 | asset.Name = xml.GetAttribute("name"); | 279 | asset.Metadata.Name = xml.GetAttribute("name"); |
280 | asset.Description = xml.GetAttribute("desc"); | 280 | asset.Metadata.Description = xml.GetAttribute("desc"); |
281 | asset.Type = SByte.Parse(xml.GetAttribute("type")); | 281 | asset.Metadata.Type = SByte.Parse(xml.GetAttribute("type")); |
282 | asset.Local = Int32.Parse(xml.GetAttribute("local")) != 0; | 282 | asset.Metadata.Local = Int32.Parse(xml.GetAttribute("local")) != 0; |
283 | asset.Temporary = Int32.Parse(xml.GetAttribute("temporary")) != 0; | 283 | asset.Metadata.Temporary = Int32.Parse(xml.GetAttribute("temporary")) != 0; |
284 | asset.Data = Convert.FromBase64String(xml.ReadElementContentAsString("Asset", "")); | 284 | asset.Data = Convert.FromBase64String(xml.ReadElementContentAsString("Asset", "")); |
285 | 285 | ||
286 | if (asset.ID != rdata.Parameters[0]) | 286 | if (asset.Metadata.ID != rdata.Parameters[0]) |
287 | { | 287 | { |
288 | Rest.Log.WarnFormat("{0} URI and payload disagree on UUID U:{1} vs P:{2}", | 288 | Rest.Log.WarnFormat("{0} URI and payload disagree on UUID U:{1} vs P:{2}", |
289 | MsgId, rdata.Parameters[0], asset.ID); | 289 | MsgId, rdata.Parameters[0], asset.Metadata.ID); |
290 | } | 290 | } |
291 | 291 | ||
292 | Rest.AssetServices.AddAsset(asset); | 292 | Rest.AssetServices.AddAsset(asset); |
@@ -300,14 +300,14 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
300 | 300 | ||
301 | if (created) | 301 | if (created) |
302 | { | 302 | { |
303 | rdata.appendStatus(String.Format("<p> Created asset {0}, UUID {1} <p>", asset.Name, asset.FullID)); | 303 | rdata.appendStatus(String.Format("<p> Created asset {0}, UUID {1} <p>", asset.Metadata.Name, asset.Metadata.FullID)); |
304 | rdata.Complete(Rest.HttpStatusCodeCreated); | 304 | rdata.Complete(Rest.HttpStatusCodeCreated); |
305 | } | 305 | } |
306 | else | 306 | else |
307 | { | 307 | { |
308 | if (modified) | 308 | if (modified) |
309 | { | 309 | { |
310 | rdata.appendStatus(String.Format("<p> Modified asset {0}, UUID {1} <p>", asset.Name, asset.FullID)); | 310 | rdata.appendStatus(String.Format("<p> Modified asset {0}, UUID {1} <p>", asset.Metadata.Name, asset.Metadata.FullID)); |
311 | rdata.Complete(Rest.HttpStatusCodeOK); | 311 | rdata.Complete(Rest.HttpStatusCodeOK); |
312 | } | 312 | } |
313 | else | 313 | else |
@@ -354,27 +354,27 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
354 | modified = (asset != null); | 354 | modified = (asset != null); |
355 | created = !modified; | 355 | created = !modified; |
356 | 356 | ||
357 | asset = new AssetBase(); | 357 | asset = new AssetBase(); |
358 | asset.FullID = uuid; | 358 | asset.Metadata.FullID = uuid; |
359 | asset.Name = xml.GetAttribute("name"); | 359 | asset.Metadata.Name = xml.GetAttribute("name"); |
360 | asset.Description = xml.GetAttribute("desc"); | 360 | asset.Metadata.Description = xml.GetAttribute("desc"); |
361 | asset.Type = SByte.Parse(xml.GetAttribute("type")); | 361 | asset.Metadata.Type = SByte.Parse(xml.GetAttribute("type")); |
362 | asset.Local = Int32.Parse(xml.GetAttribute("local")) != 0; | 362 | asset.Metadata.Local = Int32.Parse(xml.GetAttribute("local")) != 0; |
363 | asset.Temporary = Int32.Parse(xml.GetAttribute("temporary")) != 0; | 363 | asset.Metadata.Temporary = Int32.Parse(xml.GetAttribute("temporary")) != 0; |
364 | asset.Data = Convert.FromBase64String(xml.ReadElementContentAsString("Asset", "")); | 364 | asset.Data = Convert.FromBase64String(xml.ReadElementContentAsString("Asset", "")); |
365 | 365 | ||
366 | Rest.AssetServices.AddAsset(asset); | 366 | Rest.AssetServices.AddAsset(asset); |
367 | 367 | ||
368 | if (created) | 368 | if (created) |
369 | { | 369 | { |
370 | rdata.appendStatus(String.Format("<p> Created asset {0}, UUID {1} <p>", asset.Name, asset.FullID)); | 370 | rdata.appendStatus(String.Format("<p> Created asset {0}, UUID {1} <p>", asset.Metadata.Name, asset.Metadata.FullID)); |
371 | rdata.Complete(Rest.HttpStatusCodeCreated); | 371 | rdata.Complete(Rest.HttpStatusCodeCreated); |
372 | } | 372 | } |
373 | else | 373 | else |
374 | { | 374 | { |
375 | if (modified) | 375 | if (modified) |
376 | { | 376 | { |
377 | rdata.appendStatus(String.Format("<p> Modified asset {0}, UUID {1} <p>", asset.Name, asset.FullID)); | 377 | rdata.appendStatus(String.Format("<p> Modified asset {0}, UUID {1} <p>", asset.Metadata.Name, asset.Metadata.FullID)); |
378 | rdata.Complete(Rest.HttpStatusCodeOK); | 378 | rdata.Complete(Rest.HttpStatusCodeOK); |
379 | } | 379 | } |
380 | else | 380 | else |