diff options
author | Mike Mazur | 2009-02-03 05:20:44 +0000 |
---|---|---|
committer | Mike Mazur | 2009-02-03 05:20:44 +0000 |
commit | d259238c748aafe366fd1d04e0248ef23116fd28 (patch) | |
tree | ec85d8863cffedda47d396d007459b5499bd8162 /OpenSim/Data/DataPluginFactory.cs | |
parent | - move OpenSim/Framework/IUserData.cs to OpenSim/Data/IUserData.cs (diff) | |
download | opensim-SC-d259238c748aafe366fd1d04e0248ef23116fd28.zip opensim-SC-d259238c748aafe366fd1d04e0248ef23116fd28.tar.gz opensim-SC-d259238c748aafe366fd1d04e0248ef23116fd28.tar.bz2 opensim-SC-d259238c748aafe366fd1d04e0248ef23116fd28.tar.xz |
- moved data plugin loading code from various places to
OpenSim/Data/DataPluginFactory.cs
- removed dependencies on a few executable assemblies in
bin/OpenSim.Data.addin.xml
- trim trailing whitespace
Diffstat (limited to 'OpenSim/Data/DataPluginFactory.cs')
-rw-r--r-- | OpenSim/Data/DataPluginFactory.cs | 141 |
1 files changed, 141 insertions, 0 deletions
diff --git a/OpenSim/Data/DataPluginFactory.cs b/OpenSim/Data/DataPluginFactory.cs new file mode 100644 index 0000000..5293e94 --- /dev/null +++ b/OpenSim/Data/DataPluginFactory.cs | |||
@@ -0,0 +1,141 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System.Collections.Generic; | ||
29 | using OpenSim.Framework; | ||
30 | |||
31 | namespace OpenSim.Data | ||
32 | { | ||
33 | /// <summary> | ||
34 | /// A static class containing a series of methods for obtaining handles to | ||
35 | /// database storage objects. | ||
36 | /// </summary> | ||
37 | // Yeah, it's not really a factory, but maybe it'll morph into one? | ||
38 | public static class DataPluginFactory | ||
39 | { | ||
40 | /// <summary> | ||
41 | /// Returns a list of new inventory data plugins. Plugins will be | ||
42 | /// requested in the order they were added. | ||
43 | /// </summary> | ||
44 | /// <param name="provider"> | ||
45 | /// The filename of the inventory server plugin DLL. | ||
46 | /// </param> | ||
47 | /// <param name="connect"> | ||
48 | /// The connection string for the storage backend. | ||
49 | /// </param> | ||
50 | public static List<IInventoryDataPlugin> LoadInventoryDataPlugins(string provider, string connect) | ||
51 | { | ||
52 | PluginLoader<IInventoryDataPlugin> loader = new PluginLoader<IInventoryDataPlugin> (new InventoryDataInitialiser(connect)); | ||
53 | |||
54 | // loader will try to load all providers (MySQL, MSSQL, etc) | ||
55 | // unless it is constrainted to the correct "Provider" entry in the addin.xml | ||
56 | loader.Add ("/OpenSim/InventoryData", new PluginProviderFilter(provider)); | ||
57 | loader.Load(); | ||
58 | |||
59 | return loader.Plugins; | ||
60 | } | ||
61 | |||
62 | /// <summary> | ||
63 | /// Returns a list of new user data plugins. Plugins will be requested | ||
64 | /// in the order they were added. | ||
65 | /// </summary> | ||
66 | /// <param name="provider"> | ||
67 | /// The filename of the user data plugin DLL. | ||
68 | /// </param> | ||
69 | /// <param name="connect"> | ||
70 | /// The connection string for the storage backend. | ||
71 | /// </param> | ||
72 | public static List<IUserDataPlugin> LoadUserDataPlugins(string provider, string connect) | ||
73 | { | ||
74 | PluginLoader<IUserDataPlugin> loader = new PluginLoader<IUserDataPlugin>(new UserDataInitialiser(connect)); | ||
75 | |||
76 | // loader will try to load all providers (MySQL, MSSQL, etc) | ||
77 | // unless it is constrainted to the correct "Provider" entry in the addin.xml | ||
78 | loader.Add("/OpenSim/UserData", new PluginProviderFilter(provider)); | ||
79 | loader.Load(); | ||
80 | |||
81 | return loader.Plugins; | ||
82 | } | ||
83 | |||
84 | /// <summary> | ||
85 | /// Returns a list of new grid data plugins. Plugins will be requested | ||
86 | /// in the order they were added. | ||
87 | /// </summary> | ||
88 | /// <param name="provider"> | ||
89 | /// The filename of the user data plugin DLL. | ||
90 | /// </param> | ||
91 | /// <param name="connect"> | ||
92 | /// The connection string for the storage backend. | ||
93 | /// </param> | ||
94 | public static List<IGridDataPlugin> LoadGridDataPlugins(string provider, string connect) | ||
95 | { | ||
96 | PluginLoader<IGridDataPlugin> loader = new PluginLoader<IGridDataPlugin>(new GridDataInitialiser(connect)); | ||
97 | |||
98 | // loader will try to load all providers (MySQL, MSSQL, etc) | ||
99 | // unless it is constrainted to the correct "Provider" entry in the addin.xml | ||
100 | loader.Add("/OpenSim/GridData", new PluginProviderFilter(provider)); | ||
101 | loader.Load(); | ||
102 | |||
103 | return loader.Plugins; | ||
104 | } | ||
105 | |||
106 | /// <summary> | ||
107 | /// Returns a list of new log data plugins. Plugins will be requested | ||
108 | /// in the order they were added. | ||
109 | /// </summary> | ||
110 | /// <param name="provider"> | ||
111 | /// The filename of the user data plugin DLL. | ||
112 | /// </param> | ||
113 | /// <param name="connect"> | ||
114 | /// The connection string for the storage backend. | ||
115 | /// </param> | ||
116 | public static List<ILogDataPlugin> LoadLogDataPlugins(string provider, string connect) | ||
117 | { | ||
118 | PluginLoader<ILogDataPlugin> loader = new PluginLoader<ILogDataPlugin>(new LogDataInitialiser(connect)); | ||
119 | |||
120 | // loader will try to load all providers (MySQL, MSSQL, etc) | ||
121 | // unless it is constrainted to the correct "Provider" entry in the addin.xml | ||
122 | loader.Add("/OpenSim/LogData", new PluginProviderFilter(provider)); | ||
123 | loader.Load(); | ||
124 | |||
125 | return loader.Plugins; | ||
126 | } | ||
127 | |||
128 | public static IAssetDataPlugin LoadAssetDataPlugin(string provider, string connect) | ||
129 | { | ||
130 | PluginLoader<IAssetDataPlugin> loader = new PluginLoader<IAssetDataPlugin> (new AssetDataInitialiser (connect)); | ||
131 | |||
132 | // loader will try to load all providers (MySQL, MSSQL, etc) | ||
133 | // unless it is constrainted to the correct "Provider" entry in the addin.xml | ||
134 | loader.Add ("/OpenSim/AssetData", new PluginProviderFilter (provider)); | ||
135 | loader.Load(); | ||
136 | |||
137 | return loader.Plugin; | ||
138 | } | ||
139 | |||
140 | } | ||
141 | } | ||