Cleanups in REST inventory and asset services.
0.6.0-stable
Dr Scofield 2008-10-30 15:26:23 +00:00
parent e8615f0fee
commit 3a6037b421
2 changed files with 18 additions and 12 deletions

View File

@ -254,6 +254,8 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
bool modified = false;
bool created = false;
AssetBase asset = null;
Rest.Log.DebugFormat("{0} REST Asset handler, Method = <{1}> ENTRY", MsgId, rdata.method);
if (rdata.Parameters.Length == 1)
@ -269,7 +271,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
}
UUID uuid = new UUID(rdata.Parameters[0]);
AssetBase asset = Rest.AssetServices.GetAsset(uuid, false);
asset = Rest.AssetServices.GetAsset(uuid, false);
modified = (asset != null);
created = !modified;
@ -300,12 +302,14 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
if (created)
{
rdata.appendStatus(String.Format("<p> Created asset {0}, UUID {1} <p>", asset.Name, asset.FullID));
rdata.Complete(Rest.HttpStatusCodeCreated);
}
else
{
if (modified)
{
rdata.appendStatus(String.Format("<p> Modified asset {0}, UUID {1} <p>", asset.Name, asset.FullID));
rdata.Complete(Rest.HttpStatusCodeOK);
}
else
@ -365,12 +369,14 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
if (created)
{
rdata.appendStatus(String.Format("<p> Created asset {0}, UUID {1} <p>", asset.Name, asset.FullID));
rdata.Complete(Rest.HttpStatusCodeCreated);
}
else
{
if (modified)
{
rdata.appendStatus(String.Format("<p> Modified asset {0}, UUID {1} <p>", asset.Name, asset.FullID));
rdata.Complete(Rest.HttpStatusCodeOK);
}
else

View File

@ -612,7 +612,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
MsgId, item.ID, item.AssetID, item.InvType, item.AssetType, item.Name);
Rest.InventoryServices.AddItem(item);
created = true;
rdata.appendStatus(String.Format("<p> Created item {2}, UUID {3}<p>", item.Name, item.ID));
rdata.appendStatus(String.Format("<p> Created item {0}, UUID {1} <p>", item.Name, item.ID));
}
}