From 1bd0b06ec1a0a5a7d6302d8017edcea7faf557e0 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 16 Aug 2010 20:38:20 +0100 Subject: Implement Dynamic Attributes for SOP and PBS. Implement storage in SQLite --- OpenSim/Framework/DynAttrsOSDMap.cs | 79 +++++++++++++++++++++++++++++++++ OpenSim/Framework/PrimitiveBaseShape.cs | 7 +++ 2 files changed, 86 insertions(+) create mode 100644 OpenSim/Framework/DynAttrsOSDMap.cs (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/DynAttrsOSDMap.cs b/OpenSim/Framework/DynAttrsOSDMap.cs new file mode 100644 index 0000000..2d45f66 --- /dev/null +++ b/OpenSim/Framework/DynAttrsOSDMap.cs @@ -0,0 +1,79 @@ +/* + * 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.Text; +using System.Xml; +using System.Xml.Schema; +using System.Xml.Serialization; +using OpenMetaverse; +using OpenMetaverse.StructuredData; + +namespace OpenSim.Framework +{ + /// + /// This is the map for storing and retrieving dynamic attributes. + /// + public class DynAttrsOSDMap : OSDMap, IXmlSerializable + { + public XmlSchema GetSchema() { return null; } + + public static DynAttrsOSDMap FromXml(string rawXml) + { + DynAttrsOSDMap map = new DynAttrsOSDMap(); + map.ReadXml(rawXml); + return map; + } + + public void ReadXml(string rawXml) + { + //System.Console.WriteLine("Trying to deserialize [{0}]", rawXml); + + OSDMap map = (OSDMap)OSDParser.DeserializeLLSDXml(rawXml); + + foreach (string key in map.Keys) + this[key] = map[key]; + } + + public void ReadXml(XmlReader reader) + { + ReadXml(reader.ReadInnerXml()); + } + + public string ToXml() + { + return OSDParser.SerializeLLSDXmlString(this); + } + + public void WriteXml(XmlWriter writer) + { + writer.WriteRaw(ToXml()); + } + } +} \ No newline at end of file diff --git a/OpenSim/Framework/PrimitiveBaseShape.cs b/OpenSim/Framework/PrimitiveBaseShape.cs index 4c36819..fb0255b 100644 --- a/OpenSim/Framework/PrimitiveBaseShape.cs +++ b/OpenSim/Framework/PrimitiveBaseShape.cs @@ -82,6 +82,11 @@ namespace OpenSim.Framework private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly byte[] DEFAULT_TEXTURE = new Primitive.TextureEntry(new UUID("89556747-24cb-43ed-920b-47caed15465f")).GetBytes(); + + /// + /// Dynamic attributes can be created and deleted as required. + /// + public DynAttrsOSDMap DynAttrs { get; set; } private byte[] m_textureEntry; @@ -194,6 +199,7 @@ namespace OpenSim.Framework { PCode = (byte)PCodeEnum.Primitive; m_textureEntry = DEFAULT_TEXTURE; + DynAttrs = new DynAttrsOSDMap(); } /// @@ -205,6 +211,7 @@ namespace OpenSim.Framework // m_log.DebugFormat("[PRIMITIVE BASE SHAPE]: Creating from {0}", prim.ID); PCode = (byte)prim.PrimData.PCode; + DynAttrs = new DynAttrsOSDMap(); State = prim.PrimData.State; PathBegin = Primitive.PackBeginCut(prim.PrimData.PathBegin); -- cgit v1.1 From a6d9c263650cc23d60f941718f87a64aa2f360b2 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 16 Aug 2010 22:21:46 +0100 Subject: Encapsulate an OSDMap in DAMap (was DynAttrsOSDMap) rather than inheriting from it This is the easier way to give us control over locking, rather than asking that OSDMap IDictionary methods be virtual --- OpenSim/Framework/DAMap.cs | 173 ++++++++++++++++++++++++++++++++ OpenSim/Framework/DynAttrsOSDMap.cs | 79 --------------- OpenSim/Framework/PrimitiveBaseShape.cs | 6 +- 3 files changed, 176 insertions(+), 82 deletions(-) create mode 100644 OpenSim/Framework/DAMap.cs delete mode 100644 OpenSim/Framework/DynAttrsOSDMap.cs (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/DAMap.cs b/OpenSim/Framework/DAMap.cs new file mode 100644 index 0000000..a6fdf61 --- /dev/null +++ b/OpenSim/Framework/DAMap.cs @@ -0,0 +1,173 @@ +/* + * 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.IO; +using System.Text; +using System.Xml; +using System.Xml.Schema; +using System.Xml.Serialization; +using OpenMetaverse; +using OpenMetaverse.StructuredData; + +namespace OpenSim.Framework +{ + /// + /// This is the map for storing and retrieving dynamic attributes. + /// + public class DAMap : IDictionary, IXmlSerializable + { + protected OSDMap m_map; + + public DAMap() { m_map = new OSDMap(); } + + public XmlSchema GetSchema() { return null; } + + public static DAMap FromXml(string rawXml) + { + DAMap map = new DAMap(); + map.ReadXml(rawXml); + return map; + } + + public void ReadXml(string rawXml) + { + //System.Console.WriteLine("Trying to deserialize [{0}]", rawXml); + + m_map = (OSDMap)OSDParser.DeserializeLLSDXml(rawXml); + } + + public void ReadXml(XmlReader reader) + { + ReadXml(reader.ReadInnerXml()); + } + + public string ToXml() + { + lock (m_map) + return OSDParser.SerializeLLSDXmlString(m_map); + } + + public void WriteXml(XmlWriter writer) + { + writer.WriteRaw(ToXml()); + } + + public int Count { get { lock (m_map) { return m_map.Count; } } } + public bool IsReadOnly { get { return false; } } + public ICollection Keys { get { lock (m_map) { return m_map.Keys; } } } + public ICollection Values { get { lock (m_map) { return m_map.Values; } } } + public OSD this[string key] + { + get + { + OSD llsd; + + lock (m_map) + { + if (m_map.TryGetValue(key, out llsd)) + return llsd; + else + return null; + } + } + set { lock (m_map) { m_map[key] = value; } } + } + + public bool ContainsKey(string key) + { + lock (m_map) + return m_map.ContainsKey(key); + } + + public void Add(string key, OSD llsd) + { + lock (m_map) + m_map.Add(key, llsd); + } + + public void Add(KeyValuePair kvp) + { + lock (m_map) + m_map.Add(kvp.Key, kvp.Value); + } + + public bool Remove(string key) + { + lock (m_map) + return m_map.Remove(key); + } + + public bool TryGetValue(string key, out OSD llsd) + { + lock (m_map) + return m_map.TryGetValue(key, out llsd); + } + + public void Clear() + { + lock (m_map) + m_map.Clear(); + } + + public bool Contains(KeyValuePair kvp) + { + lock (m_map) + return m_map.ContainsKey(kvp.Key); + } + + public void CopyTo(KeyValuePair[] array, int index) + { + throw new NotImplementedException(); + } + + public bool Remove(KeyValuePair kvp) + { + lock (m_map) + return m_map.Remove(kvp.Key); + } + + public System.Collections.IDictionaryEnumerator GetEnumerator() + { + lock (m_map) + return m_map.GetEnumerator(); + } + + IEnumerator> IEnumerable>.GetEnumerator() + { + return null; + } + + IEnumerator IEnumerable.GetEnumerator() + { + lock (m_map) + return m_map.GetEnumerator(); + } + } +} \ No newline at end of file diff --git a/OpenSim/Framework/DynAttrsOSDMap.cs b/OpenSim/Framework/DynAttrsOSDMap.cs deleted file mode 100644 index 2d45f66..0000000 --- a/OpenSim/Framework/DynAttrsOSDMap.cs +++ /dev/null @@ -1,79 +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.Text; -using System.Xml; -using System.Xml.Schema; -using System.Xml.Serialization; -using OpenMetaverse; -using OpenMetaverse.StructuredData; - -namespace OpenSim.Framework -{ - /// - /// This is the map for storing and retrieving dynamic attributes. - /// - public class DynAttrsOSDMap : OSDMap, IXmlSerializable - { - public XmlSchema GetSchema() { return null; } - - public static DynAttrsOSDMap FromXml(string rawXml) - { - DynAttrsOSDMap map = new DynAttrsOSDMap(); - map.ReadXml(rawXml); - return map; - } - - public void ReadXml(string rawXml) - { - //System.Console.WriteLine("Trying to deserialize [{0}]", rawXml); - - OSDMap map = (OSDMap)OSDParser.DeserializeLLSDXml(rawXml); - - foreach (string key in map.Keys) - this[key] = map[key]; - } - - public void ReadXml(XmlReader reader) - { - ReadXml(reader.ReadInnerXml()); - } - - public string ToXml() - { - return OSDParser.SerializeLLSDXmlString(this); - } - - public void WriteXml(XmlWriter writer) - { - writer.WriteRaw(ToXml()); - } - } -} \ No newline at end of file diff --git a/OpenSim/Framework/PrimitiveBaseShape.cs b/OpenSim/Framework/PrimitiveBaseShape.cs index fb0255b..775412b 100644 --- a/OpenSim/Framework/PrimitiveBaseShape.cs +++ b/OpenSim/Framework/PrimitiveBaseShape.cs @@ -86,7 +86,7 @@ namespace OpenSim.Framework /// /// Dynamic attributes can be created and deleted as required. /// - public DynAttrsOSDMap DynAttrs { get; set; } + public DAMap DynAttrs { get; set; } private byte[] m_textureEntry; @@ -199,7 +199,7 @@ namespace OpenSim.Framework { PCode = (byte)PCodeEnum.Primitive; m_textureEntry = DEFAULT_TEXTURE; - DynAttrs = new DynAttrsOSDMap(); + DynAttrs = new DAMap(); } /// @@ -211,7 +211,7 @@ namespace OpenSim.Framework // m_log.DebugFormat("[PRIMITIVE BASE SHAPE]: Creating from {0}", prim.ID); PCode = (byte)prim.PrimData.PCode; - DynAttrs = new DynAttrsOSDMap(); + DynAttrs = new DAMap(); State = prim.PrimData.State; PathBegin = Primitive.PackBeginCut(prim.PrimData.PathBegin); -- cgit v1.1 From 1650846df32872fa64a8d944f2144b866f17c57a Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 16 Aug 2010 22:28:48 +0100 Subject: Lock DAMap rather than encapsulated OSDMap This allows external lockers to preserve atomicity of dynamic attribute changes --- OpenSim/Framework/DAMap.cs | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/DAMap.cs b/OpenSim/Framework/DAMap.cs index a6fdf61..7551a10 100644 --- a/OpenSim/Framework/DAMap.cs +++ b/OpenSim/Framework/DAMap.cs @@ -60,7 +60,8 @@ namespace OpenSim.Framework { //System.Console.WriteLine("Trying to deserialize [{0}]", rawXml); - m_map = (OSDMap)OSDParser.DeserializeLLSDXml(rawXml); + lock (this) + m_map = (OSDMap)OSDParser.DeserializeLLSDXml(rawXml); } public void ReadXml(XmlReader reader) @@ -70,7 +71,7 @@ namespace OpenSim.Framework public string ToXml() { - lock (m_map) + lock (this) return OSDParser.SerializeLLSDXmlString(m_map); } @@ -79,17 +80,17 @@ namespace OpenSim.Framework writer.WriteRaw(ToXml()); } - public int Count { get { lock (m_map) { return m_map.Count; } } } + public int Count { get { lock (this) { return m_map.Count; } } } public bool IsReadOnly { get { return false; } } - public ICollection Keys { get { lock (m_map) { return m_map.Keys; } } } - public ICollection Values { get { lock (m_map) { return m_map.Values; } } } + public ICollection Keys { get { lock (this) { return m_map.Keys; } } } + public ICollection Values { get { lock (this) { return m_map.Values; } } } public OSD this[string key] { get { OSD llsd; - lock (m_map) + lock (this) { if (m_map.TryGetValue(key, out llsd)) return llsd; @@ -97,48 +98,48 @@ namespace OpenSim.Framework return null; } } - set { lock (m_map) { m_map[key] = value; } } + set { lock (this) { m_map[key] = value; } } } public bool ContainsKey(string key) { - lock (m_map) + lock (this) return m_map.ContainsKey(key); } public void Add(string key, OSD llsd) { - lock (m_map) + lock (this) m_map.Add(key, llsd); } public void Add(KeyValuePair kvp) { - lock (m_map) + lock (this) m_map.Add(kvp.Key, kvp.Value); } public bool Remove(string key) { - lock (m_map) + lock (this) return m_map.Remove(key); } public bool TryGetValue(string key, out OSD llsd) { - lock (m_map) + lock (this) return m_map.TryGetValue(key, out llsd); } public void Clear() { - lock (m_map) + lock (this) m_map.Clear(); } public bool Contains(KeyValuePair kvp) { - lock (m_map) + lock (this) return m_map.ContainsKey(kvp.Key); } @@ -149,13 +150,13 @@ namespace OpenSim.Framework public bool Remove(KeyValuePair kvp) { - lock (m_map) + lock (this) return m_map.Remove(kvp.Key); } public System.Collections.IDictionaryEnumerator GetEnumerator() { - lock (m_map) + lock (this) return m_map.GetEnumerator(); } @@ -166,7 +167,7 @@ namespace OpenSim.Framework IEnumerator IEnumerable.GetEnumerator() { - lock (m_map) + lock (this) return m_map.GetEnumerator(); } } -- cgit v1.1 From 8b4441d940a55da90645580477ece33d15849078 Mon Sep 17 00:00:00 2001 From: Oren Hurvitz Date: Tue, 22 Jan 2013 08:41:32 +0200 Subject: Changed DAMap to be the container of "data stores", which are OSDMaps. Store names must have at least 4 characters. --- OpenSim/Framework/DAMap.cs | 104 ++++++++++++++++++++++++++++++++++++--------- 1 file changed, 84 insertions(+), 20 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/DAMap.cs b/OpenSim/Framework/DAMap.cs index 7551a10..c256230 100644 --- a/OpenSim/Framework/DAMap.cs +++ b/OpenSim/Framework/DAMap.cs @@ -39,10 +39,19 @@ using OpenMetaverse.StructuredData; namespace OpenSim.Framework { /// - /// This is the map for storing and retrieving dynamic attributes. + /// This class stores and retrieves dynamic attributes. /// - public class DAMap : IDictionary, IXmlSerializable - { + /// + /// Modules that want to use dynamic attributes need to do so in a private data store + /// which is accessed using a unique name. DAMap provides access to the data stores, + /// each of which is an OSDMap. Modules are free to store any type of data they want + /// within their data store. However, avoid storing large amounts of data because that + /// would slow down database access. + /// + public class DAMap : IDictionary, IXmlSerializable + { + private static readonly int MIN_STORE_NAME_LENGTH = 4; + protected OSDMap m_map; public DAMap() { m_map = new OSDMap(); } @@ -79,12 +88,42 @@ namespace OpenSim.Framework { writer.WriteRaw(ToXml()); } - + + /// + /// Returns the number of data stores. + /// public int Count { get { lock (this) { return m_map.Count; } } } + public bool IsReadOnly { get { return false; } } + + /// + /// Returns the names of the data stores. + /// public ICollection Keys { get { lock (this) { return m_map.Keys; } } } - public ICollection Values { get { lock (this) { return m_map.Values; } } } - public OSD this[string key] + + /// + /// Returns all the data stores. + /// + public ICollection Values + { + get + { + lock (this) + { + List stores = new List(m_map.Count); + foreach (OSD llsd in m_map.Values) + stores.Add((OSDMap)llsd); + return stores; + } + } + } + + /// + /// Gets or sets one data store. + /// + /// Store name + /// + public OSDMap this[string key] { get { @@ -93,13 +132,25 @@ namespace OpenSim.Framework lock (this) { if (m_map.TryGetValue(key, out llsd)) - return llsd; + return (OSDMap)llsd; else return null; } } - set { lock (this) { m_map[key] = value; } } - } + + set + { + ValidateKey(key); + lock (this) + m_map[key] = value; + } + } + + private static void ValidateKey(string key) + { + if (key.Length < MIN_STORE_NAME_LENGTH) + throw new Exception("Minimum store name length is " + MIN_STORE_NAME_LENGTH); + } public bool ContainsKey(string key) { @@ -107,13 +158,14 @@ namespace OpenSim.Framework return m_map.ContainsKey(key); } - public void Add(string key, OSD llsd) - { + public void Add(string key, OSDMap store) + { + ValidateKey(key); lock (this) - m_map.Add(key, llsd); + m_map.Add(key, store); } - public void Add(KeyValuePair kvp) + public void Add(KeyValuePair kvp) { lock (this) m_map.Add(kvp.Key, kvp.Value); @@ -125,10 +177,22 @@ namespace OpenSim.Framework return m_map.Remove(key); } - public bool TryGetValue(string key, out OSD llsd) - { + public bool TryGetValue(string key, out OSDMap store) + { lock (this) - return m_map.TryGetValue(key, out llsd); + { + OSD llsd; + if (m_map.TryGetValue(key, out llsd)) + { + store = (OSDMap)llsd; + return true; + } + else + { + store = null; + return false; + } + } } public void Clear() @@ -137,18 +201,18 @@ namespace OpenSim.Framework m_map.Clear(); } - public bool Contains(KeyValuePair kvp) + public bool Contains(KeyValuePair kvp) { lock (this) return m_map.ContainsKey(kvp.Key); } - public void CopyTo(KeyValuePair[] array, int index) + public void CopyTo(KeyValuePair[] array, int index) { throw new NotImplementedException(); } - public bool Remove(KeyValuePair kvp) + public bool Remove(KeyValuePair kvp) { lock (this) return m_map.Remove(kvp.Key); @@ -160,7 +224,7 @@ namespace OpenSim.Framework return m_map.GetEnumerator(); } - IEnumerator> IEnumerable>.GetEnumerator() + IEnumerator> IEnumerable>.GetEnumerator() { return null; } -- cgit v1.1 From fdec05a15ef126f344c03427e9ef264b4248646b Mon Sep 17 00:00:00 2001 From: Oren Hurvitz Date: Tue, 22 Jan 2013 08:49:36 +0200 Subject: Stopped storing dynamic attributes in the PrimShape --- OpenSim/Framework/PrimitiveBaseShape.cs | 7 ------- 1 file changed, 7 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/PrimitiveBaseShape.cs b/OpenSim/Framework/PrimitiveBaseShape.cs index 775412b..4c36819 100644 --- a/OpenSim/Framework/PrimitiveBaseShape.cs +++ b/OpenSim/Framework/PrimitiveBaseShape.cs @@ -82,11 +82,6 @@ namespace OpenSim.Framework private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly byte[] DEFAULT_TEXTURE = new Primitive.TextureEntry(new UUID("89556747-24cb-43ed-920b-47caed15465f")).GetBytes(); - - /// - /// Dynamic attributes can be created and deleted as required. - /// - public DAMap DynAttrs { get; set; } private byte[] m_textureEntry; @@ -199,7 +194,6 @@ namespace OpenSim.Framework { PCode = (byte)PCodeEnum.Primitive; m_textureEntry = DEFAULT_TEXTURE; - DynAttrs = new DAMap(); } /// @@ -211,7 +205,6 @@ namespace OpenSim.Framework // m_log.DebugFormat("[PRIMITIVE BASE SHAPE]: Creating from {0}", prim.ID); PCode = (byte)prim.PrimData.PCode; - DynAttrs = new DAMap(); State = prim.PrimData.State; PathBegin = Primitive.PackBeginCut(prim.PrimData.PathBegin); -- cgit v1.1 From af6a7cf95df76708d013932d8ef92c9bbeda0e5d Mon Sep 17 00:00:00 2001 From: Oren Hurvitz Date: Tue, 22 Jan 2013 11:59:20 +0200 Subject: Added DynAttrs to the serialized XML format of prims. When copying prims, use deep copy for DynAttrs. --- OpenSim/Framework/DAMap.cs | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/DAMap.cs b/OpenSim/Framework/DAMap.cs index c256230..291c8b8 100644 --- a/OpenSim/Framework/DAMap.cs +++ b/OpenSim/Framework/DAMap.cs @@ -67,7 +67,7 @@ namespace OpenSim.Framework public void ReadXml(string rawXml) { - //System.Console.WriteLine("Trying to deserialize [{0}]", rawXml); + // System.Console.WriteLine("Trying to deserialize [{0}]", rawXml); lock (this) m_map = (OSDMap)OSDParser.DeserializeLLSDXml(rawXml); @@ -87,7 +87,29 @@ namespace OpenSim.Framework public void WriteXml(XmlWriter writer) { writer.WriteRaw(ToXml()); - } + } + + public void CopyFrom(DAMap other) + { + // Deep copy + + string data = null; + lock (other) + { + if (other.Count > 0) + { + data = OSDParser.SerializeLLSDXmlString(other.m_map); + } + } + + lock (this) + { + if (data == null) + Clear(); + else + m_map = (OSDMap)OSDParser.DeserializeLLSDXml(data); + } + } /// /// Returns the number of data stores. -- cgit v1.1 From 1f1da230976451d30d920c237d53c699ba96b9d9 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 5 Feb 2013 00:23:17 +0000 Subject: Bump version and assembly version numbers from 0.7.5 to 0.7.6 This is mostly Bluewall's work but I am also bumping the general version number OpenSimulator 0.7.5 remains in the release candidate stage. I'm doing this because master is significantly adding things that will not be in 0.7.5 This update should not cause issues with existing external binary DLLs because our DLLs do not have strong names and so the exact version match requirement is not in force. --- OpenSim/Framework/AssemblyInfo.cs | 2 +- OpenSim/Framework/AssetLoader/Filesystem/Properties/AssemblyInfo.cs | 2 +- OpenSim/Framework/Communications/Properties/AssemblyInfo.cs | 2 +- OpenSim/Framework/Configuration/HTTP/Properties/AssemblyInfo.cs | 2 +- OpenSim/Framework/Configuration/XML/Properties/AssemblyInfo.cs | 2 +- OpenSim/Framework/Console/AssemblyInfo.cs | 2 +- OpenSim/Framework/Monitoring/Properties/AssemblyInfo.cs | 2 +- OpenSim/Framework/RegionLoader/Filesystem/Properties/AssemblyInfo.cs | 2 +- OpenSim/Framework/RegionLoader/Web/Properties/AssemblyInfo.cs | 2 +- OpenSim/Framework/Serialization/Properties/AssemblyInfo.cs | 2 +- OpenSim/Framework/Servers/HttpServer/Properties/AssemblyInfo.cs | 2 +- OpenSim/Framework/Servers/Properties/AssemblyInfo.cs | 2 +- OpenSim/Framework/Servers/VersionInfo.cs | 2 +- 13 files changed, 13 insertions(+), 13 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/AssemblyInfo.cs b/OpenSim/Framework/AssemblyInfo.cs index 02986d5..b3db56c 100644 --- a/OpenSim/Framework/AssemblyInfo.cs +++ b/OpenSim/Framework/AssemblyInfo.cs @@ -59,5 +59,5 @@ using System.Runtime.InteropServices; // Revision // -[assembly : AssemblyVersion("0.7.5.*")] +[assembly : AssemblyVersion("0.7.6.*")] [assembly : AssemblyFileVersion("0.6.5.0")] \ No newline at end of file diff --git a/OpenSim/Framework/AssetLoader/Filesystem/Properties/AssemblyInfo.cs b/OpenSim/Framework/AssetLoader/Filesystem/Properties/AssemblyInfo.cs index 0498ed4..077244d 100644 --- a/OpenSim/Framework/AssetLoader/Filesystem/Properties/AssemblyInfo.cs +++ b/OpenSim/Framework/AssetLoader/Filesystem/Properties/AssemblyInfo.cs @@ -29,5 +29,5 @@ using System.Runtime.InteropServices; // Build Number // Revision // -[assembly: AssemblyVersion("0.7.5.*")] +[assembly: AssemblyVersion("0.7.6.*")] [assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/OpenSim/Framework/Communications/Properties/AssemblyInfo.cs b/OpenSim/Framework/Communications/Properties/AssemblyInfo.cs index 6d1c03a..cf575ac 100644 --- a/OpenSim/Framework/Communications/Properties/AssemblyInfo.cs +++ b/OpenSim/Framework/Communications/Properties/AssemblyInfo.cs @@ -61,5 +61,5 @@ using System.Runtime.InteropServices; // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: -[assembly : AssemblyVersion("0.7.5.*")] +[assembly : AssemblyVersion("0.7.6.*")] [assembly : AssemblyFileVersion("0.6.5.0")] diff --git a/OpenSim/Framework/Configuration/HTTP/Properties/AssemblyInfo.cs b/OpenSim/Framework/Configuration/HTTP/Properties/AssemblyInfo.cs index 0674656..c3b6227 100644 --- a/OpenSim/Framework/Configuration/HTTP/Properties/AssemblyInfo.cs +++ b/OpenSim/Framework/Configuration/HTTP/Properties/AssemblyInfo.cs @@ -29,5 +29,5 @@ using System.Runtime.InteropServices; // Build Number // Revision // -[assembly: AssemblyVersion("0.7.5.*")] +[assembly: AssemblyVersion("0.7.6.*")] [assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/OpenSim/Framework/Configuration/XML/Properties/AssemblyInfo.cs b/OpenSim/Framework/Configuration/XML/Properties/AssemblyInfo.cs index 1095b23..b0d2d67 100644 --- a/OpenSim/Framework/Configuration/XML/Properties/AssemblyInfo.cs +++ b/OpenSim/Framework/Configuration/XML/Properties/AssemblyInfo.cs @@ -29,5 +29,5 @@ using System.Runtime.InteropServices; // Build Number // Revision // -[assembly: AssemblyVersion("0.7.5.*")] +[assembly: AssemblyVersion("0.7.6.*")] [assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/OpenSim/Framework/Console/AssemblyInfo.cs b/OpenSim/Framework/Console/AssemblyInfo.cs index 37c7304..c618454 100644 --- a/OpenSim/Framework/Console/AssemblyInfo.cs +++ b/OpenSim/Framework/Console/AssemblyInfo.cs @@ -55,4 +55,4 @@ using System.Runtime.InteropServices; // You can specify all values by your own or you can build default build and revision // numbers with the '*' character (the default): -[assembly : AssemblyVersion("0.7.5.*")] +[assembly : AssemblyVersion("0.7.6.*")] diff --git a/OpenSim/Framework/Monitoring/Properties/AssemblyInfo.cs b/OpenSim/Framework/Monitoring/Properties/AssemblyInfo.cs index 1f2bb40..bb83db1 100644 --- a/OpenSim/Framework/Monitoring/Properties/AssemblyInfo.cs +++ b/OpenSim/Framework/Monitoring/Properties/AssemblyInfo.cs @@ -29,5 +29,5 @@ using System.Runtime.InteropServices; // Build Number // Revision // -[assembly: AssemblyVersion("0.7.5.*")] +[assembly: AssemblyVersion("0.7.6.*")] [assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/OpenSim/Framework/RegionLoader/Filesystem/Properties/AssemblyInfo.cs b/OpenSim/Framework/RegionLoader/Filesystem/Properties/AssemblyInfo.cs index d670f2f..f836350 100644 --- a/OpenSim/Framework/RegionLoader/Filesystem/Properties/AssemblyInfo.cs +++ b/OpenSim/Framework/RegionLoader/Filesystem/Properties/AssemblyInfo.cs @@ -29,5 +29,5 @@ using System.Runtime.InteropServices; // Build Number // Revision // -[assembly: AssemblyVersion("0.7.5.*")] +[assembly: AssemblyVersion("0.7.6.*")] [assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/OpenSim/Framework/RegionLoader/Web/Properties/AssemblyInfo.cs b/OpenSim/Framework/RegionLoader/Web/Properties/AssemblyInfo.cs index 7309a12..72fa679 100644 --- a/OpenSim/Framework/RegionLoader/Web/Properties/AssemblyInfo.cs +++ b/OpenSim/Framework/RegionLoader/Web/Properties/AssemblyInfo.cs @@ -29,5 +29,5 @@ using System.Runtime.InteropServices; // Build Number // Revision // -[assembly: AssemblyVersion("0.7.5.*")] +[assembly: AssemblyVersion("0.7.6.*")] [assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/OpenSim/Framework/Serialization/Properties/AssemblyInfo.cs b/OpenSim/Framework/Serialization/Properties/AssemblyInfo.cs index 11efa4b..7a122da 100644 --- a/OpenSim/Framework/Serialization/Properties/AssemblyInfo.cs +++ b/OpenSim/Framework/Serialization/Properties/AssemblyInfo.cs @@ -29,5 +29,5 @@ using System.Runtime.InteropServices; // Build Number // Revision // -[assembly: AssemblyVersion("0.7.5.*")] +[assembly: AssemblyVersion("0.7.6.*")] [assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/OpenSim/Framework/Servers/HttpServer/Properties/AssemblyInfo.cs b/OpenSim/Framework/Servers/HttpServer/Properties/AssemblyInfo.cs index 02ecc25..386be2d 100644 --- a/OpenSim/Framework/Servers/HttpServer/Properties/AssemblyInfo.cs +++ b/OpenSim/Framework/Servers/HttpServer/Properties/AssemblyInfo.cs @@ -29,5 +29,5 @@ using System.Runtime.InteropServices; // Build Number // Revision // -[assembly: AssemblyVersion("0.7.5.*")] +[assembly: AssemblyVersion("0.7.6.*")] [assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/OpenSim/Framework/Servers/Properties/AssemblyInfo.cs b/OpenSim/Framework/Servers/Properties/AssemblyInfo.cs index 021f63c..792c62e 100644 --- a/OpenSim/Framework/Servers/Properties/AssemblyInfo.cs +++ b/OpenSim/Framework/Servers/Properties/AssemblyInfo.cs @@ -29,5 +29,5 @@ using System.Runtime.InteropServices; // Build Number // Revision // -[assembly: AssemblyVersion("0.7.5.*")] +[assembly: AssemblyVersion("0.7.6.*")] [assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/OpenSim/Framework/Servers/VersionInfo.cs b/OpenSim/Framework/Servers/VersionInfo.cs index c9d9770..80568e0 100644 --- a/OpenSim/Framework/Servers/VersionInfo.cs +++ b/OpenSim/Framework/Servers/VersionInfo.cs @@ -29,7 +29,7 @@ namespace OpenSim { public class VersionInfo { - private const string VERSION_NUMBER = "0.7.5"; + private const string VERSION_NUMBER = "0.7.6"; private const Flavour VERSION_FLAVOUR = Flavour.Dev; public enum Flavour -- cgit v1.1 From e5beb480eaf23fa7454728724de80b2a67ded1e8 Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 6 Feb 2013 08:03:04 +0000 Subject: Partial port of Avination's support for the new physics parameters. Implements the parameters as properties, the serialization and database storage (MySQL only). Implements llSetPrimitiveParams for prim physics shape and the other 4 extra params. Only the prim shape type "None" is currently functional. No support for the Viewer UI (yet), that will be ported in due course. Lots more to port, this is a large-ish changeset. --- OpenSim/Framework/ExtraPhysicsData.cs | 50 +++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 OpenSim/Framework/ExtraPhysicsData.cs (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/ExtraPhysicsData.cs b/OpenSim/Framework/ExtraPhysicsData.cs new file mode 100644 index 0000000..9e7334f --- /dev/null +++ b/OpenSim/Framework/ExtraPhysicsData.cs @@ -0,0 +1,50 @@ +/* + * 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 OpenMetaverse; + +namespace OpenSim.Framework +{ + public enum PhysShapeType : byte + { + prim = 0, + none = 1, + convex = 2, + + invalid = 255 // use to mark invalid data in ExtraPhysicsData + } + + public struct ExtraPhysicsData + { + public float Density; + public float GravitationModifier; + public float Friction; + public float Bounce; + public PhysShapeType PhysShapeType; + + } +} -- cgit v1.1 From e2c1e37b077bad2d1b6d0ac5277c3f9001d819dd Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 7 Feb 2013 00:15:50 +0000 Subject: Add key length validation to DAMap.Add(KeyValuePair kvp) to match Add(string key, OSDMap store) --- OpenSim/Framework/DAMap.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/DAMap.cs b/OpenSim/Framework/DAMap.cs index 291c8b8..dd9c61b 100644 --- a/OpenSim/Framework/DAMap.cs +++ b/OpenSim/Framework/DAMap.cs @@ -188,7 +188,8 @@ namespace OpenSim.Framework } public void Add(KeyValuePair kvp) - { + { + ValidateKey(kvp.Key); lock (this) m_map.Add(kvp.Key, kvp.Value); } -- cgit v1.1 From c8c5d74c22056deb0b079d0651c005d610626f66 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 7 Feb 2013 00:22:39 +0000 Subject: minor: add method doc to DAMap.ValidateKey() --- OpenSim/Framework/DAMap.cs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/DAMap.cs b/OpenSim/Framework/DAMap.cs index dd9c61b..24e0895 100644 --- a/OpenSim/Framework/DAMap.cs +++ b/OpenSim/Framework/DAMap.cs @@ -168,6 +168,10 @@ namespace OpenSim.Framework } } + /// + /// Validate the key used for storing separate data stores. + /// + /// private static void ValidateKey(string key) { if (key.Length < MIN_STORE_NAME_LENGTH) -- cgit v1.1 From df37738ce7702774c4d3ff1f3835bfe87e0f1a5e Mon Sep 17 00:00:00 2001 From: Dan Lake Date: Wed, 6 Feb 2013 16:42:55 -0800 Subject: WebStats will now use actual logfile as specified in OpenSim.exe.config rather than hardcoded ./OpenSim.log. This allows for rotating logs and other file appender types --- OpenSim/Framework/Util.cs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index 9b1e97d..d9148fb 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs @@ -45,6 +45,7 @@ using System.Text.RegularExpressions; using System.Xml; using System.Threading; using log4net; +using log4net.Appender; using Nini.Config; using Nwc.XmlRpc; using OpenMetaverse; @@ -816,9 +817,22 @@ namespace OpenSim.Framework return "."; } + public static string logFile() + { + foreach (IAppender appender in LogManager.GetRepository().GetAppenders()) + { + if (appender is FileAppender) + { + return ((FileAppender)appender).File; + } + } + + return "./OpenSim.log"; + } + public static string logDir() { - return "."; + return Path.GetDirectoryName(logFile()); } // From: http://coercedcode.blogspot.com/2008/03/c-generate-unique-filenames-within.html -- cgit v1.1 From e17392acbb46e1e48e169069a822f8b814762214 Mon Sep 17 00:00:00 2001 From: Mic Bowman Date: Wed, 6 Feb 2013 17:29:17 -0800 Subject: Enables script access to the per object dynamic attributes through the JsonStore script functions. Adds JsonAttachObjectStore to associate a store identifier with an object (scripts can only access the store in their host object, this could be extended but isn't necessary for now). Note this opens a method to the DAMap OSDMap. This will be removed later, but greatly simplifies the code for now. The JsonStore and these scripts are disabled by default. --- OpenSim/Framework/DAMap.cs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/DAMap.cs b/OpenSim/Framework/DAMap.cs index 291c8b8..7d7738a 100644 --- a/OpenSim/Framework/DAMap.cs +++ b/OpenSim/Framework/DAMap.cs @@ -73,6 +73,14 @@ namespace OpenSim.Framework m_map = (OSDMap)OSDParser.DeserializeLLSDXml(rawXml); } + // WARNING: this is temporary for experimentation only, it will be removed!!!! + public OSDMap TopLevelMap + { + get { return m_map; } + set { m_map = value; } + } + + public void ReadXml(XmlReader reader) { ReadXml(reader.ReadInnerXml()); -- cgit v1.1