diff options
author | Mike Mazur | 2009-02-16 02:27:34 +0000 |
---|---|---|
committer | Mike Mazur | 2009-02-16 02:27:34 +0000 |
commit | 529dd66ed01f598696ef8d20b465b911931d6fe8 (patch) | |
tree | 5bde49aaa0be88479d118b09c465af13538f1139 | |
parent | - asset server functionality works with OpenSim's HttpServer (diff) | |
download | opensim-SC-529dd66ed01f598696ef8d20b465b911931d6fe8.zip opensim-SC-529dd66ed01f598696ef8d20b465b911931d6fe8.tar.gz opensim-SC-529dd66ed01f598696ef8d20b465b911931d6fe8.tar.bz2 opensim-SC-529dd66ed01f598696ef8d20b465b911931d6fe8.tar.xz |
- 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
9 files changed, 344 insertions, 384 deletions
diff --git a/OpenSim/Framework/AssetInventoryConfig.cs b/OpenSim/Framework/AssetInventoryConfig.cs new file mode 100644 index 0000000..9277b5e --- /dev/null +++ b/OpenSim/Framework/AssetInventoryConfig.cs | |||
@@ -0,0 +1,146 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | |||
30 | namespace OpenSim.Framework | ||
31 | { | ||
32 | /// <summary> | ||
33 | /// AssetInventoryConfig -- For AssetInventory Server Configuration | ||
34 | /// </summary> | ||
35 | public class AssetInventoryConfig | ||
36 | { | ||
37 | private ConfigurationMember configMember; | ||
38 | |||
39 | public const uint DefaultHttpPort = 8003; | ||
40 | public uint HttpPort = DefaultHttpPort; | ||
41 | |||
42 | public string AssetStorageProvider = "OpenSimAssetStorage"; | ||
43 | public string AssetDatabaseConnect = String.Empty; | ||
44 | public string InventoryStorageProvider = "OpenSimInventoryStorage"; | ||
45 | public string InventoryDatabaseConnect = String.Empty; | ||
46 | |||
47 | public string AuthenticationProvider = "NullAuthentication"; | ||
48 | public string AuthorizationProvider = "AuthorizeAll"; | ||
49 | public string MetricsProvider = "NullMetrics"; | ||
50 | public string Frontends = "OpenSimAssetFrontend,OpenSimInventoryFrontend"; | ||
51 | |||
52 | public AssetInventoryConfig(string description, string filename) | ||
53 | { | ||
54 | configMember = new ConfigurationMember(filename, description, loadConfigurationOptions, handleIncomingConfiguration, true); | ||
55 | configMember.performConfigurationRetrieve(); | ||
56 | } | ||
57 | |||
58 | public void loadConfigurationOptions() | ||
59 | { | ||
60 | configMember.addConfigurationOption("listen_port", | ||
61 | ConfigurationOption.ConfigurationTypes.TYPE_UINT32, | ||
62 | "HTTP listener port", | ||
63 | DefaultHttpPort.ToString(), | ||
64 | false); | ||
65 | |||
66 | configMember.addConfigurationOption("asset_storage_provider", | ||
67 | ConfigurationOption.ConfigurationTypes.TYPE_STRING, | ||
68 | "Asset storage provider", | ||
69 | AssetStorageProvider, | ||
70 | false); | ||
71 | configMember.addConfigurationOption("asset_database_connect", | ||
72 | ConfigurationOption.ConfigurationTypes.TYPE_STRING, | ||
73 | "Asset database connection string", | ||
74 | AssetDatabaseConnect, | ||
75 | false); | ||
76 | configMember.addConfigurationOption("inventory_storage_provider", | ||
77 | ConfigurationOption.ConfigurationTypes.TYPE_STRING, | ||
78 | "Inventory storage provider", | ||
79 | InventoryStorageProvider, | ||
80 | false); | ||
81 | configMember.addConfigurationOption("inventory_database_connect", | ||
82 | ConfigurationOption.ConfigurationTypes.TYPE_STRING, | ||
83 | "Inventory database connection string", | ||
84 | InventoryDatabaseConnect, | ||
85 | false); | ||
86 | |||
87 | configMember.addConfigurationOption("authentication_provider", | ||
88 | ConfigurationOption.ConfigurationTypes.TYPE_STRING, | ||
89 | "Authentication provider", | ||
90 | AuthenticationProvider, | ||
91 | false); | ||
92 | configMember.addConfigurationOption("authorization_provider", | ||
93 | ConfigurationOption.ConfigurationTypes.TYPE_STRING, | ||
94 | "Authentication provider", | ||
95 | AuthorizationProvider, | ||
96 | false); | ||
97 | configMember.addConfigurationOption("metrics_provider", | ||
98 | ConfigurationOption.ConfigurationTypes.TYPE_STRING, | ||
99 | "Metrics provider", | ||
100 | MetricsProvider, | ||
101 | false); | ||
102 | configMember.addConfigurationOption("frontends", | ||
103 | ConfigurationOption.ConfigurationTypes.TYPE_STRING, | ||
104 | "Comma-separated list of frontends", | ||
105 | Frontends, | ||
106 | false); | ||
107 | |||
108 | } | ||
109 | |||
110 | public bool handleIncomingConfiguration(string configuration_key, object configuration_result) | ||
111 | { | ||
112 | switch (configuration_key) | ||
113 | { | ||
114 | case "listen_port": | ||
115 | HttpPort = (uint) configuration_result; | ||
116 | break; | ||
117 | case "asset_storage_provider": | ||
118 | AssetStorageProvider = (string) configuration_result; | ||
119 | break; | ||
120 | case "asset_database_connect": | ||
121 | AssetDatabaseConnect = (string) configuration_result; | ||
122 | break; | ||
123 | case "inventory_storage_provider": | ||
124 | InventoryStorageProvider = (string) configuration_result; | ||
125 | break; | ||
126 | case "inventory_database_connect": | ||
127 | InventoryDatabaseConnect = (string) configuration_result; | ||
128 | break; | ||
129 | case "authentication_provider": | ||
130 | AuthenticationProvider = (string) configuration_result; | ||
131 | break; | ||
132 | case "authorization_provider": | ||
133 | AuthorizationProvider = (string) configuration_result; | ||
134 | break; | ||
135 | case "metrics_provider": | ||
136 | MetricsProvider = (string) configuration_result; | ||
137 | break; | ||
138 | case "frontends": | ||
139 | Frontends = (string) configuration_result; | ||
140 | break; | ||
141 | } | ||
142 | |||
143 | return true; | ||
144 | } | ||
145 | } | ||
146 | } | ||
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 | |||
278 | public class PluginExtensionNode : ExtensionNode | 278 | public class PluginExtensionNode : ExtensionNode |
279 | { | 279 | { |
280 | [NodeAttribute] | 280 | [NodeAttribute] |
281 | string id = ""; | ||
282 | |||
283 | [NodeAttribute] | ||
281 | string provider = ""; | 284 | string provider = ""; |
282 | 285 | ||
283 | [NodeAttribute] | 286 | [NodeAttribute] |
@@ -285,6 +288,7 @@ namespace OpenSim.Framework | |||
285 | 288 | ||
286 | Type typeobj; | 289 | Type typeobj; |
287 | 290 | ||
291 | public string ID { get { return id; } } | ||
288 | public string Provider { get { return provider; } } | 292 | public string Provider { get { return provider; } } |
289 | public string TypeName { get { return type; } } | 293 | public string TypeName { get { return type; } } |
290 | 294 | ||
@@ -349,7 +353,7 @@ namespace OpenSim.Framework | |||
349 | } | 353 | } |
350 | 354 | ||
351 | /// <summary> | 355 | /// <summary> |
352 | /// Filters out which plugin to load based on its the plugin name or names given. Plugin names are contained in | 356 | /// Filters out which plugin to load based on the plugin name or names given. Plugin names are contained in |
353 | /// their addin.xml | 357 | /// their addin.xml |
354 | /// </summary> | 358 | /// </summary> |
355 | public class PluginProviderFilter : IPluginFilter | 359 | public class PluginProviderFilter : IPluginFilter |
@@ -390,4 +394,46 @@ namespace OpenSim.Framework | |||
390 | return false; | 394 | return false; |
391 | } | 395 | } |
392 | } | 396 | } |
397 | |||
398 | /// <summary> | ||
399 | /// Filters plugins according to their ID. Plugin IDs are contained in their addin.xml | ||
400 | /// </summary> | ||
401 | public class PluginIdFilter : IPluginFilter | ||
402 | { | ||
403 | private string[] m_filters; | ||
404 | |||
405 | /// <summary> | ||
406 | /// Constructor. | ||
407 | /// </summary> | ||
408 | /// <param name="p"> | ||
409 | /// Plugin ID or IDs on which to filter. Multiple names should be separated by commas. | ||
410 | /// </param> | ||
411 | public PluginIdFilter(string p) | ||
412 | { | ||
413 | m_filters = p.Split(','); | ||
414 | |||
415 | for (int i = 0; i < m_filters.Length; i++) | ||
416 | { | ||
417 | m_filters[i] = m_filters[i].Trim(); | ||
418 | } | ||
419 | } | ||
420 | |||
421 | /// <summary> | ||
422 | /// Apply this filter to <paramref name="plugin" />. | ||
423 | /// </summary> | ||
424 | /// <param name="plugin">PluginExtensionNode instance to check whether it passes the filter.</param> | ||
425 | /// <returns>true if the plugin's ID matches one of the filters, false otherwise.</returns> | ||
426 | public bool Apply (PluginExtensionNode plugin) | ||
427 | { | ||
428 | for (int i = 0; i < m_filters.Length; i++) | ||
429 | { | ||
430 | if (m_filters[i] == plugin.ID) | ||
431 | { | ||
432 | return true; | ||
433 | } | ||
434 | } | ||
435 | |||
436 | return false; | ||
437 | } | ||
438 | } | ||
393 | } | 439 | } |
diff --git a/OpenSim/Grid/AssetInventoryServer/AssetInventoryServer.cs b/OpenSim/Grid/AssetInventoryServer/AssetInventoryServer.cs index bd05d59..f6d46e8 100644 --- a/OpenSim/Grid/AssetInventoryServer/AssetInventoryServer.cs +++ b/OpenSim/Grid/AssetInventoryServer/AssetInventoryServer.cs | |||
@@ -32,11 +32,6 @@ using System.Collections.Generic; | |||
32 | using System.IO; | 32 | using System.IO; |
33 | using System.Net; | 33 | using System.Net; |
34 | using System.Reflection; | 34 | using System.Reflection; |
35 | using System.Security.Cryptography.X509Certificates; | ||
36 | using System.ServiceProcess; | ||
37 | using ExtensionLoader; | ||
38 | using ExtensionLoader.Config; | ||
39 | //using HttpServer; | ||
40 | using log4net; | 35 | using log4net; |
41 | using OpenSim.Framework; | 36 | using OpenSim.Framework; |
42 | using OpenSim.Framework.Servers; | 37 | using OpenSim.Framework.Servers; |
@@ -44,12 +39,11 @@ using OpenSim.Framework.Console; | |||
44 | 39 | ||
45 | namespace OpenSim.Grid.AssetInventoryServer | 40 | namespace OpenSim.Grid.AssetInventoryServer |
46 | { | 41 | { |
47 | public class AssetInventoryServer : BaseOpenSimServer//ServiceBase | 42 | public class AssetInventoryServer : BaseOpenSimServer |
48 | { | 43 | { |
49 | public const string CONFIG_FILE = "AssetInventoryServer.ini"; | 44 | public const string CONFIG_FILE = "AssetInventoryServer.ini"; |
50 | 45 | ||
51 | //public WebServer HttpServer; | 46 | public AssetInventoryConfig ConfigFile; |
52 | public IniConfigSource ConfigFile; | ||
53 | 47 | ||
54 | public IAssetStorageProvider StorageProvider; | 48 | public IAssetStorageProvider StorageProvider; |
55 | public IInventoryStorageProvider InventoryProvider; | 49 | public IInventoryStorageProvider InventoryProvider; |
@@ -57,72 +51,39 @@ namespace OpenSim.Grid.AssetInventoryServer | |||
57 | public IAuthorizationProvider AuthorizationProvider; | 51 | public IAuthorizationProvider AuthorizationProvider; |
58 | public IMetricsProvider MetricsProvider; | 52 | public IMetricsProvider MetricsProvider; |
59 | 53 | ||
60 | private List<IAssetInventoryServerPlugin> frontends = new List<IAssetInventoryServerPlugin>(); | 54 | private List<IAssetInventoryServerPlugin> m_frontends = new List<IAssetInventoryServerPlugin>(); |
61 | private List<IAssetInventoryServerPlugin> backends = new List<IAssetInventoryServerPlugin>(); | 55 | private List<IAssetInventoryServerPlugin> m_backends = new List<IAssetInventoryServerPlugin>(); |
62 | 56 | ||
63 | public AssetInventoryServer() | 57 | public AssetInventoryServer() |
64 | { | 58 | { |
65 | m_console = new ConsoleBase("Asset"); | 59 | m_console = new ConsoleBase("Asset"); |
66 | MainConsole.Instance = m_console; | 60 | MainConsole.Instance = m_console; |
67 | //this.ServiceName = "OpenSimAssetInventoryServer"; | ||
68 | } | 61 | } |
69 | 62 | ||
70 | public bool Start() | 63 | public bool Start() |
71 | { | 64 | { |
72 | Logger.Log.Info("Starting Asset Server"); | 65 | Logger.Log.Info("Starting Asset Server"); |
73 | List<string> extensionList = null; | 66 | uint port = 0; |
74 | int port = 0; | ||
75 | X509Certificate2 serverCert = null; | ||
76 | 67 | ||
77 | try { ConfigFile = new IniConfigSource(CONFIG_FILE); } | 68 | try { ConfigFile = new AssetInventoryConfig("AssetInventory Server", (Path.Combine(Util.configDir(), "AssetInventoryServer.ini"))); } |
78 | catch (Exception) | 69 | catch (Exception) |
79 | { | 70 | { |
80 | Logger.Log.Error("Failed to load the config file " + CONFIG_FILE); | 71 | Logger.Log.Error("Failed to load the config file " + CONFIG_FILE); |
81 | return false; | 72 | return false; |
82 | } | 73 | } |
83 | 74 | ||
84 | try | 75 | StorageProvider = LoadAssetInventoryServerPlugin("/OpenSim/AssetInventoryServer/StorageProvider", ConfigFile.AssetStorageProvider) as IAssetStorageProvider; |
85 | { | 76 | m_backends.Add(StorageProvider); |
86 | IConfig extensionConfig = ConfigFile.Configs["Config"]; | ||
87 | |||
88 | // Load the port number to listen on | ||
89 | port = extensionConfig.GetInt("ListenPort"); | ||
90 | |||
91 | // Load the server certificate file | ||
92 | string certFile = extensionConfig.GetString("SSLCertFile"); | ||
93 | if (!String.IsNullOrEmpty(certFile)) | ||
94 | serverCert = new X509Certificate2(certFile); | ||
95 | } | ||
96 | catch (Exception) | ||
97 | { | ||
98 | Logger.Log.Error("Failed to load [Config] section from " + CONFIG_FILE); | ||
99 | return false; | ||
100 | } | ||
101 | |||
102 | try | ||
103 | { | ||
104 | // Load the extension list (and ordering) from our config file | ||
105 | IConfig extensionConfig = ConfigFile.Configs["Extensions"]; | ||
106 | extensionList = new List<string>(extensionConfig.GetKeys()); | ||
107 | } | ||
108 | catch (Exception) | ||
109 | { | ||
110 | Logger.Log.Error("Failed to load [Extensions] section from " + CONFIG_FILE); | ||
111 | return false; | ||
112 | } | ||
113 | |||
114 | StorageProvider = LoadAssetInventoryServerPlugin("/OpenSim/AssetInventoryServer/StorageProvider", "OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim.dll") as IAssetStorageProvider; | ||
115 | backends.Add(StorageProvider); | ||
116 | 77 | ||
117 | InventoryProvider = LoadAssetInventoryServerPlugin("/OpenSim/AssetInventoryServer/InventoryProvider", "OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim.dll") as IInventoryStorageProvider; | 78 | InventoryProvider = LoadAssetInventoryServerPlugin("/OpenSim/AssetInventoryServer/InventoryProvider", ConfigFile.InventoryStorageProvider) as IInventoryStorageProvider; |
118 | backends.Add(InventoryProvider); | 79 | m_backends.Add(InventoryProvider); |
119 | 80 | ||
120 | MetricsProvider = LoadAssetInventoryServerPlugin("/OpenSim/AssetInventoryServer/MetricsProvider", String.Empty) as IMetricsProvider; | 81 | MetricsProvider = LoadAssetInventoryServerPlugins("/OpenSim/AssetInventoryServer/MetricsProvider", ConfigFile.MetricsProvider) as IMetricsProvider; |
121 | backends.Add(MetricsProvider); | 82 | m_backends.Add(MetricsProvider); |
122 | 83 | ||
123 | try | 84 | try |
124 | { | 85 | { |
125 | InitHttpServer(port, serverCert); | 86 | InitHttpServer(ConfigFile.HttpPort); |
126 | } | 87 | } |
127 | catch (Exception ex) | 88 | catch (Exception ex) |
128 | { | 89 | { |
@@ -131,13 +92,13 @@ namespace OpenSim.Grid.AssetInventoryServer | |||
131 | return false; | 92 | return false; |
132 | } | 93 | } |
133 | 94 | ||
134 | frontends.AddRange(LoadAssetInventoryServerPlugins("/OpenSim/AssetInventoryServer/Frontend", String.Empty)); | 95 | AuthenticationProvider = LoadAssetInventoryServerPlugin("/OpenSim/AssetInventoryServer/AuthenticationProvider", ConfigFile.AuthenticationProvider) as IAuthenticationProvider; |
96 | m_backends.Add(AuthenticationProvider); | ||
135 | 97 | ||
136 | AuthenticationProvider = LoadAssetInventoryServerPlugin("/OpenSim/AssetInventoryServer/AuthenticationProvider", String.Empty) as IAuthenticationProvider; | 98 | AuthorizationProvider = LoadAssetInventoryServerPlugin("/OpenSim/AssetInventoryServer/AuthorizationProvider", ConfigFile.AuthorizationProvider) as IAuthorizationProvider; |
137 | backends.Add(AuthenticationProvider); | 99 | m_backends.Add(AuthorizationProvider); |
138 | 100 | ||
139 | AuthorizationProvider = LoadAssetInventoryServerPlugin("/OpenSim/AssetInventoryServer/AuthorizationProvider", String.Empty) as IAuthorizationProvider; | 101 | m_frontends.AddRange(LoadAssetInventoryServerPlugins("/OpenSim/AssetInventoryServer/Frontend", ConfigFile.Frontends)); |
140 | backends.Add(AuthorizationProvider); | ||
141 | 102 | ||
142 | return true; | 103 | return true; |
143 | } | 104 | } |
@@ -154,7 +115,7 @@ namespace OpenSim.Grid.AssetInventoryServer | |||
154 | 115 | ||
155 | public override void ShutdownSpecific() | 116 | public override void ShutdownSpecific() |
156 | { | 117 | { |
157 | foreach (IAssetInventoryServerPlugin plugin in frontends) | 118 | foreach (IAssetInventoryServerPlugin plugin in m_frontends) |
158 | { | 119 | { |
159 | Logger.Log.Debug("Disposing plugin " + plugin.Name); | 120 | Logger.Log.Debug("Disposing plugin " + plugin.Name); |
160 | try { plugin.Dispose(); } | 121 | try { plugin.Dispose(); } |
@@ -162,7 +123,7 @@ namespace OpenSim.Grid.AssetInventoryServer | |||
162 | { Logger.Log.ErrorFormat("Failure shutting down plugin {0}: {1}", plugin.Name, ex.Message); } | 123 | { Logger.Log.ErrorFormat("Failure shutting down plugin {0}: {1}", plugin.Name, ex.Message); } |
163 | } | 124 | } |
164 | 125 | ||
165 | foreach (IAssetInventoryServerPlugin plugin in backends) | 126 | foreach (IAssetInventoryServerPlugin plugin in m_backends) |
166 | { | 127 | { |
167 | Logger.Log.Debug("Disposing plugin " + plugin.Name); | 128 | Logger.Log.Debug("Disposing plugin " + plugin.Name); |
168 | try { plugin.Dispose(); } | 129 | try { plugin.Dispose(); } |
@@ -174,47 +135,14 @@ namespace OpenSim.Grid.AssetInventoryServer | |||
174 | HttpServer.Stop(); | 135 | HttpServer.Stop(); |
175 | } | 136 | } |
176 | 137 | ||
177 | void InitHttpServer(int port, X509Certificate serverCert) | 138 | void InitHttpServer(uint port) |
178 | { | 139 | { |
179 | //if (serverCert != null) | 140 | m_httpServer = new BaseHttpServer(port); |
180 | // HttpServer = new WebServer(IPAddress.Any, port, serverCert, null, false); | 141 | m_httpServer.Start(); |
181 | //else | ||
182 | // HttpServer = new WebServer(IPAddress.Any, port); | ||
183 | |||
184 | //HttpServer.LogWriter = new log4netLogWriter(Logger.Log); | ||
185 | |||
186 | //HttpServer.Set404Handler( | ||
187 | // delegate(IHttpClientContext client, IHttpRequest request, IHttpResponse response) | ||
188 | // { | ||
189 | // Logger.Log.Warn("Requested page was not found: " + request.Uri.PathAndQuery); | ||
190 | |||
191 | // string notFoundString = "<html><head><title>Page Not Found</title></head><body>The requested page or method was not found</body></html>"; | ||
192 | // byte[] buffer = System.Text.Encoding.UTF8.GetBytes(notFoundString); | ||
193 | // response.Body.Write(buffer, 0, buffer.Length); | ||
194 | // response.Status = HttpStatusCode.NotFound; | ||
195 | // return true; | ||
196 | // } | ||
197 | //); | ||
198 | |||
199 | m_httpServer = new BaseHttpServer(8003); | ||
200 | HttpServer.Start(); | ||
201 | 142 | ||
202 | Logger.Log.Info("Asset server is listening on port " + port); | 143 | Logger.Log.Info("Asset server is listening on port " + port); |
203 | } | 144 | } |
204 | 145 | ||
205 | #region ServiceBase Overrides | ||
206 | |||
207 | //protected override void OnStart(string[] args) | ||
208 | //{ | ||
209 | // Start(); | ||
210 | //} | ||
211 | //protected override void OnStop() | ||
212 | //{ | ||
213 | // Shutdown(); | ||
214 | //} | ||
215 | |||
216 | #endregion | ||
217 | |||
218 | private IAssetInventoryServerPlugin LoadAssetInventoryServerPlugin(string addinPath, string provider) | 146 | private IAssetInventoryServerPlugin LoadAssetInventoryServerPlugin(string addinPath, string provider) |
219 | { | 147 | { |
220 | PluginLoader<IAssetInventoryServerPlugin> loader = new PluginLoader<IAssetInventoryServerPlugin>(new AssetInventoryServerPluginInitialiser(this)); | 148 | PluginLoader<IAssetInventoryServerPlugin> loader = new PluginLoader<IAssetInventoryServerPlugin>(new AssetInventoryServerPluginInitialiser(this)); |
@@ -222,7 +150,7 @@ namespace OpenSim.Grid.AssetInventoryServer | |||
222 | if (provider == String.Empty) | 150 | if (provider == String.Empty) |
223 | loader.Add(addinPath); | 151 | loader.Add(addinPath); |
224 | else | 152 | else |
225 | loader.Add(addinPath, new PluginProviderFilter(provider)); | 153 | loader.Add(addinPath, new PluginIdFilter(provider)); |
226 | //loader.Add(addinPath, new PluginCountConstraint(1)); | 154 | //loader.Add(addinPath, new PluginCountConstraint(1)); |
227 | 155 | ||
228 | loader.Load(); | 156 | loader.Load(); |
@@ -237,7 +165,7 @@ namespace OpenSim.Grid.AssetInventoryServer | |||
237 | if (provider == String.Empty) | 165 | if (provider == String.Empty) |
238 | loader.Add(addinPath); | 166 | loader.Add(addinPath); |
239 | else | 167 | else |
240 | loader.Add(addinPath, new PluginProviderFilter(provider)); | 168 | loader.Add(addinPath, new PluginIdFilter(provider)); |
241 | //loader.Add(addinPath, new PluginCountConstraint(1)); | 169 | //loader.Add(addinPath, new PluginCountConstraint(1)); |
242 | 170 | ||
243 | loader.Load(); | 171 | loader.Load(); |
@@ -245,37 +173,4 @@ namespace OpenSim.Grid.AssetInventoryServer | |||
245 | return loader.Plugins; | 173 | return loader.Plugins; |
246 | } | 174 | } |
247 | } | 175 | } |
248 | |||
249 | //public class log4netLogWriter : ILogWriter | ||
250 | //{ | ||
251 | // ILog Log; | ||
252 | |||
253 | // public log4netLogWriter(ILog log) | ||
254 | // { | ||
255 | // Log = log; | ||
256 | // } | ||
257 | |||
258 | // public void Write(object source, LogPrio prio, string message) | ||
259 | // { | ||
260 | // switch (prio) | ||
261 | // { | ||
262 | // case LogPrio.Trace: | ||
263 | // case LogPrio.Debug: | ||
264 | // Log.DebugFormat("{0}: {1}", source, message); | ||
265 | // break; | ||
266 | // case LogPrio.Info: | ||
267 | // Log.InfoFormat("{0}: {1}", source, message); | ||
268 | // break; | ||
269 | // case LogPrio.Warning: | ||
270 | // Log.WarnFormat("{0}: {1}", source, message); | ||
271 | // break; | ||
272 | // case LogPrio.Error: | ||
273 | // Log.ErrorFormat("{0}: {1}", source, message); | ||
274 | // break; | ||
275 | // case LogPrio.Fatal: | ||
276 | // Log.FatalFormat("{0}: {1}", source, message); | ||
277 | // break; | ||
278 | // } | ||
279 | // } | ||
280 | //} | ||
281 | } | 176 | } |
diff --git a/OpenSim/Grid/AssetInventoryServer/Extensions/DBConnString.cs b/OpenSim/Grid/AssetInventoryServer/Extensions/DBConnString.cs deleted file mode 100644 index 78761be..0000000 --- a/OpenSim/Grid/AssetInventoryServer/Extensions/DBConnString.cs +++ /dev/null | |||
@@ -1,78 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2008 Intel Corporation | ||
3 | * All rights reserved. | ||
4 | * Redistribution and use in source and binary forms, with or without | ||
5 | * modification, are permitted provided that the following conditions | ||
6 | * are met: | ||
7 | * | ||
8 | * -- Redistributions of source code must retain the above copyright | ||
9 | * notice, this list of conditions and the following disclaimer. | ||
10 | * -- Redistributions in binary form must reproduce the above copyright | ||
11 | * notice, this list of conditions and the following disclaimer in the | ||
12 | * documentation and/or other materials provided with the distribution. | ||
13 | * -- Neither the name of the Intel Corporation nor the names of its | ||
14 | * contributors may be used to endorse or promote products derived from | ||
15 | * this software without specific prior written permission. | ||
16 | * | ||
17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
18 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
19 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A | ||
20 | * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE INTEL OR ITS | ||
21 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | ||
22 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | ||
23 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | ||
24 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF | ||
25 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||
26 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
27 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
28 | */ | ||
29 | |||
30 | using System; | ||
31 | using System.Xml; | ||
32 | using ExtensionLoader.Config; | ||
33 | using MySql.Data.MySqlClient; | ||
34 | |||
35 | namespace OpenSim.Grid.AssetInventoryServer.Extensions | ||
36 | { | ||
37 | public static class DBConnString | ||
38 | { | ||
39 | private static string connectionString; | ||
40 | |||
41 | /// <summary> | ||
42 | /// Parses the MySQL connection string out of either the asset server | ||
43 | /// .ini or a OpenSim-style .xml file and caches the result for future | ||
44 | /// requests | ||
45 | /// </summary> | ||
46 | public static string GetConnectionString(IniConfigSource configFile) | ||
47 | { | ||
48 | if (connectionString == null) | ||
49 | { | ||
50 | // Try parsing from the ini file | ||
51 | try | ||
52 | { | ||
53 | // Load the extension list (and ordering) from our config file | ||
54 | IConfig extensionConfig = configFile.Configs["MySQL"]; | ||
55 | connectionString = extensionConfig.GetString("database_connect", null); | ||
56 | } | ||
57 | catch (Exception) { } | ||
58 | |||
59 | if (connectionString != null) | ||
60 | { | ||
61 | // Force MySQL's broken connection pooling off | ||
62 | MySqlConnectionStringBuilder builder = new MySqlConnectionStringBuilder(connectionString); | ||
63 | builder.Pooling = false; | ||
64 | if (String.IsNullOrEmpty(builder.Database)) | ||
65 | Logger.Log.Error("No database selected in the connectionString: " + connectionString); | ||
66 | connectionString = builder.ToString(); | ||
67 | } | ||
68 | else | ||
69 | { | ||
70 | Logger.Log.Error("Database connection string is missing, check that the database_connect line is " + | ||
71 | "correct and uncommented in AssetInventoryServer.ini"); | ||
72 | } | ||
73 | } | ||
74 | |||
75 | return connectionString; | ||
76 | } | ||
77 | } | ||
78 | } | ||
diff --git a/OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/OpenSimAssetStoragePlugin.cs b/OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/OpenSimAssetStoragePlugin.cs index e35092b..b7aef08 100644 --- a/OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/OpenSimAssetStoragePlugin.cs +++ b/OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/OpenSimAssetStoragePlugin.cs | |||
@@ -35,7 +35,6 @@ using MySql.Data.MySqlClient; | |||
35 | using OpenMetaverse; | 35 | using OpenMetaverse; |
36 | using OpenMetaverse.StructuredData; | 36 | using OpenMetaverse.StructuredData; |
37 | using OpenSim.Framework; | 37 | using OpenSim.Framework; |
38 | using OpenSim.Grid.AssetInventoryServer.Extensions; | ||
39 | using OpenSim.Data; | 38 | using OpenSim.Data; |
40 | 39 | ||
41 | namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim | 40 | namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim |
@@ -58,7 +57,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim | |||
58 | metadata = null; | 57 | metadata = null; |
59 | BackendResponse ret; | 58 | BackendResponse ret; |
60 | 59 | ||
61 | using (MySqlConnection dbConnection = new MySqlConnection(DBConnString.GetConnectionString(server.ConfigFile))) | 60 | using (MySqlConnection dbConnection = new MySqlConnection(server.ConfigFile.AssetDatabaseConnect)) |
62 | { | 61 | { |
63 | IDataReader reader; | 62 | IDataReader reader; |
64 | 63 | ||
@@ -104,7 +103,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim | |||
104 | assetData = null; | 103 | assetData = null; |
105 | BackendResponse ret; | 104 | BackendResponse ret; |
106 | 105 | ||
107 | using (MySqlConnection dbConnection = new MySqlConnection(DBConnString.GetConnectionString(server.ConfigFile))) | 106 | using (MySqlConnection dbConnection = new MySqlConnection(server.ConfigFile.AssetDatabaseConnect)) |
108 | { | 107 | { |
109 | IDataReader reader; | 108 | IDataReader reader; |
110 | 109 | ||
@@ -156,7 +155,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim | |||
156 | { | 155 | { |
157 | BackendResponse ret; | 156 | BackendResponse ret; |
158 | 157 | ||
159 | using (MySqlConnection dbConnection = new MySqlConnection(DBConnString.GetConnectionString(server.ConfigFile))) | 158 | using (MySqlConnection dbConnection = new MySqlConnection(server.ConfigFile.AssetDatabaseConnect)) |
160 | { | 159 | { |
161 | try | 160 | try |
162 | { | 161 | { |
@@ -205,7 +204,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim | |||
205 | { | 204 | { |
206 | int rowCount = 0; | 205 | int rowCount = 0; |
207 | 206 | ||
208 | using (MySqlConnection dbConnection = new MySqlConnection(DBConnString.GetConnectionString(server.ConfigFile))) | 207 | using (MySqlConnection dbConnection = new MySqlConnection(server.ConfigFile.AssetDatabaseConnect)) |
209 | { | 208 | { |
210 | MySqlDataReader reader; | 209 | MySqlDataReader reader; |
211 | 210 | ||
@@ -255,7 +254,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim | |||
255 | 254 | ||
256 | try | 255 | try |
257 | { | 256 | { |
258 | m_assetProvider = DataPluginFactory.LoadDataPlugin<IAssetDataPlugin>("OpenSim.Data.MySQL.dll", server.ConfigFile.Configs["MySQL"].GetString("database_connect", null)); | 257 | m_assetProvider = DataPluginFactory.LoadDataPlugin<IAssetDataPlugin>("OpenSim.Data.MySQL.dll", server.ConfigFile.AssetDatabaseConnect); |
259 | if (m_assetProvider == null) | 258 | if (m_assetProvider == null) |
260 | { | 259 | { |
261 | Logger.Log.Error("[ASSET]: Failed to load a database plugin, server halting."); | 260 | Logger.Log.Error("[ASSET]: Failed to load a database plugin, server halting."); |
diff --git a/OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/OpenSimInventoryStoragePlugin.cs b/OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/OpenSimInventoryStoragePlugin.cs index a7d2f92..0ad6c80 100644 --- a/OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/OpenSimInventoryStoragePlugin.cs +++ b/OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/OpenSimInventoryStoragePlugin.cs | |||
@@ -35,7 +35,6 @@ using MySql.Data.MySqlClient; | |||
35 | using OpenMetaverse; | 35 | using OpenMetaverse; |
36 | using OpenMetaverse.StructuredData; | 36 | using OpenMetaverse.StructuredData; |
37 | using OpenSim.Framework; | 37 | using OpenSim.Framework; |
38 | using OpenSim.Grid.AssetInventoryServer.Extensions; | ||
39 | using OpenSim.Data; | 38 | using OpenSim.Data; |
40 | 39 | ||
41 | namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim | 40 | namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim |
@@ -58,7 +57,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim | |||
58 | item = null; | 57 | item = null; |
59 | BackendResponse ret; | 58 | BackendResponse ret; |
60 | 59 | ||
61 | using (MySqlConnection dbConnection = new MySqlConnection(DBConnString.GetConnectionString(server.ConfigFile))) | 60 | using (MySqlConnection dbConnection = new MySqlConnection(server.ConfigFile.InventoryDatabaseConnect)) |
62 | { | 61 | { |
63 | IDataReader reader; | 62 | IDataReader reader; |
64 | 63 | ||
@@ -120,7 +119,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim | |||
120 | folder = null; | 119 | folder = null; |
121 | BackendResponse ret; | 120 | BackendResponse ret; |
122 | 121 | ||
123 | using (MySqlConnection dbConnection = new MySqlConnection(DBConnString.GetConnectionString(server.ConfigFile))) | 122 | using (MySqlConnection dbConnection = new MySqlConnection(server.ConfigFile.InventoryDatabaseConnect)) |
124 | { | 123 | { |
125 | IDataReader reader; | 124 | IDataReader reader; |
126 | 125 | ||
@@ -167,7 +166,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim | |||
167 | contents = null; | 166 | contents = null; |
168 | BackendResponse ret; | 167 | BackendResponse ret; |
169 | 168 | ||
170 | using (MySqlConnection dbConnection = new MySqlConnection(DBConnString.GetConnectionString(server.ConfigFile))) | 169 | using (MySqlConnection dbConnection = new MySqlConnection(server.ConfigFile.InventoryDatabaseConnect)) |
171 | { | 170 | { |
172 | IDataReader reader; | 171 | IDataReader reader; |
173 | 172 | ||
@@ -267,7 +266,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim | |||
267 | 266 | ||
268 | if (Utils.TryGetOpenSimUUID(owner, out ownerID)) | 267 | if (Utils.TryGetOpenSimUUID(owner, out ownerID)) |
269 | { | 268 | { |
270 | using (MySqlConnection dbConnection = new MySqlConnection(DBConnString.GetConnectionString(server.ConfigFile))) | 269 | using (MySqlConnection dbConnection = new MySqlConnection(server.ConfigFile.InventoryDatabaseConnect)) |
271 | { | 270 | { |
272 | IDataReader reader; | 271 | IDataReader reader; |
273 | 272 | ||
@@ -333,7 +332,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim | |||
333 | // Fetch inventory items | 332 | // Fetch inventory items |
334 | if (Utils.TryGetOpenSimUUID(owner, out ownerID)) | 333 | if (Utils.TryGetOpenSimUUID(owner, out ownerID)) |
335 | { | 334 | { |
336 | using (MySqlConnection dbConnection = new MySqlConnection(DBConnString.GetConnectionString(server.ConfigFile))) | 335 | using (MySqlConnection dbConnection = new MySqlConnection(server.ConfigFile.InventoryDatabaseConnect)) |
337 | { | 336 | { |
338 | IDataReader reader; | 337 | IDataReader reader; |
339 | 338 | ||
@@ -405,7 +404,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim | |||
405 | 404 | ||
406 | if (Utils.TryGetOpenSimUUID(owner, out ownerID)) | 405 | if (Utils.TryGetOpenSimUUID(owner, out ownerID)) |
407 | { | 406 | { |
408 | using (MySqlConnection dbConnection = new MySqlConnection(DBConnString.GetConnectionString(server.ConfigFile))) | 407 | using (MySqlConnection dbConnection = new MySqlConnection(server.ConfigFile.InventoryDatabaseConnect)) |
409 | { | 408 | { |
410 | IDataReader reader; | 409 | IDataReader reader; |
411 | 410 | ||
@@ -470,7 +469,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim | |||
470 | { | 469 | { |
471 | BackendResponse ret; | 470 | BackendResponse ret; |
472 | 471 | ||
473 | using (MySqlConnection dbConnection = new MySqlConnection(DBConnString.GetConnectionString(server.ConfigFile))) | 472 | using (MySqlConnection dbConnection = new MySqlConnection(server.ConfigFile.InventoryDatabaseConnect)) |
474 | { | 473 | { |
475 | try | 474 | try |
476 | { | 475 | { |
@@ -537,7 +536,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim | |||
537 | { | 536 | { |
538 | BackendResponse ret; | 537 | BackendResponse ret; |
539 | 538 | ||
540 | using (MySqlConnection dbConnection = new MySqlConnection(DBConnString.GetConnectionString(server.ConfigFile))) | 539 | using (MySqlConnection dbConnection = new MySqlConnection(server.ConfigFile.InventoryDatabaseConnect)) |
541 | { | 540 | { |
542 | try | 541 | try |
543 | { | 542 | { |
@@ -593,7 +592,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim | |||
593 | 592 | ||
594 | if (Utils.TryGetOpenSimUUID(owner, out ownerID)) | 593 | if (Utils.TryGetOpenSimUUID(owner, out ownerID)) |
595 | { | 594 | { |
596 | using (MySqlConnection dbConnection = new MySqlConnection(DBConnString.GetConnectionString(server.ConfigFile))) | 595 | using (MySqlConnection dbConnection = new MySqlConnection(server.ConfigFile.InventoryDatabaseConnect)) |
597 | { | 596 | { |
598 | try | 597 | try |
599 | { | 598 | { |
@@ -639,7 +638,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim | |||
639 | 638 | ||
640 | if (Utils.TryGetOpenSimUUID(owner, out ownerID)) | 639 | if (Utils.TryGetOpenSimUUID(owner, out ownerID)) |
641 | { | 640 | { |
642 | using (MySqlConnection dbConnection = new MySqlConnection(DBConnString.GetConnectionString(server.ConfigFile))) | 641 | using (MySqlConnection dbConnection = new MySqlConnection(server.ConfigFile.InventoryDatabaseConnect)) |
643 | { | 642 | { |
644 | try | 643 | try |
645 | { | 644 | { |
@@ -685,7 +684,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim | |||
685 | 684 | ||
686 | if (Utils.TryGetOpenSimUUID(owner, out ownerID)) | 685 | if (Utils.TryGetOpenSimUUID(owner, out ownerID)) |
687 | { | 686 | { |
688 | using (MySqlConnection dbConnection = new MySqlConnection(DBConnString.GetConnectionString(server.ConfigFile))) | 687 | using (MySqlConnection dbConnection = new MySqlConnection(server.ConfigFile.InventoryDatabaseConnect)) |
689 | { | 688 | { |
690 | try | 689 | try |
691 | { | 690 | { |
@@ -739,7 +738,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim | |||
739 | { | 738 | { |
740 | int rowCount = 0; | 739 | int rowCount = 0; |
741 | 740 | ||
742 | using (MySqlConnection dbConnection = new MySqlConnection(DBConnString.GetConnectionString(server.ConfigFile))) | 741 | using (MySqlConnection dbConnection = new MySqlConnection(server.ConfigFile.InventoryDatabaseConnect)) |
743 | { | 742 | { |
744 | MySqlDataReader reader; | 743 | MySqlDataReader reader; |
745 | 744 | ||
@@ -789,7 +788,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim | |||
789 | 788 | ||
790 | try | 789 | try |
791 | { | 790 | { |
792 | m_inventoryProvider = DataPluginFactory.LoadDataPlugin<IInventoryDataPlugin>("OpenSim.Data.MySQL.dll", server.ConfigFile.Configs["MySQL"].GetString("database_connect", null)); | 791 | m_inventoryProvider = DataPluginFactory.LoadDataPlugin<IInventoryDataPlugin>("OpenSim.Data.MySQL.dll", server.ConfigFile.InventoryDatabaseConnect); |
793 | if (m_inventoryProvider == null) | 792 | if (m_inventoryProvider == null) |
794 | { | 793 | { |
795 | Logger.Log.Error("[INVENTORY]: Failed to load a database plugin, server halting."); | 794 | Logger.Log.Error("[INVENTORY]: Failed to load a database plugin, server halting."); |
diff --git a/OpenSim/Grid/AssetInventoryServer/Plugins/Resources/AssetInventoryServerPlugins.addin.xml b/OpenSim/Grid/AssetInventoryServer/Plugins/Resources/AssetInventoryServerPlugins.addin.xml index 67c4cd2..c1e5c4d 100644 --- a/OpenSim/Grid/AssetInventoryServer/Plugins/Resources/AssetInventoryServerPlugins.addin.xml +++ b/OpenSim/Grid/AssetInventoryServer/Plugins/Resources/AssetInventoryServerPlugins.addin.xml | |||
@@ -8,7 +8,7 @@ | |||
8 | </Dependencies> | 8 | </Dependencies> |
9 | 9 | ||
10 | <Extension path="/OpenSim/AssetInventoryServer/MetricsProvider"> | 10 | <Extension path="/OpenSim/AssetInventoryServer/MetricsProvider"> |
11 | <Plugin id="AssetInventoryMetrics" provider="OpenSim.Grid.AssetInventoryServer.Plugins.dll" type="OpenSim.Grid.AssetInventoryServer.Plugins.NullMetricsPlugin" /> | 11 | <Plugin id="NullMetrics" provider="OpenSim.Grid.AssetInventoryServer.Plugins.dll" type="OpenSim.Grid.AssetInventoryServer.Plugins.NullMetricsPlugin" /> |
12 | </Extension> | 12 | </Extension> |
13 | <Extension path="/OpenSim/AssetInventoryServer/Frontend"> | 13 | <Extension path="/OpenSim/AssetInventoryServer/Frontend"> |
14 | <Plugin id="BrowseFrontend" provider="OpenSim.Grid.AssetInventoryServer.Plugins.dll" type="OpenSim.Grid.AssetInventoryServer.Plugins.BrowseFrontendPlugin" /> | 14 | <Plugin id="BrowseFrontend" provider="OpenSim.Grid.AssetInventoryServer.Plugins.dll" type="OpenSim.Grid.AssetInventoryServer.Plugins.BrowseFrontendPlugin" /> |
diff --git a/bin/AssetInventoryServer.ini.example b/bin/AssetInventoryServer.ini.example index f346624..503870e 100644 --- a/bin/AssetInventoryServer.ini.example +++ b/bin/AssetInventoryServer.ini.example | |||
@@ -1,153 +1,107 @@ | |||
1 | [Config] | 1 | ;[Config] |
2 | 2 | ||
3 | ; The port number for the asset server to listen on. If a valid SSL certificate | 3 | ; The port number for the asset server to listen on. |
4 | ; file is given for SSLCertFile, the HTTPS protocol will be used. Otherwise, the | 4 | listen_port = 8003 |
5 | ; HTTP protocol is used. | 5 | |
6 | ListenPort = 8003 | 6 | ;[Extensions] |
7 | 7 | ||
8 | ; An SSL certificate file for the server. If a valid raw certificate or PKCS#12 | 8 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
9 | ; file is given the server will run in HTTPS mode. | 9 | ; Asset Storage Provider |
10 | ;SSLCertFile = server.p12 | 10 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
11 | 11 | ||
12 | [Extensions] | 12 | ; Simple storage is a very basic storage system for the purposes of illustrating |
13 | 13 | ; a storage backend example. The assets are stored in SimpleAssets/ and | |
14 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 14 | ; TempAssets/ (which is deleted when the server shuts down). Metadata is |
15 | ; Storage Providers | 15 | ; generated for all of the files at startup and when new assets are uploaded. |
16 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 16 | ;asset_storage_provider = SimpleAssetStorage |
17 | 17 | ||
18 | ; Simple storage is a very basic storage system for the purposes of illustrating | 18 | ; OpenSimMySQL storage connects to a MySQL server that has an assets table created |
19 | ; a storage backend example. The assets are stored in SimpleAssets/ and | 19 | ; by OpenSim. Open the AssetServer_Config.xml file from OpenSim and use the |
20 | ; TempAssets/ (which is deleted when the server shuts down). Metadata is | 20 | ; database connection string for the database_connect option in the MySQL section |
21 | ; generated for all of the files at startup and when new assets are uploaded. | 21 | ; below. This backend combined with the OpenSimFrontend will allow the asset |
22 | ;SimpleStorage | 22 | ; server to be used as a drop-in replacement for OpenSim.Grid.AssetServer.exe, |
23 | 23 | ; while also allowing other frontends to run. | |
24 | ; OpenSimMySQL storage connects to a MySQL server that has an assets table created | 24 | asset_storage_provider = OpenSimAssetStorage |
25 | ; by OpenSim. Open the AssetServer_Config.xml file from OpenSim and use the | 25 | |
26 | ; database connection string for the database_connect option in the MySQL section | 26 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
27 | ; below. This backend combined with the OpenSimFrontend will allow the asset | 27 | ; Inventory Storage Provider |
28 | ; server to be used as a drop-in replacement for OpenSim.Grid.AssetServer.exe, | 28 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
29 | ; while also allowing other frontends to run. | 29 | |
30 | OpenSimMySQLStorage | 30 | ; Simple inventory is a very basic inventory storage system for the purposes of |
31 | 31 | ; illustrating an inventory backend example. The inventory is stored in | |
32 | ; Uses Amazon.com's Simple Storage Service (http://aws.amazon.com/s3/) to store | 32 | ; SimpleInventory/ by creating a folder for each agent that contains all of the |
33 | ; asset data and metadata. This backend does not handle any data requests, as the | 33 | ; inventory items and folders serialized as XML files. |
34 | ; data is stored remotely and metadata replies will contain the amazon.com URL | 34 | ;inventory_asset_provider = SimpleInventoryStorage |
35 | ; holding the actual asset data. Your Access Key ID and Secret Access Key must be | 35 | |
36 | ; set in the [Amazon] section below for this backend to function. If | 36 | ; OpenSimMySQL inventory connects to a MySQL server that has an inventory table |
37 | ; UseCloudFront is true and your Amazon account has CloudFront enabled, | 37 | ; created by OpenSim. If the OpenSimMySQLStorage backend is also being used, the |
38 | ; CloudFront URLs will be returned in metadata instead of normal S3 URLs. | 38 | ; inventory and asset tables must be stored in the same database. The |
39 | ;AmazonS3Storage | 39 | ; database_connect string in the MySQL section below is used to connect to the |
40 | 40 | ; database. This backend combined with the OpenSimInventoryFrontend will allow | |
41 | ; Uses memcached (http://www.danga.com/memcached/) as a caching layer on top of | 41 | ; the server to be used as a drop-in replacement for |
42 | ; another storage backend. If you use this, make sure you enable another storage | 42 | ; OpenSim.Grid.InventoryServer.exe, while also allowing other frontends to run. |
43 | ; provider as the actual backend, and that the MemcacheStorage line appears in | 43 | inventory_asset_provider = OpenSimInventoryStorage |
44 | ; this config file after the other storage provider. | 44 | |
45 | ;MemcachedStorage | 45 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
46 | 46 | ; Authentication Provider | |
47 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 47 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
48 | ; Inventory Providers | 48 | |
49 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 49 | ; NullAuthentication does nothing. |
50 | 50 | authentication_provider = NullAuthentication | |
51 | ; Simple inventory is a very basic inventory storage system for the purposes of | 51 | |
52 | ; illustrating an inventory backend example. The inventory is stored in | 52 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
53 | ; SimpleInventory/ by creating a folder for each agent that contains all of the | 53 | ; Authorization Provider |
54 | ; inventory items and folders serialized as XML files. | 54 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
55 | ;SimpleInventory | 55 | |
56 | 56 | ; Authorize all is a dummy authorization module that allows all requests for | |
57 | ; OpenSimMySQL inventory connects to a MySQL server that has an inventory table | 57 | ; metadata, data, and asset creation. Use this extension if your primary |
58 | ; created by OpenSim. If the OpenSimMySQLStorage backend is also being used, the | 58 | ; storage provider or front-end interface does not support authentication. |
59 | ; inventory and asset tables must be stored in the same database. The | 59 | authroization_provider = AuthorizeAll |
60 | ; database_connect string in the MySQL section below is used to connect to the | 60 | |
61 | ; database. This backend combined with the OpenSimInventoryFrontend will allow | 61 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
62 | ; the server to be used as a drop-in replacement for | 62 | ; Metrics Provider |
63 | ; OpenSim.Grid.InventoryServer.exe, while also allowing other frontends to run. | 63 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
64 | OpenSimMySQLInventory | 64 | |
65 | 65 | ; NullMetrics contains empty logging functions. Use this metrics provider if | |
66 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 66 | ; you want to disable metrics collection and reporting. |
67 | ; Authentication Providers | 67 | metrics_provider = NullMetrics |
68 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 68 | |
69 | 69 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
70 | ; OpenID provides a direct method of authenticating with the asset server. Users | 70 | ; Frontends |
71 | ; can provide credentials and receive a session token directly from the asset | 71 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
72 | ; server. The OpenIdAuth module provides a browser-based form login and an | 72 | |
73 | ; XML-based API, both accessible through the URL /authenticate. | 73 | ; Specify multiple frontends as a comma-separated list. |
74 | ;OpenIdAuth | 74 | |
75 | NullAuthentication | 75 | ; ReferenceFrontend is a simple frontend that provides three basic REST |
76 | 76 | ; methods. /assetid/metadata will return the metadata for an asset (currently in | |
77 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 77 | ; LLSD format, that will change soon). /assetid/data will return the raw asset |
78 | ; Authorization Providers | 78 | ; data with proper Content-Type and Content-Disposition headers to make |
79 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 79 | ; downloading assets in a web browser easy. |
80 | 80 | ||
81 | ; Authorize all is a dummy authorization module that allows all requests for | 81 | ; OpenSimAssetFrontend is a frontend that matches the existing OpenSim XML for |
82 | ; metadata, data, and asset creation. Use this extension if your primary | 82 | ; transferring grid assets. This will allow the asset server to function as a |
83 | ; storage provider or front-end interface does not support authentication. | 83 | ; drop-in replacement for OpenSim.Grid.AssetServer.exe, and can be combined with |
84 | AuthorizeAll | 84 | ; OpenSimAssetStorage to provide an identical replacement, or any other asset |
85 | 85 | ; storage backend. | |
86 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 86 | |
87 | ; Metrics Providers | 87 | ; OpenSimInventoryFrontend is a frontend that matches the existing OpenSim XML |
88 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 88 | ; for transferring inventory. This will allow the inventory server to function as |
89 | 89 | ; a drop-in replacement for OpenSim.Grid.InventoryServer.exe, and can be combined | |
90 | ; NullMetrics contains empty logging functions. Use this metrics provider if | 90 | ; with OpenSimInventoryStorage to provide an identical replacement, or any other |
91 | ; you want to disable metrics collection and reporting. | 91 | ; inventory storage backend. |
92 | NullMetrics | 92 | ; *** NOTE: Inventory is not currently implemented. |
93 | 93 | ||
94 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 94 | ; BrowseFrontend is an HTML interface for browsing through the asset store. |
95 | ; Frontends | 95 | |
96 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 96 | frontends = ReferenceFrontend,OpenSimAssetFrontend,OpenSimInventoryFrontend,BrowseFrontend |
97 | 97 | ||
98 | ; A simple frontend that provides three basic REST methods. /assetid/metadata | 98 | ;[MySQL] |
99 | ; will return the metadata for an asset (currently in LLSD format, that will | 99 | |
100 | ; change soon). /assetid/data will return the raw asset data with proper | 100 | ; Database connection string used by the OpenSim MySQL backend. If these lines |
101 | ; Content-Type and Content-Disposition headers to make downloading assets in a | 101 | ; are commented out or missing, the server will look for an |
102 | ; web browser easy. | 102 | ; AssetServer_Config.xml or InventoryServer_Config.xml file in the current |
103 | ReferenceFrontend | 103 | ; working directory. These files are generated by OpenSim.Grid.AssetServer.exe |
104 | 104 | ; and OpenSim.Grid.InventoryServer.exe, respectively, and can be used without | |
105 | ; A frontend that matches the existing OpenSim XML for transferring grid | 105 | ; modification. |
106 | ; assets. This will allow the asset server to function as a drop-in replacement | 106 | asset_database_connect = "Server=localhost; Database=opensim; User=changeme; Password=changeme;" |
107 | ; for OpenSim.Grid.AssetServer.exe, and can be combined with OpenSimMySQLStorage | 107 | inventory_database_connect = "Server=localhost; Database=opensim; User=changeme; Password=changeme;" |
108 | ; to provide an identical replacement or any other storage backend. | ||
109 | OpenSimFrontend | ||
110 | |||
111 | ; A frontend that matches the existing OpenSim XML for handling inventory | ||
112 | ; transactions. This will allow the asset server to function as a drop-in | ||
113 | ; replacement for OpenSim.Grid.InventoryServer.exe, and can be combined with | ||
114 | ; OpenSimMySQLInventory to provide an identical replacement or any other | ||
115 | ; inventory backend. | ||
116 | OpenSimInventoryFrontend | ||
117 | |||
118 | ; An HTML interface for browsing through the asset store | ||
119 | BrowseFrontend | ||
120 | |||
121 | [MySQL] | ||
122 | |||
123 | ; Database connection string used by the OpenSim MySQL backend. If this line is | ||
124 | ; commented out or missing, the server will look for an AssetServer_Config.xml | ||
125 | ; in the current working directory. This file is generated by | ||
126 | ; OpenSim.Grid.AssetServer.exe and can be used without modification. | ||
127 | database_connect = "Server=localhost; Database=opensim; User=changeme; Password=changeme;" | ||
128 | |||
129 | [Amazon] | ||
130 | |||
131 | ; Get these values by logging in to your Amazon S3 account and going to | ||
132 | ; https://aws-portal.amazon.com/gp/aws/developer/account/index.html?ie=UTF8&action=access-key | ||
133 | AccessKeyID = xxxxxxxxxxxxxxxxxxxx | ||
134 | SecretAccessKey = xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx | ||
135 | |||
136 | ; The bucket, or namespace, in your Amazon S3 account for storing assets in. | ||
137 | ; Bucket names on S3 are global identifiers, and must be unique. Think up | ||
138 | ; something clever or random. | ||
139 | BucketName = changeme | ||
140 | |||
141 | ; Amazon CloudFront is a Content Distribution Network for S3 stores. If this is | ||
142 | ; set to true, AmazonS3Storage will try to locate the first available CloudFront | ||
143 | ; distribution tied to the active S3 bucket. If no usable distribution is found, | ||
144 | ; a new one will be created. | ||
145 | UseCloudFront = true | ||
146 | |||
147 | [Memcached] | ||
148 | |||
149 | ; A comma-separated list of the memcached servers that make up your caching | ||
150 | ; pool. Each server is a hostname or IP address, optionally followed by a | ||
151 | ; colon and port number if the server is not listening on the default 11211 | ||
152 | ; port. | ||
153 | Servers = localhost | ||
diff --git a/prebuild.xml b/prebuild.xml index e63bb4f..75879d9 100644 --- a/prebuild.xml +++ b/prebuild.xml | |||
@@ -769,7 +769,6 @@ | |||
769 | <Reference name="log4net2"/> | 769 | <Reference name="log4net2"/> |
770 | <Reference name="OpenMetaverseTypes"/> | 770 | <Reference name="OpenMetaverseTypes"/> |
771 | <Reference name="OpenMetaverse.StructuredData2"/> | 771 | <Reference name="OpenMetaverse.StructuredData2"/> |
772 | <Reference name="ExtensionLoader"/> | ||
773 | <Reference name="HttpServer"/> | 772 | <Reference name="HttpServer"/> |
774 | 773 | ||
775 | <!-- for Simple Storage and MySQL storage --> | 774 | <!-- for Simple Storage and MySQL storage --> |