aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/InventoryServiceBase
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Framework/InventoryServiceBase')
-rw-r--r--OpenSim/Framework/InventoryServiceBase/InventoryServiceBase.cs136
-rw-r--r--OpenSim/Framework/InventoryServiceBase/Properties/AssemblyInfo.cs35
2 files changed, 171 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}
diff --git a/OpenSim/Framework/InventoryServiceBase/Properties/AssemblyInfo.cs b/OpenSim/Framework/InventoryServiceBase/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..35cca07
--- /dev/null
+++ b/OpenSim/Framework/InventoryServiceBase/Properties/AssemblyInfo.cs
@@ -0,0 +1,35 @@
1using System.Reflection;
2using System.Runtime.CompilerServices;
3using System.Runtime.InteropServices;
4
5// General Information about an assembly is controlled through the following
6// set of attributes. Change these attribute values to modify the information
7// associated with an assembly.
8[assembly: AssemblyTitle("InventoryServiceBase")]
9[assembly: AssemblyDescription("")]
10[assembly: AssemblyConfiguration("")]
11[assembly: AssemblyCompany("")]
12[assembly: AssemblyProduct("InventoryServiceBase")]
13[assembly: AssemblyCopyright("Copyright © 2007")]
14[assembly: AssemblyTrademark("")]
15[assembly: AssemblyCulture("")]
16
17// Setting ComVisible to false makes the types in this assembly not visible
18// to COM components. If you need to access a type in this assembly from
19// COM, set the ComVisible attribute to true on that type.
20[assembly: ComVisible(false)]
21
22// The following GUID is for the ID of the typelib if this project is exposed to COM
23[assembly: Guid("7e1fbd0b-4a25-4804-a01f-89b04eb5b349")]
24
25// Version information for an assembly consists of the following four values:
26//
27// Major Version
28// Minor Version
29// Build Number
30// Revision
31//
32// You can specify all the values or you can default the Revision and Build Numbers
33// by using the '*' as shown below:
34[assembly: AssemblyVersion("1.0.0.0")]
35[assembly: AssemblyFileVersion("1.0.0.0")]