diff options
-rw-r--r-- | OpenSim/Framework/PluginLoader.cs | 67 | ||||
-rw-r--r-- | OpenSim/Grid/GridServer/GridManager.cs | 6 | ||||
-rw-r--r-- | bin/GridInfoPlugin.addin.xml | 2 | ||||
-rw-r--r-- | bin/LoadRegionsPlugin.addin.xml | 2 | ||||
-rw-r--r-- | bin/OpenSim.Data.MSSQL.addin.xml | 4 | ||||
-rw-r--r-- | bin/OpenSim.Data.MySQL.addin.xml | 4 | ||||
-rw-r--r-- | bin/OpenSim.Data.SQLite.addin.xml | 2 | ||||
-rw-r--r-- | bin/OpenSim.Data.addin.xml | 5 | ||||
-rw-r--r-- | bin/OpenSim.Grid.GridServer.addin.xml | 3 | ||||
-rw-r--r-- | bin/OpenSim.addin.xml | 3 | ||||
-rw-r--r-- | bin/RemoteAdminPlugin.addin.xml | 2 | ||||
-rw-r--r-- | bin/RestHandler.addin.xml | 2 | ||||
-rw-r--r-- | bin/RestRegionPlugin.addin.xml | 2 |
13 files changed, 70 insertions, 34 deletions
diff --git a/OpenSim/Framework/PluginLoader.cs b/OpenSim/Framework/PluginLoader.cs index c4602a8..616fa3e 100644 --- a/OpenSim/Framework/PluginLoader.cs +++ b/OpenSim/Framework/PluginLoader.cs | |||
@@ -27,6 +27,7 @@ | |||
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.IO; | 29 | using System.IO; |
30 | using System.Xml; | ||
30 | using System.Collections.Generic; | 31 | using System.Collections.Generic; |
31 | using System.Reflection; | 32 | using System.Reflection; |
32 | using log4net; | 33 | using log4net; |
@@ -61,7 +62,7 @@ namespace OpenSim.Framework | |||
61 | /// </summary> | 62 | /// </summary> |
62 | public interface IPluginFilter | 63 | public interface IPluginFilter |
63 | { | 64 | { |
64 | bool Apply (ExtensionNode plugin); | 65 | bool Apply (PluginExtensionNode plugin); |
65 | } | 66 | } |
66 | 67 | ||
67 | /// <summary> | 68 | /// <summary> |
@@ -152,7 +153,7 @@ namespace OpenSim.Framework | |||
152 | if (filters.ContainsKey (ext)) | 153 | if (filters.ContainsKey (ext)) |
153 | filter = filters [ext]; | 154 | filter = filters [ext]; |
154 | 155 | ||
155 | foreach (TypeExtensionNode node in AddinManager.GetExtensionNodes (ext)) | 156 | foreach (PluginExtensionNode node in AddinManager.GetExtensionNodes (ext)) |
156 | { | 157 | { |
157 | log.Info("[PLUGINS]: Trying plugin " + node.Path); | 158 | log.Info("[PLUGINS]: Trying plugin " + node.Path); |
158 | 159 | ||
@@ -197,9 +198,13 @@ namespace OpenSim.Framework | |||
197 | 198 | ||
198 | private void on_addinloaderror_(object sender, AddinErrorEventArgs args) | 199 | private void on_addinloaderror_(object sender, AddinErrorEventArgs args) |
199 | { | 200 | { |
200 | log.Error ("[PLUGINS]: Plugin Error: " + args.Message | 201 | if (args.Exception == null) |
201 | + ": " + args.Exception.Message | 202 | log.Error ("[PLUGINS]: Plugin Error: " |
202 | + "\n"+ args.Exception.StackTrace); | 203 | + args.Message); |
204 | else | ||
205 | log.Error ("[PLUGINS]: Plugin Error: " | ||
206 | + args.Exception.Message + "\n" | ||
207 | + args.Exception.StackTrace); | ||
203 | } | 208 | } |
204 | 209 | ||
205 | private void clear_registry_ () | 210 | private void clear_registry_ () |
@@ -230,6 +235,39 @@ namespace OpenSim.Framework | |||
230 | } | 235 | } |
231 | } | 236 | } |
232 | 237 | ||
238 | public class PluginExtensionNode : ExtensionNode | ||
239 | { | ||
240 | [NodeAttribute] | ||
241 | string provider; | ||
242 | |||
243 | [NodeAttribute] | ||
244 | string type; | ||
245 | |||
246 | Type typeobj; | ||
247 | |||
248 | public string Provider { get { return provider; } } | ||
249 | public string TypeName { get { return type; } } | ||
250 | |||
251 | public Type TypeObject | ||
252 | { | ||
253 | get | ||
254 | { | ||
255 | if (typeobj != null) | ||
256 | return typeobj; | ||
257 | |||
258 | if (type.Length == 0) | ||
259 | throw new InvalidOperationException ("Type name not specified."); | ||
260 | |||
261 | return typeobj = Addin.GetType (type, true); | ||
262 | } | ||
263 | } | ||
264 | |||
265 | public object CreateInstance () | ||
266 | { | ||
267 | return Activator.CreateInstance (TypeObject); | ||
268 | } | ||
269 | } | ||
270 | |||
233 | /// <summary> | 271 | /// <summary> |
234 | /// Constraint that bounds the number of plugins to be loaded. | 272 | /// Constraint that bounds the number of plugins to be loaded. |
235 | /// </summary> | 273 | /// </summary> |
@@ -271,25 +309,20 @@ namespace OpenSim.Framework | |||
271 | } | 309 | } |
272 | 310 | ||
273 | /// <summary> | 311 | /// <summary> |
274 | /// Filters out which plugin to load based on its "Id", which is name given by the namespace or by Mono.Addins. | 312 | /// Filters out which plugin to load based on its "Provider", which is name given by in the addin.xml |
275 | /// </summary> | 313 | /// </summary> |
276 | public class PluginIdFilter : IPluginFilter | 314 | public class PluginProviderFilter : IPluginFilter |
277 | { | 315 | { |
278 | private string id; | 316 | private string provider; |
279 | 317 | ||
280 | public PluginIdFilter (string id) | 318 | public PluginProviderFilter (string p) |
281 | { | 319 | { |
282 | this.id = id; | 320 | provider = p; |
283 | } | 321 | } |
284 | 322 | ||
285 | public bool Apply (ExtensionNode plugin) | 323 | public bool Apply (PluginExtensionNode plugin) |
286 | { | 324 | { |
287 | System.Console.WriteLine ("[WTF]: " + plugin.Path); | 325 | return (plugin.Provider == provider); |
288 | |||
289 | if (plugin.HasId == false) | ||
290 | return false; | ||
291 | |||
292 | return (plugin.Id == id); | ||
293 | } | 326 | } |
294 | } | 327 | } |
295 | } | 328 | } |
diff --git a/OpenSim/Grid/GridServer/GridManager.cs b/OpenSim/Grid/GridServer/GridManager.cs index ec3ca19..98e670f 100644 --- a/OpenSim/Grid/GridServer/GridManager.cs +++ b/OpenSim/Grid/GridServer/GridManager.cs | |||
@@ -71,9 +71,9 @@ namespace OpenSim.Grid.GridServer | |||
71 | logloader.AddExtensionPoint ("/OpenSim/LogData"); | 71 | logloader.AddExtensionPoint ("/OpenSim/LogData"); |
72 | 72 | ||
73 | // loader will try to load all providers (MySQL, MSSQL, etc) | 73 | // loader will try to load all providers (MySQL, MSSQL, etc) |
74 | // unless it is constrainted to the correct "id" | 74 | // unless it is constrainted to the correct "Provider" entry in the addin.xml |
75 | gridloader.AddFilter ("/OpenSim/GridData", new PluginIdFilter (provider)); | 75 | gridloader.AddFilter ("/OpenSim/GridData", new PluginProviderFilter (provider)); |
76 | logloader.AddFilter ("/OpenSim/LogData", new PluginIdFilter (provider)); | 76 | logloader.AddFilter ("/OpenSim/LogData", new PluginProviderFilter (provider)); |
77 | 77 | ||
78 | gridloader.Load(); | 78 | gridloader.Load(); |
79 | logloader.Load(); | 79 | logloader.Load(); |
diff --git a/bin/GridInfoPlugin.addin.xml b/bin/GridInfoPlugin.addin.xml index ee75817..67cf604 100644 --- a/bin/GridInfoPlugin.addin.xml +++ b/bin/GridInfoPlugin.addin.xml | |||
@@ -6,6 +6,6 @@ | |||
6 | <Addin id="OpenSim" version="0.5" /> | 6 | <Addin id="OpenSim" version="0.5" /> |
7 | </Dependencies> | 7 | </Dependencies> |
8 | <Extension path = "/OpenSim/Startup"> | 8 | <Extension path = "/OpenSim/Startup"> |
9 | <Type type="OpenSim.ApplicationPlugins.GridInfo.GridInfoPlugin" /> | 9 | <Plugin type="OpenSim.ApplicationPlugins.GridInfo.GridInfoPlugin" /> |
10 | </Extension> | 10 | </Extension> |
11 | </Addin> | 11 | </Addin> |
diff --git a/bin/LoadRegionsPlugin.addin.xml b/bin/LoadRegionsPlugin.addin.xml index 7fc3876..a12f91a 100644 --- a/bin/LoadRegionsPlugin.addin.xml +++ b/bin/LoadRegionsPlugin.addin.xml | |||
@@ -6,6 +6,6 @@ | |||
6 | <Addin id="OpenSim" version="0.5" /> | 6 | <Addin id="OpenSim" version="0.5" /> |
7 | </Dependencies> | 7 | </Dependencies> |
8 | <Extension path = "/OpenSim/Startup"> | 8 | <Extension path = "/OpenSim/Startup"> |
9 | <Type type="OpenSim.ApplicationPlugins.LoadRegions.LoadRegionsPlugin" /> | 9 | <Plugin type="OpenSim.ApplicationPlugins.LoadRegions.LoadRegionsPlugin" /> |
10 | </Extension> | 10 | </Extension> |
11 | </Addin> | 11 | </Addin> |
diff --git a/bin/OpenSim.Data.MSSQL.addin.xml b/bin/OpenSim.Data.MSSQL.addin.xml index b85c792..9b05e59 100644 --- a/bin/OpenSim.Data.MSSQL.addin.xml +++ b/bin/OpenSim.Data.MSSQL.addin.xml | |||
@@ -6,9 +6,9 @@ | |||
6 | <Addin id="OpenSim.Data" version="0.5" /> | 6 | <Addin id="OpenSim.Data" version="0.5" /> |
7 | </Dependencies> | 7 | </Dependencies> |
8 | <Extension path = "/OpenSim/GridData"> | 8 | <Extension path = "/OpenSim/GridData"> |
9 | <Type id="OpenSim.Data.MSSQL.dll" type="OpenSim.Data.MSSQL.MSSQLGridData" /> | 9 | <Plugin provider="OpenSim.Data.MSSQL.dll" type="OpenSim.Data.MSSQL.MSSQLGridData" /> |
10 | </Extension> | 10 | </Extension> |
11 | <Extension path = "/OpenSim/LogData"> | 11 | <Extension path = "/OpenSim/LogData"> |
12 | <Type id="OpenSim.Data.MSSQL.dll" type="OpenSim.Data.MSSQL.MSSQLLogData" /> | 12 | <Plugin provider="OpenSim.Data.MSSQL.dll" type="OpenSim.Data.MSSQL.MSSQLLogData" /> |
13 | </Extension> | 13 | </Extension> |
14 | </Addin> | 14 | </Addin> |
diff --git a/bin/OpenSim.Data.MySQL.addin.xml b/bin/OpenSim.Data.MySQL.addin.xml index 6dd4d75..f7372e6 100644 --- a/bin/OpenSim.Data.MySQL.addin.xml +++ b/bin/OpenSim.Data.MySQL.addin.xml | |||
@@ -6,9 +6,9 @@ | |||
6 | <Addin id="OpenSim.Data" version="0.5" /> | 6 | <Addin id="OpenSim.Data" version="0.5" /> |
7 | </Dependencies> | 7 | </Dependencies> |
8 | <Extension path = "/OpenSim/GridData"> | 8 | <Extension path = "/OpenSim/GridData"> |
9 | <Type id="OpenSim.Data.MySQL.dll" type="OpenSim.Data.MySQL.MySQLGridData" /> | 9 | <Plugin provider="OpenSim.Data.MySQL.dll" type="OpenSim.Data.MySQL.MySQLGridData" /> |
10 | </Extension> | 10 | </Extension> |
11 | <Extension path = "/OpenSim/LogData"> | 11 | <Extension path = "/OpenSim/LogData"> |
12 | <Type id="OpenSim.Data.MySQL.dll" type="OpenSim.Data.MySQL.MySQLLogData" /> | 12 | <Plugin provider="OpenSim.Data.MySQL.dll" type="OpenSim.Data.MySQL.MySQLLogData" /> |
13 | </Extension> | 13 | </Extension> |
14 | </Addin> | 14 | </Addin> |
diff --git a/bin/OpenSim.Data.SQLite.addin.xml b/bin/OpenSim.Data.SQLite.addin.xml index ef254dc..1d2f29e 100644 --- a/bin/OpenSim.Data.SQLite.addin.xml +++ b/bin/OpenSim.Data.SQLite.addin.xml | |||
@@ -6,6 +6,6 @@ | |||
6 | <Addin id="OpenSim.Data" version="0.5" /> | 6 | <Addin id="OpenSim.Data" version="0.5" /> |
7 | </Dependencies> | 7 | </Dependencies> |
8 | <Extension path = "/OpenSim/GridData"> | 8 | <Extension path = "/OpenSim/GridData"> |
9 | <Type id="OpenSim.Data.SQLite.dll" type="OpenSim.Data.SQLite.SQLiteGridData" /> | 9 | <Plugin provider="OpenSim.Data.SQLite.dll" type="OpenSim.Data.SQLite.SQLiteGridData" /> |
10 | </Extension> | 10 | </Extension> |
11 | </Addin> | 11 | </Addin> |
diff --git a/bin/OpenSim.Data.addin.xml b/bin/OpenSim.Data.addin.xml index c70c3f7..991f652 100644 --- a/bin/OpenSim.Data.addin.xml +++ b/bin/OpenSim.Data.addin.xml | |||
@@ -2,11 +2,12 @@ | |||
2 | <Runtime> | 2 | <Runtime> |
3 | <Import assembly="OpenSim.Grid.GridServer.exe"/> | 3 | <Import assembly="OpenSim.Grid.GridServer.exe"/> |
4 | <Import assembly="OpenSim.Data.dll"/> | 4 | <Import assembly="OpenSim.Data.dll"/> |
5 | <Import assembly="OpenSim.Framework.dll"/> | ||
5 | </Runtime> | 6 | </Runtime> |
6 | <ExtensionPoint path = "/OpenSim/GridData"> | 7 | <ExtensionPoint path = "/OpenSim/GridData"> |
7 | <ExtensionNode objectType="OpenSim.Data.IGridDataPlugin"/> | 8 | <ExtensionNode name="Plugin" type="OpenSim.Framework.PluginExtensionNode" objectType="OpenSim.Data.IGridDataPlugin"/> |
8 | </ExtensionPoint> | 9 | </ExtensionPoint> |
9 | <ExtensionPoint path = "/OpenSim/LogData"> | 10 | <ExtensionPoint path = "/OpenSim/LogData"> |
10 | <ExtensionNode objectType="OpenSim.Data.ILogDataPlugin"/> | 11 | <ExtensionNode name="Plugin" type="OpenSim.Framework.PluginExtensionNode" objectType="OpenSim.Data.ILogDataPlugin"/> |
11 | </ExtensionPoint> | 12 | </ExtensionPoint> |
12 | </Addin> | 13 | </Addin> |
diff --git a/bin/OpenSim.Grid.GridServer.addin.xml b/bin/OpenSim.Grid.GridServer.addin.xml index 0d44082..85742a1 100644 --- a/bin/OpenSim.Grid.GridServer.addin.xml +++ b/bin/OpenSim.Grid.GridServer.addin.xml | |||
@@ -1,8 +1,9 @@ | |||
1 | <Addin id="OpenSim.Grid.GridServer" isroot="true" version="0.5"> | 1 | <Addin id="OpenSim.Grid.GridServer" isroot="true" version="0.5"> |
2 | <Runtime> | 2 | <Runtime> |
3 | <Import assembly="OpenSim.Grid.GridServer.exe"/> | 3 | <Import assembly="OpenSim.Grid.GridServer.exe"/> |
4 | <Import assembly="OpenSim.Framework.dll"/> | ||
4 | </Runtime> | 5 | </Runtime> |
5 | <ExtensionPoint path = "/OpenSim/GridServer"> | 6 | <ExtensionPoint path = "/OpenSim/GridServer"> |
6 | <ExtensionNode objectType="OpenSim.Grid.GridServer.IGridPlugin"/> | 7 | <ExtensionNode name="Plugin" type="OpenSim.Framework.PluginExtensionNode" objectType="OpenSim.Grid.GridServer.IGridPlugin"/> |
7 | </ExtensionPoint> | 8 | </ExtensionPoint> |
8 | </Addin> | 9 | </Addin> |
diff --git a/bin/OpenSim.addin.xml b/bin/OpenSim.addin.xml index 7f8b258..122a1a8 100644 --- a/bin/OpenSim.addin.xml +++ b/bin/OpenSim.addin.xml | |||
@@ -1,8 +1,9 @@ | |||
1 | <Addin id="OpenSim" isroot="true" version="0.5"> | 1 | <Addin id="OpenSim" isroot="true" version="0.5"> |
2 | <Runtime> | 2 | <Runtime> |
3 | <Import assembly="OpenSim.exe"/> | 3 | <Import assembly="OpenSim.exe"/> |
4 | <Import assembly="OpenSim.Framework.dll"/> | ||
4 | </Runtime> | 5 | </Runtime> |
5 | <ExtensionPoint path = "/OpenSim/Startup"> | 6 | <ExtensionPoint path = "/OpenSim/Startup"> |
6 | <ExtensionNode objectType="OpenSim.IApplicationPlugin"/> | 7 | <ExtensionNode name="Plugin" type="OpenSim.Framework.PluginExtensionNode" objectType="OpenSim.IApplicationPlugin"/> |
7 | </ExtensionPoint> | 8 | </ExtensionPoint> |
8 | </Addin> | 9 | </Addin> |
diff --git a/bin/RemoteAdminPlugin.addin.xml b/bin/RemoteAdminPlugin.addin.xml index cb82ee0..a0b8bee 100644 --- a/bin/RemoteAdminPlugin.addin.xml +++ b/bin/RemoteAdminPlugin.addin.xml | |||
@@ -6,6 +6,6 @@ | |||
6 | <Addin id="OpenSim" version="0.5" /> | 6 | <Addin id="OpenSim" version="0.5" /> |
7 | </Dependencies> | 7 | </Dependencies> |
8 | <Extension path = "/OpenSim/Startup"> | 8 | <Extension path = "/OpenSim/Startup"> |
9 | <Type type="OpenSim.ApplicationPlugins.RemoteController.RemoteAdminPlugin" /> | 9 | <Plugin type="OpenSim.ApplicationPlugins.RemoteController.RemoteAdminPlugin" /> |
10 | </Extension> | 10 | </Extension> |
11 | </Addin> | 11 | </Addin> |
diff --git a/bin/RestHandler.addin.xml b/bin/RestHandler.addin.xml index 1727c3b..33a1484 100644 --- a/bin/RestHandler.addin.xml +++ b/bin/RestHandler.addin.xml | |||
@@ -6,6 +6,6 @@ | |||
6 | <Addin id="OpenSim" version="0.5" /> | 6 | <Addin id="OpenSim" version="0.5" /> |
7 | </Dependencies> | 7 | </Dependencies> |
8 | <Extension path = "/OpenSim/Startup"> | 8 | <Extension path = "/OpenSim/Startup"> |
9 | <Type type="OpenSim.ApplicationPlugins.Rest.Inventory.RestHandler" /> | 9 | <Plugin type="OpenSim.ApplicationPlugins.Rest.Inventory.RestHandler" /> |
10 | </Extension> | 10 | </Extension> |
11 | </Addin> | 11 | </Addin> |
diff --git a/bin/RestRegionPlugin.addin.xml b/bin/RestRegionPlugin.addin.xml index 91a6dd6..9fc8e6b 100644 --- a/bin/RestRegionPlugin.addin.xml +++ b/bin/RestRegionPlugin.addin.xml | |||
@@ -6,6 +6,6 @@ | |||
6 | <Addin id="OpenSim" version="0.5" /> | 6 | <Addin id="OpenSim" version="0.5" /> |
7 | </Dependencies> | 7 | </Dependencies> |
8 | <Extension path = "/OpenSim/Startup"> | 8 | <Extension path = "/OpenSim/Startup"> |
9 | <Type type="OpenSim.ApplicationPlugins.Rest.Regions.RestRegionPlugin" /> | 9 | <Plugin type="OpenSim.ApplicationPlugins.Rest.Regions.RestRegionPlugin" /> |
10 | </Extension> | 10 | </Extension> |
11 | </Addin> | 11 | </Addin> |