diff options
author | Adam Frisby | 2007-07-15 15:40:50 +0000 |
---|---|---|
committer | Adam Frisby | 2007-07-15 15:40:50 +0000 |
commit | 8fc1dfec792f3527c7f153bd49852519d561d17a (patch) | |
tree | 0aae20f07b43c4ac9a4f2d5fff3f7eb1619733ab /OpenSim/Region/Environment/StorageManager.cs | |
parent | * Typo in prebuild.xml (diff) | |
download | opensim-SC-8fc1dfec792f3527c7f153bd49852519d561d17a.zip opensim-SC-8fc1dfec792f3527c7f153bd49852519d561d17a.tar.gz opensim-SC-8fc1dfec792f3527c7f153bd49852519d561d17a.tar.bz2 opensim-SC-8fc1dfec792f3527c7f153bd49852519d561d17a.tar.xz |
* Added loading methods for NullStorage.
Diffstat (limited to 'OpenSim/Region/Environment/StorageManager.cs')
-rw-r--r-- | OpenSim/Region/Environment/StorageManager.cs | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/OpenSim/Region/Environment/StorageManager.cs b/OpenSim/Region/Environment/StorageManager.cs new file mode 100644 index 0000000..9f2730f --- /dev/null +++ b/OpenSim/Region/Environment/StorageManager.cs | |||
@@ -0,0 +1,63 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | |||
5 | using OpenSim.Framework; | ||
6 | using OpenSim.Framework.Communications; | ||
7 | using OpenSim.Framework.Servers; | ||
8 | using OpenSim.Region.Capabilities; | ||
9 | using OpenSim.Region.Environment.Scenes; | ||
10 | using OpenSim.Region.Interfaces; | ||
11 | |||
12 | using System.Reflection; | ||
13 | |||
14 | namespace OpenSim.Region.Environment | ||
15 | { | ||
16 | public class StorageManager | ||
17 | { | ||
18 | private IRegionDataStore m_dataStore; | ||
19 | |||
20 | public IRegionDataStore DataStore | ||
21 | { | ||
22 | get | ||
23 | { | ||
24 | return m_dataStore; | ||
25 | } | ||
26 | } | ||
27 | |||
28 | public StorageManager(IRegionDataStore storage) | ||
29 | { | ||
30 | m_dataStore = storage; | ||
31 | } | ||
32 | |||
33 | public StorageManager(string dllName, string dataStoreFile, string dataStoreDB) | ||
34 | { | ||
35 | Assembly pluginAssembly = Assembly.LoadFrom(dllName); | ||
36 | |||
37 | foreach (Type pluginType in pluginAssembly.GetTypes()) | ||
38 | { | ||
39 | if (pluginType.IsPublic) | ||
40 | { | ||
41 | if (!pluginType.IsAbstract) | ||
42 | { | ||
43 | Type typeInterface = pluginType.GetInterface("IRegionDataStore", true); | ||
44 | |||
45 | if (typeInterface != null) | ||
46 | { | ||
47 | IRegionDataStore plug = (IRegionDataStore)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); | ||
48 | plug.Initialise(dataStoreFile, dataStoreDB); | ||
49 | |||
50 | m_dataStore = plug; | ||
51 | } | ||
52 | |||
53 | typeInterface = null; | ||
54 | } | ||
55 | } | ||
56 | } | ||
57 | |||
58 | pluginAssembly = null; | ||
59 | |||
60 | //TODO: Add checking and warning to make sure it initialised. | ||
61 | } | ||
62 | } | ||
63 | } | ||