aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorMike Mazur2009-02-16 02:28:51 +0000
committerMike Mazur2009-02-16 02:28:51 +0000
commite41f761e0d808f39d58766cb8f888cda3b5a6043 (patch)
treea00b2349f5e1fcfde0c23471fbdf0a238cc29370
parentStandardize logging messages. (diff)
downloadopensim-SC_OLD-e41f761e0d808f39d58766cb8f888cda3b5a6043.zip
opensim-SC_OLD-e41f761e0d808f39d58766cb8f888cda3b5a6043.tar.gz
opensim-SC_OLD-e41f761e0d808f39d58766cb8f888cda3b5a6043.tar.bz2
opensim-SC_OLD-e41f761e0d808f39d58766cb8f888cda3b5a6043.tar.xz
- 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 box
-rw-r--r--OpenSim/Grid/AssetInventoryServer/AssetInventoryServer.cs74
-rw-r--r--OpenSim/Grid/AssetInventoryServer/Plugins/AuthorizeAllPlugin.cs2
-rw-r--r--OpenSim/Grid/AssetInventoryServer/Plugins/BrowseFrontendPlugin.cs2
-rw-r--r--OpenSim/Grid/AssetInventoryServer/Plugins/NullAuthenticationPlugin.cs2
-rw-r--r--OpenSim/Grid/AssetInventoryServer/Plugins/NullMetricsPlugin.cs2
-rw-r--r--OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/OpenSimAssetFrontendPlugin.cs2
-rw-r--r--OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/OpenSimAssetStoragePlugin.cs3
-rw-r--r--OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/OpenSimInventoryFrontendPlugin.cs2
-rw-r--r--OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/OpenSimInventoryStoragePlugin.cs3
-rw-r--r--OpenSim/Grid/AssetInventoryServer/Plugins/ReferenceFrontendPlugin.cs2
-rw-r--r--OpenSim/Grid/AssetInventoryServer/Plugins/Simple/SimpleAssetStoragePlugin.cs2
-rw-r--r--OpenSim/Grid/AssetInventoryServer/Plugins/Simple/SimpleInventoryStoragePlugin.cs2
-rw-r--r--bin/AssetInventoryServer.ini.example16
13 files changed, 69 insertions, 45 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 }
diff --git a/OpenSim/Grid/AssetInventoryServer/Plugins/AuthorizeAllPlugin.cs b/OpenSim/Grid/AssetInventoryServer/Plugins/AuthorizeAllPlugin.cs
index 9e3a421..7fd1ee8 100644
--- a/OpenSim/Grid/AssetInventoryServer/Plugins/AuthorizeAllPlugin.cs
+++ b/OpenSim/Grid/AssetInventoryServer/Plugins/AuthorizeAllPlugin.cs
@@ -74,7 +74,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins
74 74
75 public string Name 75 public string Name
76 { 76 {
77 get { return "AssetInventoryServer Authorize All"; } 77 get { return "AuthorizeAll"; }
78 } 78 }
79 79
80 #endregion IPlugin implementation 80 #endregion IPlugin implementation
diff --git a/OpenSim/Grid/AssetInventoryServer/Plugins/BrowseFrontendPlugin.cs b/OpenSim/Grid/AssetInventoryServer/Plugins/BrowseFrontendPlugin.cs
index 6c98612..4ed8d87 100644
--- a/OpenSim/Grid/AssetInventoryServer/Plugins/BrowseFrontendPlugin.cs
+++ b/OpenSim/Grid/AssetInventoryServer/Plugins/BrowseFrontendPlugin.cs
@@ -83,7 +83,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins
83 83
84 public string Name 84 public string Name
85 { 85 {
86 get { return "AssetInventoryServer Browse asset frontend"; } 86 get { return "BrowseFrontend"; }
87 } 87 }
88 88
89 #endregion IPlugin implementation 89 #endregion IPlugin implementation
diff --git a/OpenSim/Grid/AssetInventoryServer/Plugins/NullAuthenticationPlugin.cs b/OpenSim/Grid/AssetInventoryServer/Plugins/NullAuthenticationPlugin.cs
index 1fbe780..e958591 100644
--- a/OpenSim/Grid/AssetInventoryServer/Plugins/NullAuthenticationPlugin.cs
+++ b/OpenSim/Grid/AssetInventoryServer/Plugins/NullAuthenticationPlugin.cs
@@ -74,7 +74,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins
74 74
75 public string Name 75 public string Name
76 { 76 {
77 get { return "AssetInventoryServer Null authentication"; } 77 get { return "NullAuthentication"; }
78 } 78 }
79 79
80 #endregion IPlugin implementation 80 #endregion IPlugin implementation
diff --git a/OpenSim/Grid/AssetInventoryServer/Plugins/NullMetricsPlugin.cs b/OpenSim/Grid/AssetInventoryServer/Plugins/NullMetricsPlugin.cs
index eef98dc..84e526a 100644
--- a/OpenSim/Grid/AssetInventoryServer/Plugins/NullMetricsPlugin.cs
+++ b/OpenSim/Grid/AssetInventoryServer/Plugins/NullMetricsPlugin.cs
@@ -145,7 +145,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins
145 145
146 public string Name 146 public string Name
147 { 147 {
148 get { return "AssetInventoryServer Null Metrics"; } 148 get { return "NullMetrics"; }
149 } 149 }
150 150
151 #endregion IPlugin implementation 151 #endregion IPlugin implementation
diff --git a/OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/OpenSimAssetFrontendPlugin.cs b/OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/OpenSimAssetFrontendPlugin.cs
index d2a87e6..887ab68 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
86 86
87 public string Name 87 public string Name
88 { 88 {
89 get { return "AssetInventoryServer OpenSim asset frontend"; } 89 get { return "OpenSimAssetFrontend"; }
90 } 90 }
91 91
92 #endregion IPlugin implementation 92 #endregion IPlugin implementation
diff --git a/OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/OpenSimAssetStoragePlugin.cs b/OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/OpenSimAssetStoragePlugin.cs
index 69dcff3..ad68c57 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
183 catch (Exception e) 183 catch (Exception e)
184 { 184 {
185 m_log.WarnFormat("[OPENSIMASSETSTORAGE]: Failure loading data plugin: {0}", e.ToString()); 185 m_log.WarnFormat("[OPENSIMASSETSTORAGE]: Failure loading data plugin: {0}", e.ToString());
186 throw new PluginNotInitialisedException(Name);
186 } 187 }
187 } 188 }
188 189
@@ -206,7 +207,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
206 207
207 public string Name 208 public string Name
208 { 209 {
209 get { return "AssetInventoryServer OpenSim asset storage provider"; } 210 get { return "OpenSimAssetStorage"; }
210 } 211 }
211 212
212 #endregion IPlugin implementation 213 #endregion IPlugin implementation
diff --git a/OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/OpenSimInventoryFrontendPlugin.cs b/OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/OpenSimInventoryFrontendPlugin.cs
index 76d7122..5e7f0c6 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
91 91
92 public string Name 92 public string Name
93 { 93 {
94 get { return "AssetInventoryServer OpenSim inventory frontend"; } 94 get { return "OpenSimInventoryFrontend"; }
95 } 95 }
96 96
97 #endregion IPlugin implementation 97 #endregion IPlugin implementation
diff --git a/OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/OpenSimInventoryStoragePlugin.cs b/OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/OpenSimInventoryStoragePlugin.cs
index 2f5d2ca..1ead422 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
815 catch (Exception e) 815 catch (Exception e)
816 { 816 {
817 m_log.WarnFormat("[OPENSIMINVENTORYSTORAGE]: Failure loading data plugin: {0}", e.ToString()); 817 m_log.WarnFormat("[OPENSIMINVENTORYSTORAGE]: Failure loading data plugin: {0}", e.ToString());
818 throw new PluginNotInitialisedException(Name);
818 } 819 }
819 } 820 }
820 821
@@ -839,7 +840,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
839 840
840 public string Name 841 public string Name
841 { 842 {
842 get { return "AssetInventoryServer OpenSim inventory storage provider"; } 843 get { return "OpenSimInventoryStorage"; }
843 } 844 }
844 845
845 #endregion IPlugin implementation 846 #endregion IPlugin implementation
diff --git a/OpenSim/Grid/AssetInventoryServer/Plugins/ReferenceFrontendPlugin.cs b/OpenSim/Grid/AssetInventoryServer/Plugins/ReferenceFrontendPlugin.cs
index af10393..f411127 100644
--- a/OpenSim/Grid/AssetInventoryServer/Plugins/ReferenceFrontendPlugin.cs
+++ b/OpenSim/Grid/AssetInventoryServer/Plugins/ReferenceFrontendPlugin.cs
@@ -87,7 +87,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins
87 87
88 public string Name 88 public string Name
89 { 89 {
90 get { return "AssetInventoryServer Reference asset frontend"; } 90 get { return "ReferenceFrontend"; }
91 } 91 }
92 92
93 #endregion IPlugin implementation 93 #endregion IPlugin implementation
diff --git a/OpenSim/Grid/AssetInventoryServer/Plugins/Simple/SimpleAssetStoragePlugin.cs b/OpenSim/Grid/AssetInventoryServer/Plugins/Simple/SimpleAssetStoragePlugin.cs
index 26c34e9..4e5526b 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
229 229
230 public string Name 230 public string Name
231 { 231 {
232 get { return "AssetInventoryServer Simple asset storage provider"; } 232 get { return "SimpleAssetStorage"; }
233 } 233 }
234 234
235 #endregion IPlugin implementation 235 #endregion IPlugin implementation
diff --git a/OpenSim/Grid/AssetInventoryServer/Plugins/Simple/SimpleInventoryStoragePlugin.cs b/OpenSim/Grid/AssetInventoryServer/Plugins/Simple/SimpleInventoryStoragePlugin.cs
index fee8837..a48be2e 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
619 619
620 public string Name 620 public string Name
621 { 621 {
622 get { return "AssetInventoryServer Simple inventory storage provider"; } 622 get { return "SimpleInventoryStorage"; }
623 } 623 }
624 624
625 #endregion IPlugin implementation 625 #endregion IPlugin implementation
diff --git a/bin/AssetInventoryServer.ini.example b/bin/AssetInventoryServer.ini.example
index a004818..619495c 100644
--- a/bin/AssetInventoryServer.ini.example
+++ b/bin/AssetInventoryServer.ini.example
@@ -101,12 +101,12 @@ frontends = ReferenceFrontend,OpenSimAssetFrontend,OpenSimInventoryFrontend,Brow
101 101
102; The database provider determines which database to use. Any database backend 102; The database provider determines which database to use. Any database backend
103; supported by OpenSim is supported. 103; supported by OpenSim is supported.
104;asset_database_provider = "OpenSim.Data.SQLite.dll" 104asset_database_provider = "OpenSim.Data.SQLite.dll"
105asset_database_provider = "OpenSim.Data.MySQL.dll" 105;asset_database_provider = "OpenSim.Data.MySQL.dll"
106;asset_database_provider = "OpenSim.Data.NHibernate.dll" 106;asset_database_provider = "OpenSim.Data.NHibernate.dll"
107 107
108;inventory_database_provider = "OpenSim.Data.SQLite.dll" 108inventory_database_provider = "OpenSim.Data.SQLite.dll"
109inventory_database_provider = "OpenSim.Data.MySQL.dll" 109;inventory_database_provider = "OpenSim.Data.MySQL.dll"
110;inventory_database_provider = "OpenSim.Data.NHibernate.dll" 110;inventory_database_provider = "OpenSim.Data.NHibernate.dll"
111 111
112; Database connection string used by the OpenSim MySQL backend. If these lines 112; Database connection string used by the OpenSim MySQL backend. If these lines
@@ -117,12 +117,12 @@ inventory_database_provider = "OpenSim.Data.MySQL.dll"
117; modification. 117; modification.
118 118
119; For SQLite 119; For SQLite
120;asset_database_connect = "URI=file:Asset.db,version=3" 120asset_database_connect = "URI=file:Asset.db,version=3"
121;inventory_database_connect = "URI=file:Inventory.db,version=3" 121inventory_database_connect = "URI=file:Inventory.db,version=3"
122 122
123; For MySQL 123; For MySQL
124asset_database_connect = "Server=localhost; Database=opensim; User=changeme; Password=changeme;" 124;asset_database_connect = "Server=localhost; Database=opensim; User=changeme; Password=changeme;"
125inventory_database_connect = "Server=localhost; Database=opensim; User=changeme; Password=changeme;" 125;inventory_database_connect = "Server=localhost; Database=opensim; User=changeme; Password=changeme;"
126 126
127; For NHibernate 127; For NHibernate
128;asset_database_connect = "SQLiteDialect;SQLite20Driver;Data Source=file:Asset.db;Version=3" 128;asset_database_connect = "SQLiteDialect;SQLite20Driver;Data Source=file:Asset.db;Version=3"