From c5ea783526611a968400a1936e4c6764ee1c7013 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Mon, 11 Jan 2010 07:51:33 -0800 Subject: OpenSim/Framework/Communications/Cache deleted. LibraryRootFolder deleted. --- .../Communications/Cache/LibraryRootFolder.cs | 257 --------------------- .../Framework/Communications/Osp/OspResolver.cs | 1 - 2 files changed, 258 deletions(-) delete mode 100644 OpenSim/Framework/Communications/Cache/LibraryRootFolder.cs (limited to 'OpenSim/Framework/Communications') diff --git a/OpenSim/Framework/Communications/Cache/LibraryRootFolder.cs b/OpenSim/Framework/Communications/Cache/LibraryRootFolder.cs deleted file mode 100644 index 74ba0a5..0000000 --- a/OpenSim/Framework/Communications/Cache/LibraryRootFolder.cs +++ /dev/null @@ -1,257 +0,0 @@ -/* - * 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 OpenSimulator 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; -using System.Collections.Generic; -using System.IO; -using System.Reflection; -using System.Xml; -using log4net; -using Nini.Config; -using OpenMetaverse; - -namespace OpenSim.Framework.Communications.Cache -{ - /// - /// Basically a hack to give us a Inventory library while we don't have a inventory server - /// once the server is fully implemented then should read the data from that - /// - public class LibraryRootFolder : InventoryFolderImpl - { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - - private UUID libOwner = new UUID("11111111-1111-0000-0000-000100bba000"); - - /// - /// Holds the root library folder and all its descendents. This is really only used during inventory - /// setup so that we don't have to repeatedly search the tree of library folders. - /// - protected Dictionary libraryFolders - = new Dictionary(); - - public LibraryRootFolder(string pLibrariesLocation) - { - Owner = libOwner; - ID = new UUID("00000112-000f-0000-0000-000100bba000"); - Name = "OpenSim Library"; - ParentID = UUID.Zero; - Type = (short) 8; - Version = (ushort) 1; - - libraryFolders.Add(ID, this); - - LoadLibraries(pLibrariesLocation); - } - - public InventoryItemBase CreateItem(UUID inventoryID, UUID assetID, string name, string description, - int assetType, int invType, UUID parentFolderID) - { - InventoryItemBase item = new InventoryItemBase(); - item.Owner = libOwner; - item.CreatorId = libOwner.ToString(); - item.ID = inventoryID; - item.AssetID = assetID; - item.Description = description; - item.Name = name; - item.AssetType = assetType; - item.InvType = invType; - item.Folder = parentFolderID; - item.BasePermissions = 0x7FFFFFFF; - item.EveryOnePermissions = 0x7FFFFFFF; - item.CurrentPermissions = 0x7FFFFFFF; - item.NextPermissions = 0x7FFFFFFF; - return item; - } - - /// - /// Use the asset set information at path to load assets - /// - /// - /// - protected void LoadLibraries(string librariesControlPath) - { - m_log.InfoFormat("[LIBRARY INVENTORY]: Loading library control file {0}", librariesControlPath); - LoadFromFile(librariesControlPath, "Libraries control", ReadLibraryFromConfig); - } - - /// - /// Read a library set from config - /// - /// - protected void ReadLibraryFromConfig(IConfig config, string path) - { - string basePath = Path.GetDirectoryName(path); - string foldersPath - = Path.Combine( - basePath, config.GetString("foldersFile", String.Empty)); - - LoadFromFile(foldersPath, "Library folders", ReadFolderFromConfig); - - string itemsPath - = Path.Combine( - basePath, config.GetString("itemsFile", String.Empty)); - - LoadFromFile(itemsPath, "Library items", ReadItemFromConfig); - } - - /// - /// Read a library inventory folder from a loaded configuration - /// - /// - private void ReadFolderFromConfig(IConfig config, string path) - { - InventoryFolderImpl folderInfo = new InventoryFolderImpl(); - - folderInfo.ID = new UUID(config.GetString("folderID", ID.ToString())); - folderInfo.Name = config.GetString("name", "unknown"); - folderInfo.ParentID = new UUID(config.GetString("parentFolderID", ID.ToString())); - folderInfo.Type = (short)config.GetInt("type", 8); - - folderInfo.Owner = libOwner; - folderInfo.Version = 1; - - if (libraryFolders.ContainsKey(folderInfo.ParentID)) - { - InventoryFolderImpl parentFolder = libraryFolders[folderInfo.ParentID]; - - libraryFolders.Add(folderInfo.ID, folderInfo); - parentFolder.AddChildFolder(folderInfo); - -// m_log.InfoFormat("[LIBRARY INVENTORY]: Adding folder {0} ({1})", folderInfo.name, folderInfo.folderID); - } - else - { - m_log.WarnFormat( - "[LIBRARY INVENTORY]: Couldn't add folder {0} ({1}) since parent folder with ID {2} does not exist!", - folderInfo.Name, folderInfo.ID, folderInfo.ParentID); - } - } - - /// - /// Read a library inventory item metadata from a loaded configuration - /// - /// - private void ReadItemFromConfig(IConfig config, string path) - { - InventoryItemBase item = new InventoryItemBase(); - item.Owner = libOwner; - item.CreatorId = libOwner.ToString(); - item.ID = new UUID(config.GetString("inventoryID", ID.ToString())); - item.AssetID = new UUID(config.GetString("assetID", item.ID.ToString())); - item.Folder = new UUID(config.GetString("folderID", ID.ToString())); - item.Name = config.GetString("name", String.Empty); - item.Description = config.GetString("description", item.Name); - item.InvType = config.GetInt("inventoryType", 0); - item.AssetType = config.GetInt("assetType", item.InvType); - item.CurrentPermissions = (uint)config.GetLong("currentPermissions", 0x7FFFFFFF); - item.NextPermissions = (uint)config.GetLong("nextPermissions", 0x7FFFFFFF); - item.EveryOnePermissions = (uint)config.GetLong("everyonePermissions", 0x7FFFFFFF); - item.BasePermissions = (uint)config.GetLong("basePermissions", 0x7FFFFFFF); - item.Flags = (uint)config.GetInt("flags", 0); - - if (libraryFolders.ContainsKey(item.Folder)) - { - InventoryFolderImpl parentFolder = libraryFolders[item.Folder]; - try - { - parentFolder.Items.Add(item.ID, item); - } - catch (Exception) - { - m_log.WarnFormat("[LIBRARY INVENTORY] Item {1} [{0}] not added, duplicate item", item.ID, item.Name); - } - } - else - { - m_log.WarnFormat( - "[LIBRARY INVENTORY]: Couldn't add item {0} ({1}) since parent folder with ID {2} does not exist!", - item.Name, item.ID, item.Folder); - } - } - - private delegate void ConfigAction(IConfig config, string path); - - /// - /// Load the given configuration at a path and perform an action on each Config contained within it - /// - /// - /// - /// - private static void LoadFromFile(string path, string fileDescription, ConfigAction action) - { - if (File.Exists(path)) - { - try - { - XmlConfigSource source = new XmlConfigSource(path); - - for (int i = 0; i < source.Configs.Count; i++) - { - action(source.Configs[i], path); - } - } - catch (XmlException e) - { - m_log.ErrorFormat("[LIBRARY INVENTORY]: Error loading {0} : {1}", path, e); - } - } - else - { - m_log.ErrorFormat("[LIBRARY INVENTORY]: {0} file {1} does not exist!", fileDescription, path); - } - } - - /// - /// Looks like a simple getter, but is written like this for some consistency with the other Request - /// methods in the superclass - /// - /// - public Dictionary RequestSelfAndDescendentFolders() - { - Dictionary fs = new Dictionary(); - fs.Add(ID, this); - List fis = TraverseFolder(this); - foreach (InventoryFolderImpl f in fis) - { - fs.Add(f.ID, f); - } - //return libraryFolders; - return fs; - } - - private List TraverseFolder(InventoryFolderImpl node) - { - List folders = node.RequestListOfFolderImpls(); - List subs = new List(); - foreach (InventoryFolderImpl f in folders) - subs.AddRange(TraverseFolder(f)); - - folders.AddRange(subs); - return folders; - } - } -} diff --git a/OpenSim/Framework/Communications/Osp/OspResolver.cs b/OpenSim/Framework/Communications/Osp/OspResolver.cs index 14f813a..2e55f53 100644 --- a/OpenSim/Framework/Communications/Osp/OspResolver.cs +++ b/OpenSim/Framework/Communications/Osp/OspResolver.cs @@ -30,7 +30,6 @@ using System.Text; using log4net; using OpenMetaverse; using OpenSim.Framework; -using OpenSim.Framework.Communications.Cache; using OpenSim.Services.Interfaces; namespace OpenSim.Framework.Communications.Osp -- cgit v1.1