diff options
Merge branch 'master' of ssh://opensimulator.org/var/git/opensim
Diffstat (limited to 'OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/BaseInventoryConnector.cs')
-rw-r--r-- | OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/BaseInventoryConnector.cs | 223 |
1 files changed, 0 insertions, 223 deletions
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/BaseInventoryConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/BaseInventoryConnector.cs deleted file mode 100644 index dcf08e3..0000000 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/BaseInventoryConnector.cs +++ /dev/null | |||
@@ -1,223 +0,0 @@ | |||
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 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using OpenMetaverse; | ||
31 | using Nini.Config; | ||
32 | using log4net; | ||
33 | using OpenSim.Framework; | ||
34 | using OpenSim.Services.Interfaces; | ||
35 | |||
36 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | ||
37 | { | ||
38 | public abstract class BaseInventoryConnector : IInventoryService | ||
39 | { | ||
40 | protected static InventoryCache m_cache; | ||
41 | private static bool m_Initialized; | ||
42 | |||
43 | protected virtual void Init(IConfigSource source) | ||
44 | { | ||
45 | if (!m_Initialized) | ||
46 | { | ||
47 | m_cache = new InventoryCache(); | ||
48 | m_cache.Init(source, this); | ||
49 | m_Initialized = true; | ||
50 | } | ||
51 | } | ||
52 | |||
53 | /// <summary> | ||
54 | /// Create the entire inventory for a given user | ||
55 | /// </summary> | ||
56 | /// <param name="user"></param> | ||
57 | /// <returns></returns> | ||
58 | public abstract bool CreateUserInventory(UUID user); | ||
59 | |||
60 | /// <summary> | ||
61 | /// Gets the skeleton of the inventory -- folders only | ||
62 | /// </summary> | ||
63 | /// <param name="userId"></param> | ||
64 | /// <returns></returns> | ||
65 | public abstract List<InventoryFolderBase> GetInventorySkeleton(UUID userId); | ||
66 | |||
67 | /// <summary> | ||
68 | /// Synchronous inventory fetch. | ||
69 | /// </summary> | ||
70 | /// <param name="userID"></param> | ||
71 | /// <returns></returns> | ||
72 | public abstract InventoryCollection GetUserInventory(UUID userID); | ||
73 | |||
74 | /// <summary> | ||
75 | /// Request the inventory for a user. This is an asynchronous operation that will call the callback when the | ||
76 | /// inventory has been received | ||
77 | /// </summary> | ||
78 | /// <param name="userID"></param> | ||
79 | /// <param name="callback"></param> | ||
80 | public abstract void GetUserInventory(UUID userID, InventoryReceiptCallback callback); | ||
81 | |||
82 | /// <summary> | ||
83 | /// Retrieve the root inventory folder for the given user. | ||
84 | /// </summary> | ||
85 | /// <param name="userID"></param> | ||
86 | /// <returns>null if no root folder was found</returns> | ||
87 | public InventoryFolderBase GetRootFolder(UUID userID) | ||
88 | { | ||
89 | // Root folder is here as system type Folder. | ||
90 | return m_cache.GetFolderForType(userID, AssetType.Folder); | ||
91 | } | ||
92 | |||
93 | public abstract Dictionary<AssetType, InventoryFolderBase> GetSystemFolders(UUID userID); | ||
94 | |||
95 | /// <summary> | ||
96 | /// Gets the user folder for the given folder-type | ||
97 | /// </summary> | ||
98 | /// <param name="userID"></param> | ||
99 | /// <param name="type"></param> | ||
100 | /// <returns></returns> | ||
101 | public InventoryFolderBase GetFolderForType(UUID userID, AssetType type) | ||
102 | { | ||
103 | return m_cache.GetFolderForType(userID, type); | ||
104 | } | ||
105 | |||
106 | /// <summary> | ||
107 | /// Gets everything (folders and items) inside a folder | ||
108 | /// </summary> | ||
109 | /// <param name="userId"></param> | ||
110 | /// <param name="folderID"></param> | ||
111 | /// <returns></returns> | ||
112 | public abstract InventoryCollection GetFolderContent(UUID userID, UUID folderID); | ||
113 | |||
114 | /// <summary> | ||
115 | /// Gets the items inside a folder | ||
116 | /// </summary> | ||
117 | /// <param name="userID"></param> | ||
118 | /// <param name="folderID"></param> | ||
119 | /// <returns></returns> | ||
120 | public abstract List<InventoryItemBase> GetFolderItems(UUID userID, UUID folderID); | ||
121 | |||
122 | /// <summary> | ||
123 | /// Add a new folder to the user's inventory | ||
124 | /// </summary> | ||
125 | /// <param name="folder"></param> | ||
126 | /// <returns>true if the folder was successfully added</returns> | ||
127 | public abstract bool AddFolder(InventoryFolderBase folder); | ||
128 | |||
129 | /// <summary> | ||
130 | /// Update a folder in the user's inventory | ||
131 | /// </summary> | ||
132 | /// <param name="folder"></param> | ||
133 | /// <returns>true if the folder was successfully updated</returns> | ||
134 | public abstract bool UpdateFolder(InventoryFolderBase folder); | ||
135 | |||
136 | /// <summary> | ||
137 | /// Move an inventory folder to a new location | ||
138 | /// </summary> | ||
139 | /// <param name="folder">A folder containing the details of the new location</param> | ||
140 | /// <returns>true if the folder was successfully moved</returns> | ||
141 | public abstract bool MoveFolder(InventoryFolderBase folder); | ||
142 | |||
143 | /// <summary> | ||
144 | /// Delete a list of inventory folders (from trash) | ||
145 | /// </summary> | ||
146 | public abstract bool DeleteFolders(UUID ownerID, List<UUID> folderIDs); | ||
147 | |||
148 | /// <summary> | ||
149 | /// Purge an inventory folder of all its items and subfolders. | ||
150 | /// </summary> | ||
151 | /// <param name="folder"></param> | ||
152 | /// <returns>true if the folder was successfully purged</returns> | ||
153 | public abstract bool PurgeFolder(InventoryFolderBase folder); | ||
154 | |||
155 | /// <summary> | ||
156 | /// Add a new item to the user's inventory. | ||
157 | /// If the given item has to parent folder, it tries to find the most | ||
158 | /// suitable folder for it. | ||
159 | /// </summary> | ||
160 | /// <param name="item"></param> | ||
161 | /// <returns>true if the item was successfully added</returns> | ||
162 | public bool AddItem(InventoryItemBase item) | ||
163 | { | ||
164 | if (item == null) | ||
165 | return false; | ||
166 | |||
167 | if (item.Folder == UUID.Zero) | ||
168 | { | ||
169 | InventoryFolderBase f = GetFolderForType(item.Owner, (AssetType)item.AssetType); | ||
170 | if (f != null) | ||
171 | item.Folder = f.ID; | ||
172 | else | ||
173 | { | ||
174 | f = GetRootFolder(item.Owner); | ||
175 | if (f != null) | ||
176 | item.Folder = f.ID; | ||
177 | else | ||
178 | return false; | ||
179 | } | ||
180 | } | ||
181 | |||
182 | return AddItemPlain(item); | ||
183 | } | ||
184 | |||
185 | protected abstract bool AddItemPlain(InventoryItemBase item); | ||
186 | |||
187 | /// <summary> | ||
188 | /// Update an item in the user's inventory | ||
189 | /// </summary> | ||
190 | /// <param name="item"></param> | ||
191 | /// <returns>true if the item was successfully updated</returns> | ||
192 | public abstract bool UpdateItem(InventoryItemBase item); | ||
193 | |||
194 | public abstract bool MoveItems(UUID ownerID, List<InventoryItemBase> items); | ||
195 | |||
196 | /// <summary> | ||
197 | /// Delete an item from the user's inventory | ||
198 | /// </summary> | ||
199 | /// <param name="item"></param> | ||
200 | /// <returns>true if the item was successfully deleted</returns> | ||
201 | public abstract bool DeleteItems(UUID ownerID, List<UUID> itemIDs); | ||
202 | |||
203 | public abstract InventoryItemBase GetItem(InventoryItemBase item); | ||
204 | |||
205 | public abstract InventoryFolderBase GetFolder(InventoryFolderBase folder); | ||
206 | |||
207 | /// <summary> | ||
208 | /// Does the given user have an inventory structure? | ||
209 | /// </summary> | ||
210 | /// <param name="userID"></param> | ||
211 | /// <returns></returns> | ||
212 | public abstract bool HasInventoryForUser(UUID userID); | ||
213 | |||
214 | /// <summary> | ||
215 | /// Get the active gestures of the agent. | ||
216 | /// </summary> | ||
217 | /// <param name="userId"></param> | ||
218 | /// <returns></returns> | ||
219 | public abstract List<InventoryItemBase> GetActiveGestures(UUID userId); | ||
220 | |||
221 | public abstract int GetAssetPermissions(UUID userID, UUID assetID); | ||
222 | } | ||
223 | } | ||