comment out large chunks of appearance/inventory region access services to eliminate warnings that this code is unused

soprefactor
Justin Clark-Casey (justincc) 2010-05-28 18:42:25 +01:00
parent 565db4635f
commit 1042ce7283
2 changed files with 656 additions and 660 deletions

View File

@ -39,8 +39,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
public class RestAppearanceServices : IRest public class RestAppearanceServices : IRest
{ {
// private static readonly int PARM_USERID = 0;
private static readonly int PARM_USERID = 0;
// private static readonly int PARM_PATH = 1; // private static readonly int PARM_PATH = 1;
@ -64,6 +63,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
{ {
Rest.Log.InfoFormat("{0} Domain is relative, adding absolute prefix", MsgId); Rest.Log.InfoFormat("{0} Domain is relative, adding absolute prefix", MsgId);
qPrefix = String.Format("{0}{1}{2}", Rest.Prefix, Rest.UrlPathSeparator, qPrefix); qPrefix = String.Format("{0}{1}{2}", Rest.Prefix, Rest.UrlPathSeparator, qPrefix);
qPrefix = String.Format("{0}{1}{2}", Rest.Prefix, Rest.UrlPathSeparator, qPrefix);
Rest.Log.InfoFormat("{0} Domain is now <{1}>", MsgId, qPrefix); Rest.Log.InfoFormat("{0} Domain is now <{1}>", MsgId, qPrefix);
} }
@ -294,31 +294,31 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
/// </summary> /// </summary>
/// <param name=rdata>HTTP service request work area</param> /// <param name=rdata>HTTP service request work area</param>
private void DoGet(AppearanceRequestData rdata) // private void DoGet(AppearanceRequestData rdata)
{ // {
AvatarData adata = Rest.AvatarServices.GetAvatar(rdata.userProfile.ID); // AvatarData adata = Rest.AvatarServices.GetAvatar(rdata.userProfile.ID);
//
if (adata == null) // if (adata == null)
{ // {
rdata.Fail(Rest.HttpStatusCodeNoContent, // rdata.Fail(Rest.HttpStatusCodeNoContent,
String.Format("appearance data not found for user {0} {1}", // String.Format("appearance data not found for user {0} {1}",
rdata.userProfile.FirstName, rdata.userProfile.SurName)); // rdata.userProfile.FirstName, rdata.userProfile.SurName));
} // }
rdata.userAppearance = adata.ToAvatarAppearance(rdata.userProfile.ID); // rdata.userAppearance = adata.ToAvatarAppearance(rdata.userProfile.ID);
//
rdata.initXmlWriter(); // rdata.initXmlWriter();
//
FormatUserAppearance(rdata); // FormatUserAppearance(rdata);
//
// Indicate a successful request // // Indicate a successful request
//
rdata.Complete(); // rdata.Complete();
//
// Send the response to the user. The body will be implicitly // // Send the response to the user. The body will be implicitly
// constructed from the result of the XML writer. // // constructed from the result of the XML writer.
//
rdata.Respond(String.Format("Appearance {0} Normal completion", rdata.method)); // rdata.Respond(String.Format("Appearance {0} Normal completion", rdata.method));
} // }
/// <summary> /// <summary>
/// POST adds NEW information to the user profile database. /// POST adds NEW information to the user profile database.
@ -326,112 +326,112 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
/// characteristics supplied in the request. /// characteristics supplied in the request.
/// </summary> /// </summary>
private void DoExtend(AppearanceRequestData rdata) // private void DoExtend(AppearanceRequestData rdata)
{ // {
//
bool created = false; // bool created = false;
bool modified = false; // bool modified = false;
string newnode = String.Empty; // string newnode = String.Empty;
//
Rest.Log.DebugFormat("{0} POST ENTRY", MsgId); // Rest.Log.DebugFormat("{0} POST ENTRY", MsgId);
//
//AvatarAppearance old = Rest.AvatarServices.GetUserAppearance(rdata.userProfile.ID); // //AvatarAppearance old = Rest.AvatarServices.GetUserAppearance(rdata.userProfile.ID);
//
rdata.userAppearance = new AvatarAppearance(); // rdata.userAppearance = new AvatarAppearance();
//
// Although the following behavior is admitted by HTTP I am becoming // // Although the following behavior is admitted by HTTP I am becoming
// increasingly doubtful that it is appropriate for REST. If I attempt to // // increasingly doubtful that it is appropriate for REST. If I attempt to
// add a new record, and it already exists, then it seems to me that the // // add a new record, and it already exists, then it seems to me that the
// attempt should fail, rather than update the existing record. // // attempt should fail, rather than update the existing record.
AvatarData adata = null; // AvatarData adata = null;
if (GetUserAppearance(rdata)) // if (GetUserAppearance(rdata))
{ // {
modified = rdata.userAppearance != null; // modified = rdata.userAppearance != null;
created = !modified; // created = !modified;
adata = new AvatarData(rdata.userAppearance); // adata = new AvatarData(rdata.userAppearance);
Rest.AvatarServices.SetAvatar(rdata.userProfile.ID, adata); // Rest.AvatarServices.SetAvatar(rdata.userProfile.ID, adata);
// Rest.UserServices.UpdateUserProfile(rdata.userProfile); // // Rest.UserServices.UpdateUserProfile(rdata.userProfile);
} // }
else // else
{ // {
created = true; // created = true;
adata = new AvatarData(rdata.userAppearance); // adata = new AvatarData(rdata.userAppearance);
Rest.AvatarServices.SetAvatar(rdata.userProfile.ID, adata); // Rest.AvatarServices.SetAvatar(rdata.userProfile.ID, adata);
// Rest.UserServices.UpdateUserProfile(rdata.userProfile); // // Rest.UserServices.UpdateUserProfile(rdata.userProfile);
} // }
//
if (created) // if (created)
{ // {
newnode = String.Format("{0} {1}", rdata.userProfile.FirstName, // newnode = String.Format("{0} {1}", rdata.userProfile.FirstName,
rdata.userProfile.SurName); // rdata.userProfile.SurName);
// Must include a location header with a URI that identifies the new resource. // // Must include a location header with a URI that identifies the new resource.
//
rdata.AddHeader(Rest.HttpHeaderLocation,String.Format("http://{0}{1}:{2}{3}{4}", // rdata.AddHeader(Rest.HttpHeaderLocation,String.Format("http://{0}{1}:{2}{3}{4}",
rdata.hostname,rdata.port,rdata.path,Rest.UrlPathSeparator, newnode)); // rdata.hostname,rdata.port,rdata.path,Rest.UrlPathSeparator, newnode));
rdata.Complete(Rest.HttpStatusCodeCreated); // rdata.Complete(Rest.HttpStatusCodeCreated);
//
} // }
else // else
{ // {
if (modified) // if (modified)
{ // {
rdata.Complete(Rest.HttpStatusCodeOK); // rdata.Complete(Rest.HttpStatusCodeOK);
} // }
else // else
{ // {
rdata.Complete(Rest.HttpStatusCodeNoContent); // rdata.Complete(Rest.HttpStatusCodeNoContent);
} // }
} // }
//
rdata.Respond(String.Format("Appearance {0} : Normal completion", rdata.method)); // rdata.Respond(String.Format("Appearance {0} : Normal completion", rdata.method));
//
} // }
/// <summary> /// <summary>
/// This updates the user's appearance. not all aspects need to be provided, /// This updates the user's appearance. not all aspects need to be provided,
/// only those supplied will be changed. /// only those supplied will be changed.
/// </summary> /// </summary>
private void DoUpdate(AppearanceRequestData rdata) // private void DoUpdate(AppearanceRequestData rdata)
{ // {
//
// REFACTORING PROBLEM This was commented out. It doesn't work for 0.7 // // REFACTORING PROBLEM This was commented out. It doesn't work for 0.7
//
//bool created = false; // //bool created = false;
//bool modified = false; // //bool modified = false;
//
//
//rdata.userAppearance = Rest.AvatarServices.GetUserAppearance(rdata.userProfile.ID); // //rdata.userAppearance = Rest.AvatarServices.GetUserAppearance(rdata.userProfile.ID);
//
//// If the user exists then this is considered a modification regardless // //// If the user exists then this is considered a modification regardless
//// of what may, or may not be, specified in the payload. // //// of what may, or may not be, specified in the payload.
//
//if (rdata.userAppearance != null) // //if (rdata.userAppearance != null)
//{ // //{
// modified = true; // // modified = true;
// Rest.AvatarServices.UpdateUserAppearance(rdata.userProfile.ID, rdata.userAppearance); // // Rest.AvatarServices.UpdateUserAppearance(rdata.userProfile.ID, rdata.userAppearance);
// Rest.UserServices.UpdateUserProfile(rdata.userProfile); // // Rest.UserServices.UpdateUserProfile(rdata.userProfile);
//} // //}
//
//if (created) // //if (created)
//{ // //{
// rdata.Complete(Rest.HttpStatusCodeCreated); // // rdata.Complete(Rest.HttpStatusCodeCreated);
//} // //}
//else // //else
//{ // //{
// if (modified) // // if (modified)
// { // // {
// rdata.Complete(Rest.HttpStatusCodeOK); // // rdata.Complete(Rest.HttpStatusCodeOK);
// } // // }
// else // // else
// { // // {
// rdata.Complete(Rest.HttpStatusCodeNoContent); // // rdata.Complete(Rest.HttpStatusCodeNoContent);
// } // // }
//} // //}
//
rdata.Respond(String.Format("Appearance {0} : Normal completion", rdata.method)); // rdata.Respond(String.Format("Appearance {0} : Normal completion", rdata.method));
//
} // }
/// <summary> /// <summary>
/// Delete the specified user's appearance. This actually performs a reset /// Delete the specified user's appearance. This actually performs a reset
@ -439,31 +439,29 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
/// Existing ownership is preserved. All prior updates are lost and can not /// Existing ownership is preserved. All prior updates are lost and can not
/// be recovered. /// be recovered.
/// </summary> /// </summary>
// private void DoDelete(AppearanceRequestData rdata)
private void DoDelete(AppearanceRequestData rdata) // {
{ // AvatarData adata = Rest.AvatarServices.GetAvatar(rdata.userProfile.ID);
AvatarData adata = Rest.AvatarServices.GetAvatar(rdata.userProfile.ID); //
// if (adata != null)
if (adata != null) // {
{ // AvatarAppearance old = adata.ToAvatarAppearance(rdata.userProfile.ID);
AvatarAppearance old = adata.ToAvatarAppearance(rdata.userProfile.ID); // rdata.userAppearance = new AvatarAppearance();
rdata.userAppearance = new AvatarAppearance(); // rdata.userAppearance.Owner = old.Owner;
rdata.userAppearance.Owner = old.Owner; // adata = new AvatarData(rdata.userAppearance);
adata = new AvatarData(rdata.userAppearance); //
// Rest.AvatarServices.SetAvatar(rdata.userProfile.ID, adata);
Rest.AvatarServices.SetAvatar(rdata.userProfile.ID, adata); //
// rdata.Complete();
rdata.Complete(); // }
} // else
else // {
{ //
// rdata.Complete(Rest.HttpStatusCodeNoContent);
rdata.Complete(Rest.HttpStatusCodeNoContent); // }
} //
// rdata.Respond(String.Format("Appearance {0} : Normal completion", rdata.method));
rdata.Respond(String.Format("Appearance {0} : Normal completion", rdata.method)); // }
}
#endregion method-specific processing #endregion method-specific processing