aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/InventoryServiceBase/InventoryServiceBase.cs
diff options
context:
space:
mode:
authorMW2007-07-22 11:44:36 +0000
committerMW2007-07-22 11:44:36 +0000
commit70fa30204272e874b8e3acccdc2e22cd4e42b2b2 (patch)
tree2f6c3c0f3b3bd60d5972f8dea6b3abeae4dc9065 /OpenSim/Framework/InventoryServiceBase/InventoryServiceBase.cs
parent* Aerobic erosion now uses Navier Stokes algorithms for wind calculations. (diff)
downloadopensim-SC_OLD-70fa30204272e874b8e3acccdc2e22cd4e42b2b2.zip
opensim-SC_OLD-70fa30204272e874b8e3acccdc2e22cd4e42b2b2.tar.gz
opensim-SC_OLD-70fa30204272e874b8e3acccdc2e22cd4e42b2b2.tar.bz2
opensim-SC_OLD-70fa30204272e874b8e3acccdc2e22cd4e42b2b2.tar.xz
* Some work in progress code: Inventory cache, start of inventory server/service, userprofile cache, inventory handling. (non of it is enabled yet (or at least it shouldn't be).
* Fixed some of the problems with crossing regions when flying: you should no longer sink to ground level when crossing (should keep roughly your right height). Should no longer sometimes get sent back to the centre of the current region when attempting to border cross. But instead sometimes you will find you avatar stop at the edge of region and you will need to start moving again to retry the crossing (which should then work). This code is partly based on Babblefrog's issue #212 patch. [I think I have some ideas of how to solve the stopping at edges problem, just want to get the inventory code done first] * Capabilities code has now been moved to the OpenSim.Framework.Communications project as some of the caps code will be tightly tied to inventory/asset handling and it was causing a two way reference problem when it was in its own project/dll. This is a Big commit as I was going to keep my inventory work local until I had it in a working state, in case it brakes anything, but its getting harder to keep in sync with svn.
Diffstat (limited to '')
-rw-r--r--OpenSim/Framework/InventoryServiceBase/InventoryServiceBase.cs136
1 files changed, 136 insertions, 0 deletions
diff --git a/OpenSim/Framework/InventoryServiceBase/InventoryServiceBase.cs b/OpenSim/Framework/InventoryServiceBase/InventoryServiceBase.cs
new file mode 100644
index 0000000..d407cdb
--- /dev/null
+++ b/OpenSim/Framework/InventoryServiceBase/InventoryServiceBase.cs
@@ -0,0 +1,136 @@
1using System;
2using System.Collections.Generic;
3using System.Reflection;
4using System.Text;
5using libsecondlife;
6using OpenSim.Framework.Console;
7using OpenSim.Framework.Interfaces;
8using OpenSim.Framework.Data;
9
10namespace OpenSim.Framework.InventoryServiceBase
11{
12 public class InventoryServiceBase
13 {
14 protected Dictionary<string, IInventoryData> m_plugins = new Dictionary<string, IInventoryData>();
15 protected IAssetServer m_assetServer;
16
17 public InventoryServiceBase(IAssetServer assetServer)
18 {
19 m_assetServer = assetServer;
20 }
21
22 /// <summary>
23 /// Adds a new user server plugin - plugins will be requested in the order they were loaded.
24 /// </summary>
25 /// <param name="FileName">The filename to the user server plugin DLL</param>
26 public void AddPlugin(string FileName)
27 {
28 MainLog.Instance.Verbose("Inventorytorage: 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 = (IInventoryData)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
40 plug.Initialise();
41 this.m_plugins.Add(plug.getName(), plug);
42 MainLog.Instance.Verbose("Inventorystorage: Added IInventoryData Interface");
43 }
44
45 typeInterface = null;
46 }
47 }
48
49 pluginAssembly = null;
50 }
51
52 /// <summary>
53 ///
54 /// </summary>
55 /// <param name="userID"></param>
56 /// <returns></returns>
57 public List<InventoryFolderBase> RequestFirstLevelFolders(LLUUID userID)
58 {
59 List<InventoryFolderBase> inventoryList = new List<InventoryFolderBase>();
60 foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins)
61 {
62 InventoryFolderBase rootFolder = plugin.Value.getUserRootFolder(userID);
63 if (rootFolder != null)
64 {
65 inventoryList = plugin.Value.getInventoryFolders(rootFolder.folderID);
66 inventoryList.Insert(0, rootFolder);
67 return inventoryList;
68 }
69 }
70 return inventoryList;
71 }
72
73 /// <summary>
74 ///
75 /// </summary>
76 public InventoryFolderBase RequestUsersRoot(LLUUID userID)
77 {
78 foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins)
79 {
80 return plugin.Value.getUserRootFolder(userID);
81 }
82 return null;
83 }
84
85 /// <summary>
86 ///
87 /// </summary>
88 /// <param name="parentFolderID"></param>
89 /// <returns></returns>
90 public List<InventoryFolderBase> RequestSubFolders(LLUUID parentFolderID)
91 {
92 List<InventoryFolderBase> inventoryList = new List<InventoryFolderBase>();
93 foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins)
94 {
95 return plugin.Value.getInventoryFolders(parentFolderID);
96 }
97 return inventoryList;
98 }
99
100 public List<InventoryItemBase> RequestFolderItems(LLUUID folderID)
101 {
102 List<InventoryItemBase> itemsList = new List<InventoryItemBase>();
103 foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins)
104 {
105 itemsList = plugin.Value.getInventoryInFolder(folderID);
106 return itemsList;
107 }
108 return itemsList;
109 }
110
111 /// <summary>
112 ///
113 /// </summary>
114 /// <param name="inventory"></param>
115 public void AddNewInventorySet(UsersInventory inventory)
116 {
117
118 }
119
120 public class UsersInventory
121 {
122 public Dictionary<LLUUID, InventoryFolderBase> Folders = new Dictionary<LLUUID, InventoryFolderBase>();
123 public Dictionary<LLUUID, InventoryItemBase> Items = new Dictionary<LLUUID, InventoryItemBase>();
124
125 public UsersInventory()
126 {
127
128 }
129
130 protected virtual void CreateNewInventorySet()
131 {
132
133 }
134 }
135 }
136}