InventoryData.cs 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  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 (NULL_KEY = Inventory Root)
  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 name of the inventory item (must be less than 64 characters)
  59. /// </summary>
  60. public string inventoryName;
  61. /// <summary>
  62. /// The description of the inventory item (must be less than 64 characters)
  63. /// </summary>
  64. public string inventoryDescription;
  65. /// <summary>
  66. /// A mask containing the permissions for the next owner (cannot be enforced)
  67. /// </summary>
  68. public uint inventoryNextPermissions;
  69. /// <summary>
  70. /// A mask containing permissions for the current owner (cannot be enforced)
  71. /// </summary>
  72. public uint inventoryCurrentPermissions;
  73. }
  74. /// <summary>
  75. /// A Class for folders which contain users inventory
  76. /// </summary>
  77. public class InventoryFolderBase
  78. {
  79. /// <summary>
  80. /// The name of the folder (64 characters or less)
  81. /// </summary>
  82. public string name;
  83. /// <summary>
  84. /// The agent who's inventory this is contained by
  85. /// </summary>
  86. public LLUUID agentID;
  87. /// <summary>
  88. /// The folder this folder is contained in (NULL_KEY for root)
  89. /// </summary>
  90. public LLUUID parentID;
  91. /// <summary>
  92. /// The UUID for this folder
  93. /// </summary>
  94. public LLUUID folderID;
  95. }
  96. /// <summary>
  97. /// An interface for accessing inventory data from a storage server
  98. /// </summary>
  99. public interface IInventoryData
  100. {
  101. /// <summary>
  102. /// Initialises the interface
  103. /// </summary>
  104. void Initialise();
  105. /// <summary>
  106. /// Closes the interface
  107. /// </summary>
  108. void Close();
  109. /// <summary>
  110. /// The plugin being loaded
  111. /// </summary>
  112. /// <returns>A string containing the plugin name</returns>
  113. string getName();
  114. /// <summary>
  115. /// The plugins version
  116. /// </summary>
  117. /// <returns>A string containing the plugin version</returns>
  118. string getVersion();
  119. /// <summary>
  120. /// Returns a list of inventory items contained within the specified folder
  121. /// </summary>
  122. /// <param name="folderID">The UUID of the target folder</param>
  123. /// <returns>A List of InventoryItemBase items</returns>
  124. List<InventoryItemBase> getInventoryInFolder(LLUUID folderID);
  125. /// <summary>
  126. /// Returns a list of folders in the users inventory root.
  127. /// </summary>
  128. /// <param name="user">The UUID of the user who is having inventory being returned</param>
  129. /// <returns>A list of folders</returns>
  130. List<InventoryFolderBase> getUserRootFolders(LLUUID user);
  131. /// <summary>
  132. /// Returns a list of inventory folders contained in the folder 'parentID'
  133. /// </summary>
  134. /// <param name="parentID">The folder to get subfolders for</param>
  135. /// <returns>A list of inventory folders</returns>
  136. List<InventoryFolderBase> getInventoryFolders(LLUUID parentID);
  137. /// <summary>
  138. /// Returns an inventory item by its UUID
  139. /// </summary>
  140. /// <param name="item">The UUID of the item to be returned</param>
  141. /// <returns>A class containing item information</returns>
  142. InventoryItemBase getInventoryItem(LLUUID item);
  143. /// <summary>
  144. /// Returns a specified inventory folder by its UUID
  145. /// </summary>
  146. /// <param name="folder">The UUID of the folder to be returned</param>
  147. /// <returns>A class containing folder information</returns>
  148. InventoryFolderBase getInventoryFolder(LLUUID folder);
  149. /// <summary>
  150. /// Creates a new inventory item based on item
  151. /// </summary>
  152. /// <param name="item">The item to be created</param>
  153. void addInventoryItem(InventoryItemBase item);
  154. /// <summary>
  155. /// Updates an inventory item with item (updates based on ID)
  156. /// </summary>
  157. /// <param name="item">The updated item</param>
  158. void updateInventoryItem(InventoryItemBase item);
  159. /// <summary>
  160. /// Adds a new folder specified by folder
  161. /// </summary>
  162. /// <param name="folder">The inventory folder</param>
  163. void addInventoryFolder(InventoryFolderBase folder);
  164. /// <summary>
  165. /// Updates a folder based on its ID with folder
  166. /// </summary>
  167. /// <param name="folder">The inventory folder</param>
  168. void updateInventoryFolder(InventoryFolderBase folder);
  169. }
  170. }