aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/MySQL/MySQLLogData.cs
diff options
context:
space:
mode:
authorDiva Canto2010-02-21 15:38:52 -0800
committerDiva Canto2010-02-21 15:38:52 -0800
commitbb171717ceaef37b022a135209c2e0bf031d21f9 (patch)
tree2239ad031280027839b22c4f3c9df1a598a63228 /OpenSim/Data/MySQL/MySQLLogData.cs
parentBug fixes on field names in order to make data import work from old users tab... (diff)
downloadopensim-SC_OLD-bb171717ceaef37b022a135209c2e0bf031d21f9.zip
opensim-SC_OLD-bb171717ceaef37b022a135209c2e0bf031d21f9.tar.gz
opensim-SC_OLD-bb171717ceaef37b022a135209c2e0bf031d21f9.tar.bz2
opensim-SC_OLD-bb171717ceaef37b022a135209c2e0bf031d21f9.tar.xz
Deleted obsolete files in the Data layer. Compiles.
Diffstat (limited to 'OpenSim/Data/MySQL/MySQLLogData.cs')
-rw-r--r--OpenSim/Data/MySQL/MySQLLogData.cs166
1 files changed, 0 insertions, 166 deletions
diff --git a/OpenSim/Data/MySQL/MySQLLogData.cs b/OpenSim/Data/MySQL/MySQLLogData.cs
deleted file mode 100644
index 304883c..0000000
--- a/OpenSim/Data/MySQL/MySQLLogData.cs
+++ /dev/null
@@ -1,166 +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 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 */
27using System;
28using System.Collections.Generic;
29using System.Reflection;
30using log4net;
31using OpenSim.Framework;
32
33namespace OpenSim.Data.MySQL
34{
35 /// <summary>
36 /// An interface to the log database for MySQL
37 /// </summary>
38 internal class MySQLLogData : ILogDataPlugin
39 {
40 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
41
42 /// <summary>
43 /// The database manager
44 /// </summary>
45 public MySQLManager database;
46
47 public void Initialise()
48 {
49 m_log.Info("[MySQLLogData]: " + Name + " cannot be default-initialized!");
50 throw new PluginNotInitialisedException (Name);
51 }
52
53 /// <summary>
54 /// Artificial constructor called when the plugin is loaded
55 /// Uses the obsolete mysql_connection.ini if connect string is empty.
56 /// </summary>
57 /// <param name="connect">connect string</param>
58 public void Initialise(string connect)
59 {
60 if (connect != String.Empty)
61 {
62 database = new MySQLManager(connect);
63 }
64 else
65 {
66 m_log.Warn("Using deprecated mysql_connection.ini. Please update database_connect in GridServer_Config.xml and we'll use that instead");
67
68 IniFile GridDataMySqlFile = new IniFile("mysql_connection.ini");
69 string settingHostname = GridDataMySqlFile.ParseFileReadValue("hostname");
70 string settingDatabase = GridDataMySqlFile.ParseFileReadValue("database");
71 string settingUsername = GridDataMySqlFile.ParseFileReadValue("username");
72 string settingPassword = GridDataMySqlFile.ParseFileReadValue("password");
73 string settingPooling = GridDataMySqlFile.ParseFileReadValue("pooling");
74 string settingPort = GridDataMySqlFile.ParseFileReadValue("port");
75
76 database = new MySQLManager(settingHostname, settingDatabase, settingUsername, settingPassword,
77 settingPooling, settingPort);
78 }
79
80 // This actually does the roll forward assembly stuff
81 Assembly assem = GetType().Assembly;
82
83 using (MySql.Data.MySqlClient.MySqlConnection dbcon = new MySql.Data.MySqlClient.MySqlConnection(connect))
84 {
85 dbcon.Open();
86
87 Migration m = new Migration(dbcon, assem, "LogStore");
88
89 // TODO: After rev 6000, remove this. People should have
90 // been rolled onto the new migration code by then.
91 TestTables(m);
92
93 m.Update();
94 }
95 }
96
97 /// <summary></summary>
98 /// <param name="m"></param>
99 private void TestTables(Migration m)
100 {
101 // under migrations, bail
102 if (m.Version > 0)
103 return;
104
105 Dictionary<string, string> tableList = new Dictionary<string, string>();
106 tableList["logs"] = null;
107 database.GetTableVersion(tableList);
108
109 // migrations will handle it
110 if (tableList["logs"] == null)
111 return;
112
113 // we have the table, so pretend like we did the first migration in the past
114 if (m.Version == 0)
115 m.Version = 1;
116 }
117
118 /// <summary>
119 /// Saves a log item to the database
120 /// </summary>
121 /// <param name="serverDaemon">The daemon triggering the event</param>
122 /// <param name="target">The target of the action (region / agent UUID, etc)</param>
123 /// <param name="methodCall">The method call where the problem occured</param>
124 /// <param name="arguments">The arguments passed to the method</param>
125 /// <param name="priority">How critical is this?</param>
126 /// <param name="logMessage">The message to log</param>
127 public void saveLog(string serverDaemon, string target, string methodCall, string arguments, int priority,
128 string logMessage)
129 {
130 try
131 {
132 database.insertLogRow(serverDaemon, target, methodCall, arguments, priority, logMessage);
133 }
134 catch
135 {
136 }
137 }
138
139 /// <summary>
140 /// Returns the name of this DB provider
141 /// </summary>
142 /// <returns>A string containing the DB provider name</returns>
143 public string Name
144 {
145 get { return "MySQL Logdata Interface";}
146 }
147
148 /// <summary>
149 /// Closes the database provider
150 /// </summary>
151 /// <remarks>do nothing</remarks>
152 public void Dispose()
153 {
154 // Do nothing.
155 }
156
157 /// <summary>
158 /// Returns the version of this DB provider
159 /// </summary>
160 /// <returns>A string containing the provider version</returns>
161 public string Version
162 {
163 get { return "0.1"; }
164 }
165 }
166}