aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Grid/AssetServer/Main.cs
diff options
context:
space:
mode:
authorMike Mazur2008-07-31 09:24:28 +0000
committerMike Mazur2008-07-31 09:24:28 +0000
commit2270b252656146d9d74b84665a7ace6c3139db30 (patch)
tree7a967ee50349cf4301ed801e0b8c85f5060ffe1d /OpenSim/Grid/AssetServer/Main.cs
parentdropping intermediate GridInfoPlugin.addin.xml, as it's no longer (diff)
downloadopensim-SC_OLD-2270b252656146d9d74b84665a7ace6c3139db30.zip
opensim-SC_OLD-2270b252656146d9d74b84665a7ace6c3139db30.tar.gz
opensim-SC_OLD-2270b252656146d9d74b84665a7ace6c3139db30.tar.bz2
opensim-SC_OLD-2270b252656146d9d74b84665a7ace6c3139db30.tar.xz
Thanks, sempuki, for a patch that moves all Grid Server's plugins to
PluginLoader. Fix issue 1871.
Diffstat (limited to 'OpenSim/Grid/AssetServer/Main.cs')
-rw-r--r--OpenSim/Grid/AssetServer/Main.cs37
1 files changed, 10 insertions, 27 deletions
diff --git a/OpenSim/Grid/AssetServer/Main.cs b/OpenSim/Grid/AssetServer/Main.cs
index 7053f72..7c7e39b 100644
--- a/OpenSim/Grid/AssetServer/Main.cs
+++ b/OpenSim/Grid/AssetServer/Main.cs
@@ -53,7 +53,7 @@ namespace OpenSim.Grid.AssetServer
53 // Temporarily hardcoded - should be a plugin 53 // Temporarily hardcoded - should be a plugin
54 protected IAssetLoader assetLoader = new AssetLoaderFileSystem(); 54 protected IAssetLoader assetLoader = new AssetLoaderFileSystem();
55 55
56 private IAssetProvider m_assetProvider; 56 private IAssetProviderPlugin m_assetProvider;
57 57
58 [STAThread] 58 [STAThread]
59 public static void Main(string[] args) 59 public static void Main(string[] args)
@@ -116,36 +116,19 @@ namespace OpenSim.Grid.AssetServer
116 return null; 116 return null;
117 } 117 }
118 118
119 public IAssetProvider LoadDatabasePlugin(string FileName, string connect) 119 public IAssetProviderPlugin LoadDatabasePlugin(string provider, string connect)
120 { 120 {
121 m_log.Info("[ASSET SERVER]: LoadDatabasePlugin: Attempting to load " + FileName); 121 PluginLoader<IAssetProviderPlugin> loader =
122 Assembly pluginAssembly = Assembly.LoadFrom(FileName); 122 new PluginLoader<IAssetProviderPlugin> (new AssetDataInitialiser (connect));
123 IAssetProvider assetPlugin = null;
124 foreach (Type pluginType in pluginAssembly.GetTypes())
125 {
126 if (!pluginType.IsAbstract)
127 {
128 Type typeInterface = pluginType.GetInterface("IAssetProvider", true);
129 123
130 if (typeInterface != null) 124 // loader will try to load all providers (MySQL, MSSQL, etc)
131 { 125 // unless it is constrainted to the correct "Provider" entry in the addin.xml
132 IAssetProvider plug = 126 loader.Add ("/OpenSim/AssetData", new PluginProviderFilter (provider));
133 (IAssetProvider) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); 127 loader.Load();
134 assetPlugin = plug;
135 assetPlugin.Initialise(connect);
136 128
137 m_log.Info("[ASSET SERVER]: Added " + assetPlugin.Name + " " + assetPlugin.Version); 129 return loader.Plugin;
138 break;
139 }
140
141 typeInterface = null;
142 }
143 }
144
145 pluginAssembly = null;
146 return assetPlugin;
147 } 130 }
148 131
149 public void setupDB(AssetConfig config) 132 public void setupDB(AssetConfig config)
150 { 133 {
151 try 134 try