diff options
author | Justin Clarke Casey | 2009-05-14 16:33:04 +0000 |
---|---|---|
committer | Justin Clarke Casey | 2009-05-14 16:33:04 +0000 |
commit | d10b5e29bcef7335d38d4cbb590b60b7b171897b (patch) | |
tree | 957624c5fb9bdda9b715320fd477d771e0883717 /OpenSim | |
parent | Remove empty server dirs to break the mold and allow a new structure to evolve (diff) | |
download | opensim-SC-d10b5e29bcef7335d38d4cbb590b60b7b171897b.zip opensim-SC-d10b5e29bcef7335d38d4cbb590b60b7b171897b.tar.gz opensim-SC-d10b5e29bcef7335d38d4cbb590b60b7b171897b.tar.bz2 opensim-SC-d10b5e29bcef7335d38d4cbb590b60b7b171897b.tar.xz |
* refactor: break some of xml2 serialization out of sog
Diffstat (limited to '')
9 files changed, 36 insertions, 23 deletions
diff --git a/OpenSim/Framework/Communications/Clients/RegionClient.cs b/OpenSim/Framework/Communications/Clients/RegionClient.cs index fb1dc19..5c2babc 100644 --- a/OpenSim/Framework/Communications/Clients/RegionClient.cs +++ b/OpenSim/Framework/Communications/Clients/RegionClient.cs | |||
@@ -362,10 +362,12 @@ namespace OpenSim.Framework.Communications.Clients | |||
362 | return true; | 362 | return true; |
363 | } | 363 | } |
364 | 364 | ||
365 | public bool DoCreateObjectCall(RegionInfo region, ISceneObject sog, bool allowScriptCrossing) | 365 | public bool DoCreateObjectCall(RegionInfo region, ISceneObject sog, string sogXml2, bool allowScriptCrossing) |
366 | { | 366 | { |
367 | ulong regionHandle = GetRegionHandle(region.RegionHandle); | 367 | ulong regionHandle = GetRegionHandle(region.RegionHandle); |
368 | string uri = "http://" + region.ExternalEndPoint.Address + ":" + region.HttpPort + "/object/" + sog.UUID + "/" + regionHandle.ToString() + "/"; | 368 | string uri |
369 | = "http://" + region.ExternalEndPoint.Address + ":" + region.HttpPort | ||
370 | + "/object/" + sog.UUID + "/" + regionHandle.ToString() + "/"; | ||
369 | //m_log.Debug(" >>> DoCreateChildAgentCall <<< " + uri); | 371 | //m_log.Debug(" >>> DoCreateChildAgentCall <<< " + uri); |
370 | 372 | ||
371 | WebRequest ObjectCreateRequest = WebRequest.Create(uri); | 373 | WebRequest ObjectCreateRequest = WebRequest.Create(uri); |
@@ -374,7 +376,7 @@ namespace OpenSim.Framework.Communications.Clients | |||
374 | ObjectCreateRequest.Timeout = 10000; | 376 | ObjectCreateRequest.Timeout = 10000; |
375 | 377 | ||
376 | OSDMap args = new OSDMap(2); | 378 | OSDMap args = new OSDMap(2); |
377 | args["sog"] = OSD.FromString(sog.ToXmlString2()); | 379 | args["sog"] = OSD.FromString(sogXml2); |
378 | args["extra"] = OSD.FromString(sog.ExtraToXmlString()); | 380 | args["extra"] = OSD.FromString(sog.ExtraToXmlString()); |
379 | if (allowScriptCrossing) | 381 | if (allowScriptCrossing) |
380 | { | 382 | { |
diff --git a/OpenSim/Framework/ISceneObject.cs b/OpenSim/Framework/ISceneObject.cs index c327b05..2162cb9 100644 --- a/OpenSim/Framework/ISceneObject.cs +++ b/OpenSim/Framework/ISceneObject.cs | |||
@@ -25,6 +25,7 @@ | |||
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 | using System.Xml; | ||
28 | using OpenMetaverse; | 29 | using OpenMetaverse; |
29 | 30 | ||
30 | namespace OpenSim.Framework | 31 | namespace OpenSim.Framework |
@@ -33,7 +34,7 @@ namespace OpenSim.Framework | |||
33 | { | 34 | { |
34 | UUID UUID { get; } | 35 | UUID UUID { get; } |
35 | ISceneObject CloneForNewScene(); | 36 | ISceneObject CloneForNewScene(); |
36 | string ToXmlString2(); | 37 | void ToXml2(XmlTextWriter writer); |
37 | string ExtraToXmlString(); | 38 | string ExtraToXmlString(); |
38 | void ExtraFromXmlString(string xmlstr); | 39 | void ExtraFromXmlString(string xmlstr); |
39 | string GetStateSnapshot(); | 40 | string GetStateSnapshot(); |
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs index f4c5cba..34640ae 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs | |||
@@ -44,6 +44,7 @@ using OpenSim.Framework.Communications.Osp; | |||
44 | using OpenSim.Region.CoreModules.Avatar.Inventory.Archiver; | 44 | using OpenSim.Region.CoreModules.Avatar.Inventory.Archiver; |
45 | using OpenSim.Region.CoreModules.World.Serialiser; | 45 | using OpenSim.Region.CoreModules.World.Serialiser; |
46 | using OpenSim.Region.Framework.Scenes; | 46 | using OpenSim.Region.Framework.Scenes; |
47 | using OpenSim.Region.Framework.Scenes.Serialization; | ||
47 | using OpenSim.Tests.Common; | 48 | using OpenSim.Tests.Common; |
48 | using OpenSim.Tests.Common.Mock; | 49 | using OpenSim.Tests.Common.Mock; |
49 | using OpenSim.Tests.Common.Setup; | 50 | using OpenSim.Tests.Common.Setup; |
@@ -108,7 +109,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
108 | UUID asset1Id = UUID.Parse("00000000-0000-0000-0000-000000000060"); | 109 | UUID asset1Id = UUID.Parse("00000000-0000-0000-0000-000000000060"); |
109 | AssetBase asset1 = new AssetBase(); | 110 | AssetBase asset1 = new AssetBase(); |
110 | asset1.FullID = asset1Id; | 111 | asset1.FullID = asset1Id; |
111 | asset1.Data = Encoding.ASCII.GetBytes(object1.ToXmlString2()); | 112 | asset1.Data = Encoding.ASCII.GetBytes(SceneObjectSerializer.ToXml2Format(object1)); |
112 | cm.AssetCache.AddAsset(asset1); | 113 | cm.AssetCache.AddAsset(asset1); |
113 | 114 | ||
114 | // Create item | 115 | // Create item |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectors/Interregion/RESTInterregionComms.cs b/OpenSim/Region/CoreModules/ServiceConnectors/Interregion/RESTInterregionComms.cs index 6ad3b73..606b47c 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectors/Interregion/RESTInterregionComms.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectors/Interregion/RESTInterregionComms.cs | |||
@@ -276,7 +276,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Interregion | |||
276 | RegionInfo regInfo = m_commsManager.GridService.RequestNeighbourInfo(regionHandle); | 276 | RegionInfo regInfo = m_commsManager.GridService.RequestNeighbourInfo(regionHandle); |
277 | if (regInfo != null) | 277 | if (regInfo != null) |
278 | { | 278 | { |
279 | return m_regionClient.DoCreateObjectCall(regInfo, sog, m_aScene.m_allowScriptCrossings); | 279 | return m_regionClient.DoCreateObjectCall( |
280 | regInfo, sog, SceneObjectSerializer.ToXml2Format(sog), m_aScene.m_allowScriptCrossings); | ||
280 | } | 281 | } |
281 | //else | 282 | //else |
282 | // m_log.Warn("[REST COMMS]: Region not found " + regionHandle); | 283 | // m_log.Warn("[REST COMMS]: Region not found " + regionHandle); |
diff --git a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs index c052bda..2012ea8 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs | |||
@@ -39,6 +39,7 @@ using OpenSim.Framework.Serialization; | |||
39 | using OpenSim.Region.CoreModules.World.Serialiser; | 39 | using OpenSim.Region.CoreModules.World.Serialiser; |
40 | using OpenSim.Region.CoreModules.World.Terrain; | 40 | using OpenSim.Region.CoreModules.World.Terrain; |
41 | using OpenSim.Region.Framework.Scenes; | 41 | using OpenSim.Region.Framework.Scenes; |
42 | using OpenSim.Region.Framework.Scenes.Serialization; | ||
42 | using OpenSim.Tests.Common; | 43 | using OpenSim.Tests.Common; |
43 | using OpenSim.Tests.Common.Setup; | 44 | using OpenSim.Tests.Common.Setup; |
44 | 45 | ||
@@ -242,7 +243,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests | |||
242 | part1Name, | 243 | part1Name, |
243 | Math.Round(groupPosition.X), Math.Round(groupPosition.Y), Math.Round(groupPosition.Z), | 244 | Math.Round(groupPosition.X), Math.Round(groupPosition.Y), Math.Round(groupPosition.Z), |
244 | part1.UUID); | 245 | part1.UUID); |
245 | tar.WriteFile(ArchiveConstants.OBJECTS_PATH + object1FileName, object1.ToXmlString2()); | 246 | tar.WriteFile(ArchiveConstants.OBJECTS_PATH + object1FileName, SceneObjectSerializer.ToXml2Format(object1)); |
246 | 247 | ||
247 | tar.Close(); | 248 | tar.Close(); |
248 | 249 | ||
diff --git a/OpenSim/Region/CoreModules/World/Serialiser/SerialiseObjects.cs b/OpenSim/Region/CoreModules/World/Serialiser/SerialiseObjects.cs index ed6448f..af2e350 100644 --- a/OpenSim/Region/CoreModules/World/Serialiser/SerialiseObjects.cs +++ b/OpenSim/Region/CoreModules/World/Serialiser/SerialiseObjects.cs | |||
@@ -31,6 +31,7 @@ using System.IO.Compression; | |||
31 | using System.Text; | 31 | using System.Text; |
32 | using System.Xml; | 32 | using System.Xml; |
33 | using OpenSim.Region.Framework.Scenes; | 33 | using OpenSim.Region.Framework.Scenes; |
34 | using OpenSim.Region.Framework.Scenes.Serialization; | ||
34 | 35 | ||
35 | namespace OpenSim.Region.CoreModules.World.Serialiser | 36 | namespace OpenSim.Region.CoreModules.World.Serialiser |
36 | { | 37 | { |
@@ -86,7 +87,7 @@ namespace OpenSim.Region.CoreModules.World.Serialiser | |||
86 | { | 87 | { |
87 | if (ent is SceneObjectGroup) | 88 | if (ent is SceneObjectGroup) |
88 | { | 89 | { |
89 | EntityXml.Add(((SceneObjectGroup) ent).ToXmlString2()); | 90 | EntityXml.Add(SceneObjectSerializer.ToXml2Format((SceneObjectGroup)ent)); |
90 | } | 91 | } |
91 | } | 92 | } |
92 | EntityXml.Sort(); | 93 | EntityXml.Sort(); |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index fd2d746..5611b03 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -583,19 +583,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
583 | 583 | ||
584 | #endregion | 584 | #endregion |
585 | 585 | ||
586 | public string ToXmlString2() | ||
587 | { | ||
588 | using (StringWriter sw = new StringWriter()) | ||
589 | { | ||
590 | using (XmlTextWriter writer = new XmlTextWriter(sw)) | ||
591 | { | ||
592 | ToXml2(writer); | ||
593 | } | ||
594 | |||
595 | return sw.ToString(); | ||
596 | } | ||
597 | } | ||
598 | |||
599 | public void ToXml2(XmlTextWriter writer) | 586 | public void ToXml2(XmlTextWriter writer) |
600 | { | 587 | { |
601 | //m_log.DebugFormat("[SOG]: Starting serialization of SOG {0} to XML2", Name); | 588 | //m_log.DebugFormat("[SOG]: Starting serialization of SOG {0} to XML2", Name); |
diff --git a/OpenSim/Region/Framework/Scenes/SceneXmlLoader.cs b/OpenSim/Region/Framework/Scenes/SceneXmlLoader.cs index 49fe8a4..5418139 100644 --- a/OpenSim/Region/Framework/Scenes/SceneXmlLoader.cs +++ b/OpenSim/Region/Framework/Scenes/SceneXmlLoader.cs | |||
@@ -101,7 +101,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
101 | 101 | ||
102 | public static string SaveGroupToXml2(SceneObjectGroup grp) | 102 | public static string SaveGroupToXml2(SceneObjectGroup grp) |
103 | { | 103 | { |
104 | return grp.ToXmlString2(); | 104 | return SceneObjectSerializer.ToXml2Format(grp); |
105 | } | 105 | } |
106 | 106 | ||
107 | public static SceneObjectGroup DeserializeGroupFromXml2(string xmlString) | 107 | public static SceneObjectGroup DeserializeGroupFromXml2(string xmlString) |
@@ -278,7 +278,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
278 | continue; | 278 | continue; |
279 | } | 279 | } |
280 | 280 | ||
281 | stream.WriteLine(g.ToXmlString2()); | 281 | stream.WriteLine(SceneObjectSerializer.ToXml2Format(g)); |
282 | primCount++; | 282 | primCount++; |
283 | } | 283 | } |
284 | } | 284 | } |
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs index aa331d9..0ec1922 100644 --- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs +++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs | |||
@@ -31,6 +31,7 @@ using System.Reflection; | |||
31 | using System.Xml; | 31 | using System.Xml; |
32 | using log4net; | 32 | using log4net; |
33 | using OpenMetaverse; | 33 | using OpenMetaverse; |
34 | using OpenSim.Framework; | ||
34 | using OpenSim.Region.Framework.Scenes; | 35 | using OpenSim.Region.Framework.Scenes; |
35 | 36 | ||
36 | namespace OpenSim.Region.Framework.Scenes.Serialization | 37 | namespace OpenSim.Region.Framework.Scenes.Serialization |
@@ -246,6 +247,24 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
246 | writer.WriteEndElement(); // SceneObjectGroup | 247 | writer.WriteEndElement(); // SceneObjectGroup |
247 | 248 | ||
248 | //m_log.DebugFormat("[SERIALIZER]: Finished serialization of SOG {0}, {1}ms", Name, System.Environment.TickCount - time); | 249 | //m_log.DebugFormat("[SERIALIZER]: Finished serialization of SOG {0}, {1}ms", Name, System.Environment.TickCount - time); |
250 | } | ||
251 | |||
252 | /// <summary> | ||
253 | /// Serialize a scene object to the 'xml2' format. | ||
254 | /// </summary> | ||
255 | /// <param name="sceneObject"></param> | ||
256 | /// <returns></returns> | ||
257 | public static string ToXml2Format(ISceneObject sceneObject) | ||
258 | { | ||
259 | using (StringWriter sw = new StringWriter()) | ||
260 | { | ||
261 | using (XmlTextWriter writer = new XmlTextWriter(sw)) | ||
262 | { | ||
263 | sceneObject.ToXml2(writer); | ||
264 | } | ||
265 | |||
266 | return sw.ToString(); | ||
267 | } | ||
249 | } | 268 | } |
250 | } | 269 | } |
251 | } | 270 | } |