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