aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorMike Mazur2009-02-16 02:27:43 +0000
committerMike Mazur2009-02-16 02:27:43 +0000
commit5277fc64c07da92014e749be40aa837193a26495 (patch)
tree5351a96ac5d612560dc63d8c8585237d9dc80d27
parent- remove dependency on ExtensionLoader.dll (DBConnString.cs can go) (diff)
downloadopensim-SC_OLD-5277fc64c07da92014e749be40aa837193a26495.zip
opensim-SC_OLD-5277fc64c07da92014e749be40aa837193a26495.tar.gz
opensim-SC_OLD-5277fc64c07da92014e749be40aa837193a26495.tar.bz2
opensim-SC_OLD-5277fc64c07da92014e749be40aa837193a26495.tar.xz
- change AssetInventoryServer config from XML to INI
- convert AssetInventoryServer logging to OpenSim's log4net - updated AssetInventoryServer.ini.example file
-rw-r--r--OpenSim/Framework/AssetInventoryConfig.cs146
-rw-r--r--OpenSim/Grid/AssetInventoryServer/AssetInventoryConfig.cs97
-rw-r--r--OpenSim/Grid/AssetInventoryServer/AssetInventoryServer.cs53
-rw-r--r--OpenSim/Grid/AssetInventoryServer/Logger.cs62
-rw-r--r--OpenSim/Grid/AssetInventoryServer/Main.cs21
-rw-r--r--OpenSim/Grid/AssetInventoryServer/Plugins/AuthorizeAllPlugin.cs7
-rw-r--r--OpenSim/Grid/AssetInventoryServer/Plugins/BrowseFrontendPlugin.cs7
-rw-r--r--OpenSim/Grid/AssetInventoryServer/Plugins/NullAuthenticationPlugin.cs7
-rw-r--r--OpenSim/Grid/AssetInventoryServer/Plugins/NullMetricsPlugin.cs28
-rw-r--r--OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/OpenSimAssetFrontendPlugin.cs16
-rw-r--r--OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/OpenSimAssetStoragePlugin.cs47
-rw-r--r--OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/OpenSimInventoryFrontendPlugin.cs19
-rw-r--r--OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/OpenSimInventoryStoragePlugin.cs105
-rw-r--r--OpenSim/Grid/AssetInventoryServer/Plugins/ReferenceFrontendPlugin.cs9
-rw-r--r--OpenSim/Grid/AssetInventoryServer/Plugins/Simple/SimpleAssetStoragePlugin.cs19
-rw-r--r--OpenSim/Grid/AssetInventoryServer/Plugins/Simple/SimpleInventoryStoragePlugin.cs23
-rw-r--r--bin/AssetInventoryServer.ini.example34
-rw-r--r--bin/OpenSim.Grid.AssetInventoryServer.exe.config34
-rw-r--r--prebuild.xml7
19 files changed, 368 insertions, 373 deletions
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 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSim Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29
30namespace OpenSim.Framework
31{
32 /// <summary>
33 /// AssetInventoryConfig -- For AssetInventory Server Configuration
34 /// </summary>
35 public class AssetInventoryConfig
36 {
37 private ConfigurationMember configMember;
38
39 public const uint DefaultHttpPort = 8003;
40 public uint HttpPort = DefaultHttpPort;
41
42 public string AssetStorageProvider = "OpenSimAssetStorage";
43 public string AssetDatabaseConnect = String.Empty;
44 public string InventoryStorageProvider = "OpenSimInventoryStorage";
45 public string InventoryDatabaseConnect = String.Empty;
46
47 public string AuthenticationProvider = "NullAuthentication";
48 public string AuthorizationProvider = "AuthorizeAll";
49 public string MetricsProvider = "NullMetrics";
50 public string Frontends = "OpenSimAssetFrontend,OpenSimInventoryFrontend";
51
52 public AssetInventoryConfig(string description, string filename)
53 {
54 configMember = new ConfigurationMember(filename, description, loadConfigurationOptions, handleIncomingConfiguration, true);
55 configMember.performConfigurationRetrieve();
56 }
57
58 public void loadConfigurationOptions()
59 {
60 configMember.addConfigurationOption("listen_port",
61 ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
62 "HTTP listener port",
63 DefaultHttpPort.ToString(),
64 false);
65
66 configMember.addConfigurationOption("asset_storage_provider",
67 ConfigurationOption.ConfigurationTypes.TYPE_STRING,
68 "Asset storage provider",
69 AssetStorageProvider,
70 false);
71 configMember.addConfigurationOption("asset_database_connect",
72 ConfigurationOption.ConfigurationTypes.TYPE_STRING,
73 "Asset database connection string",
74 AssetDatabaseConnect,
75 false);
76 configMember.addConfigurationOption("inventory_storage_provider",
77 ConfigurationOption.ConfigurationTypes.TYPE_STRING,
78 "Inventory storage provider",
79 InventoryStorageProvider,
80 false);
81 configMember.addConfigurationOption("inventory_database_connect",
82 ConfigurationOption.ConfigurationTypes.TYPE_STRING,
83 "Inventory database connection string",
84 InventoryDatabaseConnect,
85 false);
86
87 configMember.addConfigurationOption("authentication_provider",
88 ConfigurationOption.ConfigurationTypes.TYPE_STRING,
89 "Authentication provider",
90 AuthenticationProvider,
91 false);
92 configMember.addConfigurationOption("authorization_provider",
93 ConfigurationOption.ConfigurationTypes.TYPE_STRING,
94 "Authentication provider",
95 AuthorizationProvider,
96 false);
97 configMember.addConfigurationOption("metrics_provider",
98 ConfigurationOption.ConfigurationTypes.TYPE_STRING,
99 "Metrics provider",
100 MetricsProvider,
101 false);
102 configMember.addConfigurationOption("frontends",
103 ConfigurationOption.ConfigurationTypes.TYPE_STRING,
104 "Comma-separated list of frontends",
105 Frontends,
106 false);
107
108 }
109
110 public bool handleIncomingConfiguration(string configuration_key, object configuration_result)
111 {
112 switch (configuration_key)
113 {
114 case "listen_port":
115 HttpPort = (uint) configuration_result;
116 break;
117 case "asset_storage_provider":
118 AssetStorageProvider = (string) configuration_result;
119 break;
120 case "asset_database_connect":
121 AssetDatabaseConnect = (string) configuration_result;
122 break;
123 case "inventory_storage_provider":
124 InventoryStorageProvider = (string) configuration_result;
125 break;
126 case "inventory_database_connect":
127 InventoryDatabaseConnect = (string) configuration_result;
128 break;
129 case "authentication_provider":
130 AuthenticationProvider = (string) configuration_result;
131 break;
132 case "authorization_provider":
133 AuthorizationProvider = (string) configuration_result;
134 break;
135 case "metrics_provider":
136 MetricsProvider = (string) configuration_result;
137 break;
138 case "frontends":
139 Frontends = (string) configuration_result;
140 break;
141 }
142
143 return true;
144 }
145 }
146}
diff --git a/OpenSim/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 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.IO;
30using System.Reflection;
31using OpenSim.Framework;
32using log4net;
33using Nini.Config;
34
35namespace OpenSim.Grid.AssetInventoryServer
36{
37 public static class AssetInventoryConfig
38 {
39 public const string CONFIG_FILE = "AssetInventoryServer.ini";
40 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
41
42 public static IConfigSource LoadConfig()
43 {
44 IConfigSource configSource = new IniConfigSource();
45 configSource.AddConfig("Startup");
46 return LoadConfig(configSource);
47 }
48
49 public static IConfigSource LoadConfig(IConfigSource source)
50 {
51 string iniFileName = source.Configs["Startup"].GetString("inifile", CONFIG_FILE);
52 string iniFilePath = Path.Combine(Util.configDir(), iniFileName);
53
54 source.Merge(DefaultConfig());
55
56 if (!File.Exists(iniFilePath))
57 {
58 m_log.FatalFormat("[CONFIG] File {0} not found, could not load any configuration.", iniFilePath);
59 m_log.FatalFormat("[CONFIG] Did you copy the AssetInventoryServer.ini.example file to AssetInventoryServer.ini?");
60 Environment.Exit(1);
61 }
62
63 source.Merge(new IniConfigSource(iniFilePath));
64 return source;
65 }
66
67 private static IConfigSource DefaultConfig()
68 {
69 IConfigSource result = new IniConfigSource();
70
71 {
72 IConfig config = result.AddConfig("Config");
73 config.Set("listen_port", 8003);
74 }
75
76 {
77 IConfig config = result.AddConfig("Plugins");
78 config.Set("asset_storage_provider", "OpenSimAssetStorage");
79 config.Set("inventory_storage_provider", "OpenSimInventoryStorage");
80 config.Set("authentication_provider", "NullAuthentication");
81 config.Set("authorization_provider", "AuthorizeAll");
82 config.Set("metrics_provider", "NullMetrics");
83 config.Set("frontends", "ReferenceFrontend,OpenSimAssetFrontend,OpenSimInventoryFrontend,BrowseFrontend");
84 }
85
86 {
87 IConfig config = result.AddConfig("OpenSim");
88 config.Set("asset_database_provider", "OpenSim.Data.MySQL.dll");
89 config.Set("inventory_database_provider", "OpenSim.Data.MySQL.dll");
90 config.Set("asset_database_connect", String.Empty);
91 config.Set("inventory_database_connect", String.Empty);
92 }
93
94 return result;
95 }
96 }
97}
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;
32using System.IO; 32using System.IO;
33using System.Net; 33using System.Net;
34using System.Reflection; 34using System.Reflection;
35using log4net;
36using OpenSim.Framework; 35using OpenSim.Framework;
37using OpenSim.Framework.Servers; 36using OpenSim.Framework.Servers;
38using OpenSim.Framework.Console; 37using OpenSim.Framework.Console;
38using Nini.Config;
39using log4net;
39 40
40namespace OpenSim.Grid.AssetInventoryServer 41namespace OpenSim.Grid.AssetInventoryServer
41{ 42{
42 public class AssetInventoryServer : BaseOpenSimServer 43 public class AssetInventoryServer : BaseOpenSimServer
43 { 44 {
44 public const string CONFIG_FILE = "AssetInventoryServer.ini"; 45 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
45 46 public IConfigSource ConfigFile;
46 public AssetInventoryConfig ConfigFile;
47 47
48 public IAssetStorageProvider StorageProvider; 48 public IAssetStorageProvider StorageProvider;
49 public IInventoryStorageProvider InventoryProvider; 49 public IInventoryStorageProvider InventoryProvider;
@@ -54,51 +54,58 @@ namespace OpenSim.Grid.AssetInventoryServer
54 private List<IAssetInventoryServerPlugin> m_frontends = new List<IAssetInventoryServerPlugin>(); 54 private List<IAssetInventoryServerPlugin> m_frontends = new List<IAssetInventoryServerPlugin>();
55 private List<IAssetInventoryServerPlugin> m_backends = new List<IAssetInventoryServerPlugin>(); 55 private List<IAssetInventoryServerPlugin> m_backends = new List<IAssetInventoryServerPlugin>();
56 56
57 public AssetInventoryServer() 57 public AssetInventoryServer(IConfigSource config)
58 { 58 {
59 m_console = new ConsoleBase("Asset"); 59 ConfigFile = config;
60
61 m_console = new ConsoleBase("AssetInventory");
60 MainConsole.Instance = m_console; 62 MainConsole.Instance = m_console;
61 } 63 }
62 64
63 public bool Start() 65 public bool Start()
64 { 66 {
65 Logger.Log.Info("Starting Asset Server"); 67 Startup();
66 uint port = 0; 68 m_log.Info("[ASSETINVENTORY] Starting AssetInventory Server");
67 69
68 try { ConfigFile = new AssetInventoryConfig("AssetInventory Server", (Path.Combine(Util.configDir(), "AssetInventoryServer.ini"))); } 70 try
71 {
72 ConfigFile = AssetInventoryConfig.LoadConfig(ConfigFile);
73 }
69 catch (Exception) 74 catch (Exception)
70 { 75 {
71 Logger.Log.Error("Failed to load the config file " + CONFIG_FILE); 76 m_log.Error("[ASSETINVENTORY] Failed to load the config.");
72 return false; 77 return false;
73 } 78 }
74 79
75 StorageProvider = LoadAssetInventoryServerPlugin("/OpenSim/AssetInventoryServer/StorageProvider", ConfigFile.AssetStorageProvider) as IAssetStorageProvider; 80 IConfig pluginConfig = ConfigFile.Configs["Plugins"];
81
82 StorageProvider = LoadAssetInventoryServerPlugin("/OpenSim/AssetInventoryServer/StorageProvider", pluginConfig.GetString("asset_storage_provider")) as IAssetStorageProvider;
76 m_backends.Add(StorageProvider); 83 m_backends.Add(StorageProvider);
77 84
78 InventoryProvider = LoadAssetInventoryServerPlugin("/OpenSim/AssetInventoryServer/InventoryProvider", ConfigFile.InventoryStorageProvider) as IInventoryStorageProvider; 85 InventoryProvider = LoadAssetInventoryServerPlugin("/OpenSim/AssetInventoryServer/InventoryProvider", pluginConfig.GetString("inventory_storage_provider")) as IInventoryStorageProvider;
79 m_backends.Add(InventoryProvider); 86 m_backends.Add(InventoryProvider);
80 87
81 MetricsProvider = LoadAssetInventoryServerPlugins("/OpenSim/AssetInventoryServer/MetricsProvider", ConfigFile.MetricsProvider) as IMetricsProvider; 88 MetricsProvider = LoadAssetInventoryServerPlugin("/OpenSim/AssetInventoryServer/MetricsProvider", pluginConfig.GetString("metrics_provider")) as IMetricsProvider;
82 m_backends.Add(MetricsProvider); 89 m_backends.Add(MetricsProvider);
83 90
84 try 91 try
85 { 92 {
86 InitHttpServer(ConfigFile.HttpPort); 93 InitHttpServer((uint) ConfigFile.Configs["Config"].GetInt("listen_port"));
87 } 94 }
88 catch (Exception ex) 95 catch (Exception ex)
89 { 96 {
90 Logger.Log.Error("Initializing the HTTP server failed, shutting down: " + ex.Message); 97 m_log.Error("[ASSETINVENTORY] Initializing the HTTP server failed, shutting down: " + ex.Message);
91 Shutdown(); 98 Shutdown();
92 return false; 99 return false;
93 } 100 }
94 101
95 AuthenticationProvider = LoadAssetInventoryServerPlugin("/OpenSim/AssetInventoryServer/AuthenticationProvider", ConfigFile.AuthenticationProvider) as IAuthenticationProvider; 102 AuthenticationProvider = LoadAssetInventoryServerPlugin("/OpenSim/AssetInventoryServer/AuthenticationProvider", pluginConfig.GetString("authentication_provider")) as IAuthenticationProvider;
96 m_backends.Add(AuthenticationProvider); 103 m_backends.Add(AuthenticationProvider);
97 104
98 AuthorizationProvider = LoadAssetInventoryServerPlugin("/OpenSim/AssetInventoryServer/AuthorizationProvider", ConfigFile.AuthorizationProvider) as IAuthorizationProvider; 105 AuthorizationProvider = LoadAssetInventoryServerPlugin("/OpenSim/AssetInventoryServer/AuthorizationProvider", pluginConfig.GetString("authorization_provider")) as IAuthorizationProvider;
99 m_backends.Add(AuthorizationProvider); 106 m_backends.Add(AuthorizationProvider);
100 107
101 m_frontends.AddRange(LoadAssetInventoryServerPlugins("/OpenSim/AssetInventoryServer/Frontend", ConfigFile.Frontends)); 108 m_frontends.AddRange(LoadAssetInventoryServerPlugins("/OpenSim/AssetInventoryServer/Frontend", pluginConfig.GetString("frontends")));
102 109
103 return true; 110 return true;
104 } 111 }
@@ -117,18 +124,18 @@ namespace OpenSim.Grid.AssetInventoryServer
117 { 124 {
118 foreach (IAssetInventoryServerPlugin plugin in m_frontends) 125 foreach (IAssetInventoryServerPlugin plugin in m_frontends)
119 { 126 {
120 Logger.Log.Debug("Disposing plugin " + plugin.Name); 127 m_log.Debug("[ASSETINVENTORY] Disposing plugin " + plugin.Name);
121 try { plugin.Dispose(); } 128 try { plugin.Dispose(); }
122 catch (Exception ex) 129 catch (Exception ex)
123 { Logger.Log.ErrorFormat("Failure shutting down plugin {0}: {1}", plugin.Name, ex.Message); } 130 { m_log.ErrorFormat("[ASSETINVENTORY] Failure shutting down plugin {0}: {1}", plugin.Name, ex.Message); }
124 } 131 }
125 132
126 foreach (IAssetInventoryServerPlugin plugin in m_backends) 133 foreach (IAssetInventoryServerPlugin plugin in m_backends)
127 { 134 {
128 Logger.Log.Debug("Disposing plugin " + plugin.Name); 135 m_log.Debug("[ASSETINVENTORY] Disposing plugin " + plugin.Name);
129 try { plugin.Dispose(); } 136 try { plugin.Dispose(); }
130 catch (Exception ex) 137 catch (Exception ex)
131 { Logger.Log.ErrorFormat("Failure shutting down plugin {0}: {1}", plugin.Name, ex.Message); } 138 { m_log.ErrorFormat("[ASSETINVENTORY] Failure shutting down plugin {0}: {1}", plugin.Name, ex.Message); }
132 } 139 }
133 140
134 if (HttpServer != null) 141 if (HttpServer != null)
@@ -140,7 +147,7 @@ namespace OpenSim.Grid.AssetInventoryServer
140 m_httpServer = new BaseHttpServer(port); 147 m_httpServer = new BaseHttpServer(port);
141 m_httpServer.Start(); 148 m_httpServer.Start();
142 149
143 Logger.Log.Info("Asset server is listening on port " + port); 150 m_log.Info("[ASSETINVENTORY] AssetInventory server is listening on port " + port);
144 } 151 }
145 152
146 private IAssetInventoryServerPlugin LoadAssetInventoryServerPlugin(string addinPath, string provider) 153 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 @@
1/*
2 * Copyright (c) 2008 Intel Corporation
3 * All rights reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 *
8 * -- Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * -- Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * -- Neither the name of the Intel Corporation nor the names of its
14 * contributors may be used to endorse or promote products derived from
15 * this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
20 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE INTEL OR ITS
21 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
22 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
23 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
24 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
25 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
26 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 */
29
30using System;
31using log4net;
32using log4net.Config;
33
34[assembly: log4net.Config.XmlConfigurator(ConfigFileExtension = "log4net")]
35
36namespace OpenSim.Grid.AssetInventoryServer
37{
38 /// <summary>
39 /// Singleton logging class for the entire library
40 /// </summary>
41 public static class Logger
42 {
43 /// <summary>log4net logging engine</summary>
44 public static ILog Log;
45
46 static Logger()
47 {
48 Log = LogManager.GetLogger(System.Reflection.Assembly.GetExecutingAssembly().FullName);
49
50 // If error level reporting isn't enabled we assume no logger is configured and initialize a default
51 // ConsoleAppender
52 if (!Log.Logger.IsEnabledFor(log4net.Core.Level.Error))
53 {
54 log4net.Appender.ConsoleAppender appender = new log4net.Appender.ConsoleAppender();
55 appender.Layout = new log4net.Layout.PatternLayout("%timestamp [%thread] %-5level - %message%newline");
56 BasicConfigurator.Configure(appender);
57
58 Log.Info("No log configuration found, defaulting to console logging");
59 }
60 }
61 }
62}
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 @@
28 */ 28 */
29 29
30using System; 30using System;
31using System.ServiceProcess; 31using Nini.Config;
32using log4net.Config;
32 33
33namespace OpenSim.Grid.AssetInventoryServer 34namespace OpenSim.Grid.AssetInventoryServer
34{ 35{
@@ -36,28 +37,24 @@ namespace OpenSim.Grid.AssetInventoryServer
36 { 37 {
37 static void Main(string[] args) 38 static void Main(string[] args)
38 { 39 {
39#if DEBUG 40 XmlConfigurator.Configure();
40 AssetInventoryServer server = new AssetInventoryServer(); 41
42 ArgvConfigSource configSource = new ArgvConfigSource(args);
43 configSource.AddSwitch("Startup", "inifile");
44
45 AssetInventoryServer server = new AssetInventoryServer(configSource);
41 if (server.Start()) 46 if (server.Start())
42 { 47 {
43 Console.WriteLine("Asset server is running. Press CTRL+C to quit");
44
45 Console.CancelKeyPress += 48 Console.CancelKeyPress +=
46 delegate(object sender, ConsoleCancelEventArgs e) 49 delegate(object sender, ConsoleCancelEventArgs e)
47 { 50 {
48 Console.WriteLine("Asset server is shutting down..."); 51 Console.WriteLine("AssetInventory server is shutting down...");
49 server.Shutdown(); 52 server.Shutdown();
50 Environment.Exit(0); 53 Environment.Exit(0);
51 }; 54 };
52 55
53 server.Work(); 56 server.Work();
54 //while (true)
55 // Console.ReadLine();
56 } 57 }
57#else
58 ServiceBase[] servicesToRun = new ServiceBase[] { new AssetInventoryServer() };
59 ServiceBase.Run(servicesToRun);
60#endif
61 } 58 }
62 } 59 }
63} 60}
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 @@
28 */ 28 */
29 29
30using System; 30using System;
31using System.Reflection;
31using OpenMetaverse; 32using OpenMetaverse;
32using OpenSim.Framework; 33using OpenSim.Framework;
34using log4net;
33 35
34namespace OpenSim.Grid.AssetInventoryServer.Plugins 36namespace OpenSim.Grid.AssetInventoryServer.Plugins
35{ 37{
36 public class AuthorizeAllPlugin : IAuthorizationProvider 38 public class AuthorizeAllPlugin : IAuthorizationProvider
37 { 39 {
40 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
38 AssetInventoryServer server; 41 AssetInventoryServer server;
39 42
40 public AuthorizeAllPlugin() 43 public AuthorizeAllPlugin()
@@ -47,7 +50,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins
47 { 50 {
48 this.server = server; 51 this.server = server;
49 52
50 Logger.Log.Info("[ASSET] Authorize All loaded."); 53 m_log.Info("[ASSET] Authorize All loaded.");
51 } 54 }
52 55
53 /// <summary> 56 /// <summary>
@@ -55,7 +58,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins
55 /// </summary> 58 /// </summary>
56 public void Initialise() 59 public void Initialise()
57 { 60 {
58 Logger.Log.InfoFormat("[ASSET]: {0} cannot be default-initialized!", Name); 61 m_log.InfoFormat("[ASSET]: {0} cannot be default-initialized!", Name);
59 throw new PluginNotInitialisedException(Name); 62 throw new PluginNotInitialisedException(Name);
60 } 63 }
61 64
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 @@
29 29
30using System; 30using System;
31using System.IO; 31using System.IO;
32using System.Reflection;
32using System.Collections.Generic; 33using System.Collections.Generic;
33using System.Collections.Specialized; 34using System.Collections.Specialized;
34using System.Net; 35using System.Net;
@@ -37,11 +38,13 @@ using System.Web;
37using OpenMetaverse; 38using OpenMetaverse;
38using OpenSim.Framework; 39using OpenSim.Framework;
39using OpenSim.Framework.Servers; 40using OpenSim.Framework.Servers;
41using log4net;
40 42
41namespace OpenSim.Grid.AssetInventoryServer.Plugins 43namespace OpenSim.Grid.AssetInventoryServer.Plugins
42{ 44{
43 public class BrowseFrontendPlugin : IAssetInventoryServerPlugin 45 public class BrowseFrontendPlugin : IAssetInventoryServerPlugin
44 { 46 {
47 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
45 AssetInventoryServer m_server; 48 AssetInventoryServer m_server;
46 49
47 public BrowseFrontendPlugin() 50 public BrowseFrontendPlugin()
@@ -58,7 +61,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins
58 //server.HttpServer.AddHandler("get", null, @"(^/$)|(^/\?.*)", BrowseRequestHandler); 61 //server.HttpServer.AddHandler("get", null, @"(^/$)|(^/\?.*)", BrowseRequestHandler);
59 m_server.HttpServer.AddStreamHandler(new BrowseRequestHandler(server)); 62 m_server.HttpServer.AddStreamHandler(new BrowseRequestHandler(server));
60 63
61 Logger.Log.Info("[ASSET] Browser Frontend loaded."); 64 m_log.Info("[ASSET] Browser Frontend loaded.");
62 } 65 }
63 66
64 /// <summary> 67 /// <summary>
@@ -66,7 +69,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins
66 /// </summary> 69 /// </summary>
67 public void Initialise() 70 public void Initialise()
68 { 71 {
69 Logger.Log.InfoFormat("[ASSET]: {0} cannot be default-initialized!", Name); 72 m_log.InfoFormat("[ASSET]: {0} cannot be default-initialized!", Name);
70 throw new PluginNotInitialisedException(Name); 73 throw new PluginNotInitialisedException(Name);
71 } 74 }
72 75
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 @@
28 */ 28 */
29 29
30using System; 30using System;
31using System.Reflection;
31using OpenMetaverse; 32using OpenMetaverse;
32using OpenSim.Framework; 33using OpenSim.Framework;
34using log4net;
33 35
34namespace OpenSim.Grid.AssetInventoryServer.Plugins 36namespace OpenSim.Grid.AssetInventoryServer.Plugins
35{ 37{
36 public class NullAuthenticationPlugin : IAuthenticationProvider 38 public class NullAuthenticationPlugin : IAuthenticationProvider
37 { 39 {
40 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
38 AssetInventoryServer server; 41 AssetInventoryServer server;
39 42
40 public NullAuthenticationPlugin() 43 public NullAuthenticationPlugin()
@@ -47,7 +50,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins
47 { 50 {
48 this.server = server; 51 this.server = server;
49 52
50 Logger.Log.Info("[ASSET] Null Authentication loaded."); 53 m_log.Info("[ASSET] Null Authentication loaded.");
51 } 54 }
52 55
53 /// <summary> 56 /// <summary>
@@ -55,7 +58,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins
55 /// </summary> 58 /// </summary>
56 public void Initialise() 59 public void Initialise()
57 { 60 {
58 Logger.Log.InfoFormat("[ASSET]: {0} cannot be default-initialized!", Name); 61 m_log.InfoFormat("[ASSET]: {0} cannot be default-initialized!", Name);
59 throw new PluginNotInitialisedException(Name); 62 throw new PluginNotInitialisedException(Name);
60 } 63 }
61 64
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 @@
28 */ 28 */
29 29
30using System; 30using System;
31using System.Reflection;
31using OpenMetaverse; 32using OpenMetaverse;
33using log4net;
32 34
33namespace OpenSim.Grid.AssetInventoryServer.Plugins 35namespace OpenSim.Grid.AssetInventoryServer.Plugins
34{ 36{
35 public class NullMetricsPlugin : IMetricsProvider 37 public class NullMetricsPlugin : IMetricsProvider
36 { 38 {
39 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
37 AssetInventoryServer server; 40 AssetInventoryServer server;
38 41
39 public NullMetricsPlugin() 42 public NullMetricsPlugin()
@@ -44,72 +47,72 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins
44 47
45 public void LogAssetMetadataFetch(string extension, BackendResponse response, UUID assetID, DateTime time) 48 public void LogAssetMetadataFetch(string extension, BackendResponse response, UUID assetID, DateTime time)
46 { 49 {
47 Logger.Log.DebugFormat("[{0}] AssetMetadataFetch(): AssetID: {1}, Response: {2}", extension, assetID, response); 50 m_log.DebugFormat("[{0}] AssetMetadataFetch(): AssetID: {1}, Response: {2}", extension, assetID, response);
48 } 51 }
49 52
50 public void LogAssetDataFetch(string extension, BackendResponse response, UUID assetID, int dataSize, DateTime time) 53 public void LogAssetDataFetch(string extension, BackendResponse response, UUID assetID, int dataSize, DateTime time)
51 { 54 {
52 Logger.Log.DebugFormat("[{0}] AssetDataFetch(): AssetID: {1}, DataSize: {2}, Response: {3}", extension, assetID, 55 m_log.DebugFormat("[{0}] AssetDataFetch(): AssetID: {1}, DataSize: {2}, Response: {3}", extension, assetID,
53 dataSize, response); 56 dataSize, response);
54 } 57 }
55 58
56 public void LogAssetCreate(string extension, BackendResponse response, UUID assetID, int dataSize, DateTime time) 59 public void LogAssetCreate(string extension, BackendResponse response, UUID assetID, int dataSize, DateTime time)
57 { 60 {
58 Logger.Log.DebugFormat("[{0}] AssetCreate(): AssetID: {1}, DataSize: {2}, Response: {3}", extension, assetID, 61 m_log.DebugFormat("[{0}] AssetCreate(): AssetID: {1}, DataSize: {2}, Response: {3}", extension, assetID,
59 dataSize, response); 62 dataSize, response);
60 } 63 }
61 64
62 public void LogInventoryFetch(string extension, BackendResponse response, Uri owner, UUID objID, bool folder, DateTime time) 65 public void LogInventoryFetch(string extension, BackendResponse response, Uri owner, UUID objID, bool folder, DateTime time)
63 { 66 {
64 Logger.Log.DebugFormat("[{0}] InventoryFetch(): ObjID: {1}, Folder: {2}, OwnerID: {3}, Response: {4}", extension, 67 m_log.DebugFormat("[{0}] InventoryFetch(): ObjID: {1}, Folder: {2}, OwnerID: {3}, Response: {4}", extension,
65 objID, folder, owner, response); 68 objID, folder, owner, response);
66 } 69 }
67 70
68 public void LogInventoryFetchFolderContents(string extension, BackendResponse response, Uri owner, UUID folderID, DateTime time) 71 public void LogInventoryFetchFolderContents(string extension, BackendResponse response, Uri owner, UUID folderID, DateTime time)
69 { 72 {
70 Logger.Log.DebugFormat("[{0}] InventoryFetchFolderContents(): FolderID: {1}, OwnerID: {2}, Response: {3}", extension, 73 m_log.DebugFormat("[{0}] InventoryFetchFolderContents(): FolderID: {1}, OwnerID: {2}, Response: {3}", extension,
71 folderID, owner, response); 74 folderID, owner, response);
72 } 75 }
73 76
74 public void LogInventoryFetchFolderList(string extension, BackendResponse response, Uri owner, DateTime time) 77 public void LogInventoryFetchFolderList(string extension, BackendResponse response, Uri owner, DateTime time)
75 { 78 {
76 Logger.Log.DebugFormat("[{0}] InventoryFetchFolderList(): OwnerID: {1}, Response: {2}", extension, 79 m_log.DebugFormat("[{0}] InventoryFetchFolderList(): OwnerID: {1}, Response: {2}", extension,
77 owner, response); 80 owner, response);
78 } 81 }
79 82
80 public void LogInventoryFetchInventory(string extension, BackendResponse response, Uri owner, DateTime time) 83 public void LogInventoryFetchInventory(string extension, BackendResponse response, Uri owner, DateTime time)
81 { 84 {
82 Logger.Log.DebugFormat("[{0}] InventoryFetchInventory(): OwnerID: {1}, Response: {2}", extension, 85 m_log.DebugFormat("[{0}] InventoryFetchInventory(): OwnerID: {1}, Response: {2}", extension,
83 owner, response); 86 owner, response);
84 } 87 }
85 88
86 public void LogInventoryFetchActiveGestures(string extension, BackendResponse response, Uri owner, DateTime time) 89 public void LogInventoryFetchActiveGestures(string extension, BackendResponse response, Uri owner, DateTime time)
87 { 90 {
88 Logger.Log.DebugFormat("[{0}] InventoryFetchActiveGestures(): OwnerID: {1}, Response: {2}", extension, 91 m_log.DebugFormat("[{0}] InventoryFetchActiveGestures(): OwnerID: {1}, Response: {2}", extension,
89 owner, response); 92 owner, response);
90 } 93 }
91 94
92 public void LogInventoryCreate(string extension, BackendResponse response, Uri owner, bool folder, DateTime time) 95 public void LogInventoryCreate(string extension, BackendResponse response, Uri owner, bool folder, DateTime time)
93 { 96 {
94 Logger.Log.DebugFormat("[{0}] InventoryCreate(): OwnerID: {1}, Response: {2}", extension, 97 m_log.DebugFormat("[{0}] InventoryCreate(): OwnerID: {1}, Response: {2}", extension,
95 owner, response); 98 owner, response);
96 } 99 }
97 100
98 public void LogInventoryCreateInventory(string extension, BackendResponse response, DateTime time) 101 public void LogInventoryCreateInventory(string extension, BackendResponse response, DateTime time)
99 { 102 {
100 Logger.Log.DebugFormat("[{0}] InventoryCreateInventory(): Response: {1}", extension, 103 m_log.DebugFormat("[{0}] InventoryCreateInventory(): Response: {1}", extension,
101 response); 104 response);
102 } 105 }
103 106
104 public void LogInventoryDelete(string extension, BackendResponse response, Uri owner, UUID objID, bool folder, DateTime time) 107 public void LogInventoryDelete(string extension, BackendResponse response, Uri owner, UUID objID, bool folder, DateTime time)
105 { 108 {
106 Logger.Log.DebugFormat("[{0}] InventoryDelete(): OwnerID: {1}, Folder: {2}, Response: {3}", extension, 109 m_log.DebugFormat("[{0}] InventoryDelete(): OwnerID: {1}, Folder: {2}, Response: {3}", extension,
107 owner, folder, response); 110 owner, folder, response);
108 } 111 }
109 112
110 public void LogInventoryPurgeFolder(string extension, BackendResponse response, Uri owner, UUID folderID, DateTime time) 113 public void LogInventoryPurgeFolder(string extension, BackendResponse response, Uri owner, UUID folderID, DateTime time)
111 { 114 {
112 Logger.Log.DebugFormat("[{0}] InventoryPurgeFolder(): OwnerID: {1}, FolderID: {2}, Response: {3}", extension, 115 m_log.DebugFormat("[{0}] InventoryPurgeFolder(): OwnerID: {1}, FolderID: {2}, Response: {3}", extension,
113 owner, response); 116 owner, response);
114 } 117 }
115 118
@@ -128,6 +131,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins
128 public void Initialise() 131 public void Initialise()
129 { 132 {
130 this.server = null; 133 this.server = null;
134 m_log.Info("[ASSET] Null metrics loaded.");
131 } 135 }
132 136
133 public void Dispose() 137 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 @@
28 */ 28 */
29 29
30using System; 30using System;
31using System.Reflection;
31using System.Collections.Generic; 32using System.Collections.Generic;
32using System.Net; 33using System.Net;
33using System.IO; 34using System.IO;
@@ -38,11 +39,13 @@ using OpenMetaverse;
38using HttpServer; 39using HttpServer;
39using OpenSim.Framework; 40using OpenSim.Framework;
40using OpenSim.Framework.Servers; 41using OpenSim.Framework.Servers;
42using log4net;
41 43
42namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim 44namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
43{ 45{
44 public class OpenSimAssetFrontendPlugin : IAssetInventoryServerPlugin 46 public class OpenSimAssetFrontendPlugin : IAssetInventoryServerPlugin
45 { 47 {
48 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
46 private AssetInventoryServer m_server; 49 private AssetInventoryServer m_server;
47 50
48 public OpenSimAssetFrontendPlugin() 51 public OpenSimAssetFrontendPlugin()
@@ -61,7 +64,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
61 // Asset creation 64 // Asset creation
62 m_server.HttpServer.AddStreamHandler(new AssetPostHandler(server)); 65 m_server.HttpServer.AddStreamHandler(new AssetPostHandler(server));
63 66
64 Logger.Log.Info("[ASSET] OpenSim Asset Frontend loaded."); 67 m_log.Info("[ASSET] OpenSim Asset Frontend loaded.");
65 } 68 }
66 69
67 /// <summary> 70 /// <summary>
@@ -69,7 +72,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
69 /// </summary> 72 /// </summary>
70 public void Initialise() 73 public void Initialise()
71 { 74 {
72 Logger.Log.InfoFormat("[ASSET]: {0} cannot be default-initialized!", Name); 75 m_log.InfoFormat("[ASSET]: {0} cannot be default-initialized!", Name);
73 throw new PluginNotInitialisedException(Name); 76 throw new PluginNotInitialisedException(Name);
74 } 77 }
75 78
@@ -97,7 +100,6 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
97 //public AssetRequestHandler(AssetInventoryServer server) : base("GET", "^/assets") 100 //public AssetRequestHandler(AssetInventoryServer server) : base("GET", "^/assets")
98 public AssetRequestHandler(AssetInventoryServer server) : base("GET", "/assets") 101 public AssetRequestHandler(AssetInventoryServer server) : base("GET", "/assets")
99 { 102 {
100 Logger.Log.Info("[REST]: In Get Request");
101 m_server = server; 103 m_server = server;
102 } 104 }
103 105
@@ -128,13 +130,13 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
128 } 130 }
129 else 131 else
130 { 132 {
131 Logger.Log.WarnFormat("Failed to fetch asset data or metadata for {0}: {1}", assetID, dataResponse); 133 m_log.WarnFormat("Failed to fetch asset data or metadata for {0}: {1}", assetID, dataResponse);
132 httpResponse.StatusCode = (int) HttpStatusCode.NotFound; 134 httpResponse.StatusCode = (int) HttpStatusCode.NotFound;
133 } 135 }
134 } 136 }
135 else 137 else
136 { 138 {
137 Logger.Log.Warn("Unrecognized OpenSim asset request: " + httpRequest.Url.PathAndQuery); 139 m_log.Warn("Unrecognized OpenSim asset request: " + httpRequest.Url.PathAndQuery);
138 } 140 }
139 141
140 return buffer; 142 return buffer;
@@ -181,13 +183,13 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
181 } 183 }
182 else 184 else
183 { 185 {
184 Logger.Log.Warn("AssetPostHandler called with no asset data"); 186 m_log.Warn("AssetPostHandler called with no asset data");
185 httpResponse.StatusCode = (int) HttpStatusCode.BadRequest; 187 httpResponse.StatusCode = (int) HttpStatusCode.BadRequest;
186 } 188 }
187 } 189 }
188 catch (Exception ex) 190 catch (Exception ex)
189 { 191 {
190 Logger.Log.Warn("Failed to parse POST data (expecting AssetBase): " + ex.Message); 192 m_log.Warn("Failed to parse POST data (expecting AssetBase): " + ex.Message);
191 httpResponse.StatusCode = (int) HttpStatusCode.BadRequest; 193 httpResponse.StatusCode = (int) HttpStatusCode.BadRequest;
192 } 194 }
193 195
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 @@
28 */ 28 */
29 29
30using System; 30using System;
31using System.Reflection;
31using System.Collections.Generic; 32using System.Collections.Generic;
32using System.Net; 33using System.Net;
33using System.Data; 34using System.Data;
@@ -36,15 +37,19 @@ using OpenMetaverse;
36using OpenMetaverse.StructuredData; 37using OpenMetaverse.StructuredData;
37using OpenSim.Framework; 38using OpenSim.Framework;
38using OpenSim.Data; 39using OpenSim.Data;
40using Nini.Config;
41using log4net;
39 42
40namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim 43namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
41{ 44{
42 public class OpenSimAssetStoragePlugin : IAssetStorageProvider 45 public class OpenSimAssetStoragePlugin : IAssetStorageProvider
43 { 46 {
47 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
44 const string EXTENSION_NAME = "OpenSimAssetStorage"; // Used in metrics reporting 48 const string EXTENSION_NAME = "OpenSimAssetStorage"; // Used in metrics reporting
45 49
46 private AssetInventoryServer server; 50 private AssetInventoryServer m_server;
47 private IAssetDataPlugin m_assetProvider; 51 private IAssetDataPlugin m_assetProvider;
52 private IConfig m_openSimConfig;
48 53
49 public OpenSimAssetStoragePlugin() 54 public OpenSimAssetStoragePlugin()
50 { 55 {
@@ -57,7 +62,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
57 metadata = null; 62 metadata = null;
58 BackendResponse ret; 63 BackendResponse ret;
59 64
60 using (MySqlConnection dbConnection = new MySqlConnection(server.ConfigFile.AssetDatabaseConnect)) 65 using (MySqlConnection dbConnection = new MySqlConnection(m_openSimConfig.GetString("asset_database_connect")))
61 { 66 {
62 IDataReader reader; 67 IDataReader reader;
63 68
@@ -89,12 +94,12 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
89 } 94 }
90 catch (MySqlException ex) 95 catch (MySqlException ex)
91 { 96 {
92 Logger.Log.Error("Connection to MySQL backend failed: " + ex.Message); 97 m_log.Error("Connection to MySQL backend failed: " + ex.Message);
93 ret = BackendResponse.Failure; 98 ret = BackendResponse.Failure;
94 } 99 }
95 } 100 }
96 101
97 server.MetricsProvider.LogAssetMetadataFetch(EXTENSION_NAME, ret, assetID, DateTime.Now); 102 m_server.MetricsProvider.LogAssetMetadataFetch(EXTENSION_NAME, ret, assetID, DateTime.Now);
98 return ret; 103 return ret;
99 } 104 }
100 105
@@ -103,7 +108,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
103 assetData = null; 108 assetData = null;
104 BackendResponse ret; 109 BackendResponse ret;
105 110
106 using (MySqlConnection dbConnection = new MySqlConnection(server.ConfigFile.AssetDatabaseConnect)) 111 using (MySqlConnection dbConnection = new MySqlConnection(m_openSimConfig.GetString("asset_database_connect")))
107 { 112 {
108 IDataReader reader; 113 IDataReader reader;
109 114
@@ -127,12 +132,12 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
127 } 132 }
128 catch (MySqlException ex) 133 catch (MySqlException ex)
129 { 134 {
130 Logger.Log.Error("Connection to MySQL backend failed: " + ex.Message); 135 m_log.Error("Connection to MySQL backend failed: " + ex.Message);
131 ret = BackendResponse.Failure; 136 ret = BackendResponse.Failure;
132 } 137 }
133 } 138 }
134 139
135 server.MetricsProvider.LogAssetDataFetch(EXTENSION_NAME, ret, assetID, (assetData != null ? assetData.Length : 0), DateTime.Now); 140 m_server.MetricsProvider.LogAssetDataFetch(EXTENSION_NAME, ret, assetID, (assetData != null ? assetData.Length : 0), DateTime.Now);
136 return ret; 141 return ret;
137 } 142 }
138 143
@@ -155,7 +160,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
155 { 160 {
156 BackendResponse ret; 161 BackendResponse ret;
157 162
158 using (MySqlConnection dbConnection = new MySqlConnection(server.ConfigFile.AssetDatabaseConnect)) 163 using (MySqlConnection dbConnection = new MySqlConnection(m_openSimConfig.GetString("asset_database_connect")))
159 { 164 {
160 try 165 try
161 { 166 {
@@ -180,23 +185,23 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
180 } 185 }
181 else if (rowsAffected == 2) 186 else if (rowsAffected == 2)
182 { 187 {
183 Logger.Log.Info("Replaced asset " + metadata.ID.ToString()); 188 m_log.Info("Replaced asset " + metadata.ID.ToString());
184 ret = BackendResponse.Success; 189 ret = BackendResponse.Success;
185 } 190 }
186 else 191 else
187 { 192 {
188 Logger.Log.ErrorFormat("MySQL REPLACE query affected {0} rows", rowsAffected); 193 m_log.ErrorFormat("MySQL REPLACE query affected {0} rows", rowsAffected);
189 ret = BackendResponse.Failure; 194 ret = BackendResponse.Failure;
190 } 195 }
191 } 196 }
192 catch (MySqlException ex) 197 catch (MySqlException ex)
193 { 198 {
194 Logger.Log.Error("Connection to MySQL backend failed: " + ex.Message); 199 m_log.Error("Connection to MySQL backend failed: " + ex.Message);
195 ret = BackendResponse.Failure; 200 ret = BackendResponse.Failure;
196 } 201 }
197 } 202 }
198 203
199 server.MetricsProvider.LogAssetCreate(EXTENSION_NAME, ret, metadata.ID, assetData.Length, DateTime.Now); 204 m_server.MetricsProvider.LogAssetCreate(EXTENSION_NAME, ret, metadata.ID, assetData.Length, DateTime.Now);
200 return ret; 205 return ret;
201 } 206 }
202 207
@@ -204,7 +209,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
204 { 209 {
205 int rowCount = 0; 210 int rowCount = 0;
206 211
207 using (MySqlConnection dbConnection = new MySqlConnection(server.ConfigFile.AssetDatabaseConnect)) 212 using (MySqlConnection dbConnection = new MySqlConnection(m_openSimConfig.GetString("asset_database_connect")))
208 { 213 {
209 MySqlDataReader reader; 214 MySqlDataReader reader;
210 215
@@ -219,7 +224,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
219 } 224 }
220 catch (MySqlException ex) 225 catch (MySqlException ex)
221 { 226 {
222 Logger.Log.Error("Connection to MySQL backend failed: " + ex.Message); 227 m_log.Error("Connection to MySQL backend failed: " + ex.Message);
223 return 0; 228 return 0;
224 } 229 }
225 230
@@ -250,22 +255,24 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
250 255
251 public void Initialise(AssetInventoryServer server) 256 public void Initialise(AssetInventoryServer server)
252 { 257 {
253 this.server = server; 258 m_server = server;
259 m_openSimConfig = server.ConfigFile.Configs["OpenSim"];
254 260
255 try 261 try
256 { 262 {
257 m_assetProvider = DataPluginFactory.LoadDataPlugin<IAssetDataPlugin>("OpenSim.Data.MySQL.dll", server.ConfigFile.AssetDatabaseConnect); 263 m_assetProvider = DataPluginFactory.LoadDataPlugin<IAssetDataPlugin>(m_openSimConfig.GetString("asset_database_provider"),
264 m_openSimConfig.GetString("asset_database_connect"));
258 if (m_assetProvider == null) 265 if (m_assetProvider == null)
259 { 266 {
260 Logger.Log.Error("[ASSET]: Failed to load a database plugin, server halting."); 267 m_log.Error("[ASSET]: Failed to load a database plugin, server halting.");
261 Environment.Exit(-1); 268 Environment.Exit(-1);
262 } 269 }
263 else 270 else
264 Logger.Log.InfoFormat("[ASSET]: Loaded storage backend: {0}", Version); 271 m_log.InfoFormat("[ASSET]: Loaded storage backend: {0}", Version);
265 } 272 }
266 catch (Exception e) 273 catch (Exception e)
267 { 274 {
268 Logger.Log.WarnFormat("[ASSET]: Failure loading data plugin: {0}", e.ToString()); 275 m_log.WarnFormat("[ASSET]: Failure loading data plugin: {0}", e.ToString());
269 } 276 }
270 } 277 }
271 278
@@ -274,7 +281,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
274 /// </summary> 281 /// </summary>
275 public void Initialise() 282 public void Initialise()
276 { 283 {
277 Logger.Log.InfoFormat("[ASSET]: {0} cannot be default-initialized!", Name); 284 m_log.InfoFormat("[ASSET]: {0} cannot be default-initialized!", Name);
278 throw new PluginNotInitialisedException(Name); 285 throw new PluginNotInitialisedException(Name);
279 } 286 }
280 287
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 @@
28 */ 28 */
29 29
30using System; 30using System;
31using System.Reflection;
31using System.Collections.Generic; 32using System.Collections.Generic;
32using System.Net; 33using System.Net;
33using System.IO; 34using System.IO;
@@ -36,11 +37,13 @@ using OpenMetaverse;
36using OpenMetaverse.StructuredData; 37using OpenMetaverse.StructuredData;
37using HttpServer; 38using HttpServer;
38using OpenSim.Framework; 39using OpenSim.Framework;
40using log4net;
39 41
40namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim 42namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
41{ 43{
42 public class OpenSimInventoryFrontendPlugin : IAssetInventoryServerPlugin 44 public class OpenSimInventoryFrontendPlugin : IAssetInventoryServerPlugin
43 { 45 {
46 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
44 private AssetInventoryServer server; 47 private AssetInventoryServer server;
45 private Utils.InventoryItemSerializer itemSerializer = new Utils.InventoryItemSerializer(); 48 private Utils.InventoryItemSerializer itemSerializer = new Utils.InventoryItemSerializer();
46 private Utils.InventoryFolderSerializer folderSerializer = new Utils.InventoryFolderSerializer(); 49 private Utils.InventoryFolderSerializer folderSerializer = new Utils.InventoryFolderSerializer();
@@ -67,7 +70,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
67 //server.HttpServer.AddHandler("post", null, @"^/RootFolders/", RootFoldersHandler); 70 //server.HttpServer.AddHandler("post", null, @"^/RootFolders/", RootFoldersHandler);
68 //server.HttpServer.AddHandler("post", null, @"^/ActiveGestures/", ActiveGesturesHandler); 71 //server.HttpServer.AddHandler("post", null, @"^/ActiveGestures/", ActiveGesturesHandler);
69 72
70 Logger.Log.Info("[INVENTORY] OpenSim Inventory Frontend loaded."); 73 m_log.Info("[INVENTORY] OpenSim Inventory Frontend loaded.");
71 } 74 }
72 75
73 /// <summary> 76 /// <summary>
@@ -75,7 +78,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
75 /// </summary> 78 /// </summary>
76 public void Initialise() 79 public void Initialise()
77 { 80 {
78 Logger.Log.InfoFormat("[INVENTORY]: {0} cannot be default-initialized!", Name); 81 m_log.InfoFormat("[INVENTORY]: {0} cannot be default-initialized!", Name);
79 throw new PluginNotInitialisedException(Name); 82 throw new PluginNotInitialisedException(Name);
80 } 83 }
81 84
@@ -103,7 +106,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
103 106
104 // if (ownerID != UUID.Zero) 107 // if (ownerID != UUID.Zero)
105 // { 108 // {
106 // Logger.Log.Warn("GetInventory is not scalable on some inventory backends, avoid calling it wherever possible"); 109 // m_log.Warn("GetInventory is not scalable on some inventory backends, avoid calling it wherever possible");
107 110
108 // Uri owner = Utils.GetOpenSimUri(ownerID); 111 // Uri owner = Utils.GetOpenSimUri(ownerID);
109 // InventoryCollection inventory; 112 // InventoryCollection inventory;
@@ -144,7 +147,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
144 // if (ownerID != UUID.Zero) 147 // if (ownerID != UUID.Zero)
145 // { 148 // {
146 // Uri owner = Utils.GetOpenSimUri(ownerID); 149 // Uri owner = Utils.GetOpenSimUri(ownerID);
147 // Logger.Log.DebugFormat("Created URI {0} for inventory creation", owner); 150 // m_log.DebugFormat("Created URI {0} for inventory creation", owner);
148 151
149 // InventoryFolder rootFolder = new InventoryFolder("My Inventory", ownerID, UUID.Zero, (short)AssetType.Folder); 152 // InventoryFolder rootFolder = new InventoryFolder("My Inventory", ownerID, UUID.Zero, (short)AssetType.Folder);
150 // BackendResponse storageResponse = server.InventoryProvider.TryCreateInventory(owner, rootFolder); 153 // BackendResponse storageResponse = server.InventoryProvider.TryCreateInventory(owner, rootFolder);
@@ -365,7 +368,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
365 } 368 }
366 catch (Exception ex) 369 catch (Exception ex)
367 { 370 {
368 Logger.Log.Warn("Failed to parse POST data (expecting guid): " + ex.Message); 371 m_log.Warn("Failed to parse POST data (expecting guid): " + ex.Message);
369 } 372 }
370 373
371 return id; 374 return id;
@@ -389,7 +392,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
389 } 392 }
390 catch (Exception ex) 393 catch (Exception ex)
391 { 394 {
392 Logger.Log.Warn("Failed to parse GetInventory POST data: " + ex.Message); 395 m_log.Warn("Failed to parse GetInventory POST data: " + ex.Message);
393 agentID = UUID.Zero; 396 agentID = UUID.Zero;
394 sessionID = UUID.Zero; 397 sessionID = UUID.Zero;
395 return UUID.Zero; 398 return UUID.Zero;
@@ -426,7 +429,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
426 } 429 }
427 catch (Exception ex) 430 catch (Exception ex)
428 { 431 {
429 Logger.Log.Warn("Failed to parse POST data (expecting InventoryFolderBase): " + ex.Message); 432 m_log.Warn("Failed to parse POST data (expecting InventoryFolderBase): " + ex.Message);
430 agentID = UUID.Zero; 433 agentID = UUID.Zero;
431 sessionID = UUID.Zero; 434 sessionID = UUID.Zero;
432 return null; 435 return null;
@@ -474,7 +477,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
474 } 477 }
475 catch (Exception ex) 478 catch (Exception ex)
476 { 479 {
477 Logger.Log.Warn("Failed to parse POST data (expecting InventoryItemBase): " + ex.Message); 480 m_log.Warn("Failed to parse POST data (expecting InventoryItemBase): " + ex.Message);
478 agentID = UUID.Zero; 481 agentID = UUID.Zero;
479 sessionID = UUID.Zero; 482 sessionID = UUID.Zero;
480 return null; 483 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 @@
28 */ 28 */
29 29
30using System; 30using System;
31using System.Reflection;
31using System.Collections.Generic; 32using System.Collections.Generic;
32using System.Net; 33using System.Net;
33using System.Data; 34using System.Data;
@@ -36,15 +37,19 @@ using OpenMetaverse;
36using OpenMetaverse.StructuredData; 37using OpenMetaverse.StructuredData;
37using OpenSim.Framework; 38using OpenSim.Framework;
38using OpenSim.Data; 39using OpenSim.Data;
40using Nini.Config;
41using log4net;
39 42
40namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim 43namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
41{ 44{
42 public class OpenSimInventoryStoragePlugin : IInventoryStorageProvider 45 public class OpenSimInventoryStoragePlugin : IInventoryStorageProvider
43 { 46 {
47 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
44 const string EXTENSION_NAME = "OpenSimInventoryStorage"; // Used in metrics reporting 48 const string EXTENSION_NAME = "OpenSimInventoryStorage"; // Used in metrics reporting
45 49
46 private AssetInventoryServer server; 50 private AssetInventoryServer m_server;
47 private IInventoryDataPlugin m_inventoryProvider; 51 private IInventoryDataPlugin m_inventoryProvider;
52 private IConfig m_openSimConfig;
48 53
49 public OpenSimInventoryStoragePlugin() 54 public OpenSimInventoryStoragePlugin()
50 { 55 {
@@ -57,7 +62,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
57 item = null; 62 item = null;
58 BackendResponse ret; 63 BackendResponse ret;
59 64
60 using (MySqlConnection dbConnection = new MySqlConnection(server.ConfigFile.InventoryDatabaseConnect)) 65 using (MySqlConnection dbConnection = new MySqlConnection(m_openSimConfig.GetString("inventory_database_connect")))
61 { 66 {
62 IDataReader reader; 67 IDataReader reader;
63 68
@@ -105,12 +110,12 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
105 } 110 }
106 catch (MySqlException ex) 111 catch (MySqlException ex)
107 { 112 {
108 Logger.Log.Error("Connection to MySQL backend failed: " + ex.Message); 113 m_log.Error("Connection to MySQL backend failed: " + ex.Message);
109 ret = BackendResponse.Failure; 114 ret = BackendResponse.Failure;
110 } 115 }
111 } 116 }
112 117
113 server.MetricsProvider.LogInventoryFetch(EXTENSION_NAME, ret, owner, itemID, false, DateTime.Now); 118 m_server.MetricsProvider.LogInventoryFetch(EXTENSION_NAME, ret, owner, itemID, false, DateTime.Now);
114 return ret; 119 return ret;
115 } 120 }
116 121
@@ -119,7 +124,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
119 folder = null; 124 folder = null;
120 BackendResponse ret; 125 BackendResponse ret;
121 126
122 using (MySqlConnection dbConnection = new MySqlConnection(server.ConfigFile.InventoryDatabaseConnect)) 127 using (MySqlConnection dbConnection = new MySqlConnection(m_openSimConfig.GetString("inventory_database_connect")))
123 { 128 {
124 IDataReader reader; 129 IDataReader reader;
125 130
@@ -152,12 +157,12 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
152 } 157 }
153 catch (MySqlException ex) 158 catch (MySqlException ex)
154 { 159 {
155 Logger.Log.Error("Connection to MySQL backend failed: " + ex.Message); 160 m_log.Error("Connection to MySQL backend failed: " + ex.Message);
156 ret = BackendResponse.Failure; 161 ret = BackendResponse.Failure;
157 } 162 }
158 } 163 }
159 164
160 server.MetricsProvider.LogInventoryFetch(EXTENSION_NAME, ret, owner, folderID, true, DateTime.Now); 165 m_server.MetricsProvider.LogInventoryFetch(EXTENSION_NAME, ret, owner, folderID, true, DateTime.Now);
161 return ret; 166 return ret;
162 } 167 }
163 168
@@ -166,7 +171,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
166 contents = null; 171 contents = null;
167 BackendResponse ret; 172 BackendResponse ret;
168 173
169 using (MySqlConnection dbConnection = new MySqlConnection(server.ConfigFile.InventoryDatabaseConnect)) 174 using (MySqlConnection dbConnection = new MySqlConnection(m_openSimConfig.GetString("inventory_database_connect")))
170 { 175 {
171 IDataReader reader; 176 IDataReader reader;
172 177
@@ -249,12 +254,12 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
249 } 254 }
250 catch (MySqlException ex) 255 catch (MySqlException ex)
251 { 256 {
252 Logger.Log.Error("Connection to MySQL backend failed: " + ex.Message); 257 m_log.Error("Connection to MySQL backend failed: " + ex.Message);
253 ret = BackendResponse.Failure; 258 ret = BackendResponse.Failure;
254 } 259 }
255 } 260 }
256 261
257 server.MetricsProvider.LogInventoryFetchFolderContents(EXTENSION_NAME, ret, owner, folderID, DateTime.Now); 262 m_server.MetricsProvider.LogInventoryFetchFolderContents(EXTENSION_NAME, ret, owner, folderID, DateTime.Now);
258 return ret; 263 return ret;
259 } 264 }
260 265
@@ -266,7 +271,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
266 271
267 if (Utils.TryGetOpenSimUUID(owner, out ownerID)) 272 if (Utils.TryGetOpenSimUUID(owner, out ownerID))
268 { 273 {
269 using (MySqlConnection dbConnection = new MySqlConnection(server.ConfigFile.InventoryDatabaseConnect)) 274 using (MySqlConnection dbConnection = new MySqlConnection(m_openSimConfig.GetString("inventory_database_connect")))
270 { 275 {
271 IDataReader reader; 276 IDataReader reader;
272 277
@@ -298,7 +303,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
298 } 303 }
299 catch (MySqlException ex) 304 catch (MySqlException ex)
300 { 305 {
301 Logger.Log.Error("Connection to MySQL backend failed: " + ex.Message); 306 m_log.Error("Connection to MySQL backend failed: " + ex.Message);
302 ret = BackendResponse.Failure; 307 ret = BackendResponse.Failure;
303 } 308 }
304 } 309 }
@@ -308,7 +313,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
308 ret = BackendResponse.NotFound; 313 ret = BackendResponse.NotFound;
309 } 314 }
310 315
311 server.MetricsProvider.LogInventoryFetchFolderList(EXTENSION_NAME, ret, owner, DateTime.Now); 316 m_server.MetricsProvider.LogInventoryFetchFolderList(EXTENSION_NAME, ret, owner, DateTime.Now);
312 return ret; 317 return ret;
313 } 318 }
314 319
@@ -332,7 +337,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
332 // Fetch inventory items 337 // Fetch inventory items
333 if (Utils.TryGetOpenSimUUID(owner, out ownerID)) 338 if (Utils.TryGetOpenSimUUID(owner, out ownerID))
334 { 339 {
335 using (MySqlConnection dbConnection = new MySqlConnection(server.ConfigFile.InventoryDatabaseConnect)) 340 using (MySqlConnection dbConnection = new MySqlConnection(m_openSimConfig.GetString("inventory_database_connect")))
336 { 341 {
337 IDataReader reader; 342 IDataReader reader;
338 343
@@ -381,7 +386,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
381 } 386 }
382 catch (MySqlException ex) 387 catch (MySqlException ex)
383 { 388 {
384 Logger.Log.Error("Connection to MySQL backend failed: " + ex.Message); 389 m_log.Error("Connection to MySQL backend failed: " + ex.Message);
385 ret = BackendResponse.Failure; 390 ret = BackendResponse.Failure;
386 } 391 }
387 } 392 }
@@ -392,7 +397,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
392 } 397 }
393 } 398 }
394 399
395 server.MetricsProvider.LogInventoryFetchInventory(EXTENSION_NAME, ret, owner, DateTime.Now); 400 m_server.MetricsProvider.LogInventoryFetchInventory(EXTENSION_NAME, ret, owner, DateTime.Now);
396 return ret; 401 return ret;
397 } 402 }
398 403
@@ -404,7 +409,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
404 409
405 if (Utils.TryGetOpenSimUUID(owner, out ownerID)) 410 if (Utils.TryGetOpenSimUUID(owner, out ownerID))
406 { 411 {
407 using (MySqlConnection dbConnection = new MySqlConnection(server.ConfigFile.InventoryDatabaseConnect)) 412 using (MySqlConnection dbConnection = new MySqlConnection(m_openSimConfig.GetString("inventory_database_connect")))
408 { 413 {
409 IDataReader reader; 414 IDataReader reader;
410 415
@@ -451,7 +456,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
451 } 456 }
452 catch (MySqlException ex) 457 catch (MySqlException ex)
453 { 458 {
454 Logger.Log.Error("Connection to MySQL backend failed: " + ex.Message); 459 m_log.Error("Connection to MySQL backend failed: " + ex.Message);
455 ret = BackendResponse.Failure; 460 ret = BackendResponse.Failure;
456 } 461 }
457 } 462 }
@@ -461,7 +466,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
461 ret = BackendResponse.NotFound; 466 ret = BackendResponse.NotFound;
462 } 467 }
463 468
464 server.MetricsProvider.LogInventoryFetchActiveGestures(EXTENSION_NAME, ret, owner, DateTime.Now); 469 m_server.MetricsProvider.LogInventoryFetchActiveGestures(EXTENSION_NAME, ret, owner, DateTime.Now);
465 return ret; 470 return ret;
466 } 471 }
467 472
@@ -469,7 +474,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
469 { 474 {
470 BackendResponse ret; 475 BackendResponse ret;
471 476
472 using (MySqlConnection dbConnection = new MySqlConnection(server.ConfigFile.InventoryDatabaseConnect)) 477 using (MySqlConnection dbConnection = new MySqlConnection(m_openSimConfig.GetString("inventory_database_connect")))
473 { 478 {
474 try 479 try
475 { 480 {
@@ -512,23 +517,23 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
512 } 517 }
513 else if (rowsAffected == 2) 518 else if (rowsAffected == 2)
514 { 519 {
515 Logger.Log.Info("Replaced inventory item " + item.ID.ToString()); 520 m_log.Info("Replaced inventory item " + item.ID.ToString());
516 ret = BackendResponse.Success; 521 ret = BackendResponse.Success;
517 } 522 }
518 else 523 else
519 { 524 {
520 Logger.Log.ErrorFormat("MySQL REPLACE query affected {0} rows", rowsAffected); 525 m_log.ErrorFormat("MySQL REPLACE query affected {0} rows", rowsAffected);
521 ret = BackendResponse.Failure; 526 ret = BackendResponse.Failure;
522 } 527 }
523 } 528 }
524 catch (MySqlException ex) 529 catch (MySqlException ex)
525 { 530 {
526 Logger.Log.Error("Connection to MySQL backend failed: " + ex.Message); 531 m_log.Error("Connection to MySQL backend failed: " + ex.Message);
527 ret = BackendResponse.Failure; 532 ret = BackendResponse.Failure;
528 } 533 }
529 } 534 }
530 535
531 server.MetricsProvider.LogInventoryCreate(EXTENSION_NAME, ret, owner, false, DateTime.Now); 536 m_server.MetricsProvider.LogInventoryCreate(EXTENSION_NAME, ret, owner, false, DateTime.Now);
532 return ret; 537 return ret;
533 } 538 }
534 539
@@ -536,7 +541,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
536 { 541 {
537 BackendResponse ret; 542 BackendResponse ret;
538 543
539 using (MySqlConnection dbConnection = new MySqlConnection(server.ConfigFile.InventoryDatabaseConnect)) 544 using (MySqlConnection dbConnection = new MySqlConnection(m_openSimConfig.GetString("inventory_database_connect")))
540 { 545 {
541 try 546 try
542 { 547 {
@@ -560,23 +565,23 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
560 } 565 }
561 else if (rowsAffected == 2) 566 else if (rowsAffected == 2)
562 { 567 {
563 Logger.Log.Info("Replaced inventory folder " + folder.ID.ToString()); 568 m_log.Info("Replaced inventory folder " + folder.ID.ToString());
564 ret = BackendResponse.Success; 569 ret = BackendResponse.Success;
565 } 570 }
566 else 571 else
567 { 572 {
568 Logger.Log.ErrorFormat("MySQL REPLACE query affected {0} rows", rowsAffected); 573 m_log.ErrorFormat("MySQL REPLACE query affected {0} rows", rowsAffected);
569 ret = BackendResponse.Failure; 574 ret = BackendResponse.Failure;
570 } 575 }
571 } 576 }
572 catch (MySqlException ex) 577 catch (MySqlException ex)
573 { 578 {
574 Logger.Log.Error("Connection to MySQL backend failed: " + ex.Message); 579 m_log.Error("Connection to MySQL backend failed: " + ex.Message);
575 ret = BackendResponse.Failure; 580 ret = BackendResponse.Failure;
576 } 581 }
577 } 582 }
578 583
579 server.MetricsProvider.LogInventoryCreate(EXTENSION_NAME, ret, owner, true, DateTime.Now); 584 m_server.MetricsProvider.LogInventoryCreate(EXTENSION_NAME, ret, owner, true, DateTime.Now);
580 return ret; 585 return ret;
581 } 586 }
582 587
@@ -592,7 +597,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
592 597
593 if (Utils.TryGetOpenSimUUID(owner, out ownerID)) 598 if (Utils.TryGetOpenSimUUID(owner, out ownerID))
594 { 599 {
595 using (MySqlConnection dbConnection = new MySqlConnection(server.ConfigFile.InventoryDatabaseConnect)) 600 using (MySqlConnection dbConnection = new MySqlConnection(m_openSimConfig.GetString("inventory_database_connect")))
596 { 601 {
597 try 602 try
598 { 603 {
@@ -611,13 +616,13 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
611 } 616 }
612 else 617 else
613 { 618 {
614 Logger.Log.ErrorFormat("MySQL DELETE query affected {0} rows", rowsAffected); 619 m_log.ErrorFormat("MySQL DELETE query affected {0} rows", rowsAffected);
615 ret = BackendResponse.NotFound; 620 ret = BackendResponse.NotFound;
616 } 621 }
617 } 622 }
618 catch (MySqlException ex) 623 catch (MySqlException ex)
619 { 624 {
620 Logger.Log.Error("Connection to MySQL backend failed: " + ex.Message); 625 m_log.Error("Connection to MySQL backend failed: " + ex.Message);
621 ret = BackendResponse.Failure; 626 ret = BackendResponse.Failure;
622 } 627 }
623 } 628 }
@@ -627,7 +632,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
627 ret = BackendResponse.NotFound; 632 ret = BackendResponse.NotFound;
628 } 633 }
629 634
630 server.MetricsProvider.LogInventoryDelete(EXTENSION_NAME, ret, owner, itemID, false, DateTime.Now); 635 m_server.MetricsProvider.LogInventoryDelete(EXTENSION_NAME, ret, owner, itemID, false, DateTime.Now);
631 return ret; 636 return ret;
632 } 637 }
633 638
@@ -638,7 +643,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
638 643
639 if (Utils.TryGetOpenSimUUID(owner, out ownerID)) 644 if (Utils.TryGetOpenSimUUID(owner, out ownerID))
640 { 645 {
641 using (MySqlConnection dbConnection = new MySqlConnection(server.ConfigFile.InventoryDatabaseConnect)) 646 using (MySqlConnection dbConnection = new MySqlConnection(m_openSimConfig.GetString("inventory_database_connect")))
642 { 647 {
643 try 648 try
644 { 649 {
@@ -657,13 +662,13 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
657 } 662 }
658 else 663 else
659 { 664 {
660 Logger.Log.ErrorFormat("MySQL DELETE query affected {0} rows", rowsAffected); 665 m_log.ErrorFormat("MySQL DELETE query affected {0} rows", rowsAffected);
661 ret = BackendResponse.NotFound; 666 ret = BackendResponse.NotFound;
662 } 667 }
663 } 668 }
664 catch (MySqlException ex) 669 catch (MySqlException ex)
665 { 670 {
666 Logger.Log.Error("Connection to MySQL backend failed: " + ex.Message); 671 m_log.Error("Connection to MySQL backend failed: " + ex.Message);
667 ret = BackendResponse.Failure; 672 ret = BackendResponse.Failure;
668 } 673 }
669 } 674 }
@@ -673,7 +678,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
673 ret = BackendResponse.NotFound; 678 ret = BackendResponse.NotFound;
674 } 679 }
675 680
676 server.MetricsProvider.LogInventoryDelete(EXTENSION_NAME, ret, owner, folderID, true, DateTime.Now); 681 m_server.MetricsProvider.LogInventoryDelete(EXTENSION_NAME, ret, owner, folderID, true, DateTime.Now);
677 return ret; 682 return ret;
678 } 683 }
679 684
@@ -684,7 +689,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
684 689
685 if (Utils.TryGetOpenSimUUID(owner, out ownerID)) 690 if (Utils.TryGetOpenSimUUID(owner, out ownerID))
686 { 691 {
687 using (MySqlConnection dbConnection = new MySqlConnection(server.ConfigFile.InventoryDatabaseConnect)) 692 using (MySqlConnection dbConnection = new MySqlConnection(m_openSimConfig.GetString("inventory_database_connect")))
688 { 693 {
689 try 694 try
690 { 695 {
@@ -714,13 +719,13 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
714 719
715 #endregion Delete folders 720 #endregion Delete folders
716 721
717 Logger.Log.DebugFormat("Deleted {0} inventory objects from MySQL in a folder purge", rowsAffected); 722 m_log.DebugFormat("Deleted {0} inventory objects from MySQL in a folder purge", rowsAffected);
718 723
719 ret = BackendResponse.Success; 724 ret = BackendResponse.Success;
720 } 725 }
721 catch (MySqlException ex) 726 catch (MySqlException ex)
722 { 727 {
723 Logger.Log.Error("Connection to MySQL backend failed: " + ex.Message); 728 m_log.Error("Connection to MySQL backend failed: " + ex.Message);
724 ret = BackendResponse.Failure; 729 ret = BackendResponse.Failure;
725 } 730 }
726 } 731 }
@@ -730,7 +735,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
730 ret = BackendResponse.NotFound; 735 ret = BackendResponse.NotFound;
731 } 736 }
732 737
733 server.MetricsProvider.LogInventoryPurgeFolder(EXTENSION_NAME, ret, owner, folderID, DateTime.Now); 738 m_server.MetricsProvider.LogInventoryPurgeFolder(EXTENSION_NAME, ret, owner, folderID, DateTime.Now);
734 return ret; 739 return ret;
735 } 740 }
736 741
@@ -738,7 +743,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
738 { 743 {
739 int rowCount = 0; 744 int rowCount = 0;
740 745
741 using (MySqlConnection dbConnection = new MySqlConnection(server.ConfigFile.InventoryDatabaseConnect)) 746 using (MySqlConnection dbConnection = new MySqlConnection(m_openSimConfig.GetString("inventory_database_connect")))
742 { 747 {
743 MySqlDataReader reader; 748 MySqlDataReader reader;
744 749
@@ -753,7 +758,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
753 } 758 }
754 catch (MySqlException ex) 759 catch (MySqlException ex)
755 { 760 {
756 Logger.Log.Error("Connection to MySQL backend failed: " + ex.Message); 761 m_log.Error("Connection to MySQL backend failed: " + ex.Message);
757 return 0; 762 return 0;
758 } 763 }
759 764
@@ -784,22 +789,24 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
784 789
785 public void Initialise(AssetInventoryServer server) 790 public void Initialise(AssetInventoryServer server)
786 { 791 {
787 this.server = server; 792 m_server = server;
793 m_openSimConfig = server.ConfigFile.Configs["OpenSim"];
788 794
789 try 795 try
790 { 796 {
791 m_inventoryProvider = DataPluginFactory.LoadDataPlugin<IInventoryDataPlugin>("OpenSim.Data.MySQL.dll", server.ConfigFile.InventoryDatabaseConnect); 797 m_inventoryProvider = DataPluginFactory.LoadDataPlugin<IInventoryDataPlugin>(m_openSimConfig.GetString("inventory_database_provider"),
798 m_openSimConfig.GetString("inventory_database_connect"));
792 if (m_inventoryProvider == null) 799 if (m_inventoryProvider == null)
793 { 800 {
794 Logger.Log.Error("[INVENTORY]: Failed to load a database plugin, server halting."); 801 m_log.Error("[INVENTORY]: Failed to load a database plugin, server halting.");
795 Environment.Exit(-1); 802 Environment.Exit(-1);
796 } 803 }
797 else 804 else
798 Logger.Log.InfoFormat("[INVENTORY]: Loaded storage backend: {0}", Version); 805 m_log.InfoFormat("[INVENTORY]: Loaded storage backend: {0}", Version);
799 } 806 }
800 catch (Exception e) 807 catch (Exception e)
801 { 808 {
802 Logger.Log.WarnFormat("[INVENTORY]: Failure loading data plugin: {0}", e.ToString()); 809 m_log.WarnFormat("[INVENTORY]: Failure loading data plugin: {0}", e.ToString());
803 } 810 }
804 } 811 }
805 812
@@ -809,7 +816,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
809 816
810 public void Initialise() 817 public void Initialise()
811 { 818 {
812 Logger.Log.InfoFormat("[INVENTORY]: {0} cannot be default-initialized!", Name); 819 m_log.InfoFormat("[INVENTORY]: {0} cannot be default-initialized!", Name);
813 throw new PluginNotInitialisedException(Name); 820 throw new PluginNotInitialisedException(Name);
814 } 821 }
815 822
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 @@
29 29
30using System; 30using System;
31using System.IO; 31using System.IO;
32using System.Reflection;
32using System.Collections.Generic; 33using System.Collections.Generic;
33using System.Net; 34using System.Net;
34using System.Xml; 35using System.Xml;
@@ -37,11 +38,13 @@ using OpenMetaverse.StructuredData;
37using HttpServer; 38using HttpServer;
38using OpenSim.Framework; 39using OpenSim.Framework;
39using OpenSim.Framework.Servers; 40using OpenSim.Framework.Servers;
41using log4net;
40 42
41namespace OpenSim.Grid.AssetInventoryServer.Plugins 43namespace OpenSim.Grid.AssetInventoryServer.Plugins
42{ 44{
43 public class ReferenceFrontendPlugin : IAssetInventoryServerPlugin 45 public class ReferenceFrontendPlugin : IAssetInventoryServerPlugin
44 { 46 {
47 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
45 AssetInventoryServer m_server; 48 AssetInventoryServer m_server;
46 49
47 public ReferenceFrontendPlugin() 50 public ReferenceFrontendPlugin()
@@ -63,7 +66,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins
63 // Asset creation 66 // Asset creation
64 m_server.HttpServer.AddStreamHandler(new CreateRequestHandler(server)); 67 m_server.HttpServer.AddStreamHandler(new CreateRequestHandler(server));
65 68
66 Logger.Log.Info("[ASSET] Reference Frontend loaded."); 69 m_log.Info("[ASSET] Reference Frontend loaded.");
67 } 70 }
68 71
69 /// <summary> 72 /// <summary>
@@ -71,7 +74,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins
71 /// </summary> 74 /// </summary>
72 public void Initialise() 75 public void Initialise()
73 { 76 {
74 Logger.Log.InfoFormat("[ASSET]: {0} cannot be default-initialized!", Name); 77 m_log.InfoFormat("[ASSET]: {0} cannot be default-initialized!", Name);
75 throw new PluginNotInitialisedException(Name); 78 throw new PluginNotInitialisedException(Name);
76 } 79 }
77 80
@@ -159,7 +162,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins
159 } 162 }
160 else if (storageResponse == BackendResponse.NotFound) 163 else if (storageResponse == BackendResponse.NotFound)
161 { 164 {
162 Logger.Log.Warn("Could not find metadata for asset " + assetID.ToString()); 165 m_log.Warn("Could not find metadata for asset " + assetID.ToString());
163 httpResponse.StatusCode = (int) HttpStatusCode.NotFound; 166 httpResponse.StatusCode = (int) HttpStatusCode.NotFound;
164 } 167 }
165 else 168 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 @@
28 */ 28 */
29 29
30using System; 30using System;
31using System.Reflection;
31using System.Collections.Generic; 32using System.Collections.Generic;
32using System.Net; 33using System.Net;
33using System.IO; 34using System.IO;
34using OpenMetaverse; 35using OpenMetaverse;
35using OpenMetaverse.StructuredData; 36using OpenMetaverse.StructuredData;
36using OpenSim.Framework; 37using OpenSim.Framework;
38using log4net;
37 39
38namespace OpenSim.Grid.AssetInventoryServer.Plugins.Simple 40namespace OpenSim.Grid.AssetInventoryServer.Plugins.Simple
39{ 41{
@@ -43,6 +45,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.Simple
43 const string DEFAULT_DATA_DIR = "SimpleAssets"; 45 const string DEFAULT_DATA_DIR = "SimpleAssets";
44 const string TEMP_DATA_DIR = "SimpleAssetsTemp"; 46 const string TEMP_DATA_DIR = "SimpleAssetsTemp";
45 47
48 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
46 AssetInventoryServer server; 49 AssetInventoryServer server;
47 Dictionary<UUID, Metadata> metadataStorage; 50 Dictionary<UUID, Metadata> metadataStorage;
48 Dictionary<UUID, string> filenames; 51 Dictionary<UUID, string> filenames;
@@ -82,7 +85,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.Simple
82 } 85 }
83 catch (Exception ex) 86 catch (Exception ex)
84 { 87 {
85 Logger.Log.ErrorFormat("Failed reading data for asset {0} from {1}: {2}", assetID, filename, ex.Message); 88 m_log.ErrorFormat("Failed reading data for asset {0} from {1}: {2}", assetID, filename, ex.Message);
86 ret = BackendResponse.Failure; 89 ret = BackendResponse.Failure;
87 } 90 }
88 } 91 }
@@ -112,7 +115,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.Simple
112 } 115 }
113 catch (Exception ex) 116 catch (Exception ex)
114 { 117 {
115 Logger.Log.ErrorFormat("Failed reading data for asset {0} from {1}: {2}", assetID, filename, ex.Message); 118 m_log.ErrorFormat("Failed reading data for asset {0} from {1}: {2}", assetID, filename, ex.Message);
116 ret = BackendResponse.Failure; 119 ret = BackendResponse.Failure;
117 } 120 }
118 } 121 }
@@ -169,7 +172,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.Simple
169 } 172 }
170 catch (Exception ex) 173 catch (Exception ex)
171 { 174 {
172 Logger.Log.ErrorFormat("Failed writing data for asset {0} to {1}: {2}", metadata.ID, filename, ex.Message); 175 m_log.ErrorFormat("Failed writing data for asset {0} to {1}: {2}", metadata.ID, filename, ex.Message);
173 ret = BackendResponse.Failure; 176 ret = BackendResponse.Failure;
174 } 177 }
175 178
@@ -207,7 +210,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.Simple
207 LoadFiles(DEFAULT_DATA_DIR, false); 210 LoadFiles(DEFAULT_DATA_DIR, false);
208 LoadFiles(TEMP_DATA_DIR, true); 211 LoadFiles(TEMP_DATA_DIR, true);
209 212
210 Logger.Log.InfoFormat("Initialized the store index with metadata for {0} assets", 213 m_log.InfoFormat("Initialized the store index with metadata for {0} assets",
211 metadataStorage.Count); 214 metadataStorage.Count);
212 } 215 }
213 216
@@ -216,7 +219,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.Simple
216 /// </summary> 219 /// </summary>
217 public void Initialise() 220 public void Initialise()
218 { 221 {
219 Logger.Log.InfoFormat("[ASSET]: {0} cannot be default-initialized!", Name); 222 m_log.InfoFormat("[ASSET]: {0} cannot be default-initialized!", Name);
220 throw new PluginNotInitialisedException(Name); 223 throw new PluginNotInitialisedException(Name);
221 } 224 }
222 225
@@ -243,7 +246,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.Simple
243 if (Directory.Exists(TEMP_DATA_DIR)) 246 if (Directory.Exists(TEMP_DATA_DIR))
244 { 247 {
245 try { Directory.Delete(TEMP_DATA_DIR); } 248 try { Directory.Delete(TEMP_DATA_DIR); }
246 catch (Exception ex) { Logger.Log.Error(ex.Message); } 249 catch (Exception ex) { m_log.Error(ex.Message); }
247 } 250 }
248 } 251 }
249 252
@@ -255,7 +258,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.Simple
255 try { Directory.CreateDirectory(folder); } 258 try { Directory.CreateDirectory(folder); }
256 catch (Exception ex) 259 catch (Exception ex)
257 { 260 {
258 Logger.Log.Warn(ex.Message); 261 m_log.Warn(ex.Message);
259 return; 262 return;
260 } 263 }
261 } 264 }
@@ -287,7 +290,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.Simple
287 } 290 }
288 catch (Exception ex) 291 catch (Exception ex)
289 { 292 {
290 Logger.Log.Warn(ex.Message); 293 m_log.Warn(ex.Message);
291 } 294 }
292 } 295 }
293 } 296 }
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 @@
28 */ 28 */
29 29
30using System; 30using System;
31using System.Reflection;
31using System.Collections.Generic; 32using System.Collections.Generic;
32using System.Net; 33using System.Net;
33using System.IO; 34using System.IO;
@@ -35,6 +36,7 @@ using System.Text;
35using OpenMetaverse; 36using OpenMetaverse;
36using OpenMetaverse.StructuredData; 37using OpenMetaverse.StructuredData;
37using OpenSim.Framework; 38using OpenSim.Framework;
39using log4net;
38 40
39namespace OpenSim.Grid.AssetInventoryServer.Plugins.Simple 41namespace OpenSim.Grid.AssetInventoryServer.Plugins.Simple
40{ 42{
@@ -43,6 +45,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.Simple
43 const string EXTENSION_NAME = "SimpleInventoryStorage"; // Used for metrics reporting 45 const string EXTENSION_NAME = "SimpleInventoryStorage"; // Used for metrics reporting
44 const string DEFAULT_INVENTORY_DIR = "SimpleInventory"; 46 const string DEFAULT_INVENTORY_DIR = "SimpleInventory";
45 47
48 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
46 AssetInventoryServer server; 49 AssetInventoryServer server;
47 Dictionary<Uri, InventoryCollection> inventories = new Dictionary<Uri, InventoryCollection>(); 50 Dictionary<Uri, InventoryCollection> inventories = new Dictionary<Uri, InventoryCollection>();
48 Dictionary<Uri, List<InventoryItem>> activeGestures = new Dictionary<Uri, List<InventoryItem>>(); 51 Dictionary<Uri, List<InventoryItem>> activeGestures = new Dictionary<Uri, List<InventoryItem>>();
@@ -209,7 +212,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.Simple
209 } 212 }
210 catch (Exception ex) 213 catch (Exception ex)
211 { 214 {
212 Logger.Log.Error(ex.Message); 215 m_log.Error(ex.Message);
213 ret = BackendResponse.Failure; 216 ret = BackendResponse.Failure;
214 } 217 }
215 } 218 }
@@ -251,7 +254,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.Simple
251 } 254 }
252 catch (Exception ex) 255 catch (Exception ex)
253 { 256 {
254 Logger.Log.Error(ex.Message); 257 m_log.Error(ex.Message);
255 ret = BackendResponse.Failure; 258 ret = BackendResponse.Failure;
256 } 259 }
257 } 260 }
@@ -305,7 +308,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.Simple
305 } 308 }
306 catch (Exception ex) 309 catch (Exception ex)
307 { 310 {
308 Logger.Log.Error(ex.Message); 311 m_log.Error(ex.Message);
309 ret = BackendResponse.Failure; 312 ret = BackendResponse.Failure;
310 } 313 }
311 } 314 }
@@ -353,7 +356,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.Simple
353 foreach (string match in matches) 356 foreach (string match in matches)
354 { 357 {
355 try { File.Delete(match); } 358 try { File.Delete(match); }
356 catch (Exception ex) { Logger.Log.ErrorFormat("Failed to delete file {0}: {1}", match, ex.Message); } 359 catch (Exception ex) { m_log.ErrorFormat("Failed to delete file {0}: {1}", match, ex.Message); }
357 } 360 }
358 361
359 ret = BackendResponse.Success; 362 ret = BackendResponse.Success;
@@ -390,7 +393,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.Simple
390 foreach (string match in matches) 393 foreach (string match in matches)
391 { 394 {
392 try { File.Delete(match); } 395 try { File.Delete(match); }
393 catch (Exception ex) { Logger.Log.ErrorFormat("Failed to delete folder file {0}: {1}", match, ex.Message); } 396 catch (Exception ex) { m_log.ErrorFormat("Failed to delete folder file {0}: {1}", match, ex.Message); }
394 } 397 }
395 398
396 ret = BackendResponse.Success; 399 ret = BackendResponse.Success;
@@ -501,7 +504,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.Simple
501 try { Directory.CreateDirectory(folder); } 504 try { Directory.CreateDirectory(folder); }
502 catch (Exception ex) 505 catch (Exception ex)
503 { 506 {
504 Logger.Log.Warn(ex.Message); 507 m_log.Warn(ex.Message);
505 return; 508 return;
506 } 509 }
507 } 510 }
@@ -525,7 +528,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.Simple
525 } 528 }
526 catch (Exception ex) 529 catch (Exception ex)
527 { 530 {
528 Logger.Log.WarnFormat("Failed loading the index file {0}: {1}", indexPath, ex.Message); 531 m_log.WarnFormat("Failed loading the index file {0}: {1}", indexPath, ex.Message);
529 } 532 }
530 533
531 if (ownerID != UUID.Zero && owner != null) 534 if (ownerID != UUID.Zero && owner != null)
@@ -581,7 +584,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.Simple
581 } 584 }
582 catch (Exception ex) 585 catch (Exception ex)
583 { 586 {
584 Logger.Log.ErrorFormat("Failed loading inventory from {0}: {1}", folder, ex.Message); 587 m_log.ErrorFormat("Failed loading inventory from {0}: {1}", folder, ex.Message);
585 } 588 }
586 } 589 }
587 590
@@ -593,7 +596,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.Simple
593 596
594 LoadFiles(DEFAULT_INVENTORY_DIR); 597 LoadFiles(DEFAULT_INVENTORY_DIR);
595 598
596 Logger.Log.InfoFormat("Initialized the inventory index with data for {0} avatars", 599 m_log.InfoFormat("Initialized the inventory index with data for {0} avatars",
597 inventories.Count); 600 inventories.Count);
598 } 601 }
599 602
@@ -602,7 +605,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.Simple
602 /// </summary> 605 /// </summary>
603 public void Initialise() 606 public void Initialise()
604 { 607 {
605 Logger.Log.InfoFormat("[ASSET]: {0} cannot be default-initialized!", Name); 608 m_log.InfoFormat("[ASSET]: {0} cannot be default-initialized!", Name);
606 throw new PluginNotInitialisedException(Name); 609 throw new PluginNotInitialisedException(Name);
607 } 610 }
608 611
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 @@
1;[Config] 1[Config]
2 2
3; The port number for the asset server to listen on. 3; The port number for the asset server to listen on.
4listen_port = 8003 4listen_port = 8003
5 5
6;[Extensions] 6[Plugins]
7 7
8;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 8;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
9; Asset Storage Provider 9; Asset Storage Provider
@@ -31,7 +31,7 @@ asset_storage_provider = OpenSimAssetStorage
31; illustrating an inventory backend example. The inventory is stored in 31; illustrating an inventory backend example. The inventory is stored in
32; SimpleInventory/ by creating a folder for each agent that contains all of the 32; SimpleInventory/ by creating a folder for each agent that contains all of the
33; inventory items and folders serialized as XML files. 33; inventory items and folders serialized as XML files.
34;inventory_asset_provider = SimpleInventoryStorage 34;inventory_storage_provider = SimpleInventoryStorage
35 35
36; OpenSimMySQL inventory connects to a MySQL server that has an inventory table 36; OpenSimMySQL inventory connects to a MySQL server that has an inventory table
37; created by OpenSim. If the OpenSimMySQLStorage backend is also being used, the 37; created by OpenSim. If the OpenSimMySQLStorage backend is also being used, the
@@ -40,7 +40,7 @@ asset_storage_provider = OpenSimAssetStorage
40; database. This backend combined with the OpenSimInventoryFrontend will allow 40; database. This backend combined with the OpenSimInventoryFrontend will allow
41; the server to be used as a drop-in replacement for 41; the server to be used as a drop-in replacement for
42; OpenSim.Grid.InventoryServer.exe, while also allowing other frontends to run. 42; OpenSim.Grid.InventoryServer.exe, while also allowing other frontends to run.
43inventory_asset_provider = OpenSimInventoryStorage 43inventory_storage_provider = OpenSimInventoryStorage
44 44
45;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 45;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
46; Authentication Provider 46; Authentication Provider
@@ -56,7 +56,7 @@ authentication_provider = NullAuthentication
56; Authorize all is a dummy authorization module that allows all requests for 56; Authorize all is a dummy authorization module that allows all requests for
57; metadata, data, and asset creation. Use this extension if your primary 57; metadata, data, and asset creation. Use this extension if your primary
58; storage provider or front-end interface does not support authentication. 58; storage provider or front-end interface does not support authentication.
59authroization_provider = AuthorizeAll 59authorization_provider = AuthorizeAll
60 60
61;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 61;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
62; Metrics Provider 62; Metrics Provider
@@ -95,7 +95,19 @@ metrics_provider = NullMetrics
95 95
96frontends = ReferenceFrontend,OpenSimAssetFrontend,OpenSimInventoryFrontend,BrowseFrontend 96frontends = ReferenceFrontend,OpenSimAssetFrontend,OpenSimInventoryFrontend,BrowseFrontend
97 97
98;[MySQL] 98; The OpenSim section applies to the OpenSim plugin (OpenSimAssetStorage,
99; OpenSimInventoryStorage, OpenSimAssetFronend, OpenSimInventoryFrontend).
100[OpenSim]
101
102; The database provider determines which database to use. Any database backend
103; supported by OpenSim is supported.
104;asset_database_provider = "OpenSim.Data.SQLite.dll"
105asset_database_provider = "OpenSim.Data.MySQL.dll"
106;asset_database_provider = "OpenSim.Data.NHibernate.dll"
107
108;inventory_database_provider = "OpenSim.Data.SQLite.dll"
109inventory_database_provider = "OpenSim.Data.MySQL.dll"
110;inventory_database_provider = "OpenSim.Data.NHibernate.dll"
99 111
100; Database connection string used by the OpenSim MySQL backend. If these lines 112; Database connection string used by the OpenSim MySQL backend. If these lines
101; are commented out or missing, the server will look for an 113; are commented out or missing, the server will look for an
@@ -103,5 +115,15 @@ frontends = ReferenceFrontend,OpenSimAssetFrontend,OpenSimInventoryFrontend,Brow
103; working directory. These files are generated by OpenSim.Grid.AssetServer.exe 115; working directory. These files are generated by OpenSim.Grid.AssetServer.exe
104; and OpenSim.Grid.InventoryServer.exe, respectively, and can be used without 116; and OpenSim.Grid.InventoryServer.exe, respectively, and can be used without
105; modification. 117; modification.
118
119; For SQLite
120;asset_database_connect = "URI:file:Asset.db,version=3"
121;inventory_database_connect = "URI:file:Inventory.db,version=3"
122
123; For MySQL
106asset_database_connect = "Server=localhost; Database=opensim; User=changeme; Password=changeme;" 124asset_database_connect = "Server=localhost; Database=opensim; User=changeme; Password=changeme;"
107inventory_database_connect = "Server=localhost; Database=opensim; User=changeme; Password=changeme;" 125inventory_database_connect = "Server=localhost; Database=opensim; User=changeme; Password=changeme;"
126
127; For NHibernate
128;asset_database_connect = "SQLiteDialect;SQLite20Driver;Data Source=file:Asset.db;Version=3"
129;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 @@
1<?xml version="1.0" encoding="utf-8" ?>
2<configuration>
3 <configSections>
4 <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" />
5 </configSections>
6 <appSettings>
7 </appSettings>
8 <log4net>
9 <appender name="Console" type="OpenSim.Framework.Console.OpenSimAppender, OpenSim.Framework.Console">
10 <layout type="log4net.Layout.PatternLayout">
11 <conversionPattern value="%date{HH:mm:ss} - %message%newline" />
12 </layout>
13 </appender>
14 <appender name="LogFileAppender" type="log4net.Appender.FileAppender">
15 <file value="OpenSim.Grid.AssetInventoryServer.log" />
16 <appendToFile value="true" />
17 <layout type="log4net.Layout.PatternLayout">
18 <conversionPattern value="%date %-5level - %logger %message%newline" />
19 </layout>
20 </appender>
21
22 <!-- if you'd like to know what NHibernate is doing more set value="DEBUG" -->
23 <logger name="NHibernate" additivity="false">
24 <level value="INFO"/>
25 <appender-ref ref="NHibernateFileLog"/>
26 </logger>
27
28 <root>
29 <level value="DEBUG" />
30 <appender-ref ref="Console" />
31 <appender-ref ref="LogFileAppender" />
32 </root>
33 </log4net>
34</configuration>
diff --git a/prebuild.xml b/prebuild.xml
index 75879d9..1e704c0 100644
--- a/prebuild.xml
+++ b/prebuild.xml
@@ -766,10 +766,11 @@
766 <Reference name="OpenSim.Framework"/> 766 <Reference name="OpenSim.Framework"/>
767 <Reference name="OpenSim.Framework.Console"/> 767 <Reference name="OpenSim.Framework.Console"/>
768 <Reference name="OpenSim.Framework.Servers"/> 768 <Reference name="OpenSim.Framework.Servers"/>
769 <Reference name="log4net2"/> 769 <Reference name="log4net"/>
770 <Reference name="OpenMetaverseTypes"/> 770 <Reference name="OpenMetaverseTypes"/>
771 <Reference name="OpenMetaverse.StructuredData2"/> 771 <Reference name="OpenMetaverse.StructuredData2"/>
772 <Reference name="HttpServer"/> 772 <Reference name="HttpServer"/>
773 <Reference name="Nini.dll" />
773 774
774 <!-- for Simple Storage and MySQL storage --> 775 <!-- for Simple Storage and MySQL storage -->
775 <Reference name="System.Data"/> 776 <Reference name="System.Data"/>
@@ -805,6 +806,7 @@
805 <Reference name="OpenMetaverseTypes"/> 806 <Reference name="OpenMetaverseTypes"/>
806 <Reference name="OpenMetaverse.StructuredData2"/> 807 <Reference name="OpenMetaverse.StructuredData2"/>
807 <Reference name="HttpServer"/> 808 <Reference name="HttpServer"/>
809 <Reference name="log4net"/>
808 810
809 <Files> 811 <Files>
810 <Match pattern="*.cs" recurse="false" /> 812 <Match pattern="*.cs" recurse="false" />
@@ -834,6 +836,7 @@
834 <Reference name="OpenMetaverseTypes"/> 836 <Reference name="OpenMetaverseTypes"/>
835 <Reference name="OpenMetaverse.StructuredData2" /> 837 <Reference name="OpenMetaverse.StructuredData2" />
836 <Reference name="HttpServer"/> 838 <Reference name="HttpServer"/>
839 <Reference name="log4net"/>
837 840
838 <!-- Remove these eventually --> 841 <!-- Remove these eventually -->
839 <Reference name="MySql.Data" /> 842 <Reference name="MySql.Data" />
@@ -866,6 +869,8 @@
866 <Reference name="OpenMetaverseTypes"/> 869 <Reference name="OpenMetaverseTypes"/>
867 <Reference name="OpenMetaverse.StructuredData2" /> 870 <Reference name="OpenMetaverse.StructuredData2" />
868 <Reference name="HttpServer"/> 871 <Reference name="HttpServer"/>
872 <Reference name="Nini.dll" />
873 <Reference name="log4net"/>
869 874
870 <!-- Remove these eventually --> 875 <!-- Remove these eventually -->
871 <Reference name="MySql.Data" /> 876 <Reference name="MySql.Data" />