* iars: Serialize information about item creators to archive
parent
28d9a73521
commit
93b26f8933
|
@ -35,49 +35,54 @@ namespace OpenSim.Framework.Serialization
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class ArchiveConstants
|
public class ArchiveConstants
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <value>
|
||||||
/// The location of the archive control file
|
/// The location of the archive control file
|
||||||
/// </summary>
|
/// </value>
|
||||||
public static readonly string CONTROL_FILE_PATH = "archive.xml";
|
public static readonly string CONTROL_FILE_PATH = "archive.xml";
|
||||||
|
|
||||||
/// <summary>
|
/// <value>
|
||||||
/// Path for the assets held in an archive
|
/// Path for the assets held in an archive
|
||||||
/// </summary>
|
/// </value>
|
||||||
public static readonly string ASSETS_PATH = "assets/";
|
public static readonly string ASSETS_PATH = "assets/";
|
||||||
|
|
||||||
/// <summary>
|
/// <value>
|
||||||
/// Path for the inventory data
|
/// Path for the inventory data
|
||||||
/// </summary>
|
/// </value>
|
||||||
public static readonly string INVENTORY_PATH = "inventory/";
|
public static readonly string INVENTORY_PATH = "inventory/";
|
||||||
|
|
||||||
/// <summary>
|
/// <value>
|
||||||
/// Path for the prims file
|
/// Path for the prims file
|
||||||
/// </summary>
|
/// </value>
|
||||||
public static readonly string OBJECTS_PATH = "objects/";
|
public static readonly string OBJECTS_PATH = "objects/";
|
||||||
|
|
||||||
/// <summary>
|
/// <value>
|
||||||
/// Path for terrains. Technically these may be assets, but I think it's quite nice to split them out.
|
/// Path for terrains. Technically these may be assets, but I think it's quite nice to split them out.
|
||||||
/// </summary>
|
/// </value>
|
||||||
public static readonly string TERRAINS_PATH = "terrains/";
|
public static readonly string TERRAINS_PATH = "terrains/";
|
||||||
|
|
||||||
/// <summary>
|
/// <value>
|
||||||
/// Path for region settings.
|
/// Path for region settings.
|
||||||
/// </summary>
|
/// </value>
|
||||||
public static readonly string SETTINGS_PATH = "settings/";
|
public static readonly string SETTINGS_PATH = "settings/";
|
||||||
|
|
||||||
|
/// <value>
|
||||||
|
/// Path for user profiles
|
||||||
|
/// </value>
|
||||||
|
public const string USERS_PATH = "users/";
|
||||||
|
|
||||||
/// <summary>
|
/// <value>
|
||||||
/// The character the separates the uuid from extension information in an archived asset filename
|
/// The character the separates the uuid from extension information in an archived asset filename
|
||||||
/// </summary>
|
/// </value>
|
||||||
public static readonly string ASSET_EXTENSION_SEPARATOR = "_";
|
public static readonly string ASSET_EXTENSION_SEPARATOR = "_";
|
||||||
|
|
||||||
/// <summary>
|
/// <value>
|
||||||
/// Used to separate components in an inventory node name
|
/// Used to separate components in an inventory node name
|
||||||
/// </summary>
|
/// </value>
|
||||||
public static readonly string INVENTORY_NODE_NAME_COMPONENT_SEPARATOR = "__";
|
public static readonly string INVENTORY_NODE_NAME_COMPONENT_SEPARATOR = "__";
|
||||||
|
|
||||||
/// <summary>
|
/// <value>
|
||||||
/// Extensions used for asset types in the archive
|
/// Extensions used for asset types in the archive
|
||||||
/// </summary>
|
/// </value>
|
||||||
public static readonly IDictionary<sbyte, string> ASSET_TYPE_TO_EXTENSION = new Dictionary<sbyte, string>();
|
public static readonly IDictionary<sbyte, string> ASSET_TYPE_TO_EXTENSION = new Dictionary<sbyte, string>();
|
||||||
public static readonly IDictionary<string, sbyte> EXTENSION_TO_ASSET_TYPE = new Dictionary<string, sbyte>();
|
public static readonly IDictionary<string, sbyte> EXTENSION_TO_ASSET_TYPE = new Dictionary<string, sbyte>();
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,71 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* * Neither the name of the OpenSim Project nor the
|
||||||
|
* names of its contributors may be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||||
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
using System.IO;
|
||||||
|
using System.Xml;
|
||||||
|
using OpenSim.Framework;
|
||||||
|
|
||||||
|
namespace OpenSim.Framework.Serialization.External
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Serialize and deserialize region settings for an archive file format.
|
||||||
|
/// </summary>
|
||||||
|
/// We didn't use automatic .NET serialization since this is really
|
||||||
|
/// a file format rather than an object serialization.
|
||||||
|
public class UserProfileSerializer
|
||||||
|
{
|
||||||
|
public const int MAJOR_VERSION = 0;
|
||||||
|
public const int MINOR_VERSION = 1;
|
||||||
|
|
||||||
|
public static string Serialize(UserProfileData profile)
|
||||||
|
{
|
||||||
|
StringWriter sw = new StringWriter();
|
||||||
|
XmlTextWriter xtw = new XmlTextWriter(sw);
|
||||||
|
xtw.Formatting = Formatting.Indented;
|
||||||
|
xtw.WriteStartDocument();
|
||||||
|
|
||||||
|
xtw.WriteStartElement("user_profile");
|
||||||
|
xtw.WriteAttributeString("major_version", MAJOR_VERSION.ToString());
|
||||||
|
xtw.WriteAttributeString("minor_version", MINOR_VERSION.ToString());
|
||||||
|
|
||||||
|
xtw.WriteElementString("name", profile.Name);
|
||||||
|
xtw.WriteElementString("id", profile.ID);
|
||||||
|
xtw.WriteElementString("about", profile.AboutText);
|
||||||
|
|
||||||
|
// Not sure if we're storing this yet, need to take a look
|
||||||
|
// xtw.WriteElementString("Url", profile.Url);
|
||||||
|
// or, indeed, interests
|
||||||
|
|
||||||
|
xtw.WriteEndElement();
|
||||||
|
|
||||||
|
xtw.Close();
|
||||||
|
sw.Close();
|
||||||
|
|
||||||
|
return sw.ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -35,6 +35,7 @@ using log4net;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using OpenSim.Framework.Serialization;
|
using OpenSim.Framework.Serialization;
|
||||||
|
using OpenSim.Framework.Serialization.External;
|
||||||
using OpenSim.Framework.Communications;
|
using OpenSim.Framework.Communications;
|
||||||
using OpenSim.Framework.Communications.Cache;
|
using OpenSim.Framework.Communications.Cache;
|
||||||
using OpenSim.Region.CoreModules.World.Archiver;
|
using OpenSim.Region.CoreModules.World.Archiver;
|
||||||
|
@ -346,10 +347,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||||
= m_module.CommsManager.UserProfileCacheService.GetUserDetails(creatorId);
|
= m_module.CommsManager.UserProfileCacheService.GetUserDetails(creatorId);
|
||||||
|
|
||||||
if (creator != null)
|
if (creator != null)
|
||||||
m_log.DebugFormat(
|
{
|
||||||
"[INVENTORY ARCHIVER]: Got creator {0} {1}", creator.UserProfile.Name, creator.UserProfile.ID);
|
m_archive.WriteFile(
|
||||||
|
ArchiveConstants.USERS_PATH + creator.UserProfile.Name + ".xml",
|
||||||
|
UserProfileSerializer.Serialize(creator.UserProfile));
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
m_log.WarnFormat("[INVENTORY ARCHIVER]: Failed to get creator profile for {0}", creatorId);
|
m_log.WarnFormat("[INVENTORY ARCHIVER]: Failed to get creator profile for {0}", creatorId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -118,9 +118,11 @@
|
||||||
</Configuration>
|
</Configuration>
|
||||||
|
|
||||||
<ReferencePath>../../../bin/</ReferencePath>
|
<ReferencePath>../../../bin/</ReferencePath>
|
||||||
<Reference name="OpenMetaverse" />
|
|
||||||
<Reference name="System"/>
|
<Reference name="System"/>
|
||||||
|
<Reference name="System.Xml"/>
|
||||||
<Reference name="log4net.dll"/>
|
<Reference name="log4net.dll"/>
|
||||||
|
<Reference name="OpenMetaverse" />
|
||||||
|
<Reference name="OpenSim.Framework"/>
|
||||||
|
|
||||||
<Files>
|
<Files>
|
||||||
<Match pattern="*.cs" recurse="true"/>
|
<Match pattern="*.cs" recurse="true"/>
|
||||||
|
|
Loading…
Reference in New Issue