aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorJustin Clarke Casey2009-05-08 19:18:37 +0000
committerJustin Clarke Casey2009-05-08 19:18:37 +0000
commit567e0d032c56b2d1498216416fa6874ec77dd55b (patch)
treeef63642c32a558c1a47f4fd9143fdbdf25d1e5f3 /OpenSim/Region
parentImplement an ingenious solution to pacekt pool performance suggested by (diff)
downloadopensim-SC_OLD-567e0d032c56b2d1498216416fa6874ec77dd55b.zip
opensim-SC_OLD-567e0d032c56b2d1498216416fa6874ec77dd55b.tar.gz
opensim-SC_OLD-567e0d032c56b2d1498216416fa6874ec77dd55b.tar.bz2
opensim-SC_OLD-567e0d032c56b2d1498216416fa6874ec77dd55b.tar.xz
* break out 'xml2' deserialization from sog
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectors/Interregion/RESTInterregionComms.cs3
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs72
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneXmlLoader.cs6
-rw-r--r--OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs78
-rw-r--r--OpenSim/Region/OptionalModules/ContentManagementSystem/CMModel.cs17
-rw-r--r--OpenSim/Region/OptionalModules/ContentManagementSystem/ContentManagementEntity.cs12
-rw-r--r--OpenSim/Region/OptionalModules/ContentManagementSystem/MetaEntity.cs13
-rw-r--r--OpenSim/Region/OptionalModules/ContentManagementSystem/PointMetaEntity.cs10
8 files changed, 85 insertions, 126 deletions
diff --git a/OpenSim/Region/CoreModules/ServiceConnectors/Interregion/RESTInterregionComms.cs b/OpenSim/Region/CoreModules/ServiceConnectors/Interregion/RESTInterregionComms.cs
index 80dced7..6ad3b73 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectors/Interregion/RESTInterregionComms.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectors/Interregion/RESTInterregionComms.cs
@@ -41,6 +41,7 @@ using OpenSim.Framework.Communications.Clients;
41using OpenSim.Region.Framework.Interfaces; 41using OpenSim.Region.Framework.Interfaces;
42using OpenSim.Region.Framework.Scenes; 42using OpenSim.Region.Framework.Scenes;
43using OpenSim.Region.Framework.Scenes.Hypergrid; 43using OpenSim.Region.Framework.Scenes.Hypergrid;
44using OpenSim.Region.Framework.Scenes.Serialization;
44 45
45namespace OpenSim.Region.CoreModules.ServiceConnectors.Interregion 46namespace OpenSim.Region.CoreModules.ServiceConnectors.Interregion
46{ 47{
@@ -641,7 +642,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Interregion
641 SceneObjectGroup sog = null; 642 SceneObjectGroup sog = null;
642 try 643 try
643 { 644 {
644 sog = new SceneObjectGroup(sogXmlStr); 645 sog = SceneObjectSerializer.FromXml2Format(sogXmlStr);
645 sog.ExtraFromXmlString(extraStr); 646 sog.ExtraFromXmlString(extraStr);
646 } 647 }
647 catch (Exception ex) 648 catch (Exception ex)
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index cceb444..fd2d746 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -407,78 +407,6 @@ namespace OpenSim.Region.Framework.Scenes
407 } 407 }
408 408
409 /// <summary> 409 /// <summary>
410 /// Create an object using serialized data in OpenSim's xml2 format.
411 /// </summary>
412 public SceneObjectGroup(string xmlData)
413 {
414 SetFromXml(xmlData);
415 }
416
417 protected void SetFromXml(string xmlData)
418 {
419
420 //m_log.DebugFormat("[SOG]: Starting deserialization of SOG");
421 //int time = System.Environment.TickCount;
422
423 // libomv.types changes UUID to Guid
424 xmlData = xmlData.Replace("<UUID>", "<Guid>");
425 xmlData = xmlData.Replace("</UUID>", "</Guid>");
426
427 // Handle Nested <UUID><UUID> property
428 xmlData = xmlData.Replace("<Guid><Guid>", "<UUID><Guid>");
429 xmlData = xmlData.Replace("</Guid></Guid>", "</Guid></UUID>");
430
431 try
432 {
433
434 XmlDocument doc = new XmlDocument();
435 doc.LoadXml(xmlData);
436
437 XmlNodeList parts = doc.GetElementsByTagName("SceneObjectPart");
438
439 // Process the root part first
440 if (parts.Count > 0)
441 {
442 StringReader sr = new StringReader(parts[0].OuterXml);
443 XmlTextReader reader = new XmlTextReader(sr);
444 SetRootPart(CreatePartFromXml(reader));
445 reader.Close();
446 sr.Close();
447 }
448
449 // Then deal with the rest
450 for (int i=1; i<parts.Count; i++)
451 {
452 StringReader sr = new StringReader(parts[i].OuterXml);
453 XmlTextReader reader = new XmlTextReader(sr);
454 SceneObjectPart part = CreatePartFromXml(reader);
455 AddPart(part);
456 part.StoreUndoState();
457 reader.Close();
458 sr.Close();
459 }
460
461 // Script state may, or may not, exist. Not having any, is NOT
462 // ever a problem.
463
464 LoadScriptState(doc);
465
466 }
467 catch (Exception e)
468 {
469 m_log.ErrorFormat("[SCENE]: Deserialization of xml failed with {0}. xml was {1}", e, xmlData);
470 }
471
472 //m_log.DebugFormat("[SOG]: Finished deserialization of SOG {0}, {1}ms", Name, System.Environment.TickCount - time);
473 }
474
475 protected virtual SceneObjectPart CreatePartFromXml(XmlTextReader reader)
476 {
477 SceneObjectPart part = SceneObjectPart.FromXml(reader);
478 return part;
479 }
480
481 /// <summary>
482 /// Constructor. This object is added to the scene later via AttachToScene() 410 /// Constructor. This object is added to the scene later via AttachToScene()
483 /// </summary> 411 /// </summary>
484 public SceneObjectGroup(UUID ownerID, Vector3 pos, Quaternion rot, PrimitiveBaseShape shape) 412 public SceneObjectGroup(UUID ownerID, Vector3 pos, Quaternion rot, PrimitiveBaseShape shape)
diff --git a/OpenSim/Region/Framework/Scenes/SceneXmlLoader.cs b/OpenSim/Region/Framework/Scenes/SceneXmlLoader.cs
index 212ca72..49fe8a4 100644
--- a/OpenSim/Region/Framework/Scenes/SceneXmlLoader.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneXmlLoader.cs
@@ -125,14 +125,14 @@ namespace OpenSim.Region.Framework.Scenes
125 foreach (XmlNode aPrimNode in rootNode.ChildNodes) 125 foreach (XmlNode aPrimNode in rootNode.ChildNodes)
126 { 126 {
127 // There is only ever one prim. This oddity should be removeable post 0.5.9 127 // There is only ever one prim. This oddity should be removeable post 0.5.9
128 return new SceneObjectGroup(aPrimNode.OuterXml); 128 return SceneObjectSerializer.FromXml2Format(aPrimNode.OuterXml);
129 } 129 }
130 130
131 return null; 131 return null;
132 } 132 }
133 else 133 else
134 { 134 {
135 return new SceneObjectGroup(rootNode.OuterXml); 135 return SceneObjectSerializer.FromXml2Format(rootNode.OuterXml);
136 } 136 }
137 } 137 }
138 138
@@ -193,7 +193,7 @@ namespace OpenSim.Region.Framework.Scenes
193 /// <returns>The scene object created. null if the scene object already existed</returns> 193 /// <returns>The scene object created. null if the scene object already existed</returns>
194 protected static SceneObjectGroup CreatePrimFromXml2(Scene scene, string xmlData) 194 protected static SceneObjectGroup CreatePrimFromXml2(Scene scene, string xmlData)
195 { 195 {
196 SceneObjectGroup obj = new SceneObjectGroup(xmlData); 196 SceneObjectGroup obj = SceneObjectSerializer.FromXml2Format(xmlData);
197 197
198 if (scene.AddRestoredSceneObject(obj, true, false)) 198 if (scene.AddRestoredSceneObject(obj, true, false))
199 return obj; 199 return obj;
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
index 9eac3be..aa331d9 100644
--- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
+++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
@@ -59,7 +59,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
59 /// </summary> 59 /// </summary>
60 /// <param name="serialization"></param> 60 /// <param name="serialization"></param>
61 /// <returns></returns> 61 /// <returns></returns>
62 public static SceneObjectGroup FromOriginalXmlFormat(UUID fromUserInventoryItemID, string serialization) 62 public static SceneObjectGroup FromOriginalXmlFormat(UUID fromUserInventoryItemID, string xmlData)
63 { 63 {
64 //m_log.DebugFormat("[SOG]: Starting deserialization of SOG"); 64 //m_log.DebugFormat("[SOG]: Starting deserialization of SOG");
65 //int time = System.Environment.TickCount; 65 //int time = System.Environment.TickCount;
@@ -67,12 +67,12 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
67 SceneObjectGroup sceneObject = new SceneObjectGroup(); 67 SceneObjectGroup sceneObject = new SceneObjectGroup();
68 68
69 // libomv.types changes UUID to Guid 69 // libomv.types changes UUID to Guid
70 serialization = serialization.Replace("<UUID>", "<Guid>"); 70 xmlData = xmlData.Replace("<UUID>", "<Guid>");
71 serialization = serialization.Replace("</UUID>", "</Guid>"); 71 xmlData = xmlData.Replace("</UUID>", "</Guid>");
72 72
73 // Handle Nested <UUID><UUID> property 73 // Handle Nested <UUID><UUID> property
74 serialization = serialization.Replace("<Guid><Guid>", "<UUID><Guid>"); 74 xmlData = xmlData.Replace("<Guid><Guid>", "<UUID><Guid>");
75 serialization = serialization.Replace("</Guid></Guid>", "</Guid></UUID>"); 75 xmlData = xmlData.Replace("</Guid></Guid>", "</Guid></UUID>");
76 76
77 try 77 try
78 { 78 {
@@ -83,7 +83,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
83 int linkNum; 83 int linkNum;
84 84
85 doc = new XmlDocument(); 85 doc = new XmlDocument();
86 doc.LoadXml(serialization); 86 doc.LoadXml(xmlData);
87 parts = doc.GetElementsByTagName("RootPart"); 87 parts = doc.GetElementsByTagName("RootPart");
88 88
89 if (parts.Count == 0) 89 if (parts.Count == 0)
@@ -122,7 +122,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
122 catch (Exception e) 122 catch (Exception e)
123 { 123 {
124 m_log.ErrorFormat( 124 m_log.ErrorFormat(
125 "[SERIALIZER]: Deserialization of xml failed with {0}. xml was {1}", e, serialization); 125 "[SERIALIZER]: Deserialization of xml failed with {0}. xml was {1}", e, xmlData);
126 } 126 }
127 127
128 //m_log.DebugFormat("[SERIALIZER]: Finished deserialization of SOG {0}, {1}ms", Name, System.Environment.TickCount - time); 128 //m_log.DebugFormat("[SERIALIZER]: Finished deserialization of SOG {0}, {1}ms", Name, System.Environment.TickCount - time);
@@ -131,6 +131,70 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
131 } 131 }
132 132
133 /// <summary> 133 /// <summary>
134 /// Deserialize a scene object from the 'xml2' format
135 /// </summary>
136 /// <param name="serialization"></param>
137 /// <returns></returns>
138 public static SceneObjectGroup FromXml2Format(string xmlData)
139 {
140 //m_log.DebugFormat("[SOG]: Starting deserialization of SOG");
141 //int time = System.Environment.TickCount;
142
143 SceneObjectGroup sceneObject = new SceneObjectGroup();
144
145 // libomv.types changes UUID to Guid
146 xmlData = xmlData.Replace("<UUID>", "<Guid>");
147 xmlData = xmlData.Replace("</UUID>", "</Guid>");
148
149 // Handle Nested <UUID><UUID> property
150 xmlData = xmlData.Replace("<Guid><Guid>", "<UUID><Guid>");
151 xmlData = xmlData.Replace("</Guid></Guid>", "</Guid></UUID>");
152
153 try
154 {
155 XmlDocument doc = new XmlDocument();
156 doc.LoadXml(xmlData);
157
158 XmlNodeList parts = doc.GetElementsByTagName("SceneObjectPart");
159
160 // Process the root part first
161 if (parts.Count > 0)
162 {
163 StringReader sr = new StringReader(parts[0].OuterXml);
164 XmlTextReader reader = new XmlTextReader(sr);
165 sceneObject.SetRootPart(SceneObjectPart.FromXml(reader));
166 reader.Close();
167 sr.Close();
168 }
169
170 // Then deal with the rest
171 for (int i = 1; i < parts.Count; i++)
172 {
173 StringReader sr = new StringReader(parts[i].OuterXml);
174 XmlTextReader reader = new XmlTextReader(sr);
175 SceneObjectPart part = SceneObjectPart.FromXml(reader);
176 sceneObject.AddPart(part);
177 part.StoreUndoState();
178 reader.Close();
179 sr.Close();
180 }
181
182 // Script state may, or may not, exist. Not having any, is NOT
183 // ever a problem.
184
185 sceneObject.LoadScriptState(doc);
186 }
187 catch (Exception e)
188 {
189 m_log.ErrorFormat("[SERIALIZER]: Deserialization of xml failed with {0}. xml was {1}", e, xmlData);
190 }
191
192 //m_log.DebugFormat("[SERIALIZER]: Finished deserialization of SOG {0}, {1}ms", Name, System.Environment.TickCount - time);
193
194 return sceneObject;
195 }
196
197 /// <summary>
134 /// Serialize a scene object to the original xml format 198 /// Serialize a scene object to the original xml format
135 /// </summary> 199 /// </summary>
136 /// <param name="sceneObject"></param> 200 /// <param name="sceneObject"></param>
diff --git a/OpenSim/Region/OptionalModules/ContentManagementSystem/CMModel.cs b/OpenSim/Region/OptionalModules/ContentManagementSystem/CMModel.cs
index c9a760b..a4ee270 100644
--- a/OpenSim/Region/OptionalModules/ContentManagementSystem/CMModel.cs
+++ b/OpenSim/Region/OptionalModules/ContentManagementSystem/CMModel.cs
@@ -25,15 +25,6 @@
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28#region Header
29
30// CMModel.cs
31// User: bongiojp
32//
33//
34
35#endregion Header
36
37using System; 28using System;
38using System.Collections; 29using System.Collections;
39using System.Collections.Generic; 30using System.Collections.Generic;
@@ -45,6 +36,7 @@ using OpenSim;
45using OpenSim.Framework; 36using OpenSim.Framework;
46using OpenSim.Region.Framework.Interfaces; 37using OpenSim.Region.Framework.Interfaces;
47using OpenSim.Region.Framework.Scenes; 38using OpenSim.Region.Framework.Scenes;
39using OpenSim.Region.Framework.Scenes.Serialization;
48using OpenSim.Region.Physics.Manager; 40using OpenSim.Region.Physics.Manager;
49 41
50using log4net; 42using log4net;
@@ -211,14 +203,15 @@ namespace OpenSim.Region.OptionalModules.ContentManagement
211 203
212 foreach (string xml in xmllist) 204 foreach (string xml in xmllist)
213 { 205 {
214 try{ 206 try
215 temp = new SceneObjectGroup(xml); 207 {
208 temp = SceneObjectSerializer.FromXml2Format(xml);
216 temp.SetScene(scene); 209 temp.SetScene(scene);
217 foreach (SceneObjectPart part in temp.Children.Values) 210 foreach (SceneObjectPart part in temp.Children.Values)
218 part.RegionHandle = scene.RegionInfo.RegionHandle; 211 part.RegionHandle = scene.RegionInfo.RegionHandle;
219 ReplacementList.Add(temp.UUID, (EntityBase)temp); 212 ReplacementList.Add(temp.UUID, (EntityBase)temp);
220 } 213 }
221 catch(Exception e) 214 catch (Exception e)
222 { 215 {
223 m_log.Info("[CMMODEL]: Error while creating replacement list for rollback: " + e); 216 m_log.Info("[CMMODEL]: Error while creating replacement list for rollback: " + e);
224 } 217 }
diff --git a/OpenSim/Region/OptionalModules/ContentManagementSystem/ContentManagementEntity.cs b/OpenSim/Region/OptionalModules/ContentManagementSystem/ContentManagementEntity.cs
index 4d65038..cbd2a6f 100644
--- a/OpenSim/Region/OptionalModules/ContentManagementSystem/ContentManagementEntity.cs
+++ b/OpenSim/Region/OptionalModules/ContentManagementSystem/ContentManagementEntity.cs
@@ -25,15 +25,6 @@
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28#region Header
29
30// ContentManagementEntity.cs
31// User: bongiojp
32//
33//
34
35#endregion Header
36
37using System; 28using System;
38using System.Collections.Generic; 29using System.Collections.Generic;
39using System.Drawing; 30using System.Drawing;
@@ -45,6 +36,7 @@ using Nini.Config;
45using OpenSim.Framework; 36using OpenSim.Framework;
46using OpenSim.Region.Framework.Interfaces; 37using OpenSim.Region.Framework.Interfaces;
47using OpenSim.Region.Framework.Scenes; 38using OpenSim.Region.Framework.Scenes;
39using OpenSim.Region.Framework.Scenes.Serialization;
48using OpenSim.Region.Physics.Manager; 40using OpenSim.Region.Physics.Manager;
49 41
50using log4net; 42using log4net;
@@ -87,7 +79,7 @@ namespace OpenSim.Region.OptionalModules.ContentManagement
87 public ContentManagementEntity(string objectXML, Scene scene, bool physics) 79 public ContentManagementEntity(string objectXML, Scene scene, bool physics)
88 : base(objectXML, scene, false) 80 : base(objectXML, scene, false)
89 { 81 {
90 m_UnchangedEntity = new SceneObjectGroup(objectXML); 82 m_UnchangedEntity = SceneObjectSerializer.FromXml2Format(objectXML);
91 } 83 }
92 84
93 #endregion Constructors 85 #endregion Constructors
diff --git a/OpenSim/Region/OptionalModules/ContentManagementSystem/MetaEntity.cs b/OpenSim/Region/OptionalModules/ContentManagementSystem/MetaEntity.cs
index 7ff58da..184c55a 100644
--- a/OpenSim/Region/OptionalModules/ContentManagementSystem/MetaEntity.cs
+++ b/OpenSim/Region/OptionalModules/ContentManagementSystem/MetaEntity.cs
@@ -25,16 +25,6 @@
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28#region Header
29
30// MetaEntity.cs
31// User: bongiojp
32//
33// TODO:
34// Create a physics manager to the meta object if there isn't one or the object knows of no scene but the user wants physics enabled.
35
36#endregion Header
37
38using System; 28using System;
39using System.Collections.Generic; 29using System.Collections.Generic;
40using System.Drawing; 30using System.Drawing;
@@ -46,6 +36,7 @@ using Nini.Config;
46using OpenSim.Framework; 36using OpenSim.Framework;
47using OpenSim.Region.Framework.Interfaces; 37using OpenSim.Region.Framework.Interfaces;
48using OpenSim.Region.Framework.Scenes; 38using OpenSim.Region.Framework.Scenes;
39using OpenSim.Region.Framework.Scenes.Serialization;
49using OpenSim.Region.Physics.Manager; 40using OpenSim.Region.Physics.Manager;
50 41
51using log4net; 42using log4net;
@@ -98,7 +89,7 @@ namespace OpenSim.Region.OptionalModules.ContentManagement
98 /// </summary> 89 /// </summary>
99 public MetaEntity(string objectXML, Scene scene, bool physics) 90 public MetaEntity(string objectXML, Scene scene, bool physics)
100 { 91 {
101 m_Entity = new SceneObjectGroup(objectXML); 92 m_Entity = SceneObjectSerializer.FromXml2Format(objectXML);
102 m_Entity.SetScene(scene); 93 m_Entity.SetScene(scene);
103 Initialize(physics); 94 Initialize(physics);
104 } 95 }
diff --git a/OpenSim/Region/OptionalModules/ContentManagementSystem/PointMetaEntity.cs b/OpenSim/Region/OptionalModules/ContentManagementSystem/PointMetaEntity.cs
index 22f09fd..da3ba46 100644
--- a/OpenSim/Region/OptionalModules/ContentManagementSystem/PointMetaEntity.cs
+++ b/OpenSim/Region/OptionalModules/ContentManagementSystem/PointMetaEntity.cs
@@ -25,16 +25,6 @@
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28#region Header
29
30// PointMetaEntity.cs created with MonoDevelop
31// User: bongiojp at 3:03 PMĀ 8/6/2008
32//
33// To change standard headers go to Edit->Preferences->Coding->Standard Headers
34//
35
36#endregion Header
37
38using System; 28using System;
39using System.Collections.Generic; 29using System.Collections.Generic;
40using System.Drawing; 30using System.Drawing;