aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJustin Clarke Casey2009-03-26 17:25:12 +0000
committerJustin Clarke Casey2009-03-26 17:25:12 +0000
commit93b26f89336d83f2eab43ced0081d60b1acf2d7f (patch)
treec729d6730fc639d0df44f3613bc477f2d99da00c
parentSmall refactoring in Caps, no functional changes. (diff)
downloadopensim-SC_OLD-93b26f89336d83f2eab43ced0081d60b1acf2d7f.zip
opensim-SC_OLD-93b26f89336d83f2eab43ced0081d60b1acf2d7f.tar.gz
opensim-SC_OLD-93b26f89336d83f2eab43ced0081d60b1acf2d7f.tar.bz2
opensim-SC_OLD-93b26f89336d83f2eab43ced0081d60b1acf2d7f.tar.xz
* iars: Serialize information about item creators to archive
-rw-r--r--OpenSim/Framework/Serialization/ArchiveConstants.cs41
-rw-r--r--OpenSim/Framework/Serialization/External/UserProfileSerializer.cs71
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs10
-rw-r--r--prebuild.xml4
4 files changed, 105 insertions, 21 deletions
diff --git a/OpenSim/Framework/Serialization/ArchiveConstants.cs b/OpenSim/Framework/Serialization/ArchiveConstants.cs
index d0a0985..8ce7b56 100644
--- a/OpenSim/Framework/Serialization/ArchiveConstants.cs
+++ b/OpenSim/Framework/Serialization/ArchiveConstants.cs
@@ -35,49 +35,54 @@ namespace OpenSim.Framework.Serialization
35 /// </summary> 35 /// </summary>
36 public class ArchiveConstants 36 public class ArchiveConstants
37 { 37 {
38 /// <summary> 38 /// <value>
39 /// The location of the archive control file 39 /// The location of the archive control file
40 /// </summary> 40 /// </value>
41 public static readonly string CONTROL_FILE_PATH = "archive.xml"; 41 public static readonly string CONTROL_FILE_PATH = "archive.xml";
42 42
43 /// <summary> 43 /// <value>
44 /// Path for the assets held in an archive 44 /// Path for the assets held in an archive
45 /// </summary> 45 /// </value>
46 public static readonly string ASSETS_PATH = "assets/"; 46 public static readonly string ASSETS_PATH = "assets/";
47 47
48 /// <summary> 48 /// <value>
49 /// Path for the inventory data 49 /// Path for the inventory data
50 /// </summary> 50 /// </value>
51 public static readonly string INVENTORY_PATH = "inventory/"; 51 public static readonly string INVENTORY_PATH = "inventory/";
52 52
53 /// <summary> 53 /// <value>
54 /// Path for the prims file 54 /// Path for the prims file
55 /// </summary> 55 /// </value>
56 public static readonly string OBJECTS_PATH = "objects/"; 56 public static readonly string OBJECTS_PATH = "objects/";
57 57
58 /// <summary> 58 /// <value>
59 /// Path for terrains. Technically these may be assets, but I think it's quite nice to split them out. 59 /// Path for terrains. Technically these may be assets, but I think it's quite nice to split them out.
60 /// </summary> 60 /// </value>
61 public static readonly string TERRAINS_PATH = "terrains/"; 61 public static readonly string TERRAINS_PATH = "terrains/";
62 62
63 /// <summary> 63 /// <value>
64 /// Path for region settings. 64 /// Path for region settings.
65 /// </summary> 65 /// </value>
66 public static readonly string SETTINGS_PATH = "settings/"; 66 public static readonly string SETTINGS_PATH = "settings/";
67
68 /// <value>
69 /// Path for user profiles
70 /// </value>
71 public const string USERS_PATH = "users/";
67 72
68 /// <summary> 73 /// <value>
69 /// The character the separates the uuid from extension information in an archived asset filename 74 /// The character the separates the uuid from extension information in an archived asset filename
70 /// </summary> 75 /// </value>
71 public static readonly string ASSET_EXTENSION_SEPARATOR = "_"; 76 public static readonly string ASSET_EXTENSION_SEPARATOR = "_";
72 77
73 /// <summary> 78 /// <value>
74 /// Used to separate components in an inventory node name 79 /// Used to separate components in an inventory node name
75 /// </summary> 80 /// </value>
76 public static readonly string INVENTORY_NODE_NAME_COMPONENT_SEPARATOR = "__"; 81 public static readonly string INVENTORY_NODE_NAME_COMPONENT_SEPARATOR = "__";
77 82
78 /// <summary> 83 /// <value>
79 /// Extensions used for asset types in the archive 84 /// Extensions used for asset types in the archive
80 /// </summary> 85 /// </value>
81 public static readonly IDictionary<sbyte, string> ASSET_TYPE_TO_EXTENSION = new Dictionary<sbyte, string>(); 86 public static readonly IDictionary<sbyte, string> ASSET_TYPE_TO_EXTENSION = new Dictionary<sbyte, string>();
82 public static readonly IDictionary<string, sbyte> EXTENSION_TO_ASSET_TYPE = new Dictionary<string, sbyte>(); 87 public static readonly IDictionary<string, sbyte> EXTENSION_TO_ASSET_TYPE = new Dictionary<string, sbyte>();
83 88
diff --git a/OpenSim/Framework/Serialization/External/UserProfileSerializer.cs b/OpenSim/Framework/Serialization/External/UserProfileSerializer.cs
new file mode 100644
index 0000000..fc76fb6
--- /dev/null
+++ b/OpenSim/Framework/Serialization/External/UserProfileSerializer.cs
@@ -0,0 +1,71 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSim Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System.IO;
29using System.Xml;
30using OpenSim.Framework;
31
32namespace OpenSim.Framework.Serialization.External
33{
34 /// <summary>
35 /// Serialize and deserialize region settings for an archive file format.
36 /// </summary>
37 /// We didn't use automatic .NET serialization since this is really
38 /// a file format rather than an object serialization.
39 public class UserProfileSerializer
40 {
41 public const int MAJOR_VERSION = 0;
42 public const int MINOR_VERSION = 1;
43
44 public static string Serialize(UserProfileData profile)
45 {
46 StringWriter sw = new StringWriter();
47 XmlTextWriter xtw = new XmlTextWriter(sw);
48 xtw.Formatting = Formatting.Indented;
49 xtw.WriteStartDocument();
50
51 xtw.WriteStartElement("user_profile");
52 xtw.WriteAttributeString("major_version", MAJOR_VERSION.ToString());
53 xtw.WriteAttributeString("minor_version", MINOR_VERSION.ToString());
54
55 xtw.WriteElementString("name", profile.Name);
56 xtw.WriteElementString("id", profile.ID);
57 xtw.WriteElementString("about", profile.AboutText);
58
59 // Not sure if we're storing this yet, need to take a look
60// xtw.WriteElementString("Url", profile.Url);
61 // or, indeed, interests
62
63 xtw.WriteEndElement();
64
65 xtw.Close();
66 sw.Close();
67
68 return sw.ToString();
69 }
70 }
71} \ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs
index 208c49e..5a7d929 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs
@@ -35,6 +35,7 @@ using log4net;
35using OpenMetaverse; 35using OpenMetaverse;
36using OpenSim.Framework; 36using OpenSim.Framework;
37using OpenSim.Framework.Serialization; 37using OpenSim.Framework.Serialization;
38using OpenSim.Framework.Serialization.External;
38using OpenSim.Framework.Communications; 39using OpenSim.Framework.Communications;
39using OpenSim.Framework.Communications.Cache; 40using OpenSim.Framework.Communications.Cache;
40using OpenSim.Region.CoreModules.World.Archiver; 41using OpenSim.Region.CoreModules.World.Archiver;
@@ -346,10 +347,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
346 = m_module.CommsManager.UserProfileCacheService.GetUserDetails(creatorId); 347 = m_module.CommsManager.UserProfileCacheService.GetUserDetails(creatorId);
347 348
348 if (creator != null) 349 if (creator != null)
349 m_log.DebugFormat( 350 {
350 "[INVENTORY ARCHIVER]: Got creator {0} {1}", creator.UserProfile.Name, creator.UserProfile.ID); 351 m_archive.WriteFile(
352 ArchiveConstants.USERS_PATH + creator.UserProfile.Name + ".xml",
353 UserProfileSerializer.Serialize(creator.UserProfile));
354 }
351 else 355 else
356 {
352 m_log.WarnFormat("[INVENTORY ARCHIVER]: Failed to get creator profile for {0}", creatorId); 357 m_log.WarnFormat("[INVENTORY ARCHIVER]: Failed to get creator profile for {0}", creatorId);
358 }
353 } 359 }
354 } 360 }
355 } 361 }
diff --git a/prebuild.xml b/prebuild.xml
index f876cdf..5da8d9c 100644
--- a/prebuild.xml
+++ b/prebuild.xml
@@ -118,9 +118,11 @@
118 </Configuration> 118 </Configuration>
119 119
120 <ReferencePath>../../../bin/</ReferencePath> 120 <ReferencePath>../../../bin/</ReferencePath>
121 <Reference name="OpenMetaverse" />
122 <Reference name="System"/> 121 <Reference name="System"/>
122 <Reference name="System.Xml"/>
123 <Reference name="log4net.dll"/> 123 <Reference name="log4net.dll"/>
124 <Reference name="OpenMetaverse" />
125 <Reference name="OpenSim.Framework"/>
124 126
125 <Files> 127 <Files>
126 <Match pattern="*.cs" recurse="true"/> 128 <Match pattern="*.cs" recurse="true"/>