From 0c03a48fb2060eda4d288e2d2ca4e650ce000b4b Mon Sep 17 00:00:00 2001
From: Mike Mazur
Date: Wed, 4 Feb 2009 00:01:36 +0000
Subject: - add OpenSim.Framework.AssetMetadata class. AssetBase is now
composed of it - trim trailing whitespace
---
.../Rest/Inventory/RestAssetServices.cs | 60 +++++++++++-----------
.../Rest/Inventory/RestInventoryServices.cs | 48 ++++++++---------
2 files changed, 54 insertions(+), 54 deletions(-)
(limited to 'OpenSim/ApplicationPlugins/Rest')
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
#endregion Interface
///
Created asset {0}, UUID {1}
", asset.Name, asset.FullID)); + rdata.appendStatus(String.Format("
Created asset {0}, UUID {1}
", asset.Metadata.Name, asset.Metadata.FullID)); rdata.Complete(Rest.HttpStatusCodeCreated); } else { if (modified) { - rdata.appendStatus(String.Format("
Modified asset {0}, UUID {1}
", asset.Name, asset.FullID)); + rdata.appendStatus(String.Format("
Modified asset {0}, UUID {1}
", asset.Metadata.Name, asset.Metadata.FullID)); rdata.Complete(Rest.HttpStatusCodeOK); } else @@ -354,27 +354,27 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory modified = (asset != null); created = !modified; - asset = new AssetBase(); - asset.FullID = uuid; - asset.Name = xml.GetAttribute("name"); - asset.Description = xml.GetAttribute("desc"); - asset.Type = SByte.Parse(xml.GetAttribute("type")); - asset.Local = Int32.Parse(xml.GetAttribute("local")) != 0; - asset.Temporary = Int32.Parse(xml.GetAttribute("temporary")) != 0; - asset.Data = Convert.FromBase64String(xml.ReadElementContentAsString("Asset", "")); + asset = new AssetBase(); + asset.Metadata.FullID = uuid; + asset.Metadata.Name = xml.GetAttribute("name"); + asset.Metadata.Description = xml.GetAttribute("desc"); + asset.Metadata.Type = SByte.Parse(xml.GetAttribute("type")); + asset.Metadata.Local = Int32.Parse(xml.GetAttribute("local")) != 0; + asset.Metadata.Temporary = Int32.Parse(xml.GetAttribute("temporary")) != 0; + asset.Data = Convert.FromBase64String(xml.ReadElementContentAsString("Asset", "")); Rest.AssetServices.AddAsset(asset); if (created) { - rdata.appendStatus(String.Format("
Created asset {0}, UUID {1}
", asset.Name, asset.FullID)); + rdata.appendStatus(String.Format("
Created asset {0}, UUID {1}
", asset.Metadata.Name, asset.Metadata.FullID)); rdata.Complete(Rest.HttpStatusCodeCreated); } else { if (modified) { - rdata.appendStatus(String.Format("
Modified asset {0}, UUID {1}
", asset.Name, asset.FullID)); + rdata.appendStatus(String.Format("
Modified asset {0}, UUID {1}
", asset.Metadata.Name, asset.Metadata.FullID)); rdata.Complete(Rest.HttpStatusCodeOK); } 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 default : Rest.Log.WarnFormat("{0} Method {1} not supported for {2}", MsgId, rdata.method, rdata.path); - rdata.Fail(Rest.HttpStatusCodeMethodNotAllowed, + rdata.Fail(Rest.HttpStatusCodeMethodNotAllowed, String.Format("{0} not supported", rdata.method)); break; } @@ -488,12 +488,12 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory foreach (AssetBase asset in entity.Assets) { Rest.Log.DebugFormat("{0} Rest asset: {1} {2} {3}", - MsgId, asset.ID, asset.Type, asset.Name); + MsgId, asset.Metadata.ID, asset.Metadata.Type, asset.Metadata.Name); Rest.AssetServices.AddAsset(asset); created = true; rdata.appendStatus(String.Format("
Created asset {0}, UUID {1}
", - asset.Name, asset.ID)); + asset.Metadata.Name, asset.Metadata.ID)); if (Rest.DEBUG && Rest.DumpAsset) { @@ -691,14 +691,14 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory foreach (AssetBase asset in entity.Assets) { Rest.Log.DebugFormat("{0} Rest asset: {1} {2} {3}", - MsgId, asset.ID, asset.Type, asset.Name); + MsgId, asset.Metadata.ID, asset.Metadata.Type, asset.Metadata.Name); // The asset was validated during the collection process Rest.AssetServices.AddAsset(asset); created = true; - rdata.appendStatus(String.Format("
Created asset {0}, UUID {1}
", asset.Name, asset.ID)); + rdata.appendStatus(String.Format("
Created asset {0}, UUID {1}
", asset.Metadata.Name, asset.Metadata.ID));
if (Rest.DEBUG && Rest.DumpAsset)
{
@@ -1083,7 +1083,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
Rest.Log.DebugFormat("{0} {1}: Resource {2} not found",
MsgId, rdata.method, rdata.path);
- rdata.Fail(Rest.HttpStatusCodeNotFound,
+ rdata.Fail(Rest.HttpStatusCodeNotFound,
String.Format("resource {0}:{1} not found", rdata.method, rdata.path));
return null; /* Never reached */
@@ -1324,7 +1324,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
rdata.writer.WriteAttributeString("everyone", String.Empty, i.EveryOnePermissions.ToString("X"));
rdata.writer.WriteAttributeString("base", String.Empty, i.BasePermissions.ToString("X"));
rdata.writer.WriteEndElement();
-
+
rdata.writer.WriteElementString("Asset", i.AssetID.ToString());
rdata.writer.WriteEndElement();
@@ -1458,7 +1458,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
case XmlNodeType.Element:
Rest.Log.DebugFormat("{0} StartElement: <{1}>",
MsgId, ic.xml.Name);
-
+
switch (ic.xml.Name)
{
case "Folder":
@@ -1486,7 +1486,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
MsgId, ic.xml.Name);
break;
}
-
+
// This stinks, but the ReadElement call above not only reads
// the imbedded data, but also consumes the end tag for Asset
// and moves the element pointer on to the containing Item's
@@ -1498,7 +1498,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
Validate(ic);
}
break;
-
+
case XmlNodeType.EndElement :
switch (ic.xml.Name)
{
@@ -1526,7 +1526,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
break;
}
break;
-
+
default:
Rest.Log.DebugFormat("{0} Ignoring: <{1}>:<{2}>",
MsgId, ic.xml.NodeType, ic.xml.Value);
@@ -1868,7 +1868,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
// only if the size is non-zero.
else
- {
+ {
AssetBase asset = null;
string b64string = null;
@@ -1884,10 +1884,10 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
asset = new AssetBase(uuid, name);
- asset.Description = desc;
- asset.Type = type; // type == 0 == texture
- asset.Local = local;
- asset.Temporary = temp;
+ asset.Metadata.Description = desc;
+ asset.Metadata.Type = type; // type == 0 == texture
+ asset.Metadata.Local = local;
+ asset.Metadata.Temporary = temp;
b64string = ic.xml.ReadElementContentAsString();
@@ -1911,8 +1911,8 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
{
ic.Item.AssetID = uuid;
}
-
- ic.Push(asset);
+
+ ic.Push(asset);
}
}
@@ -2039,10 +2039,10 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
if (ic.Asset != null)
{
- if (ic.Asset.Name == String.Empty)
- ic.Asset.Name = ic.Item.Name;
- if (ic.Asset.Description == String.Empty)
- ic.Asset.Description = ic.Item.Description;
+ if (ic.Asset.Metadata.Name == String.Empty)
+ ic.Asset.Metadata.Name = ic.Item.Name;
+ if (ic.Asset.Metadata.Description == String.Empty)
+ ic.Asset.Metadata.Description = ic.Item.Description;
}
// Assign permissions
@@ -2139,7 +2139,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
try
{
ic.Asset.Data = OpenJPEG.EncodeFromImage(temp, true);
- }
+ }
catch (DllNotFoundException)
{
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
///