aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r--OpenSim/Framework/AssemblyInfo.cs2
-rw-r--r--OpenSim/Framework/AssetLoader/Filesystem/Properties/AssemblyInfo.cs33
-rw-r--r--OpenSim/Framework/AvatarAppearance.cs3
-rw-r--r--OpenSim/Framework/ChildAgentDataUpdate.cs36
-rw-r--r--OpenSim/Framework/Client/IClientChat.cs7
-rw-r--r--OpenSim/Framework/Communications/Properties/AssemblyInfo.cs8
-rw-r--r--OpenSim/Framework/Configuration/HTTP/Properties/AssemblyInfo.cs33
-rw-r--r--OpenSim/Framework/Configuration/XML/Properties/AssemblyInfo.cs33
-rw-r--r--OpenSim/Framework/Console/AssemblyInfo.cs4
-rw-r--r--OpenSim/Framework/Console/CommandConsole.cs31
-rwxr-xr-xOpenSim/Framework/Console/ConsoleBase.cs10
-rw-r--r--OpenSim/Framework/Console/ConsoleUtil.cs246
-rw-r--r--OpenSim/Framework/Console/MockConsole.cs7
-rw-r--r--OpenSim/Framework/IClientAPI.cs16
-rw-r--r--OpenSim/Framework/ICommandConsole.cs5
-rw-r--r--OpenSim/Framework/IConsole.cs2
-rw-r--r--OpenSim/Framework/InventoryItemBase.cs22
-rw-r--r--OpenSim/Framework/Monitoring/Properties/AssemblyInfo.cs33
-rw-r--r--OpenSim/Framework/Monitoring/Stats/PercentageStat.cs88
-rw-r--r--OpenSim/Framework/Monitoring/Stats/Stat.cs238
-rw-r--r--OpenSim/Framework/Monitoring/StatsManager.cs150
-rw-r--r--OpenSim/Framework/Monitoring/Watchdog.cs4
-rw-r--r--OpenSim/Framework/Pool.cs15
-rw-r--r--OpenSim/Framework/RegionLoader/Filesystem/Properties/AssemblyInfo.cs33
-rw-r--r--OpenSim/Framework/RegionLoader/Web/Properties/AssemblyInfo.cs33
-rw-r--r--OpenSim/Framework/Serialization/ArchiveConstants.cs5
-rw-r--r--OpenSim/Framework/Serialization/Properties/AssemblyInfo.cs33
-rw-r--r--OpenSim/Framework/Serialization/Tests/LandDataSerializerTests.cs2
-rw-r--r--OpenSim/Framework/Serialization/Tests/RegionSettingsSerializerTests.cs2
-rw-r--r--OpenSim/Framework/Servers/BaseOpenSimServer.cs455
-rw-r--r--OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs72
-rw-r--r--OpenSim/Framework/Servers/HttpServer/Properties/AssemblyInfo.cs33
-rw-r--r--OpenSim/Framework/Servers/Properties/AssemblyInfo.cs33
-rw-r--r--OpenSim/Framework/Servers/ServerBase.cs677
-rw-r--r--OpenSim/Framework/Servers/Tests/OSHttpTests.cs3
-rw-r--r--OpenSim/Framework/Servers/Tests/VersionInfoTests.cs3
-rw-r--r--OpenSim/Framework/TaskInventoryDictionary.cs4
-rw-r--r--OpenSim/Framework/TaskInventoryItem.cs19
-rw-r--r--OpenSim/Framework/Tests/AgentCircuitDataTest.cs5
-rw-r--r--OpenSim/Framework/Tests/AnimationTests.cs2
-rw-r--r--OpenSim/Framework/Tests/AssetBaseTest.cs3
-rw-r--r--OpenSim/Framework/Tests/CacheTests.cs3
-rw-r--r--OpenSim/Framework/Tests/LocationTest.cs3
-rw-r--r--OpenSim/Framework/Tests/MundaneFrameworkTests.cs3
-rw-r--r--OpenSim/Framework/Tests/PrimeNumberHelperTests.cs3
-rw-r--r--OpenSim/Framework/Tests/UtilTest.cs2
-rw-r--r--OpenSim/Framework/Util.cs18
47 files changed, 1721 insertions, 754 deletions
diff --git a/OpenSim/Framework/AssemblyInfo.cs b/OpenSim/Framework/AssemblyInfo.cs
index adeaeb2..02986d5 100644
--- a/OpenSim/Framework/AssemblyInfo.cs
+++ b/OpenSim/Framework/AssemblyInfo.cs
@@ -59,5 +59,5 @@ using System.Runtime.InteropServices;
59// Revision 59// Revision
60// 60//
61 61
62[assembly : AssemblyVersion("0.6.5.*")] 62[assembly : AssemblyVersion("0.7.5.*")]
63[assembly : AssemblyFileVersion("0.6.5.0")] \ No newline at end of file 63[assembly : AssemblyFileVersion("0.6.5.0")] \ No newline at end of file
diff --git a/OpenSim/Framework/AssetLoader/Filesystem/Properties/AssemblyInfo.cs b/OpenSim/Framework/AssetLoader/Filesystem/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..0498ed4
--- /dev/null
+++ b/OpenSim/Framework/AssetLoader/Filesystem/Properties/AssemblyInfo.cs
@@ -0,0 +1,33 @@
1using System.Reflection;
2using System.Runtime.CompilerServices;
3using System.Runtime.InteropServices;
4
5// General Information about an assembly is controlled through the following
6// set of attributes. Change these attribute values to modify the information
7// associated with an assembly.
8[assembly: AssemblyTitle("OpenSim.Framework.AssetLoader.Filesystem")]
9[assembly: AssemblyDescription("")]
10[assembly: AssemblyConfiguration("")]
11[assembly: AssemblyCompany("http://opensimulator.org")]
12[assembly: AssemblyProduct("OpenSim")]
13[assembly: AssemblyCopyright("OpenSimulator developers")]
14[assembly: AssemblyTrademark("")]
15[assembly: AssemblyCulture("")]
16
17// Setting ComVisible to false makes the types in this assembly not visible
18// to COM components. If you need to access a type in this assembly from
19// COM, set the ComVisible attribute to true on that type.
20[assembly: ComVisible(false)]
21
22// The following GUID is for the ID of the typelib if this project is exposed to COM
23[assembly: Guid("8cb9cf69-4771-4d3a-a2ba-bac7230de326")]
24
25// Version information for an assembly consists of the following four values:
26//
27// Major Version
28// Minor Version
29// Build Number
30// Revision
31//
32[assembly: AssemblyVersion("0.7.5.*")]
33[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs
index 4f598b0..95e9667 100644
--- a/OpenSim/Framework/AvatarAppearance.cs
+++ b/OpenSim/Framework/AvatarAppearance.cs
@@ -330,6 +330,9 @@ namespace OpenSim.Framework
330 SetVisualParams(visualParams); 330 SetVisualParams(visualParams);
331 } 331 }
332 332
333 /// <summary>
334 /// Set avatar height by a calculation based on their visual parameters.
335 /// </summary>
333 public virtual void SetHeight() 336 public virtual void SetHeight()
334 { 337 {
335 // Start with shortest possible female avatar height 338 // Start with shortest possible female avatar height
diff --git a/OpenSim/Framework/ChildAgentDataUpdate.cs b/OpenSim/Framework/ChildAgentDataUpdate.cs
index 6d048f4..dfe60aa 100644
--- a/OpenSim/Framework/ChildAgentDataUpdate.cs
+++ b/OpenSim/Framework/ChildAgentDataUpdate.cs
@@ -306,6 +306,8 @@ namespace OpenSim.Framework
306 306
307 public AgentGroupData[] Groups; 307 public AgentGroupData[] Groups;
308 public Animation[] Anims; 308 public Animation[] Anims;
309 public Animation DefaultAnim = null;
310 public Animation AnimState = null;
309 311
310 public UUID GranterID; 312 public UUID GranterID;
311 313
@@ -390,6 +392,16 @@ namespace OpenSim.Framework
390 args["animations"] = anims; 392 args["animations"] = anims;
391 } 393 }
392 394
395 if (DefaultAnim != null)
396 {
397 args["default_animation"] = DefaultAnim.PackUpdateMessage();
398 }
399
400 if (AnimState != null)
401 {
402 args["animation_state"] = AnimState.PackUpdateMessage();
403 }
404
393 if (Appearance != null) 405 if (Appearance != null)
394 args["packed_appearance"] = Appearance.Pack(); 406 args["packed_appearance"] = Appearance.Pack();
395 407
@@ -583,6 +595,30 @@ namespace OpenSim.Framework
583 } 595 }
584 } 596 }
585 597
598 if (args["default_animation"] != null)
599 {
600 try
601 {
602 DefaultAnim = new Animation((OSDMap)args["default_animation"]);
603 }
604 catch
605 {
606 DefaultAnim = null;
607 }
608 }
609
610 if (args["animation_state"] != null)
611 {
612 try
613 {
614 AnimState = new Animation((OSDMap)args["animation_state"]);
615 }
616 catch
617 {
618 AnimState = null;
619 }
620 }
621
586 //if ((args["agent_textures"] != null) && (args["agent_textures"]).Type == OSDType.Array) 622 //if ((args["agent_textures"] != null) && (args["agent_textures"]).Type == OSDType.Array)
587 //{ 623 //{
588 // OSDArray textures = (OSDArray)(args["agent_textures"]); 624 // OSDArray textures = (OSDArray)(args["agent_textures"]);
diff --git a/OpenSim/Framework/Client/IClientChat.cs b/OpenSim/Framework/Client/IClientChat.cs
index 078ea9b..86b1faa 100644
--- a/OpenSim/Framework/Client/IClientChat.cs
+++ b/OpenSim/Framework/Client/IClientChat.cs
@@ -33,7 +33,8 @@ namespace OpenSim.Framework.Client
33 { 33 {
34 event ChatMessage OnChatFromClient; 34 event ChatMessage OnChatFromClient;
35 35
36 void SendChatMessage(string message, byte type, Vector3 fromPos, string fromName, UUID fromAgentID, byte source, 36 void SendChatMessage(
37 byte audible); 37 string message, byte type, Vector3 fromPos, string fromName, UUID fromAgentID, UUID ownerID, byte source,
38 byte audible);
38 } 39 }
39} 40} \ No newline at end of file
diff --git a/OpenSim/Framework/Communications/Properties/AssemblyInfo.cs b/OpenSim/Framework/Communications/Properties/AssemblyInfo.cs
index 2df6ace..6d1c03a 100644
--- a/OpenSim/Framework/Communications/Properties/AssemblyInfo.cs
+++ b/OpenSim/Framework/Communications/Properties/AssemblyInfo.cs
@@ -32,12 +32,12 @@ using System.Runtime.InteropServices;
32// set of attributes. Change these attribute values to modify the information 32// set of attributes. Change these attribute values to modify the information
33// associated with an assembly. 33// associated with an assembly.
34 34
35[assembly : AssemblyTitle("OpenGrid.Framework.Communications")] 35[assembly : AssemblyTitle("OpenSim.Framework.Communications")]
36[assembly : AssemblyDescription("")] 36[assembly : AssemblyDescription("")]
37[assembly : AssemblyConfiguration("")] 37[assembly : AssemblyConfiguration("")]
38[assembly : AssemblyCompany("http://opensimulator.org")] 38[assembly : AssemblyCompany("http://opensimulator.org")]
39[assembly : AssemblyProduct("OpenGrid.Framework.Communications")] 39[assembly : AssemblyProduct("OpenSim")]
40[assembly : AssemblyCopyright("Copyright (c) OpenSimulator.org Developers 2007-2009")] 40[assembly : AssemblyCopyright("Copyright (c) OpenSimulator.org Developers")]
41[assembly : AssemblyTrademark("")] 41[assembly : AssemblyTrademark("")]
42[assembly : AssemblyCulture("")] 42[assembly : AssemblyCulture("")]
43 43
@@ -61,5 +61,5 @@ using System.Runtime.InteropServices;
61// You can specify all the values or you can default the Revision and Build Numbers 61// You can specify all the values or you can default the Revision and Build Numbers
62// by using the '*' as shown below: 62// by using the '*' as shown below:
63 63
64[assembly : AssemblyVersion("0.6.5.*")] 64[assembly : AssemblyVersion("0.7.5.*")]
65[assembly : AssemblyFileVersion("0.6.5.0")] 65[assembly : AssemblyFileVersion("0.6.5.0")]
diff --git a/OpenSim/Framework/Configuration/HTTP/Properties/AssemblyInfo.cs b/OpenSim/Framework/Configuration/HTTP/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..0674656
--- /dev/null
+++ b/OpenSim/Framework/Configuration/HTTP/Properties/AssemblyInfo.cs
@@ -0,0 +1,33 @@
1using System.Reflection;
2using System.Runtime.CompilerServices;
3using System.Runtime.InteropServices;
4
5// General Information about an assembly is controlled through the following
6// set of attributes. Change these attribute values to modify the information
7// associated with an assembly.
8[assembly: AssemblyTitle("OpenSim.Framework.Configuration.HTTP")]
9[assembly: AssemblyDescription("")]
10[assembly: AssemblyConfiguration("")]
11[assembly: AssemblyCompany("http://opensimulator.org")]
12[assembly: AssemblyProduct("OpenSim")]
13[assembly: AssemblyCopyright("OpenSimulator develoeprs")]
14[assembly: AssemblyTrademark("")]
15[assembly: AssemblyCulture("")]
16
17// Setting ComVisible to false makes the types in this assembly not visible
18// to COM components. If you need to access a type in this assembly from
19// COM, set the ComVisible attribute to true on that type.
20[assembly: ComVisible(false)]
21
22// The following GUID is for the ID of the typelib if this project is exposed to COM
23[assembly: Guid("cb78b672-d000-4f93-88f9-dae151cc0061")]
24
25// Version information for an assembly consists of the following four values:
26//
27// Major Version
28// Minor Version
29// Build Number
30// Revision
31//
32[assembly: AssemblyVersion("0.7.5.*")]
33[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/OpenSim/Framework/Configuration/XML/Properties/AssemblyInfo.cs b/OpenSim/Framework/Configuration/XML/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..1095b23
--- /dev/null
+++ b/OpenSim/Framework/Configuration/XML/Properties/AssemblyInfo.cs
@@ -0,0 +1,33 @@
1using System.Reflection;
2using System.Runtime.CompilerServices;
3using System.Runtime.InteropServices;
4
5// General Information about an assembly is controlled through the following
6// set of attributes. Change these attribute values to modify the information
7// associated with an assembly.
8[assembly: AssemblyTitle("OpenSim.Framework.Configuration.XML")]
9[assembly: AssemblyDescription("")]
10[assembly: AssemblyConfiguration("")]
11[assembly: AssemblyCompany("http://opensimulator.org")]
12[assembly: AssemblyProduct("OpenSim")]
13[assembly: AssemblyCopyright("OpenSimulator developers")]
14[assembly: AssemblyTrademark("")]
15[assembly: AssemblyCulture("")]
16
17// Setting ComVisible to false makes the types in this assembly not visible
18// to COM components. If you need to access a type in this assembly from
19// COM, set the ComVisible attribute to true on that type.
20[assembly: ComVisible(false)]
21
22// The following GUID is for the ID of the typelib if this project is exposed to COM
23[assembly: Guid("eeb880df-0112-4c3d-87ed-b2108d614c55")]
24
25// Version information for an assembly consists of the following four values:
26//
27// Major Version
28// Minor Version
29// Build Number
30// Revision
31//
32[assembly: AssemblyVersion("0.7.5.*")]
33[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/OpenSim/Framework/Console/AssemblyInfo.cs b/OpenSim/Framework/Console/AssemblyInfo.cs
index 75e35bf..37c7304 100644
--- a/OpenSim/Framework/Console/AssemblyInfo.cs
+++ b/OpenSim/Framework/Console/AssemblyInfo.cs
@@ -39,7 +39,7 @@ using System.Runtime.InteropServices;
39[assembly: AssemblyConfiguration("")] 39[assembly: AssemblyConfiguration("")]
40[assembly: AssemblyCompany("http://opensimulator.org")] 40[assembly: AssemblyCompany("http://opensimulator.org")]
41[assembly : AssemblyProduct("ServerConsole")] 41[assembly : AssemblyProduct("ServerConsole")]
42[assembly: AssemblyCopyright("Copyright (c) OpenSimulator.org Developers 2007-2009")] 42[assembly: AssemblyCopyright("Copyright (c) OpenSimulator.org Developers")]
43[assembly: AssemblyTrademark("")] 43[assembly: AssemblyTrademark("")]
44[assembly: AssemblyCulture("")] 44[assembly: AssemblyCulture("")]
45 45
@@ -55,4 +55,4 @@ using System.Runtime.InteropServices;
55// You can specify all values by your own or you can build default build and revision 55// You can specify all values by your own or you can build default build and revision
56// numbers with the '*' character (the default): 56// numbers with the '*' character (the default):
57 57
58[assembly : AssemblyVersion("0.6.5.*")] 58[assembly : AssemblyVersion("0.7.5.*")]
diff --git a/OpenSim/Framework/Console/CommandConsole.cs b/OpenSim/Framework/Console/CommandConsole.cs
index bd23d1c..de30414 100644
--- a/OpenSim/Framework/Console/CommandConsole.cs
+++ b/OpenSim/Framework/Console/CommandConsole.cs
@@ -83,7 +83,8 @@ namespace OpenSim.Framework.Console
83 = "To enter an argument that contains spaces, surround the argument with double quotes.\nFor example, show object name \"My long object name\"\n"; 83 = "To enter an argument that contains spaces, surround the argument with double quotes.\nFor example, show object name \"My long object name\"\n";
84 84
85 public const string ItemHelpText 85 public const string ItemHelpText
86 = "For more information, type 'help <item>' where <item> is one of the following:"; 86= @"For more information, type 'help all' to get a list of all commands,
87 or type help <item>' where <item> is one of the following:";
87 88
88 /// <value> 89 /// <value>
89 /// Commands organized by keyword in a tree 90 /// Commands organized by keyword in a tree
@@ -117,6 +118,10 @@ namespace OpenSim.Framework.Console
117 help.Add(ItemHelpText); 118 help.Add(ItemHelpText);
118 help.AddRange(CollectModulesHelp(tree)); 119 help.AddRange(CollectModulesHelp(tree));
119 } 120 }
121 else if (helpParts.Count == 1 && helpParts[0] == "all")
122 {
123 help.AddRange(CollectAllCommandsHelp());
124 }
120 else 125 else
121 { 126 {
122 help.AddRange(CollectHelp(helpParts)); 127 help.AddRange(CollectHelp(helpParts));
@@ -124,6 +129,28 @@ namespace OpenSim.Framework.Console
124 129
125 return help; 130 return help;
126 } 131 }
132
133 /// <summary>
134 /// Collects the help from all commands and return in alphabetical order.
135 /// </summary>
136 /// <returns></returns>
137 private List<string> CollectAllCommandsHelp()
138 {
139 List<string> help = new List<string>();
140
141 lock (m_modulesCommands)
142 {
143 foreach (List<CommandInfo> commands in m_modulesCommands.Values)
144 {
145 var ourHelpText = commands.ConvertAll(c => string.Format("{0} - {1}", c.help_text, c.long_help));
146 help.AddRange(ourHelpText);
147 }
148 }
149
150 help.Sort();
151
152 return help;
153 }
127 154
128 /// <summary> 155 /// <summary>
129 /// See if we can find the requested command in order to display longer help 156 /// See if we can find the requested command in order to display longer help
@@ -711,7 +738,7 @@ namespace OpenSim.Framework.Console
711 /// </summary> 738 /// </summary>
712 public void Prompt() 739 public void Prompt()
713 { 740 {
714 string line = ReadLine(m_defaultPrompt + "# ", true, true); 741 string line = ReadLine(DefaultPrompt + "# ", true, true);
715 742
716 if (line != String.Empty) 743 if (line != String.Empty)
717 Output("Invalid command"); 744 Output("Invalid command");
diff --git a/OpenSim/Framework/Console/ConsoleBase.cs b/OpenSim/Framework/Console/ConsoleBase.cs
index 4b375d9..2d8e723 100755
--- a/OpenSim/Framework/Console/ConsoleBase.cs
+++ b/OpenSim/Framework/Console/ConsoleBase.cs
@@ -43,15 +43,7 @@ namespace OpenSim.Framework.Console
43 43
44 public object ConsoleScene { get; set; } 44 public object ConsoleScene { get; set; }
45 45
46 /// <summary> 46 public string DefaultPrompt { get; set; }
47 /// The default prompt text.
48 /// </summary>
49 public string DefaultPrompt
50 {
51 set { m_defaultPrompt = value; }
52 get { return m_defaultPrompt; }
53 }
54 protected string m_defaultPrompt;
55 47
56 public ConsoleBase(string defaultPrompt) 48 public ConsoleBase(string defaultPrompt)
57 { 49 {
diff --git a/OpenSim/Framework/Console/ConsoleUtil.cs b/OpenSim/Framework/Console/ConsoleUtil.cs
index a7cf0c0..16a63e0 100644
--- a/OpenSim/Framework/Console/ConsoleUtil.cs
+++ b/OpenSim/Framework/Console/ConsoleUtil.cs
@@ -27,88 +27,202 @@
27 27
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.IO;
30using System.Linq; 31using System.Linq;
31using System.Reflection; 32using System.Reflection;
32using log4net; 33using log4net;
33using OpenMetaverse; 34using OpenMetaverse;
34 35
35public class ConsoleUtil 36namespace OpenSim.Framework.Console
36{ 37{
37// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 38 public class ConsoleUtil
38
39 public const string MinRawConsoleVectorValue = "-~";
40 public const string MaxRawConsoleVectorValue = "~";
41
42 public const string VectorSeparator = ",";
43 public static char[] VectorSeparatorChars = VectorSeparator.ToCharArray();
44
45 /// <summary>
46 /// Convert a minimum vector input from the console to an OpenMetaverse.Vector3
47 /// </summary>
48 /// <param name='rawConsoleVector'>/param>
49 /// <param name='vector'></param>
50 /// <returns></returns>
51 public static bool TryParseConsoleMinVector(string rawConsoleVector, out Vector3 vector)
52 { 39 {
53 return TryParseConsoleVector(rawConsoleVector, c => float.MinValue.ToString(), out vector); 40 // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
54 }
55 41
56 /// <summary> 42 public const int LocalIdNotFound = 0;
57 /// Convert a maximum vector input from the console to an OpenMetaverse.Vector3 43
58 /// </summary> 44 /// <summary>
59 /// <param name='rawConsoleVector'>/param> 45 /// Used by modules to display stock co-ordinate help, though possibly this should be under some general section
60 /// <param name='vector'></param> 46 /// rather than in each help summary.
61 /// <returns></returns> 47 /// </summary>
62 public static bool TryParseConsoleMaxVector(string rawConsoleVector, out Vector3 vector) 48 public const string CoordHelp
63 { 49 = @"Each component of the coord is comma separated. There must be no spaces between the commas.
64 return TryParseConsoleVector(rawConsoleVector, c => float.MaxValue.ToString(), out vector); 50 If you don't care about the z component you can simply omit it.
65 } 51 If you don't care about the x or y components then you can leave them blank (though a comma is still required)
52 If you want to specify the maxmimum value of a component then you can use ~ instead of a number
53 If you want to specify the minimum value of a component then you can use -~ instead of a number
54 e.g.
55 delete object pos 20,20,20 to 40,40,40
56 delete object pos 20,20 to 40,40
57 delete object pos ,20,20 to ,40,40
58 delete object pos ,,30 to ,,~
59 delete object pos ,,-~ to ,,30";
60
61 public const string MinRawConsoleVectorValue = "-~";
62 public const string MaxRawConsoleVectorValue = "~";
63
64 public const string VectorSeparator = ",";
65 public static char[] VectorSeparatorChars = VectorSeparator.ToCharArray();
66 66
67 /// <summary> 67 /// <summary>
68 /// Convert a vector input from the console to an OpenMetaverse.Vector3 68 /// Check if the given file path exists.
69 /// </summary> 69 /// </summary>
70 /// <param name='rawConsoleVector'> 70 /// <remarks>If not, warning is printed to the given console.</remarks>
71 /// A string in the form <x>,<y>,<z> where there is no space between values. 71 /// <returns>true if the file does not exist, false otherwise.</returns>
72 /// Any component can be missing (e.g. ,,40). blankComponentFunc is invoked to replace the blank with a suitable value 72 /// <param name='console'></param>
73 /// Also, if the blank component is at the end, then the comma can be missed off entirely (e.g. 40,30 or 40) 73 /// <param name='path'></param>
74 /// The strings "~" and "-~" are valid in components. The first substitutes float.MaxValue whilst the second is float.MinValue 74 public static bool CheckFileDoesNotExist(ICommandConsole console, string path)
75 /// Other than that, component values must be numeric. 75 {
76 /// </param> 76 if (File.Exists(path))
77 /// <param name='blankComponentFunc'></param> 77 {
78 /// <param name='vector'></param> 78 console.OutputFormat("File {0} already exists. Please move or remove it.", path);
79 /// <returns></returns> 79 return false;
80 public static bool TryParseConsoleVector( 80 }
81 string rawConsoleVector, Func<string, string> blankComponentFunc, out Vector3 vector)
82 {
83 List<string> components = rawConsoleVector.Split(VectorSeparatorChars).ToList();
84 81
85 if (components.Count < 1 || components.Count > 3) 82 return true;
83 }
84
85 /// <summary>
86 /// Try to parse a console UUID from the console.
87 /// </summary>
88 /// <remarks>
89 /// Will complain to the console if parsing fails.
90 /// </remarks>
91 /// <returns></returns>
92 /// <param name='console'>If null then no complaint is printed.</param>
93 /// <param name='rawUuid'></param>
94 /// <param name='uuid'></param>
95 public static bool TryParseConsoleUuid(ICommandConsole console, string rawUuid, out UUID uuid)
86 { 96 {
87 vector = Vector3.Zero; 97 if (!UUID.TryParse(rawUuid, out uuid))
88 return false; 98 {
99 if (console != null)
100 console.OutputFormat("{0} is not a valid uuid", rawUuid);
101
102 return false;
103 }
104
105 return true;
89 } 106 }
90 107
91 for (int i = components.Count; i < 3; i++) 108 public static bool TryParseConsoleLocalId(ICommandConsole console, string rawLocalId, out uint localId)
92 components.Add(""); 109 {
110 if (!uint.TryParse(rawLocalId, out localId))
111 {
112 if (console != null)
113 console.OutputFormat("{0} is not a valid local id", localId);
114
115 return false;
116 }
93 117
94 List<string> semiDigestedComponents 118 if (localId == 0)
95 = components.ConvertAll<string>( 119 {
96 c => 120 if (console != null)
97 { 121 console.OutputFormat("{0} is not a valid local id - it must be greater than 0", localId);
98 if (c == "")
99 return blankComponentFunc.Invoke(c);
100 else if (c == MaxRawConsoleVectorValue)
101 return float.MaxValue.ToString();
102 else if (c == MinRawConsoleVectorValue)
103 return float.MinValue.ToString();
104 else
105 return c;
106 });
107 122
108 string semiDigestedConsoleVector = string.Join(VectorSeparator, semiDigestedComponents.ToArray()); 123 return false;
124 }
109 125
110// m_log.DebugFormat("[CONSOLE UTIL]: Parsing {0} into OpenMetaverse.Vector3", semiDigestedConsoleVector); 126 return true;
127 }
128
129 /// <summary>
130 /// Tries to parse the input as either a UUID or a local ID.
131 /// </summary>
132 /// <returns>true if parsing succeeded, false otherwise.</returns>
133 /// <param name='console'></param>
134 /// <param name='rawId'></param>
135 /// <param name='uuid'></param>
136 /// <param name='localId'>
137 /// Will be set to ConsoleUtil.LocalIdNotFound if parsing result was a UUID or no parse succeeded.
138 /// </param>
139 public static bool TryParseConsoleId(ICommandConsole console, string rawId, out UUID uuid, out uint localId)
140 {
141 if (TryParseConsoleUuid(null, rawId, out uuid))
142 {
143 localId = LocalIdNotFound;
144 return true;
145 }
146
147 if (TryParseConsoleLocalId(null, rawId, out localId))
148 {
149 return true;
150 }
111 151
112 return Vector3.TryParse(semiDigestedConsoleVector, out vector); 152 if (console != null)
153 console.OutputFormat("{0} is not a valid UUID or local id", rawId);
154
155 return false;
156 }
157
158 /// <summary>
159 /// Convert a minimum vector input from the console to an OpenMetaverse.Vector3
160 /// </summary>
161 /// <param name='rawConsoleVector'>/param>
162 /// <param name='vector'></param>
163 /// <returns></returns>
164 public static bool TryParseConsoleMinVector(string rawConsoleVector, out Vector3 vector)
165 {
166 return TryParseConsoleVector(rawConsoleVector, c => float.MinValue.ToString(), out vector);
167 }
168
169 /// <summary>
170 /// Convert a maximum vector input from the console to an OpenMetaverse.Vector3
171 /// </summary>
172 /// <param name='rawConsoleVector'>/param>
173 /// <param name='vector'></param>
174 /// <returns></returns>
175 public static bool TryParseConsoleMaxVector(string rawConsoleVector, out Vector3 vector)
176 {
177 return TryParseConsoleVector(rawConsoleVector, c => float.MaxValue.ToString(), out vector);
178 }
179
180 /// <summary>
181 /// Convert a vector input from the console to an OpenMetaverse.Vector3
182 /// </summary>
183 /// <param name='rawConsoleVector'>
184 /// A string in the form <x>,<y>,<z> where there is no space between values.
185 /// Any component can be missing (e.g. ,,40). blankComponentFunc is invoked to replace the blank with a suitable value
186 /// Also, if the blank component is at the end, then the comma can be missed off entirely (e.g. 40,30 or 40)
187 /// The strings "~" and "-~" are valid in components. The first substitutes float.MaxValue whilst the second is float.MinValue
188 /// Other than that, component values must be numeric.
189 /// </param>
190 /// <param name='blankComponentFunc'></param>
191 /// <param name='vector'></param>
192 /// <returns></returns>
193 public static bool TryParseConsoleVector(
194 string rawConsoleVector, Func<string, string> blankComponentFunc, out Vector3 vector)
195 {
196 List<string> components = rawConsoleVector.Split(VectorSeparatorChars).ToList();
197
198 if (components.Count < 1 || components.Count > 3)
199 {
200 vector = Vector3.Zero;
201 return false;
202 }
203
204 for (int i = components.Count; i < 3; i++)
205 components.Add("");
206
207 List<string> semiDigestedComponents
208 = components.ConvertAll<string>(
209 c =>
210 {
211 if (c == "")
212 return blankComponentFunc.Invoke(c);
213 else if (c == MaxRawConsoleVectorValue)
214 return float.MaxValue.ToString();
215 else if (c == MinRawConsoleVectorValue)
216 return float.MinValue.ToString();
217 else
218 return c;
219 });
220
221 string semiDigestedConsoleVector = string.Join(VectorSeparator, semiDigestedComponents.ToArray());
222
223 // m_log.DebugFormat("[CONSOLE UTIL]: Parsing {0} into OpenMetaverse.Vector3", semiDigestedConsoleVector);
224
225 return Vector3.TryParse(semiDigestedConsoleVector, out vector);
226 }
113 } 227 }
114} \ No newline at end of file 228} \ No newline at end of file
diff --git a/OpenSim/Framework/Console/MockConsole.cs b/OpenSim/Framework/Console/MockConsole.cs
index b489f93..8ba58e4 100644
--- a/OpenSim/Framework/Console/MockConsole.cs
+++ b/OpenSim/Framework/Console/MockConsole.cs
@@ -46,13 +46,18 @@ namespace OpenSim.Framework.Console
46 46
47 public ICommands Commands { get { return m_commands; } } 47 public ICommands Commands { get { return m_commands; } }
48 48
49 public string DefaultPrompt { get; set; }
50
49 public void Prompt() {} 51 public void Prompt() {}
50 52
51 public void RunCommand(string cmd) {} 53 public void RunCommand(string cmd) {}
52 54
53 public string ReadLine(string p, bool isCommand, bool e) { return ""; } 55 public string ReadLine(string p, bool isCommand, bool e) { return ""; }
54 56
55 public object ConsoleScene { get { return null; } } 57 public object ConsoleScene {
58 get { return null; }
59 set {}
60 }
56 61
57 public void Output(string text, string level) {} 62 public void Output(string text, string level) {}
58 public void Output(string text) {} 63 public void Output(string text) {}
diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs
index 9856978..87433cc 100644
--- a/OpenSim/Framework/IClientAPI.cs
+++ b/OpenSim/Framework/IClientAPI.cs
@@ -1099,8 +1099,20 @@ namespace OpenSim.Framework
1099 void SendAnimations(UUID[] animID, int[] seqs, UUID sourceAgentId, UUID[] objectIDs); 1099 void SendAnimations(UUID[] animID, int[] seqs, UUID sourceAgentId, UUID[] objectIDs);
1100 void SendRegionHandshake(RegionInfo regionInfo, RegionHandshakeArgs args); 1100 void SendRegionHandshake(RegionInfo regionInfo, RegionHandshakeArgs args);
1101 1101
1102 void SendChatMessage(string message, byte type, Vector3 fromPos, string fromName, UUID fromAgentID, byte source, 1102 /// <summary>
1103 byte audible); 1103 /// Send chat to the viewer.
1104 /// </summary>
1105 /// <param name='message'></param>
1106 /// <param name='type'></param>
1107 /// <param name='fromPos'></param>
1108 /// <param name='fromName'></param>
1109 /// <param name='fromAgentID'></param>
1110 /// <param name='ownerID'></param>
1111 /// <param name='source'></param>
1112 /// <param name='audible'></param>
1113 void SendChatMessage(
1114 string message, byte type, Vector3 fromPos, string fromName, UUID fromAgentID, UUID ownerID, byte source,
1115 byte audible);
1104 1116
1105 void SendInstantMessage(GridInstantMessage im); 1117 void SendInstantMessage(GridInstantMessage im);
1106 1118
diff --git a/OpenSim/Framework/ICommandConsole.cs b/OpenSim/Framework/ICommandConsole.cs
index 8cd20da..a6573f8 100644
--- a/OpenSim/Framework/ICommandConsole.cs
+++ b/OpenSim/Framework/ICommandConsole.cs
@@ -83,6 +83,11 @@ namespace OpenSim.Framework
83 ICommands Commands { get; } 83 ICommands Commands { get; }
84 84
85 /// <summary> 85 /// <summary>
86 /// The default prompt text.
87 /// </summary>
88 string DefaultPrompt { get; set; }
89
90 /// <summary>
86 /// Display a command prompt on the console and wait for user input 91 /// Display a command prompt on the console and wait for user input
87 /// </summary> 92 /// </summary>
88 void Prompt(); 93 void Prompt();
diff --git a/OpenSim/Framework/IConsole.cs b/OpenSim/Framework/IConsole.cs
index 33024b2..79560d8 100644
--- a/OpenSim/Framework/IConsole.cs
+++ b/OpenSim/Framework/IConsole.cs
@@ -32,7 +32,7 @@ namespace OpenSim.Framework
32{ 32{
33 public interface IConsole 33 public interface IConsole
34 { 34 {
35 object ConsoleScene { get; } 35 object ConsoleScene { get; set; }
36 36
37 void Output(string text, string level); 37 void Output(string text, string level);
38 void Output(string text); 38 void Output(string text);
diff --git a/OpenSim/Framework/InventoryItemBase.cs b/OpenSim/Framework/InventoryItemBase.cs
index a663680..3d45e76 100644
--- a/OpenSim/Framework/InventoryItemBase.cs
+++ b/OpenSim/Framework/InventoryItemBase.cs
@@ -87,16 +87,7 @@ namespace OpenSim.Framework
87 protected string m_creatorId; 87 protected string m_creatorId;
88 88
89 /// <value> 89 /// <value>
90 /// The UUID for the creator. This may be different from the canonical CreatorId. This property is used 90 /// The CreatorId expressed as a UUID.tely
91 /// for communication with the client over the Second Life protocol, since that protocol can only understand
92 /// UUIDs. As this is a basic framework class, this means that both the string creator id and the uuid
93 /// reference have to be settable separately
94 ///
95 /// Database plugins don't need to set this, it will be set by
96 /// upstream code (or set by the get accessor if left unset).
97 ///
98 /// XXX: An alternative to having a separate uuid property would be to hash the CreatorId appropriately
99 /// every time there was communication with a UUID-only client. This may be much more expensive.
100 /// </value> 91 /// </value>
101 public UUID CreatorIdAsUuid 92 public UUID CreatorIdAsUuid
102 { 93 {
@@ -109,20 +100,18 @@ namespace OpenSim.Framework
109 100
110 return m_creatorIdAsUuid; 101 return m_creatorIdAsUuid;
111 } 102 }
112
113 set
114 {
115 m_creatorIdAsUuid = value;
116 }
117 } 103 }
118 protected UUID m_creatorIdAsUuid = UUID.Zero; 104 protected UUID m_creatorIdAsUuid = UUID.Zero;
119 105
120 protected string m_creatorData = string.Empty; 106 /// <summary>
107 /// Extended creator information of the form <profile url>;<name>
108 /// </summary>
121 public string CreatorData // = <profile url>;<name> 109 public string CreatorData // = <profile url>;<name>
122 { 110 {
123 get { return m_creatorData; } 111 get { return m_creatorData; }
124 set { m_creatorData = value; } 112 set { m_creatorData = value; }
125 } 113 }
114 protected string m_creatorData = string.Empty;
126 115
127 /// <summary> 116 /// <summary>
128 /// Used by the DB layer to retrieve / store the entire user identification. 117 /// Used by the DB layer to retrieve / store the entire user identification.
@@ -162,7 +151,6 @@ namespace OpenSim.Framework
162 name = parts[2]; 151 name = parts[2];
163 152
164 m_creatorData += ';' + name; 153 m_creatorData += ';' + name;
165
166 } 154 }
167 } 155 }
168 } 156 }
diff --git a/OpenSim/Framework/Monitoring/Properties/AssemblyInfo.cs b/OpenSim/Framework/Monitoring/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..1f2bb40
--- /dev/null
+++ b/OpenSim/Framework/Monitoring/Properties/AssemblyInfo.cs
@@ -0,0 +1,33 @@
1using System.Reflection;
2using System.Runtime.CompilerServices;
3using System.Runtime.InteropServices;
4
5// General Information about an assembly is controlled through the following
6// set of attributes. Change these attribute values to modify the information
7// associated with an assembly.
8[assembly: AssemblyTitle("OpenSim.Framework.Monitoring")]
9[assembly: AssemblyDescription("")]
10[assembly: AssemblyConfiguration("")]
11[assembly: AssemblyCompany("http://opensimulator.org")]
12[assembly: AssemblyProduct("OpenSim")]
13[assembly: AssemblyCopyright("OpenSimulator developers")]
14[assembly: AssemblyTrademark("")]
15[assembly: AssemblyCulture("")]
16
17// Setting ComVisible to false makes the types in this assembly not visible
18// to COM components. If you need to access a type in this assembly from
19// COM, set the ComVisible attribute to true on that type.
20[assembly: ComVisible(false)]
21
22// The following GUID is for the ID of the typelib if this project is exposed to COM
23[assembly: Guid("74506fe3-2f9d-44c1-94c9-a30f79d9e0cb")]
24
25// Version information for an assembly consists of the following four values:
26//
27// Major Version
28// Minor Version
29// Build Number
30// Revision
31//
32[assembly: AssemblyVersion("0.7.5.*")]
33[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/OpenSim/Framework/Monitoring/Stats/PercentageStat.cs b/OpenSim/Framework/Monitoring/Stats/PercentageStat.cs
new file mode 100644
index 0000000..60bed55
--- /dev/null
+++ b/OpenSim/Framework/Monitoring/Stats/PercentageStat.cs
@@ -0,0 +1,88 @@
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.Collections.Generic;
30using System.Text;
31
32namespace OpenSim.Framework.Monitoring
33{
34 public class PercentageStat : Stat
35 {
36 public long Antecedent { get; set; }
37 public long Consequent { get; set; }
38
39 public override double Value
40 {
41 get
42 {
43 // Asking for an update here means that the updater cannot access this value without infinite recursion.
44 // XXX: A slightly messy but simple solution may be to flick a flag so we can tell if this is being
45 // called by the pull action and just return the value.
46 if (StatType == StatType.Pull)
47 PullAction(this);
48
49 long c = Consequent;
50
51 // Avoid any chance of a multi-threaded divide-by-zero
52 if (c == 0)
53 return 0;
54
55 return (double)Antecedent / c * 100;
56 }
57
58 set
59 {
60 throw new InvalidOperationException("Cannot set value on a PercentageStat");
61 }
62 }
63
64 public PercentageStat(
65 string shortName,
66 string name,
67 string description,
68 string category,
69 string container,
70 StatType type,
71 Action<Stat> pullAction,
72 StatVerbosity verbosity)
73 : base(shortName, name, description, "%", category, container, type, pullAction, verbosity) {}
74
75 public override string ToConsoleString()
76 {
77 StringBuilder sb = new StringBuilder();
78
79 sb.AppendFormat(
80 "{0}.{1}.{2} : {3:0.##}{4} ({5}/{6})",
81 Category, Container, ShortName, Value, UnitName, Antecedent, Consequent);
82
83 AppendMeasuresOfInterest(sb);
84
85 return sb.ToString();
86 }
87 }
88} \ No newline at end of file
diff --git a/OpenSim/Framework/Monitoring/Stats/Stat.cs b/OpenSim/Framework/Monitoring/Stats/Stat.cs
new file mode 100644
index 0000000..f91251b
--- /dev/null
+++ b/OpenSim/Framework/Monitoring/Stats/Stat.cs
@@ -0,0 +1,238 @@
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.Collections.Generic;
30using System.Text;
31
32namespace OpenSim.Framework.Monitoring
33{
34 /// <summary>
35 /// Holds individual statistic details
36 /// </summary>
37 public class Stat
38 {
39 /// <summary>
40 /// Category of this stat (e.g. cache, scene, etc).
41 /// </summary>
42 public string Category { get; private set; }
43
44 /// <summary>
45 /// Containing name for this stat.
46 /// FIXME: In the case of a scene, this is currently the scene name (though this leaves
47 /// us with a to-be-resolved problem of non-unique region names).
48 /// </summary>
49 /// <value>
50 /// The container.
51 /// </value>
52 public string Container { get; private set; }
53
54 public StatType StatType { get; private set; }
55
56 public MeasuresOfInterest MeasuresOfInterest { get; private set; }
57
58 /// <summary>
59 /// Action used to update this stat when the value is requested if it's a pull type.
60 /// </summary>
61 public Action<Stat> PullAction { get; private set; }
62
63 public StatVerbosity Verbosity { get; private set; }
64 public string ShortName { get; private set; }
65 public string Name { get; private set; }
66 public string Description { get; private set; }
67 public virtual string UnitName { get; private set; }
68
69 public virtual double Value
70 {
71 get
72 {
73 // Asking for an update here means that the updater cannot access this value without infinite recursion.
74 // XXX: A slightly messy but simple solution may be to flick a flag so we can tell if this is being
75 // called by the pull action and just return the value.
76 if (StatType == StatType.Pull)
77 PullAction(this);
78
79 return m_value;
80 }
81
82 set
83 {
84 m_value = value;
85 }
86 }
87
88 private double m_value;
89
90 /// <summary>
91 /// Historical samples for calculating measures of interest average.
92 /// </summary>
93 /// <remarks>
94 /// Will be null if no measures of interest require samples.
95 /// </remarks>
96 private static Queue<double> m_samples;
97
98 /// <summary>
99 /// Maximum number of statistical samples.
100 /// </summary>
101 /// <remarks>
102 /// At the moment this corresponds to 1 minute since the sampling rate is every 2.5 seconds as triggered from
103 /// the main Watchdog.
104 /// </remarks>
105 private static int m_maxSamples = 24;
106
107 public Stat(
108 string shortName,
109 string name,
110 string description,
111 string unitName,
112 string category,
113 string container,
114 StatType type,
115 Action<Stat> pullAction,
116 StatVerbosity verbosity)
117 : this(
118 shortName,
119 name,
120 description,
121 unitName,
122 category,
123 container,
124 type,
125 MeasuresOfInterest.None,
126 pullAction,
127 verbosity)
128 {
129 }
130
131 /// <summary>
132 /// Constructor
133 /// </summary>
134 /// <param name='shortName'>Short name for the stat. Must not contain spaces. e.g. "LongFrames"</param>
135 /// <param name='name'>Human readable name for the stat. e.g. "Long frames"</param>
136 /// <param name='description'>Description of stat</param>
137 /// <param name='unitName'>
138 /// Unit name for the stat. Should be preceeded by a space if the unit name isn't normally appeneded immediately to the value.
139 /// e.g. " frames"
140 /// </param>
141 /// <param name='category'>Category under which this stat should appear, e.g. "scene". Do not capitalize.</param>
142 /// <param name='container'>Entity to which this stat relates. e.g. scene name if this is a per scene stat.</param>
143 /// <param name='type'>Push or pull</param>
144 /// <param name='pullAction'>Pull stats need an action to update the stat on request. Push stats should set null here.</param>
145 /// <param name='moi'>Measures of interest</param>
146 /// <param name='verbosity'>Verbosity of stat. Controls whether it will appear in short stat display or only full display.</param>
147 public Stat(
148 string shortName,
149 string name,
150 string description,
151 string unitName,
152 string category,
153 string container,
154 StatType type,
155 MeasuresOfInterest moi,
156 Action<Stat> pullAction,
157 StatVerbosity verbosity)
158 {
159 if (StatsManager.SubCommands.Contains(category))
160 throw new Exception(
161 string.Format("Stat cannot be in category '{0}' since this is reserved for a subcommand", category));
162
163 ShortName = shortName;
164 Name = name;
165 Description = description;
166 UnitName = unitName;
167 Category = category;
168 Container = container;
169 StatType = type;
170
171 if (StatType == StatType.Push && pullAction != null)
172 throw new Exception("A push stat cannot have a pull action");
173 else
174 PullAction = pullAction;
175
176 MeasuresOfInterest = moi;
177
178 if ((moi & MeasuresOfInterest.AverageChangeOverTime) == MeasuresOfInterest.AverageChangeOverTime)
179 m_samples = new Queue<double>(m_maxSamples);
180
181 Verbosity = verbosity;
182 }
183
184 /// <summary>
185 /// Record a value in the sample set.
186 /// </summary>
187 /// <remarks>
188 /// Do not call this if MeasuresOfInterest.None
189 /// </remarks>
190 public void RecordValue()
191 {
192 double newValue = Value;
193
194 lock (m_samples)
195 {
196 if (m_samples.Count >= m_maxSamples)
197 m_samples.Dequeue();
198
199 m_samples.Enqueue(newValue);
200 }
201 }
202
203 public virtual string ToConsoleString()
204 {
205 StringBuilder sb = new StringBuilder();
206 sb.AppendFormat("{0}.{1}.{2} : {3}{4}", Category, Container, ShortName, Value, UnitName);
207
208 AppendMeasuresOfInterest(sb);
209
210 return sb.ToString();
211 }
212
213 protected void AppendMeasuresOfInterest(StringBuilder sb)
214 {
215 if ((MeasuresOfInterest & MeasuresOfInterest.AverageChangeOverTime)
216 == MeasuresOfInterest.AverageChangeOverTime)
217 {
218 double totalChange = 0;
219 double? lastSample = null;
220
221 lock (m_samples)
222 {
223 foreach (double s in m_samples)
224 {
225 if (lastSample != null)
226 totalChange += s - (double)lastSample;
227
228 lastSample = s;
229 }
230 }
231
232 int divisor = m_samples.Count <= 1 ? 1 : m_samples.Count - 1;
233
234 sb.AppendFormat(", {0:0.##}{1}/s", totalChange / divisor / (Watchdog.WATCHDOG_INTERVAL_MS / 1000), UnitName);
235 }
236 }
237 }
238} \ No newline at end of file
diff --git a/OpenSim/Framework/Monitoring/StatsManager.cs b/OpenSim/Framework/Monitoring/StatsManager.cs
index 31989e5..0762b01 100644
--- a/OpenSim/Framework/Monitoring/StatsManager.cs
+++ b/OpenSim/Framework/Monitoring/StatsManager.cs
@@ -27,6 +27,7 @@
27 27
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Text;
30 31
31namespace OpenSim.Framework.Monitoring 32namespace OpenSim.Framework.Monitoring
32{ 33{
@@ -207,7 +208,7 @@ namespace OpenSim.Framework.Monitoring
207 return false; 208 return false;
208 209
209 newContainer = new Dictionary<string, Stat>(container); 210 newContainer = new Dictionary<string, Stat>(container);
210 newContainer.Remove(stat.UniqueName); 211 newContainer.Remove(stat.ShortName);
211 212
212 newCategory = new Dictionary<string, Dictionary<string, Stat>>(category); 213 newCategory = new Dictionary<string, Dictionary<string, Stat>>(category);
213 newCategory.Remove(stat.Container); 214 newCategory.Remove(stat.Container);
@@ -246,129 +247,58 @@ namespace OpenSim.Framework.Monitoring
246 247
247 return false; 248 return false;
248 } 249 }
250
251 public static void RecordStats()
252 {
253 lock (RegisteredStats)
254 {
255 foreach (Dictionary<string, Dictionary<string, Stat>> category in RegisteredStats.Values)
256 {
257 foreach (Dictionary<string, Stat> container in category.Values)
258 {
259 foreach (Stat stat in container.Values)
260 {
261 if (stat.MeasuresOfInterest != MeasuresOfInterest.None)
262 stat.RecordValue();
263 }
264 }
265 }
266 }
267 }
249 } 268 }
250 269
251 /// <summary> 270 /// <summary>
252 /// Verbosity of stat. 271 /// Stat type.
253 /// </summary> 272 /// </summary>
254 /// <remarks> 273 /// <remarks>
255 /// Info will always be displayed. 274 /// A push stat is one which is continually updated and so it's value can simply by read.
275 /// A pull stat is one where reading the value triggers a collection method - the stat is not continually updated.
256 /// </remarks> 276 /// </remarks>
257 public enum StatVerbosity 277 public enum StatType
258 { 278 {
259 Debug, 279 Push,
260 Info 280 Pull
261 } 281 }
262 282
263 /// <summary> 283 /// <summary>
264 /// Holds individual static details 284 /// Measures of interest for this stat.
265 /// </summary> 285 /// </summary>
266 public class Stat 286 [Flags]
287 public enum MeasuresOfInterest
267 { 288 {
268 /// <summary> 289 None,
269 /// Unique stat name used for indexing. Each ShortName in a Category must be unique. 290 AverageChangeOverTime
270 /// </summary>
271 public string UniqueName { get; private set; }
272
273 /// <summary>
274 /// Category of this stat (e.g. cache, scene, etc).
275 /// </summary>
276 public string Category { get; private set; }
277
278 /// <summary>
279 /// Containing name for this stat.
280 /// FIXME: In the case of a scene, this is currently the scene name (though this leaves
281 /// us with a to-be-resolved problem of non-unique region names).
282 /// </summary>
283 /// <value>
284 /// The container.
285 /// </value>
286 public string Container { get; private set; }
287
288 public StatVerbosity Verbosity { get; private set; }
289 public string ShortName { get; private set; }
290 public string Name { get; private set; }
291 public string Description { get; private set; }
292 public virtual string UnitName { get; private set; }
293
294 public virtual double Value { get; set; }
295
296 /// <summary>
297 /// Constructor
298 /// </summary>
299 /// <param name='shortName'>Short name for the stat. Must not contain spaces. e.g. "LongFrames"</param>
300 /// <param name='name'>Human readable name for the stat. e.g. "Long frames"</param>
301 /// <param name='unitName'>
302 /// Unit name for the stat. Should be preceeded by a space if the unit name isn't normally appeneded immediately to the value.
303 /// e.g. " frames"
304 /// </param>
305 /// <param name='category'>Category under which this stat should appear, e.g. "scene". Do not capitalize.</param>
306 /// <param name='container'>Entity to which this stat relates. e.g. scene name if this is a per scene stat.</param>
307 /// <param name='verbosity'>Verbosity of stat. Controls whether it will appear in short stat display or only full display.</param>
308 /// <param name='description'>Description of stat</param>
309 public Stat(
310 string shortName, string name, string unitName, string category, string container, StatVerbosity verbosity, string description)
311 {
312 if (StatsManager.SubCommands.Contains(category))
313 throw new Exception(
314 string.Format("Stat cannot be in category '{0}' since this is reserved for a subcommand", category));
315
316 ShortName = shortName;
317 Name = name;
318 UnitName = unitName;
319 Category = category;
320 Container = container;
321 Verbosity = verbosity;
322 Description = description;
323
324 UniqueName = GenUniqueName(Container, Category, ShortName);
325 }
326
327 public static string GenUniqueName(string container, string category, string shortName)
328 {
329 return string.Format("{0}+{1}+{2}", container, category, shortName);
330 }
331
332 public virtual string ToConsoleString()
333 {
334 return string.Format(
335 "{0}.{1}.{2} : {3}{4}", Category, Container, ShortName, Value, UnitName);
336 }
337 } 291 }
338 292
339 public class PercentageStat : Stat 293 /// <summary>
294 /// Verbosity of stat.
295 /// </summary>
296 /// <remarks>
297 /// Info will always be displayed.
298 /// </remarks>
299 public enum StatVerbosity
340 { 300 {
341 public int Antecedent { get; set; } 301 Debug,
342 public int Consequent { get; set; } 302 Info
343
344 public override double Value
345 {
346 get
347 {
348 int c = Consequent;
349
350 // Avoid any chance of a multi-threaded divide-by-zero
351 if (c == 0)
352 return 0;
353
354 return (double)Antecedent / c * 100;
355 }
356
357 set
358 {
359 throw new Exception("Cannot set value on a PercentageStat");
360 }
361 }
362
363 public PercentageStat(
364 string shortName, string name, string category, string container, StatVerbosity verbosity, string description)
365 : base(shortName, name, "%", category, container, verbosity, description) {}
366
367 public override string ToConsoleString()
368 {
369 return string.Format(
370 "{0}.{1}.{2} : {3:0.##}{4} ({5}/{6})",
371 Category, Container, ShortName, Value, UnitName, Antecedent, Consequent);
372 }
373 } 303 }
374} \ No newline at end of file 304} \ No newline at end of file
diff --git a/OpenSim/Framework/Monitoring/Watchdog.cs b/OpenSim/Framework/Monitoring/Watchdog.cs
index a20326d..3f992b1 100644
--- a/OpenSim/Framework/Monitoring/Watchdog.cs
+++ b/OpenSim/Framework/Monitoring/Watchdog.cs
@@ -39,7 +39,7 @@ namespace OpenSim.Framework.Monitoring
39 public static class Watchdog 39 public static class Watchdog
40 { 40 {
41 /// <summary>Timer interval in milliseconds for the watchdog timer</summary> 41 /// <summary>Timer interval in milliseconds for the watchdog timer</summary>
42 const double WATCHDOG_INTERVAL_MS = 2500.0d; 42 public const double WATCHDOG_INTERVAL_MS = 2500.0d;
43 43
44 /// <summary>Default timeout in milliseconds before a thread is considered dead</summary> 44 /// <summary>Default timeout in milliseconds before a thread is considered dead</summary>
45 public const int DEFAULT_WATCHDOG_TIMEOUT_MS = 5000; 45 public const int DEFAULT_WATCHDOG_TIMEOUT_MS = 5000;
@@ -380,6 +380,8 @@ namespace OpenSim.Framework.Monitoring
380 if (MemoryWatchdog.Enabled) 380 if (MemoryWatchdog.Enabled)
381 MemoryWatchdog.Update(); 381 MemoryWatchdog.Update();
382 382
383 StatsManager.RecordStats();
384
383 m_watchdogTimer.Start(); 385 m_watchdogTimer.Start();
384 } 386 }
385 } 387 }
diff --git a/OpenSim/Framework/Pool.cs b/OpenSim/Framework/Pool.cs
index 1ca06c3..5484f5c 100644
--- a/OpenSim/Framework/Pool.cs
+++ b/OpenSim/Framework/Pool.cs
@@ -38,8 +38,23 @@ namespace OpenSim.Framework
38 /// </remarks> 38 /// </remarks>
39 public class Pool<T> 39 public class Pool<T>
40 { 40 {
41 /// <summary>
42 /// Number of objects in the pool.
43 /// </summary>
44 public int Count
45 {
46 get
47 {
48 lock (m_pool)
49 return m_pool.Count;
50 }
51 }
52
41 private Stack<T> m_pool; 53 private Stack<T> m_pool;
42 54
55 /// <summary>
56 /// Maximum pool size. Beyond this, any returned objects are not pooled.
57 /// </summary>
43 private int m_maxPoolSize; 58 private int m_maxPoolSize;
44 59
45 private Func<T> m_createFunction; 60 private Func<T> m_createFunction;
diff --git a/OpenSim/Framework/RegionLoader/Filesystem/Properties/AssemblyInfo.cs b/OpenSim/Framework/RegionLoader/Filesystem/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..d670f2f
--- /dev/null
+++ b/OpenSim/Framework/RegionLoader/Filesystem/Properties/AssemblyInfo.cs
@@ -0,0 +1,33 @@
1using System.Reflection;
2using System.Runtime.CompilerServices;
3using System.Runtime.InteropServices;
4
5// General Information about an assembly is controlled through the following
6// set of attributes. Change these attribute values to modify the information
7// associated with an assembly.
8[assembly: AssemblyTitle("OpenSim.Framework.RegionLoader.Filesystem")]
9[assembly: AssemblyDescription("")]
10[assembly: AssemblyConfiguration("")]
11[assembly: AssemblyCompany("http://opensimulator.org")]
12[assembly: AssemblyProduct("OpenSim")]
13[assembly: AssemblyCopyright("OpenSimulator developers")]
14[assembly: AssemblyTrademark("")]
15[assembly: AssemblyCulture("")]
16
17// Setting ComVisible to false makes the types in this assembly not visible
18// to COM components. If you need to access a type in this assembly from
19// COM, set the ComVisible attribute to true on that type.
20[assembly: ComVisible(false)]
21
22// The following GUID is for the ID of the typelib if this project is exposed to COM
23[assembly: Guid("4ab5c74b-e886-40a1-b67d-a04df285e706")]
24
25// Version information for an assembly consists of the following four values:
26//
27// Major Version
28// Minor Version
29// Build Number
30// Revision
31//
32[assembly: AssemblyVersion("0.7.5.*")]
33[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/OpenSim/Framework/RegionLoader/Web/Properties/AssemblyInfo.cs b/OpenSim/Framework/RegionLoader/Web/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..7309a12
--- /dev/null
+++ b/OpenSim/Framework/RegionLoader/Web/Properties/AssemblyInfo.cs
@@ -0,0 +1,33 @@
1using System.Reflection;
2using System.Runtime.CompilerServices;
3using System.Runtime.InteropServices;
4
5// General Information about an assembly is controlled through the following
6// set of attributes. Change these attribute values to modify the information
7// associated with an assembly.
8[assembly: AssemblyTitle("OpenSim.Framework.RegionLoader.Web")]
9[assembly: AssemblyDescription("")]
10[assembly: AssemblyConfiguration("")]
11[assembly: AssemblyCompany("http://opensimulator.org")]
12[assembly: AssemblyProduct("OpenSim")]
13[assembly: AssemblyCopyright("OpenSimulator developers")]
14[assembly: AssemblyTrademark("")]
15[assembly: AssemblyCulture("")]
16
17// Setting ComVisible to false makes the types in this assembly not visible
18// to COM components. If you need to access a type in this assembly from
19// COM, set the ComVisible attribute to true on that type.
20[assembly: ComVisible(false)]
21
22// The following GUID is for the ID of the typelib if this project is exposed to COM
23[assembly: Guid("985afff8-e7ed-4056-acce-39abf7a43d33")]
24
25// Version information for an assembly consists of the following four values:
26//
27// Major Version
28// Minor Version
29// Build Number
30// Revision
31//
32[assembly: AssemblyVersion("0.7.5.*")]
33[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/OpenSim/Framework/Serialization/ArchiveConstants.cs b/OpenSim/Framework/Serialization/ArchiveConstants.cs
index 48f1c4f..0c12787 100644
--- a/OpenSim/Framework/Serialization/ArchiveConstants.cs
+++ b/OpenSim/Framework/Serialization/ArchiveConstants.cs
@@ -154,6 +154,11 @@ namespace OpenSim.Framework.Serialization
154 EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "trashfolder.txt"] = (sbyte)AssetType.TrashFolder; 154 EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "trashfolder.txt"] = (sbyte)AssetType.TrashFolder;
155 } 155 }
156 156
157 public static string CreateOarLandDataPath(LandData ld)
158 {
159 return string.Format("{0}{1}.xml", ArchiveConstants.LANDDATA_PATH, ld.GlobalID);
160 }
161
157 /// <summary> 162 /// <summary>
158 /// Create the filename used to store an object in an OpenSim Archive. 163 /// Create the filename used to store an object in an OpenSim Archive.
159 /// </summary> 164 /// </summary>
diff --git a/OpenSim/Framework/Serialization/Properties/AssemblyInfo.cs b/OpenSim/Framework/Serialization/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..11efa4b
--- /dev/null
+++ b/OpenSim/Framework/Serialization/Properties/AssemblyInfo.cs
@@ -0,0 +1,33 @@
1using System.Reflection;
2using System.Runtime.CompilerServices;
3using System.Runtime.InteropServices;
4
5// General Information about an assembly is controlled through the following
6// set of attributes. Change these attribute values to modify the information
7// associated with an assembly.
8[assembly: AssemblyTitle("OpenSim.Framework.Serialization")]
9[assembly: AssemblyDescription("")]
10[assembly: AssemblyConfiguration("")]
11[assembly: AssemblyCompany("http://opensimulator.org")]
12[assembly: AssemblyProduct("OpenSim")]
13[assembly: AssemblyCopyright("OpenSimulator developers")]
14[assembly: AssemblyTrademark("")]
15[assembly: AssemblyCulture("")]
16
17// Setting ComVisible to false makes the types in this assembly not visible
18// to COM components. If you need to access a type in this assembly from
19// COM, set the ComVisible attribute to true on that type.
20[assembly: ComVisible(false)]
21
22// The following GUID is for the ID of the typelib if this project is exposed to COM
23[assembly: Guid("919db41e-4ac0-4f24-9992-81d62c0ee183")]
24
25// Version information for an assembly consists of the following four values:
26//
27// Major Version
28// Minor Version
29// Build Number
30// Revision
31//
32[assembly: AssemblyVersion("0.7.5.*")]
33[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/OpenSim/Framework/Serialization/Tests/LandDataSerializerTests.cs b/OpenSim/Framework/Serialization/Tests/LandDataSerializerTests.cs
index 8b9756b..ea100ee 100644
--- a/OpenSim/Framework/Serialization/Tests/LandDataSerializerTests.cs
+++ b/OpenSim/Framework/Serialization/Tests/LandDataSerializerTests.cs
@@ -37,7 +37,7 @@ using OpenSim.Tests.Common;
37namespace OpenSim.Framework.Serialization.Tests 37namespace OpenSim.Framework.Serialization.Tests
38{ 38{
39 [TestFixture] 39 [TestFixture]
40 public class LandDataSerializerTest 40 public class LandDataSerializerTest : OpenSimTestCase
41 { 41 {
42 private LandData land; 42 private LandData land;
43 private LandData landWithParcelAccessList; 43 private LandData landWithParcelAccessList;
diff --git a/OpenSim/Framework/Serialization/Tests/RegionSettingsSerializerTests.cs b/OpenSim/Framework/Serialization/Tests/RegionSettingsSerializerTests.cs
index 09b6f6d..142726b 100644
--- a/OpenSim/Framework/Serialization/Tests/RegionSettingsSerializerTests.cs
+++ b/OpenSim/Framework/Serialization/Tests/RegionSettingsSerializerTests.cs
@@ -37,7 +37,7 @@ using OpenSim.Tests.Common;
37namespace OpenSim.Framework.Serialization.Tests 37namespace OpenSim.Framework.Serialization.Tests
38{ 38{
39 [TestFixture] 39 [TestFixture]
40 public class RegionSettingsSerializerTests 40 public class RegionSettingsSerializerTests : OpenSimTestCase
41 { 41 {
42 private string m_serializedRs = @"<?xml version=""1.0"" encoding=""utf-16""?> 42 private string m_serializedRs = @"<?xml version=""1.0"" encoding=""utf-16""?>
43<RegionSettings> 43<RegionSettings>
diff --git a/OpenSim/Framework/Servers/BaseOpenSimServer.cs b/OpenSim/Framework/Servers/BaseOpenSimServer.cs
index aac9c45..c0dc907 100644
--- a/OpenSim/Framework/Servers/BaseOpenSimServer.cs
+++ b/OpenSim/Framework/Servers/BaseOpenSimServer.cs
@@ -27,7 +27,6 @@
27 27
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Diagnostics;
31using System.IO; 30using System.IO;
32using System.Reflection; 31using System.Reflection;
33using System.Text; 32using System.Text;
@@ -38,6 +37,8 @@ using log4net;
38using log4net.Appender; 37using log4net.Appender;
39using log4net.Core; 38using log4net.Core;
40using log4net.Repository; 39using log4net.Repository;
40using OpenMetaverse;
41using OpenMetaverse.StructuredData;
41using OpenSim.Framework; 42using OpenSim.Framework;
42using OpenSim.Framework.Console; 43using OpenSim.Framework.Console;
43using OpenSim.Framework.Monitoring; 44using OpenSim.Framework.Monitoring;
@@ -45,16 +46,12 @@ using OpenSim.Framework.Servers;
45using OpenSim.Framework.Servers.HttpServer; 46using OpenSim.Framework.Servers.HttpServer;
46using Timer=System.Timers.Timer; 47using Timer=System.Timers.Timer;
47 48
48using OpenMetaverse;
49using OpenMetaverse.StructuredData;
50
51
52namespace OpenSim.Framework.Servers 49namespace OpenSim.Framework.Servers
53{ 50{
54 /// <summary> 51 /// <summary>
55 /// Common base for the main OpenSimServers (user, grid, inventory, region, etc) 52 /// Common base for the main OpenSimServers (user, grid, inventory, region, etc)
56 /// </summary> 53 /// </summary>
57 public abstract class BaseOpenSimServer 54 public abstract class BaseOpenSimServer : ServerBase
58 { 55 {
59 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 56 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
60 57
@@ -63,27 +60,6 @@ namespace OpenSim.Framework.Servers
63 /// server. 60 /// server.
64 /// </summary> 61 /// </summary>
65 private Timer m_periodicDiagnosticsTimer = new Timer(60 * 60 * 1000); 62 private Timer m_periodicDiagnosticsTimer = new Timer(60 * 60 * 1000);
66
67 protected CommandConsole m_console;
68 protected OpenSimAppender m_consoleAppender;
69 protected IAppender m_logFileAppender = null;
70
71 /// <summary>
72 /// Time at which this server was started
73 /// </summary>
74 protected DateTime m_startuptime;
75
76 /// <summary>
77 /// Record the initial startup directory for info purposes
78 /// </summary>
79 protected string m_startupDirectory = Environment.CurrentDirectory;
80
81 /// <summary>
82 /// Server version information. Usually VersionInfo + information about git commit, operating system, etc.
83 /// </summary>
84 protected string m_version;
85
86 protected string m_pidFile = String.Empty;
87 63
88 /// <summary> 64 /// <summary>
89 /// Random uuid for private data 65 /// Random uuid for private data
@@ -96,30 +72,13 @@ namespace OpenSim.Framework.Servers
96 get { return m_httpServer; } 72 get { return m_httpServer; }
97 } 73 }
98 74
99 public BaseOpenSimServer() 75 public BaseOpenSimServer() : base()
100 { 76 {
101 m_startuptime = DateTime.Now;
102 m_version = VersionInfo.Version;
103
104 // Random uuid for private data 77 // Random uuid for private data
105 m_osSecret = UUID.Random().ToString(); 78 m_osSecret = UUID.Random().ToString();
106 79
107 m_periodicDiagnosticsTimer.Elapsed += new ElapsedEventHandler(LogDiagnostics); 80 m_periodicDiagnosticsTimer.Elapsed += new ElapsedEventHandler(LogDiagnostics);
108 m_periodicDiagnosticsTimer.Enabled = true; 81 m_periodicDiagnosticsTimer.Enabled = true;
109
110 // This thread will go on to become the console listening thread
111 Thread.CurrentThread.Name = "ConsoleThread";
112
113 ILoggerRepository repository = LogManager.GetRepository();
114 IAppender[] appenders = repository.GetAppenders();
115
116 foreach (IAppender appender in appenders)
117 {
118 if (appender.Name == "LogFileAppender")
119 {
120 m_logFileAppender = appender;
121 }
122 }
123 } 82 }
124 83
125 /// <summary> 84 /// <summary>
@@ -127,72 +86,18 @@ namespace OpenSim.Framework.Servers
127 /// </summary> 86 /// </summary>
128 protected virtual void StartupSpecific() 87 protected virtual void StartupSpecific()
129 { 88 {
130 if (m_console != null) 89 if (m_console == null)
131 { 90 return;
132 ILoggerRepository repository = LogManager.GetRepository();
133 IAppender[] appenders = repository.GetAppenders();
134
135 foreach (IAppender appender in appenders)
136 {
137 if (appender.Name == "Console")
138 {
139 m_consoleAppender = (OpenSimAppender)appender;
140 break;
141 }
142 }
143
144 if (null == m_consoleAppender)
145 {
146 Notice("No appender named Console found (see the log4net config file for this executable)!");
147 }
148 else
149 {
150 m_consoleAppender.Console = m_console;
151
152 // If there is no threshold set then the threshold is effectively everything.
153 if (null == m_consoleAppender.Threshold)
154 m_consoleAppender.Threshold = Level.All;
155
156 Notice(String.Format("Console log level is {0}", m_consoleAppender.Threshold));
157 }
158
159 m_console.Commands.AddCommand("General", false, "quit",
160 "quit",
161 "Quit the application", HandleQuit);
162
163 m_console.Commands.AddCommand("General", false, "shutdown",
164 "shutdown",
165 "Quit the application", HandleQuit);
166
167 m_console.Commands.AddCommand("General", false, "set log level",
168 "set log level <level>",
169 "Set the console logging level", HandleLogLevel);
170
171 m_console.Commands.AddCommand("General", false, "show info",
172 "show info",
173 "Show general information about the server", HandleShow);
174
175 m_console.Commands.AddCommand("General", false, "show threads",
176 "show threads",
177 "Show thread status", HandleShow);
178
179 m_console.Commands.AddCommand("General", false, "show uptime",
180 "show uptime",
181 "Show server uptime", HandleShow);
182
183 m_console.Commands.AddCommand("General", false, "show version",
184 "show version",
185 "Show server version", HandleShow);
186 91
187 m_console.Commands.AddCommand("General", false, "threads abort", 92 RegisterCommonCommands();
188 "threads abort <thread-id>", 93
189 "Abort a managed thread. Use \"show threads\" to find possible threads.", HandleThreadsAbort); 94 m_console.Commands.AddCommand("General", false, "quit",
95 "quit",
96 "Quit the application", HandleQuit);
190 97
191 m_console.Commands.AddCommand("General", false, "threads show", 98 m_console.Commands.AddCommand("General", false, "shutdown",
192 "threads show", 99 "shutdown",
193 "Show thread status. Synonym for \"show threads\"", 100 "Quit the application", HandleQuit);
194 (string module, string[] args) => Notice(GetThreadsReport()));
195 }
196 } 101 }
197 102
198 /// <summary> 103 /// <summary>
@@ -225,74 +130,11 @@ namespace OpenSim.Framework.Servers
225 } 130 }
226 131
227 /// <summary> 132 /// <summary>
228 /// Get a report about the registered threads in this server.
229 /// </summary>
230 protected string GetThreadsReport()
231 {
232 // This should be a constant field.
233 string reportFormat = "{0,6} {1,35} {2,16} {3,13} {4,10} {5,30}";
234
235 StringBuilder sb = new StringBuilder();
236 Watchdog.ThreadWatchdogInfo[] threads = Watchdog.GetThreadsInfo();
237
238 sb.Append(threads.Length + " threads are being tracked:" + Environment.NewLine);
239
240 int timeNow = Environment.TickCount & Int32.MaxValue;
241
242 sb.AppendFormat(reportFormat, "ID", "NAME", "LAST UPDATE (MS)", "LIFETIME (MS)", "PRIORITY", "STATE");
243 sb.Append(Environment.NewLine);
244
245 foreach (Watchdog.ThreadWatchdogInfo twi in threads)
246 {
247 Thread t = twi.Thread;
248
249 sb.AppendFormat(
250 reportFormat,
251 t.ManagedThreadId,
252 t.Name,
253 timeNow - twi.LastTick,
254 timeNow - twi.FirstTick,
255 t.Priority,
256 t.ThreadState);
257
258 sb.Append("\n");
259 }
260
261 sb.Append("\n");
262
263 // For some reason mono 2.6.7 returns an empty threads set! Not going to confuse people by reporting
264 // zero active threads.
265 int totalThreads = Process.GetCurrentProcess().Threads.Count;
266 if (totalThreads > 0)
267 sb.AppendFormat("Total threads active: {0}\n\n", totalThreads);
268
269 sb.Append("Main threadpool (excluding script engine pools)\n");
270 sb.Append(Util.GetThreadPoolReport());
271
272 return sb.ToString();
273 }
274
275 /// <summary>
276 /// Return a report about the uptime of this server
277 /// </summary>
278 /// <returns></returns>
279 protected string GetUptimeReport()
280 {
281 StringBuilder sb = new StringBuilder(String.Format("Time now is {0}\n", DateTime.Now));
282 sb.Append(String.Format("Server has been running since {0}, {1}\n", m_startuptime.DayOfWeek, m_startuptime));
283 sb.Append(String.Format("That is an elapsed time of {0}\n", DateTime.Now - m_startuptime));
284
285 return sb.ToString();
286 }
287
288 /// <summary>
289 /// Performs initialisation of the scene, such as loading configuration from disk. 133 /// Performs initialisation of the scene, such as loading configuration from disk.
290 /// </summary> 134 /// </summary>
291 public virtual void Startup() 135 public virtual void Startup()
292 { 136 {
293 m_log.Info("[STARTUP]: Beginning startup processing"); 137 m_log.Info("[STARTUP]: Beginning startup processing");
294
295 EnhanceVersionInformation();
296 138
297 m_log.Info("[STARTUP]: OpenSimulator version: " + m_version + Environment.NewLine); 139 m_log.Info("[STARTUP]: OpenSimulator version: " + m_version + Environment.NewLine);
298 // clr version potentially is more confusing than helpful, since it doesn't tell us if we're running under Mono/MS .NET and 140 // clr version potentially is more confusing than helpful, since it doesn't tell us if we're running under Mono/MS .NET and
@@ -327,257 +169,7 @@ namespace OpenSim.Framework.Servers
327 private void HandleQuit(string module, string[] args) 169 private void HandleQuit(string module, string[] args)
328 { 170 {
329 Shutdown(); 171 Shutdown();
330 } 172 }
331
332 private void HandleLogLevel(string module, string[] cmd)
333 {
334 if (null == m_consoleAppender)
335 {
336 Notice("No appender named Console found (see the log4net config file for this executable)!");
337 return;
338 }
339
340 if (cmd.Length > 3)
341 {
342 string rawLevel = cmd[3];
343
344 ILoggerRepository repository = LogManager.GetRepository();
345 Level consoleLevel = repository.LevelMap[rawLevel];
346
347 if (consoleLevel != null)
348 m_consoleAppender.Threshold = consoleLevel;
349 else
350 Notice(
351 String.Format(
352 "{0} is not a valid logging level. Valid logging levels are ALL, DEBUG, INFO, WARN, ERROR, FATAL, OFF",
353 rawLevel));
354 }
355
356 Notice(String.Format("Console log level is {0}", m_consoleAppender.Threshold));
357 }
358
359 /// <summary>
360 /// Show help information
361 /// </summary>
362 /// <param name="helpArgs"></param>
363 protected virtual void ShowHelp(string[] helpArgs)
364 {
365 Notice("");
366
367 if (helpArgs.Length == 0)
368 {
369 Notice("set log level [level] - change the console logging level only. For example, off or debug.");
370 Notice("show info - show server information (e.g. startup path).");
371 Notice("show threads - list tracked threads");
372 Notice("show uptime - show server startup time and uptime.");
373 Notice("show version - show server version.");
374 Notice("");
375
376 return;
377 }
378 }
379
380 public virtual void HandleShow(string module, string[] cmd)
381 {
382 List<string> args = new List<string>(cmd);
383
384 args.RemoveAt(0);
385
386 string[] showParams = args.ToArray();
387
388 switch (showParams[0])
389 {
390 case "info":
391 ShowInfo();
392 break;
393
394 case "threads":
395 Notice(GetThreadsReport());
396 break;
397
398 case "uptime":
399 Notice(GetUptimeReport());
400 break;
401
402 case "version":
403 Notice(GetVersionText());
404 break;
405 }
406 }
407
408 public virtual void HandleThreadsAbort(string module, string[] cmd)
409 {
410 if (cmd.Length != 3)
411 {
412 MainConsole.Instance.Output("Usage: threads abort <thread-id>");
413 return;
414 }
415
416 int threadId;
417 if (!int.TryParse(cmd[2], out threadId))
418 {
419 MainConsole.Instance.Output("ERROR: Thread id must be an integer");
420 return;
421 }
422
423 if (Watchdog.AbortThread(threadId))
424 MainConsole.Instance.OutputFormat("Aborted thread with id {0}", threadId);
425 else
426 MainConsole.Instance.OutputFormat("ERROR - Thread with id {0} not found in managed threads", threadId);
427 }
428
429 protected void ShowInfo()
430 {
431 Notice(GetVersionText());
432 Notice("Startup directory: " + m_startupDirectory);
433 if (null != m_consoleAppender)
434 Notice(String.Format("Console log level: {0}", m_consoleAppender.Threshold));
435 }
436
437 protected string GetVersionText()
438 {
439 return String.Format("Version: {0} (interface version {1})", m_version, VersionInfo.MajorInterfaceVersion);
440 }
441
442 /// <summary>
443 /// Console output is only possible if a console has been established.
444 /// That is something that cannot be determined within this class. So
445 /// all attempts to use the console MUST be verified.
446 /// </summary>
447 /// <param name="msg"></param>
448 protected void Notice(string msg)
449 {
450 if (m_console != null)
451 {
452 m_console.Output(msg);
453 }
454 }
455
456 /// <summary>
457 /// Console output is only possible if a console has been established.
458 /// That is something that cannot be determined within this class. So
459 /// all attempts to use the console MUST be verified.
460 /// </summary>
461 /// <param name="format"></param>
462 /// <param name="components"></param>
463 protected void Notice(string format, params string[] components)
464 {
465 if (m_console != null)
466 m_console.OutputFormat(format, components);
467 }
468
469 /// <summary>
470 /// Enhance the version string with extra information if it's available.
471 /// </summary>
472 protected void EnhanceVersionInformation()
473 {
474 string buildVersion = string.Empty;
475
476 // The subversion information is deprecated and will be removed at a later date
477 // Add subversion revision information if available
478 // Try file "svn_revision" in the current directory first, then the .svn info.
479 // This allows to make the revision available in simulators not running from the source tree.
480 // FIXME: Making an assumption about the directory we're currently in - we do this all over the place
481 // elsewhere as well
482 string gitDir = "../.git/";
483 string gitRefPointerPath = gitDir + "HEAD";
484
485 string svnRevisionFileName = "svn_revision";
486 string svnFileName = ".svn/entries";
487 string manualVersionFileName = ".version";
488 string inputLine;
489 int strcmp;
490
491 if (File.Exists(manualVersionFileName))
492 {
493 using (StreamReader CommitFile = File.OpenText(manualVersionFileName))
494 buildVersion = CommitFile.ReadLine();
495
496 m_version += buildVersion ?? "";
497 }
498 else if (File.Exists(gitRefPointerPath))
499 {
500// m_log.DebugFormat("[OPENSIM]: Found {0}", gitRefPointerPath);
501
502 string rawPointer = "";
503
504 using (StreamReader pointerFile = File.OpenText(gitRefPointerPath))
505 rawPointer = pointerFile.ReadLine();
506
507// m_log.DebugFormat("[OPENSIM]: rawPointer [{0}]", rawPointer);
508
509 Match m = Regex.Match(rawPointer, "^ref: (.+)$");
510
511 if (m.Success)
512 {
513// m_log.DebugFormat("[OPENSIM]: Matched [{0}]", m.Groups[1].Value);
514
515 string gitRef = m.Groups[1].Value;
516 string gitRefPath = gitDir + gitRef;
517 if (File.Exists(gitRefPath))
518 {
519// m_log.DebugFormat("[OPENSIM]: Found gitRefPath [{0}]", gitRefPath);
520
521 using (StreamReader refFile = File.OpenText(gitRefPath))
522 {
523 string gitHash = refFile.ReadLine();
524 m_version += gitHash.Substring(0, 7);
525 }
526 }
527 }
528 }
529 else
530 {
531 // Remove the else logic when subversion mirror is no longer used
532 if (File.Exists(svnRevisionFileName))
533 {
534 StreamReader RevisionFile = File.OpenText(svnRevisionFileName);
535 buildVersion = RevisionFile.ReadLine();
536 buildVersion.Trim();
537 RevisionFile.Close();
538 }
539
540 if (string.IsNullOrEmpty(buildVersion) && File.Exists(svnFileName))
541 {
542 StreamReader EntriesFile = File.OpenText(svnFileName);
543 inputLine = EntriesFile.ReadLine();
544 while (inputLine != null)
545 {
546 // using the dir svn revision at the top of entries file
547 strcmp = String.Compare(inputLine, "dir");
548 if (strcmp == 0)
549 {
550 buildVersion = EntriesFile.ReadLine();
551 break;
552 }
553 else
554 {
555 inputLine = EntriesFile.ReadLine();
556 }
557 }
558 EntriesFile.Close();
559 }
560
561 m_version += string.IsNullOrEmpty(buildVersion) ? " " : ("." + buildVersion + " ").Substring(0, 6);
562 }
563 }
564
565 protected void CreatePIDFile(string path)
566 {
567 try
568 {
569 string pidstring = System.Diagnostics.Process.GetCurrentProcess().Id.ToString();
570 FileStream fs = File.Create(path);
571
572 Byte[] buf = Encoding.ASCII.GetBytes(pidstring);
573 fs.Write(buf, 0, buf.Length);
574 fs.Close();
575 m_pidFile = path;
576 }
577 catch (Exception)
578 {
579 }
580 }
581 173
582 public string osSecret { 174 public string osSecret {
583 // Secret uuid for the simulator 175 // Secret uuid for the simulator
@@ -596,20 +188,5 @@ namespace OpenSim.Framework.Servers
596 return StatsManager.SimExtraStats.XReport((DateTime.Now - m_startuptime).ToString() , m_version); 188 return StatsManager.SimExtraStats.XReport((DateTime.Now - m_startuptime).ToString() , m_version);
597 } 189 }
598 } 190 }
599
600 protected void RemovePIDFile()
601 {
602 if (m_pidFile != String.Empty)
603 {
604 try
605 {
606 File.Delete(m_pidFile);
607 m_pidFile = String.Empty;
608 }
609 catch (Exception)
610 {
611 }
612 }
613 }
614 } 191 }
615} 192} \ No newline at end of file
diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
index b018e57..2cd626f 100644
--- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
+++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
@@ -542,11 +542,8 @@ namespace OpenSim.Framework.Servers.HttpServer
542 { 542 {
543 case null: 543 case null:
544 case "text/html": 544 case "text/html":
545
546 if (DebugLevel >= 3) 545 if (DebugLevel >= 3)
547 m_log.DebugFormat( 546 LogIncomingToContentTypeHandler(request);
548 "[BASE HTTP SERVER]: HTTP IN {0} :{1} {2} content type handler {3} {4} from {5}",
549 RequestNumber, Port, request.ContentType, request.HttpMethod, request.Url.PathAndQuery, request.RemoteIPEndPoint);
550 547
551 buffer = HandleHTTPRequest(request, response); 548 buffer = HandleHTTPRequest(request, response);
552 break; 549 break;
@@ -554,11 +551,8 @@ namespace OpenSim.Framework.Servers.HttpServer
554 case "application/llsd+xml": 551 case "application/llsd+xml":
555 case "application/xml+llsd": 552 case "application/xml+llsd":
556 case "application/llsd+json": 553 case "application/llsd+json":
557
558 if (DebugLevel >= 3) 554 if (DebugLevel >= 3)
559 m_log.DebugFormat( 555 LogIncomingToContentTypeHandler(request);
560 "[BASE HTTP SERVER]: HTTP IN {0} :{1} {2} content type handler {3} {4} from {5}",
561 RequestNumber, Port, request.ContentType, request.HttpMethod, request.Url.PathAndQuery, request.RemoteIPEndPoint);
562 556
563 buffer = HandleLLSDRequests(request, response); 557 buffer = HandleLLSDRequests(request, response);
564 break; 558 break;
@@ -693,7 +687,7 @@ namespace OpenSim.Framework.Servers.HttpServer
693 "[BASE HTTP SERVER]: HTTP IN {0} :{1} {2} content type handler {3} {4} from {5}", 687 "[BASE HTTP SERVER]: HTTP IN {0} :{1} {2} content type handler {3} {4} from {5}",
694 RequestNumber, 688 RequestNumber,
695 Port, 689 Port,
696 request.ContentType, 690 (request.ContentType == null || request.ContentType == "") ? "not set" : request.ContentType,
697 request.HttpMethod, 691 request.HttpMethod,
698 request.Url.PathAndQuery, 692 request.Url.PathAndQuery,
699 request.RemoteIPEndPoint); 693 request.RemoteIPEndPoint);
@@ -725,8 +719,11 @@ namespace OpenSim.Framework.Servers.HttpServer
725 if (DebugLevel == 5) 719 if (DebugLevel == 5)
726 { 720 {
727 const int sampleLength = 80; 721 const int sampleLength = 80;
728 char[] sampleChars = new char[sampleLength]; 722 char[] sampleChars = new char[sampleLength + 3];
729 reader.Read(sampleChars, 0, sampleLength); 723 reader.Read(sampleChars, 0, sampleLength);
724 sampleChars[80] = '.';
725 sampleChars[81] = '.';
726 sampleChars[82] = '.';
730 output = new string(sampleChars); 727 output = new string(sampleChars);
731 } 728 }
732 else 729 else
@@ -734,7 +731,7 @@ namespace OpenSim.Framework.Servers.HttpServer
734 output = reader.ReadToEnd(); 731 output = reader.ReadToEnd();
735 } 732 }
736 733
737 m_log.DebugFormat("[BASE HTTP SERVER]: {0}...", output.Replace("\n", @"\n")); 734 m_log.DebugFormat("[BASE HTTP SERVER]: {0}", output.Replace("\n", @"\n"));
738 } 735 }
739 } 736 }
740 737
@@ -1285,59 +1282,6 @@ namespace OpenSim.Framework.Servers.HttpServer
1285 map["login"] = OSD.FromString("false"); 1282 map["login"] = OSD.FromString("false");
1286 return map; 1283 return map;
1287 } 1284 }
1288 /// <summary>
1289 /// A specific agent handler was provided. Such a handler is expecetd to have an
1290 /// intimate, and highly specific relationship with the client. Consequently,
1291 /// nothing is done here.
1292 /// </summary>
1293 /// <param name="handler"></param>
1294 /// <param name="request"></param>
1295 /// <param name="response"></param>
1296
1297 private bool HandleAgentRequest(IHttpAgentHandler handler, OSHttpRequest request, OSHttpResponse response)
1298 {
1299 // In the case of REST, then handler is responsible for ALL aspects of
1300 // the request/response handling. Nothing is done here, not even encoding.
1301
1302 try
1303 {
1304 return handler.Handle(request, response);
1305 }
1306 catch (Exception e)
1307 {
1308 // If the handler did in fact close the stream, then this will blow
1309 // chunks. So that that doesn't disturb anybody we throw away any
1310 // and all exceptions raised. We've done our best to release the
1311 // client.
1312 try
1313 {
1314 m_log.Warn("[HTTP-AGENT]: Error - " + e.Message);
1315 response.SendChunked = false;
1316 response.KeepAlive = true;
1317 response.StatusCode = (int)OSHttpStatusCode.ServerErrorInternalError;
1318 //response.OutputStream.Close();
1319 try
1320 {
1321 response.Send();
1322 //response.FreeContext();
1323 }
1324 catch (SocketException f)
1325 {
1326 // This has to be here to prevent a Linux/Mono crash
1327 m_log.Warn(
1328 String.Format("[BASE HTTP SERVER]: XmlRpcRequest issue {0}.\nNOTE: this may be spurious on Linux. ", f.Message), f);
1329 }
1330 }
1331 catch(Exception)
1332 {
1333 }
1334 }
1335
1336 // Indicate that the request has been "handled"
1337
1338 return true;
1339
1340 }
1341 1285
1342 public byte[] HandleHTTPRequest(OSHttpRequest request, OSHttpResponse response) 1286 public byte[] HandleHTTPRequest(OSHttpRequest request, OSHttpResponse response)
1343 { 1287 {
diff --git a/OpenSim/Framework/Servers/HttpServer/Properties/AssemblyInfo.cs b/OpenSim/Framework/Servers/HttpServer/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..02ecc25
--- /dev/null
+++ b/OpenSim/Framework/Servers/HttpServer/Properties/AssemblyInfo.cs
@@ -0,0 +1,33 @@
1using System.Reflection;
2using System.Runtime.CompilerServices;
3using System.Runtime.InteropServices;
4
5// General Information about an assembly is controlled through the following
6// set of attributes. Change these attribute values to modify the information
7// associated with an assembly.
8[assembly: AssemblyTitle("OpenSim.Framework.Servers.HttpServer")]
9[assembly: AssemblyDescription("")]
10[assembly: AssemblyConfiguration("")]
11[assembly: AssemblyCompany("http://opensimulator.org")]
12[assembly: AssemblyProduct("OpenSim")]
13[assembly: AssemblyCopyright("OpenSimulator developers")]
14[assembly: AssemblyTrademark("")]
15[assembly: AssemblyCulture("")]
16
17// Setting ComVisible to false makes the types in this assembly not visible
18// to COM components. If you need to access a type in this assembly from
19// COM, set the ComVisible attribute to true on that type.
20[assembly: ComVisible(false)]
21
22// The following GUID is for the ID of the typelib if this project is exposed to COM
23[assembly: Guid("c4ea5baa-81c4-4867-a645-1ec360c1f164")]
24
25// Version information for an assembly consists of the following four values:
26//
27// Major Version
28// Minor Version
29// Build Number
30// Revision
31//
32[assembly: AssemblyVersion("0.7.5.*")]
33[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/OpenSim/Framework/Servers/Properties/AssemblyInfo.cs b/OpenSim/Framework/Servers/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..021f63c
--- /dev/null
+++ b/OpenSim/Framework/Servers/Properties/AssemblyInfo.cs
@@ -0,0 +1,33 @@
1using System.Reflection;
2using System.Runtime.CompilerServices;
3using System.Runtime.InteropServices;
4
5// General Information about an assembly is controlled through the following
6// set of attributes. Change these attribute values to modify the information
7// associated with an assembly.
8[assembly: AssemblyTitle("OpenSim.Framework.Servers")]
9[assembly: AssemblyDescription("")]
10[assembly: AssemblyConfiguration("")]
11[assembly: AssemblyCompany("http://opensimulator.org")]
12[assembly: AssemblyProduct("OpenSim")]
13[assembly: AssemblyCopyright("OpenSimulator developers")]
14[assembly: AssemblyTrademark("")]
15[assembly: AssemblyCulture("")]
16
17// Setting ComVisible to false makes the types in this assembly not visible
18// to COM components. If you need to access a type in this assembly from
19// COM, set the ComVisible attribute to true on that type.
20[assembly: ComVisible(false)]
21
22// The following GUID is for the ID of the typelib if this project is exposed to COM
23[assembly: Guid("b48e8b3e-5c5c-4673-b31f-21e13b8e568b")]
24
25// Version information for an assembly consists of the following four values:
26//
27// Major Version
28// Minor Version
29// Build Number
30// Revision
31//
32[assembly: AssemblyVersion("0.7.5.*")]
33[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/OpenSim/Framework/Servers/ServerBase.cs b/OpenSim/Framework/Servers/ServerBase.cs
new file mode 100644
index 0000000..47baac8
--- /dev/null
+++ b/OpenSim/Framework/Servers/ServerBase.cs
@@ -0,0 +1,677 @@
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.Collections.Generic;
30using System.Diagnostics;
31using System.IO;
32using System.Reflection;
33using System.Text;
34using System.Text.RegularExpressions;
35using System.Threading;
36using log4net;
37using log4net.Appender;
38using log4net.Core;
39using log4net.Repository;
40using Nini.Config;
41using OpenSim.Framework.Console;
42using OpenSim.Framework.Monitoring;
43
44namespace OpenSim.Framework.Servers
45{
46 public class ServerBase
47 {
48 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
49
50 public IConfigSource Config { get; protected set; }
51
52 /// <summary>
53 /// Console to be used for any command line output. Can be null, in which case there should be no output.
54 /// </summary>
55 protected ICommandConsole m_console;
56
57 protected OpenSimAppender m_consoleAppender;
58 protected FileAppender m_logFileAppender;
59
60 protected DateTime m_startuptime;
61 protected string m_startupDirectory = Environment.CurrentDirectory;
62
63 protected string m_pidFile = String.Empty;
64
65 /// <summary>
66 /// Server version information. Usually VersionInfo + information about git commit, operating system, etc.
67 /// </summary>
68 protected string m_version;
69
70 public ServerBase()
71 {
72 m_startuptime = DateTime.Now;
73 m_version = VersionInfo.Version;
74 EnhanceVersionInformation();
75 }
76
77 protected void CreatePIDFile(string path)
78 {
79 try
80 {
81 string pidstring = System.Diagnostics.Process.GetCurrentProcess().Id.ToString();
82
83 using (FileStream fs = File.Create(path))
84 {
85 Byte[] buf = Encoding.ASCII.GetBytes(pidstring);
86 fs.Write(buf, 0, buf.Length);
87 }
88
89 m_pidFile = path;
90
91 m_log.InfoFormat("[SERVER BASE]: Created pid file {0}", m_pidFile);
92 }
93 catch (Exception e)
94 {
95 m_log.Warn(string.Format("[SERVER BASE]: Could not create PID file at {0} ", path), e);
96 }
97 }
98
99 protected void RemovePIDFile()
100 {
101 if (m_pidFile != String.Empty)
102 {
103 try
104 {
105 File.Delete(m_pidFile);
106 }
107 catch (Exception e)
108 {
109 m_log.Error(string.Format("[SERVER BASE]: Error whilst removing {0} ", m_pidFile), e);
110 }
111
112 m_pidFile = String.Empty;
113 }
114 }
115
116 public void RegisterCommonAppenders(IConfig startupConfig)
117 {
118 ILoggerRepository repository = LogManager.GetRepository();
119 IAppender[] appenders = repository.GetAppenders();
120
121 foreach (IAppender appender in appenders)
122 {
123 if (appender.Name == "Console")
124 {
125 m_consoleAppender = (OpenSimAppender)appender;
126 }
127 else if (appender.Name == "LogFileAppender")
128 {
129 m_logFileAppender = (FileAppender)appender;
130 }
131 }
132
133 if (null == m_consoleAppender)
134 {
135 Notice("No appender named Console found (see the log4net config file for this executable)!");
136 }
137 else
138 {
139 // FIXME: This should be done through an interface rather than casting.
140 m_consoleAppender.Console = (ConsoleBase)m_console;
141
142 // If there is no threshold set then the threshold is effectively everything.
143 if (null == m_consoleAppender.Threshold)
144 m_consoleAppender.Threshold = Level.All;
145
146 Notice(String.Format("Console log level is {0}", m_consoleAppender.Threshold));
147 }
148
149 if (m_logFileAppender != null && startupConfig != null)
150 {
151 string cfgFileName = startupConfig.GetString("LogFile", null);
152 if (cfgFileName != null)
153 {
154 m_logFileAppender.File = cfgFileName;
155 m_logFileAppender.ActivateOptions();
156 }
157
158 m_log.InfoFormat("[SERVER BASE]: Logging started to file {0}", m_logFileAppender.File);
159 }
160 }
161
162 /// <summary>
163 /// Register common commands once m_console has been set if it is going to be set
164 /// </summary>
165 public void RegisterCommonCommands()
166 {
167 if (m_console == null)
168 return;
169
170 m_console.Commands.AddCommand(
171 "General", false, "show info", "show info", "Show general information about the server", HandleShow);
172
173 m_console.Commands.AddCommand(
174 "General", false, "show version", "show version", "Show server version", HandleShow);
175
176 m_console.Commands.AddCommand(
177 "General", false, "show uptime", "show uptime", "Show server uptime", HandleShow);
178
179 m_console.Commands.AddCommand(
180 "General", false, "get log level", "get log level", "Get the current console logging level",
181 (mod, cmd) => ShowLogLevel());
182
183 m_console.Commands.AddCommand(
184 "General", false, "set log level", "set log level <level>",
185 "Set the console logging level for this session.", HandleSetLogLevel);
186
187 m_console.Commands.AddCommand(
188 "General", false, "config set",
189 "config set <section> <key> <value>",
190 "Set a config option. In most cases this is not useful since changed parameters are not dynamically reloaded. Neither do changed parameters persist - you will have to change a config file manually and restart.", HandleConfig);
191
192 m_console.Commands.AddCommand(
193 "General", false, "config get",
194 "config get [<section>] [<key>]",
195 "Synonym for config show",
196 HandleConfig);
197
198 m_console.Commands.AddCommand(
199 "General", false, "config show",
200 "config show [<section>] [<key>]",
201 "Show config information",
202 "If neither section nor field are specified, then the whole current configuration is printed." + Environment.NewLine
203 + "If a section is given but not a field, then all fields in that section are printed.",
204 HandleConfig);
205
206 m_console.Commands.AddCommand(
207 "General", false, "config save",
208 "config save <path>",
209 "Save current configuration to a file at the given path", HandleConfig);
210
211 m_console.Commands.AddCommand(
212 "General", false, "command-script",
213 "command-script <script>",
214 "Run a command script from file", HandleScript);
215
216 m_console.Commands.AddCommand(
217 "General", false, "show threads",
218 "show threads",
219 "Show thread status", HandleShow);
220
221 m_console.Commands.AddCommand(
222 "General", false, "threads abort",
223 "threads abort <thread-id>",
224 "Abort a managed thread. Use \"show threads\" to find possible threads.", HandleThreadsAbort);
225
226 m_console.Commands.AddCommand(
227 "General", false, "threads show",
228 "threads show",
229 "Show thread status. Synonym for \"show threads\"",
230 (string module, string[] args) => Notice(GetThreadsReport()));
231
232 m_console.Commands.AddCommand(
233 "General", false, "force gc",
234 "force gc",
235 "Manually invoke runtime garbage collection. For debugging purposes",
236 HandleForceGc);
237 }
238
239 private void HandleForceGc(string module, string[] args)
240 {
241 Notice("Manually invoking runtime garbage collection");
242 GC.Collect();
243 }
244
245 public virtual void HandleShow(string module, string[] cmd)
246 {
247 List<string> args = new List<string>(cmd);
248
249 args.RemoveAt(0);
250
251 string[] showParams = args.ToArray();
252
253 switch (showParams[0])
254 {
255 case "info":
256 ShowInfo();
257 break;
258
259 case "version":
260 Notice(GetVersionText());
261 break;
262
263 case "uptime":
264 Notice(GetUptimeReport());
265 break;
266
267 case "threads":
268 Notice(GetThreadsReport());
269 break;
270 }
271 }
272
273 /// <summary>
274 /// Change and load configuration file data.
275 /// </summary>
276 /// <param name="module"></param>
277 /// <param name="cmd"></param>
278 private void HandleConfig(string module, string[] cmd)
279 {
280 List<string> args = new List<string>(cmd);
281 args.RemoveAt(0);
282 string[] cmdparams = args.ToArray();
283
284 if (cmdparams.Length > 0)
285 {
286 string firstParam = cmdparams[0].ToLower();
287
288 switch (firstParam)
289 {
290 case "set":
291 if (cmdparams.Length < 4)
292 {
293 Notice("Syntax: config set <section> <key> <value>");
294 Notice("Example: config set ScriptEngine.DotNetEngine NumberOfScriptThreads 5");
295 }
296 else
297 {
298 IConfig c;
299 IConfigSource source = new IniConfigSource();
300 c = source.AddConfig(cmdparams[1]);
301 if (c != null)
302 {
303 string _value = String.Join(" ", cmdparams, 3, cmdparams.Length - 3);
304 c.Set(cmdparams[2], _value);
305 Config.Merge(source);
306
307 Notice("In section [{0}], set {1} = {2}", c.Name, cmdparams[2], _value);
308 }
309 }
310 break;
311
312 case "get":
313 case "show":
314 if (cmdparams.Length == 1)
315 {
316 foreach (IConfig config in Config.Configs)
317 {
318 Notice("[{0}]", config.Name);
319 string[] keys = config.GetKeys();
320 foreach (string key in keys)
321 Notice(" {0} = {1}", key, config.GetString(key));
322 }
323 }
324 else if (cmdparams.Length == 2 || cmdparams.Length == 3)
325 {
326 IConfig config = Config.Configs[cmdparams[1]];
327 if (config == null)
328 {
329 Notice("Section \"{0}\" does not exist.",cmdparams[1]);
330 break;
331 }
332 else
333 {
334 if (cmdparams.Length == 2)
335 {
336 Notice("[{0}]", config.Name);
337 foreach (string key in config.GetKeys())
338 Notice(" {0} = {1}", key, config.GetString(key));
339 }
340 else
341 {
342 Notice(
343 "config get {0} {1} : {2}",
344 cmdparams[1], cmdparams[2], config.GetString(cmdparams[2]));
345 }
346 }
347 }
348 else
349 {
350 Notice("Syntax: config {0} [<section>] [<key>]", firstParam);
351 Notice("Example: config {0} ScriptEngine.DotNetEngine NumberOfScriptThreads", firstParam);
352 }
353
354 break;
355
356 case "save":
357 if (cmdparams.Length < 2)
358 {
359 Notice("Syntax: config save <path>");
360 return;
361 }
362
363 string path = cmdparams[1];
364 Notice("Saving configuration file: {0}", path);
365
366 if (Config is IniConfigSource)
367 {
368 IniConfigSource iniCon = (IniConfigSource)Config;
369 iniCon.Save(path);
370 }
371 else if (Config is XmlConfigSource)
372 {
373 XmlConfigSource xmlCon = (XmlConfigSource)Config;
374 xmlCon.Save(path);
375 }
376
377 break;
378 }
379 }
380 }
381
382 private void HandleSetLogLevel(string module, string[] cmd)
383 {
384 if (cmd.Length != 4)
385 {
386 Notice("Usage: set log level <level>");
387 return;
388 }
389
390 if (null == m_consoleAppender)
391 {
392 Notice("No appender named Console found (see the log4net config file for this executable)!");
393 return;
394 }
395
396 string rawLevel = cmd[3];
397
398 ILoggerRepository repository = LogManager.GetRepository();
399 Level consoleLevel = repository.LevelMap[rawLevel];
400
401 if (consoleLevel != null)
402 m_consoleAppender.Threshold = consoleLevel;
403 else
404 Notice(
405 "{0} is not a valid logging level. Valid logging levels are ALL, DEBUG, INFO, WARN, ERROR, FATAL, OFF",
406 rawLevel);
407
408 ShowLogLevel();
409 }
410
411 private void ShowLogLevel()
412 {
413 Notice("Console log level is {0}", m_consoleAppender.Threshold);
414 }
415
416 protected virtual void HandleScript(string module, string[] parms)
417 {
418 if (parms.Length != 2)
419 {
420 Notice("Usage: command-script <path-to-script");
421 return;
422 }
423
424 RunCommandScript(parms[1]);
425 }
426
427 /// <summary>
428 /// Run an optional startup list of commands
429 /// </summary>
430 /// <param name="fileName"></param>
431 protected void RunCommandScript(string fileName)
432 {
433 if (m_console == null)
434 return;
435
436 if (File.Exists(fileName))
437 {
438 m_log.Info("[SERVER BASE]: Running " + fileName);
439
440 using (StreamReader readFile = File.OpenText(fileName))
441 {
442 string currentCommand;
443 while ((currentCommand = readFile.ReadLine()) != null)
444 {
445 currentCommand = currentCommand.Trim();
446 if (!(currentCommand == ""
447 || currentCommand.StartsWith(";")
448 || currentCommand.StartsWith("//")
449 || currentCommand.StartsWith("#")))
450 {
451 m_log.Info("[SERVER BASE]: Running '" + currentCommand + "'");
452 m_console.RunCommand(currentCommand);
453 }
454 }
455 }
456 }
457 }
458
459 /// <summary>
460 /// Return a report about the uptime of this server
461 /// </summary>
462 /// <returns></returns>
463 protected string GetUptimeReport()
464 {
465 StringBuilder sb = new StringBuilder(String.Format("Time now is {0}\n", DateTime.Now));
466 sb.Append(String.Format("Server has been running since {0}, {1}\n", m_startuptime.DayOfWeek, m_startuptime));
467 sb.Append(String.Format("That is an elapsed time of {0}\n", DateTime.Now - m_startuptime));
468
469 return sb.ToString();
470 }
471
472 protected void ShowInfo()
473 {
474 Notice(GetVersionText());
475 Notice("Startup directory: " + m_startupDirectory);
476 if (null != m_consoleAppender)
477 Notice(String.Format("Console log level: {0}", m_consoleAppender.Threshold));
478 }
479
480 /// <summary>
481 /// Enhance the version string with extra information if it's available.
482 /// </summary>
483 protected void EnhanceVersionInformation()
484 {
485 string buildVersion = string.Empty;
486
487 // The subversion information is deprecated and will be removed at a later date
488 // Add subversion revision information if available
489 // Try file "svn_revision" in the current directory first, then the .svn info.
490 // This allows to make the revision available in simulators not running from the source tree.
491 // FIXME: Making an assumption about the directory we're currently in - we do this all over the place
492 // elsewhere as well
493 string gitDir = "../.git/";
494 string gitRefPointerPath = gitDir + "HEAD";
495
496 string svnRevisionFileName = "svn_revision";
497 string svnFileName = ".svn/entries";
498 string manualVersionFileName = ".version";
499 string inputLine;
500 int strcmp;
501
502 if (File.Exists(manualVersionFileName))
503 {
504 using (StreamReader CommitFile = File.OpenText(manualVersionFileName))
505 buildVersion = CommitFile.ReadLine();
506
507 m_version += buildVersion ?? "";
508 }
509 else if (File.Exists(gitRefPointerPath))
510 {
511// m_log.DebugFormat("[SERVER BASE]: Found {0}", gitRefPointerPath);
512
513 string rawPointer = "";
514
515 using (StreamReader pointerFile = File.OpenText(gitRefPointerPath))
516 rawPointer = pointerFile.ReadLine();
517
518// m_log.DebugFormat("[SERVER BASE]: rawPointer [{0}]", rawPointer);
519
520 Match m = Regex.Match(rawPointer, "^ref: (.+)$");
521
522 if (m.Success)
523 {
524// m_log.DebugFormat("[SERVER BASE]: Matched [{0}]", m.Groups[1].Value);
525
526 string gitRef = m.Groups[1].Value;
527 string gitRefPath = gitDir + gitRef;
528 if (File.Exists(gitRefPath))
529 {
530// m_log.DebugFormat("[SERVER BASE]: Found gitRefPath [{0}]", gitRefPath);
531
532 using (StreamReader refFile = File.OpenText(gitRefPath))
533 {
534 string gitHash = refFile.ReadLine();
535 m_version += gitHash.Substring(0, 7);
536 }
537 }
538 }
539 }
540 else
541 {
542 // Remove the else logic when subversion mirror is no longer used
543 if (File.Exists(svnRevisionFileName))
544 {
545 StreamReader RevisionFile = File.OpenText(svnRevisionFileName);
546 buildVersion = RevisionFile.ReadLine();
547 buildVersion.Trim();
548 RevisionFile.Close();
549 }
550
551 if (string.IsNullOrEmpty(buildVersion) && File.Exists(svnFileName))
552 {
553 StreamReader EntriesFile = File.OpenText(svnFileName);
554 inputLine = EntriesFile.ReadLine();
555 while (inputLine != null)
556 {
557 // using the dir svn revision at the top of entries file
558 strcmp = String.Compare(inputLine, "dir");
559 if (strcmp == 0)
560 {
561 buildVersion = EntriesFile.ReadLine();
562 break;
563 }
564 else
565 {
566 inputLine = EntriesFile.ReadLine();
567 }
568 }
569 EntriesFile.Close();
570 }
571
572 m_version += string.IsNullOrEmpty(buildVersion) ? " " : ("." + buildVersion + " ").Substring(0, 6);
573 }
574 }
575
576 protected string GetVersionText()
577 {
578 return String.Format("Version: {0} (interface version {1})", m_version, VersionInfo.MajorInterfaceVersion);
579 }
580
581 /// <summary>
582 /// Get a report about the registered threads in this server.
583 /// </summary>
584 protected string GetThreadsReport()
585 {
586 // This should be a constant field.
587 string reportFormat = "{0,6} {1,35} {2,16} {3,13} {4,10} {5,30}";
588
589 StringBuilder sb = new StringBuilder();
590 Watchdog.ThreadWatchdogInfo[] threads = Watchdog.GetThreadsInfo();
591
592 sb.Append(threads.Length + " threads are being tracked:" + Environment.NewLine);
593
594 int timeNow = Environment.TickCount & Int32.MaxValue;
595
596 sb.AppendFormat(reportFormat, "ID", "NAME", "LAST UPDATE (MS)", "LIFETIME (MS)", "PRIORITY", "STATE");
597 sb.Append(Environment.NewLine);
598
599 foreach (Watchdog.ThreadWatchdogInfo twi in threads)
600 {
601 Thread t = twi.Thread;
602
603 sb.AppendFormat(
604 reportFormat,
605 t.ManagedThreadId,
606 t.Name,
607 timeNow - twi.LastTick,
608 timeNow - twi.FirstTick,
609 t.Priority,
610 t.ThreadState);
611
612 sb.Append("\n");
613 }
614
615 sb.Append("\n");
616
617 // For some reason mono 2.6.7 returns an empty threads set! Not going to confuse people by reporting
618 // zero active threads.
619 int totalThreads = Process.GetCurrentProcess().Threads.Count;
620 if (totalThreads > 0)
621 sb.AppendFormat("Total threads active: {0}\n\n", totalThreads);
622
623 sb.Append("Main threadpool (excluding script engine pools)\n");
624 sb.Append(Util.GetThreadPoolReport());
625
626 return sb.ToString();
627 }
628
629 public virtual void HandleThreadsAbort(string module, string[] cmd)
630 {
631 if (cmd.Length != 3)
632 {
633 MainConsole.Instance.Output("Usage: threads abort <thread-id>");
634 return;
635 }
636
637 int threadId;
638 if (!int.TryParse(cmd[2], out threadId))
639 {
640 MainConsole.Instance.Output("ERROR: Thread id must be an integer");
641 return;
642 }
643
644 if (Watchdog.AbortThread(threadId))
645 MainConsole.Instance.OutputFormat("Aborted thread with id {0}", threadId);
646 else
647 MainConsole.Instance.OutputFormat("ERROR - Thread with id {0} not found in managed threads", threadId);
648 }
649
650 /// <summary>
651 /// Console output is only possible if a console has been established.
652 /// That is something that cannot be determined within this class. So
653 /// all attempts to use the console MUST be verified.
654 /// </summary>
655 /// <param name="msg"></param>
656 protected void Notice(string msg)
657 {
658 if (m_console != null)
659 {
660 m_console.Output(msg);
661 }
662 }
663
664 /// <summary>
665 /// Console output is only possible if a console has been established.
666 /// That is something that cannot be determined within this class. So
667 /// all attempts to use the console MUST be verified.
668 /// </summary>
669 /// <param name="format"></param>
670 /// <param name="components"></param>
671 protected void Notice(string format, params object[] components)
672 {
673 if (m_console != null)
674 m_console.OutputFormat(format, components);
675 }
676 }
677} \ No newline at end of file
diff --git a/OpenSim/Framework/Servers/Tests/OSHttpTests.cs b/OpenSim/Framework/Servers/Tests/OSHttpTests.cs
index dc4eb8f..3412e0f 100644
--- a/OpenSim/Framework/Servers/Tests/OSHttpTests.cs
+++ b/OpenSim/Framework/Servers/Tests/OSHttpTests.cs
@@ -35,11 +35,12 @@ using HttpServer;
35using HttpServer.FormDecoders; 35using HttpServer.FormDecoders;
36using NUnit.Framework; 36using NUnit.Framework;
37using OpenSim.Framework.Servers.HttpServer; 37using OpenSim.Framework.Servers.HttpServer;
38using OpenSim.Tests.Common;
38 39
39namespace OpenSim.Framework.Servers.Tests 40namespace OpenSim.Framework.Servers.Tests
40{ 41{
41 [TestFixture] 42 [TestFixture]
42 public class OSHttpTests 43 public class OSHttpTests : OpenSimTestCase
43 { 44 {
44 // we need an IHttpClientContext for our tests 45 // we need an IHttpClientContext for our tests
45 public class TestHttpClientContext: IHttpClientContext 46 public class TestHttpClientContext: IHttpClientContext
diff --git a/OpenSim/Framework/Servers/Tests/VersionInfoTests.cs b/OpenSim/Framework/Servers/Tests/VersionInfoTests.cs
index 49e5061..480f2bb 100644
--- a/OpenSim/Framework/Servers/Tests/VersionInfoTests.cs
+++ b/OpenSim/Framework/Servers/Tests/VersionInfoTests.cs
@@ -29,11 +29,12 @@ using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Text; 30using System.Text;
31using NUnit.Framework; 31using NUnit.Framework;
32using OpenSim.Tests.Common;
32 33
33namespace OpenSim.Framework.Servers.Tests 34namespace OpenSim.Framework.Servers.Tests
34{ 35{
35 [TestFixture] 36 [TestFixture]
36 public class VersionInfoTests 37 public class VersionInfoTests : OpenSimTestCase
37 { 38 {
38 [Test] 39 [Test]
39 public void TestVersionLength() 40 public void TestVersionLength()
diff --git a/OpenSim/Framework/TaskInventoryDictionary.cs b/OpenSim/Framework/TaskInventoryDictionary.cs
index 421bd5d..8af2c41 100644
--- a/OpenSim/Framework/TaskInventoryDictionary.cs
+++ b/OpenSim/Framework/TaskInventoryDictionary.cs
@@ -35,10 +35,12 @@ using OpenMetaverse;
35namespace OpenSim.Framework 35namespace OpenSim.Framework
36{ 36{
37 /// <summary> 37 /// <summary>
38 /// A dictionary for task inventory. 38 /// A dictionary containing task inventory items. Indexed by item UUID.
39 /// </summary> 39 /// </summary>
40 /// <remarks>
40 /// This class is not thread safe. Callers must synchronize on Dictionary methods or Clone() this object before 41 /// This class is not thread safe. Callers must synchronize on Dictionary methods or Clone() this object before
41 /// iterating over it. 42 /// iterating over it.
43 /// </remarks>
42 public class TaskInventoryDictionary : Dictionary<UUID, TaskInventoryItem>, 44 public class TaskInventoryDictionary : Dictionary<UUID, TaskInventoryItem>,
43 ICloneable, IXmlSerializable 45 ICloneable, IXmlSerializable
44 { 46 {
diff --git a/OpenSim/Framework/TaskInventoryItem.cs b/OpenSim/Framework/TaskInventoryItem.cs
index 3b40381..a06f8e7 100644
--- a/OpenSim/Framework/TaskInventoryItem.cs
+++ b/OpenSim/Framework/TaskInventoryItem.cs
@@ -73,9 +73,6 @@ namespace OpenSim.Framework
73 73
74 private bool _ownerChanged = false; 74 private bool _ownerChanged = false;
75 75
76 // This used ONLY during copy. It can't be relied on at other times!
77 private bool _scriptRunning = true;
78
79 public UUID AssetID { 76 public UUID AssetID {
80 get { 77 get {
81 return _assetID; 78 return _assetID;
@@ -353,14 +350,13 @@ namespace OpenSim.Framework
353 } 350 }
354 } 351 }
355 352
356 public bool ScriptRunning { 353 /// <summary>
357 get { 354 /// This used ONLY during copy. It can't be relied on at other times!
358 return _scriptRunning; 355 /// </summary>
359 } 356 /// <remarks>
360 set { 357 /// For true script running status, use IEntityInventory.TryGetScriptInstanceRunning() for now.
361 _scriptRunning = value; 358 /// </remarks>
362 } 359 public bool ScriptRunning { get; set; }
363 }
364 360
365 // See ICloneable 361 // See ICloneable
366 362
@@ -388,6 +384,7 @@ namespace OpenSim.Framework
388 384
389 public TaskInventoryItem() 385 public TaskInventoryItem()
390 { 386 {
387 ScriptRunning = true;
391 CreationDate = (uint)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; 388 CreationDate = (uint)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
392 } 389 }
393 } 390 }
diff --git a/OpenSim/Framework/Tests/AgentCircuitDataTest.cs b/OpenSim/Framework/Tests/AgentCircuitDataTest.cs
index 0dce414..95e9439 100644
--- a/OpenSim/Framework/Tests/AgentCircuitDataTest.cs
+++ b/OpenSim/Framework/Tests/AgentCircuitDataTest.cs
@@ -24,16 +24,17 @@
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 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. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27
27using System.Collections.Generic; 28using System.Collections.Generic;
28using OpenMetaverse; 29using OpenMetaverse;
29using OpenMetaverse.StructuredData; 30using OpenMetaverse.StructuredData;
30using NUnit.Framework; 31using NUnit.Framework;
31 32using OpenSim.Tests.Common;
32 33
33namespace OpenSim.Framework.Tests 34namespace OpenSim.Framework.Tests
34{ 35{
35 [TestFixture] 36 [TestFixture]
36 public class AgentCircuitDataTest 37 public class AgentCircuitDataTest : OpenSimTestCase
37 { 38 {
38 private UUID AgentId; 39 private UUID AgentId;
39 private AvatarAppearance AvAppearance; 40 private AvatarAppearance AvAppearance;
diff --git a/OpenSim/Framework/Tests/AnimationTests.cs b/OpenSim/Framework/Tests/AnimationTests.cs
index 967a355..f3be81b 100644
--- a/OpenSim/Framework/Tests/AnimationTests.cs
+++ b/OpenSim/Framework/Tests/AnimationTests.cs
@@ -38,7 +38,7 @@ using Animation = OpenSim.Framework.Animation;
38namespace OpenSim.Framework.Tests 38namespace OpenSim.Framework.Tests
39{ 39{
40 [TestFixture] 40 [TestFixture]
41 public class AnimationTests 41 public class AnimationTests : OpenSimTestCase
42 { 42 {
43 private Animation anim1 = null; 43 private Animation anim1 = null;
44 private Animation anim2 = null; 44 private Animation anim2 = null;
diff --git a/OpenSim/Framework/Tests/AssetBaseTest.cs b/OpenSim/Framework/Tests/AssetBaseTest.cs
index 6db1aa0..25d2393 100644
--- a/OpenSim/Framework/Tests/AssetBaseTest.cs
+++ b/OpenSim/Framework/Tests/AssetBaseTest.cs
@@ -30,11 +30,12 @@ using System.Collections.Generic;
30using System.Text; 30using System.Text;
31using NUnit.Framework; 31using NUnit.Framework;
32using OpenMetaverse; 32using OpenMetaverse;
33using OpenSim.Tests.Common;
33 34
34namespace OpenSim.Framework.Tests 35namespace OpenSim.Framework.Tests
35{ 36{
36 [TestFixture] 37 [TestFixture]
37 public class AssetBaseTest 38 public class AssetBaseTest : OpenSimTestCase
38 { 39 {
39 [Test] 40 [Test]
40 public void TestContainsReferences() 41 public void TestContainsReferences()
diff --git a/OpenSim/Framework/Tests/CacheTests.cs b/OpenSim/Framework/Tests/CacheTests.cs
index c3613e6..c709860 100644
--- a/OpenSim/Framework/Tests/CacheTests.cs
+++ b/OpenSim/Framework/Tests/CacheTests.cs
@@ -28,11 +28,12 @@
28using System; 28using System;
29using NUnit.Framework; 29using NUnit.Framework;
30using OpenMetaverse; 30using OpenMetaverse;
31using OpenSim.Tests.Common;
31 32
32namespace OpenSim.Framework.Tests 33namespace OpenSim.Framework.Tests
33{ 34{
34 [TestFixture] 35 [TestFixture]
35 public class CacheTests 36 public class CacheTests : OpenSimTestCase
36 { 37 {
37 private Cache cache; 38 private Cache cache;
38 private UUID cacheItemUUID; 39 private UUID cacheItemUUID;
diff --git a/OpenSim/Framework/Tests/LocationTest.cs b/OpenSim/Framework/Tests/LocationTest.cs
index 2707afa..a56ecb4 100644
--- a/OpenSim/Framework/Tests/LocationTest.cs
+++ b/OpenSim/Framework/Tests/LocationTest.cs
@@ -26,11 +26,12 @@
26 */ 26 */
27 27
28using NUnit.Framework; 28using NUnit.Framework;
29using OpenSim.Tests.Common;
29 30
30namespace OpenSim.Framework.Tests 31namespace OpenSim.Framework.Tests
31{ 32{
32 [TestFixture] 33 [TestFixture]
33 public class LocationTest 34 public class LocationTest : OpenSimTestCase
34 { 35 {
35 [Test] 36 [Test]
36 public void locationRegionHandleRegionHandle() 37 public void locationRegionHandleRegionHandle()
diff --git a/OpenSim/Framework/Tests/MundaneFrameworkTests.cs b/OpenSim/Framework/Tests/MundaneFrameworkTests.cs
index 672847d..47fe599 100644
--- a/OpenSim/Framework/Tests/MundaneFrameworkTests.cs
+++ b/OpenSim/Framework/Tests/MundaneFrameworkTests.cs
@@ -32,11 +32,12 @@ using OpenMetaverse.StructuredData;
32using System; 32using System;
33using System.Globalization; 33using System.Globalization;
34using System.Threading; 34using System.Threading;
35using OpenSim.Tests.Common;
35 36
36namespace OpenSim.Framework.Tests 37namespace OpenSim.Framework.Tests
37{ 38{
38 [TestFixture] 39 [TestFixture]
39 public class MundaneFrameworkTests 40 public class MundaneFrameworkTests : OpenSimTestCase
40 { 41 {
41 private bool m_RegionSettingsOnSaveEventFired; 42 private bool m_RegionSettingsOnSaveEventFired;
42 private bool m_RegionLightShareDataOnSaveEventFired; 43 private bool m_RegionLightShareDataOnSaveEventFired;
diff --git a/OpenSim/Framework/Tests/PrimeNumberHelperTests.cs b/OpenSim/Framework/Tests/PrimeNumberHelperTests.cs
index 36bc6e7..82e13e5 100644
--- a/OpenSim/Framework/Tests/PrimeNumberHelperTests.cs
+++ b/OpenSim/Framework/Tests/PrimeNumberHelperTests.cs
@@ -31,11 +31,12 @@ using NUnit.Framework;
31using OpenMetaverse; 31using OpenMetaverse;
32using OpenMetaverse.StructuredData; 32using OpenMetaverse.StructuredData;
33using OpenSim.Framework; 33using OpenSim.Framework;
34using OpenSim.Tests.Common;
34 35
35namespace OpenSim.Framework.Tests 36namespace OpenSim.Framework.Tests
36{ 37{
37 [TestFixture] 38 [TestFixture]
38 public class PrimeNumberHelperTests 39 public class PrimeNumberHelperTests : OpenSimTestCase
39 { 40 {
40 [Test] 41 [Test]
41 public void TestGetPrime() 42 public void TestGetPrime()
diff --git a/OpenSim/Framework/Tests/UtilTest.cs b/OpenSim/Framework/Tests/UtilTest.cs
index f0d2a3f..11ca068 100644
--- a/OpenSim/Framework/Tests/UtilTest.cs
+++ b/OpenSim/Framework/Tests/UtilTest.cs
@@ -33,7 +33,7 @@ using OpenSim.Tests.Common;
33namespace OpenSim.Framework.Tests 33namespace OpenSim.Framework.Tests
34{ 34{
35 [TestFixture] 35 [TestFixture]
36 public class UtilTests 36 public class UtilTests : OpenSimTestCase
37 { 37 {
38 [Test] 38 [Test]
39 public void VectorOperationTests() 39 public void VectorOperationTests()
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs
index 5c7797a..a0c54a0 100644
--- a/OpenSim/Framework/Util.cs
+++ b/OpenSim/Framework/Util.cs
@@ -536,7 +536,7 @@ namespace OpenSim.Framework
536 /// <summary> 536 /// <summary>
537 /// Determines whether a point is inside a bounding box. 537 /// Determines whether a point is inside a bounding box.
538 /// </summary> 538 /// </summary>
539 /// <param name='v'>/param> 539 /// <param name='v'></param>
540 /// <param name='min'></param> 540 /// <param name='min'></param>
541 /// <param name='max'></param> 541 /// <param name='max'></param>
542 /// <returns></returns> 542 /// <returns></returns>
@@ -1741,12 +1741,16 @@ namespace OpenSim.Framework
1741 StringBuilder sb = new StringBuilder(); 1741 StringBuilder sb = new StringBuilder();
1742 if (FireAndForgetMethod == FireAndForgetMethod.SmartThreadPool) 1742 if (FireAndForgetMethod == FireAndForgetMethod.SmartThreadPool)
1743 { 1743 {
1744 threadPoolUsed = "SmartThreadPool"; 1744 // ROBUST currently leaves this the FireAndForgetMethod but never actually initializes the threadpool.
1745 maxThreads = m_ThreadPool.MaxThreads; 1745 if (m_ThreadPool != null)
1746 minThreads = m_ThreadPool.MinThreads; 1746 {
1747 inUseThreads = m_ThreadPool.InUseThreads; 1747 threadPoolUsed = "SmartThreadPool";
1748 allocatedThreads = m_ThreadPool.ActiveThreads; 1748 maxThreads = m_ThreadPool.MaxThreads;
1749 waitingCallbacks = m_ThreadPool.WaitingCallbacks; 1749 minThreads = m_ThreadPool.MinThreads;
1750 inUseThreads = m_ThreadPool.InUseThreads;
1751 allocatedThreads = m_ThreadPool.ActiveThreads;
1752 waitingCallbacks = m_ThreadPool.WaitingCallbacks;
1753 }
1750 } 1754 }
1751 else if ( 1755 else if (
1752 FireAndForgetMethod == FireAndForgetMethod.UnsafeQueueUserWorkItem 1756 FireAndForgetMethod == FireAndForgetMethod.UnsafeQueueUserWorkItem