aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/InventoryServiceBase/InventoryServiceBase.cs
diff options
context:
space:
mode:
authorlbsa712007-09-24 07:30:30 +0000
committerlbsa712007-09-24 07:30:30 +0000
commit1302ef44e3c632159378bc4042c753bcf36e9c63 (patch)
tree6b6295ac233ecb05afe6432a903ec616e4fa079a /OpenSim/Framework/InventoryServiceBase/InventoryServiceBase.cs
parent* Trying to streamline CommunicationsManager (diff)
downloadopensim-SC_OLD-1302ef44e3c632159378bc4042c753bcf36e9c63.zip
opensim-SC_OLD-1302ef44e3c632159378bc4042c753bcf36e9c63.tar.gz
opensim-SC_OLD-1302ef44e3c632159378bc4042c753bcf36e9c63.tar.bz2
opensim-SC_OLD-1302ef44e3c632159378bc4042c753bcf36e9c63.tar.xz
* Started major restructusing of comms to prepare for better grid and region functionality
* Working towards one shared set of services * Killed off two projects with very little functionality
Diffstat (limited to 'OpenSim/Framework/InventoryServiceBase/InventoryServiceBase.cs')
-rw-r--r--OpenSim/Framework/InventoryServiceBase/InventoryServiceBase.cs204
1 files changed, 0 insertions, 204 deletions
diff --git a/OpenSim/Framework/InventoryServiceBase/InventoryServiceBase.cs b/OpenSim/Framework/InventoryServiceBase/InventoryServiceBase.cs
deleted file mode 100644
index d76fac5..0000000
--- a/OpenSim/Framework/InventoryServiceBase/InventoryServiceBase.cs
+++ /dev/null
@@ -1,204 +0,0 @@
1using System;
2using System.Collections.Generic;
3using System.Reflection;
4using libsecondlife;
5using OpenSim.Framework.Console;
6using OpenSim.Framework.Data;
7
8namespace OpenSim.Framework.InventoryServiceBase
9{
10 public class InventoryServiceBase
11 {
12 protected Dictionary<string, IInventoryData> m_plugins = new Dictionary<string, IInventoryData>();
13 //protected IAssetServer m_assetServer;
14
15 public InventoryServiceBase()
16 {
17 //m_assetServer = assetServer;
18 }
19
20 /// <summary>
21 /// Adds a new user server plugin - plugins will be requested in the order they were loaded.
22 /// </summary>
23 /// <param name="FileName">The filename to the user server plugin DLL</param>
24 public void AddPlugin(string FileName)
25 {
26 if (!String.IsNullOrEmpty(FileName))
27 {
28 MainLog.Instance.Verbose("Inventory", "Inventorystorage: Attempting to load " + FileName);
29 Assembly pluginAssembly = Assembly.LoadFrom(FileName);
30
31 foreach (Type pluginType in pluginAssembly.GetTypes())
32 {
33 if (!pluginType.IsAbstract)
34 {
35 Type typeInterface = pluginType.GetInterface("IInventoryData", true);
36
37 if (typeInterface != null)
38 {
39 IInventoryData plug =
40 (IInventoryData)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
41 plug.Initialise();
42 this.m_plugins.Add(plug.getName(), plug);
43 MainLog.Instance.Verbose("Inventorystorage: Added IInventoryData Interface");
44 }
45 }
46 }
47 }
48 }
49
50 /// <summary>
51 /// Returns the root folder plus any folders in root (so down one level in the Inventory folders tree)
52 /// </summary>
53 /// <param name="userID"></param>
54 /// <returns></returns>
55 public List<InventoryFolderBase> RequestFirstLevelFolders(LLUUID userID)
56 {
57 List<InventoryFolderBase> inventoryList = new List<InventoryFolderBase>();
58 foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins)
59 {
60 InventoryFolderBase rootFolder = plugin.Value.getUserRootFolder(userID);
61 if (rootFolder != null)
62 {
63 inventoryList = plugin.Value.getInventoryFolders(rootFolder.folderID);
64 inventoryList.Insert(0, rootFolder);
65 return inventoryList;
66 }
67 }
68 return inventoryList;
69 }
70
71 /// <summary>
72 ///
73 /// </summary>
74 public InventoryFolderBase RequestUsersRoot(LLUUID userID)
75 {
76 foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins)
77 {
78 return plugin.Value.getUserRootFolder(userID);
79 }
80 return null;
81 }
82
83 /// <summary>
84 ///
85 /// </summary>
86 /// <param name="parentFolderID"></param>
87 /// <returns></returns>
88 public List<InventoryFolderBase> RequestSubFolders(LLUUID parentFolderID)
89 {
90 List<InventoryFolderBase> inventoryList = new List<InventoryFolderBase>();
91 foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins)
92 {
93 return plugin.Value.getInventoryFolders(parentFolderID);
94 }
95 return inventoryList;
96 }
97
98 public List<InventoryItemBase> RequestFolderItems(LLUUID folderID)
99 {
100 List<InventoryItemBase> itemsList = new List<InventoryItemBase>();
101 foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins)
102 {
103 itemsList = plugin.Value.getInventoryInFolder(folderID);
104 return itemsList;
105 }
106 return itemsList;
107 }
108
109 public void AddFolder(InventoryFolderBase folder)
110 {
111 foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins)
112 {
113 plugin.Value.addInventoryFolder(folder);
114 }
115 }
116
117 public void AddItem(InventoryItemBase item)
118 {
119 foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins)
120 {
121 plugin.Value.addInventoryItem(item);
122 }
123 }
124
125 public void deleteItem(InventoryItemBase item)
126 {
127 foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins)
128 {
129 plugin.Value.deleteInventoryItem(item);
130 }
131 }
132
133 /// <summary>
134 ///
135 /// </summary>
136 /// <param name="inventory"></param>
137 public void AddNewInventorySet(UsersInventory inventory)
138 {
139 foreach (InventoryFolderBase folder in inventory.Folders.Values)
140 {
141 this.AddFolder(folder);
142 }
143 }
144
145 public void CreateNewUserInventory(LLUUID user)
146 {
147 UsersInventory inven = new UsersInventory();
148 inven.CreateNewInventorySet(user);
149 this.AddNewInventorySet(inven);
150 }
151
152 public class UsersInventory
153 {
154 public Dictionary<LLUUID, InventoryFolderBase> Folders = new Dictionary<LLUUID, InventoryFolderBase>();
155 public Dictionary<LLUUID, InventoryItemBase> Items = new Dictionary<LLUUID, InventoryItemBase>();
156
157 public UsersInventory()
158 {
159
160 }
161
162 public virtual void CreateNewInventorySet(LLUUID user)
163 {
164 InventoryFolderBase folder = new InventoryFolderBase();
165 folder.parentID = LLUUID.Zero;
166 folder.agentID = user;
167 folder.folderID = LLUUID.Random();
168 folder.name = "My Inventory";
169 folder.type = 8;
170 folder.version = 1;
171 Folders.Add(folder.folderID, folder);
172
173 LLUUID rootFolder = folder.folderID;
174
175 folder = new InventoryFolderBase();
176 folder.parentID = rootFolder;
177 folder.agentID = user;
178 folder.folderID = LLUUID.Random();
179 folder.name = "Textures";
180 folder.type = 0;
181 folder.version = 1;
182 Folders.Add(folder.folderID, folder);
183
184 folder = new InventoryFolderBase();
185 folder.parentID = rootFolder;
186 folder.agentID = user;
187 folder.folderID = LLUUID.Random();
188 folder.name = "Objects";
189 folder.type = 6;
190 folder.version = 1;
191 Folders.Add(folder.folderID, folder);
192
193 folder = new InventoryFolderBase();
194 folder.parentID = rootFolder;
195 folder.agentID = user;
196 folder.folderID = LLUUID.Random();
197 folder.name = "Clothes";
198 folder.type = 5;
199 folder.version = 1;
200 Folders.Add(folder.folderID, folder);
201 }
202 }
203 }
204} \ No newline at end of file