IInventoryData.cs 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  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 child folders in the hierarchy from the parent folder and down.
  42. /// 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. /// Adds a new folder specified by folder
  100. /// </summary>
  101. /// <param name="folder">The inventory folder</param>
  102. void addInventoryFolder(InventoryFolderBase folder);
  103. /// <summary>
  104. /// Updates a folder based on its ID with folder
  105. /// </summary>
  106. /// <param name="folder">The inventory folder</param>
  107. void updateInventoryFolder(InventoryFolderBase folder);
  108. /// <summary>
  109. /// Updates a folder based on its ID with folder
  110. /// </summary>
  111. /// <param name="folder">The inventory folder</param>
  112. void moveInventoryFolder(InventoryFolderBase folder);
  113. /// <summary>
  114. /// Deletes a folder. Thie will delete both the folder itself and its contents (items and descendent folders)
  115. /// </summary>
  116. /// <param name="folder">The id of the folder</param>
  117. void deleteInventoryFolder(UUID folder);
  118. /// <summary>
  119. /// Returns all activated gesture-items in the inventory of the specified avatar.
  120. /// </summary>
  121. /// <param name="avatarID">
  122. /// The <see cref="UUID"/> of the avatar
  123. /// </param>
  124. /// <returns>
  125. /// The list of gestures (<see cref="InventoryItemBase"/>s)
  126. /// </returns>
  127. List<InventoryItemBase> fetchActiveGestures(UUID avatarID);
  128. }
  129. public class InventoryDataInitialiser : PluginInitialiserBase
  130. {
  131. private string connect;
  132. public InventoryDataInitialiser (string s) { connect = s; }
  133. public override void Initialise (IPlugin plugin)
  134. {
  135. IInventoryDataPlugin p = plugin as IInventoryDataPlugin;
  136. p.Initialise (connect);
  137. }
  138. }
  139. }