From f42d085ab17098709bcba0c816c9742a213d3c01 Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Wed, 16 Sep 2009 15:06:08 -0700 Subject: SceneObjectGroup cleanup. Removes the default constructor and unnecessary null checks on m_rootPart --- OpenSim/Data/NHibernate/NHibernateRegionData.cs | 32 ++++-- OpenSim/Data/SQLite/SQLiteRegionData.cs | 3 +- OpenSim/Data/Tests/BasicRegionTest.cs | 6 +- .../Region/Examples/SimpleModule/ComplexObject.cs | 4 - .../Region/Framework/Scenes/SceneObjectGroup.cs | 110 ++++++--------------- .../Scenes/Serialization/SceneObjectSerializer.cs | 53 +++++----- .../Framework/Scenes/Tests/EntityManagerTests.cs | 4 +- .../Framework/Scenes/Tests/ScenePresenceTests.cs | 3 +- .../ContentManagementSystem/PointMetaEntity.cs | 3 +- 9 files changed, 78 insertions(+), 140 deletions(-) diff --git a/OpenSim/Data/NHibernate/NHibernateRegionData.cs b/OpenSim/Data/NHibernate/NHibernateRegionData.cs index 26ec500..673ca6f 100644 --- a/OpenSim/Data/NHibernate/NHibernateRegionData.cs +++ b/OpenSim/Data/NHibernate/NHibernateRegionData.cs @@ -178,25 +178,38 @@ namespace OpenSim.Data.NHibernate private SceneObjectGroup LoadObject(UUID uuid, UUID region) { - SceneObjectGroup group = new SceneObjectGroup(); - ICriteria criteria = manager.GetSession().CreateCriteria(typeof(SceneObjectPart)); criteria.Add(Expression.Eq("RegionID", region)); criteria.Add(Expression.Eq("ParentUUID", uuid)); criteria.AddOrder(Order.Asc("ParentID")); - foreach (SceneObjectPart p in criteria.List()) + IList parts = criteria.List(); + + SceneObjectGroup group = null; + + // Find the root part + for (int i = 0; i < parts.Count; i++) { - // root part - if (p.UUID == uuid) + if (parts[i].UUID == uuid) { - group.SetRootPart(p); + group = new SceneObjectGroup(parts[i]); + break; } - else + } + + // Add the children parts + if (group != null) + { + for (int i = 0; i < parts.Count; i++) { - group.AddPart(p); + if (parts[i].UUID != uuid) + group.AddPart(parts[i]); } } + else + { + m_log.Error("[NHIBERNATE]: LoadObject() Attempted to load a SceneObjectGroup with no root SceneObjectPart "); + } return group; } @@ -237,8 +250,7 @@ namespace OpenSim.Data.NHibernate // root part if (p.UUID == p.ParentUUID) { - SceneObjectGroup group = new SceneObjectGroup(); - group.SetRootPart(p); + SceneObjectGroup group = new SceneObjectGroup(p); SOG.Add(p.ParentUUID, group); } else diff --git a/OpenSim/Data/SQLite/SQLiteRegionData.cs b/OpenSim/Data/SQLite/SQLiteRegionData.cs index 0259ac5..ea076fe 100644 --- a/OpenSim/Data/SQLite/SQLiteRegionData.cs +++ b/OpenSim/Data/SQLite/SQLiteRegionData.cs @@ -416,7 +416,6 @@ namespace OpenSim.Data.SQLite if (uuid == objID) //is new SceneObjectGroup ? { - SceneObjectGroup group = new SceneObjectGroup(); prim = buildPrim(primRow); DataRow shapeRow = shapes.Rows.Find(prim.UUID.ToString()); if (shapeRow != null) @@ -430,7 +429,7 @@ namespace OpenSim.Data.SQLite prim.Shape = PrimitiveBaseShape.Default; } - group.SetRootPart(prim); + SceneObjectGroup group = new SceneObjectGroup(prim); createdObjects.Add(group.UUID, group); retvals.Add(group); LoadItems(prim); diff --git a/OpenSim/Data/Tests/BasicRegionTest.cs b/OpenSim/Data/Tests/BasicRegionTest.cs index 8474921..c66ab7c 100644 --- a/OpenSim/Data/Tests/BasicRegionTest.cs +++ b/OpenSim/Data/Tests/BasicRegionTest.cs @@ -322,9 +322,8 @@ namespace OpenSim.Data.Tests // This is necessary or object will not be inserted in DB sop.ObjectFlags = 0; - SceneObjectGroup sog = new SceneObjectGroup(); + SceneObjectGroup sog = new SceneObjectGroup(sop); sog.SetScene(scene); // Reguired by nhibernate database module. - sog.SetRootPart(sop); // Inserts group in DB db.StoreObject(sog,region3); @@ -1003,9 +1002,8 @@ namespace OpenSim.Data.Tests sop.UUID = uuid; sop.Shape = PrimitiveBaseShape.Default; - SceneObjectGroup sog = new SceneObjectGroup(); + SceneObjectGroup sog = new SceneObjectGroup(sop); sog.SetScene(scene); - sog.SetRootPart(sop); return sog; } diff --git a/OpenSim/Region/Examples/SimpleModule/ComplexObject.cs b/OpenSim/Region/Examples/SimpleModule/ComplexObject.cs index f9c3fa6..3809749 100644 --- a/OpenSim/Region/Examples/SimpleModule/ComplexObject.cs +++ b/OpenSim/Region/Examples/SimpleModule/ComplexObject.cs @@ -73,10 +73,6 @@ namespace OpenSim.Region.Examples.SimpleModule base.UpdateMovement(); } - public ComplexObject() - { - } - public ComplexObject(Scene scene, ulong regionHandle, UUID ownerID, uint localID, Vector3 pos) : base(ownerID, pos, PrimitiveBaseShape.Default) { diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 6ba7e41..3c17bbe 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -250,16 +250,7 @@ namespace OpenSim.Region.Framework.Scenes /// public override Vector3 AbsolutePosition { - get - { - if (m_rootPart == null) - { - throw new NullReferenceException( - string.Format("[SCENE OBJECT GROUP]: Object {0} has no root part.", m_uuid)); - } - - return m_rootPart.GroupPosition; - } + get { return m_rootPart.GroupPosition; } set { Vector3 val = value; @@ -291,41 +282,19 @@ namespace OpenSim.Region.Framework.Scenes public override uint LocalId { - get - { - if (m_rootPart == null) - { - m_log.Error("[SCENE OBJECT GROUP]: Unable to find the rootpart for a LocalId Request!"); - return 0; - } - - return m_rootPart.LocalId; - } + get { return m_rootPart.LocalId; } set { m_rootPart.LocalId = value; } } public override UUID UUID { - get { - if (m_rootPart == null) - { - m_log.Error("Got a null rootpart while requesting UUID. Called from: ", new Exception()); - return UUID.Zero; - } - else return m_rootPart.UUID; - } + get { return m_rootPart.UUID; } set { m_rootPart.UUID = value; } } public UUID OwnerID { - get - { - if (m_rootPart == null) - return UUID.Zero; - - return m_rootPart.OwnerID; - } + get { return m_rootPart.OwnerID; } set { m_rootPart.OwnerID = value; } } @@ -366,7 +335,7 @@ namespace OpenSim.Region.Framework.Scenes { m_isSelected = value; // Tell physics engine that group is selected - if (m_rootPart != null && m_rootPart.PhysActor != null) + if (m_rootPart.PhysActor != null) { m_rootPart.PhysActor.Selected = value; // Pass it on to the children. @@ -399,13 +368,6 @@ namespace OpenSim.Region.Framework.Scenes #region Constructors /// - /// Constructor - /// - public SceneObjectGroup() - { - } - - /// /// This constructor creates a SceneObjectGroup using a pre-existing SceneObjectPart. /// The original SceneObjectPart will be used rather than a copy, preserving /// its existing localID and UUID. @@ -419,9 +381,8 @@ namespace OpenSim.Region.Framework.Scenes /// Constructor. This object is added to the scene later via AttachToScene() /// public SceneObjectGroup(UUID ownerID, Vector3 pos, Quaternion rot, PrimitiveBaseShape shape) - { - Vector3 rootOffset = new Vector3(0, 0, 0); - SetRootPart(new SceneObjectPart(ownerID, shape, pos, rot, rootOffset)); + { + SetRootPart(new SceneObjectPart(ownerID, shape, pos, rot, Vector3.Zero)); } /// @@ -462,11 +423,7 @@ namespace OpenSim.Region.Framework.Scenes public UUID GetFromItemID() { - if (m_rootPart != null) - { - return m_rootPart.FromItemID; - } - return UUID.Zero; + return m_rootPart.FromItemID; } /// @@ -958,11 +915,7 @@ namespace OpenSim.Region.Framework.Scenes public byte GetAttachmentPoint() { - if (m_rootPart != null) - { - return m_rootPart.Shape.State; - } - return (byte)0; + return m_rootPart.Shape.State; } public void ClearPartAttachmentData() @@ -1071,7 +1024,10 @@ namespace OpenSim.Region.Framework.Scenes /// /// public void SetRootPart(SceneObjectPart part) - { + { + if (part == null) + throw new ArgumentNullException("Cannot give SceneObjectGroup a null root SceneObjectPart"); + part.SetParent(this); m_rootPart = part; if (!IsAttachment) @@ -1224,7 +1180,7 @@ namespace OpenSim.Region.Framework.Scenes if (!silent) { - if (m_rootPart != null && part == m_rootPart) + if (part == m_rootPart) avatars[i].ControllingClient.SendKillObject(m_regionHandle, part.LocalId); } } @@ -1447,7 +1403,7 @@ namespace OpenSim.Region.Framework.Scenes /// internal void SendPartFullUpdate(IClientAPI remoteClient, SceneObjectPart part, uint clientFlags) { - if (m_rootPart != null && m_rootPart.UUID == part.UUID) + if (m_rootPart.UUID == part.UUID) { if (IsAttachment) { @@ -1881,12 +1837,6 @@ namespace OpenSim.Region.Framework.Scenes if (m_isDeleted) return; - // This is what happens when an orphanced link set child prim's - // group was queued when it was linked - // - if (m_rootPart == null) - return; - // Even temporary objects take part in physics (e.g. temp-on-rez bullets) //if ((RootPart.Flags & PrimFlags.TemporaryOnRez) != 0) // return; @@ -3129,26 +3079,22 @@ namespace OpenSim.Region.Framework.Scenes int yaxis = 4; int zaxis = 8; - if (m_rootPart != null) - { - setX = ((axis & xaxis) != 0) ? true : false; - setY = ((axis & yaxis) != 0) ? true : false; - setZ = ((axis & zaxis) != 0) ? true : false; + setX = ((axis & xaxis) != 0) ? true : false; + setY = ((axis & yaxis) != 0) ? true : false; + setZ = ((axis & zaxis) != 0) ? true : false; - float setval = (rotate10 > 0) ? 1f : 0f; + float setval = (rotate10 > 0) ? 1f : 0f; - if (setX) - m_rootPart.RotationAxis.X = setval; - if (setY) - m_rootPart.RotationAxis.Y = setval; - if (setZ) - m_rootPart.RotationAxis.Z = setval; - - if (setX || setY || setZ) - { - m_rootPart.SetPhysicsAxisRotation(); - } + if (setX) + m_rootPart.RotationAxis.X = setval; + if (setY) + m_rootPart.RotationAxis.Y = setval; + if (setZ) + m_rootPart.RotationAxis.Z = setval; + if (setX || setY || setZ) + { + m_rootPart.SetPhysicsAxisRotation(); } } diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs index 5ae81cd..fe74158 100644 --- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs +++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs @@ -65,8 +65,6 @@ namespace OpenSim.Region.Framework.Scenes.Serialization //m_log.DebugFormat("[SOG]: Starting deserialization of SOG"); //int time = System.Environment.TickCount; - SceneObjectGroup sceneObject = new SceneObjectGroup(); - // libomv.types changes UUID to Guid xmlData = xmlData.Replace("", ""); xmlData = xmlData.Replace("", ""); @@ -88,17 +86,13 @@ namespace OpenSim.Region.Framework.Scenes.Serialization parts = doc.GetElementsByTagName("RootPart"); if (parts.Count == 0) - { throw new Exception("Invalid Xml format - no root part"); - } - else - { - sr = new StringReader(parts[0].InnerXml); - reader = new XmlTextReader(sr); - sceneObject.SetRootPart(SceneObjectPart.FromXml(fromUserInventoryItemID, reader)); - reader.Close(); - sr.Close(); - } + + sr = new StringReader(parts[0].InnerXml); + reader = new XmlTextReader(sr); + SceneObjectGroup sceneObject = new SceneObjectGroup(SceneObjectPart.FromXml(fromUserInventoryItemID, reader)); + reader.Close(); + sr.Close(); parts = doc.GetElementsByTagName("Part"); @@ -119,16 +113,15 @@ namespace OpenSim.Region.Framework.Scenes.Serialization // Script state may, or may not, exist. Not having any, is NOT // ever a problem. sceneObject.LoadScriptState(doc); + + return sceneObject; } catch (Exception e) { m_log.ErrorFormat( "[SERIALIZER]: Deserialization of xml failed with {0}. xml was {1}", e, xmlData); + return null; } - - //m_log.DebugFormat("[SERIALIZER]: Finished deserialization of SOG {0}, {1}ms", Name, System.Environment.TickCount - time); - - return sceneObject; } /// @@ -194,8 +187,6 @@ namespace OpenSim.Region.Framework.Scenes.Serialization { //m_log.DebugFormat("[SOG]: Starting deserialization of SOG"); //int time = System.Environment.TickCount; - - SceneObjectGroup sceneObject = new SceneObjectGroup(); // libomv.types changes UUID to Guid xmlData = xmlData.Replace("", ""); @@ -212,21 +203,23 @@ namespace OpenSim.Region.Framework.Scenes.Serialization XmlNodeList parts = doc.GetElementsByTagName("SceneObjectPart"); - // Process the root part first - if (parts.Count > 0) + if (parts.Count == 0) { - StringReader sr = new StringReader(parts[0].OuterXml); - XmlTextReader reader = new XmlTextReader(sr); - sceneObject.SetRootPart(SceneObjectPart.FromXml(reader)); - reader.Close(); - sr.Close(); + m_log.ErrorFormat("[SERIALIZER]: Deserialization of xml failed: No SceneObjectPart nodes. xml was " + xmlData); + return null; } + StringReader sr = new StringReader(parts[0].OuterXml); + XmlTextReader reader = new XmlTextReader(sr); + SceneObjectGroup sceneObject = new SceneObjectGroup(SceneObjectPart.FromXml(reader)); + reader.Close(); + sr.Close(); + // Then deal with the rest for (int i = 1; i < parts.Count; i++) { - StringReader sr = new StringReader(parts[i].OuterXml); - XmlTextReader reader = new XmlTextReader(sr); + sr = new StringReader(parts[i].OuterXml); + reader = new XmlTextReader(sr); SceneObjectPart part = SceneObjectPart.FromXml(reader); sceneObject.AddPart(part); part.StoreUndoState(); @@ -238,15 +231,13 @@ namespace OpenSim.Region.Framework.Scenes.Serialization // ever a problem. sceneObject.LoadScriptState(doc); + return sceneObject; } catch (Exception e) { m_log.ErrorFormat("[SERIALIZER]: Deserialization of xml failed with {0}. xml was {1}", e, xmlData); + return null; } - - //m_log.DebugFormat("[SERIALIZER]: Finished deserialization of SOG {0}, {1}ms", Name, System.Environment.TickCount - time); - - return sceneObject; } /// diff --git a/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs b/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs index bb8f27d..3b0e77f 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs @@ -128,7 +128,6 @@ namespace OpenSim.Region.Framework.Scenes.Tests private SceneObjectGroup NewSOG() { - SceneObjectGroup sog = new SceneObjectGroup(); SceneObjectPart sop = new SceneObjectPart(UUID.Random(), PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero); sop.Name = RandomName(); sop.Description = sop.Name; @@ -136,9 +135,8 @@ namespace OpenSim.Region.Framework.Scenes.Tests sop.SitName = RandomName(); sop.TouchName = RandomName(); sop.ObjectFlags |= (uint)PrimFlags.Phantom; - - sog.SetRootPart(sop); + SceneObjectGroup sog = new SceneObjectGroup(sop); scene.AddNewSceneObject(sog, false); return sog; diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs index 7fb2d25..19c0fea 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs @@ -407,9 +407,8 @@ namespace OpenSim.Region.Framework.Scenes.Tests sop.Shape.State = 1; sop.OwnerID = agent; - SceneObjectGroup sog = new SceneObjectGroup(); + SceneObjectGroup sog = new SceneObjectGroup(sop); sog.SetScene(scene); - sog.SetRootPart(sop); return sog; } diff --git a/OpenSim/Region/OptionalModules/ContentManagementSystem/PointMetaEntity.cs b/OpenSim/Region/OptionalModules/ContentManagementSystem/PointMetaEntity.cs index 59b7289..fbe43d6 100644 --- a/OpenSim/Region/OptionalModules/ContentManagementSystem/PointMetaEntity.cs +++ b/OpenSim/Region/OptionalModules/ContentManagementSystem/PointMetaEntity.cs @@ -66,7 +66,6 @@ namespace OpenSim.Region.OptionalModules.ContentManagement private void CreatePointEntity(Scene scene, UUID uuid, Vector3 groupPos) { - SceneObjectGroup x = new SceneObjectGroup(); SceneObjectPart y = new SceneObjectPart(); //Initialize part @@ -93,8 +92,8 @@ namespace OpenSim.Region.OptionalModules.ContentManagement y.TrimPermissions(); //Initialize group and add part as root part + SceneObjectGroup x = new SceneObjectGroup(y); x.SetScene(scene); - x.SetRootPart(y); x.RegionHandle = scene.RegionInfo.RegionHandle; x.SetScene(scene); -- cgit v1.1 From 69ef95693ae6451e2c754b22190557f3bf15777b Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 17 Sep 2009 15:38:17 +0100 Subject: Thank you, mcortez, for a patch to address showing users in group list Removed patch 0005, which was unrelated and likely accidental, and further didn't apply. --- .../Avatar/XmlRpcGroups/GroupsModule.cs | 102 +++++++++++++++------ .../XmlRpcGroupsServicesConnectorModule.cs | 42 ++++++--- 2 files changed, 100 insertions(+), 44 deletions(-) diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs index 37e1ed4..d5cbfd4 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs @@ -281,7 +281,10 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups private void OnRequestAvatarProperties(IClientAPI remoteClient, UUID avatarID) { - GroupMembershipData[] avatarGroups = m_groupData.GetAgentGroupMemberships(GetClientGroupRequestID(remoteClient), avatarID).ToArray(); + if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); + + //GroupMembershipData[] avatarGroups = m_groupData.GetAgentGroupMemberships(GetClientGroupRequestID(remoteClient), avatarID).ToArray(); + GroupMembershipData[] avatarGroups = GetProfileListedGroupMemberships(remoteClient, avatarID); remoteClient.SendAvatarGroupsReply(avatarID, avatarGroups); } @@ -485,6 +488,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups bucket[18] = 0; //dunno } + m_groupData.AddGroupNotice(GetClientGroupRequestID(remoteClient), GroupID, NoticeID, im.fromAgentName, Subject, Message, bucket); if (OnNewGroupNotice != null) { @@ -494,7 +498,20 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups // Send notice out to everyone that wants notices foreach (GroupMembersData member in m_groupData.GetGroupMembers(GetClientGroupRequestID(remoteClient), GroupID)) { - if (member.AcceptNotices) + if (m_debugEnabled) + { + UserProfileData targetUserProfile = m_sceneList[0].CommsManager.UserService.GetUserProfile(member.AgentID); + if (targetUserProfile != null) + { + m_log.DebugFormat("[GROUPS]: Prepping group notice {0} for agent: {1} who Accepts Notices ({2})", NoticeID, targetUserProfile.Name, member.AcceptNotices); + } + else + { + m_log.DebugFormat("[GROUPS]: Prepping group notice {0} for agent: {1} who Accepts Notices ({2})", NoticeID, member.AgentID, member.AcceptNotices); + } + } + + if (member.AcceptNotices) { // Build notice IIM GridInstantMessage msg = CreateGroupNoticeIM(UUID.Zero, NoticeID, (byte)OpenMetaverse.InstantMessageDialog.GroupNotice); @@ -614,13 +631,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); List data = m_groupData.GetGroupMembers(GetClientGroupRequestID(remoteClient), groupID); - if (m_debugEnabled) - { - foreach (GroupMembersData member in data) - { - m_log.DebugFormat("[GROUPS]: {0} {1}", member.AgentID, member.Title); - } - } return data; @@ -632,14 +642,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups List data = m_groupData.GetGroupRoles(GetClientGroupRequestID(remoteClient), groupID); - if (m_debugEnabled) - { - foreach (GroupRolesData member in data) - { - m_log.DebugFormat("[GROUPS]: {0} {1}", member.Title, member.Members); - } - } - return data; } @@ -650,14 +652,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups List data = m_groupData.GetGroupRoleMembers(GetClientGroupRequestID(remoteClient), groupID); - if (m_debugEnabled) - { - foreach (GroupRoleMembersData member in data) - { - m_log.DebugFormat("[GROUPS]: Av: {0} Role: {1}", member.MemberID, member.RoleID); - } - } - return data; @@ -808,7 +802,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups { if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); - // TODO: Security Checks? + // Security Checks are handled in the Groups Service. GroupRequestID grID = GetClientGroupRequestID(remoteClient); @@ -825,6 +819,11 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups case OpenMetaverse.GroupRoleUpdate.UpdateAll: case OpenMetaverse.GroupRoleUpdate.UpdateData: case OpenMetaverse.GroupRoleUpdate.UpdatePowers: + if (m_debugEnabled) + { + GroupPowers gp = (GroupPowers)powers; + m_log.DebugFormat("[GROUPS]: Role ({0}) updated with Powers ({1}) ({2})", name, powers.ToString(), gp.ToString()); + } m_groupData.UpdateGroupRole(grID, groupID, roleID, name, description, title, powers); break; @@ -1195,6 +1194,16 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups foreach (GroupMembershipData membership in data) { + if (remoteClient.AgentId != dataForAgentID) + { + if (!membership.ListInProfile) + { + // If we're sending group info to remoteclient about another agent, + // filter out groups the other agent doesn't want to share. + continue; + } + } + OSDMap GroupDataMap = new OSDMap(6); OSDMap NewGroupDataMap = new OSDMap(1); @@ -1281,11 +1290,46 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups // to the core Groups Stub remoteClient.SendGroupMembership(new GroupMembershipData[0]); - GroupMembershipData[] membershipData = m_groupData.GetAgentGroupMemberships(GetClientGroupRequestID(remoteClient), dataForAgentID).ToArray(); + GroupMembershipData[] membershipArray = GetProfileListedGroupMemberships(remoteClient, dataForAgentID); + SendGroupMembershipInfoViaCaps(remoteClient, dataForAgentID, membershipArray); + remoteClient.SendAvatarGroupsReply(dataForAgentID, membershipArray); - SendGroupMembershipInfoViaCaps(remoteClient, dataForAgentID, membershipData); - remoteClient.SendAvatarGroupsReply(dataForAgentID, membershipData); + } + + /// + /// Get a list of groups memberships for the agent that are marked "ListInProfile" + /// + /// + /// + private GroupMembershipData[] GetProfileListedGroupMemberships(IClientAPI requestingClient, UUID dataForAgentID) + { + List membershipData = m_groupData.GetAgentGroupMemberships(GetClientGroupRequestID(requestingClient), dataForAgentID); + GroupMembershipData[] membershipArray; + + if (requestingClient.AgentId != dataForAgentID) + { + Predicate showInProfile = delegate(GroupMembershipData membership) + { + return membership.ListInProfile; + }; + + membershipArray = membershipData.FindAll(showInProfile).ToArray(); + } + else + { + membershipArray = membershipData.ToArray(); + } + + if (m_debugEnabled) + { + m_log.InfoFormat("[GROUPS]: Get group membership information for {0} requested by {1}", dataForAgentID, requestingClient.AgentId); + foreach (GroupMembershipData membership in membershipArray) + { + m_log.InfoFormat("[GROUPS]: {0} :: {1} - {2}", dataForAgentID, membership.GroupName, membership.GroupTitle); + } + } + return membershipArray; } private void SendAgentDataUpdate(IClientAPI remoteClient, UUID dataForAgentID, UUID activeGroupID, string activeGroupName, ulong activeGroupPowers, string activeGroupTitle) diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs index b3eaa37..805c3d4 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs @@ -855,16 +855,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups IList parameters = new ArrayList(); parameters.Add(param); - XmlRpcRequest req; - if (!m_disableKeepAlive) - { - req = new XmlRpcRequest(function, parameters); - } - else - { - // This seems to solve a major problem on some windows servers - req = new NoKeepAliveXmlRpcRequest(function, parameters); - } + ConfigurableKeepAliveXmlRpcRequest req; + req = new ConfigurableKeepAliveXmlRpcRequest(function, parameters, m_disableKeepAlive); XmlRpcResponse resp = null; @@ -874,10 +866,16 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups } catch (Exception e) { + + m_log.ErrorFormat("[XMLRPCGROUPDATA]: An error has occured while attempting to access the XmlRpcGroups server method: {0}", function); m_log.ErrorFormat("[XMLRPCGROUPDATA]: {0} ", e.ToString()); - + foreach( string ResponseLine in req.RequestResponse.Split(new string[] { Environment.NewLine },StringSplitOptions.None)) + { + m_log.ErrorFormat("[XMLRPCGROUPDATA]: {0} ", ResponseLine); + } + foreach (string key in param.Keys) { m_log.WarnFormat("[XMLRPCGROUPDATA]: {0} :: {1}", key, param[key].ToString()); @@ -961,20 +959,24 @@ namespace Nwc.XmlRpc using System.Reflection; /// Class supporting the request side of an XML-RPC transaction. - public class NoKeepAliveXmlRpcRequest : XmlRpcRequest + public class ConfigurableKeepAliveXmlRpcRequest : XmlRpcRequest { private Encoding _encoding = new ASCIIEncoding(); private XmlRpcRequestSerializer _serializer = new XmlRpcRequestSerializer(); private XmlRpcResponseDeserializer _deserializer = new XmlRpcResponseDeserializer(); + private bool _disableKeepAlive = true; + + public string RequestResponse = String.Empty; /// Instantiate an XmlRpcRequest for a specified method and parameters. /// String designating the object.method on the server the request /// should be directed to. /// ArrayList of XML-RPC type parameters to invoke the request with. - public NoKeepAliveXmlRpcRequest(String methodName, IList parameters) + public ConfigurableKeepAliveXmlRpcRequest(String methodName, IList parameters, bool disableKeepAlive) { MethodName = methodName; _params = parameters; + _disableKeepAlive = disableKeepAlive; } /// Send the request to the server. @@ -989,7 +991,7 @@ namespace Nwc.XmlRpc request.Method = "POST"; request.ContentType = "text/xml"; request.AllowWriteStreamBuffering = true; - request.KeepAlive = false; + request.KeepAlive = !_disableKeepAlive; Stream stream = request.GetRequestStream(); XmlTextWriter xml = new XmlTextWriter(stream, _encoding); @@ -1000,7 +1002,17 @@ namespace Nwc.XmlRpc HttpWebResponse response = (HttpWebResponse)request.GetResponse(); StreamReader input = new StreamReader(response.GetResponseStream()); - XmlRpcResponse resp = (XmlRpcResponse)_deserializer.Deserialize(input); + string inputXml = input.ReadToEnd(); + XmlRpcResponse resp; + try + { + resp = (XmlRpcResponse)_deserializer.Deserialize(inputXml); + } + catch (Exception e) + { + RequestResponse = inputXml; + throw e; + } input.Close(); response.Close(); return resp; -- cgit v1.1 From 88294d9ebfcbaf1a382bb71a1fcacbe90913fbd8 Mon Sep 17 00:00:00 2001 From: Alan M Webb Date: Wed, 16 Sep 2009 17:31:14 -0400 Subject: While running a test case I had written to pursue problems with llDie() not always completely working, I discovered I was getting a lot (60+ over 6000 iterations of the test case) null pointer exceptions in various physics related checks in SceneObjectPart. It was apparent that the (frequent) checks for PhysActor being non-null is an insufficient protection in a highly asynchronous environment. The null reference exceptions are one example of failure, but it could also happen that a sequence started with one instance of a PhysicsActor might finish with another? Anyway, I have implemented a safer mechanism that should stop the errors. I re-ran my test case with the fix in place, and completed nearly 1000 iterations without a single occurrence. SceneObjectPart is seriously in need of rejigging, if not for this reason, then for its ridiculous size. Signed-off-by: dr scofield (aka dirk husemann) --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 265 ++++++++++++--------- 1 file changed, 152 insertions(+), 113 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index b0d279c..51bb114 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -415,9 +415,10 @@ namespace OpenSim.Region.Framework.Scenes set { m_name = value; - if (PhysActor != null) + PhysicsActor pa = PhysActor; + if (pa != null) { - PhysActor.SOPName = value; + pa.SOPName = value; } } } @@ -427,10 +428,11 @@ namespace OpenSim.Region.Framework.Scenes get { return (byte) m_material; } set { + PhysicsActor pa = PhysActor; m_material = (Material)value; - if (PhysActor != null) + if (pa != null) { - PhysActor.SetMaterial((int)value); + pa.SetMaterial((int)value); } } } @@ -501,11 +503,12 @@ namespace OpenSim.Region.Framework.Scenes get { // If this is a linkset, we don't want the physics engine mucking up our group position here. - if (PhysActor != null && _parentID == 0) + PhysicsActor pa = PhysActor; + if (pa != null && _parentID == 0) { - m_groupPosition.X = PhysActor.Position.X; - m_groupPosition.Y = PhysActor.Position.Y; - m_groupPosition.Z = PhysActor.Position.Z; + m_groupPosition.X = pa.Position.X; + m_groupPosition.Y = pa.Position.Y; + m_groupPosition.Z = pa.Position.Z; } if (IsAttachment) @@ -525,26 +528,27 @@ namespace OpenSim.Region.Framework.Scenes m_groupPosition = value; - if (PhysActor != null) + PhysicsActor pa = PhysActor; + if (pa != null) { try { // Root prim actually goes at Position if (_parentID == 0) { - PhysActor.Position = new PhysicsVector(value.X, value.Y, value.Z); + pa.Position = new PhysicsVector(value.X, value.Y, value.Z); } else { // To move the child prim in respect to the group position and rotation we have to calculate Vector3 resultingposition = GetWorldPosition(); - PhysActor.Position = new PhysicsVector(resultingposition.X, resultingposition.Y, resultingposition.Z); + pa.Position = new PhysicsVector(resultingposition.X, resultingposition.Y, resultingposition.Z); Quaternion resultingrot = GetWorldRotation(); - PhysActor.Orientation = resultingrot; + pa.Orientation = resultingrot; } // Tell the physics engines that this prim changed. - m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor); + m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(pa); } catch (Exception e) { @@ -577,15 +581,16 @@ namespace OpenSim.Region.Framework.Scenes if (ParentGroup != null && !ParentGroup.IsDeleted) { - if (_parentID != 0 && PhysActor != null) + PhysicsActor pa = PhysActor; + if (_parentID != 0 && pa != null) { Vector3 resultingposition = GetWorldPosition(); - PhysActor.Position = new PhysicsVector(resultingposition.X, resultingposition.Y, resultingposition.Z); + pa.Position = new PhysicsVector(resultingposition.X, resultingposition.Y, resultingposition.Z); Quaternion resultingrot = GetWorldRotation(); - PhysActor.Orientation = resultingrot; + pa.Orientation = resultingrot; // Tell the physics engines that this prim changed. - m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor); + m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(pa); } } } @@ -595,13 +600,14 @@ namespace OpenSim.Region.Framework.Scenes { get { + PhysicsActor pa = PhysActor; // We don't want the physics engine mucking up the rotations in a linkset - if ((_parentID == 0) && (Shape.PCode != 9 || Shape.State == 0) && (PhysActor != null)) + if ((_parentID == 0) && (Shape.PCode != 9 || Shape.State == 0) && (pa != null)) { - if (PhysActor.Orientation.X != 0 || PhysActor.Orientation.Y != 0 - || PhysActor.Orientation.Z != 0 || PhysActor.Orientation.W != 0) + if (pa.Orientation.X != 0 || pa.Orientation.Y != 0 + || pa.Orientation.Z != 0 || pa.Orientation.W != 0) { - m_rotationOffset = PhysActor.Orientation; + m_rotationOffset = pa.Orientation; } } @@ -610,27 +616,28 @@ namespace OpenSim.Region.Framework.Scenes set { + PhysicsActor pa = PhysActor; StoreUndoState(); m_rotationOffset = value; - if (PhysActor != null) + if (pa != null) { try { // Root prim gets value directly if (_parentID == 0) { - PhysActor.Orientation = value; + pa.Orientation = value; //m_log.Info("[PART]: RO1:" + PhysActor.Orientation.ToString()); } else { // Child prim we have to calculate it's world rotationwel Quaternion resultingrotation = GetWorldRotation(); - PhysActor.Orientation = resultingrotation; + pa.Orientation = resultingrotation; //m_log.Info("[PART]: RO2:" + PhysActor.Orientation.ToString()); } - m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor); + m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(pa); //} } catch (Exception ex) @@ -650,13 +657,14 @@ namespace OpenSim.Region.Framework.Scenes //if (PhysActor.Velocity.X != 0 || PhysActor.Velocity.Y != 0 //|| PhysActor.Velocity.Z != 0) //{ - if (PhysActor != null) + PhysicsActor pa = PhysActor; + if (pa != null) { - if (PhysActor.IsPhysical) + if (pa.IsPhysical) { - m_velocity.X = PhysActor.Velocity.X; - m_velocity.Y = PhysActor.Velocity.Y; - m_velocity.Z = PhysActor.Velocity.Z; + m_velocity.X = pa.Velocity.X; + m_velocity.Y = pa.Velocity.Y; + m_velocity.Z = pa.Velocity.Z; } } @@ -666,12 +674,13 @@ namespace OpenSim.Region.Framework.Scenes set { m_velocity = value; - if (PhysActor != null) + PhysicsActor pa = PhysActor; + if (pa != null) { - if (PhysActor.IsPhysical) + if (pa.IsPhysical) { - PhysActor.Velocity = new PhysicsVector(value.X, value.Y, value.Z); - m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor); + pa.Velocity = new PhysicsVector(value.X, value.Y, value.Z); + m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(pa); } } } @@ -688,9 +697,10 @@ namespace OpenSim.Region.Framework.Scenes { get { - if ((PhysActor != null) && PhysActor.IsPhysical) + PhysicsActor pa = PhysActor; + if ((pa != null) && pa.IsPhysical) { - m_angularVelocity.FromBytes(PhysActor.RotationalVelocity.GetBytes(), 0); + m_angularVelocity.FromBytes(pa.RotationalVelocity.GetBytes(), 0); } return m_angularVelocity; } @@ -709,10 +719,11 @@ namespace OpenSim.Region.Framework.Scenes get { return m_description; } set { + PhysicsActor pa = PhysActor; m_description = value; - if (PhysActor != null) + if (pa != null) { - PhysActor.SOPDescription = value; + pa.SOPDescription = value; } } } @@ -806,14 +817,15 @@ namespace OpenSim.Region.Framework.Scenes if (m_shape != null) { m_shape.Scale = value; - if (PhysActor != null && m_parentGroup != null) + PhysicsActor pa = PhysActor; + if (pa != null && m_parentGroup != null) { if (m_parentGroup.Scene != null) { if (m_parentGroup.Scene.PhysicsScene != null) { - PhysActor.Size = new PhysicsVector(m_shape.Scale.X, m_shape.Scale.Y, m_shape.Scale.Z); - m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor); + pa.Size = new PhysicsVector(m_shape.Scale.X, m_shape.Scale.Y, m_shape.Scale.Z); + m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(pa); } } } @@ -1343,13 +1355,14 @@ if (m_shape != null) { RigidBody); // Basic Physics returns null.. joy joy joy. - if (PhysActor != null) + PhysicsActor pa = PhysActor; + if (pa != null) { - PhysActor.SOPName = this.Name; // save object name and desc into the PhysActor so ODE internals know the joint/body info - PhysActor.SOPDescription = this.Description; - PhysActor.LocalID = LocalId; + pa.SOPName = this.Name; // save object name and desc into the PhysActor so ODE internals know the joint/body info + pa.SOPDescription = this.Description; + pa.LocalID = LocalId; DoPhysicsPropertyUpdate(RigidBody, true); - PhysActor.SetVolumeDetect(VolumeDetectActive ? 1 : 0); + pa.SetVolumeDetect(VolumeDetectActive ? 1 : 0); } } } @@ -1563,23 +1576,24 @@ if (m_shape != null) { } else { - if (PhysActor != null) + PhysicsActor pa = PhysActor; + if (pa != null) { - if (UsePhysics != PhysActor.IsPhysical || isNew) + if (UsePhysics != pa.IsPhysical || isNew) { - if (PhysActor.IsPhysical) // implies UsePhysics==false for this block + if (pa.IsPhysical) // implies UsePhysics==false for this block { if (!isNew) ParentGroup.Scene.RemovePhysicalPrim(1); - PhysActor.OnRequestTerseUpdate -= PhysicsRequestingTerseUpdate; - PhysActor.OnOutOfBounds -= PhysicsOutOfBounds; - PhysActor.delink(); + pa.OnRequestTerseUpdate -= PhysicsRequestingTerseUpdate; + pa.OnOutOfBounds -= PhysicsOutOfBounds; + pa.delink(); if (ParentGroup.Scene.PhysicsScene.SupportsNINJAJoints && (!isNew)) { // destroy all joints connected to this now deactivated body - m_parentGroup.Scene.PhysicsScene.RemoveAllJointsConnectedToActorThreadLocked(PhysActor); + m_parentGroup.Scene.PhysicsScene.RemoveAllJointsConnectedToActorThreadLocked(pa); } // stop client-side interpolation of all joint proxy objects that have just been deleted @@ -1598,7 +1612,7 @@ if (m_shape != null) { //RotationalVelocity = new Vector3(0, 0, 0); } - PhysActor.IsPhysical = UsePhysics; + pa.IsPhysical = UsePhysics; // If we're not what we're supposed to be in the physics scene, recreate ourselves. @@ -1612,19 +1626,19 @@ if (m_shape != null) { { ParentGroup.Scene.AddPhysicalPrim(1); - PhysActor.OnRequestTerseUpdate += PhysicsRequestingTerseUpdate; - PhysActor.OnOutOfBounds += PhysicsOutOfBounds; + pa.OnRequestTerseUpdate += PhysicsRequestingTerseUpdate; + pa.OnOutOfBounds += PhysicsOutOfBounds; if (_parentID != 0 && _parentID != LocalId) { if (ParentGroup.RootPart.PhysActor != null) { - PhysActor.link(ParentGroup.RootPart.PhysActor); + pa.link(ParentGroup.RootPart.PhysActor); } } } } } - m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor); + m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(pa); } } } @@ -1690,9 +1704,10 @@ if (m_shape != null) { public Vector3 GetGeometricCenter() { - if (PhysActor != null) + PhysicsActor pa = PhysActor; + if (pa != null) { - return new Vector3(PhysActor.CenterOfMass.X, PhysActor.CenterOfMass.Y, PhysActor.CenterOfMass.Z); + return new Vector3(pa.CenterOfMass.X, pa.CenterOfMass.Y, pa.CenterOfMass.Z); } else { @@ -1702,9 +1717,10 @@ if (m_shape != null) { public float GetMass() { - if (PhysActor != null) + PhysicsActor pa = PhysActor; + if (pa != null) { - return PhysActor.Mass; + return pa.Mass; } else { @@ -1714,8 +1730,9 @@ if (m_shape != null) { public PhysicsVector GetForce() { - if (PhysActor != null) - return PhysActor.Force; + PhysicsActor pa = PhysActor; + if (pa != null) + return pa.Force; else return new PhysicsVector(); } @@ -2094,11 +2111,15 @@ if (m_shape != null) { public void PhysicsRequestingTerseUpdate() { - if (PhysActor != null) + PhysicsActor pa = PhysActor; + if (pa != null) { - Vector3 newpos = new Vector3(PhysActor.Position.GetBytes(), 0); + Vector3 newpos = new Vector3(pa.Position.GetBytes(), 0); - if (m_parentGroup.Scene.TestBorderCross(newpos, Cardinals.N) | m_parentGroup.Scene.TestBorderCross(newpos, Cardinals.S) | m_parentGroup.Scene.TestBorderCross(newpos, Cardinals.E) | m_parentGroup.Scene.TestBorderCross(newpos, Cardinals.W)) + if (m_parentGroup.Scene.TestBorderCross(newpos, Cardinals.N) | + m_parentGroup.Scene.TestBorderCross(newpos, Cardinals.S) | + m_parentGroup.Scene.TestBorderCross(newpos, Cardinals.E) | + m_parentGroup.Scene.TestBorderCross(newpos, Cardinals.W)) { m_parentGroup.AbsolutePosition = newpos; return; @@ -2294,14 +2315,15 @@ if (m_shape != null) { if (texture != null) m_shape.SculptData = texture.Data; - if (PhysActor != null) + PhysicsActor pa = PhysActor; + if (pa != null) { // Tricks physics engine into thinking we've changed the part shape. PrimitiveBaseShape m_newshape = m_shape.Copy(); - PhysActor.Shape = m_newshape; + pa.Shape = m_newshape; m_shape = m_newshape; - m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor); + m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(pa); } } } @@ -2520,9 +2542,10 @@ if (m_shape != null) { public void SetBuoyancy(float fvalue) { - if (PhysActor != null) + PhysicsActor pa = PhysActor; + if (pa != null) { - PhysActor.Buoyancy = fvalue; + pa.Buoyancy = fvalue; } } @@ -2538,56 +2561,62 @@ if (m_shape != null) { public void SetFloatOnWater(int floatYN) { - if (PhysActor != null) + PhysicsActor pa = PhysActor; + if (pa != null) { if (floatYN == 1) { - PhysActor.FloatOnWater = true; + pa.FloatOnWater = true; } else { - PhysActor.FloatOnWater = false; + pa.FloatOnWater = false; } } } public void SetForce(PhysicsVector force) { - if (PhysActor != null) + PhysicsActor pa = PhysActor; + if (pa != null) { - PhysActor.Force = force; + pa.Force = force; } } public void SetVehicleType(int type) { - if (PhysActor != null) + PhysicsActor pa = PhysActor; + if (pa != null) { - PhysActor.VehicleType = type; + pa.VehicleType = type; } } public void SetVehicleFloatParam(int param, float value) { - if (PhysActor != null) + PhysicsActor pa = PhysActor; + if (pa != null) { - PhysActor.VehicleFloatParam(param, value); + pa.VehicleFloatParam(param, value); } } public void SetVehicleVectorParam(int param, PhysicsVector value) { - if (PhysActor != null) + PhysicsActor pa = PhysActor; + if (pa != null) { - PhysActor.VehicleVectorParam(param, value); + pa.VehicleVectorParam(param, value); } } public void SetVehicleRotationParam(int param, Quaternion rotation) { - if (PhysActor != null) + PhysicsActor pa = PhysActor; + if (pa != null) { - PhysActor.VehicleRotationParam(param, rotation); + pa.VehicleRotationParam(param, rotation); } } @@ -2615,10 +2644,11 @@ if (m_shape != null) { public void SetPhysicsAxisRotation() { - if (PhysActor != null) + PhysicsActor pa = PhysActor; + if (pa != null) { - PhysActor.LockAngularMotion(RotationAxis); - m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor); + pa.LockAngularMotion(RotationAxis); + m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(pa); } } @@ -3350,8 +3380,9 @@ if (m_shape != null) { { IsVD = false; // Switch it of for the course of this routine VolumeDetectActive = false; // and also permanently - if (PhysActor != null) - PhysActor.SetVolumeDetect(0); // Let physics know about it too + PhysicsActor pa = PhysActor; + if (pa != null) + pa.SetVolumeDetect(0); // Let physics know about it too } else { @@ -3399,18 +3430,21 @@ if (m_shape != null) { if (IsPhantom || IsAttachment) // note: this may have been changed above in the case of joints { AddFlag(PrimFlags.Phantom); - if (PhysActor != null) + PhysicsActor pa = PhysActor; + if (pa != null) { - m_parentGroup.Scene.PhysicsScene.RemovePrim(PhysActor); + m_parentGroup.Scene.PhysicsScene.RemovePrim(pa); /// that's not wholesome. Had to make Scene public - PhysActor = null; + pa = null; } } else // Not phantom { RemFlag(PrimFlags.Phantom); - if (PhysActor == null) + // This is NOT safe!! + PhysicsActor pa = PhysActor; + if (pa == null) { // It's not phantom anymore. So make sure the physics engine get's knowledge of it PhysActor = m_parentGroup.Scene.PhysicsScene.AddPrimShape( @@ -3421,9 +3455,9 @@ if (m_shape != null) { RotationOffset, UsePhysics); - if (PhysActor != null) + if (pa != null) { - PhysActor.LocalID = LocalId; + pa.LocalID = LocalId; DoPhysicsPropertyUpdate(UsePhysics, true); if (m_parentGroup != null) { @@ -3442,14 +3476,14 @@ if (m_shape != null) { (CollisionSound != UUID.Zero) ) { - PhysActor.OnCollisionUpdate += PhysicsCollision; - PhysActor.SubscribeEvents(1000); + pa.OnCollisionUpdate += PhysicsCollision; + pa.SubscribeEvents(1000); } } } else // it already has a physical representation { - PhysActor.IsPhysical = UsePhysics; + pa.IsPhysical = UsePhysics; DoPhysicsPropertyUpdate(UsePhysics, false); // Update physical status. If it's phantom this will remove the prim if (m_parentGroup != null) @@ -3472,9 +3506,10 @@ if (m_shape != null) { // Defensive programming calls for a check here. // Better would be throwing an exception that could be catched by a unit test as the internal // logic should make sure, this Physactor is always here. - if (this.PhysActor != null) + PhysicsActor pa = this.PhysActor; + if (pa != null) { - PhysActor.SetVolumeDetect(1); + pa.SetVolumeDetect(1); AddFlag(PrimFlags.Phantom); // We set this flag also if VD is active this.VolumeDetectActive = true; } @@ -3482,10 +3517,11 @@ if (m_shape != null) { } else { // Remove VolumeDetect in any case. Note, it's safe to call SetVolumeDetect as often as you like - // (mumbles, well, at least if you have infinte CPU powers :-)) - if (this.PhysActor != null) + // (mumbles, well, at least if you have infinte CPU powers :-) ) + PhysicsActor pa = this.PhysActor; + if (pa != null) { - PhysActor.SetVolumeDetect(0); + pa.SetVolumeDetect(0); } this.VolumeDetectActive = false; } @@ -3543,10 +3579,11 @@ if (m_shape != null) { m_shape.PathTaperY = shapeBlock.PathTaperY; m_shape.PathTwist = shapeBlock.PathTwist; m_shape.PathTwistBegin = shapeBlock.PathTwistBegin; - if (PhysActor != null) + PhysicsActor pa = PhysActor; + if (pa != null) { - PhysActor.Shape = m_shape; - m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor); + pa.Shape = m_shape; + m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(pa); } // This is what makes vehicle trailers work @@ -3647,19 +3684,21 @@ if (m_shape != null) { ) { // subscribe to physics updates. - if (PhysActor != null) + PhysicsActor pa = PhysActor; + if (pa != null) { - PhysActor.OnCollisionUpdate += PhysicsCollision; - PhysActor.SubscribeEvents(1000); + pa.OnCollisionUpdate += PhysicsCollision; + pa.SubscribeEvents(1000); } } else { - if (PhysActor != null) + PhysicsActor pa = PhysActor; + if (pa != null) { - PhysActor.UnSubscribeEvents(); - PhysActor.OnCollisionUpdate -= PhysicsCollision; + pa.UnSubscribeEvents(); + pa.OnCollisionUpdate -= PhysicsCollision; } } -- cgit v1.1 From 6779abf7f59e518b0cd18e52dd91a500049dfda6 Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 17 Sep 2009 23:39:58 +0100 Subject: Remove The legacy inventory and asset servers. Bump interface version to 6 --- .../Framework/Servers/BaseGetAssetStreamHandler.cs | 205 -------- OpenSim/Framework/Servers/GetAssetStreamHandler.cs | 63 --- .../Framework/Servers/PostAssetStreamHandler.cs | 72 --- OpenSim/Framework/Servers/VersionInfo.cs | 2 +- OpenSim/Grid/AssetServer/Main.cs | 146 ------ .../Grid/AssetServer/Properties/AssemblyInfo.cs | 63 --- OpenSim/Grid/InventoryServer/AuthedSessionCache.cs | 133 ------ .../Grid/InventoryServer/GridInventoryService.cs | 256 ---------- .../Grid/InventoryServer/InventoryServiceBase.cs | 519 --------------------- OpenSim/Grid/InventoryServer/Main.cs | 182 -------- prebuild.xml | 64 --- 11 files changed, 1 insertion(+), 1704 deletions(-) delete mode 100644 OpenSim/Framework/Servers/BaseGetAssetStreamHandler.cs delete mode 100644 OpenSim/Framework/Servers/GetAssetStreamHandler.cs delete mode 100644 OpenSim/Framework/Servers/PostAssetStreamHandler.cs delete mode 100644 OpenSim/Grid/AssetServer/Main.cs delete mode 100644 OpenSim/Grid/AssetServer/Properties/AssemblyInfo.cs delete mode 100644 OpenSim/Grid/InventoryServer/AuthedSessionCache.cs delete mode 100644 OpenSim/Grid/InventoryServer/GridInventoryService.cs delete mode 100644 OpenSim/Grid/InventoryServer/InventoryServiceBase.cs delete mode 100644 OpenSim/Grid/InventoryServer/Main.cs diff --git a/OpenSim/Framework/Servers/BaseGetAssetStreamHandler.cs b/OpenSim/Framework/Servers/BaseGetAssetStreamHandler.cs deleted file mode 100644 index 8372ae7..0000000 --- a/OpenSim/Framework/Servers/BaseGetAssetStreamHandler.cs +++ /dev/null @@ -1,205 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System; -using System.Collections.Generic; -using System.IO; -using System.Net; -using System.Reflection; -using System.Text; -using System.Text.RegularExpressions; -using System.Xml; -using System.Xml.Serialization; -using log4net; -using OpenMetaverse; -using OpenSim.Framework.Servers.HttpServer; -using OpenSim.Framework.Statistics; - -namespace OpenSim.Framework.Servers -{ - public abstract class BaseGetAssetStreamHandler : BaseStreamHandler - { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - - protected BaseGetAssetStreamHandler(string httpMethod, string path) : base(httpMethod, path) - { - } - - protected abstract AssetBase GetAsset(UUID assetID); - - public override byte[] Handle(string path, Stream request, - OSHttpRequest httpRequest, OSHttpResponse httpResponse) - { - byte[] result = new byte[] { }; - - string[] p = SplitParams(path); - - if (p.Length > 0) - { - UUID assetID; - - if (!UUID.TryParse(p[0], out assetID)) - { - m_log.DebugFormat( - "[REST]: GET:/asset ignoring request with malformed UUID {0}", p[0]); - return result; - } - - if (StatsManager.AssetStats != null) - { - StatsManager.AssetStats.AddRequest(); - } - - AssetBase asset = GetAsset(assetID); - - if (asset != null) - { - if (p.Length > 1 && p[1] == "data") - { - httpResponse.StatusCode = (int)HttpStatusCode.OK; - httpResponse.ContentType = SLAssetTypeToContentType(asset.Type); - result = asset.Data; - } - else - { - result = GetXml(asset); - } - } - else - { - m_log.DebugFormat("[REST]: GET:/asset failed to find {0}", assetID); - - httpResponse.StatusCode = (int)HttpStatusCode.NotFound; - - if (StatsManager.AssetStats != null) - { - StatsManager.AssetStats.AddNotFoundRequest(); - } - } - } - - return result; - } - - public static byte[] GetXml(AssetBase asset) - { - byte[] result; - XmlSerializer xs = new XmlSerializer(typeof(AssetBase)); - MemoryStream ms = new MemoryStream(); - XmlTextWriter xw = new XmlTextWriter(ms, Encoding.UTF8); - xw.Formatting = Formatting.Indented; - xs.Serialize(xw, asset); - xw.Flush(); - - ms.Seek(0, SeekOrigin.Begin); - //StreamReader sr = new StreamReader(ms); - - result = ms.GetBuffer(); - - Array.Resize(ref result, (int)ms.Length); - return result; - } - - public string ProcessAssetDataString(string data) - { - Regex regex = new Regex("(creator_id|owner_id)\\s+(\\S+)"); - - // IUserService userService = null; - - data = regex.Replace(data, delegate(Match m) - { - string result = String.Empty; - -// string key = m.Groups[1].Captures[0].Value; -// -// string value = m.Groups[2].Captures[0].Value; -// -// Guid userUri; -// -// switch (key) -// { -// case "creator_id": -// userUri = new Guid(value); -// // result = "creator_url " + userService(userService, userUri); -// break; -// -// case "owner_id": -// userUri = new Guid(value); -// // result = "owner_url " + ResolveUserUri(userService, userUri); -// break; -// } - - return result; - }); - - return data; - } - - private string SLAssetTypeToContentType(int assetType) - { - switch (assetType) - { - case 0: - return "image/jp2"; - case 1: - return "application/ogg"; - case 2: - return "application/x-metaverse-callingcard"; - case 3: - return "application/x-metaverse-landmark"; - case 5: - return "application/x-metaverse-clothing"; - case 6: - return "application/x-metaverse-primitive"; - case 7: - return "application/x-metaverse-notecard"; - case 8: - return "application/x-metaverse-folder"; - case 10: - return "application/x-metaverse-lsl"; - case 11: - return "application/x-metaverse-lso"; - case 12: - return "image/tga"; - case 13: - return "application/x-metaverse-bodypart"; - case 17: - return "audio/x-wav"; - case 19: - return "image/jpeg"; - case 20: - return "application/x-metaverse-animation"; - case 21: - return "application/x-metaverse-gesture"; - case 22: - return "application/x-metaverse-simstate"; - default: - return "application/octet-stream"; - } - } - } -} diff --git a/OpenSim/Framework/Servers/GetAssetStreamHandler.cs b/OpenSim/Framework/Servers/GetAssetStreamHandler.cs deleted file mode 100644 index c6958de..0000000 --- a/OpenSim/Framework/Servers/GetAssetStreamHandler.cs +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System; -using System.IO; -using System.Reflection; -using System.Text; -using System.Text.RegularExpressions; -using System.Xml; -using System.Xml.Serialization; -using log4net; -using OpenMetaverse; -using OpenSim.Data; -using OpenSim.Framework; -using OpenSim.Framework.Servers; -using OpenSim.Framework.Servers.HttpServer; -using OpenSim.Framework.Statistics; -using System.Net; - -namespace OpenSim.Framework.Servers -{ - public class GetAssetStreamHandler : BaseGetAssetStreamHandler - { - // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - - private readonly IAssetDataPlugin m_assetProvider; - - public GetAssetStreamHandler(IAssetDataPlugin assetProvider) - : base("GET", "/assets") - { - m_assetProvider = assetProvider; - } - - protected override AssetBase GetAsset(UUID assetID) - { - return m_assetProvider.GetAsset(assetID); - } - } -} diff --git a/OpenSim/Framework/Servers/PostAssetStreamHandler.cs b/OpenSim/Framework/Servers/PostAssetStreamHandler.cs deleted file mode 100644 index 8bf406c..0000000 --- a/OpenSim/Framework/Servers/PostAssetStreamHandler.cs +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System.IO; -using System.Reflection; -using System.Xml.Serialization; -using log4net; -using OpenMetaverse; -using OpenSim.Data; -using OpenSim.Framework; -using OpenSim.Framework.Servers.HttpServer; - -namespace OpenSim.Framework.Servers -{ - public class PostAssetStreamHandler : BaseStreamHandler - { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - - // private OpenAsset_Main m_assetManager; - private IAssetDataPlugin m_assetProvider; - - public override byte[] Handle(string path, Stream request, - OSHttpRequest httpRequest, OSHttpResponse httpResponse) - { - string param = GetParam(path); - - UUID assetId; - if (param.Length > 0) - UUID.TryParse(param, out assetId); - // byte[] txBuffer = new byte[4096]; - - XmlSerializer xs = new XmlSerializer(typeof (AssetBase)); - AssetBase asset = (AssetBase) xs.Deserialize(request); - - m_log.InfoFormat("[REST]: Creating asset {0}", asset.FullID); - m_assetProvider.StoreAsset(asset); - - return new byte[] {}; - } - - public PostAssetStreamHandler(IAssetDataPlugin assetProvider) - : base("POST", "/assets") - { - // m_assetManager = assetManager; - m_assetProvider = assetProvider; - } - } -} diff --git a/OpenSim/Framework/Servers/VersionInfo.cs b/OpenSim/Framework/Servers/VersionInfo.cs index 743ca69..6f9b00c 100644 --- a/OpenSim/Framework/Servers/VersionInfo.cs +++ b/OpenSim/Framework/Servers/VersionInfo.cs @@ -69,6 +69,6 @@ namespace OpenSim /// of the code that is too old. /// /// - public readonly static int MajorInterfaceVersion = 5; + public readonly static int MajorInterfaceVersion = 6; } } diff --git a/OpenSim/Grid/AssetServer/Main.cs b/OpenSim/Grid/AssetServer/Main.cs deleted file mode 100644 index ac8f888..0000000 --- a/OpenSim/Grid/AssetServer/Main.cs +++ /dev/null @@ -1,146 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System; -using System.IO; -using System.Reflection; -using log4net; -using log4net.Config; -using OpenMetaverse; -using OpenSim.Data; -using OpenSim.Framework; -using OpenSim.Framework.AssetLoader.Filesystem; -using OpenSim.Framework.Console; -using OpenSim.Framework.Servers; -using OpenSim.Framework.Servers.HttpServer; -using OpenSim.Framework.Statistics; - -namespace OpenSim.Grid.AssetServer -{ - /// - /// An asset server - /// - public class OpenAsset_Main : BaseOpenSimServer - { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - - public static OpenAsset_Main assetserver; - - // Temporarily hardcoded - should be a plugin - protected IAssetLoader assetLoader = new AssetLoaderFileSystem(); - - private IAssetDataPlugin m_assetProvider; - - public static void Main(string[] args) - { - XmlConfigurator.Configure(); - - assetserver = new OpenAsset_Main(); - assetserver.Startup(); - - assetserver.Work(); - } - - private void Work() - { - m_console.Output("Enter help for a list of commands"); - - while (true) - { - m_console.Prompt(); - } - } - - public OpenAsset_Main() - { - m_console = new LocalConsole("Asset"); - - MainConsole.Instance = m_console; - } - - protected override void StartupSpecific() - { - AssetConfig config = new AssetConfig("ASSET SERVER", (Path.Combine(Util.configDir(), "AssetServer_Config.xml"))); - - m_log.Info("[ASSET]: Setting up asset DB"); - setupDB(config); - - m_log.Info("[ASSET]: Loading default asset set from '" + config.AssetSetsLocation + "'"); - LoadDefaultAssets(config.AssetSetsLocation); - - m_log.Info("[ASSET]: Starting HTTP process"); - m_httpServer = new BaseHttpServer(config.HttpPort); - - m_stats = StatsManager.StartCollectingAssetStats(); - - AddHttpHandlers(); - - m_httpServer.Start(); - - base.StartupSpecific(); - } - - protected void AddHttpHandlers() - { - m_httpServer.AddStreamHandler(new GetAssetStreamHandler(m_assetProvider)); - m_httpServer.AddStreamHandler(new PostAssetStreamHandler(m_assetProvider)); - } - - public byte[] GetAssetData(UUID assetID, bool isTexture) - { - return null; - } - - public void setupDB(AssetConfig config) - { - try - { - m_assetProvider = DataPluginFactory.LoadDataPlugin(config.DatabaseProvider, config.DatabaseConnect); - if (m_assetProvider == null) - { - m_log.Error("[ASSET]: Failed to load a database plugin, server halting"); - Environment.Exit(-1); - } - } - catch (Exception e) - { - m_log.Warn("[ASSET]: setupDB() - Exception occured"); - m_log.Warn("[ASSET]: " + e.ToString()); - } - } - - public void LoadDefaultAssets(string pAssetSetsLocation) - { - assetLoader.ForEachDefaultXmlAsset(pAssetSetsLocation, StoreAsset); - } - - protected void StoreAsset(AssetBase asset) - { - m_assetProvider.StoreAsset(asset); - } - } -} diff --git a/OpenSim/Grid/AssetServer/Properties/AssemblyInfo.cs b/OpenSim/Grid/AssetServer/Properties/AssemblyInfo.cs deleted file mode 100644 index 5d67e3f..0000000 --- a/OpenSim/Grid/AssetServer/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System.Reflection; -using System.Runtime.InteropServices; - -// General information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. - -[assembly : AssemblyTitle("OGS-AssetServer")] -[assembly : AssemblyDescription("")] -[assembly : AssemblyConfiguration("")] -[assembly : AssemblyCompany("http://opensimulator.org")] -[assembly : AssemblyProduct("OGS-AssetServer")] -[assembly : AssemblyCopyright("Copyright (c) OpenSimulator.org Developers 2007-2009")] -[assembly : AssemblyTrademark("")] -[assembly : AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. - -[assembly : ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM - -[assembly : Guid("b541b244-3d1d-4625-9003-bc2a3a6a39a4")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// - -[assembly : AssemblyVersion("0.6.5.*")] -[assembly : AssemblyFileVersion("0.6.5.0")] diff --git a/OpenSim/Grid/InventoryServer/AuthedSessionCache.cs b/OpenSim/Grid/InventoryServer/AuthedSessionCache.cs deleted file mode 100644 index dadf34a..0000000 --- a/OpenSim/Grid/InventoryServer/AuthedSessionCache.cs +++ /dev/null @@ -1,133 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System; -using System.Collections.Generic; - -namespace OpenSim.Grid.InventoryServer -{ - public class AuthedSessionCache - { - public class CacheData - { - private static readonly DateTime UNIX_EPOCH = new DateTime(1970, 1, 1); - private string m_session_id; - private string m_agent_id; - private int m_expire; - - private int get_current_unix_time() - { - return (int)(DateTime.UtcNow - UNIX_EPOCH).TotalSeconds; - } - - public CacheData(string sid, string aid) - { - m_session_id = sid; - m_agent_id = aid; - m_expire = get_current_unix_time() + DEFAULT_LIFETIME; - } - - public CacheData(string sid, string aid, int time_now) - { - m_session_id = sid; - m_agent_id = aid; - m_expire = time_now + DEFAULT_LIFETIME; - } - - public string SessionID - { - get { return m_session_id; } - set { m_session_id = value; } - } - - public string AgentID - { - get { return m_agent_id; } - set { m_agent_id = value; } - } - - public bool isExpired - { - get { return m_expire < get_current_unix_time(); } - } - - public void Renew() - { - m_expire = get_current_unix_time() + DEFAULT_LIFETIME; - } - } - - private static readonly int DEFAULT_LIFETIME = 30; - private Dictionary m_authed_sessions = new Dictionary(); - // private int m_session_lifetime = DEFAULT_LIFETIME; - - public AuthedSessionCache() - { - // m_session_lifetime = DEFAULT_LIFETIME; - } - - public AuthedSessionCache(int timeout) - { - // m_session_lifetime = timeout; - } - - public CacheData getCachedSession(string session_id, string agent_id) - { - CacheData ret = null; - lock (m_authed_sessions) - { - if (m_authed_sessions.ContainsKey(session_id)) - { - CacheData cached_session = m_authed_sessions[session_id]; - if (!cached_session.isExpired && cached_session.AgentID == agent_id) - { - ret = m_authed_sessions[session_id]; - // auto renew - m_authed_sessions[session_id].Renew(); - } - } - } - return ret; - } - - public void Add(string session_id, string agent_id) - { - CacheData data = new CacheData(session_id, agent_id); - lock (m_authed_sessions) - { - if (m_authed_sessions.ContainsKey(session_id)) - { - m_authed_sessions[session_id] = data; - } - else - { - m_authed_sessions.Add(session_id, data); - } - } - } - } -} diff --git a/OpenSim/Grid/InventoryServer/GridInventoryService.cs b/OpenSim/Grid/InventoryServer/GridInventoryService.cs deleted file mode 100644 index 0704faa..0000000 --- a/OpenSim/Grid/InventoryServer/GridInventoryService.cs +++ /dev/null @@ -1,256 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Net; -using System.Reflection; -using log4net; -using Nwc.XmlRpc; -using OpenMetaverse; -using OpenSim.Framework; -using OpenSim.Framework.Communications; -using OpenSim.Framework.Communications.Cache; - -namespace OpenSim.Grid.InventoryServer -{ - /// - /// Used on a grid server to satisfy external inventory requests - /// - public class GridInventoryService : InventoryServiceBase - { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - - private bool m_doLookup = false; - - public bool DoLookup - { - get { return m_doLookup; } - set { m_doLookup = value; } - } - - private static readonly int INVENTORY_DEFAULT_SESSION_TIME = 30; // secs - - private string m_userserver_url; - private AuthedSessionCache m_session_cache = new AuthedSessionCache(INVENTORY_DEFAULT_SESSION_TIME); - - public GridInventoryService(string userserver_url) - { - m_userserver_url = userserver_url; - } - - /// - /// Check that the source of an inventory request is one that we trust. - /// - /// - /// - public bool CheckTrustSource(IPEndPoint peer) - { - if (m_doLookup) - { - m_log.InfoFormat("[GRID AGENT INVENTORY]: Checking trusted source {0}", peer); - UriBuilder ub = new UriBuilder(m_userserver_url); - IPAddress[] uaddrs = Dns.GetHostAddresses(ub.Host); - foreach (IPAddress uaddr in uaddrs) - { - if (uaddr.Equals(peer.Address)) - { - return true; - } - } - - m_log.WarnFormat( - "[GRID AGENT INVENTORY]: Rejecting request since source {0} was not in the list of trusted sources", - peer); - - return false; - } - else - { - return true; - } - } - - /// - /// Check that the source of an inventory request for a particular agent is a current session belonging to - /// that agent. - /// - /// - /// - /// - public bool CheckAuthSession(string session_id, string avatar_id) - { - if (m_doLookup) - { - m_log.InfoFormat("[GRID AGENT INVENTORY]: checking authed session {0} {1}", session_id, avatar_id); - - if (m_session_cache.getCachedSession(session_id, avatar_id) == null) - { - // cache miss, ask userserver - Hashtable requestData = new Hashtable(); - requestData["avatar_uuid"] = avatar_id; - requestData["session_id"] = session_id; - ArrayList SendParams = new ArrayList(); - SendParams.Add(requestData); - XmlRpcRequest UserReq = new XmlRpcRequest("check_auth_session", SendParams); - XmlRpcResponse UserResp = UserReq.Send(m_userserver_url, 3000); - - Hashtable responseData = (Hashtable)UserResp.Value; - if (responseData.ContainsKey("auth_session") && responseData["auth_session"].ToString() == "TRUE") - { - m_log.Info("[GRID AGENT INVENTORY]: got authed session from userserver"); - // add to cache; the session time will be automatically renewed - m_session_cache.Add(session_id, avatar_id); - return true; - } - } - else - { - // cache hits - m_log.Info("[GRID AGENT INVENTORY]: got authed session from cache"); - return true; - } - - m_log.Warn("[GRID AGENT INVENTORY]: unknown session_id, request rejected"); - return false; - } - else - { - return true; - } - } - - /// - /// Return a user's entire inventory - /// - /// - /// The user's inventory. If an inventory cannot be found then an empty collection is returned. - public InventoryCollection GetUserInventory(Guid rawUserID) - { - UUID userID = new UUID(rawUserID); - - m_log.InfoFormat("[GRID AGENT INVENTORY]: Processing request for inventory of {0}", userID); - - // Uncomment me to simulate a slow responding inventory server - //Thread.Sleep(16000); - - InventoryCollection invCollection = new InventoryCollection(); - - List allFolders = GetInventorySkeleton(userID); - - if (null == allFolders) - { - m_log.WarnFormat("[GRID AGENT INVENTORY]: No inventory found for user {0}", rawUserID); - - return invCollection; - } - - List allItems = new List(); - - foreach (InventoryFolderBase folder in allFolders) - { - List items = RequestFolderItems(folder.ID); - - if (items != null) - { - allItems.InsertRange(0, items); - } - } - - invCollection.UserID = userID; - invCollection.Folders = allFolders; - invCollection.Items = allItems; - - // foreach (InventoryFolderBase folder in invCollection.Folders) - // { - // m_log.DebugFormat("[GRID AGENT INVENTORY]: Sending back folder {0} {1}", folder.Name, folder.ID); - // } - // - // foreach (InventoryItemBase item in invCollection.Items) - // { - // m_log.DebugFormat("[GRID AGENT INVENTORY]: Sending back item {0} {1}, folder {2}", item.Name, item.ID, item.Folder); - // } - - m_log.InfoFormat( - "[GRID AGENT INVENTORY]: Sending back inventory response to user {0} containing {1} folders and {2} items", - invCollection.UserID, invCollection.Folders.Count, invCollection.Items.Count); - - return invCollection; - } - - public List GetFolderItems(Guid folderID) - { - List allItems = new List(); - - - List items = RequestFolderItems(new UUID(folderID)); - - if (items != null) - { - allItems.InsertRange(0, items); - } - m_log.InfoFormat( - "[GRID AGENT INVENTORY]: Sending back inventory response containing {0} items", allItems.Count.ToString()); - return allItems; - } - - /// - /// Guid to UUID wrapper for same name IInventoryServices method - /// - /// - /// - public List GetInventorySkeleton(Guid rawUserID) - { - UUID userID = new UUID(rawUserID); - return GetInventorySkeleton(userID); - } - - /// - /// Create an inventory for the given user. - /// - /// - /// - public bool CreateUsersInventory(Guid rawUserID) - { - UUID userID = new UUID(rawUserID); - - m_log.InfoFormat("[GRID AGENT INVENTORY]: Creating new set of inventory folders for user {0}", userID); - - return CreateNewUserInventory(userID); - } - - public List GetActiveGestures(Guid rawUserID) - { - UUID userID = new UUID(rawUserID); - - m_log.InfoFormat("[GRID AGENT INVENTORY]: fetching active gestures for user {0}", userID); - - return GetActiveGestures(userID); - } - } -} diff --git a/OpenSim/Grid/InventoryServer/InventoryServiceBase.cs b/OpenSim/Grid/InventoryServer/InventoryServiceBase.cs deleted file mode 100644 index f8b4949..0000000 --- a/OpenSim/Grid/InventoryServer/InventoryServiceBase.cs +++ /dev/null @@ -1,519 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System.Collections.Generic; -using System.Reflection; -using log4net; -using OpenMetaverse; -using OpenSim.Data; -using OpenSim.Framework; -using OpenSim.Framework.Communications; - -namespace OpenSim.Grid.InventoryServer -{ - /// - /// Abstract base class used by local and grid implementations of an inventory service. - /// - public abstract class InventoryServiceBase : IInterServiceInventoryServices - { - - private static readonly ILog m_log - = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - - protected List m_plugins = new List(); - - #region Plugin methods - - /// - /// Add a new inventory data plugin - plugins will be requested in the order they were added. - /// - /// The plugin that will provide data - public void AddPlugin(IInventoryDataPlugin plugin) - { - m_plugins.Add(plugin); - } - - /// - /// Adds a list of inventory data plugins, as described by `provider' - /// and `connect', to `m_plugins'. - /// - /// - /// The filename of the inventory server plugin DLL. - /// - /// - /// The connection string for the storage backend. - /// - public void AddPlugin(string provider, string connect) - { - m_plugins.AddRange(DataPluginFactory.LoadDataPlugins(provider, connect)); - } - - #endregion - - #region IInventoryServices methods - - public string Host - { - get { return "default"; } - } - - public List GetInventorySkeleton(UUID userId) - { -// m_log.DebugFormat("[AGENT INVENTORY]: Getting inventory skeleton for {0}", userId); - - InventoryFolderBase rootFolder = RequestRootFolder(userId); - - // Agent has no inventory structure yet. - if (null == rootFolder) - { - return null; - } - - List userFolders = new List(); - - userFolders.Add(rootFolder); - - foreach (IInventoryDataPlugin plugin in m_plugins) - { - IList folders = plugin.getFolderHierarchy(rootFolder.ID); - userFolders.AddRange(folders); - } - -// foreach (InventoryFolderBase folder in userFolders) -// { -// m_log.DebugFormat("[AGENT INVENTORY]: Got folder {0} {1}", folder.name, folder.folderID); -// } - - return userFolders; - } - - // See IInventoryServices - public virtual bool HasInventoryForUser(UUID userID) - { - return false; - } - - // See IInventoryServices - public virtual InventoryFolderBase RequestRootFolder(UUID userID) - { - // Retrieve the first root folder we get from the list of plugins. - foreach (IInventoryDataPlugin plugin in m_plugins) - { - InventoryFolderBase rootFolder = plugin.getUserRootFolder(userID); - if (rootFolder != null) - return rootFolder; - } - - // Return nothing if no plugin was able to supply a root folder - return null; - } - - // See IInventoryServices - public bool CreateNewUserInventory(UUID user) - { - InventoryFolderBase existingRootFolder = RequestRootFolder(user); - - if (null != existingRootFolder) - { - m_log.WarnFormat( - "[AGENT INVENTORY]: Did not create a new inventory for user {0} since they already have " - + "a root inventory folder with id {1}", - user, existingRootFolder.ID); - } - else - { - UsersInventory inven = new UsersInventory(); - inven.CreateNewInventorySet(user); - AddNewInventorySet(inven); - - return true; - } - - return false; - } - - public List GetActiveGestures(UUID userId) - { - List activeGestures = new List(); - foreach (IInventoryDataPlugin plugin in m_plugins) - { - activeGestures.AddRange(plugin.fetchActiveGestures(userId)); - } - - return activeGestures; - } - - #endregion - - #region Methods used by GridInventoryService - - public List RequestSubFolders(UUID parentFolderID) - { - List inventoryList = new List(); - - foreach (IInventoryDataPlugin plugin in m_plugins) - { - inventoryList.AddRange(plugin.getInventoryFolders(parentFolderID)); - } - - return inventoryList; - } - - public List RequestFolderItems(UUID folderID) - { - List itemsList = new List(); - - foreach (IInventoryDataPlugin plugin in m_plugins) - { - itemsList.AddRange(plugin.getInventoryInFolder(folderID)); - } - - return itemsList; - } - - #endregion - - // See IInventoryServices - public virtual bool AddFolder(InventoryFolderBase folder) - { - m_log.DebugFormat( - "[AGENT INVENTORY]: Adding folder {0} {1} to folder {2}", folder.Name, folder.ID, folder.ParentID); - - foreach (IInventoryDataPlugin plugin in m_plugins) - { - plugin.addInventoryFolder(folder); - } - - // FIXME: Should return false on failure - return true; - } - - // See IInventoryServices - public virtual bool UpdateFolder(InventoryFolderBase folder) - { - m_log.DebugFormat( - "[AGENT INVENTORY]: Updating folder {0} {1} to folder {2}", folder.Name, folder.ID, folder.ParentID); - - foreach (IInventoryDataPlugin plugin in m_plugins) - { - plugin.updateInventoryFolder(folder); - } - - // FIXME: Should return false on failure - return true; - } - - // See IInventoryServices - public virtual bool MoveFolder(InventoryFolderBase folder) - { - m_log.DebugFormat( - "[AGENT INVENTORY]: Moving folder {0} {1} to folder {2}", folder.Name, folder.ID, folder.ParentID); - - foreach (IInventoryDataPlugin plugin in m_plugins) - { - plugin.moveInventoryFolder(folder); - } - - // FIXME: Should return false on failure - return true; - } - - // See IInventoryServices - public virtual bool AddItem(InventoryItemBase item) - { - m_log.DebugFormat( - "[AGENT INVENTORY]: Adding item {0} {1} to folder {2}", item.Name, item.ID, item.Folder); - - foreach (IInventoryDataPlugin plugin in m_plugins) - { - plugin.addInventoryItem(item); - } - - // FIXME: Should return false on failure - return true; - } - - // See IInventoryServices - public virtual bool UpdateItem(InventoryItemBase item) - { - m_log.InfoFormat( - "[AGENT INVENTORY]: Updating item {0} {1} in folder {2}", item.Name, item.ID, item.Folder); - - foreach (IInventoryDataPlugin plugin in m_plugins) - { - plugin.updateInventoryItem(item); - } - - // FIXME: Should return false on failure - return true; - } - - // See IInventoryServices - public virtual bool DeleteItem(InventoryItemBase item) - { - m_log.InfoFormat( - "[AGENT INVENTORY]: Deleting item {0} {1} from folder {2}", item.Name, item.ID, item.Folder); - - foreach (IInventoryDataPlugin plugin in m_plugins) - { - plugin.deleteInventoryItem(item.ID); - } - - // FIXME: Should return false on failure - return true; - } - - public virtual InventoryItemBase QueryItem(InventoryItemBase item) - { - foreach (IInventoryDataPlugin plugin in m_plugins) - { - InventoryItemBase result = plugin.queryInventoryItem(item.ID); - if (result != null) - return result; - } - - return null; - } - - public virtual InventoryFolderBase QueryFolder(InventoryFolderBase item) - { - foreach (IInventoryDataPlugin plugin in m_plugins) - { - InventoryFolderBase result = plugin.queryInventoryFolder(item.ID); - if (result != null) - return result; - } - - return null; - } - - /// - /// Purge a folder of all items items and subfolders. - /// - /// FIXME: Really nasty in a sense, because we have to query the database to get information we may - /// already know... Needs heavy refactoring. - /// - /// - public virtual bool PurgeFolder(InventoryFolderBase folder) - { - m_log.DebugFormat( - "[AGENT INVENTORY]: Purging folder {0} {1} of its contents", folder.Name, folder.ID); - - List subFolders = RequestSubFolders(folder.ID); - - foreach (InventoryFolderBase subFolder in subFolders) - { -// m_log.DebugFormat("[AGENT INVENTORY]: Deleting folder {0} {1}", subFolder.Name, subFolder.ID); - - foreach (IInventoryDataPlugin plugin in m_plugins) - { - plugin.deleteInventoryFolder(subFolder.ID); - } - } - - List items = RequestFolderItems(folder.ID); - - foreach (InventoryItemBase item in items) - { - DeleteItem(item); - } - - // FIXME: Should return false on failure - return true; - } - - private void AddNewInventorySet(UsersInventory inventory) - { - foreach (InventoryFolderBase folder in inventory.Folders.Values) - { - AddFolder(folder); - } - } - - public InventoryItemBase GetInventoryItem(UUID itemID) - { - foreach (IInventoryDataPlugin plugin in m_plugins) - { - InventoryItemBase item = plugin.getInventoryItem(itemID); - if (item != null) - return item; - } - - return null; - } - - /// - /// Used to create a new user inventory. - /// - private class UsersInventory - { - public Dictionary Folders = new Dictionary(); - public Dictionary Items = new Dictionary(); - - public virtual void CreateNewInventorySet(UUID user) - { - InventoryFolderBase folder = new InventoryFolderBase(); - - folder.ParentID = UUID.Zero; - folder.Owner = user; - folder.ID = UUID.Random(); - folder.Name = "My Inventory"; - folder.Type = (short)AssetType.Folder; - folder.Version = 1; - Folders.Add(folder.ID, folder); - - UUID rootFolder = folder.ID; - - folder = new InventoryFolderBase(); - folder.ParentID = rootFolder; - folder.Owner = user; - folder.ID = UUID.Random(); - folder.Name = "Animations"; - folder.Type = (short)AssetType.Animation; - folder.Version = 1; - Folders.Add(folder.ID, folder); - - folder = new InventoryFolderBase(); - folder.ParentID = rootFolder; - folder.Owner = user; - folder.ID = UUID.Random(); - folder.Name = "Body Parts"; - folder.Type = (short)AssetType.Bodypart; - folder.Version = 1; - Folders.Add(folder.ID, folder); - - folder = new InventoryFolderBase(); - folder.ParentID = rootFolder; - folder.Owner = user; - folder.ID = UUID.Random(); - folder.Name = "Calling Cards"; - folder.Type = (short)AssetType.CallingCard; - folder.Version = 1; - Folders.Add(folder.ID, folder); - - folder = new InventoryFolderBase(); - folder.ParentID = rootFolder; - folder.Owner = user; - folder.ID = UUID.Random(); - folder.Name = "Clothing"; - folder.Type = (short)AssetType.Clothing; - folder.Version = 1; - Folders.Add(folder.ID, folder); - - folder = new InventoryFolderBase(); - folder.ParentID = rootFolder; - folder.Owner = user; - folder.ID = UUID.Random(); - folder.Name = "Gestures"; - folder.Type = (short)AssetType.Gesture; - folder.Version = 1; - Folders.Add(folder.ID, folder); - - folder = new InventoryFolderBase(); - folder.ParentID = rootFolder; - folder.Owner = user; - folder.ID = UUID.Random(); - folder.Name = "Landmarks"; - folder.Type = (short)AssetType.Landmark; - folder.Version = 1; - Folders.Add(folder.ID, folder); - - folder = new InventoryFolderBase(); - folder.ParentID = rootFolder; - folder.Owner = user; - folder.ID = UUID.Random(); - folder.Name = "Lost And Found"; - folder.Type = (short)AssetType.LostAndFoundFolder; - folder.Version = 1; - Folders.Add(folder.ID, folder); - - folder = new InventoryFolderBase(); - folder.ParentID = rootFolder; - folder.Owner = user; - folder.ID = UUID.Random(); - folder.Name = "Notecards"; - folder.Type = (short)AssetType.Notecard; - folder.Version = 1; - Folders.Add(folder.ID, folder); - - folder = new InventoryFolderBase(); - folder.ParentID = rootFolder; - folder.Owner = user; - folder.ID = UUID.Random(); - folder.Name = "Objects"; - folder.Type = (short)AssetType.Object; - folder.Version = 1; - Folders.Add(folder.ID, folder); - - folder = new InventoryFolderBase(); - folder.ParentID = rootFolder; - folder.Owner = user; - folder.ID = UUID.Random(); - folder.Name = "Photo Album"; - folder.Type = (short)AssetType.SnapshotFolder; - folder.Version = 1; - Folders.Add(folder.ID, folder); - - folder = new InventoryFolderBase(); - folder.ParentID = rootFolder; - folder.Owner = user; - folder.ID = UUID.Random(); - folder.Name = "Scripts"; - folder.Type = (short)AssetType.LSLText; - folder.Version = 1; - Folders.Add(folder.ID, folder); - - folder = new InventoryFolderBase(); - folder.ParentID = rootFolder; - folder.Owner = user; - folder.ID = UUID.Random(); - folder.Name = "Sounds"; - folder.Type = (short)AssetType.Sound; - folder.Version = 1; - Folders.Add(folder.ID, folder); - - folder = new InventoryFolderBase(); - folder.ParentID = rootFolder; - folder.Owner = user; - folder.ID = UUID.Random(); - folder.Name = "Textures"; - folder.Type = (short)AssetType.Texture; - folder.Version = 1; - Folders.Add(folder.ID, folder); - - folder = new InventoryFolderBase(); - folder.ParentID = rootFolder; - folder.Owner = user; - folder.ID = UUID.Random(); - folder.Name = "Trash"; - folder.Type = (short)AssetType.TrashFolder; - folder.Version = 1; - Folders.Add(folder.ID, folder); - } - } - } -} diff --git a/OpenSim/Grid/InventoryServer/Main.cs b/OpenSim/Grid/InventoryServer/Main.cs deleted file mode 100644 index 6106d93..0000000 --- a/OpenSim/Grid/InventoryServer/Main.cs +++ /dev/null @@ -1,182 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System; -using System.Collections.Generic; -using System.IO; -using System.Reflection; -using log4net; -using log4net.Config; -using OpenMetaverse; -using OpenSim.Framework; -using OpenSim.Framework.Communications.Services; -using OpenSim.Framework.Console; -using OpenSim.Framework.Servers; -using OpenSim.Framework.Servers.HttpServer; - -namespace OpenSim.Grid.InventoryServer -{ - public class OpenInventory_Main : BaseOpenSimServer - { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - - private GridInventoryService m_inventoryService; - //private HGInventoryService m_directInventoryService; - - public const string LogName = "INVENTORY"; - - public static void Main(string[] args) - { - XmlConfigurator.Configure(); - - OpenInventory_Main theServer = new OpenInventory_Main(); - theServer.Startup(); - - theServer.Work(); - } - - public OpenInventory_Main() - { - m_console = new LocalConsole("Inventory"); - MainConsole.Instance = m_console; - } - - protected override void StartupSpecific() - { - InventoryConfig config = new InventoryConfig(LogName, (Path.Combine(Util.configDir(), "InventoryServer_Config.xml"))); - - m_inventoryService = new GridInventoryService(config.UserServerURL); - m_inventoryService.DoLookup = config.SessionLookUp; - m_inventoryService.AddPlugin(config.DatabaseProvider, config.DatabaseConnect); - - - m_log.Info("[" + LogName + "]: Starting HTTP server ..."); - - m_httpServer = new BaseHttpServer(config.HttpPort); - - AddHttpHandlers(config.RegionAccessToAgentsInventory); - - m_httpServer.Start(); - - m_log.Info("[" + LogName + "]: Started HTTP server"); - - base.StartupSpecific(); - - m_console.Commands.AddCommand("inventoryserver", false, "add user", - "add user", - "Add a random user inventory", HandleAddUser); - } - - protected void AddHttpHandlers(bool regionAccess) - { - if (regionAccess) - { - m_httpServer.AddStreamHandler( - new RestDeserialiseSecureHandler( - "POST", "/GetInventory/", m_inventoryService.GetUserInventory, m_inventoryService.CheckAuthSession)); - - m_httpServer.AddStreamHandler( - new RestDeserialiseSecureHandler( - "POST", "/UpdateFolder/", m_inventoryService.UpdateFolder, m_inventoryService.CheckAuthSession)); - - m_httpServer.AddStreamHandler( - new RestDeserialiseSecureHandler( - "POST", "/MoveFolder/", m_inventoryService.MoveFolder, m_inventoryService.CheckAuthSession)); - - m_httpServer.AddStreamHandler( - new RestDeserialiseSecureHandler( - "POST", "/PurgeFolder/", m_inventoryService.PurgeFolder, m_inventoryService.CheckAuthSession)); - - m_httpServer.AddStreamHandler( - new RestDeserialiseSecureHandler( - "POST", "/DeleteItem/", m_inventoryService.DeleteItem, m_inventoryService.CheckAuthSession)); - - m_httpServer.AddStreamHandler( - new RestDeserialiseSecureHandler( - "POST", "/QueryItem/", m_inventoryService.QueryItem, m_inventoryService.CheckAuthSession)); - - m_httpServer.AddStreamHandler( - new RestDeserialiseSecureHandler( - "POST", "/QueryFolder/", m_inventoryService.QueryFolder, m_inventoryService.CheckAuthSession)); - - } - - m_httpServer.AddStreamHandler( - new RestDeserialiseTrustedHandler( - "POST", "/CreateInventory/", m_inventoryService.CreateUsersInventory, m_inventoryService.CheckTrustSource)); - - m_httpServer.AddStreamHandler( - new RestDeserialiseSecureHandler( - "POST", "/NewFolder/", m_inventoryService.AddFolder, m_inventoryService.CheckAuthSession)); - - m_httpServer.AddStreamHandler( - new RestDeserialiseTrustedHandler( - "POST", "/CreateFolder/", m_inventoryService.AddFolder, m_inventoryService.CheckTrustSource)); - - m_httpServer.AddStreamHandler( - new RestDeserialiseSecureHandler( - "POST", "/NewItem/", m_inventoryService.AddItem, m_inventoryService.CheckAuthSession)); - - m_httpServer.AddStreamHandler( - new RestDeserialiseTrustedHandler( - "POST", "/AddNewItem/", m_inventoryService.AddItem, m_inventoryService.CheckTrustSource)); - - m_httpServer.AddStreamHandler( - new RestDeserialiseTrustedHandler>( - "POST", "/GetItems/", m_inventoryService.GetFolderItems, m_inventoryService.CheckTrustSource)); - - // for persistent active gestures - m_httpServer.AddStreamHandler( - new RestDeserialiseTrustedHandler> - ("POST", "/ActiveGestures/", m_inventoryService.GetActiveGestures, m_inventoryService.CheckTrustSource)); - - // WARNING: Root folders no longer just delivers the root and immediate child folders (e.g - // system folders such as Objects, Textures), but it now returns the entire inventory skeleton. - // It would have been better to rename this request, but complexities in the BaseHttpServer - // (e.g. any http request not found is automatically treated as an xmlrpc request) make it easier - // to do this for now. - m_httpServer.AddStreamHandler( - new RestDeserialiseTrustedHandler> - ("POST", "/RootFolders/", m_inventoryService.GetInventorySkeleton, m_inventoryService.CheckTrustSource)); - } - - private void Work() - { - m_console.Output("Enter help for a list of commands\n"); - - while (true) - { - m_console.Prompt(); - } - } - - private void HandleAddUser(string module, string[] args) - { - m_inventoryService.CreateUsersInventory(UUID.Random().Guid); - } - } -} diff --git a/prebuild.xml b/prebuild.xml index 79c767c..9498d7d 100644 --- a/prebuild.xml +++ b/prebuild.xml @@ -956,38 +956,6 @@ - - - - ../../../bin/ - - - - - ../../../bin/ - - - - ../../../bin/ - - - - - - - - - - - - - - - - - - - @@ -1068,38 +1036,6 @@ - - - - ../../../bin/ - - - - - ../../../bin/ - - - - ../../../bin/ - - - - - - - - - - - - - - - - - - - -- cgit v1.1 From 6461243e7c780d79244184a8d4b100303f4cda27 Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 17 Sep 2009 23:55:06 +0100 Subject: Remove the methods for full inventory fetch from the connector. Remove tests for the old, removed asset handlers --- .../Servers/Tests/GetAssetStreamHandlerTests.cs | 135 --------------------- .../Inventory/InventoryServiceConnector.cs | 36 +----- .../Common/Setup/BaseRequestHandlerTestHelper.cs | 12 +- .../Setup/GetAssetStreamHandlerTestHelpers.cs | 122 ------------------- 4 files changed, 2 insertions(+), 303 deletions(-) delete mode 100644 OpenSim/Framework/Servers/Tests/GetAssetStreamHandlerTests.cs delete mode 100644 OpenSim/Tests/Common/Setup/GetAssetStreamHandlerTestHelpers.cs diff --git a/OpenSim/Framework/Servers/Tests/GetAssetStreamHandlerTests.cs b/OpenSim/Framework/Servers/Tests/GetAssetStreamHandlerTests.cs deleted file mode 100644 index be3f518..0000000 --- a/OpenSim/Framework/Servers/Tests/GetAssetStreamHandlerTests.cs +++ /dev/null @@ -1,135 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System; -using System.Collections.Generic; -using System.Net; -using System.Text; -using HttpServer; -using NUnit.Framework; -using OpenSim.Data; -using OpenSim.Framework.Servers.HttpServer; -using OpenSim.Tests.Common; -using OpenSim.Tests.Common.Mock; -using OpenSim.Tests.Common.Setup; - -namespace OpenSim.Framework.Servers.Tests -{ - [TestFixture] - public class GetAssetStreamHandlerTests - { - private const string ASSETS_PATH = "/assets"; - - [Test] - public void TestConstructor() - { - TestHelper.InMethod(); - - // GetAssetStreamHandler handler = - new GetAssetStreamHandler(null); - } - - [Test] - public void TestGetParams() - { - TestHelper.InMethod(); - - GetAssetStreamHandler handler = new GetAssetStreamHandler(null); - BaseRequestHandlerTestHelper.BaseTestGetParams(handler, ASSETS_PATH); - } - - [Test] - public void TestSplitParams() - { - TestHelper.InMethod(); - - GetAssetStreamHandler handler = new GetAssetStreamHandler(null); - BaseRequestHandlerTestHelper.BaseTestSplitParams(handler, ASSETS_PATH); - } - - [Test] - public void TestHandleNoParams() - { - TestHelper.InMethod(); - - GetAssetStreamHandler handler = new GetAssetStreamHandler(null); - - BaseRequestHandlerTestHelper.BaseTestHandleNoParams(handler, ASSETS_PATH); - } - - [Test] - public void TestHandleMalformedGuid() - { - TestHelper.InMethod(); - - GetAssetStreamHandler handler = new GetAssetStreamHandler(null); - - BaseRequestHandlerTestHelper.BaseTestHandleMalformedGuid(handler, ASSETS_PATH); - } - - [Test] - public void TestHandleFetchMissingAsset() - { - GetAssetStreamHandler handler; - OSHttpResponse response; - CreateTestEnvironment(out handler, out response); - - GetAssetStreamHandlerTestHelpers.BaseFetchMissingAsset(handler, response); - } - - [Test] - public void TestHandleFetchExistingAssetData() - { - GetAssetStreamHandler handler; - OSHttpResponse response; - AssetBase asset = CreateTestEnvironment(out handler, out response); - - GetAssetStreamHandlerTestHelpers.BaseFetchExistingAssetDataTest(asset, handler, response); - } - - [Test] - public void TestHandleFetchExistingAssetXml() - { - GetAssetStreamHandler handler; - OSHttpResponse response; - AssetBase asset = CreateTestEnvironment(out handler, out response); - - GetAssetStreamHandlerTestHelpers.BaseFetchExistingAssetXmlTest(asset, handler, response); - } - - private static AssetBase CreateTestEnvironment(out GetAssetStreamHandler handler, out OSHttpResponse response) - { - AssetBase asset = GetAssetStreamHandlerTestHelpers.CreateCommonTestResources(out response); - - IAssetDataPlugin assetDataPlugin = new TestAssetDataPlugin(); - handler = new GetAssetStreamHandler(assetDataPlugin); - - assetDataPlugin.StoreAsset(asset); - return asset; - } - } -} diff --git a/OpenSim/Services/Connectors/Inventory/InventoryServiceConnector.cs b/OpenSim/Services/Connectors/Inventory/InventoryServiceConnector.cs index cef678d..5443891 100644 --- a/OpenSim/Services/Connectors/Inventory/InventoryServiceConnector.cs +++ b/OpenSim/Services/Connectors/Inventory/InventoryServiceConnector.cs @@ -236,42 +236,8 @@ namespace OpenSim.Services.Connectors } catch (Exception e) { - // Maybe we're talking to an old inventory server. Try this other thing. - m_log.ErrorFormat("[INVENTORY CONNECTOR]: GetFolderContent operation failed, {0} {1} (old server?). Trying GetInventory.", + m_log.ErrorFormat("[INVENTORY CONNECTOR]: GetFolderContent operation failed, {0} {1} (old server?).", e.Source, e.Message); - - InventoryCollection inventory; - List folders = null; - try - { - inventory = SynchronousRestSessionObjectPoster.BeginPostObject( - "POST", m_ServerURI + "/GetInventory/", new Guid(userID), sessionID.ToString(), userID.ToString()); - if (inventory != null) - folders = inventory.Folders; - } - catch (Exception ex) - { - m_log.ErrorFormat("[INVENTORY CONNECTOR]: GetInventory operation also failed, {0} {1}. Giving up.", - e.Source, ex.Message); - return new InventoryCollection(); - } - - if ((folders != null) && (folders.Count > 0)) - { - m_log.DebugFormat("[INVENTORY CONNECTOR]: Received entire inventory ({0} folders) for user {1}", - folders.Count, userID); - - folders = folders.FindAll(delegate(InventoryFolderBase f) { return f.ParentID == folderID; }); - List items = inventory.Items; - if (items != null) - { - items = items.FindAll(delegate(InventoryItemBase i) { return i.Folder == folderID; }); - } - - inventory.Items = items; - inventory.Folders = folders; - return inventory; - } } InventoryCollection nullCollection = new InventoryCollection(); diff --git a/OpenSim/Tests/Common/Setup/BaseRequestHandlerTestHelper.cs b/OpenSim/Tests/Common/Setup/BaseRequestHandlerTestHelper.cs index e858371..eaf8b39 100644 --- a/OpenSim/Tests/Common/Setup/BaseRequestHandlerTestHelper.cs +++ b/OpenSim/Tests/Common/Setup/BaseRequestHandlerTestHelper.cs @@ -72,15 +72,5 @@ namespace OpenSim.Tests.Common.Setup public static byte[] EmptyByteArray = new byte[] {}; - public static void BaseTestHandleNoParams(BaseGetAssetStreamHandler handler, string assetsPath) - { - Assert.AreEqual(EmptyByteArray, handler.Handle(assetsPath, null, null, null), "Failed on empty params."); - Assert.AreEqual(EmptyByteArray, handler.Handle(assetsPath + "/", null, null, null), "Failed on single slash."); - } - - public static void BaseTestHandleMalformedGuid(BaseGetAssetStreamHandler handler, string assetsPath) - { - Assert.AreEqual(EmptyByteArray, handler.Handle(assetsPath + "/badGuid", null, null, null), "Failed on bad guid."); - } } -} \ No newline at end of file +} diff --git a/OpenSim/Tests/Common/Setup/GetAssetStreamHandlerTestHelpers.cs b/OpenSim/Tests/Common/Setup/GetAssetStreamHandlerTestHelpers.cs deleted file mode 100644 index ffa7283..0000000 --- a/OpenSim/Tests/Common/Setup/GetAssetStreamHandlerTestHelpers.cs +++ /dev/null @@ -1,122 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System; -using System.Collections.Generic; -using System.IO; -using System.Net; -using System.Text; -using System.Xml; -using System.Xml.Serialization; -using NUnit.Framework; -using OpenMetaverse; -using OpenSim.Framework; -using OpenSim.Framework.Servers; -using OpenSim.Framework.Servers.HttpServer; -using OpenSim.Server.Base; -using OpenSim.Tests.Common.Mock; - -namespace OpenSim.Tests.Common.Setup -{ - public class GetAssetStreamHandlerTestHelpers - { - private const string EXPECTED_CONTENT_TYPE = "application/x-metaverse-callingcard"; - - public static void BaseFetchExistingAssetXmlTest(AssetBase asset, BaseGetAssetStreamHandler handler, OSHttpResponse response) - { - byte[] expected = BaseGetAssetStreamHandler.GetXml(asset); - - byte[] actual = handler.Handle("/assets/" + asset.ID , null, null, response); - - Assert.Greater(actual.Length, 10, "Too short xml on fetching xml without trailing slash."); - Assert.AreEqual(expected, actual, "Failed on fetching xml without trailing slash."); - // Assert.AreEqual((int)HttpStatusCode.OK, response.StatusCode, "Wrong http response code on first fetch."); - - actual = handler.Handle("/assets/" + asset.ID + "/", null, null, response); - Assert.Greater(actual.Length, 10, "Too short xml on fetching xml with trailing slash."); - Assert.AreEqual(expected, actual, "Failed on fetching xml with trailing slash."); - // Assert.AreEqual((int)HttpStatusCode.OK, response.StatusCode, "Wrong http response code on second fetch."); - - actual = handler.Handle("/assets/" + asset.ID + "/badData", null, null, response); - Assert.Greater(actual.Length, 10, "Too short xml on fetching xml with bad trailing data."); - Assert.AreEqual(expected, actual, "Failed on fetching xml with bad trailing trailing slash."); - // Assert.AreEqual((int)HttpStatusCode.OK, response.StatusCode, "Wrong http response code on second fetch."); - } - - public static void BaseFetchExistingAssetDataTest(AssetBase asset, BaseGetAssetStreamHandler handler, OSHttpResponse response) - { - Assert.AreEqual(asset.Data, handler.Handle("/assets/" + asset.ID + "/data", null, null, response), "Failed on fetching data without trailing slash."); - Assert.AreEqual((int)HttpStatusCode.OK, response.StatusCode, "Wrong http response code on first fetch."); - Assert.AreEqual(EXPECTED_CONTENT_TYPE, response.ContentType, "Wrong http content type on first fetch."); - - Assert.AreEqual(asset.Data, handler.Handle("/assets/" + asset.ID + "/data/", null, null, response), "Failed on fetching data with trailing slash."); - Assert.AreEqual((int)HttpStatusCode.OK, response.StatusCode, "Wrong http response code on second fetch."); - Assert.AreEqual(EXPECTED_CONTENT_TYPE, response.ContentType, "Wrong http content type on second fetch."); - } - - public static void BaseFetchExistingAssetMetaDataTest(AssetBase asset, BaseGetAssetStreamHandler handler, OSHttpResponse response) - { - XmlSerializer xs = new XmlSerializer(typeof(AssetMetadata)); - - byte[] expected = ServerUtils.SerializeResult(xs, asset.Metadata); - - Assert.AreEqual(expected, handler.Handle("/assets/" + asset.ID + "/metadata", null, null, response), "Failed on fetching data without trailing slash."); - Assert.AreEqual((int)HttpStatusCode.OK, response.StatusCode, "Wrong http response code on first fetch."); - Assert.AreEqual(EXPECTED_CONTENT_TYPE, response.ContentType, "Wrong http content type on first fetch."); - - Assert.AreEqual(expected, handler.Handle("/assets/" + asset.ID + "/metadata/", null, null, response), "Failed on fetching data with trailing slash."); - Assert.AreEqual((int)HttpStatusCode.OK, response.StatusCode, "Wrong http response code on second fetch."); - Assert.AreEqual(EXPECTED_CONTENT_TYPE, response.ContentType, "Wrong http content type on second fetch."); - } - - public static AssetBase CreateCommonTestResources(out OSHttpResponse response) - { - AssetBase asset = CreateTestAsset(); - response = new TestOSHttpResponse(); - return asset; - } - - public static AssetBase CreateTestAsset() - { - byte[] expected = new byte[] { 1,2,3 }; - AssetBase asset = new AssetBase(); - asset.ID = Guid.NewGuid().ToString(); - asset.Data = expected; - asset.Type = 2; - - return asset; - } - - public static void BaseFetchMissingAsset(BaseGetAssetStreamHandler handler, OSHttpResponse response) - { - Assert.AreEqual( - BaseRequestHandlerTestHelper.EmptyByteArray, - handler.Handle("/assets/" + Guid.NewGuid(), null, null, response), "Failed on bad guid."); - Assert.AreEqual((int)HttpStatusCode.NotFound, response.StatusCode, "Response code wrong in BaseFetchMissingAsset"); - } - } -} -- cgit v1.1 From 56edbe9b60e5ed5f1388e2d1d4d2a0d82cdeaf6d Mon Sep 17 00:00:00 2001 From: nlin Date: Fri, 18 Sep 2009 11:26:52 +0900 Subject: Alternate algorithm for fixing avatar capsule tilt (Mantis #2905) Eliminate dynamic capsule wobble. Instead introduce a small, fixed tilt, and allow the tilt to rotate with the avatar while moving; the tilt always faces away from the direction of avatar movement. The rotation while moving should eliminate direction-dependent behavior (e.g. only being able to climb on top of prims from certain directions). Falling animation is still too frequently invoked. Ideally the tilt should be completely eliminated, but doing so currently causes the avatar to fall through the terrain. --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 2 +- OpenSim/Region/Physics/OdePlugin/ODECharacter.cs | 132 ++++++++++++----------- 2 files changed, 73 insertions(+), 61 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 23fe2d3..6772f75 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -2269,7 +2269,7 @@ namespace OpenSim.Region.Framework.Scenes { //Record the time we enter this state so we know whether to "land" or not m_animPersistUntil = DateTime.Now.Ticks; - return "FALLDOWN"; + return "FALLDOWN"; // this falling animation is invoked too frequently when capsule tilt correction is used - why? } } } diff --git a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs index dd58a4e..a00ba11 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs @@ -107,6 +107,7 @@ namespace OpenSim.Region.Physics.OdePlugin public float MinimumGroundFlightOffset = 3f; private float m_tainted_CAPSULE_LENGTH; // set when the capsule length changes. + private float m_tiltMagnitudeWhenProjectedOnXYPlane = 0.1131371f; // used to introduce a fixed tilt because a straight-up capsule falls through terrain, probably a bug in terrain collider private float m_buoyancy = 0f; @@ -477,7 +478,71 @@ namespace OpenSim.Region.Physics.OdePlugin } } } - + + private void AlignAvatarTiltWithCurrentDirectionOfMovement(PhysicsVector movementVector) + { + movementVector.Z = 0f; + float magnitude = (float)Math.Sqrt((double)(movementVector.X * movementVector.X + movementVector.Y * movementVector.Y)); + if (magnitude < 0.1f) return; + + // normalize the velocity vector + float invMagnitude = 1.0f / magnitude; + movementVector.X *= invMagnitude; + movementVector.Y *= invMagnitude; + + // if we change the capsule heading too often, the capsule can fall down + // therefore we snap movement vector to just 1 of 4 predefined directions (ne, nw, se, sw), + // meaning only 4 possible capsule tilt orientations + if (movementVector.X > 0) + { + // east + if (movementVector.Y > 0) + { + // northeast + movementVector.X = (float)Math.Sqrt(2.0); + movementVector.Y = (float)Math.Sqrt(2.0); + } + else + { + // southeast + movementVector.X = (float)Math.Sqrt(2.0); + movementVector.Y = -(float)Math.Sqrt(2.0); + } + } + else + { + // west + if (movementVector.Y > 0) + { + // northwest + movementVector.X = -(float)Math.Sqrt(2.0); + movementVector.Y = (float)Math.Sqrt(2.0); + } + else + { + // southwest + movementVector.X = -(float)Math.Sqrt(2.0); + movementVector.Y = -(float)Math.Sqrt(2.0); + } + } + + + // movementVector.Z is zero + + // calculate tilt components based on desired amount of tilt and current (snapped) heading. + // the "-" sign is to force the tilt to be OPPOSITE the direction of movement. + float xTiltComponent = -movementVector.X * m_tiltMagnitudeWhenProjectedOnXYPlane; + float yTiltComponent = -movementVector.Y * m_tiltMagnitudeWhenProjectedOnXYPlane; + + //m_log.Debug("[PHYSICS] changing avatar tilt"); + d.JointSetAMotorParam(Amotor, (int)dParam.LowStop, xTiltComponent); + d.JointSetAMotorParam(Amotor, (int)dParam.HiStop, xTiltComponent); // must be same as lowstop, else a different, spurious tilt is introduced + d.JointSetAMotorParam(Amotor, (int)dParam.LoStop2, yTiltComponent); + d.JointSetAMotorParam(Amotor, (int)dParam.HiStop2, yTiltComponent); // same as lowstop + d.JointSetAMotorParam(Amotor, (int)dParam.LoStop3, 0f); + d.JointSetAMotorParam(Amotor, (int)dParam.HiStop3, 0f); // same as lowstop + } + /// /// This creates the Avatar's physical Surrogate at the position supplied /// @@ -576,71 +641,13 @@ namespace OpenSim.Region.Physics.OdePlugin // (with -0..0 motor stops) falls into the terrain for reasons yet // to be comprehended in their entirety. #endregion + AlignAvatarTiltWithCurrentDirectionOfMovement(new PhysicsVector(0,0,0)); d.JointSetAMotorParam(Amotor, (int)dParam.LowStop, 0.08f); d.JointSetAMotorParam(Amotor, (int)dParam.LoStop3, -0f); d.JointSetAMotorParam(Amotor, (int)dParam.LoStop2, 0.08f); d.JointSetAMotorParam(Amotor, (int)dParam.HiStop, 0.08f); // must be same as lowstop, else a different, spurious tilt is introduced d.JointSetAMotorParam(Amotor, (int)dParam.HiStop3, 0f); // same as lowstop d.JointSetAMotorParam(Amotor, (int)dParam.HiStop2, 0.08f); // same as lowstop - #region Documentation of capsule motor StopERP and StopCFM parameters - // In addition to the above tilt, we allow a dynamic tilt, or - // wobble, to emerge as the capsule is pushed around the environment. - // We do this with an experimentally determined combination of - // StopERP and StopCFM which make the above motor stops soft. - // The softness of the stops should be tweaked according to two - // requirements: - // - // 1. Motor stops should be weak enough to allow enough wobble such - // that the capsule can tilt slightly more when moving, to allow - // "gliding" over obstacles: - // - // - // .-. - // / / - // / / - // _ / / _ - // / \ .-. / / / \ - // | | ----> / / / / | | - // | | / / `-' | | - // | | / / +------+ | | - // | | / / | | | | - // | | / / | | | | - // \_/ `-' +------+ \_/ - // ---------------------------------------------------------- - // - // Note that requirement 1 is made complicated by the ever-present - // slight avatar tilt (assigned in the above code to prevent avatar - // from falling through terrain), which introduces a direction-dependent - // bias into the wobble (wobbling against the existing tilt is harder - // than wobbling with the tilt), which makes it easier to walk over - // prims from some directions. I have tried to minimize this effect by - // minimizing the avatar tilt to the minimum that prevents the avatar from - // falling through the terrain. - // - // 2. Motor stops should be strong enough to prevent the capsule - // from being forced all the way to the ground; otherwise the - // capsule could slip underneath obstacles like this: - // _ _ - // / \ +------+ / \ - // | | ----> | | | | - // | | | | | | - // | | .--.___ +------+ | | - // | | `--.__`--.__ | | - // | | `--.__`--. | | - // \_/ `--' \_/ - // ---------------------------------------------------------- - // - // - // It is strongly recommended you enable USE_DRAWSTUFF if you want to - // tweak these values, to see how the capsule is reacting in various - // situations. - #endregion - d.JointSetAMotorParam(Amotor, (int)dParam.StopCFM, 0.0035f); - d.JointSetAMotorParam(Amotor, (int)dParam.StopCFM2, 0.0035f); - d.JointSetAMotorParam(Amotor, (int)dParam.StopCFM3, 0.0035f); - d.JointSetAMotorParam(Amotor, (int)dParam.StopERP, 0.8f); - d.JointSetAMotorParam(Amotor, (int)dParam.StopERP2, 0.8f); - d.JointSetAMotorParam(Amotor, (int)dParam.StopERP3, 0.8f); } // Fudge factor is 1f by default, we're setting it to 0. We don't want it to Fudge or the @@ -939,6 +946,7 @@ namespace OpenSim.Region.Physics.OdePlugin PhysicsVector vec = new PhysicsVector(); d.Vector3 vel = d.BodyGetLinearVel(Body); + float movementdivisor = 1f; if (!m_alwaysRun) @@ -1052,6 +1060,10 @@ namespace OpenSim.Region.Physics.OdePlugin if (PhysicsVector.isFinite(vec)) { doForce(vec); + if (!_zeroFlag) + { + AlignAvatarTiltWithCurrentDirectionOfMovement(new PhysicsVector(vec.X, vec.Y, vec.Z)); + } } else { -- cgit v1.1 From 4f3975f04e7bbaf7b7b8e286831714240ced5e6d Mon Sep 17 00:00:00 2001 From: Rob Smart Date: Fri, 18 Sep 2009 14:11:38 +0100 Subject: addition of a new script function osSetParcelSIPAddress(string SIPAddress), now including iVoiceModule This patch allows the land owner to dynamically set the SIP address of a particular land parcel from script. This allows predetermined SIP addresses to be used, making it easier to allow non OpenSim users to join a regions voice channel. Signed-off-by: dr scofield (aka dirk husemann) --- .../Region/Framework/Interfaces/IVoiceModule.cs | 45 ++++++++++++++++++ .../Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs | 55 ++++++++++++++++++++-- .../Shared/Api/Implementation/OSSL_Api.cs | 29 ++++++++++++ .../ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | 1 + .../ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | 5 ++ 5 files changed, 132 insertions(+), 3 deletions(-) create mode 100644 OpenSim/Region/Framework/Interfaces/IVoiceModule.cs diff --git a/OpenSim/Region/Framework/Interfaces/IVoiceModule.cs b/OpenSim/Region/Framework/Interfaces/IVoiceModule.cs new file mode 100644 index 0000000..2e555fa --- /dev/null +++ b/OpenSim/Region/Framework/Interfaces/IVoiceModule.cs @@ -0,0 +1,45 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + +using System.IO; +using OpenMetaverse; + +namespace OpenSim.Region.Framework.Interfaces +{ + public interface IVoiceModule + { + + /// + /// Set the SIP url to be used by a parcel, this will allow manual setting of a SIP address + /// for a particular piece of land, allowing region owners to use preconfigured SIP conference channels. + /// This is used by osSetParcelSIPAddress + /// + void setLandSIPAddress(string SIPAddress,UUID GlobalID); + + } +} diff --git a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs index 65c5274..6b30959 100644 --- a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs @@ -53,7 +53,7 @@ using System.Text.RegularExpressions; namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice { - public class FreeSwitchVoiceModule : IRegionModule + public class FreeSwitchVoiceModule : IRegionModule, IVoiceModule { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -101,13 +101,16 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice private FreeSwitchDialplan m_FreeSwitchDialplan; private readonly Dictionary m_UUIDName = new Dictionary(); + private Dictionary m_ParcelAddress = new Dictionary(); + + private Scene m_scene; private IConfig m_config; public void Initialise(Scene scene, IConfigSource config) { - + m_scene = scene; m_config = config.Configs["FreeSwitchVoice"]; if (null == m_config) @@ -230,6 +233,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice { OnRegisterCaps(scene, agentID, caps); }; + + try { @@ -255,6 +260,13 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice public void PostInitialise() { + if(m_pluginEnabled) + { + m_log.Info("[FreeSwitchVoice] registering IVoiceModule with the scene"); + + // register the voice interface for this module, so the script engine can call us + m_scene.RegisterModuleInterface(this); + } } public void Close() @@ -270,7 +282,27 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice { get { return true; } } - + + // + // implementation of IVoiceModule, called by osSetParcelSIPAddress script function + // + public void setLandSIPAddress(string SIPAddress,UUID GlobalID) + { + m_log.DebugFormat("[FreeSwitchVoice]: setLandSIPAddress parcel id {0}: setting sip address {1}", + GlobalID, SIPAddress); + + lock (m_ParcelAddress) + { + if (m_ParcelAddress.ContainsKey(GlobalID.ToString())) + { + m_ParcelAddress[GlobalID.ToString()] = SIPAddress; + } + else + { + m_ParcelAddress.Add(GlobalID.ToString(), SIPAddress); + } + } + } // // OnRegisterCaps is invoked via the scene.EventManager @@ -776,6 +808,16 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice // Create parcel voice channel. If no parcel exists, then the voice channel ID is the same // as the directory ID. Otherwise, it reflects the parcel's ID. + + lock (m_ParcelAddress) + { + if (m_ParcelAddress.ContainsKey( land.GlobalID.ToString() )) + { + m_log.DebugFormat("[FreeSwitchVoice]: parcel id {0}: using sip address {1}", + land.GlobalID, m_ParcelAddress[land.GlobalID.ToString()]); + return m_ParcelAddress[land.GlobalID.ToString()]; + } + } if (land.LocalID != 1 && (land.Flags & (uint)ParcelFlags.UseEstateVoiceChan) == 0) { @@ -797,6 +839,13 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice // the personal speech indicators as well unless some siren14-3d codec magic happens. we dont have siren143d so we'll settle for the personal speech indicator. channelUri = String.Format("sip:conf-{0}@{1}", "x" + Convert.ToBase64String(encoding.GetBytes(landUUID)), m_freeSwitchRealm); + lock (m_ParcelAddress) + { + if (!m_ParcelAddress.ContainsKey(land.GlobalID.ToString())) + { + m_ParcelAddress.Add(land.GlobalID.ToString(),channelUri); + } + } return channelUri; } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 726b37a..ccdd4c5 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -1164,6 +1164,35 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api land.SetMediaUrl(url); } + + public void osSetParcelSIPAddress(string SIPAddress) + { + // What actually is the difference to the LL function? + // + CheckThreatLevel(ThreatLevel.VeryLow, "osSetParcelMediaURL"); + + m_host.AddScriptLPS(1); + + + ILandObject land + = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); + + if (land.landData.OwnerID != m_host.ObjectOwner) + { + OSSLError("osSetParcelSIPAddress: Sorry, you need to own the land to use this function"); + return; + } + + // get the voice module + IVoiceModule voiceModule = World.RequestModuleInterface(); + + if (voiceModule != null) + voiceModule.setLandSIPAddress(SIPAddress,land.landData.GlobalID); + else + OSSLError("osSetParcelSIPAddress: No voice module enabled for this land"); + + + } public string osGetScriptEngineName() { diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index 49aa45a..d8d3c31 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs @@ -75,6 +75,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces bool osConsoleCommand(string Command); void osSetParcelMediaURL(string url); void osSetPrimFloatOnWater(int floatYN); + void osSetParcelSIPAddress(string SIPAddress); // Avatar Info Commands string osGetAgentIP(string agent); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index 8f52d99..d0df390 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs @@ -183,6 +183,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase { m_OSSL_Functions.osSetParcelMediaURL(url); } + + public void osSetParcelSIPAddress(string SIPAddress) + { + m_OSSL_Functions.osSetParcelSIPAddress(SIPAddress); + } public void osSetPrimFloatOnWater(int floatYN) { -- cgit v1.1 From c71894975812f26e722f4bb15b837a4efca3af8d Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 18 Sep 2009 19:24:49 +0100 Subject: Remove old OpenSim.Example.xml file that doesn't keep up with OpenSim.ini.example This to try and make things a tiny bit simpler Please just put it back if this causes issues, at which point we can comment it to say what it's for --- bin/OpenSim.Example.xml | 48 ------------------------------------------------ 1 file changed, 48 deletions(-) delete mode 100644 bin/OpenSim.Example.xml diff --git a/bin/OpenSim.Example.xml b/bin/OpenSim.Example.xml deleted file mode 100644 index 12133e6..0000000 --- a/bin/OpenSim.Example.xml +++ /dev/null @@ -1,48 +0,0 @@ - -
- - - - - - - - - - - - - -
-
- - - - - - - - - -
-
- - - - - - - - - - - - -
-
- -
-
- -
-
\ No newline at end of file -- cgit v1.1 From 70358ddb8d4940f301e00262e820bc793cb31a47 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 18 Sep 2009 19:40:53 +0100 Subject: remove old OpenSim.Services.ini.example (replaced by OpenSim.Server.ini.example) --- bin/OpenSim.Services.ini.example | 19 ------------------- 1 file changed, 19 deletions(-) delete mode 100644 bin/OpenSim.Services.ini.example diff --git a/bin/OpenSim.Services.ini.example b/bin/OpenSim.Services.ini.example deleted file mode 100644 index b2e0f96..0000000 --- a/bin/OpenSim.Services.ini.example +++ /dev/null @@ -1,19 +0,0 @@ -[Startup] -; These are also available as command line options - -; console = "local" ; Use "basic" to use this on a pipe -; inifile = "OpenSim.Servers.AssetServer.ini" -; logfile = "AssetServer.log" ; Also read from application config file - -; Connectors, comma separated -ServiceConnectors = "OpenSim.Server.Handlers.dll:AssetServiceConnector" - -[Network] -port = 8003 - -[AssetService] -LocalServiceModule = "OpenSim.Services.AssetService.dll:AssetService" -StorageProvider = "OpenSim.Data.MySQL.dll" -ConnectionString = "Data Source=localhost;Database=opensim;User ID=opensim;Password=opensim;" -DefaultAssetLoader = "OpenSim.Framework.AssetLoader.Filesystem.dll" -AssetLoaderArgs = "assets/AssetSets.xml" -- cgit v1.1 From 0cb012aae5799ec746384c36d4bc99ca699edfe7 Mon Sep 17 00:00:00 2001 From: Michael Cortez Date: Fri, 18 Sep 2009 12:06:33 -0700 Subject: Revert "Thank you, mcortez, for a patch to address showing users in group list" This reverts commit 69ef95693ae6451e2c754b22190557f3bf15777b. --- .../Avatar/XmlRpcGroups/GroupsModule.cs | 102 ++++++--------------- .../XmlRpcGroupsServicesConnectorModule.cs | 42 +++------ 2 files changed, 44 insertions(+), 100 deletions(-) diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs index d5cbfd4..37e1ed4 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs @@ -281,10 +281,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups private void OnRequestAvatarProperties(IClientAPI remoteClient, UUID avatarID) { - if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); - - //GroupMembershipData[] avatarGroups = m_groupData.GetAgentGroupMemberships(GetClientGroupRequestID(remoteClient), avatarID).ToArray(); - GroupMembershipData[] avatarGroups = GetProfileListedGroupMemberships(remoteClient, avatarID); + GroupMembershipData[] avatarGroups = m_groupData.GetAgentGroupMemberships(GetClientGroupRequestID(remoteClient), avatarID).ToArray(); remoteClient.SendAvatarGroupsReply(avatarID, avatarGroups); } @@ -488,7 +485,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups bucket[18] = 0; //dunno } - m_groupData.AddGroupNotice(GetClientGroupRequestID(remoteClient), GroupID, NoticeID, im.fromAgentName, Subject, Message, bucket); if (OnNewGroupNotice != null) { @@ -498,20 +494,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups // Send notice out to everyone that wants notices foreach (GroupMembersData member in m_groupData.GetGroupMembers(GetClientGroupRequestID(remoteClient), GroupID)) { - if (m_debugEnabled) - { - UserProfileData targetUserProfile = m_sceneList[0].CommsManager.UserService.GetUserProfile(member.AgentID); - if (targetUserProfile != null) - { - m_log.DebugFormat("[GROUPS]: Prepping group notice {0} for agent: {1} who Accepts Notices ({2})", NoticeID, targetUserProfile.Name, member.AcceptNotices); - } - else - { - m_log.DebugFormat("[GROUPS]: Prepping group notice {0} for agent: {1} who Accepts Notices ({2})", NoticeID, member.AgentID, member.AcceptNotices); - } - } - - if (member.AcceptNotices) + if (member.AcceptNotices) { // Build notice IIM GridInstantMessage msg = CreateGroupNoticeIM(UUID.Zero, NoticeID, (byte)OpenMetaverse.InstantMessageDialog.GroupNotice); @@ -631,6 +614,13 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); List data = m_groupData.GetGroupMembers(GetClientGroupRequestID(remoteClient), groupID); + if (m_debugEnabled) + { + foreach (GroupMembersData member in data) + { + m_log.DebugFormat("[GROUPS]: {0} {1}", member.AgentID, member.Title); + } + } return data; @@ -642,6 +632,14 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups List data = m_groupData.GetGroupRoles(GetClientGroupRequestID(remoteClient), groupID); + if (m_debugEnabled) + { + foreach (GroupRolesData member in data) + { + m_log.DebugFormat("[GROUPS]: {0} {1}", member.Title, member.Members); + } + } + return data; } @@ -652,6 +650,14 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups List data = m_groupData.GetGroupRoleMembers(GetClientGroupRequestID(remoteClient), groupID); + if (m_debugEnabled) + { + foreach (GroupRoleMembersData member in data) + { + m_log.DebugFormat("[GROUPS]: Av: {0} Role: {1}", member.MemberID, member.RoleID); + } + } + return data; @@ -802,7 +808,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups { if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); - // Security Checks are handled in the Groups Service. + // TODO: Security Checks? GroupRequestID grID = GetClientGroupRequestID(remoteClient); @@ -819,11 +825,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups case OpenMetaverse.GroupRoleUpdate.UpdateAll: case OpenMetaverse.GroupRoleUpdate.UpdateData: case OpenMetaverse.GroupRoleUpdate.UpdatePowers: - if (m_debugEnabled) - { - GroupPowers gp = (GroupPowers)powers; - m_log.DebugFormat("[GROUPS]: Role ({0}) updated with Powers ({1}) ({2})", name, powers.ToString(), gp.ToString()); - } m_groupData.UpdateGroupRole(grID, groupID, roleID, name, description, title, powers); break; @@ -1194,16 +1195,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups foreach (GroupMembershipData membership in data) { - if (remoteClient.AgentId != dataForAgentID) - { - if (!membership.ListInProfile) - { - // If we're sending group info to remoteclient about another agent, - // filter out groups the other agent doesn't want to share. - continue; - } - } - OSDMap GroupDataMap = new OSDMap(6); OSDMap NewGroupDataMap = new OSDMap(1); @@ -1290,46 +1281,11 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups // to the core Groups Stub remoteClient.SendGroupMembership(new GroupMembershipData[0]); - GroupMembershipData[] membershipArray = GetProfileListedGroupMemberships(remoteClient, dataForAgentID); - SendGroupMembershipInfoViaCaps(remoteClient, dataForAgentID, membershipArray); - remoteClient.SendAvatarGroupsReply(dataForAgentID, membershipArray); + GroupMembershipData[] membershipData = m_groupData.GetAgentGroupMemberships(GetClientGroupRequestID(remoteClient), dataForAgentID).ToArray(); - } - - /// - /// Get a list of groups memberships for the agent that are marked "ListInProfile" - /// - /// - /// - private GroupMembershipData[] GetProfileListedGroupMemberships(IClientAPI requestingClient, UUID dataForAgentID) - { - List membershipData = m_groupData.GetAgentGroupMemberships(GetClientGroupRequestID(requestingClient), dataForAgentID); - GroupMembershipData[] membershipArray; - - if (requestingClient.AgentId != dataForAgentID) - { - Predicate showInProfile = delegate(GroupMembershipData membership) - { - return membership.ListInProfile; - }; - - membershipArray = membershipData.FindAll(showInProfile).ToArray(); - } - else - { - membershipArray = membershipData.ToArray(); - } - - if (m_debugEnabled) - { - m_log.InfoFormat("[GROUPS]: Get group membership information for {0} requested by {1}", dataForAgentID, requestingClient.AgentId); - foreach (GroupMembershipData membership in membershipArray) - { - m_log.InfoFormat("[GROUPS]: {0} :: {1} - {2}", dataForAgentID, membership.GroupName, membership.GroupTitle); - } - } + SendGroupMembershipInfoViaCaps(remoteClient, dataForAgentID, membershipData); + remoteClient.SendAvatarGroupsReply(dataForAgentID, membershipData); - return membershipArray; } private void SendAgentDataUpdate(IClientAPI remoteClient, UUID dataForAgentID, UUID activeGroupID, string activeGroupName, ulong activeGroupPowers, string activeGroupTitle) diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs index 805c3d4..b3eaa37 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs @@ -855,8 +855,16 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups IList parameters = new ArrayList(); parameters.Add(param); - ConfigurableKeepAliveXmlRpcRequest req; - req = new ConfigurableKeepAliveXmlRpcRequest(function, parameters, m_disableKeepAlive); + XmlRpcRequest req; + if (!m_disableKeepAlive) + { + req = new XmlRpcRequest(function, parameters); + } + else + { + // This seems to solve a major problem on some windows servers + req = new NoKeepAliveXmlRpcRequest(function, parameters); + } XmlRpcResponse resp = null; @@ -866,16 +874,10 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups } catch (Exception e) { - - m_log.ErrorFormat("[XMLRPCGROUPDATA]: An error has occured while attempting to access the XmlRpcGroups server method: {0}", function); m_log.ErrorFormat("[XMLRPCGROUPDATA]: {0} ", e.ToString()); - foreach( string ResponseLine in req.RequestResponse.Split(new string[] { Environment.NewLine },StringSplitOptions.None)) - { - m_log.ErrorFormat("[XMLRPCGROUPDATA]: {0} ", ResponseLine); - } - + foreach (string key in param.Keys) { m_log.WarnFormat("[XMLRPCGROUPDATA]: {0} :: {1}", key, param[key].ToString()); @@ -959,24 +961,20 @@ namespace Nwc.XmlRpc using System.Reflection; /// Class supporting the request side of an XML-RPC transaction. - public class ConfigurableKeepAliveXmlRpcRequest : XmlRpcRequest + public class NoKeepAliveXmlRpcRequest : XmlRpcRequest { private Encoding _encoding = new ASCIIEncoding(); private XmlRpcRequestSerializer _serializer = new XmlRpcRequestSerializer(); private XmlRpcResponseDeserializer _deserializer = new XmlRpcResponseDeserializer(); - private bool _disableKeepAlive = true; - - public string RequestResponse = String.Empty; /// Instantiate an XmlRpcRequest for a specified method and parameters. /// String designating the object.method on the server the request /// should be directed to. /// ArrayList of XML-RPC type parameters to invoke the request with. - public ConfigurableKeepAliveXmlRpcRequest(String methodName, IList parameters, bool disableKeepAlive) + public NoKeepAliveXmlRpcRequest(String methodName, IList parameters) { MethodName = methodName; _params = parameters; - _disableKeepAlive = disableKeepAlive; } /// Send the request to the server. @@ -991,7 +989,7 @@ namespace Nwc.XmlRpc request.Method = "POST"; request.ContentType = "text/xml"; request.AllowWriteStreamBuffering = true; - request.KeepAlive = !_disableKeepAlive; + request.KeepAlive = false; Stream stream = request.GetRequestStream(); XmlTextWriter xml = new XmlTextWriter(stream, _encoding); @@ -1002,17 +1000,7 @@ namespace Nwc.XmlRpc HttpWebResponse response = (HttpWebResponse)request.GetResponse(); StreamReader input = new StreamReader(response.GetResponseStream()); - string inputXml = input.ReadToEnd(); - XmlRpcResponse resp; - try - { - resp = (XmlRpcResponse)_deserializer.Deserialize(inputXml); - } - catch (Exception e) - { - RequestResponse = inputXml; - throw e; - } + XmlRpcResponse resp = (XmlRpcResponse)_deserializer.Deserialize(input); input.Close(); response.Close(); return resp; -- cgit v1.1 From 61699275ed941565f3ede2a7ce6c00607fb70837 Mon Sep 17 00:00:00 2001 From: Michael Cortez Date: Wed, 19 Aug 2009 07:37:39 -0700 Subject: Add additional debugging to help track down bug with notices not going to group owner/founder. --- .../OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs index 37e1ed4..daba7bc 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs @@ -494,7 +494,20 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups // Send notice out to everyone that wants notices foreach (GroupMembersData member in m_groupData.GetGroupMembers(GetClientGroupRequestID(remoteClient), GroupID)) { - if (member.AcceptNotices) + if (m_debugEnabled) + { + UserProfileData targetUserProfile = m_sceneList[0].CommsManager.UserService.GetUserProfile(member.AgentID); + if (targetUserProfile != null) + { + m_log.DebugFormat("[GROUPS]: Prepping group notice {0} for agent: {1} who Accepts Notices ({2})", NoticeID, targetUserProfile.Name, member.AcceptNotices); + } + else + { + m_log.DebugFormat("[GROUPS]: Prepping group notice {0} for agent: {1} who Accepts Notices ({2})", NoticeID, member.AgentID, member.AcceptNotices); + } + } + + if (member.AcceptNotices) { // Build notice IIM GridInstantMessage msg = CreateGroupNoticeIM(UUID.Zero, NoticeID, (byte)OpenMetaverse.InstantMessageDialog.GroupNotice); -- cgit v1.1 From 0e07a7ef1044f5987c0d8871972204bce3155a68 Mon Sep 17 00:00:00 2001 From: Michael Cortez Date: Wed, 19 Aug 2009 08:17:29 -0700 Subject: Adding additional debug to output the group powers specified when updating a group role. This will be used to solve some issues with the Group Powers enum. --- .../Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs index daba7bc..fd74168 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs @@ -485,6 +485,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups bucket[18] = 0; //dunno } + m_groupData.AddGroupNotice(GetClientGroupRequestID(remoteClient), GroupID, NoticeID, im.fromAgentName, Subject, Message, bucket); if (OnNewGroupNotice != null) { @@ -821,7 +822,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups { if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); - // TODO: Security Checks? + // Security Checks are handled in the Groups Service. GroupRequestID grID = GetClientGroupRequestID(remoteClient); @@ -838,6 +839,11 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups case OpenMetaverse.GroupRoleUpdate.UpdateAll: case OpenMetaverse.GroupRoleUpdate.UpdateData: case OpenMetaverse.GroupRoleUpdate.UpdatePowers: + if (m_debugEnabled) + { + GroupPowers gp = (GroupPowers)powers; + m_log.DebugFormat("[GROUPS]: Role ({0}) updated with Powers ({1}) ({2})", name, powers.ToString(), gp.ToString()); + } m_groupData.UpdateGroupRole(grID, groupID, roleID, name, description, title, powers); break; -- cgit v1.1 From 841cd69af7020f663d040bb0b7e01c03712af322 Mon Sep 17 00:00:00 2001 From: Michael Cortez Date: Wed, 19 Aug 2009 08:50:20 -0700 Subject: Remove debug messages from some areas that have been highly tested, and debug info is no longer nessesary. --- .../Avatar/XmlRpcGroups/GroupsModule.cs | 23 ---------------------- 1 file changed, 23 deletions(-) diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs index fd74168..36adfad 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs @@ -628,13 +628,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); List data = m_groupData.GetGroupMembers(GetClientGroupRequestID(remoteClient), groupID); - if (m_debugEnabled) - { - foreach (GroupMembersData member in data) - { - m_log.DebugFormat("[GROUPS]: {0} {1}", member.AgentID, member.Title); - } - } return data; @@ -646,14 +639,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups List data = m_groupData.GetGroupRoles(GetClientGroupRequestID(remoteClient), groupID); - if (m_debugEnabled) - { - foreach (GroupRolesData member in data) - { - m_log.DebugFormat("[GROUPS]: {0} {1}", member.Title, member.Members); - } - } - return data; } @@ -664,14 +649,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups List data = m_groupData.GetGroupRoleMembers(GetClientGroupRequestID(remoteClient), groupID); - if (m_debugEnabled) - { - foreach (GroupRoleMembersData member in data) - { - m_log.DebugFormat("[GROUPS]: Av: {0} Role: {1}", member.MemberID, member.RoleID); - } - } - return data; -- cgit v1.1 From 247fdd1a4df55315de7184081ca025ce32e7140d Mon Sep 17 00:00:00 2001 From: Michael Cortez Date: Thu, 20 Aug 2009 09:41:14 -0700 Subject: Add additional instrumentation so that when there is an xmlrpc call failure, the actual xml that was returned from the groups service can be logged. --- .../XmlRpcGroupsServicesConnectorModule.cs | 42 ++++++++++++++-------- 1 file changed, 27 insertions(+), 15 deletions(-) diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs index b3eaa37..805c3d4 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs @@ -855,16 +855,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups IList parameters = new ArrayList(); parameters.Add(param); - XmlRpcRequest req; - if (!m_disableKeepAlive) - { - req = new XmlRpcRequest(function, parameters); - } - else - { - // This seems to solve a major problem on some windows servers - req = new NoKeepAliveXmlRpcRequest(function, parameters); - } + ConfigurableKeepAliveXmlRpcRequest req; + req = new ConfigurableKeepAliveXmlRpcRequest(function, parameters, m_disableKeepAlive); XmlRpcResponse resp = null; @@ -874,10 +866,16 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups } catch (Exception e) { + + m_log.ErrorFormat("[XMLRPCGROUPDATA]: An error has occured while attempting to access the XmlRpcGroups server method: {0}", function); m_log.ErrorFormat("[XMLRPCGROUPDATA]: {0} ", e.ToString()); - + foreach( string ResponseLine in req.RequestResponse.Split(new string[] { Environment.NewLine },StringSplitOptions.None)) + { + m_log.ErrorFormat("[XMLRPCGROUPDATA]: {0} ", ResponseLine); + } + foreach (string key in param.Keys) { m_log.WarnFormat("[XMLRPCGROUPDATA]: {0} :: {1}", key, param[key].ToString()); @@ -961,20 +959,24 @@ namespace Nwc.XmlRpc using System.Reflection; /// Class supporting the request side of an XML-RPC transaction. - public class NoKeepAliveXmlRpcRequest : XmlRpcRequest + public class ConfigurableKeepAliveXmlRpcRequest : XmlRpcRequest { private Encoding _encoding = new ASCIIEncoding(); private XmlRpcRequestSerializer _serializer = new XmlRpcRequestSerializer(); private XmlRpcResponseDeserializer _deserializer = new XmlRpcResponseDeserializer(); + private bool _disableKeepAlive = true; + + public string RequestResponse = String.Empty; /// Instantiate an XmlRpcRequest for a specified method and parameters. /// String designating the object.method on the server the request /// should be directed to. /// ArrayList of XML-RPC type parameters to invoke the request with. - public NoKeepAliveXmlRpcRequest(String methodName, IList parameters) + public ConfigurableKeepAliveXmlRpcRequest(String methodName, IList parameters, bool disableKeepAlive) { MethodName = methodName; _params = parameters; + _disableKeepAlive = disableKeepAlive; } /// Send the request to the server. @@ -989,7 +991,7 @@ namespace Nwc.XmlRpc request.Method = "POST"; request.ContentType = "text/xml"; request.AllowWriteStreamBuffering = true; - request.KeepAlive = false; + request.KeepAlive = !_disableKeepAlive; Stream stream = request.GetRequestStream(); XmlTextWriter xml = new XmlTextWriter(stream, _encoding); @@ -1000,7 +1002,17 @@ namespace Nwc.XmlRpc HttpWebResponse response = (HttpWebResponse)request.GetResponse(); StreamReader input = new StreamReader(response.GetResponseStream()); - XmlRpcResponse resp = (XmlRpcResponse)_deserializer.Deserialize(input); + string inputXml = input.ReadToEnd(); + XmlRpcResponse resp; + try + { + resp = (XmlRpcResponse)_deserializer.Deserialize(inputXml); + } + catch (Exception e) + { + RequestResponse = inputXml; + throw e; + } input.Close(); response.Close(); return resp; -- cgit v1.1 From 3b511d51388fa355c5ba4889cb7bc74c9c554b89 Mon Sep 17 00:00:00 2001 From: Michael Cortez Date: Wed, 16 Sep 2009 15:39:52 -0700 Subject: Try to filter the groups list returns for User A, when sending to User B, based on User A's preferences for ShowInProfile. --- .../Avatar/XmlRpcGroups/GroupsModule.cs | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs index 36adfad..79d7477 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs @@ -1277,10 +1277,23 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups // to the core Groups Stub remoteClient.SendGroupMembership(new GroupMembershipData[0]); - GroupMembershipData[] membershipData = m_groupData.GetAgentGroupMemberships(GetClientGroupRequestID(remoteClient), dataForAgentID).ToArray(); + List membershipData = m_groupData.GetAgentGroupMemberships(GetClientGroupRequestID(remoteClient), dataForAgentID); + GroupMembershipData[] membershipArray; - SendGroupMembershipInfoViaCaps(remoteClient, dataForAgentID, membershipData); - remoteClient.SendAvatarGroupsReply(dataForAgentID, membershipData); + if (remoteClient.AgentId != dataForAgentID) + { + Predicate showInProfile = delegate(GroupMembershipData membership) + { + return membership.ListInProfile; + }; + + membershipArray = membershipData.FindAll(showInProfile).ToArray(); + } else { + membershipArray = membershipData.ToArray(); + } + + SendGroupMembershipInfoViaCaps(remoteClient, dataForAgentID, membershipArray); + remoteClient.SendAvatarGroupsReply(dataForAgentID, membershipArray); } -- cgit v1.1 From 65b9084c65f61e5ddb2d4e106aff6ce4f899f2b6 Mon Sep 17 00:00:00 2001 From: Michael Cortez Date: Wed, 16 Sep 2009 16:12:23 -0700 Subject: Add a little debugging for filtered groups lists based on requester --- .../Avatar/XmlRpcGroups/GroupsModule.cs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs index 79d7477..9d56ba8 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs @@ -1191,6 +1191,16 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups foreach (GroupMembershipData membership in data) { + if (remoteClient.AgentId != dataForAgentID) + { + if (!membership.ListInProfile) + { + // If we're sending group info to remoteclient about another agent, + // filter out groups the other agent doesn't want to share. + continue; + } + } + OSDMap GroupDataMap = new OSDMap(6); OSDMap NewGroupDataMap = new OSDMap(1); @@ -1292,6 +1302,15 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups membershipArray = membershipData.ToArray(); } + if (m_debugEnabled) + { + m_log.InfoFormat("[GROUPS]: Sending group membership information for {0} to {1}", dataForAgentID, remoteClient.AgentId); + foreach (GroupMembershipData membership in membershipArray) + { + m_log.InfoFormat("[GROUPS]: {0} :: {1} - {2}", dataForAgentID, membership.GroupName, membership.GroupTitle); + } + } + SendGroupMembershipInfoViaCaps(remoteClient, dataForAgentID, membershipArray); remoteClient.SendAvatarGroupsReply(dataForAgentID, membershipArray); -- cgit v1.1 From 4eb07232e0e8ff36388c21c3b5522b81ee8ef156 Mon Sep 17 00:00:00 2001 From: Michael Cortez Date: Wed, 16 Sep 2009 16:51:22 -0700 Subject: Group Membership information is sent out from two different locations, refactored out the filtered membership list code and used it in both locations. --- .../Avatar/XmlRpcGroups/GroupsModule.cs | 32 ++++++++++++++++------ 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs index 9d56ba8..d5cbfd4 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs @@ -281,7 +281,10 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups private void OnRequestAvatarProperties(IClientAPI remoteClient, UUID avatarID) { - GroupMembershipData[] avatarGroups = m_groupData.GetAgentGroupMemberships(GetClientGroupRequestID(remoteClient), avatarID).ToArray(); + if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); + + //GroupMembershipData[] avatarGroups = m_groupData.GetAgentGroupMemberships(GetClientGroupRequestID(remoteClient), avatarID).ToArray(); + GroupMembershipData[] avatarGroups = GetProfileListedGroupMemberships(remoteClient, avatarID); remoteClient.SendAvatarGroupsReply(avatarID, avatarGroups); } @@ -1287,10 +1290,23 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups // to the core Groups Stub remoteClient.SendGroupMembership(new GroupMembershipData[0]); - List membershipData = m_groupData.GetAgentGroupMemberships(GetClientGroupRequestID(remoteClient), dataForAgentID); + GroupMembershipData[] membershipArray = GetProfileListedGroupMemberships(remoteClient, dataForAgentID); + SendGroupMembershipInfoViaCaps(remoteClient, dataForAgentID, membershipArray); + remoteClient.SendAvatarGroupsReply(dataForAgentID, membershipArray); + + } + + /// + /// Get a list of groups memberships for the agent that are marked "ListInProfile" + /// + /// + /// + private GroupMembershipData[] GetProfileListedGroupMemberships(IClientAPI requestingClient, UUID dataForAgentID) + { + List membershipData = m_groupData.GetAgentGroupMemberships(GetClientGroupRequestID(requestingClient), dataForAgentID); GroupMembershipData[] membershipArray; - if (remoteClient.AgentId != dataForAgentID) + if (requestingClient.AgentId != dataForAgentID) { Predicate showInProfile = delegate(GroupMembershipData membership) { @@ -1298,22 +1314,22 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups }; membershipArray = membershipData.FindAll(showInProfile).ToArray(); - } else { + } + else + { membershipArray = membershipData.ToArray(); } if (m_debugEnabled) { - m_log.InfoFormat("[GROUPS]: Sending group membership information for {0} to {1}", dataForAgentID, remoteClient.AgentId); + m_log.InfoFormat("[GROUPS]: Get group membership information for {0} requested by {1}", dataForAgentID, requestingClient.AgentId); foreach (GroupMembershipData membership in membershipArray) { m_log.InfoFormat("[GROUPS]: {0} :: {1} - {2}", dataForAgentID, membership.GroupName, membership.GroupTitle); } } - SendGroupMembershipInfoViaCaps(remoteClient, dataForAgentID, membershipArray); - remoteClient.SendAvatarGroupsReply(dataForAgentID, membershipArray); - + return membershipArray; } private void SendAgentDataUpdate(IClientAPI remoteClient, UUID dataForAgentID, UUID activeGroupID, string activeGroupName, ulong activeGroupPowers, string activeGroupTitle) -- cgit v1.1 From 33ea86374a19e9d74d673f363b7981b84afe177c Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 18 Sep 2009 22:22:00 +0100 Subject: provide intelligble warning of why load/save iar doesn't work on grid mode, pending a fix --- .../Avatar/Inventory/Archiver/InventoryArchiverModule.cs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs index 9f49da9..dc201e1 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs @@ -324,6 +324,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver protected CachedUserInfo GetUserInfo(string firstName, string lastName, string pass) { CachedUserInfo userInfo = m_aScene.CommsManager.UserProfileCacheService.GetUserDetails(firstName, lastName); + //m_aScene.CommsManager.UserService.GetUserProfile(firstName, lastName); if (null == userInfo) { m_log.ErrorFormat( @@ -333,6 +334,19 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver } string md5PasswdHash = Util.Md5Hash(Util.Md5Hash(pass) + ":" + userInfo.UserProfile.PasswordSalt); + + if (userInfo.UserProfile.PasswordHash == null || userInfo.UserProfile.PasswordHash == String.Empty) + { + m_log.ErrorFormat( + "[INVENTORY ARCHIVER]: Sorry, the grid mode service is not providing password hash details for the check. This will be fixed in an OpenSim git revision soon"); + + return null; + } + +// m_log.DebugFormat( +// "[INVENTORY ARCHIVER]: received salt {0}, hash {1}, supplied hash {2}", +// userInfo.UserProfile.PasswordSalt, userInfo.UserProfile.PasswordHash, md5PasswdHash); + if (userInfo.UserProfile.PasswordHash != md5PasswdHash) { m_log.ErrorFormat( -- cgit v1.1 From 967cbde055948f7ccbe1908a296a4d155e646009 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 18 Sep 2009 22:25:32 +0100 Subject: correct off-by-one error in save iar command handling --- .../CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs index dc201e1..196205c 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs @@ -264,7 +264,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver /// protected void HandleSaveInvConsoleCommand(string module, string[] cmdparams) { - if (cmdparams.Length < 5) + if (cmdparams.Length < 6) { m_log.Error( "[INVENTORY ARCHIVER]: usage is save iar []"); -- cgit v1.1