IInventoryData.cs 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  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. using System.Collections.Generic;
  28. using OpenMetaverse;
  29. namespace OpenSim.Framework
  30. {
  31. /// <summary>
  32. /// An interface for accessing inventory data from a storage server
  33. /// </summary>
  34. public interface IInventoryDataPlugin : IPlugin
  35. {
  36. /// <summary>
  37. /// Initialises the interface
  38. /// </summary>
  39. void Initialise(string connect);
  40. /// <summary>
  41. /// Returns all descendent folders of this folder. Does not return the parent folder itself.
  42. /// </summary>
  43. /// <param name="parentID">The folder to get subfolders for</param>
  44. /// <returns>A list of inventory folders</returns>
  45. List<InventoryFolderBase> getFolderHierarchy(UUID parentID);
  46. /// <summary>
  47. /// Returns a list of inventory items contained within the specified folder
  48. /// </summary>
  49. /// <param name="folderID">The UUID of the target folder</param>
  50. /// <returns>A List of InventoryItemBase items</returns>
  51. List<InventoryItemBase> getInventoryInFolder(UUID folderID);
  52. /// <summary>
  53. /// Returns a list of the root folders within a users inventory
  54. /// </summary>
  55. /// <param name="user">The user whos inventory is to be searched</param>
  56. /// <returns>A list of folder objects</returns>
  57. List<InventoryFolderBase> getUserRootFolders(UUID user);
  58. /// <summary>
  59. /// Returns the users inventory root folder.
  60. /// </summary>
  61. /// <param name="user">The UUID of the user who is having inventory being returned</param>
  62. /// <returns>Root inventory folder, null if no root inventory folder was found</returns>
  63. InventoryFolderBase getUserRootFolder(UUID user);
  64. /// <summary>
  65. /// Returns a list of inventory folders contained in the folder 'parentID'
  66. /// </summary>
  67. /// <param name="parentID">The folder to get subfolders for</param>
  68. /// <returns>A list of inventory folders</returns>
  69. List<InventoryFolderBase> getInventoryFolders(UUID parentID);
  70. /// <summary>
  71. /// Returns an inventory item by its UUID
  72. /// </summary>
  73. /// <param name="item">The UUID of the item to be returned</param>
  74. /// <returns>A class containing item information</returns>
  75. InventoryItemBase getInventoryItem(UUID item);
  76. /// <summary>
  77. /// Returns a specified inventory folder by its UUID
  78. /// </summary>
  79. /// <param name="folder">The UUID of the folder to be returned</param>
  80. /// <returns>A class containing folder information</returns>
  81. InventoryFolderBase getInventoryFolder(UUID folder);
  82. /// <summary>
  83. /// Creates a new inventory item based on item
  84. /// </summary>
  85. /// <param name="item">The item to be created</param>
  86. void addInventoryItem(InventoryItemBase item);
  87. /// <summary>
  88. /// Updates an inventory item with item (updates based on ID)
  89. /// </summary>
  90. /// <param name="item">The updated item</param>
  91. void updateInventoryItem(InventoryItemBase item);
  92. /// <summary>
  93. ///
  94. /// </summary>
  95. /// <param name="item"></param>
  96. void deleteInventoryItem(UUID item);
  97. /// <summary>
  98. /// Adds a new folder specified by folder
  99. /// </summary>
  100. /// <param name="folder">The inventory folder</param>
  101. void addInventoryFolder(InventoryFolderBase folder);
  102. /// <summary>
  103. /// Updates a folder based on its ID with folder
  104. /// </summary>
  105. /// <param name="folder">The inventory folder</param>
  106. void updateInventoryFolder(InventoryFolderBase folder);
  107. /// <summary>
  108. /// Updates a folder based on its ID with folder
  109. /// </summary>
  110. /// <param name="folder">The inventory folder</param>
  111. void moveInventoryFolder(InventoryFolderBase folder);
  112. /// <summary>
  113. /// Deletes a folder. Thie will delete both the folder itself and its contents (items and descendent folders)
  114. /// </summary>
  115. /// <param name="folder">The id of the folder</param>
  116. void deleteInventoryFolder(UUID folder);
  117. /// <summary>
  118. /// Returns all activated gesture-items in the inventory of the specified avatar.
  119. /// </summary>
  120. /// <param name="avatarID">
  121. /// The <see cref="UUID"/> of the avatar
  122. /// </param>
  123. /// <returns>
  124. /// The list of gestures (<see cref="InventoryItemBase"/>s)
  125. /// </returns>
  126. List<InventoryItemBase> fetchActiveGestures(UUID avatarID);
  127. }
  128. public class InventoryDataInitialiser : PluginInitialiserBase
  129. {
  130. private string connect;
  131. public InventoryDataInitialiser (string s) { connect = s; }
  132. public override void Initialise (IPlugin plugin)
  133. {
  134. IInventoryDataPlugin p = plugin as IInventoryDataPlugin;
  135. p.Initialise (connect);
  136. }
  137. }
  138. }