aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorAdam Frisby2007-05-28 22:20:25 +0000
committerAdam Frisby2007-05-28 22:20:25 +0000
commit54cf59ca438fe72eba6b6304f3fc4cf09ec80941 (patch)
tree86fb196021feddefda169602e49757a31ecb2f34
parentZomg wtf bbq logdata! (diff)
downloadopensim-SC_OLD-54cf59ca438fe72eba6b6304f3fc4cf09ec80941.zip
opensim-SC_OLD-54cf59ca438fe72eba6b6304f3fc4cf09ec80941.tar.gz
opensim-SC_OLD-54cf59ca438fe72eba6b6304f3fc4cf09ec80941.tar.bz2
opensim-SC_OLD-54cf59ca438fe72eba6b6304f3fc4cf09ec80941.tar.xz
Please to be testing new logdata interfaces!
-rw-r--r--OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLLogData.cs5
-rw-r--r--OpenGridServices/OpenGrid.Framework.Data/ILogData.cs22
-rw-r--r--OpenGridServices/OpenGridServices.GridServer/GridManager.cs54
3 files changed, 78 insertions, 3 deletions
diff --git a/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLLogData.cs b/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLLogData.cs
index f1610ec..8fff793 100644
--- a/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLLogData.cs
+++ b/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLLogData.cs
@@ -31,6 +31,11 @@ namespace OpenGrid.Framework.Data.MySQL
31 return "MySQL Logdata Interface"; 31 return "MySQL Logdata Interface";
32 } 32 }
33 33
34 public void Close()
35 {
36 // Do nothing.
37 }
38
34 public string getVersion() 39 public string getVersion()
35 { 40 {
36 return "0.1"; 41 return "0.1";
diff --git a/OpenGridServices/OpenGrid.Framework.Data/ILogData.cs b/OpenGridServices/OpenGrid.Framework.Data/ILogData.cs
index 27b40cb..7c6a2c5 100644
--- a/OpenGridServices/OpenGrid.Framework.Data/ILogData.cs
+++ b/OpenGridServices/OpenGrid.Framework.Data/ILogData.cs
@@ -16,5 +16,27 @@ namespace OpenGrid.Framework.Data
16 public interface ILogData 16 public interface ILogData
17 { 17 {
18 void saveLog(string serverDaemon, string target, string methodCall, string arguments, int priority,string logMessage); 18 void saveLog(string serverDaemon, string target, string methodCall, string arguments, int priority,string logMessage);
19 /// <summary>
20 /// Initialises the interface
21 /// </summary>
22 void Initialise();
23
24 /// <summary>
25 /// Closes the interface
26 /// </summary>
27 void Close();
28
29 /// <summary>
30 /// The plugin being loaded
31 /// </summary>
32 /// <returns>A string containing the plugin name</returns>
33 string getName();
34
35 /// <summary>
36 /// The plugins version
37 /// </summary>
38 /// <returns>A string containing the plugin version</returns>
39 string getVersion();
19 } 40 }
41
20} 42}
diff --git a/OpenGridServices/OpenGridServices.GridServer/GridManager.cs b/OpenGridServices/OpenGridServices.GridServer/GridManager.cs
index 54e4bb7..b73f24d 100644
--- a/OpenGridServices/OpenGridServices.GridServer/GridManager.cs
+++ b/OpenGridServices/OpenGridServices.GridServer/GridManager.cs
@@ -16,6 +16,8 @@ namespace OpenGridServices.GridServer
16 class GridManager 16 class GridManager
17 { 17 {
18 Dictionary<string, IGridData> _plugins = new Dictionary<string, IGridData>(); 18 Dictionary<string, IGridData> _plugins = new Dictionary<string, IGridData>();
19 Dictionary<string, ILogData> _logplugins = new Dictionary<string, ILogData>();
20
19 public OpenSim.Framework.Interfaces.GridConfig config; 21 public OpenSim.Framework.Interfaces.GridConfig config;
20 22
21 /// <summary> 23 /// <summary>
@@ -32,6 +34,7 @@ namespace OpenGridServices.GridServer
32 { 34 {
33 if (!pluginType.IsAbstract) 35 if (!pluginType.IsAbstract)
34 { 36 {
37 // Regions go here
35 Type typeInterface = pluginType.GetInterface("IGridData", true); 38 Type typeInterface = pluginType.GetInterface("IGridData", true);
36 39
37 if (typeInterface != null) 40 if (typeInterface != null)
@@ -43,12 +46,48 @@ namespace OpenGridServices.GridServer
43 } 46 }
44 47
45 typeInterface = null; 48 typeInterface = null;
49
50 // Logs go here
51 typeInterface = pluginType.GetInterface("ILogData", true);
52
53 if (typeInterface != null)
54 {
55 ILogData plug = (ILogData)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
56 plug.Initialise();
57 this._logplugins.Add(plug.getName(), plug);
58 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Storage: Added ILogData Interface");
59 }
60
61 typeInterface = null;
46 } 62 }
47 } 63 }
48 64
49 pluginAssembly = null; 65 pluginAssembly = null;
50 } 66 }
51 67
68 /// <summary>
69 /// Logs a piece of information to the database
70 /// </summary>
71 /// <param name="target">What you were operating on (in grid server, this will likely be the region UUIDs)</param>
72 /// <param name="method">Which method is being called?</param>
73 /// <param name="args">What arguments are being passed?</param>
74 /// <param name="priority">How high priority is this? 1 = Max, 6 = Verbose</param>
75 /// <param name="message">The message to log</param>
76 private void logToDB(string target, string method, string args, int priority, string message)
77 {
78 foreach (KeyValuePair<string, ILogData> kvp in _logplugins)
79 {
80 try
81 {
82 kvp.Value.saveLog("Gridserver", target, method, args, priority, message);
83 }
84 catch (Exception e)
85 {
86 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.NORMAL, "Storage: unable to write log via " + kvp.Key);
87 }
88 }
89 }
90
52 /// <summary> 91 /// <summary>
53 /// Returns a region by argument 92 /// Returns a region by argument
54 /// </summary> 93 /// </summary>
@@ -160,15 +199,23 @@ namespace OpenGridServices.GridServer
160 if (requestData.ContainsKey("UUID")) 199 if (requestData.ContainsKey("UUID"))
161 { 200 {
162 TheSim = getRegion(new LLUUID((string)requestData["UUID"])); 201 TheSim = getRegion(new LLUUID((string)requestData["UUID"]));
202 logToDB((new LLUUID((string)requestData["UUID"])).ToStringHyphenated(),"XmlRpcLoginToSimulatorMethod","", 5,"Region attempting login with UUID.");
163 } 203 }
164 else if (requestData.ContainsKey("region_handle")) 204 else if (requestData.ContainsKey("region_handle"))
165 { 205 {
166 TheSim = getRegion((ulong)Convert.ToUInt64(requestData["region_handle"])); 206 TheSim = getRegion((ulong)Convert.ToUInt64(requestData["region_handle"]));
207 logToDB((string)requestData["region_handle"], "XmlRpcLoginToSimulatorMethod", "", 5, "Region attempting login with regionHandle.");
208 }
209 else
210 {
211 responseData["error"] = "No UUID or region_handle passed to grid server - unable to connect you";
212 return response;
167 } 213 }
168 214
169 if (TheSim == null) 215 if (TheSim == null)
170 { 216 {
171 responseData["error"] = "sim not found"; 217 responseData["error"] = "sim not found";
218 return response;
172 } 219 }
173 else 220 else
174 { 221 {
@@ -366,7 +413,7 @@ namespace OpenGridServices.GridServer
366 /// <returns>"OK" or an error</returns> 413 /// <returns>"OK" or an error</returns>
367 public string RestSetSimMethod(string request, string path, string param) 414 public string RestSetSimMethod(string request, string path, string param)
368 { 415 {
369 Console.WriteLine("SimProfiles.cs:RestSetSimMethod() - processing request......"); 416 Console.WriteLine("Processing region update");
370 SimProfileData TheSim; 417 SimProfileData TheSim;
371 TheSim = getRegion(new LLUUID(param)); 418 TheSim = getRegion(new LLUUID(param));
372 if ((TheSim) == null) 419 if ((TheSim) == null)
@@ -449,13 +496,14 @@ namespace OpenGridServices.GridServer
449 496
450 try 497 try
451 { 498 {
452 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Attempting to add a new region to the grid - " + _plugins.Count + " storage provider(s) registered."); 499 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Updating / adding via " + _plugins.Count + " storage provider(s) registered.");
453 foreach (KeyValuePair<string, IGridData> kvp in _plugins) 500 foreach (KeyValuePair<string, IGridData> kvp in _plugins)
454 { 501 {
455 try 502 try
456 { 503 {
457 kvp.Value.AddProfile(TheSim); 504 kvp.Value.AddProfile(TheSim);
458 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"New sim added to grid (" + TheSim.regionName + ")"); 505 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"New sim added to grid (" + TheSim.regionName + ")");
506 logToDB(TheSim.UUID.ToStringHyphenated(), "RestSetSimMethod", "", 5, "Region successfully updated and connected to grid.");
459 } 507 }
460 catch (Exception e) 508 catch (Exception e)
461 { 509 {