diff --git a/OpenSim/Grid/AssetInventoryServer/AssetInventoryServer.cs b/OpenSim/Grid/AssetInventoryServer/AssetInventoryServer.cs index 07cbadefaa..5e8a6f11c0 100644 --- a/OpenSim/Grid/AssetInventoryServer/AssetInventoryServer.cs +++ b/OpenSim/Grid/AssetInventoryServer/AssetInventoryServer.cs @@ -75,15 +75,16 @@ namespace OpenSim.Grid.AssetInventoryServer return false; } - IConfig pluginConfig = ConfigFile.Configs["Plugins"]; - - StorageProvider = LoadAssetInventoryServerPlugin("/OpenSim/AssetInventoryServer/AssetStorageProvider", pluginConfig.GetString("asset_storage_provider")) as IAssetStorageProvider; + StorageProvider = LoadAssetInventoryServerPlugin("/OpenSim/AssetInventoryServer/AssetStorageProvider", + "asset_storage_provider", false) as IAssetStorageProvider; m_backends.Add(StorageProvider); - InventoryProvider = LoadAssetInventoryServerPlugin("/OpenSim/AssetInventoryServer/InventoryStorageProvider", pluginConfig.GetString("inventory_storage_provider")) as IInventoryStorageProvider; + InventoryProvider = LoadAssetInventoryServerPlugin("/OpenSim/AssetInventoryServer/InventoryStorageProvider", + "inventory_storage_provider", false) as IInventoryStorageProvider; m_backends.Add(InventoryProvider); - MetricsProvider = LoadAssetInventoryServerPlugin("/OpenSim/AssetInventoryServer/MetricsProvider", pluginConfig.GetString("metrics_provider")) as IMetricsProvider; + MetricsProvider = LoadAssetInventoryServerPlugin("/OpenSim/AssetInventoryServer/MetricsProvider", + "metrics_provider", false) as IMetricsProvider; m_backends.Add(MetricsProvider); try @@ -97,13 +98,19 @@ namespace OpenSim.Grid.AssetInventoryServer return false; } - AuthenticationProvider = LoadAssetInventoryServerPlugin("/OpenSim/AssetInventoryServer/AuthenticationProvider", pluginConfig.GetString("authentication_provider")) as IAuthenticationProvider; + AuthenticationProvider = LoadAssetInventoryServerPlugin("/OpenSim/AssetInventoryServer/AuthenticationProvider", + "authentication_provider", false) as IAuthenticationProvider; m_backends.Add(AuthenticationProvider); - AuthorizationProvider = LoadAssetInventoryServerPlugin("/OpenSim/AssetInventoryServer/AuthorizationProvider", pluginConfig.GetString("authorization_provider")) as IAuthorizationProvider; + AuthorizationProvider = LoadAssetInventoryServerPlugin("/OpenSim/AssetInventoryServer/AuthorizationProvider", + "authorization_provider", false) as IAuthorizationProvider; m_backends.Add(AuthorizationProvider); - m_frontends.AddRange(LoadAssetInventoryServerPlugins("/OpenSim/AssetInventoryServer/Frontend", pluginConfig.GetString("frontends"))); + m_frontends.AddRange(LoadAssetInventoryServerPlugins("/OpenSim/AssetInventoryServer/Frontend", "frontends")); + + // Inform the user if we don't have any frontends at this point. + if (m_frontends.Count == 0) + m_log.Info("[ASSETINVENTORY]: Starting with no frontends loaded, which isn't extremely useful. Did you set the 'frontends' configuration parameter?"); return true; } @@ -148,32 +155,47 @@ namespace OpenSim.Grid.AssetInventoryServer m_log.Info("[ASSETINVENTORY]: AssetInventory server is listening on port " + port); } - private IAssetInventoryServerPlugin LoadAssetInventoryServerPlugin(string addinPath, string provider) + private IAssetInventoryServerPlugin LoadAssetInventoryServerPlugin(string addinPath, string configParam, bool optional) { - PluginLoader loader = new PluginLoader(new AssetInventoryServerPluginInitialiser(this)); + IAssetInventoryServerPlugin result = null; + List plugins = LoadAssetInventoryServerPlugins(addinPath, configParam); - if (provider == String.Empty) - loader.Add(addinPath); - else - loader.Add(addinPath, new PluginIdFilter(provider)); - //loader.Add(addinPath, new PluginCountConstraint(1)); + if (plugins.Count == 1) + { + result = plugins[0]; + } + else if (plugins.Count > 1) + { + m_log.ErrorFormat("[ASSETINVENTORY]: Only 1 plugin expected for extension point '{0}', {1} plugins loaded. Check the '{2}' parameter in the config file.", + addinPath, plugins.Count, configParam); + Shutdown(); + Environment.Exit(0); + } + else if (!optional) + { + m_log.ErrorFormat("[ASSETINVENTORY]: The extension point '{0}' is not optional. Check the '{1}' parameter in the config file.", addinPath, configParam); + Shutdown(); + Environment.Exit(0); + } - loader.Load(); - - return loader.Plugin; + return result; } - private List LoadAssetInventoryServerPlugins(string addinPath, string provider) + private List LoadAssetInventoryServerPlugins(string addinPath, string configParam) { PluginLoader loader = new PluginLoader(new AssetInventoryServerPluginInitialiser(this)); + loader.Add(addinPath, new PluginIdFilter(ConfigFile.Configs["Plugins"].GetString(configParam))); - if (provider == String.Empty) - loader.Add(addinPath); - else - loader.Add(addinPath, new PluginIdFilter(provider)); - //loader.Add(addinPath, new PluginCountConstraint(1)); - - loader.Load(); + try + { + loader.Load(); + } + catch (PluginNotInitialisedException e) + { + m_log.ErrorFormat("[ASSETINVENTORY]: Error initialising plugin '{0}' for extension point '{1}'.", e.Message, addinPath); + Shutdown(); + Environment.Exit(0); + } return loader.Plugins; } diff --git a/OpenSim/Grid/AssetInventoryServer/Plugins/AuthorizeAllPlugin.cs b/OpenSim/Grid/AssetInventoryServer/Plugins/AuthorizeAllPlugin.cs index 9e3a421e94..7fd1ee8d03 100644 --- a/OpenSim/Grid/AssetInventoryServer/Plugins/AuthorizeAllPlugin.cs +++ b/OpenSim/Grid/AssetInventoryServer/Plugins/AuthorizeAllPlugin.cs @@ -74,7 +74,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins public string Name { - get { return "AssetInventoryServer Authorize All"; } + get { return "AuthorizeAll"; } } #endregion IPlugin implementation diff --git a/OpenSim/Grid/AssetInventoryServer/Plugins/BrowseFrontendPlugin.cs b/OpenSim/Grid/AssetInventoryServer/Plugins/BrowseFrontendPlugin.cs index 6c9861228d..4ed8d876cc 100644 --- a/OpenSim/Grid/AssetInventoryServer/Plugins/BrowseFrontendPlugin.cs +++ b/OpenSim/Grid/AssetInventoryServer/Plugins/BrowseFrontendPlugin.cs @@ -83,7 +83,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins public string Name { - get { return "AssetInventoryServer Browse asset frontend"; } + get { return "BrowseFrontend"; } } #endregion IPlugin implementation diff --git a/OpenSim/Grid/AssetInventoryServer/Plugins/NullAuthenticationPlugin.cs b/OpenSim/Grid/AssetInventoryServer/Plugins/NullAuthenticationPlugin.cs index 1fbe78063d..e958591ef1 100644 --- a/OpenSim/Grid/AssetInventoryServer/Plugins/NullAuthenticationPlugin.cs +++ b/OpenSim/Grid/AssetInventoryServer/Plugins/NullAuthenticationPlugin.cs @@ -74,7 +74,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins public string Name { - get { return "AssetInventoryServer Null authentication"; } + get { return "NullAuthentication"; } } #endregion IPlugin implementation diff --git a/OpenSim/Grid/AssetInventoryServer/Plugins/NullMetricsPlugin.cs b/OpenSim/Grid/AssetInventoryServer/Plugins/NullMetricsPlugin.cs index eef98dc05d..84e526a12a 100644 --- a/OpenSim/Grid/AssetInventoryServer/Plugins/NullMetricsPlugin.cs +++ b/OpenSim/Grid/AssetInventoryServer/Plugins/NullMetricsPlugin.cs @@ -145,7 +145,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins public string Name { - get { return "AssetInventoryServer Null Metrics"; } + get { return "NullMetrics"; } } #endregion IPlugin implementation diff --git a/OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/OpenSimAssetFrontendPlugin.cs b/OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/OpenSimAssetFrontendPlugin.cs index d2a87e6376..887ab681be 100644 --- a/OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/OpenSimAssetFrontendPlugin.cs +++ b/OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/OpenSimAssetFrontendPlugin.cs @@ -86,7 +86,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim public string Name { - get { return "AssetInventoryServer OpenSim asset frontend"; } + get { return "OpenSimAssetFrontend"; } } #endregion IPlugin implementation diff --git a/OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/OpenSimAssetStoragePlugin.cs b/OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/OpenSimAssetStoragePlugin.cs index 69dcff3a41..ad68c5734a 100644 --- a/OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/OpenSimAssetStoragePlugin.cs +++ b/OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/OpenSimAssetStoragePlugin.cs @@ -183,6 +183,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim catch (Exception e) { m_log.WarnFormat("[OPENSIMASSETSTORAGE]: Failure loading data plugin: {0}", e.ToString()); + throw new PluginNotInitialisedException(Name); } } @@ -206,7 +207,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim public string Name { - get { return "AssetInventoryServer OpenSim asset storage provider"; } + get { return "OpenSimAssetStorage"; } } #endregion IPlugin implementation diff --git a/OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/OpenSimInventoryFrontendPlugin.cs b/OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/OpenSimInventoryFrontendPlugin.cs index 76d712299b..5e7f0c6d5d 100644 --- a/OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/OpenSimInventoryFrontendPlugin.cs +++ b/OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/OpenSimInventoryFrontendPlugin.cs @@ -91,7 +91,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim public string Name { - get { return "AssetInventoryServer OpenSim inventory frontend"; } + get { return "OpenSimInventoryFrontend"; } } #endregion IPlugin implementation diff --git a/OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/OpenSimInventoryStoragePlugin.cs b/OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/OpenSimInventoryStoragePlugin.cs index 2f5d2ca5c5..1ead422b71 100644 --- a/OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/OpenSimInventoryStoragePlugin.cs +++ b/OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/OpenSimInventoryStoragePlugin.cs @@ -815,6 +815,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim catch (Exception e) { m_log.WarnFormat("[OPENSIMINVENTORYSTORAGE]: Failure loading data plugin: {0}", e.ToString()); + throw new PluginNotInitialisedException(Name); } } @@ -839,7 +840,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim public string Name { - get { return "AssetInventoryServer OpenSim inventory storage provider"; } + get { return "OpenSimInventoryStorage"; } } #endregion IPlugin implementation diff --git a/OpenSim/Grid/AssetInventoryServer/Plugins/ReferenceFrontendPlugin.cs b/OpenSim/Grid/AssetInventoryServer/Plugins/ReferenceFrontendPlugin.cs index af10393bd5..f4111279c1 100644 --- a/OpenSim/Grid/AssetInventoryServer/Plugins/ReferenceFrontendPlugin.cs +++ b/OpenSim/Grid/AssetInventoryServer/Plugins/ReferenceFrontendPlugin.cs @@ -87,7 +87,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins public string Name { - get { return "AssetInventoryServer Reference asset frontend"; } + get { return "ReferenceFrontend"; } } #endregion IPlugin implementation diff --git a/OpenSim/Grid/AssetInventoryServer/Plugins/Simple/SimpleAssetStoragePlugin.cs b/OpenSim/Grid/AssetInventoryServer/Plugins/Simple/SimpleAssetStoragePlugin.cs index 26c34e9984..4e5526b3a1 100644 --- a/OpenSim/Grid/AssetInventoryServer/Plugins/Simple/SimpleAssetStoragePlugin.cs +++ b/OpenSim/Grid/AssetInventoryServer/Plugins/Simple/SimpleAssetStoragePlugin.cs @@ -229,7 +229,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.Simple public string Name { - get { return "AssetInventoryServer Simple asset storage provider"; } + get { return "SimpleAssetStorage"; } } #endregion IPlugin implementation diff --git a/OpenSim/Grid/AssetInventoryServer/Plugins/Simple/SimpleInventoryStoragePlugin.cs b/OpenSim/Grid/AssetInventoryServer/Plugins/Simple/SimpleInventoryStoragePlugin.cs index fee8837487..a48be2e707 100644 --- a/OpenSim/Grid/AssetInventoryServer/Plugins/Simple/SimpleInventoryStoragePlugin.cs +++ b/OpenSim/Grid/AssetInventoryServer/Plugins/Simple/SimpleInventoryStoragePlugin.cs @@ -619,7 +619,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.Simple public string Name { - get { return "AssetInventoryServer Simple inventory storage provider"; } + get { return "SimpleInventoryStorage"; } } #endregion IPlugin implementation diff --git a/bin/AssetInventoryServer.ini.example b/bin/AssetInventoryServer.ini.example index a004818f4d..619495c81d 100644 --- a/bin/AssetInventoryServer.ini.example +++ b/bin/AssetInventoryServer.ini.example @@ -101,12 +101,12 @@ frontends = ReferenceFrontend,OpenSimAssetFrontend,OpenSimInventoryFrontend,Brow ; The database provider determines which database to use. Any database backend ; supported by OpenSim is supported. -;asset_database_provider = "OpenSim.Data.SQLite.dll" -asset_database_provider = "OpenSim.Data.MySQL.dll" +asset_database_provider = "OpenSim.Data.SQLite.dll" +;asset_database_provider = "OpenSim.Data.MySQL.dll" ;asset_database_provider = "OpenSim.Data.NHibernate.dll" -;inventory_database_provider = "OpenSim.Data.SQLite.dll" -inventory_database_provider = "OpenSim.Data.MySQL.dll" +inventory_database_provider = "OpenSim.Data.SQLite.dll" +;inventory_database_provider = "OpenSim.Data.MySQL.dll" ;inventory_database_provider = "OpenSim.Data.NHibernate.dll" ; Database connection string used by the OpenSim MySQL backend. If these lines @@ -117,12 +117,12 @@ inventory_database_provider = "OpenSim.Data.MySQL.dll" ; modification. ; For SQLite -;asset_database_connect = "URI=file:Asset.db,version=3" -;inventory_database_connect = "URI=file:Inventory.db,version=3" +asset_database_connect = "URI=file:Asset.db,version=3" +inventory_database_connect = "URI=file:Inventory.db,version=3" ; For MySQL -asset_database_connect = "Server=localhost; Database=opensim; User=changeme; Password=changeme;" -inventory_database_connect = "Server=localhost; Database=opensim; User=changeme; Password=changeme;" +;asset_database_connect = "Server=localhost; Database=opensim; User=changeme; Password=changeme;" +;inventory_database_connect = "Server=localhost; Database=opensim; User=changeme; Password=changeme;" ; For NHibernate ;asset_database_connect = "SQLiteDialect;SQLite20Driver;Data Source=file:Asset.db;Version=3"