From 5277fc64c07da92014e749be40aa837193a26495 Mon Sep 17 00:00:00 2001
From: Mike Mazur
Date: Mon, 16 Feb 2009 02:27:43 +0000
Subject: - change AssetInventoryServer config from XML to INI - convert
AssetInventoryServer logging to OpenSim's log4net - updated
AssetInventoryServer.ini.example file
---
OpenSim/Framework/AssetInventoryConfig.cs | 146 ---------------------
.../AssetInventoryServer/AssetInventoryConfig.cs | 97 ++++++++++++++
.../AssetInventoryServer/AssetInventoryServer.cs | 53 ++++----
OpenSim/Grid/AssetInventoryServer/Logger.cs | 62 ---------
OpenSim/Grid/AssetInventoryServer/Main.cs | 21 ++-
.../Plugins/AuthorizeAllPlugin.cs | 7 +-
.../Plugins/BrowseFrontendPlugin.cs | 7 +-
.../Plugins/NullAuthenticationPlugin.cs | 7 +-
.../Plugins/NullMetricsPlugin.cs | 28 ++--
.../Plugins/OpenSim/OpenSimAssetFrontendPlugin.cs | 16 ++-
.../Plugins/OpenSim/OpenSimAssetStoragePlugin.cs | 47 ++++---
.../OpenSim/OpenSimInventoryFrontendPlugin.cs | 19 +--
.../OpenSim/OpenSimInventoryStoragePlugin.cs | 105 ++++++++-------
.../Plugins/ReferenceFrontendPlugin.cs | 9 +-
.../Plugins/Simple/SimpleAssetStoragePlugin.cs | 19 +--
.../Plugins/Simple/SimpleInventoryStoragePlugin.cs | 23 ++--
bin/AssetInventoryServer.ini.example | 34 ++++-
bin/OpenSim.Grid.AssetInventoryServer.exe.config | 34 +++++
prebuild.xml | 7 +-
19 files changed, 368 insertions(+), 373 deletions(-)
delete mode 100644 OpenSim/Framework/AssetInventoryConfig.cs
create mode 100644 OpenSim/Grid/AssetInventoryServer/AssetInventoryConfig.cs
delete mode 100644 OpenSim/Grid/AssetInventoryServer/Logger.cs
create mode 100644 bin/OpenSim.Grid.AssetInventoryServer.exe.config
diff --git a/OpenSim/Framework/AssetInventoryConfig.cs b/OpenSim/Framework/AssetInventoryConfig.cs
deleted file mode 100644
index 9277b5e..0000000
--- a/OpenSim/Framework/AssetInventoryConfig.cs
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- * 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
-{
- ///
- /// AssetInventoryConfig -- For AssetInventory Server Configuration
- ///
- 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;
- }
- }
-}
diff --git a/OpenSim/Grid/AssetInventoryServer/AssetInventoryConfig.cs b/OpenSim/Grid/AssetInventoryServer/AssetInventoryConfig.cs
new file mode 100644
index 0000000..ed56c75
--- /dev/null
+++ b/OpenSim/Grid/AssetInventoryServer/AssetInventoryConfig.cs
@@ -0,0 +1,97 @@
+/*
+ * 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 OpenSimulator 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;
+using System.IO;
+using System.Reflection;
+using OpenSim.Framework;
+using log4net;
+using Nini.Config;
+
+namespace OpenSim.Grid.AssetInventoryServer
+{
+ public static class AssetInventoryConfig
+ {
+ public const string CONFIG_FILE = "AssetInventoryServer.ini";
+ private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
+
+ public static IConfigSource LoadConfig()
+ {
+ IConfigSource configSource = new IniConfigSource();
+ configSource.AddConfig("Startup");
+ return LoadConfig(configSource);
+ }
+
+ public static IConfigSource LoadConfig(IConfigSource source)
+ {
+ string iniFileName = source.Configs["Startup"].GetString("inifile", CONFIG_FILE);
+ string iniFilePath = Path.Combine(Util.configDir(), iniFileName);
+
+ source.Merge(DefaultConfig());
+
+ if (!File.Exists(iniFilePath))
+ {
+ m_log.FatalFormat("[CONFIG] File {0} not found, could not load any configuration.", iniFilePath);
+ m_log.FatalFormat("[CONFIG] Did you copy the AssetInventoryServer.ini.example file to AssetInventoryServer.ini?");
+ Environment.Exit(1);
+ }
+
+ source.Merge(new IniConfigSource(iniFilePath));
+ return source;
+ }
+
+ private static IConfigSource DefaultConfig()
+ {
+ IConfigSource result = new IniConfigSource();
+
+ {
+ IConfig config = result.AddConfig("Config");
+ config.Set("listen_port", 8003);
+ }
+
+ {
+ IConfig config = result.AddConfig("Plugins");
+ config.Set("asset_storage_provider", "OpenSimAssetStorage");
+ config.Set("inventory_storage_provider", "OpenSimInventoryStorage");
+ config.Set("authentication_provider", "NullAuthentication");
+ config.Set("authorization_provider", "AuthorizeAll");
+ config.Set("metrics_provider", "NullMetrics");
+ config.Set("frontends", "ReferenceFrontend,OpenSimAssetFrontend,OpenSimInventoryFrontend,BrowseFrontend");
+ }
+
+ {
+ IConfig config = result.AddConfig("OpenSim");
+ config.Set("asset_database_provider", "OpenSim.Data.MySQL.dll");
+ config.Set("inventory_database_provider", "OpenSim.Data.MySQL.dll");
+ config.Set("asset_database_connect", String.Empty);
+ config.Set("inventory_database_connect", String.Empty);
+ }
+
+ return result;
+ }
+ }
+}
diff --git a/OpenSim/Grid/AssetInventoryServer/AssetInventoryServer.cs b/OpenSim/Grid/AssetInventoryServer/AssetInventoryServer.cs
index f6d46e8..b76b9c6 100644
--- a/OpenSim/Grid/AssetInventoryServer/AssetInventoryServer.cs
+++ b/OpenSim/Grid/AssetInventoryServer/AssetInventoryServer.cs
@@ -32,18 +32,18 @@ using System.Collections.Generic;
using System.IO;
using System.Net;
using System.Reflection;
-using log4net;
using OpenSim.Framework;
using OpenSim.Framework.Servers;
using OpenSim.Framework.Console;
+using Nini.Config;
+using log4net;
namespace OpenSim.Grid.AssetInventoryServer
{
public class AssetInventoryServer : BaseOpenSimServer
{
- public const string CONFIG_FILE = "AssetInventoryServer.ini";
-
- public AssetInventoryConfig ConfigFile;
+ private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
+ public IConfigSource ConfigFile;
public IAssetStorageProvider StorageProvider;
public IInventoryStorageProvider InventoryProvider;
@@ -54,51 +54,58 @@ namespace OpenSim.Grid.AssetInventoryServer
private List m_frontends = new List();
private List m_backends = new List();
- public AssetInventoryServer()
+ public AssetInventoryServer(IConfigSource config)
{
- m_console = new ConsoleBase("Asset");
+ ConfigFile = config;
+
+ m_console = new ConsoleBase("AssetInventory");
MainConsole.Instance = m_console;
}
public bool Start()
{
- Logger.Log.Info("Starting Asset Server");
- uint port = 0;
+ Startup();
+ m_log.Info("[ASSETINVENTORY] Starting AssetInventory Server");
- try { ConfigFile = new AssetInventoryConfig("AssetInventory Server", (Path.Combine(Util.configDir(), "AssetInventoryServer.ini"))); }
+ try
+ {
+ ConfigFile = AssetInventoryConfig.LoadConfig(ConfigFile);
+ }
catch (Exception)
{
- Logger.Log.Error("Failed to load the config file " + CONFIG_FILE);
+ m_log.Error("[ASSETINVENTORY] Failed to load the config.");
return false;
}
- StorageProvider = LoadAssetInventoryServerPlugin("/OpenSim/AssetInventoryServer/StorageProvider", ConfigFile.AssetStorageProvider) as IAssetStorageProvider;
+ IConfig pluginConfig = ConfigFile.Configs["Plugins"];
+
+ StorageProvider = LoadAssetInventoryServerPlugin("/OpenSim/AssetInventoryServer/StorageProvider", pluginConfig.GetString("asset_storage_provider")) as IAssetStorageProvider;
m_backends.Add(StorageProvider);
- InventoryProvider = LoadAssetInventoryServerPlugin("/OpenSim/AssetInventoryServer/InventoryProvider", ConfigFile.InventoryStorageProvider) as IInventoryStorageProvider;
+ InventoryProvider = LoadAssetInventoryServerPlugin("/OpenSim/AssetInventoryServer/InventoryProvider", pluginConfig.GetString("inventory_storage_provider")) as IInventoryStorageProvider;
m_backends.Add(InventoryProvider);
- MetricsProvider = LoadAssetInventoryServerPlugins("/OpenSim/AssetInventoryServer/MetricsProvider", ConfigFile.MetricsProvider) as IMetricsProvider;
+ MetricsProvider = LoadAssetInventoryServerPlugin("/OpenSim/AssetInventoryServer/MetricsProvider", pluginConfig.GetString("metrics_provider")) as IMetricsProvider;
m_backends.Add(MetricsProvider);
try
{
- InitHttpServer(ConfigFile.HttpPort);
+ InitHttpServer((uint) ConfigFile.Configs["Config"].GetInt("listen_port"));
}
catch (Exception ex)
{
- Logger.Log.Error("Initializing the HTTP server failed, shutting down: " + ex.Message);
+ m_log.Error("[ASSETINVENTORY] Initializing the HTTP server failed, shutting down: " + ex.Message);
Shutdown();
return false;
}
- AuthenticationProvider = LoadAssetInventoryServerPlugin("/OpenSim/AssetInventoryServer/AuthenticationProvider", ConfigFile.AuthenticationProvider) as IAuthenticationProvider;
+ AuthenticationProvider = LoadAssetInventoryServerPlugin("/OpenSim/AssetInventoryServer/AuthenticationProvider", pluginConfig.GetString("authentication_provider")) as IAuthenticationProvider;
m_backends.Add(AuthenticationProvider);
- AuthorizationProvider = LoadAssetInventoryServerPlugin("/OpenSim/AssetInventoryServer/AuthorizationProvider", ConfigFile.AuthorizationProvider) as IAuthorizationProvider;
+ AuthorizationProvider = LoadAssetInventoryServerPlugin("/OpenSim/AssetInventoryServer/AuthorizationProvider", pluginConfig.GetString("authorization_provider")) as IAuthorizationProvider;
m_backends.Add(AuthorizationProvider);
- m_frontends.AddRange(LoadAssetInventoryServerPlugins("/OpenSim/AssetInventoryServer/Frontend", ConfigFile.Frontends));
+ m_frontends.AddRange(LoadAssetInventoryServerPlugins("/OpenSim/AssetInventoryServer/Frontend", pluginConfig.GetString("frontends")));
return true;
}
@@ -117,18 +124,18 @@ namespace OpenSim.Grid.AssetInventoryServer
{
foreach (IAssetInventoryServerPlugin plugin in m_frontends)
{
- Logger.Log.Debug("Disposing plugin " + plugin.Name);
+ m_log.Debug("[ASSETINVENTORY] Disposing plugin " + plugin.Name);
try { plugin.Dispose(); }
catch (Exception ex)
- { Logger.Log.ErrorFormat("Failure shutting down plugin {0}: {1}", plugin.Name, ex.Message); }
+ { m_log.ErrorFormat("[ASSETINVENTORY] Failure shutting down plugin {0}: {1}", plugin.Name, ex.Message); }
}
foreach (IAssetInventoryServerPlugin plugin in m_backends)
{
- Logger.Log.Debug("Disposing plugin " + plugin.Name);
+ m_log.Debug("[ASSETINVENTORY] Disposing plugin " + plugin.Name);
try { plugin.Dispose(); }
catch (Exception ex)
- { Logger.Log.ErrorFormat("Failure shutting down plugin {0}: {1}", plugin.Name, ex.Message); }
+ { m_log.ErrorFormat("[ASSETINVENTORY] Failure shutting down plugin {0}: {1}", plugin.Name, ex.Message); }
}
if (HttpServer != null)
@@ -140,7 +147,7 @@ namespace OpenSim.Grid.AssetInventoryServer
m_httpServer = new BaseHttpServer(port);
m_httpServer.Start();
- Logger.Log.Info("Asset server is listening on port " + port);
+ m_log.Info("[ASSETINVENTORY] AssetInventory server is listening on port " + port);
}
private IAssetInventoryServerPlugin LoadAssetInventoryServerPlugin(string addinPath, string provider)
diff --git a/OpenSim/Grid/AssetInventoryServer/Logger.cs b/OpenSim/Grid/AssetInventoryServer/Logger.cs
deleted file mode 100644
index 713a356..0000000
--- a/OpenSim/Grid/AssetInventoryServer/Logger.cs
+++ /dev/null
@@ -1,62 +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 log4net;
-using log4net.Config;
-
-[assembly: log4net.Config.XmlConfigurator(ConfigFileExtension = "log4net")]
-
-namespace OpenSim.Grid.AssetInventoryServer
-{
- ///
- /// Singleton logging class for the entire library
- ///
- public static class Logger
- {
- /// log4net logging engine
- public static ILog Log;
-
- static Logger()
- {
- Log = LogManager.GetLogger(System.Reflection.Assembly.GetExecutingAssembly().FullName);
-
- // If error level reporting isn't enabled we assume no logger is configured and initialize a default
- // ConsoleAppender
- if (!Log.Logger.IsEnabledFor(log4net.Core.Level.Error))
- {
- log4net.Appender.ConsoleAppender appender = new log4net.Appender.ConsoleAppender();
- appender.Layout = new log4net.Layout.PatternLayout("%timestamp [%thread] %-5level - %message%newline");
- BasicConfigurator.Configure(appender);
-
- Log.Info("No log configuration found, defaulting to console logging");
- }
- }
- }
-}
diff --git a/OpenSim/Grid/AssetInventoryServer/Main.cs b/OpenSim/Grid/AssetInventoryServer/Main.cs
index 2f01281..8f7d706 100644
--- a/OpenSim/Grid/AssetInventoryServer/Main.cs
+++ b/OpenSim/Grid/AssetInventoryServer/Main.cs
@@ -28,7 +28,8 @@
*/
using System;
-using System.ServiceProcess;
+using Nini.Config;
+using log4net.Config;
namespace OpenSim.Grid.AssetInventoryServer
{
@@ -36,28 +37,24 @@ namespace OpenSim.Grid.AssetInventoryServer
{
static void Main(string[] args)
{
-#if DEBUG
- AssetInventoryServer server = new AssetInventoryServer();
+ XmlConfigurator.Configure();
+
+ ArgvConfigSource configSource = new ArgvConfigSource(args);
+ configSource.AddSwitch("Startup", "inifile");
+
+ AssetInventoryServer server = new AssetInventoryServer(configSource);
if (server.Start())
{
- Console.WriteLine("Asset server is running. Press CTRL+C to quit");
-
Console.CancelKeyPress +=
delegate(object sender, ConsoleCancelEventArgs e)
{
- Console.WriteLine("Asset server is shutting down...");
+ Console.WriteLine("AssetInventory server is shutting down...");
server.Shutdown();
Environment.Exit(0);
};
server.Work();
- //while (true)
- // Console.ReadLine();
}
-#else
- ServiceBase[] servicesToRun = new ServiceBase[] { new AssetInventoryServer() };
- ServiceBase.Run(servicesToRun);
-#endif
}
}
}
diff --git a/OpenSim/Grid/AssetInventoryServer/Plugins/AuthorizeAllPlugin.cs b/OpenSim/Grid/AssetInventoryServer/Plugins/AuthorizeAllPlugin.cs
index 1c0fca7..70322e4 100644
--- a/OpenSim/Grid/AssetInventoryServer/Plugins/AuthorizeAllPlugin.cs
+++ b/OpenSim/Grid/AssetInventoryServer/Plugins/AuthorizeAllPlugin.cs
@@ -28,13 +28,16 @@
*/
using System;
+using System.Reflection;
using OpenMetaverse;
using OpenSim.Framework;
+using log4net;
namespace OpenSim.Grid.AssetInventoryServer.Plugins
{
public class AuthorizeAllPlugin : IAuthorizationProvider
{
+ private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
AssetInventoryServer server;
public AuthorizeAllPlugin()
@@ -47,7 +50,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins
{
this.server = server;
- Logger.Log.Info("[ASSET] Authorize All loaded.");
+ m_log.Info("[ASSET] Authorize All loaded.");
}
///
@@ -55,7 +58,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins
///
public void Initialise()
{
- Logger.Log.InfoFormat("[ASSET]: {0} cannot be default-initialized!", Name);
+ m_log.InfoFormat("[ASSET]: {0} cannot be default-initialized!", Name);
throw new PluginNotInitialisedException(Name);
}
diff --git a/OpenSim/Grid/AssetInventoryServer/Plugins/BrowseFrontendPlugin.cs b/OpenSim/Grid/AssetInventoryServer/Plugins/BrowseFrontendPlugin.cs
index bb38d5d..09e91dc 100644
--- a/OpenSim/Grid/AssetInventoryServer/Plugins/BrowseFrontendPlugin.cs
+++ b/OpenSim/Grid/AssetInventoryServer/Plugins/BrowseFrontendPlugin.cs
@@ -29,6 +29,7 @@
using System;
using System.IO;
+using System.Reflection;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Net;
@@ -37,11 +38,13 @@ using System.Web;
using OpenMetaverse;
using OpenSim.Framework;
using OpenSim.Framework.Servers;
+using log4net;
namespace OpenSim.Grid.AssetInventoryServer.Plugins
{
public class BrowseFrontendPlugin : IAssetInventoryServerPlugin
{
+ private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
AssetInventoryServer m_server;
public BrowseFrontendPlugin()
@@ -58,7 +61,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins
//server.HttpServer.AddHandler("get", null, @"(^/$)|(^/\?.*)", BrowseRequestHandler);
m_server.HttpServer.AddStreamHandler(new BrowseRequestHandler(server));
- Logger.Log.Info("[ASSET] Browser Frontend loaded.");
+ m_log.Info("[ASSET] Browser Frontend loaded.");
}
///
@@ -66,7 +69,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins
///
public void Initialise()
{
- Logger.Log.InfoFormat("[ASSET]: {0} cannot be default-initialized!", Name);
+ m_log.InfoFormat("[ASSET]: {0} cannot be default-initialized!", Name);
throw new PluginNotInitialisedException(Name);
}
diff --git a/OpenSim/Grid/AssetInventoryServer/Plugins/NullAuthenticationPlugin.cs b/OpenSim/Grid/AssetInventoryServer/Plugins/NullAuthenticationPlugin.cs
index ccb21b0..92caa04 100644
--- a/OpenSim/Grid/AssetInventoryServer/Plugins/NullAuthenticationPlugin.cs
+++ b/OpenSim/Grid/AssetInventoryServer/Plugins/NullAuthenticationPlugin.cs
@@ -28,13 +28,16 @@
*/
using System;
+using System.Reflection;
using OpenMetaverse;
using OpenSim.Framework;
+using log4net;
namespace OpenSim.Grid.AssetInventoryServer.Plugins
{
public class NullAuthenticationPlugin : IAuthenticationProvider
{
+ private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
AssetInventoryServer server;
public NullAuthenticationPlugin()
@@ -47,7 +50,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins
{
this.server = server;
- Logger.Log.Info("[ASSET] Null Authentication loaded.");
+ m_log.Info("[ASSET] Null Authentication loaded.");
}
///
@@ -55,7 +58,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins
///
public void Initialise()
{
- Logger.Log.InfoFormat("[ASSET]: {0} cannot be default-initialized!", Name);
+ m_log.InfoFormat("[ASSET]: {0} cannot be default-initialized!", Name);
throw new PluginNotInitialisedException(Name);
}
diff --git a/OpenSim/Grid/AssetInventoryServer/Plugins/NullMetricsPlugin.cs b/OpenSim/Grid/AssetInventoryServer/Plugins/NullMetricsPlugin.cs
index caa4efd..39844f4 100644
--- a/OpenSim/Grid/AssetInventoryServer/Plugins/NullMetricsPlugin.cs
+++ b/OpenSim/Grid/AssetInventoryServer/Plugins/NullMetricsPlugin.cs
@@ -28,12 +28,15 @@
*/
using System;
+using System.Reflection;
using OpenMetaverse;
+using log4net;
namespace OpenSim.Grid.AssetInventoryServer.Plugins
{
public class NullMetricsPlugin : IMetricsProvider
{
+ private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
AssetInventoryServer server;
public NullMetricsPlugin()
@@ -44,72 +47,72 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins
public void LogAssetMetadataFetch(string extension, BackendResponse response, UUID assetID, DateTime time)
{
- Logger.Log.DebugFormat("[{0}] AssetMetadataFetch(): AssetID: {1}, Response: {2}", extension, assetID, response);
+ m_log.DebugFormat("[{0}] AssetMetadataFetch(): AssetID: {1}, Response: {2}", extension, assetID, response);
}
public void LogAssetDataFetch(string extension, BackendResponse response, UUID assetID, int dataSize, DateTime time)
{
- Logger.Log.DebugFormat("[{0}] AssetDataFetch(): AssetID: {1}, DataSize: {2}, Response: {3}", extension, assetID,
+ m_log.DebugFormat("[{0}] AssetDataFetch(): AssetID: {1}, DataSize: {2}, Response: {3}", extension, assetID,
dataSize, response);
}
public void LogAssetCreate(string extension, BackendResponse response, UUID assetID, int dataSize, DateTime time)
{
- Logger.Log.DebugFormat("[{0}] AssetCreate(): AssetID: {1}, DataSize: {2}, Response: {3}", extension, assetID,
+ m_log.DebugFormat("[{0}] AssetCreate(): AssetID: {1}, DataSize: {2}, Response: {3}", extension, assetID,
dataSize, response);
}
public void LogInventoryFetch(string extension, BackendResponse response, Uri owner, UUID objID, bool folder, DateTime time)
{
- Logger.Log.DebugFormat("[{0}] InventoryFetch(): ObjID: {1}, Folder: {2}, OwnerID: {3}, Response: {4}", extension,
+ m_log.DebugFormat("[{0}] InventoryFetch(): ObjID: {1}, Folder: {2}, OwnerID: {3}, Response: {4}", extension,
objID, folder, owner, response);
}
public void LogInventoryFetchFolderContents(string extension, BackendResponse response, Uri owner, UUID folderID, DateTime time)
{
- Logger.Log.DebugFormat("[{0}] InventoryFetchFolderContents(): FolderID: {1}, OwnerID: {2}, Response: {3}", extension,
+ m_log.DebugFormat("[{0}] InventoryFetchFolderContents(): FolderID: {1}, OwnerID: {2}, Response: {3}", extension,
folderID, owner, response);
}
public void LogInventoryFetchFolderList(string extension, BackendResponse response, Uri owner, DateTime time)
{
- Logger.Log.DebugFormat("[{0}] InventoryFetchFolderList(): OwnerID: {1}, Response: {2}", extension,
+ m_log.DebugFormat("[{0}] InventoryFetchFolderList(): OwnerID: {1}, Response: {2}", extension,
owner, response);
}
public void LogInventoryFetchInventory(string extension, BackendResponse response, Uri owner, DateTime time)
{
- Logger.Log.DebugFormat("[{0}] InventoryFetchInventory(): OwnerID: {1}, Response: {2}", extension,
+ m_log.DebugFormat("[{0}] InventoryFetchInventory(): OwnerID: {1}, Response: {2}", extension,
owner, response);
}
public void LogInventoryFetchActiveGestures(string extension, BackendResponse response, Uri owner, DateTime time)
{
- Logger.Log.DebugFormat("[{0}] InventoryFetchActiveGestures(): OwnerID: {1}, Response: {2}", extension,
+ m_log.DebugFormat("[{0}] InventoryFetchActiveGestures(): OwnerID: {1}, Response: {2}", extension,
owner, response);
}
public void LogInventoryCreate(string extension, BackendResponse response, Uri owner, bool folder, DateTime time)
{
- Logger.Log.DebugFormat("[{0}] InventoryCreate(): OwnerID: {1}, Response: {2}", extension,
+ m_log.DebugFormat("[{0}] InventoryCreate(): OwnerID: {1}, Response: {2}", extension,
owner, response);
}
public void LogInventoryCreateInventory(string extension, BackendResponse response, DateTime time)
{
- Logger.Log.DebugFormat("[{0}] InventoryCreateInventory(): Response: {1}", extension,
+ m_log.DebugFormat("[{0}] InventoryCreateInventory(): Response: {1}", extension,
response);
}
public void LogInventoryDelete(string extension, BackendResponse response, Uri owner, UUID objID, bool folder, DateTime time)
{
- Logger.Log.DebugFormat("[{0}] InventoryDelete(): OwnerID: {1}, Folder: {2}, Response: {3}", extension,
+ m_log.DebugFormat("[{0}] InventoryDelete(): OwnerID: {1}, Folder: {2}, Response: {3}", extension,
owner, folder, response);
}
public void LogInventoryPurgeFolder(string extension, BackendResponse response, Uri owner, UUID folderID, DateTime time)
{
- Logger.Log.DebugFormat("[{0}] InventoryPurgeFolder(): OwnerID: {1}, FolderID: {2}, Response: {3}", extension,
+ m_log.DebugFormat("[{0}] InventoryPurgeFolder(): OwnerID: {1}, FolderID: {2}, Response: {3}", extension,
owner, response);
}
@@ -128,6 +131,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins
public void Initialise()
{
this.server = null;
+ m_log.Info("[ASSET] Null metrics loaded.");
}
public void Dispose()
diff --git a/OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/OpenSimAssetFrontendPlugin.cs b/OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/OpenSimAssetFrontendPlugin.cs
index b8f48cb..af69746 100644
--- a/OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/OpenSimAssetFrontendPlugin.cs
+++ b/OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/OpenSimAssetFrontendPlugin.cs
@@ -28,6 +28,7 @@
*/
using System;
+using System.Reflection;
using System.Collections.Generic;
using System.Net;
using System.IO;
@@ -38,11 +39,13 @@ using OpenMetaverse;
using HttpServer;
using OpenSim.Framework;
using OpenSim.Framework.Servers;
+using log4net;
namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
{
public class OpenSimAssetFrontendPlugin : IAssetInventoryServerPlugin
{
+ private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private AssetInventoryServer m_server;
public OpenSimAssetFrontendPlugin()
@@ -61,7 +64,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
// Asset creation
m_server.HttpServer.AddStreamHandler(new AssetPostHandler(server));
- Logger.Log.Info("[ASSET] OpenSim Asset Frontend loaded.");
+ m_log.Info("[ASSET] OpenSim Asset Frontend loaded.");
}
///
@@ -69,7 +72,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
///
public void Initialise()
{
- Logger.Log.InfoFormat("[ASSET]: {0} cannot be default-initialized!", Name);
+ m_log.InfoFormat("[ASSET]: {0} cannot be default-initialized!", Name);
throw new PluginNotInitialisedException(Name);
}
@@ -97,7 +100,6 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
//public AssetRequestHandler(AssetInventoryServer server) : base("GET", "^/assets")
public AssetRequestHandler(AssetInventoryServer server) : base("GET", "/assets")
{
- Logger.Log.Info("[REST]: In Get Request");
m_server = server;
}
@@ -128,13 +130,13 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
}
else
{
- Logger.Log.WarnFormat("Failed to fetch asset data or metadata for {0}: {1}", assetID, dataResponse);
+ m_log.WarnFormat("Failed to fetch asset data or metadata for {0}: {1}", assetID, dataResponse);
httpResponse.StatusCode = (int) HttpStatusCode.NotFound;
}
}
else
{
- Logger.Log.Warn("Unrecognized OpenSim asset request: " + httpRequest.Url.PathAndQuery);
+ m_log.Warn("Unrecognized OpenSim asset request: " + httpRequest.Url.PathAndQuery);
}
return buffer;
@@ -181,13 +183,13 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
}
else
{
- Logger.Log.Warn("AssetPostHandler called with no asset data");
+ m_log.Warn("AssetPostHandler called with no asset data");
httpResponse.StatusCode = (int) HttpStatusCode.BadRequest;
}
}
catch (Exception ex)
{
- Logger.Log.Warn("Failed to parse POST data (expecting AssetBase): " + ex.Message);
+ m_log.Warn("Failed to parse POST data (expecting AssetBase): " + ex.Message);
httpResponse.StatusCode = (int) HttpStatusCode.BadRequest;
}
diff --git a/OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/OpenSimAssetStoragePlugin.cs b/OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/OpenSimAssetStoragePlugin.cs
index b7aef08..26a7300 100644
--- a/OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/OpenSimAssetStoragePlugin.cs
+++ b/OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/OpenSimAssetStoragePlugin.cs
@@ -28,6 +28,7 @@
*/
using System;
+using System.Reflection;
using System.Collections.Generic;
using System.Net;
using System.Data;
@@ -36,15 +37,19 @@ using OpenMetaverse;
using OpenMetaverse.StructuredData;
using OpenSim.Framework;
using OpenSim.Data;
+using Nini.Config;
+using log4net;
namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
{
public class OpenSimAssetStoragePlugin : IAssetStorageProvider
{
+ private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
const string EXTENSION_NAME = "OpenSimAssetStorage"; // Used in metrics reporting
- private AssetInventoryServer server;
+ private AssetInventoryServer m_server;
private IAssetDataPlugin m_assetProvider;
+ private IConfig m_openSimConfig;
public OpenSimAssetStoragePlugin()
{
@@ -57,7 +62,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
metadata = null;
BackendResponse ret;
- using (MySqlConnection dbConnection = new MySqlConnection(server.ConfigFile.AssetDatabaseConnect))
+ using (MySqlConnection dbConnection = new MySqlConnection(m_openSimConfig.GetString("asset_database_connect")))
{
IDataReader reader;
@@ -89,12 +94,12 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
}
catch (MySqlException ex)
{
- Logger.Log.Error("Connection to MySQL backend failed: " + ex.Message);
+ m_log.Error("Connection to MySQL backend failed: " + ex.Message);
ret = BackendResponse.Failure;
}
}
- server.MetricsProvider.LogAssetMetadataFetch(EXTENSION_NAME, ret, assetID, DateTime.Now);
+ m_server.MetricsProvider.LogAssetMetadataFetch(EXTENSION_NAME, ret, assetID, DateTime.Now);
return ret;
}
@@ -103,7 +108,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
assetData = null;
BackendResponse ret;
- using (MySqlConnection dbConnection = new MySqlConnection(server.ConfigFile.AssetDatabaseConnect))
+ using (MySqlConnection dbConnection = new MySqlConnection(m_openSimConfig.GetString("asset_database_connect")))
{
IDataReader reader;
@@ -127,12 +132,12 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
}
catch (MySqlException ex)
{
- Logger.Log.Error("Connection to MySQL backend failed: " + ex.Message);
+ m_log.Error("Connection to MySQL backend failed: " + ex.Message);
ret = BackendResponse.Failure;
}
}
- server.MetricsProvider.LogAssetDataFetch(EXTENSION_NAME, ret, assetID, (assetData != null ? assetData.Length : 0), DateTime.Now);
+ m_server.MetricsProvider.LogAssetDataFetch(EXTENSION_NAME, ret, assetID, (assetData != null ? assetData.Length : 0), DateTime.Now);
return ret;
}
@@ -155,7 +160,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
{
BackendResponse ret;
- using (MySqlConnection dbConnection = new MySqlConnection(server.ConfigFile.AssetDatabaseConnect))
+ using (MySqlConnection dbConnection = new MySqlConnection(m_openSimConfig.GetString("asset_database_connect")))
{
try
{
@@ -180,23 +185,23 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
}
else if (rowsAffected == 2)
{
- Logger.Log.Info("Replaced asset " + metadata.ID.ToString());
+ m_log.Info("Replaced asset " + metadata.ID.ToString());
ret = BackendResponse.Success;
}
else
{
- Logger.Log.ErrorFormat("MySQL REPLACE query affected {0} rows", rowsAffected);
+ m_log.ErrorFormat("MySQL REPLACE query affected {0} rows", rowsAffected);
ret = BackendResponse.Failure;
}
}
catch (MySqlException ex)
{
- Logger.Log.Error("Connection to MySQL backend failed: " + ex.Message);
+ m_log.Error("Connection to MySQL backend failed: " + ex.Message);
ret = BackendResponse.Failure;
}
}
- server.MetricsProvider.LogAssetCreate(EXTENSION_NAME, ret, metadata.ID, assetData.Length, DateTime.Now);
+ m_server.MetricsProvider.LogAssetCreate(EXTENSION_NAME, ret, metadata.ID, assetData.Length, DateTime.Now);
return ret;
}
@@ -204,7 +209,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
{
int rowCount = 0;
- using (MySqlConnection dbConnection = new MySqlConnection(server.ConfigFile.AssetDatabaseConnect))
+ using (MySqlConnection dbConnection = new MySqlConnection(m_openSimConfig.GetString("asset_database_connect")))
{
MySqlDataReader reader;
@@ -219,7 +224,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
}
catch (MySqlException ex)
{
- Logger.Log.Error("Connection to MySQL backend failed: " + ex.Message);
+ m_log.Error("Connection to MySQL backend failed: " + ex.Message);
return 0;
}
@@ -250,22 +255,24 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
public void Initialise(AssetInventoryServer server)
{
- this.server = server;
+ m_server = server;
+ m_openSimConfig = server.ConfigFile.Configs["OpenSim"];
try
{
- m_assetProvider = DataPluginFactory.LoadDataPlugin("OpenSim.Data.MySQL.dll", server.ConfigFile.AssetDatabaseConnect);
+ m_assetProvider = DataPluginFactory.LoadDataPlugin(m_openSimConfig.GetString("asset_database_provider"),
+ m_openSimConfig.GetString("asset_database_connect"));
if (m_assetProvider == null)
{
- Logger.Log.Error("[ASSET]: Failed to load a database plugin, server halting.");
+ m_log.Error("[ASSET]: Failed to load a database plugin, server halting.");
Environment.Exit(-1);
}
else
- Logger.Log.InfoFormat("[ASSET]: Loaded storage backend: {0}", Version);
+ m_log.InfoFormat("[ASSET]: Loaded storage backend: {0}", Version);
}
catch (Exception e)
{
- Logger.Log.WarnFormat("[ASSET]: Failure loading data plugin: {0}", e.ToString());
+ m_log.WarnFormat("[ASSET]: Failure loading data plugin: {0}", e.ToString());
}
}
@@ -274,7 +281,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
///
public void Initialise()
{
- Logger.Log.InfoFormat("[ASSET]: {0} cannot be default-initialized!", Name);
+ m_log.InfoFormat("[ASSET]: {0} cannot be default-initialized!", Name);
throw new PluginNotInitialisedException(Name);
}
diff --git a/OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/OpenSimInventoryFrontendPlugin.cs b/OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/OpenSimInventoryFrontendPlugin.cs
index ac67159..d4e9097 100644
--- a/OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/OpenSimInventoryFrontendPlugin.cs
+++ b/OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/OpenSimInventoryFrontendPlugin.cs
@@ -28,6 +28,7 @@
*/
using System;
+using System.Reflection;
using System.Collections.Generic;
using System.Net;
using System.IO;
@@ -36,11 +37,13 @@ using OpenMetaverse;
using OpenMetaverse.StructuredData;
using HttpServer;
using OpenSim.Framework;
+using log4net;
namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
{
public class OpenSimInventoryFrontendPlugin : IAssetInventoryServerPlugin
{
+ private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private AssetInventoryServer server;
private Utils.InventoryItemSerializer itemSerializer = new Utils.InventoryItemSerializer();
private Utils.InventoryFolderSerializer folderSerializer = new Utils.InventoryFolderSerializer();
@@ -67,7 +70,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
//server.HttpServer.AddHandler("post", null, @"^/RootFolders/", RootFoldersHandler);
//server.HttpServer.AddHandler("post", null, @"^/ActiveGestures/", ActiveGesturesHandler);
- Logger.Log.Info("[INVENTORY] OpenSim Inventory Frontend loaded.");
+ m_log.Info("[INVENTORY] OpenSim Inventory Frontend loaded.");
}
///
@@ -75,7 +78,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
///
public void Initialise()
{
- Logger.Log.InfoFormat("[INVENTORY]: {0} cannot be default-initialized!", Name);
+ m_log.InfoFormat("[INVENTORY]: {0} cannot be default-initialized!", Name);
throw new PluginNotInitialisedException(Name);
}
@@ -103,7 +106,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
// if (ownerID != UUID.Zero)
// {
- // Logger.Log.Warn("GetInventory is not scalable on some inventory backends, avoid calling it wherever possible");
+ // m_log.Warn("GetInventory is not scalable on some inventory backends, avoid calling it wherever possible");
// Uri owner = Utils.GetOpenSimUri(ownerID);
// InventoryCollection inventory;
@@ -144,7 +147,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
// if (ownerID != UUID.Zero)
// {
// Uri owner = Utils.GetOpenSimUri(ownerID);
- // Logger.Log.DebugFormat("Created URI {0} for inventory creation", owner);
+ // m_log.DebugFormat("Created URI {0} for inventory creation", owner);
// InventoryFolder rootFolder = new InventoryFolder("My Inventory", ownerID, UUID.Zero, (short)AssetType.Folder);
// BackendResponse storageResponse = server.InventoryProvider.TryCreateInventory(owner, rootFolder);
@@ -365,7 +368,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
}
catch (Exception ex)
{
- Logger.Log.Warn("Failed to parse POST data (expecting guid): " + ex.Message);
+ m_log.Warn("Failed to parse POST data (expecting guid): " + ex.Message);
}
return id;
@@ -389,7 +392,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
}
catch (Exception ex)
{
- Logger.Log.Warn("Failed to parse GetInventory POST data: " + ex.Message);
+ m_log.Warn("Failed to parse GetInventory POST data: " + ex.Message);
agentID = UUID.Zero;
sessionID = UUID.Zero;
return UUID.Zero;
@@ -426,7 +429,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
}
catch (Exception ex)
{
- Logger.Log.Warn("Failed to parse POST data (expecting InventoryFolderBase): " + ex.Message);
+ m_log.Warn("Failed to parse POST data (expecting InventoryFolderBase): " + ex.Message);
agentID = UUID.Zero;
sessionID = UUID.Zero;
return null;
@@ -474,7 +477,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
}
catch (Exception ex)
{
- Logger.Log.Warn("Failed to parse POST data (expecting InventoryItemBase): " + ex.Message);
+ m_log.Warn("Failed to parse POST data (expecting InventoryItemBase): " + ex.Message);
agentID = UUID.Zero;
sessionID = UUID.Zero;
return null;
diff --git a/OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/OpenSimInventoryStoragePlugin.cs b/OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/OpenSimInventoryStoragePlugin.cs
index 0ad6c80..f5a1f78 100644
--- a/OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/OpenSimInventoryStoragePlugin.cs
+++ b/OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/OpenSimInventoryStoragePlugin.cs
@@ -28,6 +28,7 @@
*/
using System;
+using System.Reflection;
using System.Collections.Generic;
using System.Net;
using System.Data;
@@ -36,15 +37,19 @@ using OpenMetaverse;
using OpenMetaverse.StructuredData;
using OpenSim.Framework;
using OpenSim.Data;
+using Nini.Config;
+using log4net;
namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
{
public class OpenSimInventoryStoragePlugin : IInventoryStorageProvider
{
+ private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
const string EXTENSION_NAME = "OpenSimInventoryStorage"; // Used in metrics reporting
- private AssetInventoryServer server;
+ private AssetInventoryServer m_server;
private IInventoryDataPlugin m_inventoryProvider;
+ private IConfig m_openSimConfig;
public OpenSimInventoryStoragePlugin()
{
@@ -57,7 +62,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
item = null;
BackendResponse ret;
- using (MySqlConnection dbConnection = new MySqlConnection(server.ConfigFile.InventoryDatabaseConnect))
+ using (MySqlConnection dbConnection = new MySqlConnection(m_openSimConfig.GetString("inventory_database_connect")))
{
IDataReader reader;
@@ -105,12 +110,12 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
}
catch (MySqlException ex)
{
- Logger.Log.Error("Connection to MySQL backend failed: " + ex.Message);
+ m_log.Error("Connection to MySQL backend failed: " + ex.Message);
ret = BackendResponse.Failure;
}
}
- server.MetricsProvider.LogInventoryFetch(EXTENSION_NAME, ret, owner, itemID, false, DateTime.Now);
+ m_server.MetricsProvider.LogInventoryFetch(EXTENSION_NAME, ret, owner, itemID, false, DateTime.Now);
return ret;
}
@@ -119,7 +124,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
folder = null;
BackendResponse ret;
- using (MySqlConnection dbConnection = new MySqlConnection(server.ConfigFile.InventoryDatabaseConnect))
+ using (MySqlConnection dbConnection = new MySqlConnection(m_openSimConfig.GetString("inventory_database_connect")))
{
IDataReader reader;
@@ -152,12 +157,12 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
}
catch (MySqlException ex)
{
- Logger.Log.Error("Connection to MySQL backend failed: " + ex.Message);
+ m_log.Error("Connection to MySQL backend failed: " + ex.Message);
ret = BackendResponse.Failure;
}
}
- server.MetricsProvider.LogInventoryFetch(EXTENSION_NAME, ret, owner, folderID, true, DateTime.Now);
+ m_server.MetricsProvider.LogInventoryFetch(EXTENSION_NAME, ret, owner, folderID, true, DateTime.Now);
return ret;
}
@@ -166,7 +171,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
contents = null;
BackendResponse ret;
- using (MySqlConnection dbConnection = new MySqlConnection(server.ConfigFile.InventoryDatabaseConnect))
+ using (MySqlConnection dbConnection = new MySqlConnection(m_openSimConfig.GetString("inventory_database_connect")))
{
IDataReader reader;
@@ -249,12 +254,12 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
}
catch (MySqlException ex)
{
- Logger.Log.Error("Connection to MySQL backend failed: " + ex.Message);
+ m_log.Error("Connection to MySQL backend failed: " + ex.Message);
ret = BackendResponse.Failure;
}
}
- server.MetricsProvider.LogInventoryFetchFolderContents(EXTENSION_NAME, ret, owner, folderID, DateTime.Now);
+ m_server.MetricsProvider.LogInventoryFetchFolderContents(EXTENSION_NAME, ret, owner, folderID, DateTime.Now);
return ret;
}
@@ -266,7 +271,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
if (Utils.TryGetOpenSimUUID(owner, out ownerID))
{
- using (MySqlConnection dbConnection = new MySqlConnection(server.ConfigFile.InventoryDatabaseConnect))
+ using (MySqlConnection dbConnection = new MySqlConnection(m_openSimConfig.GetString("inventory_database_connect")))
{
IDataReader reader;
@@ -298,7 +303,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
}
catch (MySqlException ex)
{
- Logger.Log.Error("Connection to MySQL backend failed: " + ex.Message);
+ m_log.Error("Connection to MySQL backend failed: " + ex.Message);
ret = BackendResponse.Failure;
}
}
@@ -308,7 +313,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
ret = BackendResponse.NotFound;
}
- server.MetricsProvider.LogInventoryFetchFolderList(EXTENSION_NAME, ret, owner, DateTime.Now);
+ m_server.MetricsProvider.LogInventoryFetchFolderList(EXTENSION_NAME, ret, owner, DateTime.Now);
return ret;
}
@@ -332,7 +337,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
// Fetch inventory items
if (Utils.TryGetOpenSimUUID(owner, out ownerID))
{
- using (MySqlConnection dbConnection = new MySqlConnection(server.ConfigFile.InventoryDatabaseConnect))
+ using (MySqlConnection dbConnection = new MySqlConnection(m_openSimConfig.GetString("inventory_database_connect")))
{
IDataReader reader;
@@ -381,7 +386,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
}
catch (MySqlException ex)
{
- Logger.Log.Error("Connection to MySQL backend failed: " + ex.Message);
+ m_log.Error("Connection to MySQL backend failed: " + ex.Message);
ret = BackendResponse.Failure;
}
}
@@ -392,7 +397,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
}
}
- server.MetricsProvider.LogInventoryFetchInventory(EXTENSION_NAME, ret, owner, DateTime.Now);
+ m_server.MetricsProvider.LogInventoryFetchInventory(EXTENSION_NAME, ret, owner, DateTime.Now);
return ret;
}
@@ -404,7 +409,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
if (Utils.TryGetOpenSimUUID(owner, out ownerID))
{
- using (MySqlConnection dbConnection = new MySqlConnection(server.ConfigFile.InventoryDatabaseConnect))
+ using (MySqlConnection dbConnection = new MySqlConnection(m_openSimConfig.GetString("inventory_database_connect")))
{
IDataReader reader;
@@ -451,7 +456,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
}
catch (MySqlException ex)
{
- Logger.Log.Error("Connection to MySQL backend failed: " + ex.Message);
+ m_log.Error("Connection to MySQL backend failed: " + ex.Message);
ret = BackendResponse.Failure;
}
}
@@ -461,7 +466,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
ret = BackendResponse.NotFound;
}
- server.MetricsProvider.LogInventoryFetchActiveGestures(EXTENSION_NAME, ret, owner, DateTime.Now);
+ m_server.MetricsProvider.LogInventoryFetchActiveGestures(EXTENSION_NAME, ret, owner, DateTime.Now);
return ret;
}
@@ -469,7 +474,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
{
BackendResponse ret;
- using (MySqlConnection dbConnection = new MySqlConnection(server.ConfigFile.InventoryDatabaseConnect))
+ using (MySqlConnection dbConnection = new MySqlConnection(m_openSimConfig.GetString("inventory_database_connect")))
{
try
{
@@ -512,23 +517,23 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
}
else if (rowsAffected == 2)
{
- Logger.Log.Info("Replaced inventory item " + item.ID.ToString());
+ m_log.Info("Replaced inventory item " + item.ID.ToString());
ret = BackendResponse.Success;
}
else
{
- Logger.Log.ErrorFormat("MySQL REPLACE query affected {0} rows", rowsAffected);
+ m_log.ErrorFormat("MySQL REPLACE query affected {0} rows", rowsAffected);
ret = BackendResponse.Failure;
}
}
catch (MySqlException ex)
{
- Logger.Log.Error("Connection to MySQL backend failed: " + ex.Message);
+ m_log.Error("Connection to MySQL backend failed: " + ex.Message);
ret = BackendResponse.Failure;
}
}
- server.MetricsProvider.LogInventoryCreate(EXTENSION_NAME, ret, owner, false, DateTime.Now);
+ m_server.MetricsProvider.LogInventoryCreate(EXTENSION_NAME, ret, owner, false, DateTime.Now);
return ret;
}
@@ -536,7 +541,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
{
BackendResponse ret;
- using (MySqlConnection dbConnection = new MySqlConnection(server.ConfigFile.InventoryDatabaseConnect))
+ using (MySqlConnection dbConnection = new MySqlConnection(m_openSimConfig.GetString("inventory_database_connect")))
{
try
{
@@ -560,23 +565,23 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
}
else if (rowsAffected == 2)
{
- Logger.Log.Info("Replaced inventory folder " + folder.ID.ToString());
+ m_log.Info("Replaced inventory folder " + folder.ID.ToString());
ret = BackendResponse.Success;
}
else
{
- Logger.Log.ErrorFormat("MySQL REPLACE query affected {0} rows", rowsAffected);
+ m_log.ErrorFormat("MySQL REPLACE query affected {0} rows", rowsAffected);
ret = BackendResponse.Failure;
}
}
catch (MySqlException ex)
{
- Logger.Log.Error("Connection to MySQL backend failed: " + ex.Message);
+ m_log.Error("Connection to MySQL backend failed: " + ex.Message);
ret = BackendResponse.Failure;
}
}
- server.MetricsProvider.LogInventoryCreate(EXTENSION_NAME, ret, owner, true, DateTime.Now);
+ m_server.MetricsProvider.LogInventoryCreate(EXTENSION_NAME, ret, owner, true, DateTime.Now);
return ret;
}
@@ -592,7 +597,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
if (Utils.TryGetOpenSimUUID(owner, out ownerID))
{
- using (MySqlConnection dbConnection = new MySqlConnection(server.ConfigFile.InventoryDatabaseConnect))
+ using (MySqlConnection dbConnection = new MySqlConnection(m_openSimConfig.GetString("inventory_database_connect")))
{
try
{
@@ -611,13 +616,13 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
}
else
{
- Logger.Log.ErrorFormat("MySQL DELETE query affected {0} rows", rowsAffected);
+ m_log.ErrorFormat("MySQL DELETE query affected {0} rows", rowsAffected);
ret = BackendResponse.NotFound;
}
}
catch (MySqlException ex)
{
- Logger.Log.Error("Connection to MySQL backend failed: " + ex.Message);
+ m_log.Error("Connection to MySQL backend failed: " + ex.Message);
ret = BackendResponse.Failure;
}
}
@@ -627,7 +632,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
ret = BackendResponse.NotFound;
}
- server.MetricsProvider.LogInventoryDelete(EXTENSION_NAME, ret, owner, itemID, false, DateTime.Now);
+ m_server.MetricsProvider.LogInventoryDelete(EXTENSION_NAME, ret, owner, itemID, false, DateTime.Now);
return ret;
}
@@ -638,7 +643,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
if (Utils.TryGetOpenSimUUID(owner, out ownerID))
{
- using (MySqlConnection dbConnection = new MySqlConnection(server.ConfigFile.InventoryDatabaseConnect))
+ using (MySqlConnection dbConnection = new MySqlConnection(m_openSimConfig.GetString("inventory_database_connect")))
{
try
{
@@ -657,13 +662,13 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
}
else
{
- Logger.Log.ErrorFormat("MySQL DELETE query affected {0} rows", rowsAffected);
+ m_log.ErrorFormat("MySQL DELETE query affected {0} rows", rowsAffected);
ret = BackendResponse.NotFound;
}
}
catch (MySqlException ex)
{
- Logger.Log.Error("Connection to MySQL backend failed: " + ex.Message);
+ m_log.Error("Connection to MySQL backend failed: " + ex.Message);
ret = BackendResponse.Failure;
}
}
@@ -673,7 +678,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
ret = BackendResponse.NotFound;
}
- server.MetricsProvider.LogInventoryDelete(EXTENSION_NAME, ret, owner, folderID, true, DateTime.Now);
+ m_server.MetricsProvider.LogInventoryDelete(EXTENSION_NAME, ret, owner, folderID, true, DateTime.Now);
return ret;
}
@@ -684,7 +689,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
if (Utils.TryGetOpenSimUUID(owner, out ownerID))
{
- using (MySqlConnection dbConnection = new MySqlConnection(server.ConfigFile.InventoryDatabaseConnect))
+ using (MySqlConnection dbConnection = new MySqlConnection(m_openSimConfig.GetString("inventory_database_connect")))
{
try
{
@@ -714,13 +719,13 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
#endregion Delete folders
- Logger.Log.DebugFormat("Deleted {0} inventory objects from MySQL in a folder purge", rowsAffected);
+ m_log.DebugFormat("Deleted {0} inventory objects from MySQL in a folder purge", rowsAffected);
ret = BackendResponse.Success;
}
catch (MySqlException ex)
{
- Logger.Log.Error("Connection to MySQL backend failed: " + ex.Message);
+ m_log.Error("Connection to MySQL backend failed: " + ex.Message);
ret = BackendResponse.Failure;
}
}
@@ -730,7 +735,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
ret = BackendResponse.NotFound;
}
- server.MetricsProvider.LogInventoryPurgeFolder(EXTENSION_NAME, ret, owner, folderID, DateTime.Now);
+ m_server.MetricsProvider.LogInventoryPurgeFolder(EXTENSION_NAME, ret, owner, folderID, DateTime.Now);
return ret;
}
@@ -738,7 +743,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
{
int rowCount = 0;
- using (MySqlConnection dbConnection = new MySqlConnection(server.ConfigFile.InventoryDatabaseConnect))
+ using (MySqlConnection dbConnection = new MySqlConnection(m_openSimConfig.GetString("inventory_database_connect")))
{
MySqlDataReader reader;
@@ -753,7 +758,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
}
catch (MySqlException ex)
{
- Logger.Log.Error("Connection to MySQL backend failed: " + ex.Message);
+ m_log.Error("Connection to MySQL backend failed: " + ex.Message);
return 0;
}
@@ -784,22 +789,24 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
public void Initialise(AssetInventoryServer server)
{
- this.server = server;
+ m_server = server;
+ m_openSimConfig = server.ConfigFile.Configs["OpenSim"];
try
{
- m_inventoryProvider = DataPluginFactory.LoadDataPlugin("OpenSim.Data.MySQL.dll", server.ConfigFile.InventoryDatabaseConnect);
+ m_inventoryProvider = DataPluginFactory.LoadDataPlugin(m_openSimConfig.GetString("inventory_database_provider"),
+ m_openSimConfig.GetString("inventory_database_connect"));
if (m_inventoryProvider == null)
{
- Logger.Log.Error("[INVENTORY]: Failed to load a database plugin, server halting.");
+ m_log.Error("[INVENTORY]: Failed to load a database plugin, server halting.");
Environment.Exit(-1);
}
else
- Logger.Log.InfoFormat("[INVENTORY]: Loaded storage backend: {0}", Version);
+ m_log.InfoFormat("[INVENTORY]: Loaded storage backend: {0}", Version);
}
catch (Exception e)
{
- Logger.Log.WarnFormat("[INVENTORY]: Failure loading data plugin: {0}", e.ToString());
+ m_log.WarnFormat("[INVENTORY]: Failure loading data plugin: {0}", e.ToString());
}
}
@@ -809,7 +816,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
public void Initialise()
{
- Logger.Log.InfoFormat("[INVENTORY]: {0} cannot be default-initialized!", Name);
+ m_log.InfoFormat("[INVENTORY]: {0} cannot be default-initialized!", Name);
throw new PluginNotInitialisedException(Name);
}
diff --git a/OpenSim/Grid/AssetInventoryServer/Plugins/ReferenceFrontendPlugin.cs b/OpenSim/Grid/AssetInventoryServer/Plugins/ReferenceFrontendPlugin.cs
index d1ea201..ffeca1a 100644
--- a/OpenSim/Grid/AssetInventoryServer/Plugins/ReferenceFrontendPlugin.cs
+++ b/OpenSim/Grid/AssetInventoryServer/Plugins/ReferenceFrontendPlugin.cs
@@ -29,6 +29,7 @@
using System;
using System.IO;
+using System.Reflection;
using System.Collections.Generic;
using System.Net;
using System.Xml;
@@ -37,11 +38,13 @@ using OpenMetaverse.StructuredData;
using HttpServer;
using OpenSim.Framework;
using OpenSim.Framework.Servers;
+using log4net;
namespace OpenSim.Grid.AssetInventoryServer.Plugins
{
public class ReferenceFrontendPlugin : IAssetInventoryServerPlugin
{
+ private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
AssetInventoryServer m_server;
public ReferenceFrontendPlugin()
@@ -63,7 +66,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins
// Asset creation
m_server.HttpServer.AddStreamHandler(new CreateRequestHandler(server));
- Logger.Log.Info("[ASSET] Reference Frontend loaded.");
+ m_log.Info("[ASSET] Reference Frontend loaded.");
}
///
@@ -71,7 +74,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins
///
public void Initialise()
{
- Logger.Log.InfoFormat("[ASSET]: {0} cannot be default-initialized!", Name);
+ m_log.InfoFormat("[ASSET]: {0} cannot be default-initialized!", Name);
throw new PluginNotInitialisedException(Name);
}
@@ -159,7 +162,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins
}
else if (storageResponse == BackendResponse.NotFound)
{
- Logger.Log.Warn("Could not find metadata for asset " + assetID.ToString());
+ m_log.Warn("Could not find metadata for asset " + assetID.ToString());
httpResponse.StatusCode = (int) HttpStatusCode.NotFound;
}
else
diff --git a/OpenSim/Grid/AssetInventoryServer/Plugins/Simple/SimpleAssetStoragePlugin.cs b/OpenSim/Grid/AssetInventoryServer/Plugins/Simple/SimpleAssetStoragePlugin.cs
index 5a718f2..d66fc69 100644
--- a/OpenSim/Grid/AssetInventoryServer/Plugins/Simple/SimpleAssetStoragePlugin.cs
+++ b/OpenSim/Grid/AssetInventoryServer/Plugins/Simple/SimpleAssetStoragePlugin.cs
@@ -28,12 +28,14 @@
*/
using System;
+using System.Reflection;
using System.Collections.Generic;
using System.Net;
using System.IO;
using OpenMetaverse;
using OpenMetaverse.StructuredData;
using OpenSim.Framework;
+using log4net;
namespace OpenSim.Grid.AssetInventoryServer.Plugins.Simple
{
@@ -43,6 +45,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.Simple
const string DEFAULT_DATA_DIR = "SimpleAssets";
const string TEMP_DATA_DIR = "SimpleAssetsTemp";
+ private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
AssetInventoryServer server;
Dictionary metadataStorage;
Dictionary filenames;
@@ -82,7 +85,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.Simple
}
catch (Exception ex)
{
- Logger.Log.ErrorFormat("Failed reading data for asset {0} from {1}: {2}", assetID, filename, ex.Message);
+ m_log.ErrorFormat("Failed reading data for asset {0} from {1}: {2}", assetID, filename, ex.Message);
ret = BackendResponse.Failure;
}
}
@@ -112,7 +115,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.Simple
}
catch (Exception ex)
{
- Logger.Log.ErrorFormat("Failed reading data for asset {0} from {1}: {2}", assetID, filename, ex.Message);
+ m_log.ErrorFormat("Failed reading data for asset {0} from {1}: {2}", assetID, filename, ex.Message);
ret = BackendResponse.Failure;
}
}
@@ -169,7 +172,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.Simple
}
catch (Exception ex)
{
- Logger.Log.ErrorFormat("Failed writing data for asset {0} to {1}: {2}", metadata.ID, filename, ex.Message);
+ m_log.ErrorFormat("Failed writing data for asset {0} to {1}: {2}", metadata.ID, filename, ex.Message);
ret = BackendResponse.Failure;
}
@@ -207,7 +210,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.Simple
LoadFiles(DEFAULT_DATA_DIR, false);
LoadFiles(TEMP_DATA_DIR, true);
- Logger.Log.InfoFormat("Initialized the store index with metadata for {0} assets",
+ m_log.InfoFormat("Initialized the store index with metadata for {0} assets",
metadataStorage.Count);
}
@@ -216,7 +219,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.Simple
///
public void Initialise()
{
- Logger.Log.InfoFormat("[ASSET]: {0} cannot be default-initialized!", Name);
+ m_log.InfoFormat("[ASSET]: {0} cannot be default-initialized!", Name);
throw new PluginNotInitialisedException(Name);
}
@@ -243,7 +246,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.Simple
if (Directory.Exists(TEMP_DATA_DIR))
{
try { Directory.Delete(TEMP_DATA_DIR); }
- catch (Exception ex) { Logger.Log.Error(ex.Message); }
+ catch (Exception ex) { m_log.Error(ex.Message); }
}
}
@@ -255,7 +258,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.Simple
try { Directory.CreateDirectory(folder); }
catch (Exception ex)
{
- Logger.Log.Warn(ex.Message);
+ m_log.Warn(ex.Message);
return;
}
}
@@ -287,7 +290,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.Simple
}
catch (Exception ex)
{
- Logger.Log.Warn(ex.Message);
+ m_log.Warn(ex.Message);
}
}
}
diff --git a/OpenSim/Grid/AssetInventoryServer/Plugins/Simple/SimpleInventoryStoragePlugin.cs b/OpenSim/Grid/AssetInventoryServer/Plugins/Simple/SimpleInventoryStoragePlugin.cs
index 415874a..8be6f8c 100644
--- a/OpenSim/Grid/AssetInventoryServer/Plugins/Simple/SimpleInventoryStoragePlugin.cs
+++ b/OpenSim/Grid/AssetInventoryServer/Plugins/Simple/SimpleInventoryStoragePlugin.cs
@@ -28,6 +28,7 @@
*/
using System;
+using System.Reflection;
using System.Collections.Generic;
using System.Net;
using System.IO;
@@ -35,6 +36,7 @@ using System.Text;
using OpenMetaverse;
using OpenMetaverse.StructuredData;
using OpenSim.Framework;
+using log4net;
namespace OpenSim.Grid.AssetInventoryServer.Plugins.Simple
{
@@ -43,6 +45,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.Simple
const string EXTENSION_NAME = "SimpleInventoryStorage"; // Used for metrics reporting
const string DEFAULT_INVENTORY_DIR = "SimpleInventory";
+ private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
AssetInventoryServer server;
Dictionary inventories = new Dictionary();
Dictionary> activeGestures = new Dictionary>();
@@ -209,7 +212,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.Simple
}
catch (Exception ex)
{
- Logger.Log.Error(ex.Message);
+ m_log.Error(ex.Message);
ret = BackendResponse.Failure;
}
}
@@ -251,7 +254,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.Simple
}
catch (Exception ex)
{
- Logger.Log.Error(ex.Message);
+ m_log.Error(ex.Message);
ret = BackendResponse.Failure;
}
}
@@ -305,7 +308,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.Simple
}
catch (Exception ex)
{
- Logger.Log.Error(ex.Message);
+ m_log.Error(ex.Message);
ret = BackendResponse.Failure;
}
}
@@ -353,7 +356,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.Simple
foreach (string match in matches)
{
try { File.Delete(match); }
- catch (Exception ex) { Logger.Log.ErrorFormat("Failed to delete file {0}: {1}", match, ex.Message); }
+ catch (Exception ex) { m_log.ErrorFormat("Failed to delete file {0}: {1}", match, ex.Message); }
}
ret = BackendResponse.Success;
@@ -390,7 +393,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.Simple
foreach (string match in matches)
{
try { File.Delete(match); }
- catch (Exception ex) { Logger.Log.ErrorFormat("Failed to delete folder file {0}: {1}", match, ex.Message); }
+ catch (Exception ex) { m_log.ErrorFormat("Failed to delete folder file {0}: {1}", match, ex.Message); }
}
ret = BackendResponse.Success;
@@ -501,7 +504,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.Simple
try { Directory.CreateDirectory(folder); }
catch (Exception ex)
{
- Logger.Log.Warn(ex.Message);
+ m_log.Warn(ex.Message);
return;
}
}
@@ -525,7 +528,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.Simple
}
catch (Exception ex)
{
- Logger.Log.WarnFormat("Failed loading the index file {0}: {1}", indexPath, ex.Message);
+ m_log.WarnFormat("Failed loading the index file {0}: {1}", indexPath, ex.Message);
}
if (ownerID != UUID.Zero && owner != null)
@@ -581,7 +584,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.Simple
}
catch (Exception ex)
{
- Logger.Log.ErrorFormat("Failed loading inventory from {0}: {1}", folder, ex.Message);
+ m_log.ErrorFormat("Failed loading inventory from {0}: {1}", folder, ex.Message);
}
}
@@ -593,7 +596,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.Simple
LoadFiles(DEFAULT_INVENTORY_DIR);
- Logger.Log.InfoFormat("Initialized the inventory index with data for {0} avatars",
+ m_log.InfoFormat("Initialized the inventory index with data for {0} avatars",
inventories.Count);
}
@@ -602,7 +605,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.Simple
///
public void Initialise()
{
- Logger.Log.InfoFormat("[ASSET]: {0} cannot be default-initialized!", Name);
+ m_log.InfoFormat("[ASSET]: {0} cannot be default-initialized!", Name);
throw new PluginNotInitialisedException(Name);
}
diff --git a/bin/AssetInventoryServer.ini.example b/bin/AssetInventoryServer.ini.example
index 503870e..91b8b44 100644
--- a/bin/AssetInventoryServer.ini.example
+++ b/bin/AssetInventoryServer.ini.example
@@ -1,9 +1,9 @@
-;[Config]
+[Config]
; The port number for the asset server to listen on.
listen_port = 8003
-;[Extensions]
+[Plugins]
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Asset Storage Provider
@@ -31,7 +31,7 @@ asset_storage_provider = OpenSimAssetStorage
; illustrating an inventory backend example. The inventory is stored in
; SimpleInventory/ by creating a folder for each agent that contains all of the
; inventory items and folders serialized as XML files.
-;inventory_asset_provider = SimpleInventoryStorage
+;inventory_storage_provider = SimpleInventoryStorage
; OpenSimMySQL inventory connects to a MySQL server that has an inventory table
; created by OpenSim. If the OpenSimMySQLStorage backend is also being used, the
@@ -40,7 +40,7 @@ asset_storage_provider = OpenSimAssetStorage
; database. This backend combined with the OpenSimInventoryFrontend will allow
; the server to be used as a drop-in replacement for
; OpenSim.Grid.InventoryServer.exe, while also allowing other frontends to run.
-inventory_asset_provider = OpenSimInventoryStorage
+inventory_storage_provider = OpenSimInventoryStorage
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Authentication Provider
@@ -56,7 +56,7 @@ authentication_provider = NullAuthentication
; Authorize all is a dummy authorization module that allows all requests for
; metadata, data, and asset creation. Use this extension if your primary
; storage provider or front-end interface does not support authentication.
-authroization_provider = AuthorizeAll
+authorization_provider = AuthorizeAll
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Metrics Provider
@@ -95,7 +95,19 @@ metrics_provider = NullMetrics
frontends = ReferenceFrontend,OpenSimAssetFrontend,OpenSimInventoryFrontend,BrowseFrontend
-;[MySQL]
+; The OpenSim section applies to the OpenSim plugin (OpenSimAssetStorage,
+; OpenSimInventoryStorage, OpenSimAssetFronend, OpenSimInventoryFrontend).
+[OpenSim]
+
+; The database provider determines which database to use. Any database backend
+; supported by OpenSim is supported.
+;asset_database_provider = "OpenSim.Data.SQLite.dll"
+asset_database_provider = "OpenSim.Data.MySQL.dll"
+;asset_database_provider = "OpenSim.Data.NHibernate.dll"
+
+;inventory_database_provider = "OpenSim.Data.SQLite.dll"
+inventory_database_provider = "OpenSim.Data.MySQL.dll"
+;inventory_database_provider = "OpenSim.Data.NHibernate.dll"
; Database connection string used by the OpenSim MySQL backend. If these lines
; are commented out or missing, the server will look for an
@@ -103,5 +115,15 @@ frontends = ReferenceFrontend,OpenSimAssetFrontend,OpenSimInventoryFrontend,Brow
; working directory. These files are generated by OpenSim.Grid.AssetServer.exe
; and OpenSim.Grid.InventoryServer.exe, respectively, and can be used without
; modification.
+
+; For SQLite
+;asset_database_connect = "URI:file:Asset.db,version=3"
+;inventory_database_connect = "URI:file:Inventory.db,version=3"
+
+; For MySQL
asset_database_connect = "Server=localhost; Database=opensim; User=changeme; Password=changeme;"
inventory_database_connect = "Server=localhost; Database=opensim; User=changeme; Password=changeme;"
+
+; For NHibernate
+;asset_database_connect = "SQLiteDialect;SQLite20Driver;Data Source=file:Asset.db;Version=3"
+;inventory_database_connect = "SQLiteDialect;SQLite20Driver;Data Source=file:Asset.db;Version=3"
diff --git a/bin/OpenSim.Grid.AssetInventoryServer.exe.config b/bin/OpenSim.Grid.AssetInventoryServer.exe.config
new file mode 100644
index 0000000..e542cf2
--- /dev/null
+++ b/bin/OpenSim.Grid.AssetInventoryServer.exe.config
@@ -0,0 +1,34 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/prebuild.xml b/prebuild.xml
index 75879d9..1e704c0 100644
--- a/prebuild.xml
+++ b/prebuild.xml
@@ -766,10 +766,11 @@
-
+
+
@@ -805,6 +806,7 @@
+
@@ -834,6 +836,7 @@
+
@@ -866,6 +869,8 @@
+
+
--
cgit v1.1