From 529dd66ed01f598696ef8d20b465b911931d6fe8 Mon Sep 17 00:00:00 2001 From: Mike Mazur Date: Mon, 16 Feb 2009 02:27:34 +0000 Subject: - remove dependency on ExtensionLoader.dll (DBConnString.cs can go) - bring config system in line with other servers - add new plugin filter class which filters on ID - update AssetInventoryServer.ini file --- OpenSim/Framework/PluginLoader.cs | 48 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 47 insertions(+), 1 deletion(-) (limited to 'OpenSim/Framework/PluginLoader.cs') diff --git a/OpenSim/Framework/PluginLoader.cs b/OpenSim/Framework/PluginLoader.cs index 15e0b9f..b586fe3 100644 --- a/OpenSim/Framework/PluginLoader.cs +++ b/OpenSim/Framework/PluginLoader.cs @@ -278,6 +278,9 @@ namespace OpenSim.Framework public class PluginExtensionNode : ExtensionNode { [NodeAttribute] + string id = ""; + + [NodeAttribute] string provider = ""; [NodeAttribute] @@ -285,6 +288,7 @@ namespace OpenSim.Framework Type typeobj; + public string ID { get { return id; } } public string Provider { get { return provider; } } public string TypeName { get { return type; } } @@ -349,7 +353,7 @@ namespace OpenSim.Framework } /// - /// Filters out which plugin to load based on its the plugin name or names given. Plugin names are contained in + /// Filters out which plugin to load based on the plugin name or names given. Plugin names are contained in /// their addin.xml /// public class PluginProviderFilter : IPluginFilter @@ -390,4 +394,46 @@ namespace OpenSim.Framework return false; } } + + /// + /// Filters plugins according to their ID. Plugin IDs are contained in their addin.xml + /// + public class PluginIdFilter : IPluginFilter + { + private string[] m_filters; + + /// + /// Constructor. + /// + /// + /// Plugin ID or IDs on which to filter. Multiple names should be separated by commas. + /// + public PluginIdFilter(string p) + { + m_filters = p.Split(','); + + for (int i = 0; i < m_filters.Length; i++) + { + m_filters[i] = m_filters[i].Trim(); + } + } + + /// + /// Apply this filter to . + /// + /// PluginExtensionNode instance to check whether it passes the filter. + /// true if the plugin's ID matches one of the filters, false otherwise. + public bool Apply (PluginExtensionNode plugin) + { + for (int i = 0; i < m_filters.Length; i++) + { + if (m_filters[i] == plugin.ID) + { + return true; + } + } + + return false; + } + } } -- cgit v1.1