From f8d51e6949a8d4c3c3b2846279b171ca656105df Mon Sep 17 00:00:00 2001 From: Mike Mazur Date: Mon, 16 Feb 2009 02:28:16 +0000 Subject: - clean up using references as well as References in prebuild.xml - comment out a bunch of stuff in OpenSimInventoryFrontendPlugin.cs to get rid of warnings --- .../AssetInventoryServer/AssetInventoryServer.cs | 2 - OpenSim/Grid/AssetInventoryServer/Interfaces.cs | 2 - OpenSim/Grid/AssetInventoryServer/Metadata.cs | 1 - .../Plugins/AuthorizeAllPlugin.cs | 4 +- .../Plugins/BrowseFrontendPlugin.cs | 3 +- .../Plugins/NullAuthenticationPlugin.cs | 4 +- .../Plugins/NullMetricsPlugin.cs | 5 +- .../Plugins/OpenSim/OpenSimAssetFrontendPlugin.cs | 2 - .../Plugins/OpenSim/OpenSimAssetStoragePlugin.cs | 3 - .../OpenSim/OpenSimInventoryFrontendPlugin.cs | 533 ++++++++++----------- .../OpenSim/OpenSimInventoryStoragePlugin.cs | 2 - .../Plugins/ReferenceFrontendPlugin.cs | 3 - .../Plugins/Simple/SimpleAssetStoragePlugin.cs | 2 - .../Plugins/Simple/SimpleInventoryStoragePlugin.cs | 2 - OpenSim/Grid/AssetInventoryServer/Utils.cs | 14 +- 15 files changed, 277 insertions(+), 305 deletions(-) (limited to 'OpenSim/Grid/AssetInventoryServer') diff --git a/OpenSim/Grid/AssetInventoryServer/AssetInventoryServer.cs b/OpenSim/Grid/AssetInventoryServer/AssetInventoryServer.cs index 2b6bfe3..4b5af05 100644 --- a/OpenSim/Grid/AssetInventoryServer/AssetInventoryServer.cs +++ b/OpenSim/Grid/AssetInventoryServer/AssetInventoryServer.cs @@ -29,8 +29,6 @@ using System; using System.Collections.Generic; -using System.IO; -using System.Net; using System.Reflection; using OpenSim.Framework; using OpenSim.Framework.Servers; diff --git a/OpenSim/Grid/AssetInventoryServer/Interfaces.cs b/OpenSim/Grid/AssetInventoryServer/Interfaces.cs index d934b14..29428d4 100644 --- a/OpenSim/Grid/AssetInventoryServer/Interfaces.cs +++ b/OpenSim/Grid/AssetInventoryServer/Interfaces.cs @@ -29,9 +29,7 @@ using System; using System.Collections.Generic; -using System.Net; using OpenMetaverse; -using OpenMetaverse.StructuredData; using OpenSim.Framework; namespace OpenSim.Grid.AssetInventoryServer diff --git a/OpenSim/Grid/AssetInventoryServer/Metadata.cs b/OpenSim/Grid/AssetInventoryServer/Metadata.cs index ee96eec..ebd379d 100644 --- a/OpenSim/Grid/AssetInventoryServer/Metadata.cs +++ b/OpenSim/Grid/AssetInventoryServer/Metadata.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Xml; using OpenMetaverse; using OpenMetaverse.StructuredData; diff --git a/OpenSim/Grid/AssetInventoryServer/Plugins/AuthorizeAllPlugin.cs b/OpenSim/Grid/AssetInventoryServer/Plugins/AuthorizeAllPlugin.cs index 70322e4..517da28 100644 --- a/OpenSim/Grid/AssetInventoryServer/Plugins/AuthorizeAllPlugin.cs +++ b/OpenSim/Grid/AssetInventoryServer/Plugins/AuthorizeAllPlugin.cs @@ -38,7 +38,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins public class AuthorizeAllPlugin : IAuthorizationProvider { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - AssetInventoryServer server; + //private AssetInventoryServer m_server; public AuthorizeAllPlugin() { @@ -48,7 +48,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins public void Initialise(AssetInventoryServer server) { - this.server = server; + //m_server = server; m_log.Info("[ASSET] Authorize All loaded."); } diff --git a/OpenSim/Grid/AssetInventoryServer/Plugins/BrowseFrontendPlugin.cs b/OpenSim/Grid/AssetInventoryServer/Plugins/BrowseFrontendPlugin.cs index 09e91dc..6afda79 100644 --- a/OpenSim/Grid/AssetInventoryServer/Plugins/BrowseFrontendPlugin.cs +++ b/OpenSim/Grid/AssetInventoryServer/Plugins/BrowseFrontendPlugin.cs @@ -30,7 +30,6 @@ using System; using System.IO; using System.Reflection; -using System.Collections.Generic; using System.Collections.Specialized; using System.Net; using System.Text; @@ -45,7 +44,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins public class BrowseFrontendPlugin : IAssetInventoryServerPlugin { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - AssetInventoryServer m_server; + private AssetInventoryServer m_server; public BrowseFrontendPlugin() { diff --git a/OpenSim/Grid/AssetInventoryServer/Plugins/NullAuthenticationPlugin.cs b/OpenSim/Grid/AssetInventoryServer/Plugins/NullAuthenticationPlugin.cs index 92caa04..386822a 100644 --- a/OpenSim/Grid/AssetInventoryServer/Plugins/NullAuthenticationPlugin.cs +++ b/OpenSim/Grid/AssetInventoryServer/Plugins/NullAuthenticationPlugin.cs @@ -38,7 +38,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins public class NullAuthenticationPlugin : IAuthenticationProvider { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - AssetInventoryServer server; + //private AssetInventoryServer m_server; public NullAuthenticationPlugin() { @@ -48,7 +48,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins public void Initialise(AssetInventoryServer server) { - this.server = server; + //m_server = server; m_log.Info("[ASSET] Null Authentication loaded."); } diff --git a/OpenSim/Grid/AssetInventoryServer/Plugins/NullMetricsPlugin.cs b/OpenSim/Grid/AssetInventoryServer/Plugins/NullMetricsPlugin.cs index 39844f4..7edab93 100644 --- a/OpenSim/Grid/AssetInventoryServer/Plugins/NullMetricsPlugin.cs +++ b/OpenSim/Grid/AssetInventoryServer/Plugins/NullMetricsPlugin.cs @@ -37,7 +37,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins public class NullMetricsPlugin : IMetricsProvider { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - AssetInventoryServer server; + //private AssetInventoryServer m_server; public NullMetricsPlugin() { @@ -122,7 +122,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins public void Initialise(AssetInventoryServer server) { - this.server = server; + //m_server = server; } /// @@ -130,7 +130,6 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins /// public void Initialise() { - this.server = null; m_log.Info("[ASSET] Null metrics loaded."); } diff --git a/OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/OpenSimAssetFrontendPlugin.cs b/OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/OpenSimAssetFrontendPlugin.cs index af69746..1ca4add 100644 --- a/OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/OpenSimAssetFrontendPlugin.cs +++ b/OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/OpenSimAssetFrontendPlugin.cs @@ -29,14 +29,12 @@ using System; using System.Reflection; -using System.Collections.Generic; using System.Net; using System.IO; using System.Text; using System.Xml; using System.Xml.Serialization; using OpenMetaverse; -using HttpServer; using OpenSim.Framework; using OpenSim.Framework.Servers; using log4net; diff --git a/OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/OpenSimAssetStoragePlugin.cs b/OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/OpenSimAssetStoragePlugin.cs index 26a7300..bcd1900 100644 --- a/OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/OpenSimAssetStoragePlugin.cs +++ b/OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/OpenSimAssetStoragePlugin.cs @@ -29,12 +29,9 @@ using System; using System.Reflection; -using System.Collections.Generic; -using System.Net; using System.Data; using MySql.Data.MySqlClient; using OpenMetaverse; -using OpenMetaverse.StructuredData; using OpenSim.Framework; using OpenSim.Data; using Nini.Config; diff --git a/OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/OpenSimInventoryFrontendPlugin.cs b/OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/OpenSimInventoryFrontendPlugin.cs index d4e9097..7f8d8f9 100644 --- a/OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/OpenSimInventoryFrontendPlugin.cs +++ b/OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/OpenSimInventoryFrontendPlugin.cs @@ -30,12 +30,9 @@ using System; using System.Reflection; using System.Collections.Generic; -using System.Net; using System.IO; using System.Xml; using OpenMetaverse; -using OpenMetaverse.StructuredData; -using HttpServer; using OpenSim.Framework; using log4net; @@ -44,10 +41,10 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim public class OpenSimInventoryFrontendPlugin : IAssetInventoryServerPlugin { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - private AssetInventoryServer server; - private Utils.InventoryItemSerializer itemSerializer = new Utils.InventoryItemSerializer(); - private Utils.InventoryFolderSerializer folderSerializer = new Utils.InventoryFolderSerializer(); - private Utils.InventoryCollectionSerializer collectionSerializer = new Utils.InventoryCollectionSerializer(); + //private AssetInventoryServer m_server; + //private Utils.InventoryItemSerializer itemSerializer = new Utils.InventoryItemSerializer(); + //private Utils.InventoryFolderSerializer folderSerializer = new Utils.InventoryFolderSerializer(); + //private Utils.InventoryCollectionSerializer collectionSerializer = new Utils.InventoryCollectionSerializer(); public OpenSimInventoryFrontendPlugin() { @@ -57,18 +54,18 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim public void Initialise(AssetInventoryServer server) { - this.server = server; - - //server.HttpServer.AddHandler("post", null, @"^/GetInventory/", GetInventoryHandler); - //server.HttpServer.AddHandler("post", null, @"^/CreateInventory/", CreateInventoryHandler); - //server.HttpServer.AddHandler("post", null, @"^/NewFolder/", NewFolderHandler); - //server.HttpServer.AddHandler("post", null, @"^/UpdateFolder/", UpdateFolderHandler); - //server.HttpServer.AddHandler("post", null, @"^/MoveFolder/", MoveFolderHandler); - //server.HttpServer.AddHandler("post", null, @"^/PurgeFolder/", PurgeFolderHandler); - //server.HttpServer.AddHandler("post", null, @"^/NewItem/", NewItemHandler); - //server.HttpServer.AddHandler("post", null, @"^/DeleteItem/", DeleteItemHandler); - //server.HttpServer.AddHandler("post", null, @"^/RootFolders/", RootFoldersHandler); - //server.HttpServer.AddHandler("post", null, @"^/ActiveGestures/", ActiveGesturesHandler); + //m_server = server; + + //m_server.HttpServer.AddHandler("post", null, @"^/GetInventory/", GetInventoryHandler); + //m_server.HttpServer.AddHandler("post", null, @"^/CreateInventory/", CreateInventoryHandler); + //m_server.HttpServer.AddHandler("post", null, @"^/NewFolder/", NewFolderHandler); + //m_server.HttpServer.AddHandler("post", null, @"^/UpdateFolder/", UpdateFolderHandler); + //m_server.HttpServer.AddHandler("post", null, @"^/MoveFolder/", MoveFolderHandler); + //m_server.HttpServer.AddHandler("post", null, @"^/PurgeFolder/", PurgeFolderHandler); + //m_server.HttpServer.AddHandler("post", null, @"^/NewItem/", NewItemHandler); + //m_server.HttpServer.AddHandler("post", null, @"^/DeleteItem/", DeleteItemHandler); + //m_server.HttpServer.AddHandler("post", null, @"^/RootFolders/", RootFoldersHandler); + //m_server.HttpServer.AddHandler("post", null, @"^/ActiveGestures/", ActiveGesturesHandler); m_log.Info("[INVENTORY] OpenSim Inventory Frontend loaded."); } @@ -110,7 +107,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim // Uri owner = Utils.GetOpenSimUri(ownerID); // InventoryCollection inventory; - // BackendResponse storageResponse = server.InventoryProvider.TryFetchInventory(owner, out inventory); + // BackendResponse storageResponse = m_server.InventoryProvider.TryFetchInventory(owner, out inventory); // if (storageResponse == BackendResponse.Success) // { @@ -150,7 +147,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim // m_log.DebugFormat("Created URI {0} for inventory creation", owner); // InventoryFolder rootFolder = new InventoryFolder("My Inventory", ownerID, UUID.Zero, (short)AssetType.Folder); - // BackendResponse storageResponse = server.InventoryProvider.TryCreateInventory(owner, rootFolder); + // BackendResponse storageResponse = m_server.InventoryProvider.TryCreateInventory(owner, rootFolder); // if (storageResponse == BackendResponse.Success) // { // CreateFolder("Animations", ownerID, rootFolder.ID, AssetType.Animation); @@ -192,11 +189,11 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim // if (String.IsNullOrEmpty(folder.Name)) // { // InventoryFolder oldFolder; - // if (server.InventoryProvider.TryFetchFolder(owner, folder.ID, out oldFolder) == BackendResponse.Success) + // if (m_server.InventoryProvider.TryFetchFolder(owner, folder.ID, out oldFolder) == BackendResponse.Success) // folder.Name = oldFolder.Name; // } - // BackendResponse storageResponse = server.InventoryProvider.TryCreateFolder(owner, folder); + // BackendResponse storageResponse = m_server.InventoryProvider.TryCreateFolder(owner, folder); // if (storageResponse == BackendResponse.Success) // { @@ -227,7 +224,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim // if (folder != null) // { // Uri owner = Utils.GetOpenSimUri(folder.Owner); - // BackendResponse storageResponse = server.InventoryProvider.TryPurgeFolder(owner, folder.ID); + // BackendResponse storageResponse = m_server.InventoryProvider.TryPurgeFolder(owner, folder.ID); // if (storageResponse == BackendResponse.Success) // { @@ -248,7 +245,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim // if (item != null) // { // Uri owner = Utils.GetOpenSimUri(agentID); - // BackendResponse storageResponse = server.InventoryProvider.TryCreateItem(owner, item); + // BackendResponse storageResponse = m_server.InventoryProvider.TryCreateItem(owner, item); // if (storageResponse == BackendResponse.Success) // { @@ -269,7 +266,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim // if (item != null) // { // Uri owner = Utils.GetOpenSimUri(item.Owner); - // BackendResponse storageResponse = server.InventoryProvider.TryDeleteItem(owner, item.ID); + // BackendResponse storageResponse = m_server.InventoryProvider.TryDeleteItem(owner, item.ID); // if (storageResponse == BackendResponse.Success) // { @@ -290,7 +287,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim // { // Uri owner = Utils.GetOpenSimUri(ownerID); // List skeleton; - // BackendResponse storageResponse = server.InventoryProvider.TryFetchFolderList(owner, out skeleton); + // BackendResponse storageResponse = m_server.InventoryProvider.TryFetchFolderList(owner, out skeleton); // if (storageResponse == BackendResponse.Success) // { @@ -323,7 +320,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim // { // Uri owner = Utils.GetOpenSimUri(ownerID); // List gestures; - // BackendResponse storageResponse = server.InventoryProvider.TryFetchActiveGestures(owner, out gestures); + // BackendResponse storageResponse = m_server.InventoryProvider.TryFetchActiveGestures(owner, out gestures); // if (storageResponse == BackendResponse.Success) // { @@ -347,255 +344,255 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim // return true; //} - BackendResponse CreateFolder(string name, UUID ownerID, UUID parentID, AssetType assetType) - { - InventoryFolder folder = new InventoryFolder(name, ownerID, parentID, (short)assetType); - Uri owner = Utils.GetOpenSimUri(ownerID); - return server.InventoryProvider.TryCreateFolder(owner, folder); - } + //BackendResponse CreateFolder(string name, UUID ownerID, UUID parentID, AssetType assetType) + //{ + // InventoryFolder folder = new InventoryFolder(name, ownerID, parentID, (short)assetType); + // Uri owner = Utils.GetOpenSimUri(ownerID); + // return m_server.InventoryProvider.TryCreateFolder(owner, folder); + //} - UUID DeserializeUUID(Stream stream) - { - UUID id = UUID.Zero; - - try - { - using (XmlReader reader = XmlReader.Create(stream)) - { - reader.MoveToContent(); - UUID.TryParse(reader.ReadElementContentAsString("guid", String.Empty), out id); - } - } - catch (Exception ex) - { - m_log.Warn("Failed to parse POST data (expecting guid): " + ex.Message); - } - - return id; - } + //UUID DeserializeUUID(Stream stream) + //{ + // UUID id = UUID.Zero; - UUID DeserializeUUID(Stream stream, out UUID agentID, out UUID sessionID) - { - UUID id; - - try - { - using (XmlReader reader = XmlReader.Create(stream)) - { - reader.MoveToContent(); - reader.ReadStartElement("RestSessionObjectOfGuid"); - UUID.TryParse(reader.ReadElementContentAsString("SessionID", String.Empty), out sessionID); - UUID.TryParse(reader.ReadElementContentAsString("AvatarID", String.Empty), out agentID); - UUID.TryParse(reader.ReadElementContentAsString("Body", String.Empty), out id); - reader.ReadEndElement(); - } - } - catch (Exception ex) - { - m_log.Warn("Failed to parse GetInventory POST data: " + ex.Message); - agentID = UUID.Zero; - sessionID = UUID.Zero; - return UUID.Zero; - } - - return id; - } + // try + // { + // using (XmlReader reader = XmlReader.Create(stream)) + // { + // reader.MoveToContent(); + // UUID.TryParse(reader.ReadElementContentAsString("guid", String.Empty), out id); + // } + // } + // catch (Exception ex) + // { + // m_log.Warn("Failed to parse POST data (expecting guid): " + ex.Message); + // } - InventoryFolder DeserializeFolder(Stream stream, out UUID agentID, out UUID sessionID) - { - InventoryFolder folder = new InventoryFolder(); - - try - { - using (XmlReader reader = XmlReader.Create(stream)) - { - reader.MoveToContent(); - reader.ReadStartElement("RestSessionObjectOfInventoryFolderBase"); - UUID.TryParse(reader.ReadElementContentAsString("SessionID", String.Empty), out sessionID); - UUID.TryParse(reader.ReadElementContentAsString("AvatarID", String.Empty), out agentID); - reader.ReadStartElement("Body"); - if (reader.Name == "Name") - folder.Name = reader.ReadElementContentAsString("Name", String.Empty); - else - folder.Name = String.Empty; - ReadUUID(reader, "Owner", out folder.Owner); - ReadUUID(reader, "ParentID", out folder.ParentID); - ReadUUID(reader, "ID", out folder.ID); - Int16.TryParse(reader.ReadElementContentAsString("Type", String.Empty), out folder.Type); - UInt16.TryParse(reader.ReadElementContentAsString("Version", String.Empty), out folder.Version); - reader.ReadEndElement(); - reader.ReadEndElement(); - } - } - catch (Exception ex) - { - m_log.Warn("Failed to parse POST data (expecting InventoryFolderBase): " + ex.Message); - agentID = UUID.Zero; - sessionID = UUID.Zero; - return null; - } - - return folder; - } + // return id; + //} - InventoryItem DeserializeItem(Stream stream, out UUID agentID, out UUID sessionID) - { - InventoryItem item = new InventoryItem(); - - try - { - using (XmlReader reader = XmlReader.Create(stream)) - { - reader.MoveToContent(); - reader.ReadStartElement("RestSessionObjectOfInventoryItemBase"); - UUID.TryParse(reader.ReadElementContentAsString("SessionID", String.Empty), out sessionID); - UUID.TryParse(reader.ReadElementContentAsString("AvatarID", String.Empty), out agentID); - reader.ReadStartElement("Body"); - ReadUUID(reader, "ID", out item.ID); - Int32.TryParse(reader.ReadElementContentAsString("InvType", String.Empty), out item.InvType); - ReadUUID(reader, "Folder", out item.Folder); - ReadUUID(reader, "Owner", out item.Owner); - ReadUUID(reader, "Creator", out item.Creator); - item.Name = reader.ReadElementContentAsString("Name", String.Empty); - item.Description = reader.ReadElementContentAsString("Description", String.Empty); - UInt32.TryParse(reader.ReadElementContentAsString("NextPermissions", String.Empty), out item.NextPermissions); - UInt32.TryParse(reader.ReadElementContentAsString("CurrentPermissions", String.Empty), out item.CurrentPermissions); - UInt32.TryParse(reader.ReadElementContentAsString("BasePermissions", String.Empty), out item.BasePermissions); - UInt32.TryParse(reader.ReadElementContentAsString("EveryOnePermissions", String.Empty), out item.EveryOnePermissions); - UInt32.TryParse(reader.ReadElementContentAsString("GroupPermissions", String.Empty), out item.GroupPermissions); - Int32.TryParse(reader.ReadElementContentAsString("AssetType", String.Empty), out item.AssetType); - ReadUUID(reader, "AssetID", out item.AssetID); - ReadUUID(reader, "GroupID", out item.GroupID); - Boolean.TryParse(reader.ReadElementContentAsString("GroupOwned", String.Empty), out item.GroupOwned); - Int32.TryParse(reader.ReadElementContentAsString("SalePrice", String.Empty), out item.SalePrice); - Byte.TryParse(reader.ReadElementContentAsString("SaleType", String.Empty), out item.SaleType); - UInt32.TryParse(reader.ReadElementContentAsString("Flags", String.Empty), out item.Flags); - Int32.TryParse(reader.ReadElementContentAsString("CreationDate", String.Empty), out item.CreationDate); - reader.ReadEndElement(); - reader.ReadEndElement(); - } - } - catch (Exception ex) - { - m_log.Warn("Failed to parse POST data (expecting InventoryItemBase): " + ex.Message); - agentID = UUID.Zero; - sessionID = UUID.Zero; - return null; - } - - return item; - } + //UUID DeserializeUUID(Stream stream, out UUID agentID, out UUID sessionID) + //{ + // UUID id; - void SerializeBool(Stream stream, bool value) - { - using (XmlWriter writer = XmlWriter.Create(stream)) - { - writer.WriteStartDocument(); - writer.WriteStartElement("boolean"); - writer.WriteAttributeString("xmlns", "xsi", null, "http://www.w3.org/2001/XMLSchema-instance"); - writer.WriteAttributeString("xmlns", "xsd", null, "http://www.w3.org/2001/XMLSchema"); - writer.WriteString(value.ToString().ToLower()); - writer.WriteEndElement(); - writer.WriteEndDocument(); - writer.Flush(); - } - - stream.Flush(); - } + // try + // { + // using (XmlReader reader = XmlReader.Create(stream)) + // { + // reader.MoveToContent(); + // reader.ReadStartElement("RestSessionObjectOfGuid"); + // UUID.TryParse(reader.ReadElementContentAsString("SessionID", String.Empty), out sessionID); + // UUID.TryParse(reader.ReadElementContentAsString("AvatarID", String.Empty), out agentID); + // UUID.TryParse(reader.ReadElementContentAsString("Body", String.Empty), out id); + // reader.ReadEndElement(); + // } + // } + // catch (Exception ex) + // { + // m_log.Warn("Failed to parse GetInventory POST data: " + ex.Message); + // agentID = UUID.Zero; + // sessionID = UUID.Zero; + // return UUID.Zero; + // } - void SerializeFolderList(Stream stream, List folders) - { - using (XmlWriter writer = XmlWriter.Create(stream)) - { - writer.WriteStartDocument(); - writer.WriteStartElement("ArrayOfInventoryFolderBase"); - writer.WriteAttributeString("xmlns", "xsi", null, "http://www.w3.org/2001/XMLSchema-instance"); - writer.WriteAttributeString("xmlns", "xsd", null, "http://www.w3.org/2001/XMLSchema"); - - if (folders != null) - { - foreach (InventoryFolder folder in folders) - { - writer.WriteStartElement("InventoryFolderBase"); - writer.WriteElementString("Name", folder.Name); - WriteUUID(writer, "Owner", folder.Owner); - WriteUUID(writer, "ParentID", folder.ParentID); - WriteUUID(writer, "ID", folder.ID); - writer.WriteElementString("Type", XmlConvert.ToString(folder.Type)); - writer.WriteElementString("Version", XmlConvert.ToString(folder.Version)); - writer.WriteEndElement(); - } - } - - writer.WriteEndElement(); - writer.WriteEndDocument(); - - writer.Flush(); - } - - stream.Flush(); - } + // return id; + //} - void SerializeItemList(Stream stream, List items) - { - using (XmlWriter writer = XmlWriter.Create(stream)) - { - writer.WriteStartDocument(); - writer.WriteStartElement("ArrayOfInventoryItemBase"); - writer.WriteAttributeString("xmlns", "xsi", null, "http://www.w3.org/2001/XMLSchema-instance"); - writer.WriteAttributeString("xmlns", "xsd", null, "http://www.w3.org/2001/XMLSchema"); - - if (items != null) - { - foreach (InventoryItem item in items) - { - writer.WriteStartElement("InventoryItemBase"); - WriteUUID(writer, "ID", item.ID); - writer.WriteElementString("InvType", XmlConvert.ToString(item.InvType)); - WriteUUID(writer, "Folder", item.Folder); - WriteUUID(writer, "Owner", item.Owner); - WriteUUID(writer, "Creator", item.Creator); - writer.WriteElementString("Name", item.Name); - writer.WriteElementString("Description", item.Description); - writer.WriteElementString("NextPermissions", XmlConvert.ToString(item.NextPermissions)); - writer.WriteElementString("CurrentPermissions", XmlConvert.ToString(item.CurrentPermissions)); - writer.WriteElementString("BasePermissions", XmlConvert.ToString(item.BasePermissions)); - writer.WriteElementString("EveryOnePermissions", XmlConvert.ToString(item.EveryOnePermissions)); - writer.WriteElementString("GroupPermissions", XmlConvert.ToString(item.GroupPermissions)); - writer.WriteElementString("AssetType", XmlConvert.ToString(item.AssetType)); - WriteUUID(writer, "AssetID", item.AssetID); - WriteUUID(writer, "GroupID", item.GroupID); - writer.WriteElementString("GroupOwned", XmlConvert.ToString(item.GroupOwned)); - writer.WriteElementString("SalePrice", XmlConvert.ToString(item.SalePrice)); - writer.WriteElementString("SaleType", XmlConvert.ToString(item.SaleType)); - writer.WriteElementString("Flags", XmlConvert.ToString(item.Flags)); - writer.WriteElementString("CreationDate", XmlConvert.ToString(item.CreationDate)); - writer.WriteEndElement(); - } - } - - writer.WriteEndElement(); - writer.WriteEndDocument(); - - writer.Flush(); - } - - stream.Flush(); - } + //InventoryFolder DeserializeFolder(Stream stream, out UUID agentID, out UUID sessionID) + //{ + // InventoryFolder folder = new InventoryFolder(); - void WriteUUID(XmlWriter writer, string name, UUID id) - { - writer.WriteStartElement(name); - writer.WriteElementString("Guid", XmlConvert.ToString(id.Guid)); - writer.WriteEndElement(); - } + // try + // { + // using (XmlReader reader = XmlReader.Create(stream)) + // { + // reader.MoveToContent(); + // reader.ReadStartElement("RestSessionObjectOfInventoryFolderBase"); + // UUID.TryParse(reader.ReadElementContentAsString("SessionID", String.Empty), out sessionID); + // UUID.TryParse(reader.ReadElementContentAsString("AvatarID", String.Empty), out agentID); + // reader.ReadStartElement("Body"); + // if (reader.Name == "Name") + // folder.Name = reader.ReadElementContentAsString("Name", String.Empty); + // else + // folder.Name = String.Empty; + // ReadUUID(reader, "Owner", out folder.Owner); + // ReadUUID(reader, "ParentID", out folder.ParentID); + // ReadUUID(reader, "ID", out folder.ID); + // Int16.TryParse(reader.ReadElementContentAsString("Type", String.Empty), out folder.Type); + // UInt16.TryParse(reader.ReadElementContentAsString("Version", String.Empty), out folder.Version); + // reader.ReadEndElement(); + // reader.ReadEndElement(); + // } + // } + // catch (Exception ex) + // { + // m_log.Warn("Failed to parse POST data (expecting InventoryFolderBase): " + ex.Message); + // agentID = UUID.Zero; + // sessionID = UUID.Zero; + // return null; + // } - void ReadUUID(XmlReader reader, string name, out UUID id) - { - reader.ReadStartElement(name); - UUID.TryParse(reader.ReadElementContentAsString("Guid", String.Empty), out id); - reader.ReadEndElement(); - } + // return folder; + //} + + //InventoryItem DeserializeItem(Stream stream, out UUID agentID, out UUID sessionID) + //{ + // InventoryItem item = new InventoryItem(); + + // try + // { + // using (XmlReader reader = XmlReader.Create(stream)) + // { + // reader.MoveToContent(); + // reader.ReadStartElement("RestSessionObjectOfInventoryItemBase"); + // UUID.TryParse(reader.ReadElementContentAsString("SessionID", String.Empty), out sessionID); + // UUID.TryParse(reader.ReadElementContentAsString("AvatarID", String.Empty), out agentID); + // reader.ReadStartElement("Body"); + // ReadUUID(reader, "ID", out item.ID); + // Int32.TryParse(reader.ReadElementContentAsString("InvType", String.Empty), out item.InvType); + // ReadUUID(reader, "Folder", out item.Folder); + // ReadUUID(reader, "Owner", out item.Owner); + // ReadUUID(reader, "Creator", out item.Creator); + // item.Name = reader.ReadElementContentAsString("Name", String.Empty); + // item.Description = reader.ReadElementContentAsString("Description", String.Empty); + // UInt32.TryParse(reader.ReadElementContentAsString("NextPermissions", String.Empty), out item.NextPermissions); + // UInt32.TryParse(reader.ReadElementContentAsString("CurrentPermissions", String.Empty), out item.CurrentPermissions); + // UInt32.TryParse(reader.ReadElementContentAsString("BasePermissions", String.Empty), out item.BasePermissions); + // UInt32.TryParse(reader.ReadElementContentAsString("EveryOnePermissions", String.Empty), out item.EveryOnePermissions); + // UInt32.TryParse(reader.ReadElementContentAsString("GroupPermissions", String.Empty), out item.GroupPermissions); + // Int32.TryParse(reader.ReadElementContentAsString("AssetType", String.Empty), out item.AssetType); + // ReadUUID(reader, "AssetID", out item.AssetID); + // ReadUUID(reader, "GroupID", out item.GroupID); + // Boolean.TryParse(reader.ReadElementContentAsString("GroupOwned", String.Empty), out item.GroupOwned); + // Int32.TryParse(reader.ReadElementContentAsString("SalePrice", String.Empty), out item.SalePrice); + // Byte.TryParse(reader.ReadElementContentAsString("SaleType", String.Empty), out item.SaleType); + // UInt32.TryParse(reader.ReadElementContentAsString("Flags", String.Empty), out item.Flags); + // Int32.TryParse(reader.ReadElementContentAsString("CreationDate", String.Empty), out item.CreationDate); + // reader.ReadEndElement(); + // reader.ReadEndElement(); + // } + // } + // catch (Exception ex) + // { + // m_log.Warn("Failed to parse POST data (expecting InventoryItemBase): " + ex.Message); + // agentID = UUID.Zero; + // sessionID = UUID.Zero; + // return null; + // } + + // return item; + //} + + //void SerializeBool(Stream stream, bool value) + //{ + // using (XmlWriter writer = XmlWriter.Create(stream)) + // { + // writer.WriteStartDocument(); + // writer.WriteStartElement("boolean"); + // writer.WriteAttributeString("xmlns", "xsi", null, "http://www.w3.org/2001/XMLSchema-instance"); + // writer.WriteAttributeString("xmlns", "xsd", null, "http://www.w3.org/2001/XMLSchema"); + // writer.WriteString(value.ToString().ToLower()); + // writer.WriteEndElement(); + // writer.WriteEndDocument(); + // writer.Flush(); + // } + + // stream.Flush(); + //} + + //void SerializeFolderList(Stream stream, List folders) + //{ + // using (XmlWriter writer = XmlWriter.Create(stream)) + // { + // writer.WriteStartDocument(); + // writer.WriteStartElement("ArrayOfInventoryFolderBase"); + // writer.WriteAttributeString("xmlns", "xsi", null, "http://www.w3.org/2001/XMLSchema-instance"); + // writer.WriteAttributeString("xmlns", "xsd", null, "http://www.w3.org/2001/XMLSchema"); + + // if (folders != null) + // { + // foreach (InventoryFolder folder in folders) + // { + // writer.WriteStartElement("InventoryFolderBase"); + // writer.WriteElementString("Name", folder.Name); + // WriteUUID(writer, "Owner", folder.Owner); + // WriteUUID(writer, "ParentID", folder.ParentID); + // WriteUUID(writer, "ID", folder.ID); + // writer.WriteElementString("Type", XmlConvert.ToString(folder.Type)); + // writer.WriteElementString("Version", XmlConvert.ToString(folder.Version)); + // writer.WriteEndElement(); + // } + // } + + // writer.WriteEndElement(); + // writer.WriteEndDocument(); + + // writer.Flush(); + // } + + // stream.Flush(); + //} + + //void SerializeItemList(Stream stream, List items) + //{ + // using (XmlWriter writer = XmlWriter.Create(stream)) + // { + // writer.WriteStartDocument(); + // writer.WriteStartElement("ArrayOfInventoryItemBase"); + // writer.WriteAttributeString("xmlns", "xsi", null, "http://www.w3.org/2001/XMLSchema-instance"); + // writer.WriteAttributeString("xmlns", "xsd", null, "http://www.w3.org/2001/XMLSchema"); + + // if (items != null) + // { + // foreach (InventoryItem item in items) + // { + // writer.WriteStartElement("InventoryItemBase"); + // WriteUUID(writer, "ID", item.ID); + // writer.WriteElementString("InvType", XmlConvert.ToString(item.InvType)); + // WriteUUID(writer, "Folder", item.Folder); + // WriteUUID(writer, "Owner", item.Owner); + // WriteUUID(writer, "Creator", item.Creator); + // writer.WriteElementString("Name", item.Name); + // writer.WriteElementString("Description", item.Description); + // writer.WriteElementString("NextPermissions", XmlConvert.ToString(item.NextPermissions)); + // writer.WriteElementString("CurrentPermissions", XmlConvert.ToString(item.CurrentPermissions)); + // writer.WriteElementString("BasePermissions", XmlConvert.ToString(item.BasePermissions)); + // writer.WriteElementString("EveryOnePermissions", XmlConvert.ToString(item.EveryOnePermissions)); + // writer.WriteElementString("GroupPermissions", XmlConvert.ToString(item.GroupPermissions)); + // writer.WriteElementString("AssetType", XmlConvert.ToString(item.AssetType)); + // WriteUUID(writer, "AssetID", item.AssetID); + // WriteUUID(writer, "GroupID", item.GroupID); + // writer.WriteElementString("GroupOwned", XmlConvert.ToString(item.GroupOwned)); + // writer.WriteElementString("SalePrice", XmlConvert.ToString(item.SalePrice)); + // writer.WriteElementString("SaleType", XmlConvert.ToString(item.SaleType)); + // writer.WriteElementString("Flags", XmlConvert.ToString(item.Flags)); + // writer.WriteElementString("CreationDate", XmlConvert.ToString(item.CreationDate)); + // writer.WriteEndElement(); + // } + // } + + // writer.WriteEndElement(); + // writer.WriteEndDocument(); + + // writer.Flush(); + // } + + // stream.Flush(); + //} + + //void WriteUUID(XmlWriter writer, string name, UUID id) + //{ + // writer.WriteStartElement(name); + // writer.WriteElementString("Guid", XmlConvert.ToString(id.Guid)); + // writer.WriteEndElement(); + //} + + //void ReadUUID(XmlReader reader, string name, out UUID id) + //{ + // reader.ReadStartElement(name); + // UUID.TryParse(reader.ReadElementContentAsString("Guid", String.Empty), out id); + // reader.ReadEndElement(); + //} } #region OpenSim AssetType diff --git a/OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/OpenSimInventoryStoragePlugin.cs b/OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/OpenSimInventoryStoragePlugin.cs index f5a1f78..86cf1de 100644 --- a/OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/OpenSimInventoryStoragePlugin.cs +++ b/OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/OpenSimInventoryStoragePlugin.cs @@ -30,11 +30,9 @@ using System; using System.Reflection; using System.Collections.Generic; -using System.Net; using System.Data; using MySql.Data.MySqlClient; using OpenMetaverse; -using OpenMetaverse.StructuredData; using OpenSim.Framework; using OpenSim.Data; using Nini.Config; diff --git a/OpenSim/Grid/AssetInventoryServer/Plugins/ReferenceFrontendPlugin.cs b/OpenSim/Grid/AssetInventoryServer/Plugins/ReferenceFrontendPlugin.cs index f22dc67..7ff5dfa 100644 --- a/OpenSim/Grid/AssetInventoryServer/Plugins/ReferenceFrontendPlugin.cs +++ b/OpenSim/Grid/AssetInventoryServer/Plugins/ReferenceFrontendPlugin.cs @@ -30,12 +30,9 @@ using System; using System.IO; using System.Reflection; -using System.Collections.Generic; using System.Net; -using System.Xml; using OpenMetaverse; using OpenMetaverse.StructuredData; -using HttpServer; using OpenSim.Framework; using OpenSim.Framework.Servers; using log4net; diff --git a/OpenSim/Grid/AssetInventoryServer/Plugins/Simple/SimpleAssetStoragePlugin.cs b/OpenSim/Grid/AssetInventoryServer/Plugins/Simple/SimpleAssetStoragePlugin.cs index d66fc69..cd0a454 100644 --- a/OpenSim/Grid/AssetInventoryServer/Plugins/Simple/SimpleAssetStoragePlugin.cs +++ b/OpenSim/Grid/AssetInventoryServer/Plugins/Simple/SimpleAssetStoragePlugin.cs @@ -30,10 +30,8 @@ using System; using System.Reflection; using System.Collections.Generic; -using System.Net; using System.IO; using OpenMetaverse; -using OpenMetaverse.StructuredData; using OpenSim.Framework; using log4net; diff --git a/OpenSim/Grid/AssetInventoryServer/Plugins/Simple/SimpleInventoryStoragePlugin.cs b/OpenSim/Grid/AssetInventoryServer/Plugins/Simple/SimpleInventoryStoragePlugin.cs index 8be6f8c..e317ae3 100644 --- a/OpenSim/Grid/AssetInventoryServer/Plugins/Simple/SimpleInventoryStoragePlugin.cs +++ b/OpenSim/Grid/AssetInventoryServer/Plugins/Simple/SimpleInventoryStoragePlugin.cs @@ -30,11 +30,9 @@ using System; using System.Reflection; using System.Collections.Generic; -using System.Net; using System.IO; using System.Text; using OpenMetaverse; -using OpenMetaverse.StructuredData; using OpenSim.Framework; using log4net; diff --git a/OpenSim/Grid/AssetInventoryServer/Utils.cs b/OpenSim/Grid/AssetInventoryServer/Utils.cs index 52e2370..01ca5a6 100644 --- a/OpenSim/Grid/AssetInventoryServer/Utils.cs +++ b/OpenSim/Grid/AssetInventoryServer/Utils.cs @@ -28,14 +28,10 @@ */ using System; -using System.Collections.Specialized; using System.Globalization; -using System.Net; using System.Xml; using System.Xml.Serialization; using OpenMetaverse; -using OpenMetaverse.StructuredData; -using HttpServer; using OpenSim.Framework.Servers; namespace OpenSim.Grid.AssetInventoryServer @@ -791,11 +787,11 @@ namespace OpenSim.Grid.AssetInventoryServer public class GeneratedWriter : XmlSerializationWriter { const string xmlNamespace = "http://www.w3.org/2000/xmlns/"; - static readonly System.Reflection.MethodInfo toBinHexStringMethod = typeof(XmlConvert).GetMethod("ToBinHexString", System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.NonPublic, null, new Type[] { typeof(byte[]) }, null); - static string ToBinHexString(byte[] input) - { - return input == null ? null : (string)toBinHexStringMethod.Invoke(null, new object[] { input }); - } + //static readonly System.Reflection.MethodInfo toBinHexStringMethod = typeof(XmlConvert).GetMethod("ToBinHexString", System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.NonPublic, null, new Type[] { typeof(byte[]) }, null); + //static string ToBinHexString(byte[] input) + //{ + // return input == null ? null : (string)toBinHexStringMethod.Invoke(null, new object[] { input }); + //} public void WriteRoot_InventoryFolder(object o) { WriteStartDocument(); -- cgit v1.1