aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/ApplicationPlugins/Rest/Inventory
diff options
context:
space:
mode:
authorMike Mazur2009-02-04 00:01:36 +0000
committerMike Mazur2009-02-04 00:01:36 +0000
commit0c03a48fb2060eda4d288e2d2ca4e650ce000b4b (patch)
treea90465075960c92367b0a5e62db3121e4e3a139d /OpenSim/ApplicationPlugins/Rest/Inventory
parent* Add another object to the existing save oar test (diff)
downloadopensim-SC_OLD-0c03a48fb2060eda4d288e2d2ca4e650ce000b4b.zip
opensim-SC_OLD-0c03a48fb2060eda4d288e2d2ca4e650ce000b4b.tar.gz
opensim-SC_OLD-0c03a48fb2060eda4d288e2d2ca4e650ce000b4b.tar.bz2
opensim-SC_OLD-0c03a48fb2060eda4d288e2d2ca4e650ce000b4b.tar.xz
- add OpenSim.Framework.AssetMetadata class. AssetBase is now composed of it
- trim trailing whitespace
Diffstat (limited to 'OpenSim/ApplicationPlugins/Rest/Inventory')
-rw-r--r--OpenSim/ApplicationPlugins/Rest/Inventory/RestAssetServices.cs60
-rw-r--r--OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs48
2 files changed, 54 insertions, 54 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
diff --git a/OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs b/OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs
index 2dce706..aa222bb 100644
--- a/OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs
+++ b/OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs
@@ -353,7 +353,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
353 default : 353 default :
354 Rest.Log.WarnFormat("{0} Method {1} not supported for {2}", 354 Rest.Log.WarnFormat("{0} Method {1} not supported for {2}",
355 MsgId, rdata.method, rdata.path); 355 MsgId, rdata.method, rdata.path);
356 rdata.Fail(Rest.HttpStatusCodeMethodNotAllowed, 356 rdata.Fail(Rest.HttpStatusCodeMethodNotAllowed,
357 String.Format("{0} not supported", rdata.method)); 357 String.Format("{0} not supported", rdata.method));
358 break; 358 break;
359 } 359 }
@@ -488,12 +488,12 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
488 foreach (AssetBase asset in entity.Assets) 488 foreach (AssetBase asset in entity.Assets)
489 { 489 {
490 Rest.Log.DebugFormat("{0} Rest asset: {1} {2} {3}", 490 Rest.Log.DebugFormat("{0} Rest asset: {1} {2} {3}",
491 MsgId, asset.ID, asset.Type, asset.Name); 491 MsgId, asset.Metadata.ID, asset.Metadata.Type, asset.Metadata.Name);
492 Rest.AssetServices.AddAsset(asset); 492 Rest.AssetServices.AddAsset(asset);
493 493
494 created = true; 494 created = true;
495 rdata.appendStatus(String.Format("<p> Created asset {0}, UUID {1} <p>", 495 rdata.appendStatus(String.Format("<p> Created asset {0}, UUID {1} <p>",
496 asset.Name, asset.ID)); 496 asset.Metadata.Name, asset.Metadata.ID));
497 497
498 if (Rest.DEBUG && Rest.DumpAsset) 498 if (Rest.DEBUG && Rest.DumpAsset)
499 { 499 {
@@ -691,14 +691,14 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
691 foreach (AssetBase asset in entity.Assets) 691 foreach (AssetBase asset in entity.Assets)
692 { 692 {
693 Rest.Log.DebugFormat("{0} Rest asset: {1} {2} {3}", 693 Rest.Log.DebugFormat("{0} Rest asset: {1} {2} {3}",
694 MsgId, asset.ID, asset.Type, asset.Name); 694 MsgId, asset.Metadata.ID, asset.Metadata.Type, asset.Metadata.Name);
695 695
696 // The asset was validated during the collection process 696 // The asset was validated during the collection process
697 697
698 Rest.AssetServices.AddAsset(asset); 698 Rest.AssetServices.AddAsset(asset);
699 699
700 created = true; 700 created = true;
701 rdata.appendStatus(String.Format("<p> Created asset {0}, UUID {1} <p>", asset.Name, asset.ID)); 701 rdata.appendStatus(String.Format("<p> Created asset {0}, UUID {1} <p>", asset.Metadata.Name, asset.Metadata.ID));
702 702
703 if (Rest.DEBUG && Rest.DumpAsset) 703 if (Rest.DEBUG && Rest.DumpAsset)
704 { 704 {
@@ -1083,7 +1083,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
1083 1083
1084 Rest.Log.DebugFormat("{0} {1}: Resource {2} not found", 1084 Rest.Log.DebugFormat("{0} {1}: Resource {2} not found",
1085 MsgId, rdata.method, rdata.path); 1085 MsgId, rdata.method, rdata.path);
1086 rdata.Fail(Rest.HttpStatusCodeNotFound, 1086 rdata.Fail(Rest.HttpStatusCodeNotFound,
1087 String.Format("resource {0}:{1} not found", rdata.method, rdata.path)); 1087 String.Format("resource {0}:{1} not found", rdata.method, rdata.path));
1088 1088
1089 return null; /* Never reached */ 1089 return null; /* Never reached */
@@ -1324,7 +1324,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
1324 rdata.writer.WriteAttributeString("everyone", String.Empty, i.EveryOnePermissions.ToString("X")); 1324 rdata.writer.WriteAttributeString("everyone", String.Empty, i.EveryOnePermissions.ToString("X"));
1325 rdata.writer.WriteAttributeString("base", String.Empty, i.BasePermissions.ToString("X")); 1325 rdata.writer.WriteAttributeString("base", String.Empty, i.BasePermissions.ToString("X"));
1326 rdata.writer.WriteEndElement(); 1326 rdata.writer.WriteEndElement();
1327 1327
1328 rdata.writer.WriteElementString("Asset", i.AssetID.ToString()); 1328 rdata.writer.WriteElementString("Asset", i.AssetID.ToString());
1329 1329
1330 rdata.writer.WriteEndElement(); 1330 rdata.writer.WriteEndElement();
@@ -1458,7 +1458,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
1458 case XmlNodeType.Element: 1458 case XmlNodeType.Element:
1459 Rest.Log.DebugFormat("{0} StartElement: <{1}>", 1459 Rest.Log.DebugFormat("{0} StartElement: <{1}>",
1460 MsgId, ic.xml.Name); 1460 MsgId, ic.xml.Name);
1461 1461
1462 switch (ic.xml.Name) 1462 switch (ic.xml.Name)
1463 { 1463 {
1464 case "Folder": 1464 case "Folder":
@@ -1486,7 +1486,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
1486 MsgId, ic.xml.Name); 1486 MsgId, ic.xml.Name);
1487 break; 1487 break;
1488 } 1488 }
1489 1489
1490 // This stinks, but the ReadElement call above not only reads 1490 // This stinks, but the ReadElement call above not only reads
1491 // the imbedded data, but also consumes the end tag for Asset 1491 // the imbedded data, but also consumes the end tag for Asset
1492 // and moves the element pointer on to the containing Item's 1492 // and moves the element pointer on to the containing Item's
@@ -1498,7 +1498,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
1498 Validate(ic); 1498 Validate(ic);
1499 } 1499 }
1500 break; 1500 break;
1501 1501
1502 case XmlNodeType.EndElement : 1502 case XmlNodeType.EndElement :
1503 switch (ic.xml.Name) 1503 switch (ic.xml.Name)
1504 { 1504 {
@@ -1526,7 +1526,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
1526 break; 1526 break;
1527 } 1527 }
1528 break; 1528 break;
1529 1529
1530 default: 1530 default:
1531 Rest.Log.DebugFormat("{0} Ignoring: <{1}>:<{2}>", 1531 Rest.Log.DebugFormat("{0} Ignoring: <{1}>:<{2}>",
1532 MsgId, ic.xml.NodeType, ic.xml.Value); 1532 MsgId, ic.xml.NodeType, ic.xml.Value);
@@ -1868,7 +1868,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
1868 // only if the size is non-zero. 1868 // only if the size is non-zero.
1869 1869
1870 else 1870 else
1871 { 1871 {
1872 AssetBase asset = null; 1872 AssetBase asset = null;
1873 string b64string = null; 1873 string b64string = null;
1874 1874
@@ -1884,10 +1884,10 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
1884 1884
1885 asset = new AssetBase(uuid, name); 1885 asset = new AssetBase(uuid, name);
1886 1886
1887 asset.Description = desc; 1887 asset.Metadata.Description = desc;
1888 asset.Type = type; // type == 0 == texture 1888 asset.Metadata.Type = type; // type == 0 == texture
1889 asset.Local = local; 1889 asset.Metadata.Local = local;
1890 asset.Temporary = temp; 1890 asset.Metadata.Temporary = temp;
1891 1891
1892 b64string = ic.xml.ReadElementContentAsString(); 1892 b64string = ic.xml.ReadElementContentAsString();
1893 1893
@@ -1911,8 +1911,8 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
1911 { 1911 {
1912 ic.Item.AssetID = uuid; 1912 ic.Item.AssetID = uuid;
1913 } 1913 }
1914 1914
1915 ic.Push(asset); 1915 ic.Push(asset);
1916 } 1916 }
1917 } 1917 }
1918 1918
@@ -2039,10 +2039,10 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
2039 2039
2040 if (ic.Asset != null) 2040 if (ic.Asset != null)
2041 { 2041 {
2042 if (ic.Asset.Name == String.Empty) 2042 if (ic.Asset.Metadata.Name == String.Empty)
2043 ic.Asset.Name = ic.Item.Name; 2043 ic.Asset.Metadata.Name = ic.Item.Name;
2044 if (ic.Asset.Description == String.Empty) 2044 if (ic.Asset.Metadata.Description == String.Empty)
2045 ic.Asset.Description = ic.Item.Description; 2045 ic.Asset.Metadata.Description = ic.Item.Description;
2046 } 2046 }
2047 2047
2048 // Assign permissions 2048 // Assign permissions
@@ -2139,7 +2139,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
2139 try 2139 try
2140 { 2140 {
2141 ic.Asset.Data = OpenJPEG.EncodeFromImage(temp, true); 2141 ic.Asset.Data = OpenJPEG.EncodeFromImage(temp, true);
2142 } 2142 }
2143 catch (DllNotFoundException) 2143 catch (DllNotFoundException)
2144 { 2144 {
2145 Rest.Log.ErrorFormat("OpenJpeg is not installed correctly on this system. Asset Data is emtpy for {0}", ic.Item.Name); 2145 Rest.Log.ErrorFormat("OpenJpeg is not installed correctly on this system. Asset Data is emtpy for {0}", ic.Item.Name);
@@ -2201,7 +2201,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
2201 2201
2202 /// <summary> 2202 /// <summary>
2203 /// This is the callback method required by the inventory watchdog. The 2203 /// This is the callback method required by the inventory watchdog. The
2204 /// requestor issues an inventory request and then blocks until the 2204 /// requestor issues an inventory request and then blocks until the
2205 /// request completes, or this method signals the monitor. 2205 /// request completes, or this method signals the monitor.
2206 /// </summary> 2206 /// </summary>
2207 2207