InventoryData.cs 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. /*
  2. * Copyright (c) Contributors, http://www.openmetaverse.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. */
  28. using System.Collections.Generic;
  29. using libsecondlife;
  30. namespace OpenSim.Framework.Data
  31. {
  32. /// <summary>
  33. /// Inventory Item - contains all the properties associated with an individual inventory piece.
  34. /// </summary>
  35. public class InventoryItemBase
  36. {
  37. /// <summary>
  38. /// A UUID containing the ID for the inventory item itself
  39. /// </summary>
  40. public LLUUID inventoryID;
  41. /// <summary>
  42. /// The UUID of the associated asset on the asset server
  43. /// </summary>
  44. public LLUUID assetID;
  45. /// <summary>
  46. /// This is an enumerated value determining the type of asset (eg Notecard, Sound, Object, etc)
  47. /// </summary>
  48. public int type;
  49. /// <summary>
  50. /// The folder this item is contained in
  51. /// </summary>
  52. public LLUUID parentFolderID;
  53. /// <summary>
  54. /// The owner of this inventory item
  55. /// </summary>
  56. public LLUUID avatarID;
  57. /// <summary>
  58. /// The creator of this item
  59. /// </summary>
  60. public LLUUID creatorsID;
  61. /// <summary>
  62. /// The name of the inventory item (must be less than 64 characters)
  63. /// </summary>
  64. public string inventoryName;
  65. /// <summary>
  66. /// The description of the inventory item (must be less than 64 characters)
  67. /// </summary>
  68. public string inventoryDescription;
  69. /// <summary>
  70. /// A mask containing the permissions for the next owner (cannot be enforced)
  71. /// </summary>
  72. public uint inventoryNextPermissions;
  73. /// <summary>
  74. /// A mask containing permissions for the current owner (cannot be enforced)
  75. /// </summary>
  76. public uint inventoryCurrentPermissions;
  77. }
  78. /// <summary>
  79. /// A Class for folders which contain users inventory
  80. /// </summary>
  81. public class InventoryFolderBase
  82. {
  83. /// <summary>
  84. /// The name of the folder (64 characters or less)
  85. /// </summary>
  86. public string name;
  87. /// <summary>
  88. /// The agent who's inventory this is contained by
  89. /// </summary>
  90. public LLUUID agentID;
  91. /// <summary>
  92. /// The folder this folder is contained in
  93. /// </summary>
  94. public LLUUID parentID;
  95. /// <summary>
  96. /// The UUID for this folder
  97. /// </summary>
  98. public LLUUID folderID;
  99. /// <summary>
  100. /// Tyep of Items normally stored in this folder
  101. /// </summary>
  102. public ushort type;
  103. /// <summary>
  104. ///
  105. /// </summary>
  106. public ushort version;
  107. }
  108. /// <summary>
  109. /// An interface for accessing inventory data from a storage server
  110. /// </summary>
  111. public interface IInventoryData
  112. {
  113. /// <summary>
  114. /// Initialises the interface
  115. /// </summary>
  116. void Initialise();
  117. /// <summary>
  118. /// Closes the interface
  119. /// </summary>
  120. void Close();
  121. /// <summary>
  122. /// The plugin being loaded
  123. /// </summary>
  124. /// <returns>A string containing the plugin name</returns>
  125. string getName();
  126. /// <summary>
  127. /// The plugins version
  128. /// </summary>
  129. /// <returns>A string containing the plugin version</returns>
  130. string getVersion();
  131. /// <summary>
  132. /// Returns a list of inventory items contained within the specified folder
  133. /// </summary>
  134. /// <param name="folderID">The UUID of the target folder</param>
  135. /// <returns>A List of InventoryItemBase items</returns>
  136. List<InventoryItemBase> getInventoryInFolder(LLUUID folderID);
  137. /// <summary>
  138. /// Returns a list of folders in the users inventory root.
  139. /// </summary>
  140. /// <param name="user">The UUID of the user who is having inventory being returned</param>
  141. /// <returns>A list of folders</returns>
  142. List<InventoryFolderBase> getUserRootFolders(LLUUID user);
  143. /// <summary>
  144. /// Returns a list of inventory folders contained in the folder 'parentID'
  145. /// </summary>
  146. /// <param name="parentID">The folder to get subfolders for</param>
  147. /// <returns>A list of inventory folders</returns>
  148. List<InventoryFolderBase> getInventoryFolders(LLUUID parentID);
  149. /// <summary>
  150. /// Returns an inventory item by its UUID
  151. /// </summary>
  152. /// <param name="item">The UUID of the item to be returned</param>
  153. /// <returns>A class containing item information</returns>
  154. InventoryItemBase getInventoryItem(LLUUID item);
  155. /// <summary>
  156. /// Returns a specified inventory folder by its UUID
  157. /// </summary>
  158. /// <param name="folder">The UUID of the folder to be returned</param>
  159. /// <returns>A class containing folder information</returns>
  160. InventoryFolderBase getInventoryFolder(LLUUID folder);
  161. /// <summary>
  162. /// Creates a new inventory item based on item
  163. /// </summary>
  164. /// <param name="item">The item to be created</param>
  165. void addInventoryItem(InventoryItemBase item);
  166. /// <summary>
  167. /// Updates an inventory item with item (updates based on ID)
  168. /// </summary>
  169. /// <param name="item">The updated item</param>
  170. void updateInventoryItem(InventoryItemBase item);
  171. /// <summary>
  172. /// Adds a new folder specified by folder
  173. /// </summary>
  174. /// <param name="folder">The inventory folder</param>
  175. void addInventoryFolder(InventoryFolderBase folder);
  176. /// <summary>
  177. /// Updates a folder based on its ID with folder
  178. /// </summary>
  179. /// <param name="folder">The inventory folder</param>
  180. void updateInventoryFolder(InventoryFolderBase folder);
  181. }
  182. }