aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2013-06-27 23:14:28 +0100
committerJustin Clark-Casey (justincc)2013-06-27 23:14:28 +0100
commitf7d09b898ad6df32b3f07cb64657623980178c2f (patch)
treef7f2b1117e9843267dab89993ad6d5492c1b3cc8 /OpenSim
parentUpdate temporary "Unknown UserUMMTGUN2" name to "Unknown UserUMMTGUN3" to see... (diff)
downloadopensim-SC_OLD-f7d09b898ad6df32b3f07cb64657623980178c2f.zip
opensim-SC_OLD-f7d09b898ad6df32b3f07cb64657623980178c2f.tar.gz
opensim-SC_OLD-f7d09b898ad6df32b3f07cb64657623980178c2f.tar.bz2
opensim-SC_OLD-f7d09b898ad6df32b3f07cb64657623980178c2f.tar.xz
Make the concept of namespaces explicit in dynamic attributes
This is in order to reduce the likelihood of naming clashes, make it easier to filter in/out attributes, ensure uniformity, etc. All dynattrs in the opensim distro itself or likely future ones should be in the "OpenSim" namespace. This does alter the underlying dynattrs data structure. All data in previous structures may not be available, though old structures should not cause errors. This is done without notice since this feature has been explicitly labelled as experimental, subject to change and has not been in a release. However, existing materials data is being preserved by moving it to the "Materials" store in the "OpenSim" namespace.
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Data/MSSQL/MSSQLSimulationData.cs2
-rw-r--r--OpenSim/Data/MySQL/MySQLSimulationData.cs2
-rw-r--r--OpenSim/Data/SQLite/SQLiteSimulationData.cs2
-rw-r--r--OpenSim/Framework/DAMap.cs300
-rw-r--r--OpenSim/Framework/DOMap.cs8
-rw-r--r--OpenSim/Region/CoreModules/Framework/DynamicAttributes/DAExampleModule.cs17
-rw-r--r--OpenSim/Region/CoreModules/Framework/DynamicAttributes/DOExampleModule.cs8
-rw-r--r--OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs44
-rw-r--r--OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/UuidGatherer.cs18
-rw-r--r--OpenSim/Region/OptionalModules/Materials/MaterialsDemoModule.cs26
11 files changed, 257 insertions, 172 deletions
diff --git a/OpenSim/Data/MSSQL/MSSQLSimulationData.cs b/OpenSim/Data/MSSQL/MSSQLSimulationData.cs
index 476f57a..5135050 100644
--- a/OpenSim/Data/MSSQL/MSSQLSimulationData.cs
+++ b/OpenSim/Data/MSSQL/MSSQLSimulationData.cs
@@ -2100,7 +2100,7 @@ VALUES
2100 parameters.Add(_Database.CreateParameter("LinkNumber", prim.LinkNum)); 2100 parameters.Add(_Database.CreateParameter("LinkNumber", prim.LinkNum));
2101 parameters.Add(_Database.CreateParameter("MediaURL", prim.MediaUrl)); 2101 parameters.Add(_Database.CreateParameter("MediaURL", prim.MediaUrl));
2102 2102
2103 if (prim.DynAttrs.Count > 0) 2103 if (prim.DynAttrs.CountNamespaces > 0)
2104 parameters.Add(_Database.CreateParameter("DynAttrs", prim.DynAttrs.ToXml())); 2104 parameters.Add(_Database.CreateParameter("DynAttrs", prim.DynAttrs.ToXml()));
2105 else 2105 else
2106 parameters.Add(_Database.CreateParameter("DynAttrs", null)); 2106 parameters.Add(_Database.CreateParameter("DynAttrs", null));
diff --git a/OpenSim/Data/MySQL/MySQLSimulationData.cs b/OpenSim/Data/MySQL/MySQLSimulationData.cs
index de52623..cf367ef 100644
--- a/OpenSim/Data/MySQL/MySQLSimulationData.cs
+++ b/OpenSim/Data/MySQL/MySQLSimulationData.cs
@@ -1679,7 +1679,7 @@ namespace OpenSim.Data.MySQL
1679 else 1679 else
1680 cmd.Parameters.AddWithValue("KeyframeMotion", new Byte[0]); 1680 cmd.Parameters.AddWithValue("KeyframeMotion", new Byte[0]);
1681 1681
1682 if (prim.DynAttrs.Count > 0) 1682 if (prim.DynAttrs.CountNamespaces > 0)
1683 cmd.Parameters.AddWithValue("DynAttrs", prim.DynAttrs.ToXml()); 1683 cmd.Parameters.AddWithValue("DynAttrs", prim.DynAttrs.ToXml());
1684 else 1684 else
1685 cmd.Parameters.AddWithValue("DynAttrs", null); 1685 cmd.Parameters.AddWithValue("DynAttrs", null);
diff --git a/OpenSim/Data/SQLite/SQLiteSimulationData.cs b/OpenSim/Data/SQLite/SQLiteSimulationData.cs
index c35bba2..eba6612 100644
--- a/OpenSim/Data/SQLite/SQLiteSimulationData.cs
+++ b/OpenSim/Data/SQLite/SQLiteSimulationData.cs
@@ -2176,7 +2176,7 @@ namespace OpenSim.Data.SQLite
2176 2176
2177 row["MediaURL"] = prim.MediaUrl; 2177 row["MediaURL"] = prim.MediaUrl;
2178 2178
2179 if (prim.DynAttrs.Count > 0) 2179 if (prim.DynAttrs.CountNamespaces > 0)
2180 row["DynAttrs"] = prim.DynAttrs.ToXml(); 2180 row["DynAttrs"] = prim.DynAttrs.ToXml();
2181 else 2181 else
2182 row["DynAttrs"] = null; 2182 row["DynAttrs"] = null;
diff --git a/OpenSim/Framework/DAMap.cs b/OpenSim/Framework/DAMap.cs
index df4a6bc..a57393b 100644
--- a/OpenSim/Framework/DAMap.cs
+++ b/OpenSim/Framework/DAMap.cs
@@ -29,10 +29,12 @@ using System;
29using System.Collections; 29using System.Collections;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.IO; 31using System.IO;
32using System.Reflection;
32using System.Text; 33using System.Text;
33using System.Xml; 34using System.Xml;
34using System.Xml.Schema; 35using System.Xml.Schema;
35using System.Xml.Serialization; 36using System.Xml.Serialization;
37using log4net;
36using OpenMetaverse; 38using OpenMetaverse;
37using OpenMetaverse.StructuredData; 39using OpenMetaverse.StructuredData;
38 40
@@ -48,13 +50,20 @@ namespace OpenSim.Framework
48 /// within their data store. However, avoid storing large amounts of data because that 50 /// within their data store. However, avoid storing large amounts of data because that
49 /// would slow down database access. 51 /// would slow down database access.
50 /// </remarks> 52 /// </remarks>
51 public class DAMap : IDictionary<string, OSDMap>, IXmlSerializable 53 public class DAMap : IXmlSerializable
52 { 54 {
53 private static readonly int MIN_STORE_NAME_LENGTH = 4; 55// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
54 56
55 protected OSDMap m_map; 57 private static readonly int MIN_NAMESPACE_LENGTH = 4;
56 58
57 public DAMap() { m_map = new OSDMap(); } 59 private OSDMap m_map = new OSDMap();
60
61 // WARNING: this is temporary for experimentation only, it will be removed!!!!
62 public OSDMap TopLevelMap
63 {
64 get { return m_map; }
65 set { m_map = value; }
66 }
58 67
59 public XmlSchema GetSchema() { return null; } 68 public XmlSchema GetSchema() { return null; }
60 69
@@ -64,39 +73,34 @@ namespace OpenSim.Framework
64 map.ReadXml(rawXml); 73 map.ReadXml(rawXml);
65 return map; 74 return map;
66 } 75 }
67 76
77 public void ReadXml(XmlReader reader)
78 {
79 ReadXml(reader.ReadInnerXml());
80 }
81
68 public void ReadXml(string rawXml) 82 public void ReadXml(string rawXml)
69 { 83 {
70 // System.Console.WriteLine("Trying to deserialize [{0}]", rawXml); 84 // System.Console.WriteLine("Trying to deserialize [{0}]", rawXml);
71 85
72 lock (this) 86 lock (this)
87 {
73 m_map = (OSDMap)OSDParser.DeserializeLLSDXml(rawXml); 88 m_map = (OSDMap)OSDParser.DeserializeLLSDXml(rawXml);
89 SanitiseMap(this);
90 }
74 } 91 }
75 92
76 // WARNING: this is temporary for experimentation only, it will be removed!!!! 93 public void WriteXml(XmlWriter writer)
77 public OSDMap TopLevelMap
78 { 94 {
79 get { return m_map; } 95 writer.WriteRaw(ToXml());
80 set { m_map = value; }
81 } 96 }
82
83 97
84 public void ReadXml(XmlReader reader)
85 {
86 ReadXml(reader.ReadInnerXml());
87 }
88
89 public string ToXml() 98 public string ToXml()
90 { 99 {
91 lock (this) 100 lock (this)
92 return OSDParser.SerializeLLSDXmlString(m_map); 101 return OSDParser.SerializeLLSDXmlString(m_map);
93 } 102 }
94 103
95 public void WriteXml(XmlWriter writer)
96 {
97 writer.WriteRaw(ToXml());
98 }
99
100 public void CopyFrom(DAMap other) 104 public void CopyFrom(DAMap other)
101 { 105 {
102 // Deep copy 106 // Deep copy
@@ -104,7 +108,7 @@ namespace OpenSim.Framework
104 string data = null; 108 string data = null;
105 lock (other) 109 lock (other)
106 { 110 {
107 if (other.Count > 0) 111 if (other.CountNamespaces > 0)
108 { 112 {
109 data = OSDParser.SerializeLLSDXmlString(other.m_map); 113 data = OSDParser.SerializeLLSDXmlString(other.m_map);
110 } 114 }
@@ -120,59 +124,133 @@ namespace OpenSim.Framework
120 } 124 }
121 125
122 /// <summary> 126 /// <summary>
123 /// Returns the number of data stores. 127 /// Sanitise the map to remove any namespaces or stores that are not OSDMap.
124 /// </summary> 128 /// </summary>
125 public int Count { get { lock (this) { return m_map.Count; } } } 129 /// <param name='map'>
126 130 /// </param>
127 public bool IsReadOnly { get { return false; } } 131 public static void SanitiseMap(DAMap daMap)
128 132 {
133 List<string> keysToRemove = null;
134
135 // Hard-coded special case that needs to be removed in the future. Normally, modules themselves should
136 // handle reading data from old locations
137 bool osMaterialsMigrationRequired = false;
138
139 OSDMap namespacesMap = daMap.m_map;
140
141 foreach (string key in namespacesMap.Keys)
142 {
143// Console.WriteLine("Processing ns {0}", key);
144 if (!(namespacesMap[key] is OSDMap))
145 {
146 if (keysToRemove == null)
147 keysToRemove = new List<string>();
148
149 keysToRemove.Add(key);
150 }
151 else if (key == "OS:Materials")
152 {
153 osMaterialsMigrationRequired = true;
154 }
155 }
156
157 if (keysToRemove != null)
158 {
159 foreach (string key in keysToRemove)
160 {
161// Console.WriteLine ("Removing bad ns {0}", key);
162 namespacesMap.Remove(key);
163 }
164 }
165
166 // Hard-coded special case that needs to be removed in the future. Normally, modules themselves should
167 // handle reading data from old locations
168 if (osMaterialsMigrationRequired)
169 daMap.SetStore("OpenSim", "Materials", (OSDMap)namespacesMap["OS:Materials"]);
170
171 foreach (OSD nsOsd in namespacesMap.Values)
172 {
173 OSDMap nsOsdMap = (OSDMap)nsOsd;
174 keysToRemove = null;
175
176 foreach (string key in nsOsdMap.Keys)
177 {
178 if (!(nsOsdMap[key] is OSDMap))
179 {
180 if (keysToRemove == null)
181 keysToRemove = new List<string>();
182
183 keysToRemove.Add(key);
184 }
185 }
186
187 if (keysToRemove != null)
188 foreach (string key in keysToRemove)
189 nsOsdMap.Remove(key);
190 }
191 }
192
129 /// <summary> 193 /// <summary>
130 /// Returns the names of the data stores. 194 /// Get the number of namespaces
131 /// </summary> 195 /// </summary>
132 public ICollection<string> Keys { get { lock (this) { return m_map.Keys; } } } 196 public int CountNamespaces { get { lock (this) { return m_map.Count; } } }
133 197
134 /// <summary> 198 /// <summary>
135 /// Returns all the data stores. 199 /// Get the number of stores.
136 /// </summary> 200 /// </summary>
137 public ICollection<OSDMap> Values 201 public int CountStores
138 { 202 {
139 get 203 get
140 { 204 {
205 int count = 0;
206
141 lock (this) 207 lock (this)
142 { 208 {
143 List<OSDMap> stores = new List<OSDMap>(m_map.Count); 209 foreach (OSD osdNamespace in m_map)
144 foreach (OSD llsd in m_map.Values) 210 {
145 stores.Add((OSDMap)llsd); 211 count += ((OSDMap)osdNamespace).Count;
146 return stores; 212 }
147 } 213 }
214
215 return count;
148 } 216 }
149 } 217 }
150 218
151 /// <summary> 219 public OSDMap GetStore(string ns, string storeName)
152 /// Gets or sets one data store. 220 {
153 /// </summary> 221 OSD namespaceOsd;
154 /// <param name="key">Store name</param> 222
155 /// <returns></returns> 223 lock (this)
156 public OSDMap this[string key] 224 {
157 { 225 if (m_map.TryGetValue(ns, out namespaceOsd))
158 get
159 {
160 OSD llsd;
161
162 lock (this)
163 { 226 {
164 if (m_map.TryGetValue(key, out llsd)) 227 OSD store;
165 return (OSDMap)llsd; 228
166 else 229 if (((OSDMap)namespaceOsd).TryGetValue(storeName, out store))
167 return null; 230 return (OSDMap)store;
168 } 231 }
169 } 232 }
170 233
171 set 234 return null;
235 }
236
237 public void SetStore(string ns, string storeName, OSDMap store)
238 {
239 ValidateNamespace(ns);
240 OSDMap nsMap;
241
242 lock (this)
172 { 243 {
173 ValidateKey(key); 244 if (!m_map.ContainsKey(ns))
174 lock (this) 245 {
175 m_map[key] = value; 246 nsMap = new OSDMap();
247 m_map[ns] = nsMap;
248 }
249
250 nsMap = (OSDMap)m_map[ns];
251
252// m_log.DebugFormat("[DA MAP]: Setting store to {0}:{1}", ns, storeName);
253 nsMap[storeName] = store;
176 } 254 }
177 } 255 }
178 256
@@ -180,54 +258,46 @@ namespace OpenSim.Framework
180 /// Validate the key used for storing separate data stores. 258 /// Validate the key used for storing separate data stores.
181 /// </summary> 259 /// </summary>
182 /// <param name='key'></param> 260 /// <param name='key'></param>
183 public static void ValidateKey(string key) 261 public static void ValidateNamespace(string ns)
184 { 262 {
185 if (key.Length < MIN_STORE_NAME_LENGTH) 263 if (ns.Length < MIN_NAMESPACE_LENGTH)
186 throw new Exception("Minimum store name length is " + MIN_STORE_NAME_LENGTH); 264 throw new Exception("Minimum namespace length is " + MIN_NAMESPACE_LENGTH);
187 } 265 }
188 266
189 public bool ContainsKey(string key) 267 public bool ContainsStore(string ns, string storeName)
190 { 268 {
191 lock (this) 269 OSD namespaceOsd;
192 return m_map.ContainsKey(key);
193 }
194
195 public void Add(string key, OSDMap store)
196 {
197 ValidateKey(key);
198 lock (this)
199 m_map.Add(key, store);
200 }
201 270
202 public void Add(KeyValuePair<string, OSDMap> kvp)
203 {
204 ValidateKey(kvp.Key);
205 lock (this) 271 lock (this)
206 m_map.Add(kvp.Key, kvp.Value); 272 {
207 } 273 if (m_map.TryGetValue(ns, out namespaceOsd))
274 {
275 return ((OSDMap)namespaceOsd).ContainsKey(storeName);
276 }
277 }
208 278
209 public bool Remove(string key) 279 return false;
210 { 280 }
211 lock (this)
212 return m_map.Remove(key);
213 }
214 281
215 public bool TryGetValue(string key, out OSDMap store) 282 public bool TryGetStore(string ns, string storeName, out OSDMap store)
216 { 283 {
284 OSD namespaceOsd;
285
217 lock (this) 286 lock (this)
218 { 287 {
219 OSD llsd; 288 if (m_map.TryGetValue(ns, out namespaceOsd))
220 if (m_map.TryGetValue(key, out llsd))
221 {
222 store = (OSDMap)llsd;
223 return true;
224 }
225 else
226 { 289 {
227 store = null; 290 OSD storeOsd;
228 return false; 291
292 bool result = ((OSDMap)namespaceOsd).TryGetValue(storeName, out storeOsd);
293 store = (OSDMap)storeOsd;
294
295 return result;
229 } 296 }
230 } 297 }
298
299 store = null;
300 return false;
231 } 301 }
232 302
233 public void Clear() 303 public void Clear()
@@ -235,39 +305,25 @@ namespace OpenSim.Framework
235 lock (this) 305 lock (this)
236 m_map.Clear(); 306 m_map.Clear();
237 } 307 }
238
239 public bool Contains(KeyValuePair<string, OSDMap> kvp)
240 {
241 lock (this)
242 return m_map.ContainsKey(kvp.Key);
243 }
244 308
245 public void CopyTo(KeyValuePair<string, OSDMap>[] array, int index) 309 public bool RemoveStore(string ns, string storeName)
246 { 310 {
247 throw new NotImplementedException(); 311 OSD namespaceOsd;
248 }
249 312
250 public bool Remove(KeyValuePair<string, OSDMap> kvp)
251 {
252 lock (this)
253 return m_map.Remove(kvp.Key);
254 }
255
256 public System.Collections.IDictionaryEnumerator GetEnumerator()
257 {
258 lock (this) 313 lock (this)
259 return m_map.GetEnumerator(); 314 {
260 } 315 if (m_map.TryGetValue(ns, out namespaceOsd))
316 {
317 OSDMap namespaceOsdMap = (OSDMap)namespaceOsd;
318 namespaceOsdMap.Remove(storeName);
261 319
262 IEnumerator<KeyValuePair<string, OSDMap>> IEnumerable<KeyValuePair<string, OSDMap>>.GetEnumerator() 320 // Don't keep empty namespaces around
263 { 321 if (namespaceOsdMap.Count <= 0)
264 return null; 322 m_map.Remove(ns);
265 } 323 }
324 }
266 325
267 IEnumerator IEnumerable.GetEnumerator() 326 return false;
268 { 327 }
269 lock (this)
270 return m_map.GetEnumerator();
271 }
272 } 328 }
273} \ No newline at end of file 329} \ No newline at end of file
diff --git a/OpenSim/Framework/DOMap.cs b/OpenSim/Framework/DOMap.cs
index 755e129..f5b650b 100644
--- a/OpenSim/Framework/DOMap.cs
+++ b/OpenSim/Framework/DOMap.cs
@@ -42,22 +42,22 @@ namespace OpenSim.Framework
42 /// This class stores and retrieves dynamic objects. 42 /// This class stores and retrieves dynamic objects.
43 /// </summary> 43 /// </summary>
44 /// <remarks> 44 /// <remarks>
45 /// Experimental - DO NOT USE. 45 /// Experimental - DO NOT USE. Does not yet have namespace support.
46 /// </remarks> 46 /// </remarks>
47 public class DOMap 47 public class DOMap
48 { 48 {
49 private IDictionary<string, object> m_map; 49 private IDictionary<string, object> m_map;
50 50
51 public void Add(string key, object dynObj) 51 public void Add(string ns, string objName, object dynObj)
52 { 52 {
53 DAMap.ValidateKey(key); 53 DAMap.ValidateNamespace(ns);
54 54
55 lock (this) 55 lock (this)
56 { 56 {
57 if (m_map == null) 57 if (m_map == null)
58 m_map = new Dictionary<string, object>(); 58 m_map = new Dictionary<string, object>();
59 59
60 m_map.Add(key, dynObj); 60 m_map.Add(objName, dynObj);
61 } 61 }
62 } 62 }
63 63
diff --git a/OpenSim/Region/CoreModules/Framework/DynamicAttributes/DAExampleModule.cs b/OpenSim/Region/CoreModules/Framework/DynamicAttributes/DAExampleModule.cs
index 1f1568f..0c632b1 100644
--- a/OpenSim/Region/CoreModules/Framework/DynamicAttributes/DAExampleModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/DynamicAttributes/DAExampleModule.cs
@@ -44,11 +44,12 @@ namespace OpenSim.Region.CoreModules.Framework.DynamicAttributes.DAExampleModule
44 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "DAExampleModule")] 44 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "DAExampleModule")]
45 public class DAExampleModule : INonSharedRegionModule 45 public class DAExampleModule : INonSharedRegionModule
46 { 46 {
47// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 47 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
48 48
49 private static readonly bool ENABLED = false; // enable for testing 49 private readonly bool ENABLED = false; // enable for testing
50 50
51 public const string DANamespace = "DAExample Module"; 51 public const string Namespace = "Example";
52 public const string StoreName = "DA";
52 53
53 protected Scene m_scene; 54 protected Scene m_scene;
54 protected IDialogModule m_dialogMod; 55 protected IDialogModule m_dialogMod;
@@ -65,6 +66,8 @@ namespace OpenSim.Region.CoreModules.Framework.DynamicAttributes.DAExampleModule
65 m_scene = scene; 66 m_scene = scene;
66 m_scene.EventManager.OnSceneGroupMove += OnSceneGroupMove; 67 m_scene.EventManager.OnSceneGroupMove += OnSceneGroupMove;
67 m_dialogMod = m_scene.RequestModuleInterface<IDialogModule>(); 68 m_dialogMod = m_scene.RequestModuleInterface<IDialogModule>();
69
70 m_log.DebugFormat("[DA EXAMPLE MODULE]: Added region {0}", m_scene.Name);
68 } 71 }
69 } 72 }
70 73
@@ -91,7 +94,7 @@ namespace OpenSim.Region.CoreModules.Framework.DynamicAttributes.DAExampleModule
91 if (sop == null) 94 if (sop == null)
92 return true; 95 return true;
93 96
94 if (!sop.DynAttrs.TryGetValue(DANamespace, out attrs)) 97 if (!sop.DynAttrs.TryGetStore(Namespace, StoreName, out attrs))
95 attrs = new OSDMap(); 98 attrs = new OSDMap();
96 99
97 OSDInteger newValue; 100 OSDInteger newValue;
@@ -106,12 +109,14 @@ namespace OpenSim.Region.CoreModules.Framework.DynamicAttributes.DAExampleModule
106 109
107 attrs["moves"] = newValue; 110 attrs["moves"] = newValue;
108 111
109 sop.DynAttrs[DANamespace] = attrs; 112 sop.DynAttrs.SetStore(Namespace, StoreName, attrs);
110 } 113 }
111 114
112 sop.ParentGroup.HasGroupChanged = true; 115 sop.ParentGroup.HasGroupChanged = true;
113 116
114 m_dialogMod.SendGeneralAlert(string.Format("{0} {1} moved {2} times", sop.Name, sop.UUID, newValue)); 117 string msg = string.Format("{0} {1} moved {2} times", sop.Name, sop.UUID, newValue);
118 m_log.DebugFormat("[DA EXAMPLE MODULE]: {0}", msg);
119 m_dialogMod.SendGeneralAlert(msg);
115 120
116 return true; 121 return true;
117 } 122 }
diff --git a/OpenSim/Region/CoreModules/Framework/DynamicAttributes/DOExampleModule.cs b/OpenSim/Region/CoreModules/Framework/DynamicAttributes/DOExampleModule.cs
index 650aa35..166a994 100644
--- a/OpenSim/Region/CoreModules/Framework/DynamicAttributes/DOExampleModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/DynamicAttributes/DOExampleModule.cs
@@ -64,8 +64,8 @@ namespace OpenSim.Region.Framework.DynamicAttributes.DOExampleModule
64 64
65 private Scene m_scene; 65 private Scene m_scene;
66 private IDialogModule m_dialogMod; 66 private IDialogModule m_dialogMod;
67 67
68 public string Name { get { return "DOExample Module"; } } 68 public string Name { get { return "DO"; } }
69 public Type ReplaceableInterface { get { return null; } } 69 public Type ReplaceableInterface { get { return null; } }
70 70
71 public void Initialise(IConfigSource source) {} 71 public void Initialise(IConfigSource source) {}
@@ -106,7 +106,7 @@ namespace OpenSim.Region.Framework.DynamicAttributes.DOExampleModule
106 106
107// Console.WriteLine("Here for {0}", so.Name); 107// Console.WriteLine("Here for {0}", so.Name);
108 108
109 if (rootPart.DynAttrs.TryGetValue(DAExampleModule.DANamespace, out attrs)) 109 if (rootPart.DynAttrs.TryGetStore(DAExampleModule.Namespace, DAExampleModule.StoreName, out attrs))
110 { 110 {
111 movesSoFar = attrs["moves"].AsInteger(); 111 movesSoFar = attrs["moves"].AsInteger();
112 112
@@ -114,7 +114,7 @@ namespace OpenSim.Region.Framework.DynamicAttributes.DOExampleModule
114 "[DO EXAMPLE MODULE]: Found saved moves {0} for {1} in {2}", movesSoFar, so.Name, m_scene.Name); 114 "[DO EXAMPLE MODULE]: Found saved moves {0} for {1} in {2}", movesSoFar, so.Name, m_scene.Name);
115 } 115 }
116 116
117 rootPart.DynObjs.Add(Name, new MyObject(movesSoFar)); 117 rootPart.DynObjs.Add(DAExampleModule.Namespace, Name, new MyObject(movesSoFar));
118 } 118 }
119 119
120 private bool OnSceneGroupMove(UUID groupId, Vector3 delta) 120 private bool OnSceneGroupMove(UUID groupId, Vector3 delta)
diff --git a/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs b/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs
index b4348c9..66059fb 100644
--- a/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs
+++ b/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs
@@ -144,7 +144,20 @@ namespace OpenSim.Region.CoreModules.World.Serialiser.Tests
144 <Flags>None</Flags> 144 <Flags>None</Flags>
145 <CollisionSound><Guid>00000000-0000-0000-0000-000000000000</Guid></CollisionSound> 145 <CollisionSound><Guid>00000000-0000-0000-0000-000000000000</Guid></CollisionSound>
146 <CollisionSoundVolume>0</CollisionSoundVolume> 146 <CollisionSoundVolume>0</CollisionSoundVolume>
147 <DynAttrs><llsd><map><key>MyStore</key><map><key>the answer</key><integer>42</integer></map></map></llsd></DynAttrs> 147 <DynAttrs>
148 <llsd>
149 <map>
150 <key>MyNamespace</key>
151 <map>
152 <key>MyStore</key>
153 <map>
154 <key>the answer</key>
155 <integer>42</integer>
156 </map>
157 </map>
158 </map>
159 </llsd>
160 </DynAttrs>
148 </SceneObjectPart> 161 </SceneObjectPart>
149 </RootPart> 162 </RootPart>
150 <OtherParts /> 163 <OtherParts />
@@ -333,7 +346,20 @@ namespace OpenSim.Region.CoreModules.World.Serialiser.Tests
333 <EveryoneMask>0</EveryoneMask> 346 <EveryoneMask>0</EveryoneMask>
334 <NextOwnerMask>2147483647</NextOwnerMask> 347 <NextOwnerMask>2147483647</NextOwnerMask>
335 <Flags>None</Flags> 348 <Flags>None</Flags>
336 <DynAttrs><llsd><map><key>MyStore</key><map><key>last words</key><string>Rosebud</string></map></map></llsd></DynAttrs> 349 <DynAttrs>
350 <llsd>
351 <map>
352 <key>MyNamespace</key>
353 <map>
354 <key>MyStore</key>
355 <map>
356 <key>last words</key>
357 <string>Rosebud</string>
358 </map>
359 </map>
360 </map>
361 </llsd>
362 </DynAttrs>
337 <SitTargetAvatar><UUID>00000000-0000-0000-0000-000000000000</UUID></SitTargetAvatar> 363 <SitTargetAvatar><UUID>00000000-0000-0000-0000-000000000000</UUID></SitTargetAvatar>
338 </SceneObjectPart> 364 </SceneObjectPart>
339 <OtherParts /> 365 <OtherParts />
@@ -362,7 +388,7 @@ namespace OpenSim.Region.CoreModules.World.Serialiser.Tests
362 Assert.That(rootPart.UUID, Is.EqualTo(new UUID("e6a5a05e-e8cc-4816-8701-04165e335790"))); 388 Assert.That(rootPart.UUID, Is.EqualTo(new UUID("e6a5a05e-e8cc-4816-8701-04165e335790")));
363 Assert.That(rootPart.CreatorID, Is.EqualTo(new UUID("a6dacf01-4636-4bb9-8a97-30609438af9d"))); 389 Assert.That(rootPart.CreatorID, Is.EqualTo(new UUID("a6dacf01-4636-4bb9-8a97-30609438af9d")));
364 Assert.That(rootPart.Name, Is.EqualTo("PrimMyRide")); 390 Assert.That(rootPart.Name, Is.EqualTo("PrimMyRide"));
365 OSDMap store = rootPart.DynAttrs["MyStore"]; 391 OSDMap store = rootPart.DynAttrs.GetStore("MyNamespace", "MyStore");
366 Assert.AreEqual(42, store["the answer"].AsInteger()); 392 Assert.AreEqual(42, store["the answer"].AsInteger());
367 393
368 // TODO: Check other properties 394 // TODO: Check other properties
@@ -414,13 +440,14 @@ namespace OpenSim.Region.CoreModules.World.Serialiser.Tests
414 rp.CreatorID = rpCreatorId; 440 rp.CreatorID = rpCreatorId;
415 rp.Shape = shape; 441 rp.Shape = shape;
416 442
443 string daNamespace = "MyNamespace";
417 string daStoreName = "MyStore"; 444 string daStoreName = "MyStore";
418 string daKey = "foo"; 445 string daKey = "foo";
419 string daValue = "bar"; 446 string daValue = "bar";
420 OSDMap myStore = new OSDMap(); 447 OSDMap myStore = new OSDMap();
421 myStore.Add(daKey, daValue); 448 myStore.Add(daKey, daValue);
422 rp.DynAttrs = new DAMap(); 449 rp.DynAttrs = new DAMap();
423 rp.DynAttrs[daStoreName] = myStore; 450 rp.DynAttrs.SetStore(daNamespace, daStoreName, myStore);
424 451
425 SceneObjectGroup so = new SceneObjectGroup(rp); 452 SceneObjectGroup so = new SceneObjectGroup(rp);
426 453
@@ -481,7 +508,7 @@ namespace OpenSim.Region.CoreModules.World.Serialiser.Tests
481 Assert.That(name, Is.EqualTo(rpName)); 508 Assert.That(name, Is.EqualTo(rpName));
482 Assert.That(creatorId, Is.EqualTo(rpCreatorId)); 509 Assert.That(creatorId, Is.EqualTo(rpCreatorId));
483 Assert.NotNull(daMap); 510 Assert.NotNull(daMap);
484 Assert.AreEqual(daValue, daMap[daStoreName][daKey].AsString()); 511 Assert.AreEqual(daValue, daMap.GetStore(daNamespace, daStoreName)[daKey].AsString());
485 } 512 }
486 513
487 [Test] 514 [Test]
@@ -496,7 +523,7 @@ namespace OpenSim.Region.CoreModules.World.Serialiser.Tests
496 Assert.That(rootPart.UUID, Is.EqualTo(new UUID("9be68fdd-f740-4a0f-9675-dfbbb536b946"))); 523 Assert.That(rootPart.UUID, Is.EqualTo(new UUID("9be68fdd-f740-4a0f-9675-dfbbb536b946")));
497 Assert.That(rootPart.CreatorID, Is.EqualTo(new UUID("b46ef588-411e-4a8b-a284-d7dcfe8e74ef"))); 524 Assert.That(rootPart.CreatorID, Is.EqualTo(new UUID("b46ef588-411e-4a8b-a284-d7dcfe8e74ef")));
498 Assert.That(rootPart.Name, Is.EqualTo("PrimFun")); 525 Assert.That(rootPart.Name, Is.EqualTo("PrimFun"));
499 OSDMap store = rootPart.DynAttrs["MyStore"]; 526 OSDMap store = rootPart.DynAttrs.GetStore("MyNamespace", "MyStore");
500 Assert.AreEqual("Rosebud", store["last words"].AsString()); 527 Assert.AreEqual("Rosebud", store["last words"].AsString());
501 528
502 // TODO: Check other properties 529 // TODO: Check other properties
@@ -522,13 +549,14 @@ namespace OpenSim.Region.CoreModules.World.Serialiser.Tests
522 rp.CreatorID = rpCreatorId; 549 rp.CreatorID = rpCreatorId;
523 rp.Shape = shape; 550 rp.Shape = shape;
524 551
552 string daNamespace = "MyNamespace";
525 string daStoreName = "MyStore"; 553 string daStoreName = "MyStore";
526 string daKey = "foo"; 554 string daKey = "foo";
527 string daValue = "bar"; 555 string daValue = "bar";
528 OSDMap myStore = new OSDMap(); 556 OSDMap myStore = new OSDMap();
529 myStore.Add(daKey, daValue); 557 myStore.Add(daKey, daValue);
530 rp.DynAttrs = new DAMap(); 558 rp.DynAttrs = new DAMap();
531 rp.DynAttrs[daStoreName] = myStore; 559 rp.DynAttrs.SetStore(daNamespace, daStoreName, myStore);
532 560
533 SceneObjectGroup so = new SceneObjectGroup(rp); 561 SceneObjectGroup so = new SceneObjectGroup(rp);
534 562
@@ -585,7 +613,7 @@ namespace OpenSim.Region.CoreModules.World.Serialiser.Tests
585 Assert.That(name, Is.EqualTo(rpName)); 613 Assert.That(name, Is.EqualTo(rpName));
586 Assert.That(creatorId, Is.EqualTo(rpCreatorId)); 614 Assert.That(creatorId, Is.EqualTo(rpCreatorId));
587 Assert.NotNull(daMap); 615 Assert.NotNull(daMap);
588 Assert.AreEqual(daValue, daMap[daStoreName][daKey].AsString()); 616 Assert.AreEqual(daValue, daMap.GetStore(daNamespace, daStoreName)[daKey].AsString());
589 } 617 }
590 } 618 }
591} \ No newline at end of file 619} \ No newline at end of file
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
index 3882b45..945745e 100644
--- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
+++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
@@ -1290,7 +1290,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1290 if (sop.MediaUrl != null) 1290 if (sop.MediaUrl != null)
1291 writer.WriteElementString("MediaUrl", sop.MediaUrl.ToString()); 1291 writer.WriteElementString("MediaUrl", sop.MediaUrl.ToString());
1292 1292
1293 if (sop.DynAttrs.Count > 0) 1293 if (sop.DynAttrs.CountNamespaces > 0)
1294 { 1294 {
1295 writer.WriteStartElement("DynAttrs"); 1295 writer.WriteStartElement("DynAttrs");
1296 sop.DynAttrs.WriteXml(writer); 1296 sop.DynAttrs.WriteXml(writer);
diff --git a/OpenSim/Region/Framework/Scenes/UuidGatherer.cs b/OpenSim/Region/Framework/Scenes/UuidGatherer.cs
index 0e83781..586b59d 100644
--- a/OpenSim/Region/Framework/Scenes/UuidGatherer.cs
+++ b/OpenSim/Region/Framework/Scenes/UuidGatherer.cs
@@ -212,7 +212,6 @@ namespace OpenSim.Region.Framework.Scenes
212// } 212// }
213// } 213// }
214 214
215
216 /// <summary> 215 /// <summary>
217 /// Gather all of the texture asset UUIDs used to reference "Materials" such as normal and specular maps 216 /// Gather all of the texture asset UUIDs used to reference "Materials" such as normal and specular maps
218 /// </summary> 217 /// </summary>
@@ -221,20 +220,23 @@ namespace OpenSim.Region.Framework.Scenes
221 public void GatherMaterialsUuids(SceneObjectPart part, IDictionary<UUID, AssetType> assetUuids) 220 public void GatherMaterialsUuids(SceneObjectPart part, IDictionary<UUID, AssetType> assetUuids)
222 { 221 {
223 // scan thru the dynAttrs map of this part for any textures used as materials 222 // scan thru the dynAttrs map of this part for any textures used as materials
224 OSDMap OSMaterials = null; 223 OSD osdMaterials = null;
225 224
226 lock (part.DynAttrs) 225 lock (part.DynAttrs)
227 { 226 {
228 if (part.DynAttrs.ContainsKey("OS:Materials")) 227 if (part.DynAttrs.ContainsStore("OpenSim", "Materials"))
229 OSMaterials = part.DynAttrs["OS:Materials"]; 228 {
230 if (OSMaterials != null && OSMaterials.ContainsKey("Materials")) 229 OSDMap materialsStore = part.DynAttrs.GetStore("OpenSim", "Materials");
230 materialsStore.TryGetValue("Materials", out osdMaterials);
231 }
232
233 if (osdMaterials != null)
231 { 234 {
232 OSD osd = OSMaterials["Materials"];
233 //m_log.Info("[UUID Gatherer]: found Materials: " + OSDParser.SerializeJsonString(osd)); 235 //m_log.Info("[UUID Gatherer]: found Materials: " + OSDParser.SerializeJsonString(osd));
234 236
235 if (osd is OSDArray) 237 if (osdMaterials is OSDArray)
236 { 238 {
237 OSDArray matsArr = osd as OSDArray; 239 OSDArray matsArr = osdMaterials as OSDArray;
238 foreach (OSDMap matMap in matsArr) 240 foreach (OSDMap matMap in matsArr)
239 { 241 {
240 try 242 try
diff --git a/OpenSim/Region/OptionalModules/Materials/MaterialsDemoModule.cs b/OpenSim/Region/OptionalModules/Materials/MaterialsDemoModule.cs
index 4ab6609..5b15a73 100644
--- a/OpenSim/Region/OptionalModules/Materials/MaterialsDemoModule.cs
+++ b/OpenSim/Region/OptionalModules/Materials/MaterialsDemoModule.cs
@@ -178,7 +178,7 @@ namespace OpenSim.Region.OptionalModules.MaterialsDemoModule
178 178
179 void GetStoredMaterialsForPart(SceneObjectPart part) 179 void GetStoredMaterialsForPart(SceneObjectPart part)
180 { 180 {
181 OSDMap OSMaterials = null; 181 OSD OSMaterials = null;
182 OSDArray matsArr = null; 182 OSDArray matsArr = null;
183 183
184 if (part.DynAttrs == null) 184 if (part.DynAttrs == null)
@@ -188,23 +188,20 @@ namespace OpenSim.Region.OptionalModules.MaterialsDemoModule
188 188
189 lock (part.DynAttrs) 189 lock (part.DynAttrs)
190 { 190 {
191 if (part.DynAttrs.ContainsKey("OS:Materials")) 191 if (part.DynAttrs.ContainsStore("OpenSim", "Materials"))
192 OSMaterials = part.DynAttrs["OS:Materials"];
193 if (OSMaterials != null && OSMaterials.ContainsKey("Materials"))
194 { 192 {
195 193 OSDMap materialsStore = part.DynAttrs.GetStore("OpenSim", "Materials");
196 OSD osd = OSMaterials["Materials"]; 194 materialsStore.TryGetValue("Materials", out OSMaterials);
197 if (osd is OSDArray)
198 matsArr = osd as OSDArray;
199 } 195 }
200 }
201 196
202 if (OSMaterials == null) 197 if (OSMaterials != null && OSMaterials is OSDArray)
203 return; 198 matsArr = OSMaterials as OSDArray;
199 else
200 return;
201 }
204 202
205 m_log.Info("[MaterialsDemoModule]: OSMaterials: " + OSDParser.SerializeJsonString(OSMaterials)); 203 m_log.Info("[MaterialsDemoModule]: OSMaterials: " + OSDParser.SerializeJsonString(OSMaterials));
206 204
207
208 if (matsArr == null) 205 if (matsArr == null)
209 { 206 {
210 m_log.Info("[MaterialsDemoModule]: matsArr is null :( "); 207 m_log.Info("[MaterialsDemoModule]: matsArr is null :( ");
@@ -215,7 +212,6 @@ namespace OpenSim.Region.OptionalModules.MaterialsDemoModule
215 { 212 {
216 if (elemOsd != null && elemOsd is OSDMap) 213 if (elemOsd != null && elemOsd is OSDMap)
217 { 214 {
218
219 OSDMap matMap = elemOsd as OSDMap; 215 OSDMap matMap = elemOsd as OSDMap;
220 if (matMap.ContainsKey("ID") && matMap.ContainsKey("Material")) 216 if (matMap.ContainsKey("ID") && matMap.ContainsKey("Material"))
221 { 217 {
@@ -232,7 +228,6 @@ namespace OpenSim.Region.OptionalModules.MaterialsDemoModule
232 } 228 }
233 } 229 }
234 230
235
236 void StoreMaterialsForPart(SceneObjectPart part) 231 void StoreMaterialsForPart(SceneObjectPart part)
237 { 232 {
238 try 233 try
@@ -277,7 +272,7 @@ namespace OpenSim.Region.OptionalModules.MaterialsDemoModule
277 OSMaterials["Materials"] = matsArr; 272 OSMaterials["Materials"] = matsArr;
278 273
279 lock (part.DynAttrs) 274 lock (part.DynAttrs)
280 part.DynAttrs["OS:Materials"] = OSMaterials; 275 part.DynAttrs.SetStore("OpenSim", "Materials", OSMaterials);
281 } 276 }
282 catch (Exception e) 277 catch (Exception e)
283 { 278 {
@@ -285,7 +280,6 @@ namespace OpenSim.Region.OptionalModules.MaterialsDemoModule
285 } 280 }
286 } 281 }
287 282
288
289 public string RenderMaterialsPostCap(string request, string path, 283 public string RenderMaterialsPostCap(string request, string path,
290 string param, IOSHttpRequest httpRequest, 284 string param, IOSHttpRequest httpRequest,
291 IOSHttpResponse httpResponse) 285 IOSHttpResponse httpResponse)