Update svn properties.
parent
e57c2b47a8
commit
901e97f821
|
@ -1,13 +1,13 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Xml;
|
using System.Xml;
|
||||||
|
|
||||||
namespace OpenSim.Region.DataSnapshot.Interfaces
|
namespace OpenSim.Region.DataSnapshot.Interfaces
|
||||||
{
|
{
|
||||||
public interface IDataSnapshot
|
public interface IDataSnapshot
|
||||||
{
|
{
|
||||||
XmlDocument GetSnapshot(string regionName);
|
XmlDocument GetSnapshot(string regionName);
|
||||||
void MakeEverythingStale();
|
void MakeEverythingStale();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,46 +1,46 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) Contributors, http://opensimulator.org/
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
* * Redistributions of source code must retain the above copyright
|
* * Redistributions of source code must retain the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* notice, this list of conditions and the following disclaimer.
|
||||||
* * Redistributions in binary form must reproduce the above copyright
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* documentation and/or other materials provided with the distribution.
|
* documentation and/or other materials provided with the distribution.
|
||||||
* * Neither the name of the OpenSim Project nor the
|
* * Neither the name of the OpenSim Project nor the
|
||||||
* names of its contributors may be used to endorse or promote products
|
* names of its contributors may be used to endorse or promote products
|
||||||
* derived from this software without specific prior written permission.
|
* derived from this software without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
* 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
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using OpenSim.Framework.Communications.Capabilities;
|
using OpenSim.Framework.Communications.Capabilities;
|
||||||
|
|
||||||
namespace OpenSim.Region.DataSnapshot
|
namespace OpenSim.Region.DataSnapshot
|
||||||
{
|
{
|
||||||
[LLSDMap]
|
[LLSDMap]
|
||||||
public class LLSDDiscoveryResponse
|
public class LLSDDiscoveryResponse
|
||||||
{
|
{
|
||||||
public LLSDArray snapshot_resources;
|
public LLSDArray snapshot_resources;
|
||||||
}
|
}
|
||||||
|
|
||||||
[LLSDMap]
|
[LLSDMap]
|
||||||
public class LLSDDiscoveryDataURL
|
public class LLSDDiscoveryDataURL
|
||||||
{
|
{
|
||||||
public string snapshot_format;
|
public string snapshot_format;
|
||||||
public string snapshot_url;
|
public string snapshot_url;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,316 +1,316 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) Contributors, http://opensimulator.org/
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
* * Redistributions of source code must retain the above copyright
|
* * Redistributions of source code must retain the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* notice, this list of conditions and the following disclaimer.
|
||||||
* * Redistributions in binary form must reproduce the above copyright
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* documentation and/or other materials provided with the distribution.
|
* documentation and/or other materials provided with the distribution.
|
||||||
* * Neither the name of the OpenSim Project nor the
|
* * Neither the name of the OpenSim Project nor the
|
||||||
* names of its contributors may be used to endorse or promote products
|
* names of its contributors may be used to endorse or promote products
|
||||||
* derived from this software without specific prior written permission.
|
* derived from this software without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
* 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
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Xml;
|
using System.Xml;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using OpenSim.Region.Environment.Scenes;
|
using OpenSim.Region.Environment.Scenes;
|
||||||
using OpenSim.Region.DataSnapshot.Interfaces;
|
using OpenSim.Region.DataSnapshot.Interfaces;
|
||||||
using libsecondlife;
|
using libsecondlife;
|
||||||
|
|
||||||
namespace OpenSim.Region.DataSnapshot
|
namespace OpenSim.Region.DataSnapshot
|
||||||
{
|
{
|
||||||
public class SnapshotStore
|
public class SnapshotStore
|
||||||
{
|
{
|
||||||
#region Class Members
|
#region Class Members
|
||||||
private String m_directory = "unyuu"; //not an attempt at adding RM references to core SVN, honest
|
private String m_directory = "unyuu"; //not an attempt at adding RM references to core SVN, honest
|
||||||
private Dictionary<Scene, bool> m_scenes = null;
|
private Dictionary<Scene, bool> m_scenes = null;
|
||||||
private List<IDataSnapshotProvider> m_providers = null;
|
private List<IDataSnapshotProvider> m_providers = null;
|
||||||
private log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
private log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
private Dictionary<String, String> m_gridinfo = null;
|
private Dictionary<String, String> m_gridinfo = null;
|
||||||
private bool m_cacheEnabled = true;
|
private bool m_cacheEnabled = true;
|
||||||
private string m_listener_port = "9000"; //TODO: Set default port over 9000
|
private string m_listener_port = "9000"; //TODO: Set default port over 9000
|
||||||
private string m_hostname = "127.0.0.1";
|
private string m_hostname = "127.0.0.1";
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
public SnapshotStore(string directory, Dictionary<String, String> gridinfo, string port, string hostname) {
|
public SnapshotStore(string directory, Dictionary<String, String> gridinfo, string port, string hostname) {
|
||||||
m_directory = directory;
|
m_directory = directory;
|
||||||
m_scenes = new Dictionary<Scene, bool>();
|
m_scenes = new Dictionary<Scene, bool>();
|
||||||
m_providers = new List<IDataSnapshotProvider>();
|
m_providers = new List<IDataSnapshotProvider>();
|
||||||
m_gridinfo = gridinfo;
|
m_gridinfo = gridinfo;
|
||||||
m_listener_port = port;
|
m_listener_port = port;
|
||||||
m_hostname = hostname;
|
m_hostname = hostname;
|
||||||
|
|
||||||
if (Directory.Exists(m_directory))
|
if (Directory.Exists(m_directory))
|
||||||
{
|
{
|
||||||
m_log.Info("[DATASNAPSHOT]: Repsonse and fragment cache directory already exists.");
|
m_log.Info("[DATASNAPSHOT]: Repsonse and fragment cache directory already exists.");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Try to create the directory.
|
// Try to create the directory.
|
||||||
m_log.Info("[DATASNAPSHOT]: Creating directory " + m_directory);
|
m_log.Info("[DATASNAPSHOT]: Creating directory " + m_directory);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Directory.CreateDirectory(m_directory);
|
Directory.CreateDirectory(m_directory);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
m_log.Error("[DATASNAPSHOT]: Failed to create directory " + m_directory, e);
|
m_log.Error("[DATASNAPSHOT]: Failed to create directory " + m_directory, e);
|
||||||
|
|
||||||
//This isn't a horrible problem, just disable cacheing.
|
//This isn't a horrible problem, just disable cacheing.
|
||||||
m_cacheEnabled = false;
|
m_cacheEnabled = false;
|
||||||
m_log.Error("[DATASNAPSHOT]: Could not create directory, response cache has been disabled.");
|
m_log.Error("[DATASNAPSHOT]: Could not create directory, response cache has been disabled.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ForceSceneStale(Scene scene) {
|
public void ForceSceneStale(Scene scene) {
|
||||||
m_scenes[scene] = true;
|
m_scenes[scene] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Fragment storage
|
#region Fragment storage
|
||||||
public XmlNode GetFragment(IDataSnapshotProvider provider, XmlDocument factory)
|
public XmlNode GetFragment(IDataSnapshotProvider provider, XmlDocument factory)
|
||||||
{
|
{
|
||||||
XmlNode data = null;
|
XmlNode data = null;
|
||||||
|
|
||||||
if (provider.Stale || !m_cacheEnabled)
|
if (provider.Stale || !m_cacheEnabled)
|
||||||
{
|
{
|
||||||
data = provider.RequestSnapshotData(factory);
|
data = provider.RequestSnapshotData(factory);
|
||||||
|
|
||||||
if (m_cacheEnabled)
|
if (m_cacheEnabled)
|
||||||
{
|
{
|
||||||
String path = DataFileNameFragment(provider.GetParentScene, provider.Name);
|
String path = DataFileNameFragment(provider.GetParentScene, provider.Name);
|
||||||
|
|
||||||
using (XmlTextWriter snapXWriter = new XmlTextWriter(path, Encoding.Default))
|
using (XmlTextWriter snapXWriter = new XmlTextWriter(path, Encoding.Default))
|
||||||
{
|
{
|
||||||
snapXWriter.Formatting = Formatting.Indented;
|
snapXWriter.Formatting = Formatting.Indented;
|
||||||
snapXWriter.WriteStartDocument();
|
snapXWriter.WriteStartDocument();
|
||||||
data.WriteTo(snapXWriter);
|
data.WriteTo(snapXWriter);
|
||||||
snapXWriter.WriteEndDocument();
|
snapXWriter.WriteEndDocument();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//mark provider as not stale, parent scene as stale
|
//mark provider as not stale, parent scene as stale
|
||||||
provider.Stale = false;
|
provider.Stale = false;
|
||||||
m_scenes[provider.GetParentScene] = true;
|
m_scenes[provider.GetParentScene] = true;
|
||||||
|
|
||||||
m_log.Info("[DATASNAPSHOT]: Generated fragment response for provider type " + provider.Name);
|
m_log.Info("[DATASNAPSHOT]: Generated fragment response for provider type " + provider.Name);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
String path = DataFileNameFragment(provider.GetParentScene, provider.Name);
|
String path = DataFileNameFragment(provider.GetParentScene, provider.Name);
|
||||||
|
|
||||||
XmlDocument fragDocument = new XmlDocument();
|
XmlDocument fragDocument = new XmlDocument();
|
||||||
fragDocument.PreserveWhitespace = true;
|
fragDocument.PreserveWhitespace = true;
|
||||||
fragDocument.Load(path);
|
fragDocument.Load(path);
|
||||||
foreach (XmlNode node in fragDocument)
|
foreach (XmlNode node in fragDocument)
|
||||||
{
|
{
|
||||||
data = factory.ImportNode(node, true);
|
data = factory.ImportNode(node, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_log.Info("[DATASNAPSHOT]: Retrieved fragment response for provider type " + provider.Name);
|
m_log.Info("[DATASNAPSHOT]: Retrieved fragment response for provider type " + provider.Name);
|
||||||
}
|
}
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Response storage
|
#region Response storage
|
||||||
public XmlNode GetScene(Scene scene, XmlDocument factory)
|
public XmlNode GetScene(Scene scene, XmlDocument factory)
|
||||||
{
|
{
|
||||||
m_log.Debug("[DATASNAPSHOT]: Data requested for scene " + scene.RegionInfo.RegionName);
|
m_log.Debug("[DATASNAPSHOT]: Data requested for scene " + scene.RegionInfo.RegionName);
|
||||||
|
|
||||||
if (!m_scenes.ContainsKey(scene)) {
|
if (!m_scenes.ContainsKey(scene)) {
|
||||||
m_scenes.Add(scene, true); //stale by default
|
m_scenes.Add(scene, true); //stale by default
|
||||||
}
|
}
|
||||||
|
|
||||||
XmlNode regionElement = null;
|
XmlNode regionElement = null;
|
||||||
|
|
||||||
if (!m_scenes[scene])
|
if (!m_scenes[scene])
|
||||||
{
|
{
|
||||||
m_log.Info("[DATASNAPSHOT]: Attempting to retrieve snapshot from cache.");
|
m_log.Info("[DATASNAPSHOT]: Attempting to retrieve snapshot from cache.");
|
||||||
//get snapshot from cache
|
//get snapshot from cache
|
||||||
String path = DataFileNameScene(scene);
|
String path = DataFileNameScene(scene);
|
||||||
|
|
||||||
XmlDocument fragDocument = new XmlDocument();
|
XmlDocument fragDocument = new XmlDocument();
|
||||||
fragDocument.PreserveWhitespace = true;
|
fragDocument.PreserveWhitespace = true;
|
||||||
|
|
||||||
fragDocument.Load(path);
|
fragDocument.Load(path);
|
||||||
|
|
||||||
foreach (XmlNode node in fragDocument)
|
foreach (XmlNode node in fragDocument)
|
||||||
{
|
{
|
||||||
regionElement = factory.ImportNode(node, true);
|
regionElement = factory.ImportNode(node, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_log.Info("[DATASNAPSHOT]: Obtained snapshot from cache for " + scene.RegionInfo.RegionName);
|
m_log.Info("[DATASNAPSHOT]: Obtained snapshot from cache for " + scene.RegionInfo.RegionName);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_log.Info("[DATASNAPSHOT]: Attempting to generate snapshot.");
|
m_log.Info("[DATASNAPSHOT]: Attempting to generate snapshot.");
|
||||||
//make snapshot
|
//make snapshot
|
||||||
regionElement = MakeRegionNode(scene, factory);
|
regionElement = MakeRegionNode(scene, factory);
|
||||||
|
|
||||||
regionElement.AppendChild(GetGridSnapshotData(factory));
|
regionElement.AppendChild(GetGridSnapshotData(factory));
|
||||||
XmlNode regionData = factory.CreateNode(XmlNodeType.Element, "data", "");
|
XmlNode regionData = factory.CreateNode(XmlNodeType.Element, "data", "");
|
||||||
|
|
||||||
foreach (IDataSnapshotProvider dataprovider in m_providers)
|
foreach (IDataSnapshotProvider dataprovider in m_providers)
|
||||||
{
|
{
|
||||||
if (dataprovider.GetParentScene == scene)
|
if (dataprovider.GetParentScene == scene)
|
||||||
{
|
{
|
||||||
regionData.AppendChild(GetFragment(dataprovider, factory));
|
regionData.AppendChild(GetFragment(dataprovider, factory));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
regionElement.AppendChild(regionData);
|
regionElement.AppendChild(regionData);
|
||||||
|
|
||||||
factory.AppendChild(regionElement);
|
factory.AppendChild(regionElement);
|
||||||
|
|
||||||
//save snapshot
|
//save snapshot
|
||||||
String path = DataFileNameScene(scene);
|
String path = DataFileNameScene(scene);
|
||||||
|
|
||||||
using (XmlTextWriter snapXWriter = new XmlTextWriter(path, Encoding.Default))
|
using (XmlTextWriter snapXWriter = new XmlTextWriter(path, Encoding.Default))
|
||||||
{
|
{
|
||||||
snapXWriter.Formatting = Formatting.Indented;
|
snapXWriter.Formatting = Formatting.Indented;
|
||||||
snapXWriter.WriteStartDocument();
|
snapXWriter.WriteStartDocument();
|
||||||
regionElement.WriteTo(snapXWriter);
|
regionElement.WriteTo(snapXWriter);
|
||||||
snapXWriter.WriteEndDocument();
|
snapXWriter.WriteEndDocument();
|
||||||
}
|
}
|
||||||
|
|
||||||
m_scenes[scene] = false;
|
m_scenes[scene] = false;
|
||||||
|
|
||||||
m_log.Info("[DATASNAPSHOT]: Generated new snapshot for " + scene.RegionInfo.RegionName);
|
m_log.Info("[DATASNAPSHOT]: Generated new snapshot for " + scene.RegionInfo.RegionName);
|
||||||
}
|
}
|
||||||
|
|
||||||
return regionElement;
|
return regionElement;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Helpers
|
#region Helpers
|
||||||
private string DataFileNameFragment(Scene scene, String fragmentName)
|
private string DataFileNameFragment(Scene scene, String fragmentName)
|
||||||
{
|
{
|
||||||
return Path.Combine(m_directory, Path.ChangeExtension(scene.RegionInfo.RegionName + "_" + fragmentName, "xml"));
|
return Path.Combine(m_directory, Path.ChangeExtension(scene.RegionInfo.RegionName + "_" + fragmentName, "xml"));
|
||||||
}
|
}
|
||||||
|
|
||||||
private string DataFileNameScene(Scene scene)
|
private string DataFileNameScene(Scene scene)
|
||||||
{
|
{
|
||||||
return Path.Combine(m_directory, Path.ChangeExtension(scene.RegionInfo.RegionName, "xml"));
|
return Path.Combine(m_directory, Path.ChangeExtension(scene.RegionInfo.RegionName, "xml"));
|
||||||
//return (m_snapsDir + Path.DirectorySeparatorChar + scene.RegionInfo.RegionName + ".xml");
|
//return (m_snapsDir + Path.DirectorySeparatorChar + scene.RegionInfo.RegionName + ".xml");
|
||||||
}
|
}
|
||||||
|
|
||||||
private XmlNode MakeRegionNode(Scene scene, XmlDocument basedoc)
|
private XmlNode MakeRegionNode(Scene scene, XmlDocument basedoc)
|
||||||
{
|
{
|
||||||
XmlNode docElement = basedoc.CreateNode(XmlNodeType.Element, "region", "");
|
XmlNode docElement = basedoc.CreateNode(XmlNodeType.Element, "region", "");
|
||||||
|
|
||||||
XmlAttribute attr = basedoc.CreateAttribute("category");
|
XmlAttribute attr = basedoc.CreateAttribute("category");
|
||||||
attr.Value = GetRegionCategory(scene);
|
attr.Value = GetRegionCategory(scene);
|
||||||
docElement.Attributes.Append(attr);
|
docElement.Attributes.Append(attr);
|
||||||
|
|
||||||
attr = basedoc.CreateAttribute("entities");
|
attr = basedoc.CreateAttribute("entities");
|
||||||
attr.Value = scene.Entities.Count.ToString();
|
attr.Value = scene.Entities.Count.ToString();
|
||||||
docElement.Attributes.Append(attr);
|
docElement.Attributes.Append(attr);
|
||||||
|
|
||||||
//attr = basedoc.CreateAttribute("parcels");
|
//attr = basedoc.CreateAttribute("parcels");
|
||||||
//attr.Value = scene.LandManager.landList.Count.ToString();
|
//attr.Value = scene.LandManager.landList.Count.ToString();
|
||||||
//docElement.Attributes.Append(attr);
|
//docElement.Attributes.Append(attr);
|
||||||
|
|
||||||
|
|
||||||
XmlNode infoblock = basedoc.CreateNode(XmlNodeType.Element, "info", "");
|
XmlNode infoblock = basedoc.CreateNode(XmlNodeType.Element, "info", "");
|
||||||
|
|
||||||
XmlNode infopiece = basedoc.CreateNode(XmlNodeType.Element, "uuid", "");
|
XmlNode infopiece = basedoc.CreateNode(XmlNodeType.Element, "uuid", "");
|
||||||
infopiece.InnerText = scene.RegionInfo.RegionID.ToString();
|
infopiece.InnerText = scene.RegionInfo.RegionID.ToString();
|
||||||
infoblock.AppendChild(infopiece);
|
infoblock.AppendChild(infopiece);
|
||||||
|
|
||||||
infopiece = basedoc.CreateNode(XmlNodeType.Element, "url", "");
|
infopiece = basedoc.CreateNode(XmlNodeType.Element, "url", "");
|
||||||
infopiece.InnerText = "http://" + m_hostname + ":" + m_listener_port;
|
infopiece.InnerText = "http://" + m_hostname + ":" + m_listener_port;
|
||||||
infoblock.AppendChild(infopiece);
|
infoblock.AppendChild(infopiece);
|
||||||
|
|
||||||
infopiece = basedoc.CreateNode(XmlNodeType.Element, "name", "");
|
infopiece = basedoc.CreateNode(XmlNodeType.Element, "name", "");
|
||||||
infopiece.InnerText = scene.RegionInfo.RegionName;
|
infopiece.InnerText = scene.RegionInfo.RegionName;
|
||||||
infoblock.AppendChild(infopiece);
|
infoblock.AppendChild(infopiece);
|
||||||
|
|
||||||
docElement.AppendChild(infoblock);
|
docElement.AppendChild(infoblock);
|
||||||
|
|
||||||
m_log.Debug("[DATASNAPSHOT]: Generated region node");
|
m_log.Debug("[DATASNAPSHOT]: Generated region node");
|
||||||
return docElement;
|
return docElement;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String GetRegionCategory(Scene scene)
|
private String GetRegionCategory(Scene scene)
|
||||||
{
|
{
|
||||||
|
|
||||||
//Boolean choice between:
|
//Boolean choice between:
|
||||||
// "PG" - Mormontown
|
// "PG" - Mormontown
|
||||||
// "Mature" - Sodom and Gomorrah
|
// "Mature" - Sodom and Gomorrah
|
||||||
// (Depreciated) "Patriotic Nigra Testing Sandbox" - Abandon Hope All Ye Who Enter Here
|
// (Depreciated) "Patriotic Nigra Testing Sandbox" - Abandon Hope All Ye Who Enter Here
|
||||||
if ((scene.RegionInfo.EstateSettings.simAccess & Simulator.SimAccess.Mature) == Simulator.SimAccess.Mature)
|
if ((scene.RegionInfo.EstateSettings.simAccess & Simulator.SimAccess.Mature) == Simulator.SimAccess.Mature)
|
||||||
{
|
{
|
||||||
return "Mature";
|
return "Mature";
|
||||||
}
|
}
|
||||||
else if ((scene.RegionInfo.EstateSettings.simAccess & Simulator.SimAccess.PG) == Simulator.SimAccess.PG)
|
else if ((scene.RegionInfo.EstateSettings.simAccess & Simulator.SimAccess.PG) == Simulator.SimAccess.PG)
|
||||||
{
|
{
|
||||||
return "PG";
|
return "PG";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return "Unknown";
|
return "Unknown";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private XmlNode GetGridSnapshotData(XmlDocument factory)
|
private XmlNode GetGridSnapshotData(XmlDocument factory)
|
||||||
{
|
{
|
||||||
XmlNode griddata = factory.CreateNode(XmlNodeType.Element, "grid", "");
|
XmlNode griddata = factory.CreateNode(XmlNodeType.Element, "grid", "");
|
||||||
|
|
||||||
foreach (KeyValuePair<String, String> GridData in m_gridinfo)
|
foreach (KeyValuePair<String, String> GridData in m_gridinfo)
|
||||||
{
|
{
|
||||||
//TODO: make it lowercase tag names for diva
|
//TODO: make it lowercase tag names for diva
|
||||||
XmlNode childnode = factory.CreateNode(XmlNodeType.Element, GridData.Key, "");
|
XmlNode childnode = factory.CreateNode(XmlNodeType.Element, GridData.Key, "");
|
||||||
childnode.InnerText = GridData.Value;
|
childnode.InnerText = GridData.Value;
|
||||||
griddata.AppendChild(childnode);
|
griddata.AppendChild(childnode);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_log.Debug("[DATASNAPSHOT]: Got grid snapshot data");
|
m_log.Debug("[DATASNAPSHOT]: Got grid snapshot data");
|
||||||
|
|
||||||
return griddata;
|
return griddata;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Manage internal collections
|
#region Manage internal collections
|
||||||
public void AddScene(Scene newScene)
|
public void AddScene(Scene newScene)
|
||||||
{
|
{
|
||||||
m_scenes.Add(newScene, true);
|
m_scenes.Add(newScene, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RemoveScene(Scene deadScene)
|
public void RemoveScene(Scene deadScene)
|
||||||
{
|
{
|
||||||
m_scenes.Remove(deadScene);
|
m_scenes.Remove(deadScene);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddProvider(IDataSnapshotProvider newProvider)
|
public void AddProvider(IDataSnapshotProvider newProvider)
|
||||||
{
|
{
|
||||||
m_providers.Add(newProvider);
|
m_providers.Add(newProvider);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RemoveProvider(IDataSnapshotProvider deadProvider)
|
public void RemoveProvider(IDataSnapshotProvider deadProvider)
|
||||||
{
|
{
|
||||||
m_providers.Remove(deadProvider);
|
m_providers.Remove(deadProvider);
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue