QuickAndDirtyInventoryServiceConnector.cs 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  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 log4net;
  28. using System;
  29. using System.Collections.Generic;
  30. using System.IO;
  31. using System.Reflection;
  32. using Nini.Config;
  33. using OpenSim.Framework;
  34. using OpenSim.Framework.Servers.HttpServer;
  35. using OpenSim.Services.Interfaces;
  36. using OpenMetaverse;
  37. namespace OpenSim.Services.Connectors
  38. {
  39. /// <summary>
  40. /// This connector is temporary. It's used by the user server, before that server is refactored.
  41. /// </summary>
  42. public class QuickAndDirtyInventoryServiceConnector : IInventoryService
  43. {
  44. // private static readonly ILog m_log =
  45. // LogManager.GetLogger(
  46. // MethodBase.GetCurrentMethod().DeclaringType);
  47. private string m_ServerURI = String.Empty;
  48. //private Dictionary<UUID, InventoryReceiptCallback> m_RequestingInventory = new Dictionary<UUID, InventoryReceiptCallback>();
  49. public QuickAndDirtyInventoryServiceConnector()
  50. {
  51. }
  52. public QuickAndDirtyInventoryServiceConnector(string serverURI)
  53. {
  54. m_ServerURI = serverURI.TrimEnd('/');
  55. }
  56. /// <summary>
  57. /// <see cref="OpenSim.Framework.Communications.IInterServiceInventoryServices"/>
  58. /// </summary>
  59. /// <param name="userId"></param>
  60. /// <returns></returns>
  61. public bool CreateUserInventory(UUID userId)
  62. {
  63. return SynchronousRestObjectPoster.BeginPostObject<Guid, bool>(
  64. "POST", m_ServerURI + "CreateInventory/", userId.Guid);
  65. }
  66. /// <summary>
  67. /// <see cref="OpenSim.Framework.Communications.IInterServiceInventoryServices"/>
  68. /// </summary>
  69. /// <param name="userId"></param>
  70. /// <returns></returns>
  71. public List<InventoryFolderBase> GetInventorySkeleton(UUID userId)
  72. {
  73. return SynchronousRestObjectPoster.BeginPostObject<Guid, List<InventoryFolderBase>>(
  74. "POST", m_ServerURI + "RootFolders/", userId.Guid);
  75. }
  76. /// <summary>
  77. /// Returns a list of all the active gestures in a user's inventory.
  78. /// </summary>
  79. /// <param name="userId">
  80. /// The <see cref="UUID"/> of the user
  81. /// </param>
  82. /// <returns>
  83. /// A flat list of the gesture items.
  84. /// </returns>
  85. public List<InventoryItemBase> GetActiveGestures(UUID userId)
  86. {
  87. return SynchronousRestObjectPoster.BeginPostObject<Guid, List<InventoryItemBase>>(
  88. "POST", m_ServerURI + "ActiveGestures/", userId.Guid);
  89. }
  90. public InventoryCollection GetUserInventory(UUID userID)
  91. {
  92. return null;
  93. }
  94. public void GetUserInventory(UUID userID, InventoryReceiptCallback callback)
  95. {
  96. }
  97. public InventoryFolderBase GetFolderForType(UUID userID, AssetType type)
  98. {
  99. return null;
  100. }
  101. public InventoryCollection GetFolderContent(UUID userID, UUID folderID)
  102. {
  103. return null;
  104. }
  105. public List<InventoryItemBase> GetFolderItems(UUID userID, UUID folderID)
  106. {
  107. return null;
  108. }
  109. public bool AddFolder(InventoryFolderBase folder)
  110. {
  111. return false;
  112. }
  113. public bool UpdateFolder(InventoryFolderBase folder)
  114. {
  115. return false;
  116. }
  117. public bool MoveFolder(InventoryFolderBase folder)
  118. {
  119. return false;
  120. }
  121. public bool PurgeFolder(InventoryFolderBase folder)
  122. {
  123. return false;
  124. }
  125. public bool AddItem(InventoryItemBase item)
  126. {
  127. return false;
  128. }
  129. public bool UpdateItem(InventoryItemBase item)
  130. {
  131. return false;
  132. }
  133. public bool MoveItems(UUID ownerID, List<InventoryItemBase> items)
  134. {
  135. return false;
  136. }
  137. public bool DeleteItems(UUID owner, List<UUID> itemIDs)
  138. {
  139. return false;
  140. }
  141. public InventoryItemBase GetItem(InventoryItemBase item)
  142. {
  143. return null;
  144. }
  145. public InventoryFolderBase GetFolder(InventoryFolderBase folder)
  146. {
  147. return null;
  148. }
  149. public bool HasInventoryForUser(UUID userID)
  150. {
  151. return false;
  152. }
  153. public InventoryFolderBase GetRootFolder(UUID userID)
  154. {
  155. return null;
  156. }
  157. public int GetAssetPermissions(UUID userID, UUID assetID)
  158. {
  159. return 0;
  160. }
  161. }
  162. }