aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Grid/AssetInventoryServer/Plugins/InventoryArchivePlugin.cs
diff options
context:
space:
mode:
authorJustin Clarke Casey2009-04-23 20:15:05 +0000
committerJustin Clarke Casey2009-04-23 20:15:05 +0000
commit1ccc99a3f9d96fbdea478be7e7df427a9e5377a7 (patch)
tree713222af91ebef24e5604efffc9e6b1c68a7700b /OpenSim/Grid/AssetInventoryServer/Plugins/InventoryArchivePlugin.cs
parent* Allow interested user data plugins to store temporary user profiles (diff)
downloadopensim-SC-1ccc99a3f9d96fbdea478be7e7df427a9e5377a7.zip
opensim-SC-1ccc99a3f9d96fbdea478be7e7df427a9e5377a7.tar.gz
opensim-SC-1ccc99a3f9d96fbdea478be7e7df427a9e5377a7.tar.bz2
opensim-SC-1ccc99a3f9d96fbdea478be7e7df427a9e5377a7.tar.xz
* refactor: move archive user inventory item serialization out to a separate file
Diffstat (limited to 'OpenSim/Grid/AssetInventoryServer/Plugins/InventoryArchivePlugin.cs')
-rw-r--r--OpenSim/Grid/AssetInventoryServer/Plugins/InventoryArchivePlugin.cs73
1 files changed, 6 insertions, 67 deletions
diff --git a/OpenSim/Grid/AssetInventoryServer/Plugins/InventoryArchivePlugin.cs b/OpenSim/Grid/AssetInventoryServer/Plugins/InventoryArchivePlugin.cs
index e19160a..7f41de5 100644
--- a/OpenSim/Grid/AssetInventoryServer/Plugins/InventoryArchivePlugin.cs
+++ b/OpenSim/Grid/AssetInventoryServer/Plugins/InventoryArchivePlugin.cs
@@ -34,6 +34,7 @@ using System.Reflection;
34using OpenMetaverse; 34using OpenMetaverse;
35using OpenSim.Framework; 35using OpenSim.Framework;
36using OpenSim.Framework.Serialization; 36using OpenSim.Framework.Serialization;
37using OpenSim.Framework.Serialization.External;
37using OpenSim.Framework.Servers; 38using OpenSim.Framework.Servers;
38using log4net; 39using log4net;
39 40
@@ -178,7 +179,8 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins
178 return rootFolder; 179 return rootFolder;
179 } 180 }
180 181
181 private static void WriteInventoryFolderToArchive(TarArchiveWriter archive, InventoryFolderWithChildren folder, string path) 182 private static void WriteInventoryFolderToArchive(
183 TarArchiveWriter archive, InventoryFolderWithChildren folder, string path)
182 { 184 {
183 path += string.Format("{0}{1}{2}/", folder.Name, ArchiveConstants.INVENTORY_NODE_NAME_COMPONENT_SEPARATOR, folder.ID); 185 path += string.Format("{0}{1}{2}/", folder.Name, ArchiveConstants.INVENTORY_NODE_NAME_COMPONENT_SEPARATOR, folder.ID);
184 archive.WriteDir(path); 186 archive.WriteDir(path);
@@ -199,72 +201,9 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins
199 private static void WriteInventoryItemToArchive(TarArchiveWriter archive, InventoryItemBase item, string path) 201 private static void WriteInventoryItemToArchive(TarArchiveWriter archive, InventoryItemBase item, string path)
200 { 202 {
201 string filename = string.Format("{0}{1}_{2}.xml", path, item.Name, item.ID); 203 string filename = string.Format("{0}{1}_{2}.xml", path, item.Name, item.ID);
202 204 string serialization = UserInventoryItemSerializer.Serialize(item);
203 StringWriter sw = new StringWriter(); 205 archive.WriteFile(filename, serialization);
204 XmlTextWriter writer = new XmlTextWriter(sw); 206
205 writer.Formatting = Formatting.Indented;
206
207 writer.WriteStartElement("InventoryItem");
208
209 writer.WriteStartElement("Name");
210 writer.WriteString(item.Name);
211 writer.WriteEndElement();
212 writer.WriteStartElement("ID");
213 writer.WriteString(item.ID.ToString());
214 writer.WriteEndElement();
215 writer.WriteStartElement("InvType");
216 writer.WriteString(item.InvType.ToString());
217 writer.WriteEndElement();
218 writer.WriteStartElement("CreatorUUID");
219 writer.WriteString(item.CreatorId);
220 writer.WriteEndElement();
221 writer.WriteStartElement("CreationDate");
222 writer.WriteString(item.CreationDate.ToString());
223 writer.WriteEndElement();
224 writer.WriteStartElement("Owner");
225 writer.WriteString(item.Owner.ToString());
226 writer.WriteEndElement();
227 writer.WriteStartElement("Description");
228 writer.WriteString(item.Description);
229 writer.WriteEndElement();
230 writer.WriteStartElement("AssetType");
231 writer.WriteString(item.AssetType.ToString());
232 writer.WriteEndElement();
233 writer.WriteStartElement("AssetID");
234 writer.WriteString(item.AssetID.ToString());
235 writer.WriteEndElement();
236 writer.WriteStartElement("SaleType");
237 writer.WriteString(item.SaleType.ToString());
238 writer.WriteEndElement();
239 writer.WriteStartElement("SalePrice");
240 writer.WriteString(item.SalePrice.ToString());
241 writer.WriteEndElement();
242 writer.WriteStartElement("BasePermissions");
243 writer.WriteString(item.BasePermissions.ToString());
244 writer.WriteEndElement();
245 writer.WriteStartElement("CurrentPermissions");
246 writer.WriteString(item.CurrentPermissions.ToString());
247 writer.WriteEndElement();
248 writer.WriteStartElement("EveryOnePermssions");
249 writer.WriteString(item.EveryOnePermissions.ToString());
250 writer.WriteEndElement();
251 writer.WriteStartElement("NextPermissions");
252 writer.WriteString(item.NextPermissions.ToString());
253 writer.WriteEndElement();
254 writer.WriteStartElement("Flags");
255 writer.WriteString(item.Flags.ToString());
256 writer.WriteEndElement();
257 writer.WriteStartElement("GroupID");
258 writer.WriteString(item.GroupID.ToString());
259 writer.WriteEndElement();
260 writer.WriteStartElement("GroupOwned");
261 writer.WriteString(item.GroupOwned.ToString());
262 writer.WriteEndElement();
263
264 writer.WriteEndElement();
265
266 archive.WriteFile(filename, sw.ToString());
267
268 //m_assetGatherer.GatherAssetUuids(item.AssetID, (AssetType) item.AssetType, assetUuids); 207 //m_assetGatherer.GatherAssetUuids(item.AssetID, (AssetType) item.AssetType, assetUuids);
269 } 208 }
270 } 209 }