- add restrictions and error handling to plugin loading in
AssetInventoryServer - assign shorter names to each AssetInventory plugin - modify AssetInventoryServer.ini.example file so it works out of the box0.6.3-post-fixes
parent
efbb44b98a
commit
e41f761e0d
|
@ -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<IAssetInventoryServerPlugin> loader = new PluginLoader<IAssetInventoryServerPlugin>(new AssetInventoryServerPluginInitialiser(this));
|
||||
IAssetInventoryServerPlugin result = null;
|
||||
List<IAssetInventoryServerPlugin> plugins = LoadAssetInventoryServerPlugins(addinPath, configParam);
|
||||
|
||||
if (provider == String.Empty)
|
||||
loader.Add(addinPath);
|
||||
else
|
||||
loader.Add(addinPath, new PluginIdFilter(provider));
|
||||
//loader.Add(addinPath, new PluginCountConstraint(1));
|
||||
|
||||
loader.Load();
|
||||
|
||||
return loader.Plugin;
|
||||
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);
|
||||
}
|
||||
|
||||
private List<IAssetInventoryServerPlugin> LoadAssetInventoryServerPlugins(string addinPath, string provider)
|
||||
return result;
|
||||
}
|
||||
|
||||
private List<IAssetInventoryServerPlugin> LoadAssetInventoryServerPlugins(string addinPath, string configParam)
|
||||
{
|
||||
PluginLoader<IAssetInventoryServerPlugin> loader = new PluginLoader<IAssetInventoryServerPlugin>(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));
|
||||
|
||||
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;
|
||||
}
|
||||
|
|
|
@ -74,7 +74,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins
|
|||
|
||||
public string Name
|
||||
{
|
||||
get { return "AssetInventoryServer Authorize All"; }
|
||||
get { return "AuthorizeAll"; }
|
||||
}
|
||||
|
||||
#endregion IPlugin implementation
|
||||
|
|
|
@ -83,7 +83,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins
|
|||
|
||||
public string Name
|
||||
{
|
||||
get { return "AssetInventoryServer Browse asset frontend"; }
|
||||
get { return "BrowseFrontend"; }
|
||||
}
|
||||
|
||||
#endregion IPlugin implementation
|
||||
|
|
|
@ -74,7 +74,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins
|
|||
|
||||
public string Name
|
||||
{
|
||||
get { return "AssetInventoryServer Null authentication"; }
|
||||
get { return "NullAuthentication"; }
|
||||
}
|
||||
|
||||
#endregion IPlugin implementation
|
||||
|
|
|
@ -145,7 +145,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins
|
|||
|
||||
public string Name
|
||||
{
|
||||
get { return "AssetInventoryServer Null Metrics"; }
|
||||
get { return "NullMetrics"; }
|
||||
}
|
||||
|
||||
#endregion IPlugin implementation
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -87,7 +87,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins
|
|||
|
||||
public string Name
|
||||
{
|
||||
get { return "AssetInventoryServer Reference asset frontend"; }
|
||||
get { return "ReferenceFrontend"; }
|
||||
}
|
||||
|
||||
#endregion IPlugin implementation
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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"
|
||||
|
|
Loading…
Reference in New Issue