IInventoryData.cs 6.8 KB

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