- 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
0.6.3-post-fixes
Mike Mazur 2009-02-16 02:27:34 +00:00
parent f8ea274090
commit 529dd66ed0
9 changed files with 344 additions and 384 deletions

View File

@ -0,0 +1,146 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSim Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
namespace OpenSim.Framework
{
/// <summary>
/// AssetInventoryConfig -- For AssetInventory Server Configuration
/// </summary>
public class AssetInventoryConfig
{
private ConfigurationMember configMember;
public const uint DefaultHttpPort = 8003;
public uint HttpPort = DefaultHttpPort;
public string AssetStorageProvider = "OpenSimAssetStorage";
public string AssetDatabaseConnect = String.Empty;
public string InventoryStorageProvider = "OpenSimInventoryStorage";
public string InventoryDatabaseConnect = String.Empty;
public string AuthenticationProvider = "NullAuthentication";
public string AuthorizationProvider = "AuthorizeAll";
public string MetricsProvider = "NullMetrics";
public string Frontends = "OpenSimAssetFrontend,OpenSimInventoryFrontend";
public AssetInventoryConfig(string description, string filename)
{
configMember = new ConfigurationMember(filename, description, loadConfigurationOptions, handleIncomingConfiguration, true);
configMember.performConfigurationRetrieve();
}
public void loadConfigurationOptions()
{
configMember.addConfigurationOption("listen_port",
ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
"HTTP listener port",
DefaultHttpPort.ToString(),
false);
configMember.addConfigurationOption("asset_storage_provider",
ConfigurationOption.ConfigurationTypes.TYPE_STRING,
"Asset storage provider",
AssetStorageProvider,
false);
configMember.addConfigurationOption("asset_database_connect",
ConfigurationOption.ConfigurationTypes.TYPE_STRING,
"Asset database connection string",
AssetDatabaseConnect,
false);
configMember.addConfigurationOption("inventory_storage_provider",
ConfigurationOption.ConfigurationTypes.TYPE_STRING,
"Inventory storage provider",
InventoryStorageProvider,
false);
configMember.addConfigurationOption("inventory_database_connect",
ConfigurationOption.ConfigurationTypes.TYPE_STRING,
"Inventory database connection string",
InventoryDatabaseConnect,
false);
configMember.addConfigurationOption("authentication_provider",
ConfigurationOption.ConfigurationTypes.TYPE_STRING,
"Authentication provider",
AuthenticationProvider,
false);
configMember.addConfigurationOption("authorization_provider",
ConfigurationOption.ConfigurationTypes.TYPE_STRING,
"Authentication provider",
AuthorizationProvider,
false);
configMember.addConfigurationOption("metrics_provider",
ConfigurationOption.ConfigurationTypes.TYPE_STRING,
"Metrics provider",
MetricsProvider,
false);
configMember.addConfigurationOption("frontends",
ConfigurationOption.ConfigurationTypes.TYPE_STRING,
"Comma-separated list of frontends",
Frontends,
false);
}
public bool handleIncomingConfiguration(string configuration_key, object configuration_result)
{
switch (configuration_key)
{
case "listen_port":
HttpPort = (uint) configuration_result;
break;
case "asset_storage_provider":
AssetStorageProvider = (string) configuration_result;
break;
case "asset_database_connect":
AssetDatabaseConnect = (string) configuration_result;
break;
case "inventory_storage_provider":
InventoryStorageProvider = (string) configuration_result;
break;
case "inventory_database_connect":
InventoryDatabaseConnect = (string) configuration_result;
break;
case "authentication_provider":
AuthenticationProvider = (string) configuration_result;
break;
case "authorization_provider":
AuthorizationProvider = (string) configuration_result;
break;
case "metrics_provider":
MetricsProvider = (string) configuration_result;
break;
case "frontends":
Frontends = (string) configuration_result;
break;
}
return true;
}
}
}

View File

@ -277,6 +277,9 @@ namespace OpenSim.Framework
public class PluginExtensionNode : ExtensionNode public class PluginExtensionNode : ExtensionNode
{ {
[NodeAttribute]
string id = "";
[NodeAttribute] [NodeAttribute]
string provider = ""; string provider = "";
@ -285,6 +288,7 @@ namespace OpenSim.Framework
Type typeobj; Type typeobj;
public string ID { get { return id; } }
public string Provider { get { return provider; } } public string Provider { get { return provider; } }
public string TypeName { get { return type; } } public string TypeName { get { return type; } }
@ -349,7 +353,7 @@ namespace OpenSim.Framework
} }
/// <summary> /// <summary>
/// Filters out which plugin to load based on its the plugin name or names given. Plugin names are contained in /// Filters out which plugin to load based on the plugin name or names given. Plugin names are contained in
/// their addin.xml /// their addin.xml
/// </summary> /// </summary>
public class PluginProviderFilter : IPluginFilter public class PluginProviderFilter : IPluginFilter
@ -390,4 +394,46 @@ namespace OpenSim.Framework
return false; return false;
} }
} }
/// <summary>
/// Filters plugins according to their ID. Plugin IDs are contained in their addin.xml
/// </summary>
public class PluginIdFilter : IPluginFilter
{
private string[] m_filters;
/// <summary>
/// Constructor.
/// </summary>
/// <param name="p">
/// Plugin ID or IDs on which to filter. Multiple names should be separated by commas.
/// </param>
public PluginIdFilter(string p)
{
m_filters = p.Split(',');
for (int i = 0; i < m_filters.Length; i++)
{
m_filters[i] = m_filters[i].Trim();
}
}
/// <summary>
/// Apply this filter to <paramref name="plugin" />.
/// </summary>
/// <param name="plugin">PluginExtensionNode instance to check whether it passes the filter.</param>
/// <returns>true if the plugin's ID matches one of the filters, false otherwise.</returns>
public bool Apply (PluginExtensionNode plugin)
{
for (int i = 0; i < m_filters.Length; i++)
{
if (m_filters[i] == plugin.ID)
{
return true;
}
}
return false;
}
}
} }

View File

@ -32,11 +32,6 @@ using System.Collections.Generic;
using System.IO; using System.IO;
using System.Net; using System.Net;
using System.Reflection; using System.Reflection;
using System.Security.Cryptography.X509Certificates;
using System.ServiceProcess;
using ExtensionLoader;
using ExtensionLoader.Config;
//using HttpServer;
using log4net; using log4net;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Framework.Servers; using OpenSim.Framework.Servers;
@ -44,12 +39,11 @@ using OpenSim.Framework.Console;
namespace OpenSim.Grid.AssetInventoryServer namespace OpenSim.Grid.AssetInventoryServer
{ {
public class AssetInventoryServer : BaseOpenSimServer//ServiceBase public class AssetInventoryServer : BaseOpenSimServer
{ {
public const string CONFIG_FILE = "AssetInventoryServer.ini"; public const string CONFIG_FILE = "AssetInventoryServer.ini";
//public WebServer HttpServer; public AssetInventoryConfig ConfigFile;
public IniConfigSource ConfigFile;
public IAssetStorageProvider StorageProvider; public IAssetStorageProvider StorageProvider;
public IInventoryStorageProvider InventoryProvider; public IInventoryStorageProvider InventoryProvider;
@ -57,72 +51,39 @@ namespace OpenSim.Grid.AssetInventoryServer
public IAuthorizationProvider AuthorizationProvider; public IAuthorizationProvider AuthorizationProvider;
public IMetricsProvider MetricsProvider; public IMetricsProvider MetricsProvider;
private List<IAssetInventoryServerPlugin> frontends = new List<IAssetInventoryServerPlugin>(); private List<IAssetInventoryServerPlugin> m_frontends = new List<IAssetInventoryServerPlugin>();
private List<IAssetInventoryServerPlugin> backends = new List<IAssetInventoryServerPlugin>(); private List<IAssetInventoryServerPlugin> m_backends = new List<IAssetInventoryServerPlugin>();
public AssetInventoryServer() public AssetInventoryServer()
{ {
m_console = new ConsoleBase("Asset"); m_console = new ConsoleBase("Asset");
MainConsole.Instance = m_console; MainConsole.Instance = m_console;
//this.ServiceName = "OpenSimAssetInventoryServer";
} }
public bool Start() public bool Start()
{ {
Logger.Log.Info("Starting Asset Server"); Logger.Log.Info("Starting Asset Server");
List<string> extensionList = null; uint port = 0;
int port = 0;
X509Certificate2 serverCert = null;
try { ConfigFile = new IniConfigSource(CONFIG_FILE); } try { ConfigFile = new AssetInventoryConfig("AssetInventory Server", (Path.Combine(Util.configDir(), "AssetInventoryServer.ini"))); }
catch (Exception) catch (Exception)
{ {
Logger.Log.Error("Failed to load the config file " + CONFIG_FILE); Logger.Log.Error("Failed to load the config file " + CONFIG_FILE);
return false; return false;
} }
try StorageProvider = LoadAssetInventoryServerPlugin("/OpenSim/AssetInventoryServer/StorageProvider", ConfigFile.AssetStorageProvider) as IAssetStorageProvider;
{ m_backends.Add(StorageProvider);
IConfig extensionConfig = ConfigFile.Configs["Config"];
// Load the port number to listen on InventoryProvider = LoadAssetInventoryServerPlugin("/OpenSim/AssetInventoryServer/InventoryProvider", ConfigFile.InventoryStorageProvider) as IInventoryStorageProvider;
port = extensionConfig.GetInt("ListenPort"); m_backends.Add(InventoryProvider);
// Load the server certificate file MetricsProvider = LoadAssetInventoryServerPlugins("/OpenSim/AssetInventoryServer/MetricsProvider", ConfigFile.MetricsProvider) as IMetricsProvider;
string certFile = extensionConfig.GetString("SSLCertFile"); m_backends.Add(MetricsProvider);
if (!String.IsNullOrEmpty(certFile))
serverCert = new X509Certificate2(certFile);
}
catch (Exception)
{
Logger.Log.Error("Failed to load [Config] section from " + CONFIG_FILE);
return false;
}
try try
{ {
// Load the extension list (and ordering) from our config file InitHttpServer(ConfigFile.HttpPort);
IConfig extensionConfig = ConfigFile.Configs["Extensions"];
extensionList = new List<string>(extensionConfig.GetKeys());
}
catch (Exception)
{
Logger.Log.Error("Failed to load [Extensions] section from " + CONFIG_FILE);
return false;
}
StorageProvider = LoadAssetInventoryServerPlugin("/OpenSim/AssetInventoryServer/StorageProvider", "OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim.dll") as IAssetStorageProvider;
backends.Add(StorageProvider);
InventoryProvider = LoadAssetInventoryServerPlugin("/OpenSim/AssetInventoryServer/InventoryProvider", "OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim.dll") as IInventoryStorageProvider;
backends.Add(InventoryProvider);
MetricsProvider = LoadAssetInventoryServerPlugin("/OpenSim/AssetInventoryServer/MetricsProvider", String.Empty) as IMetricsProvider;
backends.Add(MetricsProvider);
try
{
InitHttpServer(port, serverCert);
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -131,13 +92,13 @@ namespace OpenSim.Grid.AssetInventoryServer
return false; return false;
} }
frontends.AddRange(LoadAssetInventoryServerPlugins("/OpenSim/AssetInventoryServer/Frontend", String.Empty)); AuthenticationProvider = LoadAssetInventoryServerPlugin("/OpenSim/AssetInventoryServer/AuthenticationProvider", ConfigFile.AuthenticationProvider) as IAuthenticationProvider;
m_backends.Add(AuthenticationProvider);
AuthenticationProvider = LoadAssetInventoryServerPlugin("/OpenSim/AssetInventoryServer/AuthenticationProvider", String.Empty) as IAuthenticationProvider; AuthorizationProvider = LoadAssetInventoryServerPlugin("/OpenSim/AssetInventoryServer/AuthorizationProvider", ConfigFile.AuthorizationProvider) as IAuthorizationProvider;
backends.Add(AuthenticationProvider); m_backends.Add(AuthorizationProvider);
AuthorizationProvider = LoadAssetInventoryServerPlugin("/OpenSim/AssetInventoryServer/AuthorizationProvider", String.Empty) as IAuthorizationProvider; m_frontends.AddRange(LoadAssetInventoryServerPlugins("/OpenSim/AssetInventoryServer/Frontend", ConfigFile.Frontends));
backends.Add(AuthorizationProvider);
return true; return true;
} }
@ -154,7 +115,7 @@ namespace OpenSim.Grid.AssetInventoryServer
public override void ShutdownSpecific() public override void ShutdownSpecific()
{ {
foreach (IAssetInventoryServerPlugin plugin in frontends) foreach (IAssetInventoryServerPlugin plugin in m_frontends)
{ {
Logger.Log.Debug("Disposing plugin " + plugin.Name); Logger.Log.Debug("Disposing plugin " + plugin.Name);
try { plugin.Dispose(); } try { plugin.Dispose(); }
@ -162,7 +123,7 @@ namespace OpenSim.Grid.AssetInventoryServer
{ Logger.Log.ErrorFormat("Failure shutting down plugin {0}: {1}", plugin.Name, ex.Message); } { Logger.Log.ErrorFormat("Failure shutting down plugin {0}: {1}", plugin.Name, ex.Message); }
} }
foreach (IAssetInventoryServerPlugin plugin in backends) foreach (IAssetInventoryServerPlugin plugin in m_backends)
{ {
Logger.Log.Debug("Disposing plugin " + plugin.Name); Logger.Log.Debug("Disposing plugin " + plugin.Name);
try { plugin.Dispose(); } try { plugin.Dispose(); }
@ -174,47 +135,14 @@ namespace OpenSim.Grid.AssetInventoryServer
HttpServer.Stop(); HttpServer.Stop();
} }
void InitHttpServer(int port, X509Certificate serverCert) void InitHttpServer(uint port)
{ {
//if (serverCert != null) m_httpServer = new BaseHttpServer(port);
// HttpServer = new WebServer(IPAddress.Any, port, serverCert, null, false); m_httpServer.Start();
//else
// HttpServer = new WebServer(IPAddress.Any, port);
//HttpServer.LogWriter = new log4netLogWriter(Logger.Log);
//HttpServer.Set404Handler(
// delegate(IHttpClientContext client, IHttpRequest request, IHttpResponse response)
// {
// Logger.Log.Warn("Requested page was not found: " + request.Uri.PathAndQuery);
// string notFoundString = "<html><head><title>Page Not Found</title></head><body>The requested page or method was not found</body></html>";
// byte[] buffer = System.Text.Encoding.UTF8.GetBytes(notFoundString);
// response.Body.Write(buffer, 0, buffer.Length);
// response.Status = HttpStatusCode.NotFound;
// return true;
// }
//);
m_httpServer = new BaseHttpServer(8003);
HttpServer.Start();
Logger.Log.Info("Asset server is listening on port " + port); Logger.Log.Info("Asset server is listening on port " + port);
} }
#region ServiceBase Overrides
//protected override void OnStart(string[] args)
//{
// Start();
//}
//protected override void OnStop()
//{
// Shutdown();
//}
#endregion
private IAssetInventoryServerPlugin LoadAssetInventoryServerPlugin(string addinPath, string provider) private IAssetInventoryServerPlugin LoadAssetInventoryServerPlugin(string addinPath, string provider)
{ {
PluginLoader<IAssetInventoryServerPlugin> loader = new PluginLoader<IAssetInventoryServerPlugin>(new AssetInventoryServerPluginInitialiser(this)); PluginLoader<IAssetInventoryServerPlugin> loader = new PluginLoader<IAssetInventoryServerPlugin>(new AssetInventoryServerPluginInitialiser(this));
@ -222,7 +150,7 @@ namespace OpenSim.Grid.AssetInventoryServer
if (provider == String.Empty) if (provider == String.Empty)
loader.Add(addinPath); loader.Add(addinPath);
else else
loader.Add(addinPath, new PluginProviderFilter(provider)); loader.Add(addinPath, new PluginIdFilter(provider));
//loader.Add(addinPath, new PluginCountConstraint(1)); //loader.Add(addinPath, new PluginCountConstraint(1));
loader.Load(); loader.Load();
@ -237,7 +165,7 @@ namespace OpenSim.Grid.AssetInventoryServer
if (provider == String.Empty) if (provider == String.Empty)
loader.Add(addinPath); loader.Add(addinPath);
else else
loader.Add(addinPath, new PluginProviderFilter(provider)); loader.Add(addinPath, new PluginIdFilter(provider));
//loader.Add(addinPath, new PluginCountConstraint(1)); //loader.Add(addinPath, new PluginCountConstraint(1));
loader.Load(); loader.Load();
@ -245,37 +173,4 @@ namespace OpenSim.Grid.AssetInventoryServer
return loader.Plugins; return loader.Plugins;
} }
} }
//public class log4netLogWriter : ILogWriter
//{
// ILog Log;
// public log4netLogWriter(ILog log)
// {
// Log = log;
// }
// public void Write(object source, LogPrio prio, string message)
// {
// switch (prio)
// {
// case LogPrio.Trace:
// case LogPrio.Debug:
// Log.DebugFormat("{0}: {1}", source, message);
// break;
// case LogPrio.Info:
// Log.InfoFormat("{0}: {1}", source, message);
// break;
// case LogPrio.Warning:
// Log.WarnFormat("{0}: {1}", source, message);
// break;
// case LogPrio.Error:
// Log.ErrorFormat("{0}: {1}", source, message);
// break;
// case LogPrio.Fatal:
// Log.FatalFormat("{0}: {1}", source, message);
// break;
// }
// }
//}
} }

View File

@ -1,78 +0,0 @@
/*
* Copyright (c) 2008 Intel Corporation
* All rights reserved.
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* -- Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* -- Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* -- Neither the name of the Intel Corporation nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE INTEL OR ITS
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.Xml;
using ExtensionLoader.Config;
using MySql.Data.MySqlClient;
namespace OpenSim.Grid.AssetInventoryServer.Extensions
{
public static class DBConnString
{
private static string connectionString;
/// <summary>
/// Parses the MySQL connection string out of either the asset server
/// .ini or a OpenSim-style .xml file and caches the result for future
/// requests
/// </summary>
public static string GetConnectionString(IniConfigSource configFile)
{
if (connectionString == null)
{
// Try parsing from the ini file
try
{
// Load the extension list (and ordering) from our config file
IConfig extensionConfig = configFile.Configs["MySQL"];
connectionString = extensionConfig.GetString("database_connect", null);
}
catch (Exception) { }
if (connectionString != null)
{
// Force MySQL's broken connection pooling off
MySqlConnectionStringBuilder builder = new MySqlConnectionStringBuilder(connectionString);
builder.Pooling = false;
if (String.IsNullOrEmpty(builder.Database))
Logger.Log.Error("No database selected in the connectionString: " + connectionString);
connectionString = builder.ToString();
}
else
{
Logger.Log.Error("Database connection string is missing, check that the database_connect line is " +
"correct and uncommented in AssetInventoryServer.ini");
}
}
return connectionString;
}
}
}

View File

@ -35,7 +35,6 @@ using MySql.Data.MySqlClient;
using OpenMetaverse; using OpenMetaverse;
using OpenMetaverse.StructuredData; using OpenMetaverse.StructuredData;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Grid.AssetInventoryServer.Extensions;
using OpenSim.Data; using OpenSim.Data;
namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
@ -58,7 +57,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
metadata = null; metadata = null;
BackendResponse ret; BackendResponse ret;
using (MySqlConnection dbConnection = new MySqlConnection(DBConnString.GetConnectionString(server.ConfigFile))) using (MySqlConnection dbConnection = new MySqlConnection(server.ConfigFile.AssetDatabaseConnect))
{ {
IDataReader reader; IDataReader reader;
@ -104,7 +103,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
assetData = null; assetData = null;
BackendResponse ret; BackendResponse ret;
using (MySqlConnection dbConnection = new MySqlConnection(DBConnString.GetConnectionString(server.ConfigFile))) using (MySqlConnection dbConnection = new MySqlConnection(server.ConfigFile.AssetDatabaseConnect))
{ {
IDataReader reader; IDataReader reader;
@ -156,7 +155,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
{ {
BackendResponse ret; BackendResponse ret;
using (MySqlConnection dbConnection = new MySqlConnection(DBConnString.GetConnectionString(server.ConfigFile))) using (MySqlConnection dbConnection = new MySqlConnection(server.ConfigFile.AssetDatabaseConnect))
{ {
try try
{ {
@ -205,7 +204,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
{ {
int rowCount = 0; int rowCount = 0;
using (MySqlConnection dbConnection = new MySqlConnection(DBConnString.GetConnectionString(server.ConfigFile))) using (MySqlConnection dbConnection = new MySqlConnection(server.ConfigFile.AssetDatabaseConnect))
{ {
MySqlDataReader reader; MySqlDataReader reader;
@ -255,7 +254,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
try try
{ {
m_assetProvider = DataPluginFactory.LoadDataPlugin<IAssetDataPlugin>("OpenSim.Data.MySQL.dll", server.ConfigFile.Configs["MySQL"].GetString("database_connect", null)); m_assetProvider = DataPluginFactory.LoadDataPlugin<IAssetDataPlugin>("OpenSim.Data.MySQL.dll", server.ConfigFile.AssetDatabaseConnect);
if (m_assetProvider == null) if (m_assetProvider == null)
{ {
Logger.Log.Error("[ASSET]: Failed to load a database plugin, server halting."); Logger.Log.Error("[ASSET]: Failed to load a database plugin, server halting.");

View File

@ -35,7 +35,6 @@ using MySql.Data.MySqlClient;
using OpenMetaverse; using OpenMetaverse;
using OpenMetaverse.StructuredData; using OpenMetaverse.StructuredData;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Grid.AssetInventoryServer.Extensions;
using OpenSim.Data; using OpenSim.Data;
namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
@ -58,7 +57,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
item = null; item = null;
BackendResponse ret; BackendResponse ret;
using (MySqlConnection dbConnection = new MySqlConnection(DBConnString.GetConnectionString(server.ConfigFile))) using (MySqlConnection dbConnection = new MySqlConnection(server.ConfigFile.InventoryDatabaseConnect))
{ {
IDataReader reader; IDataReader reader;
@ -120,7 +119,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
folder = null; folder = null;
BackendResponse ret; BackendResponse ret;
using (MySqlConnection dbConnection = new MySqlConnection(DBConnString.GetConnectionString(server.ConfigFile))) using (MySqlConnection dbConnection = new MySqlConnection(server.ConfigFile.InventoryDatabaseConnect))
{ {
IDataReader reader; IDataReader reader;
@ -167,7 +166,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
contents = null; contents = null;
BackendResponse ret; BackendResponse ret;
using (MySqlConnection dbConnection = new MySqlConnection(DBConnString.GetConnectionString(server.ConfigFile))) using (MySqlConnection dbConnection = new MySqlConnection(server.ConfigFile.InventoryDatabaseConnect))
{ {
IDataReader reader; IDataReader reader;
@ -267,7 +266,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
if (Utils.TryGetOpenSimUUID(owner, out ownerID)) if (Utils.TryGetOpenSimUUID(owner, out ownerID))
{ {
using (MySqlConnection dbConnection = new MySqlConnection(DBConnString.GetConnectionString(server.ConfigFile))) using (MySqlConnection dbConnection = new MySqlConnection(server.ConfigFile.InventoryDatabaseConnect))
{ {
IDataReader reader; IDataReader reader;
@ -333,7 +332,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
// Fetch inventory items // Fetch inventory items
if (Utils.TryGetOpenSimUUID(owner, out ownerID)) if (Utils.TryGetOpenSimUUID(owner, out ownerID))
{ {
using (MySqlConnection dbConnection = new MySqlConnection(DBConnString.GetConnectionString(server.ConfigFile))) using (MySqlConnection dbConnection = new MySqlConnection(server.ConfigFile.InventoryDatabaseConnect))
{ {
IDataReader reader; IDataReader reader;
@ -405,7 +404,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
if (Utils.TryGetOpenSimUUID(owner, out ownerID)) if (Utils.TryGetOpenSimUUID(owner, out ownerID))
{ {
using (MySqlConnection dbConnection = new MySqlConnection(DBConnString.GetConnectionString(server.ConfigFile))) using (MySqlConnection dbConnection = new MySqlConnection(server.ConfigFile.InventoryDatabaseConnect))
{ {
IDataReader reader; IDataReader reader;
@ -470,7 +469,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
{ {
BackendResponse ret; BackendResponse ret;
using (MySqlConnection dbConnection = new MySqlConnection(DBConnString.GetConnectionString(server.ConfigFile))) using (MySqlConnection dbConnection = new MySqlConnection(server.ConfigFile.InventoryDatabaseConnect))
{ {
try try
{ {
@ -537,7 +536,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
{ {
BackendResponse ret; BackendResponse ret;
using (MySqlConnection dbConnection = new MySqlConnection(DBConnString.GetConnectionString(server.ConfigFile))) using (MySqlConnection dbConnection = new MySqlConnection(server.ConfigFile.InventoryDatabaseConnect))
{ {
try try
{ {
@ -593,7 +592,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
if (Utils.TryGetOpenSimUUID(owner, out ownerID)) if (Utils.TryGetOpenSimUUID(owner, out ownerID))
{ {
using (MySqlConnection dbConnection = new MySqlConnection(DBConnString.GetConnectionString(server.ConfigFile))) using (MySqlConnection dbConnection = new MySqlConnection(server.ConfigFile.InventoryDatabaseConnect))
{ {
try try
{ {
@ -639,7 +638,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
if (Utils.TryGetOpenSimUUID(owner, out ownerID)) if (Utils.TryGetOpenSimUUID(owner, out ownerID))
{ {
using (MySqlConnection dbConnection = new MySqlConnection(DBConnString.GetConnectionString(server.ConfigFile))) using (MySqlConnection dbConnection = new MySqlConnection(server.ConfigFile.InventoryDatabaseConnect))
{ {
try try
{ {
@ -685,7 +684,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
if (Utils.TryGetOpenSimUUID(owner, out ownerID)) if (Utils.TryGetOpenSimUUID(owner, out ownerID))
{ {
using (MySqlConnection dbConnection = new MySqlConnection(DBConnString.GetConnectionString(server.ConfigFile))) using (MySqlConnection dbConnection = new MySqlConnection(server.ConfigFile.InventoryDatabaseConnect))
{ {
try try
{ {
@ -739,7 +738,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
{ {
int rowCount = 0; int rowCount = 0;
using (MySqlConnection dbConnection = new MySqlConnection(DBConnString.GetConnectionString(server.ConfigFile))) using (MySqlConnection dbConnection = new MySqlConnection(server.ConfigFile.InventoryDatabaseConnect))
{ {
MySqlDataReader reader; MySqlDataReader reader;
@ -789,7 +788,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
try try
{ {
m_inventoryProvider = DataPluginFactory.LoadDataPlugin<IInventoryDataPlugin>("OpenSim.Data.MySQL.dll", server.ConfigFile.Configs["MySQL"].GetString("database_connect", null)); m_inventoryProvider = DataPluginFactory.LoadDataPlugin<IInventoryDataPlugin>("OpenSim.Data.MySQL.dll", server.ConfigFile.InventoryDatabaseConnect);
if (m_inventoryProvider == null) if (m_inventoryProvider == null)
{ {
Logger.Log.Error("[INVENTORY]: Failed to load a database plugin, server halting."); Logger.Log.Error("[INVENTORY]: Failed to load a database plugin, server halting.");

View File

@ -8,7 +8,7 @@
</Dependencies> </Dependencies>
<Extension path="/OpenSim/AssetInventoryServer/MetricsProvider"> <Extension path="/OpenSim/AssetInventoryServer/MetricsProvider">
<Plugin id="AssetInventoryMetrics" provider="OpenSim.Grid.AssetInventoryServer.Plugins.dll" type="OpenSim.Grid.AssetInventoryServer.Plugins.NullMetricsPlugin" /> <Plugin id="NullMetrics" provider="OpenSim.Grid.AssetInventoryServer.Plugins.dll" type="OpenSim.Grid.AssetInventoryServer.Plugins.NullMetricsPlugin" />
</Extension> </Extension>
<Extension path="/OpenSim/AssetInventoryServer/Frontend"> <Extension path="/OpenSim/AssetInventoryServer/Frontend">
<Plugin id="BrowseFrontend" provider="OpenSim.Grid.AssetInventoryServer.Plugins.dll" type="OpenSim.Grid.AssetInventoryServer.Plugins.BrowseFrontendPlugin" /> <Plugin id="BrowseFrontend" provider="OpenSim.Grid.AssetInventoryServer.Plugins.dll" type="OpenSim.Grid.AssetInventoryServer.Plugins.BrowseFrontendPlugin" />

View File

@ -1,153 +1,107 @@
[Config] ;[Config]
; The port number for the asset server to listen on. If a valid SSL certificate ; The port number for the asset server to listen on.
; file is given for SSLCertFile, the HTTPS protocol will be used. Otherwise, the listen_port = 8003
; HTTP protocol is used.
ListenPort = 8003 ;[Extensions]
; An SSL certificate file for the server. If a valid raw certificate or PKCS#12 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; file is given the server will run in HTTPS mode. ; Asset Storage Provider
;SSLCertFile = server.p12 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
[Extensions] ; Simple storage is a very basic storage system for the purposes of illustrating
; a storage backend example. The assets are stored in SimpleAssets/ and
;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; TempAssets/ (which is deleted when the server shuts down). Metadata is
; Storage Providers ; generated for all of the files at startup and when new assets are uploaded.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;asset_storage_provider = SimpleAssetStorage
; Simple storage is a very basic storage system for the purposes of illustrating ; OpenSimMySQL storage connects to a MySQL server that has an assets table created
; a storage backend example. The assets are stored in SimpleAssets/ and ; by OpenSim. Open the AssetServer_Config.xml file from OpenSim and use the
; TempAssets/ (which is deleted when the server shuts down). Metadata is ; database connection string for the database_connect option in the MySQL section
; generated for all of the files at startup and when new assets are uploaded. ; below. This backend combined with the OpenSimFrontend will allow the asset
;SimpleStorage ; server to be used as a drop-in replacement for OpenSim.Grid.AssetServer.exe,
; while also allowing other frontends to run.
; OpenSimMySQL storage connects to a MySQL server that has an assets table created asset_storage_provider = OpenSimAssetStorage
; by OpenSim. Open the AssetServer_Config.xml file from OpenSim and use the
; database connection string for the database_connect option in the MySQL section ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; below. This backend combined with the OpenSimFrontend will allow the asset ; Inventory Storage Provider
; server to be used as a drop-in replacement for OpenSim.Grid.AssetServer.exe, ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; while also allowing other frontends to run.
OpenSimMySQLStorage ; Simple inventory is a very basic inventory storage system for the purposes of
; illustrating an inventory backend example. The inventory is stored in
; Uses Amazon.com's Simple Storage Service (http://aws.amazon.com/s3/) to store ; SimpleInventory/ by creating a folder for each agent that contains all of the
; asset data and metadata. This backend does not handle any data requests, as the ; inventory items and folders serialized as XML files.
; data is stored remotely and metadata replies will contain the amazon.com URL ;inventory_asset_provider = SimpleInventoryStorage
; holding the actual asset data. Your Access Key ID and Secret Access Key must be
; set in the [Amazon] section below for this backend to function. If ; OpenSimMySQL inventory connects to a MySQL server that has an inventory table
; UseCloudFront is true and your Amazon account has CloudFront enabled, ; created by OpenSim. If the OpenSimMySQLStorage backend is also being used, the
; CloudFront URLs will be returned in metadata instead of normal S3 URLs. ; inventory and asset tables must be stored in the same database. The
;AmazonS3Storage ; database_connect string in the MySQL section below is used to connect to the
; database. This backend combined with the OpenSimInventoryFrontend will allow
; Uses memcached (http://www.danga.com/memcached/) as a caching layer on top of ; the server to be used as a drop-in replacement for
; another storage backend. If you use this, make sure you enable another storage ; OpenSim.Grid.InventoryServer.exe, while also allowing other frontends to run.
; provider as the actual backend, and that the MemcacheStorage line appears in inventory_asset_provider = OpenSimInventoryStorage
; this config file after the other storage provider.
;MemcachedStorage ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Authentication Provider
;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Inventory Providers
;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; NullAuthentication does nothing.
authentication_provider = NullAuthentication
; Simple inventory is a very basic inventory storage system for the purposes of
; illustrating an inventory backend example. The inventory is stored in ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; SimpleInventory/ by creating a folder for each agent that contains all of the ; Authorization Provider
; inventory items and folders serialized as XML files. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;SimpleInventory
; Authorize all is a dummy authorization module that allows all requests for
; OpenSimMySQL inventory connects to a MySQL server that has an inventory table ; metadata, data, and asset creation. Use this extension if your primary
; created by OpenSim. If the OpenSimMySQLStorage backend is also being used, the ; storage provider or front-end interface does not support authentication.
; inventory and asset tables must be stored in the same database. The authroization_provider = AuthorizeAll
; database_connect string in the MySQL section below is used to connect to the
; database. This backend combined with the OpenSimInventoryFrontend will allow ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; the server to be used as a drop-in replacement for ; Metrics Provider
; OpenSim.Grid.InventoryServer.exe, while also allowing other frontends to run. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
OpenSimMySQLInventory
; NullMetrics contains empty logging functions. Use this metrics provider if
;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; you want to disable metrics collection and reporting.
; Authentication Providers metrics_provider = NullMetrics
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; OpenID provides a direct method of authenticating with the asset server. Users ; Frontends
; can provide credentials and receive a session token directly from the asset ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; server. The OpenIdAuth module provides a browser-based form login and an
; XML-based API, both accessible through the URL /authenticate. ; Specify multiple frontends as a comma-separated list.
;OpenIdAuth
NullAuthentication ; ReferenceFrontend is a simple frontend that provides three basic REST
; methods. /assetid/metadata will return the metadata for an asset (currently in
;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; LLSD format, that will change soon). /assetid/data will return the raw asset
; Authorization Providers ; data with proper Content-Type and Content-Disposition headers to make
;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; downloading assets in a web browser easy.
; Authorize all is a dummy authorization module that allows all requests for ; OpenSimAssetFrontend is a frontend that matches the existing OpenSim XML for
; metadata, data, and asset creation. Use this extension if your primary ; transferring grid assets. This will allow the asset server to function as a
; storage provider or front-end interface does not support authentication. ; drop-in replacement for OpenSim.Grid.AssetServer.exe, and can be combined with
AuthorizeAll ; OpenSimAssetStorage to provide an identical replacement, or any other asset
; storage backend.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Metrics Providers ; OpenSimInventoryFrontend is a frontend that matches the existing OpenSim XML
;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; for transferring inventory. This will allow the inventory server to function as
; a drop-in replacement for OpenSim.Grid.InventoryServer.exe, and can be combined
; NullMetrics contains empty logging functions. Use this metrics provider if ; with OpenSimInventoryStorage to provide an identical replacement, or any other
; you want to disable metrics collection and reporting. ; inventory storage backend.
NullMetrics ; *** NOTE: Inventory is not currently implemented.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; BrowseFrontend is an HTML interface for browsing through the asset store.
; Frontends
;;;;;;;;;;;;;;;;;;;;;;;;;;;;; frontends = ReferenceFrontend,OpenSimAssetFrontend,OpenSimInventoryFrontend,BrowseFrontend
; A simple frontend that provides three basic REST methods. /assetid/metadata ;[MySQL]
; will return the metadata for an asset (currently in LLSD format, that will
; change soon). /assetid/data will return the raw asset data with proper ; Database connection string used by the OpenSim MySQL backend. If these lines
; Content-Type and Content-Disposition headers to make downloading assets in a ; are commented out or missing, the server will look for an
; web browser easy. ; AssetServer_Config.xml or InventoryServer_Config.xml file in the current
ReferenceFrontend ; working directory. These files are generated by OpenSim.Grid.AssetServer.exe
; and OpenSim.Grid.InventoryServer.exe, respectively, and can be used without
; A frontend that matches the existing OpenSim XML for transferring grid ; modification.
; assets. This will allow the asset server to function as a drop-in replacement asset_database_connect = "Server=localhost; Database=opensim; User=changeme; Password=changeme;"
; for OpenSim.Grid.AssetServer.exe, and can be combined with OpenSimMySQLStorage inventory_database_connect = "Server=localhost; Database=opensim; User=changeme; Password=changeme;"
; to provide an identical replacement or any other storage backend.
OpenSimFrontend
; A frontend that matches the existing OpenSim XML for handling inventory
; transactions. This will allow the asset server to function as a drop-in
; replacement for OpenSim.Grid.InventoryServer.exe, and can be combined with
; OpenSimMySQLInventory to provide an identical replacement or any other
; inventory backend.
OpenSimInventoryFrontend
; An HTML interface for browsing through the asset store
BrowseFrontend
[MySQL]
; Database connection string used by the OpenSim MySQL backend. If this line is
; commented out or missing, the server will look for an AssetServer_Config.xml
; in the current working directory. This file is generated by
; OpenSim.Grid.AssetServer.exe and can be used without modification.
database_connect = "Server=localhost; Database=opensim; User=changeme; Password=changeme;"
[Amazon]
; Get these values by logging in to your Amazon S3 account and going to
; https://aws-portal.amazon.com/gp/aws/developer/account/index.html?ie=UTF8&action=access-key
AccessKeyID = xxxxxxxxxxxxxxxxxxxx
SecretAccessKey = xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
; The bucket, or namespace, in your Amazon S3 account for storing assets in.
; Bucket names on S3 are global identifiers, and must be unique. Think up
; something clever or random.
BucketName = changeme
; Amazon CloudFront is a Content Distribution Network for S3 stores. If this is
; set to true, AmazonS3Storage will try to locate the first available CloudFront
; distribution tied to the active S3 bucket. If no usable distribution is found,
; a new one will be created.
UseCloudFront = true
[Memcached]
; A comma-separated list of the memcached servers that make up your caching
; pool. Each server is a hostname or IP address, optionally followed by a
; colon and port number if the server is not listening on the default 11211
; port.
Servers = localhost

View File

@ -769,7 +769,6 @@
<Reference name="log4net2"/> <Reference name="log4net2"/>
<Reference name="OpenMetaverseTypes"/> <Reference name="OpenMetaverseTypes"/>
<Reference name="OpenMetaverse.StructuredData2"/> <Reference name="OpenMetaverse.StructuredData2"/>
<Reference name="ExtensionLoader"/>
<Reference name="HttpServer"/> <Reference name="HttpServer"/>
<!-- for Simple Storage and MySQL storage --> <!-- for Simple Storage and MySQL storage -->