diff options
Diffstat (limited to 'OpenSim/Grid/AssetInventoryServer/AssetInventoryServer.cs')
-rw-r--r-- | OpenSim/Grid/AssetInventoryServer/AssetInventoryServer.cs | 74 |
1 files changed, 48 insertions, 26 deletions
diff --git a/OpenSim/Grid/AssetInventoryServer/AssetInventoryServer.cs b/OpenSim/Grid/AssetInventoryServer/AssetInventoryServer.cs index 07cbade..5e8a6f1 100644 --- a/OpenSim/Grid/AssetInventoryServer/AssetInventoryServer.cs +++ b/OpenSim/Grid/AssetInventoryServer/AssetInventoryServer.cs | |||
@@ -75,15 +75,16 @@ namespace OpenSim.Grid.AssetInventoryServer | |||
75 | return false; | 75 | return false; |
76 | } | 76 | } |
77 | 77 | ||
78 | IConfig pluginConfig = ConfigFile.Configs["Plugins"]; | 78 | StorageProvider = LoadAssetInventoryServerPlugin("/OpenSim/AssetInventoryServer/AssetStorageProvider", |
79 | 79 | "asset_storage_provider", false) as IAssetStorageProvider; | |
80 | StorageProvider = LoadAssetInventoryServerPlugin("/OpenSim/AssetInventoryServer/AssetStorageProvider", pluginConfig.GetString("asset_storage_provider")) as IAssetStorageProvider; | ||
81 | m_backends.Add(StorageProvider); | 80 | m_backends.Add(StorageProvider); |
82 | 81 | ||
83 | InventoryProvider = LoadAssetInventoryServerPlugin("/OpenSim/AssetInventoryServer/InventoryStorageProvider", pluginConfig.GetString("inventory_storage_provider")) as IInventoryStorageProvider; | 82 | InventoryProvider = LoadAssetInventoryServerPlugin("/OpenSim/AssetInventoryServer/InventoryStorageProvider", |
83 | "inventory_storage_provider", false) as IInventoryStorageProvider; | ||
84 | m_backends.Add(InventoryProvider); | 84 | m_backends.Add(InventoryProvider); |
85 | 85 | ||
86 | MetricsProvider = LoadAssetInventoryServerPlugin("/OpenSim/AssetInventoryServer/MetricsProvider", pluginConfig.GetString("metrics_provider")) as IMetricsProvider; | 86 | MetricsProvider = LoadAssetInventoryServerPlugin("/OpenSim/AssetInventoryServer/MetricsProvider", |
87 | "metrics_provider", false) as IMetricsProvider; | ||
87 | m_backends.Add(MetricsProvider); | 88 | m_backends.Add(MetricsProvider); |
88 | 89 | ||
89 | try | 90 | try |
@@ -97,13 +98,19 @@ namespace OpenSim.Grid.AssetInventoryServer | |||
97 | return false; | 98 | return false; |
98 | } | 99 | } |
99 | 100 | ||
100 | AuthenticationProvider = LoadAssetInventoryServerPlugin("/OpenSim/AssetInventoryServer/AuthenticationProvider", pluginConfig.GetString("authentication_provider")) as IAuthenticationProvider; | 101 | AuthenticationProvider = LoadAssetInventoryServerPlugin("/OpenSim/AssetInventoryServer/AuthenticationProvider", |
102 | "authentication_provider", false) as IAuthenticationProvider; | ||
101 | m_backends.Add(AuthenticationProvider); | 103 | m_backends.Add(AuthenticationProvider); |
102 | 104 | ||
103 | AuthorizationProvider = LoadAssetInventoryServerPlugin("/OpenSim/AssetInventoryServer/AuthorizationProvider", pluginConfig.GetString("authorization_provider")) as IAuthorizationProvider; | 105 | AuthorizationProvider = LoadAssetInventoryServerPlugin("/OpenSim/AssetInventoryServer/AuthorizationProvider", |
106 | "authorization_provider", false) as IAuthorizationProvider; | ||
104 | m_backends.Add(AuthorizationProvider); | 107 | m_backends.Add(AuthorizationProvider); |
105 | 108 | ||
106 | m_frontends.AddRange(LoadAssetInventoryServerPlugins("/OpenSim/AssetInventoryServer/Frontend", pluginConfig.GetString("frontends"))); | 109 | m_frontends.AddRange(LoadAssetInventoryServerPlugins("/OpenSim/AssetInventoryServer/Frontend", "frontends")); |
110 | |||
111 | // Inform the user if we don't have any frontends at this point. | ||
112 | if (m_frontends.Count == 0) | ||
113 | m_log.Info("[ASSETINVENTORY]: Starting with no frontends loaded, which isn't extremely useful. Did you set the 'frontends' configuration parameter?"); | ||
107 | 114 | ||
108 | return true; | 115 | return true; |
109 | } | 116 | } |
@@ -148,32 +155,47 @@ namespace OpenSim.Grid.AssetInventoryServer | |||
148 | m_log.Info("[ASSETINVENTORY]: AssetInventory server is listening on port " + port); | 155 | m_log.Info("[ASSETINVENTORY]: AssetInventory server is listening on port " + port); |
149 | } | 156 | } |
150 | 157 | ||
151 | private IAssetInventoryServerPlugin LoadAssetInventoryServerPlugin(string addinPath, string provider) | 158 | private IAssetInventoryServerPlugin LoadAssetInventoryServerPlugin(string addinPath, string configParam, bool optional) |
152 | { | 159 | { |
153 | PluginLoader<IAssetInventoryServerPlugin> loader = new PluginLoader<IAssetInventoryServerPlugin>(new AssetInventoryServerPluginInitialiser(this)); | 160 | IAssetInventoryServerPlugin result = null; |
161 | List<IAssetInventoryServerPlugin> plugins = LoadAssetInventoryServerPlugins(addinPath, configParam); | ||
154 | 162 | ||
155 | if (provider == String.Empty) | 163 | if (plugins.Count == 1) |
156 | loader.Add(addinPath); | 164 | { |
157 | else | 165 | result = plugins[0]; |
158 | loader.Add(addinPath, new PluginIdFilter(provider)); | 166 | } |
159 | //loader.Add(addinPath, new PluginCountConstraint(1)); | 167 | else if (plugins.Count > 1) |
160 | 168 | { | |
161 | loader.Load(); | 169 | m_log.ErrorFormat("[ASSETINVENTORY]: Only 1 plugin expected for extension point '{0}', {1} plugins loaded. Check the '{2}' parameter in the config file.", |
170 | addinPath, plugins.Count, configParam); | ||
171 | Shutdown(); | ||
172 | Environment.Exit(0); | ||
173 | } | ||
174 | else if (!optional) | ||
175 | { | ||
176 | m_log.ErrorFormat("[ASSETINVENTORY]: The extension point '{0}' is not optional. Check the '{1}' parameter in the config file.", addinPath, configParam); | ||
177 | Shutdown(); | ||
178 | Environment.Exit(0); | ||
179 | } | ||
162 | 180 | ||
163 | return loader.Plugin; | 181 | return result; |
164 | } | 182 | } |
165 | 183 | ||
166 | private List<IAssetInventoryServerPlugin> LoadAssetInventoryServerPlugins(string addinPath, string provider) | 184 | private List<IAssetInventoryServerPlugin> LoadAssetInventoryServerPlugins(string addinPath, string configParam) |
167 | { | 185 | { |
168 | PluginLoader<IAssetInventoryServerPlugin> loader = new PluginLoader<IAssetInventoryServerPlugin>(new AssetInventoryServerPluginInitialiser(this)); | 186 | PluginLoader<IAssetInventoryServerPlugin> loader = new PluginLoader<IAssetInventoryServerPlugin>(new AssetInventoryServerPluginInitialiser(this)); |
187 | loader.Add(addinPath, new PluginIdFilter(ConfigFile.Configs["Plugins"].GetString(configParam))); | ||
169 | 188 | ||
170 | if (provider == String.Empty) | 189 | try |
171 | loader.Add(addinPath); | 190 | { |
172 | else | 191 | loader.Load(); |
173 | loader.Add(addinPath, new PluginIdFilter(provider)); | 192 | } |
174 | //loader.Add(addinPath, new PluginCountConstraint(1)); | 193 | catch (PluginNotInitialisedException e) |
175 | 194 | { | |
176 | loader.Load(); | 195 | m_log.ErrorFormat("[ASSETINVENTORY]: Error initialising plugin '{0}' for extension point '{1}'.", e.Message, addinPath); |
196 | Shutdown(); | ||
197 | Environment.Exit(0); | ||
198 | } | ||
177 | 199 | ||
178 | return loader.Plugins; | 200 | return loader.Plugins; |
179 | } | 201 | } |