Merge branch 'master' into careminster

avinationmerge
Melanie 2013-06-13 02:49:43 +01:00
commit 9975c5674c
18 changed files with 294 additions and 189 deletions

View File

@ -458,8 +458,6 @@ namespace OpenSim.Data.MySQL
if (prim.ParentUUID == UUID.Zero)
{
objects[prim.UUID] = new SceneObjectGroup(prim);
if (prim.KeyframeMotion != null)
prim.KeyframeMotion.UpdateSceneObject(objects[prim.UUID]);
}
}

View File

@ -732,11 +732,12 @@ namespace OpenSim.Data.SQLite
}
SceneObjectGroup group = new SceneObjectGroup(prim);
if (prim.KeyframeMotion != null)
prim.KeyframeMotion.UpdateSceneObject(group);
createdObjects.Add(group.UUID, group);
retvals.Add(group);
LoadItems(prim);
}
}
catch (Exception e)

View File

@ -125,11 +125,10 @@ namespace OpenSim.Framework
Animation other = obj as Animation;
if (other != null)
{
return (other.AnimID == this.AnimID
return (other.AnimID.Equals(this.AnimID)
&& other.SequenceNum == this.SequenceNum
&& other.ObjectID == this.ObjectID);
&& other.ObjectID.Equals(this.ObjectID) );
}
return base.Equals(obj);
}

View File

@ -121,12 +121,14 @@ namespace OpenSim.Framework.Servers
+ " level >= 2 then long warnings are logged when receiving bad input data.\n"
+ " level >= 3 then short notices about all incoming non-poll HTTP requests are logged.\n"
+ " level >= 4 then the time taken to fulfill the request is logged.\n"
+ " level >= 5 then a sample from the beginning of the incoming data is logged.\n"
+ " level >= 6 then the entire incoming data is logged.\n"
+ " level >= 5 then a sample from the beginning of the data is logged.\n"
+ " level >= 6 then the entire data is logged.\n"
+ " no level is specified then the current level is returned.\n\n"
+ "If out or all and\n"
+ " level >= 3 then short notices about all outgoing requests going through WebUtil are logged.\n"
+ " level >= 4 then the time taken to fulfill the request is logged.\n",
+ " level >= 4 then the time taken to fulfill the request is logged.\n"
+ " level >= 5 then a sample from the beginning of the data is logged.\n"
+ " level >= 6 then the entire data is logged.\n",
HandleDebugHttpCommand);
}

View File

@ -151,6 +151,39 @@ namespace OpenSim.Framework
}
}
public static void LogOutgoingDetail(Stream outputStream)
{
using (StreamReader reader = new StreamReader(Util.Copy(outputStream), Encoding.UTF8))
{
string output;
if (DebugLevel == 5)
{
const int sampleLength = 80;
char[] sampleChars = new char[sampleLength];
reader.Read(sampleChars, 0, sampleLength);
output = new string(sampleChars);
}
else
{
output = reader.ReadToEnd();
}
LogOutgoingDetail(output);
}
}
public static void LogOutgoingDetail(string output)
{
if (DebugLevel == 5)
{
output = output.Substring(0, 80);
output = output + "...";
}
m_log.DebugFormat("[WEB UTIL]: {0}", output.Replace("\n", @"\n"));
}
private static OSDMap ServiceOSDRequestWorker(string url, OSDMap data, string method, int timeout, bool compressed)
{
int reqnum = RequestNumber++;
@ -178,7 +211,11 @@ namespace OpenSim.Framework
// If there is some input, write it into the request
if (data != null)
{
strBuffer = OSDParser.SerializeJsonString(data);
strBuffer = OSDParser.SerializeJsonString(data);
if (DebugLevel >= 5)
LogOutgoingDetail(strBuffer);
byte[] buffer = System.Text.Encoding.UTF8.GetBytes(strBuffer);
if (compressed)
@ -358,6 +395,10 @@ namespace OpenSim.Framework
if (data != null)
{
queryString = BuildQueryString(data);
if (DebugLevel >= 5)
LogOutgoingDetail(queryString);
byte[] buffer = System.Text.Encoding.UTF8.GetBytes(queryString);
request.ContentLength = buffer.Length;
@ -769,6 +810,9 @@ namespace OpenSim.Framework
int length = (int)buffer.Length;
request.ContentLength = length;
if (WebUtil.DebugLevel >= 5)
WebUtil.LogOutgoingDetail(buffer);
request.BeginGetRequestStream(delegate(IAsyncResult res)
{
Stream requestStream = request.EndGetRequestStream(res);
@ -966,6 +1010,9 @@ namespace OpenSim.Framework
length = (int)obj.Length;
request.ContentLength = length;
if (WebUtil.DebugLevel >= 5)
WebUtil.LogOutgoingDetail(buffer);
Stream requestStream = null;
try
{
@ -1111,6 +1158,9 @@ namespace OpenSim.Framework
int length = (int)buffer.Length;
request.ContentLength = length;
if (WebUtil.DebugLevel >= 5)
WebUtil.LogOutgoingDetail(buffer);
Stream requestStream = null;
try
{

View File

@ -476,72 +476,72 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
UserData oldUser;
//lock the whole block - prevent concurrent update
lock (m_UserCache)
{
m_UserCache.TryGetValue (id, out oldUser);
if (oldUser != null)
{
if (creatorData == null || creatorData == String.Empty)
{
//ignore updates without creator data
return;
}
m_UserCache.TryGetValue(id, out oldUser);
//try update unknown users
//and creator's home URL's
if ((oldUser.FirstName == "Unknown" && !creatorData.Contains ("Unknown")) || (oldUser.HomeURL != null && !creatorData.StartsWith (oldUser.HomeURL)))
{
m_UserCache.Remove (id);
m_log.DebugFormat("[USER MANAGEMENT MODULE]: Re-adding user with id {0}, creatorData [{1}] and old HomeURL {2}", id, creatorData, oldUser.HomeURL);
}
else
{
//we have already a valid user within the cache
return;
}
if (oldUser != null)
{
if (creatorData == null || creatorData == String.Empty)
{
//ignore updates without creator data
return;
}
UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount (m_Scenes [0].RegionInfo.ScopeID, id);
if (account != null)
//try update unknown users
//and creator's home URL's
if ((oldUser.FirstName == "Unknown" && !creatorData.Contains("Unknown")) || (oldUser.HomeURL != null && !creatorData.StartsWith(oldUser.HomeURL)))
{
AddUser (id, account.FirstName, account.LastName);
lock (m_UserCache)
m_UserCache.Remove(id);
m_log.DebugFormat("[USER MANAGEMENT MODULE]: Re-adding user with id {0}, creatorData [{1}] and old HomeURL {2}", id, creatorData, oldUser.HomeURL);
}
else
{
UserData user = new UserData ();
user.Id = id;
if (creatorData != null && creatorData != string.Empty)
{
//creatorData = <endpoint>;<name>
string[] parts = creatorData.Split (';');
if (parts.Length >= 1)
{
user.HomeURL = parts [0];
try
{
Uri uri = new Uri (parts [0]);
user.LastName = "@" + uri.Authority;
}
catch (UriFormatException)
{
m_log.DebugFormat ("[SCENE]: Unable to parse Uri {0}", parts [0]);
user.LastName = "@unknown";
}
}
if (parts.Length >= 2)
user.FirstName = parts [1].Replace (' ', '.');
}
else
{
user.FirstName = "Unknown";
user.LastName = "UserUMMAU";
}
AddUserInternal (user);
//we have already a valid user within the cache
return;
}
}
UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, id);
if (account != null)
{
AddUser(id, account.FirstName, account.LastName);
}
else
{
UserData user = new UserData();
user.Id = id;
if (creatorData != null && creatorData != string.Empty)
{
//creatorData = <endpoint>;<name>
string[] parts = creatorData.Split(';');
if (parts.Length >= 1)
{
user.HomeURL = parts[0];
try
{
Uri uri = new Uri(parts[0]);
user.LastName = "@" + uri.Authority;
}
catch (UriFormatException)
{
m_log.DebugFormat("[SCENE]: Unable to parse Uri {0}", parts[0]);
user.LastName = "@unknown";
}
}
if (parts.Length >= 2)
user.FirstName = parts[1].Replace(' ', '.');
}
else
{
user.FirstName = "Unknown";
user.LastName = "UserUMMAU";
}
AddUserInternal(user);
}
}
void AddUserInternal(UserData user)

View File

@ -42,7 +42,7 @@ using OpenSim.Tests.Common;
namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset.Tests
{
[TestFixture]
public class AssetConnectorsTests : OpenSimTestCase
public class AssetConnectorTests : OpenSimTestCase
{
[Test]
public void TestAddAsset()
@ -77,7 +77,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset.Tests
// TODO: Add cache and check that this does receive a copy of the asset
}
[Test]
public void TestAddTemporaryAsset()
{
TestHelpers.InMethod();
@ -93,34 +92,23 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset.Tests
LocalAssetServicesConnector lasc = new LocalAssetServicesConnector();
lasc.Initialise(config);
// If it is local, it should not be stored
AssetBase a1 = AssetHelpers.CreateNotecardAsset();
a1.Local = true;
a1.Temporary = true;
lasc.Store(a1);
Assert.That(lasc.Get(a1.ID), Is.Null);
Assert.That(lasc.GetData(a1.ID), Is.Null);
Assert.That(lasc.GetMetadata(a1.ID), Is.Null);
// If it is remote, it should be stored
// AssetBase a2 = AssetHelpers.CreateNotecardAsset();
// a2.Local = false;
// a2.Temporary = true;
AssetBase a2 = AssetHelpers.CreateNotecardAsset();
a2.Local = false;
a2.Temporary = true;
// lasc.Store(a2);
lasc.Store(a2);
// AssetBase retreivedA2 = lasc.Get(a2.ID);
// Assert.That(retreivedA2.ID, Is.EqualTo(a2.ID));
// Assert.That(retreivedA2.Metadata.ID, Is.EqualTo(a2.Metadata.ID));
// Assert.That(retreivedA2.Data.Length, Is.EqualTo(a2.Data.Length));
AssetBase retreivedA2 = lasc.Get(a2.ID);
Assert.That(retreivedA2.ID, Is.EqualTo(a2.ID));
Assert.That(retreivedA2.Metadata.ID, Is.EqualTo(a2.Metadata.ID));
Assert.That(retreivedA2.Data.Length, Is.EqualTo(a2.Data.Length));
// AssetMetadata retrievedA2Metadata = lasc.GetMetadata(a2.ID);
// Assert.That(retrievedA2Metadata.ID, Is.EqualTo(a2.ID));
AssetMetadata retrievedA2Metadata = lasc.GetMetadata(a2.ID);
Assert.That(retrievedA2Metadata.ID, Is.EqualTo(a2.ID));
// byte[] retrievedA2Data = lasc.GetData(a2.ID);
// Assert.That(retrievedA2Data.Length, Is.EqualTo(a2.Data.Length));
byte[] retrievedA2Data = lasc.GetData(a2.ID);
Assert.That(retrievedA2Data.Length, Is.EqualTo(a2.Data.Length));
// TODO: Add cache and check that this does receive a copy of the asset
}
@ -152,5 +140,35 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset.Tests
// TODO: Add cache and check that this does receive a copy of the asset
}
[Test]
public void TestAddTemporaryLocalAsset()
{
TestHelpers.InMethod();
// TestHelpers.EnableLogging();
IConfigSource config = new IniConfigSource();
config.AddConfig("Modules");
config.Configs["Modules"].Set("AssetServices", "LocalAssetServicesConnector");
config.AddConfig("AssetService");
config.Configs["AssetService"].Set("LocalServiceModule", "OpenSim.Services.AssetService.dll:AssetService");
config.Configs["AssetService"].Set("StorageProvider", "OpenSim.Tests.Common.dll");
LocalAssetServicesConnector lasc = new LocalAssetServicesConnector();
lasc.Initialise(config);
// If it is local, it should not be stored
AssetBase a1 = AssetHelpers.CreateNotecardAsset();
a1.Local = true;
a1.Temporary = true;
lasc.Store(a1);
Assert.That(lasc.Get(a1.ID), Is.Null);
Assert.That(lasc.GetData(a1.ID), Is.Null);
Assert.That(lasc.GetMetadata(a1.ID), Is.Null);
// TODO: Add cache and check that this does receive a copy of the asset
}
}
}

View File

@ -63,7 +63,7 @@ namespace OpenSim.Region.DataSnapshot
public Hashtable OnGetSnapshot(Hashtable keysvals)
{
m_log.Info("[DATASNAPSHOT] Received collection request");
m_log.Debug("[DATASNAPSHOT] Received collection request");
Hashtable reply = new Hashtable();
int statuscode = 200;
@ -80,7 +80,7 @@ namespace OpenSim.Region.DataSnapshot
public Hashtable OnValidate(Hashtable keysvals)
{
m_log.Info("[DATASNAPSHOT] Received validation request");
m_log.Debug("[DATASNAPSHOT] Received validation request");
Hashtable reply = new Hashtable();
int statuscode = 200;

View File

@ -120,7 +120,7 @@ namespace OpenSim.Region.DataSnapshot
provider.Stale = false;
m_scenes[provider.GetParentScene] = true;
m_log.Info("[DATASNAPSHOT]: Generated fragment response for provider type " + provider.Name);
m_log.Debug("[DATASNAPSHOT]: Generated fragment response for provider type " + provider.Name);
}
else
{
@ -134,7 +134,7 @@ namespace OpenSim.Region.DataSnapshot
data = factory.ImportNode(node, true);
}
m_log.Info("[DATASNAPSHOT]: Retrieved fragment response for provider type " + provider.Name);
m_log.Debug("[DATASNAPSHOT]: Retrieved fragment response for provider type " + provider.Name);
}
return data;
@ -154,7 +154,7 @@ namespace OpenSim.Region.DataSnapshot
if (!m_scenes[scene])
{
m_log.Info("[DATASNAPSHOT]: Attempting to retrieve snapshot from cache.");
m_log.Debug("[DATASNAPSHOT]: Attempting to retrieve snapshot from cache.");
//get snapshot from cache
String path = DataFileNameScene(scene);
@ -168,11 +168,11 @@ namespace OpenSim.Region.DataSnapshot
regionElement = factory.ImportNode(node, true);
}
m_log.Info("[DATASNAPSHOT]: Obtained snapshot from cache for " + scene.RegionInfo.RegionName);
m_log.Debug("[DATASNAPSHOT]: Obtained snapshot from cache for " + scene.RegionInfo.RegionName);
}
else
{
m_log.Info("[DATASNAPSHOT]: Attempting to generate snapshot.");
m_log.Debug("[DATASNAPSHOT]: Attempting to generate snapshot.");
//make snapshot
regionElement = MakeRegionNode(scene, factory);
@ -211,7 +211,7 @@ namespace OpenSim.Region.DataSnapshot
m_scenes[scene] = false;
m_log.Info("[DATASNAPSHOT]: Generated new snapshot for " + scene.RegionInfo.RegionName);
m_log.Debug("[DATASNAPSHOT]: Generated new snapshot for " + scene.RegionInfo.RegionName);
}
return regionElement;

View File

@ -312,18 +312,22 @@ namespace OpenSim.Region.Framework.Scenes.Animation
buff.Append("dflt=");
buff.Append(DefaultAnimation.ToString());
buff.Append(",iDflt=");
if (DefaultAnimation == ImplicitDefaultAnimation)
if (DefaultAnimation.Equals(ImplicitDefaultAnimation))
buff.Append("same");
else
buff.Append(ImplicitDefaultAnimation.ToString());
if (m_animations.Count > 0)
{
buff.Append(",anims=");
bool firstTime = true;
foreach (OpenSim.Framework.Animation anim in m_animations)
{
if (!firstTime)
buff.Append(",");
buff.Append("<");
buff.Append(anim.ToString());
buff.Append(">,");
buff.Append(">");
firstTime = false;
}
}
return buff.ToString();

View File

@ -95,6 +95,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation
if (m_animations.Add(animID, m_scenePresence.ControllingClient.NextAnimationSequenceNumber, objectID))
{
SendAnimPack();
m_scenePresence.TriggerScenePresenceUpdated();
}
}
@ -136,6 +137,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation
if (m_animations.Remove(animID, allowNoDefault))
{
SendAnimPack();
m_scenePresence.TriggerScenePresenceUpdated();
}
}

View File

@ -1072,6 +1072,11 @@ namespace OpenSim.Region.Framework.Scenes
for (int i = 0; i < parts.Length; i++)
{
SceneObjectPart part = parts[i];
if (part.KeyframeMotion != null)
{
part.KeyframeMotion.UpdateSceneObject(this);
}
if (Object.ReferenceEquals(part, m_rootPart))
continue;

View File

@ -78,7 +78,7 @@ namespace OpenSim.Region.Framework.Scenes
// m_log.DebugFormat("[SCENE PRESENCE]: Destructor called on {0}", Name);
// }
private void TriggerScenePresenceUpdated()
public void TriggerScenePresenceUpdated()
{
if (m_scene != null)
m_scene.EventManager.TriggerScenePresenceUpdated(this);

View File

@ -168,10 +168,10 @@ public abstract class BSShape
if (prim.PrimAssetState == BSPhysObject.PrimAssetCondition.Fetched)
{
prim.PrimAssetState = BSPhysObject.PrimAssetCondition.FailedMeshing;
physicsScene.Logger.WarnFormat("{0} Fetched asset would not mesh. {1}, texture={2}",
LogHeader, prim.PhysObjectName, prim.BaseShape.SculptTexture);
physicsScene.DetailLog("{0},BSShape.VerifyMeshCreated,setFailed,objNam={1},tex={2}",
prim.LocalID, prim.PhysObjectName, prim.BaseShape.SculptTexture);
physicsScene.Logger.WarnFormat("{0} Fetched asset would not mesh. prim={1}, texture={2}",
LogHeader, UsefulPrimInfo(physicsScene, prim), prim.BaseShape.SculptTexture);
physicsScene.DetailLog("{0},BSShape.VerifyMeshCreated,setFailed,prim={1},tex={2}",
prim.LocalID, UsefulPrimInfo(physicsScene, prim), prim.BaseShape.SculptTexture);
}
else
{
@ -238,17 +238,17 @@ public abstract class BSShape
{
if (prim.PrimAssetState == BSPhysObject.PrimAssetCondition.FailedAssetFetch)
{
physicsScene.Logger.WarnFormat("{0} Mesh failed to fetch asset. obj={1}, texture={2}",
LogHeader, prim.PhysObjectName, prim.BaseShape.SculptTexture);
physicsScene.DetailLog("{0},BSShape.VerifyMeshCreated,wasFailed,objNam={1},tex={2}",
prim.LocalID, prim.PhysObjectName, prim.BaseShape.SculptTexture);
physicsScene.Logger.WarnFormat("{0} Mesh failed to fetch asset. prim={1}, texture={2}",
LogHeader, UsefulPrimInfo(physicsScene, prim), prim.BaseShape.SculptTexture);
physicsScene.DetailLog("{0},BSShape.VerifyMeshCreated,wasFailed,prim={1},tex={2}",
prim.LocalID, UsefulPrimInfo(physicsScene, prim), prim.BaseShape.SculptTexture);
}
if (prim.PrimAssetState == BSPhysObject.PrimAssetCondition.FailedMeshing)
{
physicsScene.Logger.WarnFormat("{0} Mesh asset would not mesh. obj={1}, texture={2}",
LogHeader, prim.PhysObjectName, prim.BaseShape.SculptTexture);
physicsScene.DetailLog("{0},BSShape.VerifyMeshCreated,wasFailedMeshing,objNam={1},tex={2}",
prim.LocalID, prim.PhysObjectName, prim.BaseShape.SculptTexture);
physicsScene.Logger.WarnFormat("{0} Mesh asset would not mesh. prim={1}, texture={2}",
LogHeader, UsefulPrimInfo(physicsScene, prim), prim.BaseShape.SculptTexture);
physicsScene.DetailLog("{0},BSShape.VerifyMeshCreated,wasFailedMeshing,prim={1},tex={2}",
prim.LocalID, UsefulPrimInfo(physicsScene, prim), prim.BaseShape.SculptTexture);
}
}
}
@ -260,6 +260,19 @@ public abstract class BSShape
return fillShape.physShapeInfo;
}
public static String UsefulPrimInfo(BSScene pScene, BSPhysObject prim)
{
StringBuilder buff = new StringBuilder(prim.PhysObjectName);
buff.Append("/pos=");
buff.Append(prim.RawPosition.ToString());
if (pScene != null)
{
buff.Append("/rgn=");
buff.Append(pScene.Name);
}
return buff.ToString();
}
#endregion // Common shape routines
}
@ -530,8 +543,7 @@ public class BSShapeMesh : BSShape
{
// Force the asset condition to 'failed' so we won't try to keep fetching and processing this mesh.
prim.PrimAssetState = BSPhysObject.PrimAssetCondition.FailedMeshing;
physicsScene.Logger.DebugFormat("{0} All mesh triangles degenerate. Prim {1} at {2} in {3}",
LogHeader, prim.PhysObjectName, prim.RawPosition, physicsScene.Name);
physicsScene.Logger.DebugFormat("{0} All mesh triangles degenerate. Prim={1}", LogHeader, UsefulPrimInfo(physicsScene, prim) );
physicsScene.DetailLog("{0},BSShapeMesh.CreatePhysicalMesh,allDegenerate,key={1}", prim.LocalID, newMeshKey);
}
}

View File

@ -1,5 +1,9 @@
CURRENT PROBLEMS TO FIX AND/OR LOOK AT
=================================================
Vehicle buoyancy. Computed correctly? Possibly creating very large effective mass.
Interaction of llSetBuoyancy and vehicle buoyancy. Should be additive?
Negative buoyancy computed correctly
Computation of mesh mass. How done? How should it be done?
Script changing rotation of child prim while vehicle moving (eg turning wheel) causes
the wheel to appear to jump back. Looks like sending position from previous update.
Enable vehicle border crossings (at least as poorly as ODE)

View File

@ -155,7 +155,7 @@ namespace OpenSim.Server.Handlers.Asset
}
catch (Exception e)
{
m_log.DebugFormat("[XINVENTORY HANDLER]: Exception {0}", e.StackTrace);
m_log.ErrorFormat("[XINVENTORY HANDLER]: Exception {0}", e.StackTrace);
}
return FailureResult();

View File

@ -84,6 +84,30 @@ namespace OpenSim.Services.Connectors
m_ServerURI = serviceURI;
}
private bool CheckReturn(Dictionary<string, object> ret)
{
if (ret == null)
return false;
if (ret.Count == 0)
return false;
if (ret.ContainsKey("RESULT"))
{
if (ret["RESULT"] is string)
{
bool result;
if (bool.TryParse((string)ret["RESULT"], out result))
return result;
return false;
}
}
return true;
}
public bool CreateUserInventory(UUID principalID)
{
Dictionary<string,object> ret = MakeRequest("CREATEUSERINVENTORY",
@ -91,12 +115,7 @@ namespace OpenSim.Services.Connectors
{ "PRINCIPAL", principalID.ToString() }
});
if (ret == null)
return false;
if (ret.Count == 0)
return false;
return bool.Parse(ret["RESULT"].ToString());
return CheckReturn(ret);
}
public List<InventoryFolderBase> GetInventorySkeleton(UUID principalID)
@ -106,9 +125,7 @@ namespace OpenSim.Services.Connectors
{ "PRINCIPAL", principalID.ToString() }
});
if (ret == null)
return null;
if (ret.Count == 0)
if (!CheckReturn(ret))
return null;
Dictionary<string, object> folders = (Dictionary<string, object>)ret["FOLDERS"];
@ -135,9 +152,7 @@ namespace OpenSim.Services.Connectors
{ "PRINCIPAL", principalID.ToString() }
});
if (ret == null)
return null;
if (ret.Count == 0)
if (!CheckReturn(ret))
return null;
return BuildFolder((Dictionary<string, object>)ret["folder"]);
@ -151,9 +166,7 @@ namespace OpenSim.Services.Connectors
{ "TYPE", ((int)type).ToString() }
});
if (ret == null)
return null;
if (ret.Count == 0)
if (!CheckReturn(ret))
return null;
return BuildFolder((Dictionary<string, object>)ret["folder"]);
@ -174,9 +187,7 @@ namespace OpenSim.Services.Connectors
{ "FOLDER", folderID.ToString() }
});
if (ret == null)
return null;
if (ret.Count == 0)
if (!CheckReturn(ret))
return null;
Dictionary<string,object> folders =
@ -205,9 +216,7 @@ namespace OpenSim.Services.Connectors
{ "FOLDER", folderID.ToString() }
});
if (ret == null)
return null;
if (ret.Count == 0)
if (!CheckReturn(ret))
return null;
Dictionary<string, object> items = (Dictionary<string, object>)ret["ITEMS"];
@ -230,10 +239,7 @@ namespace OpenSim.Services.Connectors
{ "ID", folder.ID.ToString() }
});
if (ret == null)
return false;
return bool.Parse(ret["RESULT"].ToString());
return CheckReturn(ret);
}
public bool UpdateFolder(InventoryFolderBase folder)
@ -248,10 +254,7 @@ namespace OpenSim.Services.Connectors
{ "ID", folder.ID.ToString() }
});
if (ret == null)
return false;
return bool.Parse(ret["RESULT"].ToString());
return CheckReturn(ret);
}
public bool MoveFolder(InventoryFolderBase folder)
@ -263,10 +266,7 @@ namespace OpenSim.Services.Connectors
{ "PRINCIPAL", folder.Owner.ToString() }
});
if (ret == null)
return false;
return bool.Parse(ret["RESULT"].ToString());
return CheckReturn(ret);
}
public bool DeleteFolders(UUID principalID, List<UUID> folderIDs)
@ -282,10 +282,7 @@ namespace OpenSim.Services.Connectors
{ "FOLDERS", slist }
});
if (ret == null)
return false;
return bool.Parse(ret["RESULT"].ToString());
return CheckReturn(ret);
}
public bool PurgeFolder(InventoryFolderBase folder)
@ -295,10 +292,7 @@ namespace OpenSim.Services.Connectors
{ "ID", folder.ID.ToString() }
});
if (ret == null)
return false;
return bool.Parse(ret["RESULT"].ToString());
return CheckReturn(ret);
}
public bool AddItem(InventoryItemBase item)
@ -330,10 +324,7 @@ namespace OpenSim.Services.Connectors
{ "CreationDate", item.CreationDate.ToString() }
});
if (ret == null)
return false;
return bool.Parse(ret["RESULT"].ToString());
return CheckReturn(ret);
}
public bool UpdateItem(InventoryItemBase item)
@ -365,10 +356,7 @@ namespace OpenSim.Services.Connectors
{ "CreationDate", item.CreationDate.ToString() }
});
if (ret == null)
return false;
return bool.Parse(ret["RESULT"].ToString());
return CheckReturn(ret);
}
public bool MoveItems(UUID principalID, List<InventoryItemBase> items)
@ -389,10 +377,7 @@ namespace OpenSim.Services.Connectors
{ "DESTLIST", destlist }
});
if (ret == null)
return false;
return bool.Parse(ret["RESULT"].ToString());
return CheckReturn(ret);
}
public bool DeleteItems(UUID principalID, List<UUID> itemIDs)
@ -408,10 +393,7 @@ namespace OpenSim.Services.Connectors
{ "ITEMS", slist }
});
if (ret == null)
return false;
return bool.Parse(ret["RESULT"].ToString());
return CheckReturn(ret);
}
public InventoryItemBase GetItem(InventoryItemBase item)
@ -423,9 +405,7 @@ namespace OpenSim.Services.Connectors
{ "ID", item.ID.ToString() }
});
if (ret == null)
return null;
if (ret.Count == 0)
if (!CheckReturn(ret))
return null;
return BuildItem((Dictionary<string, object>)ret["item"]);
@ -447,9 +427,7 @@ namespace OpenSim.Services.Connectors
{ "ID", folder.ID.ToString() }
});
if (ret == null)
return null;
if (ret.Count == 0)
if (!CheckReturn(ret))
return null;
return BuildFolder((Dictionary<string, object>)ret["folder"]);
@ -469,7 +447,7 @@ namespace OpenSim.Services.Connectors
{ "PRINCIPAL", principalID.ToString() }
});
if (ret == null)
if (!CheckReturn(ret))
return null;
List<InventoryItemBase> items = new List<InventoryItemBase>();
@ -488,10 +466,22 @@ namespace OpenSim.Services.Connectors
{ "ASSET", assetID.ToString() }
});
// We cannot use CheckReturn() here because valid values for RESULT are "false" (in the case of request failure) or an int
if (ret == null)
return 0;
return int.Parse(ret["RESULT"].ToString());
if (ret.ContainsKey("RESULT"))
{
if (ret["RESULT"] is string)
{
int intResult;
if (int.TryParse ((string)ret["RESULT"], out intResult))
return intResult;
}
}
return 0;
}
public InventoryCollection GetUserInventory(UUID principalID)
@ -508,9 +498,7 @@ namespace OpenSim.Services.Connectors
{ "PRINCIPAL", principalID.ToString() }
});
if (ret == null)
return null;
if (ret.Count == 0)
if (!CheckReturn(ret))
return null;
Dictionary<string, object> folders =

View File

@ -115,6 +115,12 @@ namespace OpenSim.Services.HypergridService
{
XInventoryFolder suitcase = GetSuitcaseXFolder(principalID);
if (suitcase == null)
{
m_log.WarnFormat("[HG SUITCASE INVENTORY SERVICE]: Found no suitcase folder for user {0} when looking for inventory skeleton", principalID);
return null;
}
List<XInventoryFolder> tree = GetFolderTree(principalID, suitcase.folderID);
if (tree == null || (tree != null && tree.Count == 0))
return null;
@ -134,6 +140,7 @@ namespace OpenSim.Services.HypergridService
public override InventoryCollection GetUserInventory(UUID userID)
{
m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: Get Suitcase inventory for user {0}", userID);
InventoryCollection userInventory = new InventoryCollection();
userInventory.UserID = userID;
userInventory.Folders = new List<InventoryFolderBase>();
@ -141,6 +148,12 @@ namespace OpenSim.Services.HypergridService
XInventoryFolder suitcase = GetSuitcaseXFolder(userID);
if (suitcase == null)
{
m_log.WarnFormat("[HG SUITCASE INVENTORY SERVICE]: Found no suitcase folder for user {0} when looking for user inventory", userID);
return null;
}
List<XInventoryFolder> tree = GetFolderTree(userID, suitcase.folderID);
if (tree == null || (tree != null && tree.Count == 0))
{
@ -182,7 +195,8 @@ namespace OpenSim.Services.HypergridService
m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: GetRootFolder for {0}", principalID);
// Let's find out the local root folder
XInventoryFolder root = GetRootXFolder(principalID); ;
XInventoryFolder root = GetRootXFolder(principalID);
if (root == null)
{
m_log.WarnFormat("[HG SUITCASE INVENTORY SERVICE]: Unable to retrieve local root folder for user {0}", principalID);
@ -255,6 +269,13 @@ namespace OpenSim.Services.HypergridService
{
//m_log.DebugFormat("[HG INVENTORY SERVICE]: GetFolderForType for {0} {0}", principalID, type);
XInventoryFolder suitcase = GetSuitcaseXFolder(principalID);
if (suitcase == null)
{
m_log.WarnFormat("[HG SUITCASE INVENTORY SERVICE]: Found no suitcase folder for user {0} when looking for child type folder {1}", principalID, type);
return null;
}
XInventoryFolder[] folders = m_Database.GetFolders(
new string[] { "agentID", "type", "parentFolderID" },
new string[] { principalID.ToString(), ((int)type).ToString(), suitcase.folderID.ToString() });
@ -546,6 +567,7 @@ namespace OpenSim.Services.HypergridService
private bool IsWithinSuitcaseTree(UUID principalID, UUID folderID)
{
XInventoryFolder suitcase = GetSuitcaseXFolder(principalID);
if (suitcase == null)
{
m_log.WarnFormat("[HG SUITCASE INVENTORY SERVICE]: User {0} does not have a Suitcase folder", principalID);