Merge branch 'ubitwork' of ssh://3dhosting.de/var/git/careminster into ubitwork
commit
5d4b7d537d
|
@ -29,9 +29,14 @@ addon-modules/
|
||||||
bin/Debug/*.dll
|
bin/Debug/*.dll
|
||||||
bin/*.dll.mdb
|
bin/*.dll.mdb
|
||||||
bin/*.db
|
bin/*.db
|
||||||
|
bin/*.db-journal
|
||||||
bin/addin-db-*
|
bin/addin-db-*
|
||||||
bin/*.dll
|
bin/*.dll
|
||||||
bin/OpenSim.vshost.exe.config
|
bin/OpenSim.vshost.exe.config
|
||||||
|
bin/OpenSim.32BitLaunch.vshost.exe.config
|
||||||
|
bin/OpenSim.32BitLaunch.log
|
||||||
|
UpgradeLog.XML
|
||||||
|
_UpgradeReport_Files/
|
||||||
bin/ScriptEngines/*-*-*-*-*
|
bin/ScriptEngines/*-*-*-*-*
|
||||||
bin/ScriptEngines/*.dll
|
bin/ScriptEngines/*.dll
|
||||||
bin/ScriptEngines/*/*.dll
|
bin/ScriptEngines/*/*.dll
|
||||||
|
@ -64,6 +69,7 @@ Examples/*.dll
|
||||||
OpenSim.build
|
OpenSim.build
|
||||||
OpenSim.sln
|
OpenSim.sln
|
||||||
OpenSim.suo
|
OpenSim.suo
|
||||||
|
OpenSim.userprefs
|
||||||
Prebuild/Prebuild.build
|
Prebuild/Prebuild.build
|
||||||
Prebuild/Prebuild.sln
|
Prebuild/Prebuild.sln
|
||||||
TestResult.xml
|
TestResult.xml
|
||||||
|
|
|
@ -132,17 +132,38 @@
|
||||||
</exec>
|
</exec>
|
||||||
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.capabilities.handlers.tests)==0}" />
|
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.capabilities.handlers.tests)==0}" />
|
||||||
|
|
||||||
|
<exec program="${nunitcmd}" failonerror="true" resultproperty="testresult.opensim.server.handlers.tests">
|
||||||
|
<arg value="./bin/OpenSim.Server.Handlers.Tests.dll" />
|
||||||
|
</exec>
|
||||||
|
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.server.handlers.tests)==0}" />
|
||||||
|
|
||||||
|
<exec program="${nunitcmd}" failonerror="true" resultproperty="testresult.opensim.services.inventoryservice.tests">
|
||||||
|
<arg value="./bin/OpenSim.Services.InventoryService.Tests.dll" />
|
||||||
|
</exec>
|
||||||
|
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.services.inventoryservice.tests)==0}" />
|
||||||
|
|
||||||
<delete dir="%temp%"/>
|
<delete dir="%temp%"/>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="torture" depends="build, find-nunit">
|
<target name="test-stress" depends="build, find-nunit">
|
||||||
<setenv name="MONO_THREADS_PER_CPU" value="100" />
|
<setenv name="MONO_THREADS_PER_CPU" value="100" />
|
||||||
|
|
||||||
<exec program="${nunitcmd}" failonerror="true" resultproperty="testresult.opensim.tests.torture">
|
<exec program="${nunitcmd}" failonerror="true" resultproperty="testresult.opensim.tests.stress">
|
||||||
<arg value="./bin/OpenSim.Tests.Torture.dll" />
|
<arg value="./bin/OpenSim.Tests.Stress.dll" />
|
||||||
</exec>
|
</exec>
|
||||||
|
|
||||||
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.tests.torture)==0}" />
|
<fail message="Failures reported in stress tests." unless="${int::parse(testresult.opensim.tests.stress)==0}" />
|
||||||
|
<delete dir="%temp%"/>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="test-perf" depends="build, find-nunit">
|
||||||
|
<setenv name="MONO_THREADS_PER_CPU" value="100" />
|
||||||
|
|
||||||
|
<exec program="${nunitcmd}" failonerror="true" resultproperty="testresult.opensim.tests.performance">
|
||||||
|
<arg value="./bin/OpenSim.Tests.Performance.dll" />
|
||||||
|
</exec>
|
||||||
|
|
||||||
|
<fail message="Failures reported in performance tests." unless="${int::parse(testresult.opensim.tests.performance)==0}" />
|
||||||
<delete dir="%temp%"/>
|
<delete dir="%temp%"/>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
|
@ -224,6 +245,16 @@
|
||||||
<arg value="-xml=test-results/OpenSim.Capabilities.Handlers.Tests.dll-Results.xml" />
|
<arg value="-xml=test-results/OpenSim.Capabilities.Handlers.Tests.dll-Results.xml" />
|
||||||
</exec>
|
</exec>
|
||||||
|
|
||||||
|
<exec program="${nunitcmd}" failonerror="false" resultproperty="testresult.opensim.server.handlers.tests">
|
||||||
|
<arg value="./bin/OpenSim.Server.Handlers.Tests.dll" />
|
||||||
|
<arg value="-xml=test-results/OpenSim.Server.Handlers.Tests.dll-Results.xml" />
|
||||||
|
</exec>
|
||||||
|
|
||||||
|
<exec program="${nunitcmd}" failonerror="false" resultproperty="testresult.opensim.services.inventoryservice.tests">
|
||||||
|
<arg value="./bin/OpenSim.Services.InventoryService.Tests.dll" />
|
||||||
|
<arg value="-xml=test-results/OpenSim.Services.InventoryService.Tests.dll-Results.xml" />
|
||||||
|
</exec>
|
||||||
|
|
||||||
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.tests)==0}" />
|
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.tests)==0}" />
|
||||||
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.framework.tests)==0}" />
|
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.framework.tests)==0}" />
|
||||||
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.framework.servers.tests)==0}" />
|
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.framework.servers.tests)==0}" />
|
||||||
|
@ -234,6 +265,7 @@
|
||||||
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.region.framework.tests)==0}" />
|
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.region.framework.tests)==0}" />
|
||||||
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.data.tests)==0}" />
|
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.data.tests)==0}" />
|
||||||
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.capabilities.handlers.tests)==0}" />
|
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.capabilities.handlers.tests)==0}" />
|
||||||
|
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.services.inventoryservice.tests)==0}" />
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="doxygen">
|
<target name="doxygen">
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
==== Building OpenSim ====
|
# Building on Windows
|
||||||
|
|
||||||
=== Building on Windows ===
|
|
||||||
|
|
||||||
Steps:
|
Steps:
|
||||||
* runprebuild.bat
|
* runprebuild.bat
|
||||||
|
@ -9,16 +7,15 @@ Steps:
|
||||||
* copy OpenSim.ini.example to OpenSim.ini and other appropriate files in bin/config-include
|
* copy OpenSim.ini.example to OpenSim.ini and other appropriate files in bin/config-include
|
||||||
* run OpenSim.exe
|
* run OpenSim.exe
|
||||||
|
|
||||||
=== Building on Linux ===
|
# Building on Linux
|
||||||
|
|
||||||
Prereqs:
|
Prereqs:
|
||||||
* Mono >= 2.4.3
|
* Mono >= 2.4.3
|
||||||
* Nant >= 0.85
|
* Nant >= 0.85
|
||||||
* On some Linux distributions you may need to install additional packages.
|
* On some Linux distributions you may need to install additional packages.
|
||||||
See http://opensimulator.org/wiki/Dependencies for more information.
|
See http://opensimulator.org/wiki/Dependencies for more information.
|
||||||
|
* May also use xbuild (included in mono distributions)
|
||||||
* May also use xbuild (included in mono distributions)
|
* May use Monodevelop, a cross-platform IDE
|
||||||
* May use Monodevelop, a cross-platform IDE
|
|
||||||
|
|
||||||
From the distribution type:
|
From the distribution type:
|
||||||
* ./runprebuild.sh
|
* ./runprebuild.sh
|
||||||
|
@ -27,13 +24,13 @@ From the distribution type:
|
||||||
* copy OpenSim.ini.example to OpenSim.ini and other appropriate files in bin/config-include
|
* copy OpenSim.ini.example to OpenSim.ini and other appropriate files in bin/config-include
|
||||||
* run mono OpenSim.exe
|
* run mono OpenSim.exe
|
||||||
|
|
||||||
=== Using Monodevelop ===
|
# Using Monodevelop
|
||||||
|
|
||||||
From the distribution type:
|
From the distribution type:
|
||||||
* ./runprebuild.sh
|
* ./runprebuild.sh
|
||||||
* type monodevelop OpenSim.sln
|
* type monodevelop OpenSim.sln
|
||||||
|
|
||||||
=== References ===
|
# References
|
||||||
|
|
||||||
Helpful resources:
|
Helpful resources:
|
||||||
* http://opensimulator.org/wiki/Build_Instructions
|
* http://opensimulator.org/wiki/Build_Instructions
|
|
@ -1,5 +1,5 @@
|
||||||
<<<>>>>The following people have contributed to OpenSim (Thank you
|
<<<>>>>The following people have contributed to OpenSim (Thank you
|
||||||
for your effort!)
|
for your effort!)
|
||||||
|
|
||||||
= Current OpenSim Developers (in very rough order of appearance) =
|
= Current OpenSim Developers (in very rough order of appearance) =
|
||||||
These folks represent the current core team for OpenSim, and are the
|
These folks represent the current core team for OpenSim, and are the
|
||||||
|
@ -16,7 +16,7 @@ people that make the day to day of OpenSim happen.
|
||||||
* BlueWall (James Hughes)
|
* BlueWall (James Hughes)
|
||||||
* Nebadon Izumi (Michael Cerquoni, OSgrid)
|
* Nebadon Izumi (Michael Cerquoni, OSgrid)
|
||||||
* Snoopy Pfeffer
|
* Snoopy Pfeffer
|
||||||
* Richard Adams (Intel)
|
* Robert Adams (Intel)
|
||||||
|
|
||||||
= Core Developers Following the White Rabbit =
|
= Core Developers Following the White Rabbit =
|
||||||
Core developers who have temporarily (we hope) gone chasing the white rabbit.
|
Core developers who have temporarily (we hope) gone chasing the white rabbit.
|
||||||
|
@ -92,6 +92,8 @@ what it is today.
|
||||||
* Flyte Xevious
|
* Flyte Xevious
|
||||||
* Garmin Kawaguichi
|
* Garmin Kawaguichi
|
||||||
* Gryc Ueusp
|
* Gryc Ueusp
|
||||||
|
* Hiro Lecker
|
||||||
|
* Iain Oliver
|
||||||
* Imaze Rhiano
|
* Imaze Rhiano
|
||||||
* Intimidated
|
* Intimidated
|
||||||
* Jeremy Bongio (IBM)
|
* Jeremy Bongio (IBM)
|
||||||
|
@ -181,12 +183,14 @@ what it is today.
|
||||||
|
|
||||||
This software uses components from the following developers:
|
This software uses components from the following developers:
|
||||||
* Sleepycat Software (Berkeley DB)
|
* Sleepycat Software (Berkeley DB)
|
||||||
|
* Aurora-Sim (http://aurora-sim.org)
|
||||||
* SQLite (Public Domain)
|
* SQLite (Public Domain)
|
||||||
* XmlRpcCS (http://xmlrpccs.sf.net/)
|
* XmlRpcCS (http://xmlrpccs.sf.net/)
|
||||||
* MySQL, Inc. (MySQL Connector/NET)
|
* MySQL, Inc. (MySQL Connector/NET)
|
||||||
* NUnit (http://www.nunit.org)
|
* NUnit (http://www.nunit.org)
|
||||||
* AGEIA Inc. (PhysX)
|
* AGEIA Inc. (PhysX)
|
||||||
* Russel L. Smith (ODE)
|
* Russel L. Smith (ODE)
|
||||||
|
* Erwin Coumans (Bullet)
|
||||||
* Prebuild (http://sourceforge.net/projects/dnpb/)
|
* Prebuild (http://sourceforge.net/projects/dnpb/)
|
||||||
* LibOpenMetaverse (http://lib.openmetaverse.org/)
|
* LibOpenMetaverse (http://lib.openmetaverse.org/)
|
||||||
* DotNetOpenMail v0.5.8b (http://dotnetopenmail.sourceforge.net)
|
* DotNetOpenMail v0.5.8b (http://dotnetopenmail.sourceforge.net)
|
||||||
|
@ -208,3 +212,4 @@ In addition, we would like to thank:
|
||||||
* The NANT Developers
|
* The NANT Developers
|
||||||
* Microsoft (.NET, MSSQL-Adapters)
|
* Microsoft (.NET, MSSQL-Adapters)
|
||||||
*x
|
*x
|
||||||
|
|
||||||
|
|
|
@ -99,12 +99,12 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
|
||||||
RegionInfo[] regionsToLoad = regionLoader.LoadRegions();
|
RegionInfo[] regionsToLoad = regionLoader.LoadRegions();
|
||||||
|
|
||||||
m_log.Info("[LOAD REGIONS PLUGIN]: Loading specific shared modules...");
|
m_log.Info("[LOAD REGIONS PLUGIN]: Loading specific shared modules...");
|
||||||
m_log.Info("[LOAD REGIONS PLUGIN]: DynamicTextureModule...");
|
//m_log.Info("[LOAD REGIONS PLUGIN]: DynamicTextureModule...");
|
||||||
m_openSim.ModuleLoader.LoadDefaultSharedModule(new DynamicTextureModule());
|
//m_openSim.ModuleLoader.LoadDefaultSharedModule(new DynamicTextureModule());
|
||||||
m_log.Info("[LOAD REGIONS PLUGIN]: LoadImageURLModule...");
|
//m_log.Info("[LOAD REGIONS PLUGIN]: LoadImageURLModule...");
|
||||||
m_openSim.ModuleLoader.LoadDefaultSharedModule(new LoadImageURLModule());
|
//m_openSim.ModuleLoader.LoadDefaultSharedModule(new LoadImageURLModule());
|
||||||
m_log.Info("[LOAD REGIONS PLUGIN]: XMLRPCModule...");
|
//m_log.Info("[LOAD REGIONS PLUGIN]: XMLRPCModule...");
|
||||||
m_openSim.ModuleLoader.LoadDefaultSharedModule(new XMLRPCModule());
|
//m_openSim.ModuleLoader.LoadDefaultSharedModule(new XMLRPCModule());
|
||||||
// m_log.Info("[LOADREGIONSPLUGIN]: AssetTransactionModule...");
|
// m_log.Info("[LOADREGIONSPLUGIN]: AssetTransactionModule...");
|
||||||
// m_openSim.ModuleLoader.LoadDefaultSharedModule(new AssetTransactionModule());
|
// m_openSim.ModuleLoader.LoadDefaultSharedModule(new AssetTransactionModule());
|
||||||
m_log.Info("[LOAD REGIONS PLUGIN]: Done.");
|
m_log.Info("[LOAD REGIONS PLUGIN]: Done.");
|
||||||
|
@ -136,9 +136,6 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_openSim.ModuleLoader.PostInitialise();
|
|
||||||
m_openSim.ModuleLoader.ClearCache();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
|
|
|
@ -60,7 +60,7 @@ using System.Runtime.InteropServices;
|
||||||
//
|
//
|
||||||
// You can specify all the values or you can default the Build and Revision Numbers
|
// You can specify all the values or you can default the Build and Revision Numbers
|
||||||
// by using the '*' as shown below:
|
// by using the '*' as shown below:
|
||||||
// [assembly: AssemblyVersion("0.6.5.*")]
|
// [assembly: AssemblyVersion("0.7.5.*")]
|
||||||
|
|
||||||
[assembly : AssemblyVersion("0.6.5.*")]
|
[assembly : AssemblyVersion("0.7.5.*")]
|
||||||
[assembly : AssemblyFileVersion("0.6.5.0")]
|
[assembly : AssemblyFileVersion("0.6.5.0")]
|
|
@ -0,0 +1,33 @@
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
// General Information about an assembly is controlled through the following
|
||||||
|
// set of attributes. Change these attribute values to modify the information
|
||||||
|
// associated with an assembly.
|
||||||
|
[assembly: AssemblyTitle("OpenSim.ApplicationPlugins.RegionModulesController")]
|
||||||
|
[assembly: AssemblyDescription("")]
|
||||||
|
[assembly: AssemblyConfiguration("")]
|
||||||
|
[assembly: AssemblyCompany("http://opensimulator.org")]
|
||||||
|
[assembly: AssemblyProduct("OpenSim")]
|
||||||
|
[assembly: AssemblyCopyright("OpenSimulator developers")]
|
||||||
|
[assembly: AssemblyTrademark("")]
|
||||||
|
[assembly: AssemblyCulture("")]
|
||||||
|
|
||||||
|
// Setting ComVisible to false makes the types in this assembly not visible
|
||||||
|
// to COM components. If you need to access a type in this assembly from
|
||||||
|
// COM, set the ComVisible attribute to true on that type.
|
||||||
|
[assembly: ComVisible(false)]
|
||||||
|
|
||||||
|
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||||
|
[assembly: Guid("c023816d-194e-40c1-9195-a0f281d4ac5d")]
|
||||||
|
|
||||||
|
// Version information for an assembly consists of the following four values:
|
||||||
|
//
|
||||||
|
// Major Version
|
||||||
|
// Minor Version
|
||||||
|
// Build Number
|
||||||
|
// Revision
|
||||||
|
//
|
||||||
|
[assembly: AssemblyVersion("0.7.5.*")]
|
||||||
|
[assembly: AssemblyFileVersion("1.0.0.0")]
|
|
@ -215,7 +215,7 @@ namespace OpenSim.ApplicationPlugins.RegionModulesController
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#region IRegionModulesController implementation
|
#region Region Module interfacesController implementation
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Check that the given module is no disabled in the [Modules] section of the config files.
|
/// Check that the given module is no disabled in the [Modules] section of the config files.
|
||||||
|
|
|
@ -0,0 +1,33 @@
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
// General Information about an assembly is controlled through the following
|
||||||
|
// set of attributes. Change these attribute values to modify the information
|
||||||
|
// associated with an assembly.
|
||||||
|
[assembly: AssemblyTitle("OpenSim.ApplicationPlugins.RemoteController")]
|
||||||
|
[assembly: AssemblyDescription("")]
|
||||||
|
[assembly: AssemblyConfiguration("")]
|
||||||
|
[assembly: AssemblyCompany("http://opensimulator.org")]
|
||||||
|
[assembly: AssemblyProduct("OpenSim")]
|
||||||
|
[assembly: AssemblyCopyright("Copyright OpenSimulator developers © 2012")]
|
||||||
|
[assembly: AssemblyTrademark("")]
|
||||||
|
[assembly: AssemblyCulture("")]
|
||||||
|
|
||||||
|
// Setting ComVisible to false makes the types in this assembly not visible
|
||||||
|
// to COM components. If you need to access a type in this assembly from
|
||||||
|
// COM, set the ComVisible attribute to true on that type.
|
||||||
|
[assembly: ComVisible(false)]
|
||||||
|
|
||||||
|
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||||
|
[assembly: Guid("efec6e69-fc4a-4e21-86e6-4a261c12d4db")]
|
||||||
|
|
||||||
|
// Version information for an assembly consists of the following four values:
|
||||||
|
//
|
||||||
|
// Major Version
|
||||||
|
// Minor Version
|
||||||
|
// Build Number
|
||||||
|
// Revision
|
||||||
|
//
|
||||||
|
[assembly: AssemblyVersion("0.7.5.*")]
|
||||||
|
[assembly: AssemblyFileVersion("1.0.0.0")]
|
|
@ -696,7 +696,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
||||||
|
|
||||||
region.ExternalHostName = (string) requestData["external_address"];
|
region.ExternalHostName = (string) requestData["external_address"];
|
||||||
|
|
||||||
bool persist = Convert.ToBoolean((string) requestData["persist"]);
|
bool persist = Convert.ToBoolean(requestData["persist"]);
|
||||||
if (persist)
|
if (persist)
|
||||||
{
|
{
|
||||||
// default place for region configuration files is in the
|
// default place for region configuration files is in the
|
||||||
|
@ -852,7 +852,6 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
||||||
responseData["success"] = true;
|
responseData["success"] = true;
|
||||||
responseData["region_name"] = region.RegionName;
|
responseData["region_name"] = region.RegionName;
|
||||||
responseData["region_id"] = region.RegionID.ToString();
|
responseData["region_id"] = region.RegionID.ToString();
|
||||||
responseData["region_uuid"] = region.RegionID.ToString(); //Deprecate July 2012
|
|
||||||
|
|
||||||
m_log.Info("[RADMIN]: CreateRegion: request complete");
|
m_log.Info("[RADMIN]: CreateRegion: request complete");
|
||||||
}
|
}
|
||||||
|
@ -1106,8 +1105,8 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
||||||
string lastName = (string) requestData["user_lastname"];
|
string lastName = (string) requestData["user_lastname"];
|
||||||
string password = (string) requestData["user_password"];
|
string password = (string) requestData["user_password"];
|
||||||
|
|
||||||
uint regionXLocation = Convert.ToUInt32((Int32) requestData["start_region_x"]);
|
uint regionXLocation = Convert.ToUInt32(requestData["start_region_x"]);
|
||||||
uint regionYLocation = Convert.ToUInt32((Int32) requestData["start_region_y"]);
|
uint regionYLocation = Convert.ToUInt32(requestData["start_region_y"]);
|
||||||
|
|
||||||
string email = ""; // empty string for email
|
string email = ""; // empty string for email
|
||||||
if (requestData.Contains("user_email"))
|
if (requestData.Contains("user_email"))
|
||||||
|
@ -1304,9 +1303,9 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
||||||
|
|
||||||
if (requestData.ContainsKey("user_password")) password = (string) requestData["user_password"];
|
if (requestData.ContainsKey("user_password")) password = (string) requestData["user_password"];
|
||||||
if (requestData.ContainsKey("start_region_x"))
|
if (requestData.ContainsKey("start_region_x"))
|
||||||
regionXLocation = Convert.ToUInt32((Int32) requestData["start_region_x"]);
|
regionXLocation = Convert.ToUInt32(requestData["start_region_x"]);
|
||||||
if (requestData.ContainsKey("start_region_y"))
|
if (requestData.ContainsKey("start_region_y"))
|
||||||
regionYLocation = Convert.ToUInt32((Int32) requestData["start_region_y"]);
|
regionYLocation = Convert.ToUInt32(requestData["start_region_y"]);
|
||||||
|
|
||||||
// if (requestData.ContainsKey("start_lookat_x"))
|
// if (requestData.ContainsKey("start_lookat_x"))
|
||||||
// ulaX = Convert.ToUInt32((Int32) requestData["start_lookat_x"]);
|
// ulaX = Convert.ToUInt32((Int32) requestData["start_lookat_x"]);
|
||||||
|
@ -1493,6 +1492,8 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
||||||
/// <description>profile url</description></item>
|
/// <description>profile url</description></item>
|
||||||
/// <item><term>noassets</term>
|
/// <item><term>noassets</term>
|
||||||
/// <description>true if no assets should be saved</description></item>
|
/// <description>true if no assets should be saved</description></item>
|
||||||
|
/// <item><term>all</term>
|
||||||
|
/// <description>true to save all the regions in the simulator</description></item>
|
||||||
/// <item><term>perm</term>
|
/// <item><term>perm</term>
|
||||||
/// <description>C and/or T</description></item>
|
/// <description>C and/or T</description></item>
|
||||||
/// </list>
|
/// </list>
|
||||||
|
@ -1549,6 +1550,11 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
||||||
options["checkPermissions"] = (string)requestData["perm"];
|
options["checkPermissions"] = (string)requestData["perm"];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((string)requestData["all"] == "true")
|
||||||
|
{
|
||||||
|
options["all"] = (string)requestData["all"];
|
||||||
|
}
|
||||||
|
|
||||||
IRegionArchiverModule archiver = scene.RequestModuleInterface<IRegionArchiverModule>();
|
IRegionArchiverModule archiver = scene.RequestModuleInterface<IRegionArchiverModule>();
|
||||||
|
|
||||||
if (archiver != null)
|
if (archiver != null)
|
||||||
|
@ -2008,29 +2014,6 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#region Deprecate July 2012
|
|
||||||
//region_ID, regionid, region_uuid will be deprecated in July 2012!!!!!!
|
|
||||||
else if (requestData.ContainsKey("regionid") &&
|
|
||||||
!String.IsNullOrEmpty((string)requestData["regionid"]))
|
|
||||||
{
|
|
||||||
m_log.WarnFormat("[RADMIN]: Use of parameter regionid will be deprecated as of July 2012. Use region_id instead");
|
|
||||||
}
|
|
||||||
else if (requestData.ContainsKey("region_ID") &&
|
|
||||||
!String.IsNullOrEmpty((string)requestData["region_ID"]))
|
|
||||||
{
|
|
||||||
m_log.WarnFormat("[RADMIN]: Use of parameter region_ID will be deprecated as of July 2012. Use region_id instead");
|
|
||||||
}
|
|
||||||
else if (requestData.ContainsKey("regionID") &&
|
|
||||||
!String.IsNullOrEmpty((string)requestData["regionID"]))
|
|
||||||
{
|
|
||||||
m_log.WarnFormat("[RADMIN]: Use of parameter regionID will be deprecated as of July 2012. Use region_id instead");
|
|
||||||
}
|
|
||||||
else if (requestData.ContainsKey("region_uuid") &&
|
|
||||||
!String.IsNullOrEmpty((string)requestData["region_uuid"]))
|
|
||||||
{
|
|
||||||
m_log.WarnFormat("[RADMIN]: Use of parameter region_uuid will be deprecated as of July 2012. Use region_id instead");
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
responseData["accepted"] = false;
|
responseData["accepted"] = false;
|
||||||
|
@ -2052,56 +2035,6 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
||||||
throw new Exception(String.Format("Region ID {0} not found", regionID));
|
throw new Exception(String.Format("Region ID {0} not found", regionID));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#region Deprecate July 2012
|
|
||||||
else if (requestData.ContainsKey("regionid") &&
|
|
||||||
!String.IsNullOrEmpty((string)requestData["regionid"]))
|
|
||||||
{
|
|
||||||
m_log.WarnFormat("[RADMIN]: Use of parameter regionid will be deprecated as of July 2012. Use region_id instead");
|
|
||||||
|
|
||||||
UUID regionID = (UUID)(string)requestData["regionid"];
|
|
||||||
if (!m_application.SceneManager.TryGetScene(regionID, out scene))
|
|
||||||
{
|
|
||||||
responseData["error"] = String.Format("Region ID {0} not found", regionID);
|
|
||||||
throw new Exception(String.Format("Region ID {0} not found", regionID));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (requestData.ContainsKey("region_ID") &&
|
|
||||||
!String.IsNullOrEmpty((string)requestData["region_ID"]))
|
|
||||||
{
|
|
||||||
m_log.WarnFormat("[RADMIN]: Use of parameter region_ID will be deprecated as of July 2012. Use region_id instead");
|
|
||||||
|
|
||||||
UUID regionID = (UUID)(string)requestData["region_ID"];
|
|
||||||
if (!m_application.SceneManager.TryGetScene(regionID, out scene))
|
|
||||||
{
|
|
||||||
responseData["error"] = String.Format("Region ID {0} not found", regionID);
|
|
||||||
throw new Exception(String.Format("Region ID {0} not found", regionID));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (requestData.ContainsKey("regionID") &&
|
|
||||||
!String.IsNullOrEmpty((string)requestData["regionID"]))
|
|
||||||
{
|
|
||||||
m_log.WarnFormat("[RADMIN]: Use of parameter regionID will be deprecated as of July 2012. Use region_id instead");
|
|
||||||
|
|
||||||
UUID regionID = (UUID)(string)requestData["regionID"];
|
|
||||||
if (!m_application.SceneManager.TryGetScene(regionID, out scene))
|
|
||||||
{
|
|
||||||
responseData["error"] = String.Format("Region ID {0} not found", regionID);
|
|
||||||
throw new Exception(String.Format("Region ID {0} not found", regionID));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (requestData.ContainsKey("region_uuid") &&
|
|
||||||
!String.IsNullOrEmpty((string)requestData["region_uuid"]))
|
|
||||||
{
|
|
||||||
m_log.WarnFormat("[RADMIN]: Use of parameter region_uuid will be deprecated as of July 2012. Use region_id instead");
|
|
||||||
|
|
||||||
UUID regionID = (UUID)(string)requestData["region_uuid"];
|
|
||||||
if (!m_application.SceneManager.TryGetScene(regionID, out scene))
|
|
||||||
{
|
|
||||||
responseData["error"] = String.Format("Region ID {0} not found", regionID);
|
|
||||||
throw new Exception(String.Format("Region ID {0} not found", regionID));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
else if (requestData.ContainsKey("region_name") &&
|
else if (requestData.ContainsKey("region_name") &&
|
||||||
!String.IsNullOrEmpty((string)requestData["region_name"]))
|
!String.IsNullOrEmpty((string)requestData["region_name"]))
|
||||||
{
|
{
|
||||||
|
@ -2515,7 +2448,6 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
||||||
destinationItem.Description = item.Description;
|
destinationItem.Description = item.Description;
|
||||||
destinationItem.InvType = item.InvType;
|
destinationItem.InvType = item.InvType;
|
||||||
destinationItem.CreatorId = item.CreatorId;
|
destinationItem.CreatorId = item.CreatorId;
|
||||||
destinationItem.CreatorIdAsUuid = item.CreatorIdAsUuid;
|
|
||||||
destinationItem.CreatorData = item.CreatorData;
|
destinationItem.CreatorData = item.CreatorData;
|
||||||
destinationItem.NextPermissions = item.NextPermissions;
|
destinationItem.NextPermissions = item.NextPermissions;
|
||||||
destinationItem.CurrentPermissions = item.CurrentPermissions;
|
destinationItem.CurrentPermissions = item.CurrentPermissions;
|
||||||
|
@ -2570,7 +2502,6 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
||||||
destinationItem.Description = item.Description;
|
destinationItem.Description = item.Description;
|
||||||
destinationItem.InvType = item.InvType;
|
destinationItem.InvType = item.InvType;
|
||||||
destinationItem.CreatorId = item.CreatorId;
|
destinationItem.CreatorId = item.CreatorId;
|
||||||
destinationItem.CreatorIdAsUuid = item.CreatorIdAsUuid;
|
|
||||||
destinationItem.CreatorData = item.CreatorData;
|
destinationItem.CreatorData = item.CreatorData;
|
||||||
destinationItem.NextPermissions = item.NextPermissions;
|
destinationItem.NextPermissions = item.NextPermissions;
|
||||||
destinationItem.CurrentPermissions = item.CurrentPermissions;
|
destinationItem.CurrentPermissions = item.CurrentPermissions;
|
||||||
|
@ -2683,7 +2614,6 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
||||||
destinationItem.Description = item.Description;
|
destinationItem.Description = item.Description;
|
||||||
destinationItem.InvType = item.InvType;
|
destinationItem.InvType = item.InvType;
|
||||||
destinationItem.CreatorId = item.CreatorId;
|
destinationItem.CreatorId = item.CreatorId;
|
||||||
destinationItem.CreatorIdAsUuid = item.CreatorIdAsUuid;
|
|
||||||
destinationItem.CreatorData = item.CreatorData;
|
destinationItem.CreatorData = item.CreatorData;
|
||||||
destinationItem.NextPermissions = item.NextPermissions;
|
destinationItem.NextPermissions = item.NextPermissions;
|
||||||
destinationItem.CurrentPermissions = item.CurrentPermissions;
|
destinationItem.CurrentPermissions = item.CurrentPermissions;
|
||||||
|
@ -2989,7 +2919,6 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
||||||
inventoryItem.Description = GetStringAttribute(item,"desc","");
|
inventoryItem.Description = GetStringAttribute(item,"desc","");
|
||||||
inventoryItem.InvType = GetIntegerAttribute(item,"invtype",-1);
|
inventoryItem.InvType = GetIntegerAttribute(item,"invtype",-1);
|
||||||
inventoryItem.CreatorId = GetStringAttribute(item,"creatorid","");
|
inventoryItem.CreatorId = GetStringAttribute(item,"creatorid","");
|
||||||
inventoryItem.CreatorIdAsUuid = (UUID)GetStringAttribute(item,"creatoruuid","");
|
|
||||||
inventoryItem.CreatorData = GetStringAttribute(item, "creatordata", "");
|
inventoryItem.CreatorData = GetStringAttribute(item, "creatordata", "");
|
||||||
inventoryItem.NextPermissions = GetUnsignedAttribute(perms, "next", 0x7fffffff);
|
inventoryItem.NextPermissions = GetUnsignedAttribute(perms, "next", 0x7fffffff);
|
||||||
inventoryItem.CurrentPermissions = GetUnsignedAttribute(perms,"current",0x7fffffff);
|
inventoryItem.CurrentPermissions = GetUnsignedAttribute(perms,"current",0x7fffffff);
|
||||||
|
|
|
@ -312,14 +312,16 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
|
||||||
// Now that everything is setup we can proceed to
|
// Now that everything is setup we can proceed to
|
||||||
// add THIS agent to the HTTP server's handler list
|
// add THIS agent to the HTTP server's handler list
|
||||||
|
|
||||||
if (!AddAgentHandler(Rest.Name,this))
|
// FIXME: If this code is ever to be re-enabled (most of it is disabled already) then this will
|
||||||
{
|
// have to be handled through the AddHttpHandler interface.
|
||||||
Rest.Log.ErrorFormat("{0} Unable to activate handler interface", MsgId);
|
// if (!AddAgentHandler(Rest.Name,this))
|
||||||
foreach (IRest handler in handlers)
|
// {
|
||||||
{
|
// Rest.Log.ErrorFormat("{0} Unable to activate handler interface", MsgId);
|
||||||
handler.Close();
|
// foreach (IRest handler in handlers)
|
||||||
}
|
// {
|
||||||
}
|
// handler.Close();
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
|
@ -342,11 +344,13 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
|
||||||
{
|
{
|
||||||
Rest.Log.InfoFormat("{0} Plugin is terminating", MsgId);
|
Rest.Log.InfoFormat("{0} Plugin is terminating", MsgId);
|
||||||
|
|
||||||
try
|
// FIXME: If this code is ever to be re-enabled (most of it is disabled already) then this will
|
||||||
{
|
// have to be handled through the AddHttpHandler interface.
|
||||||
RemoveAgentHandler(Rest.Name, this);
|
// try
|
||||||
}
|
// {
|
||||||
catch (KeyNotFoundException){}
|
// RemoveAgentHandler(Rest.Name, this);
|
||||||
|
// }
|
||||||
|
// catch (KeyNotFoundException){}
|
||||||
|
|
||||||
foreach (IRest handler in handlers)
|
foreach (IRest handler in handlers)
|
||||||
{
|
{
|
||||||
|
|
|
@ -297,7 +297,9 @@ namespace OpenSim.ApplicationPlugins.Rest
|
||||||
{
|
{
|
||||||
if (!IsEnabled) return false;
|
if (!IsEnabled) return false;
|
||||||
_agents.Add(agentName, handler);
|
_agents.Add(agentName, handler);
|
||||||
return _httpd.AddAgentHandler(agentName, handler);
|
// return _httpd.AddAgentHandler(agentName, handler);
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -316,7 +318,7 @@ namespace OpenSim.ApplicationPlugins.Rest
|
||||||
if (_agents[agentName] == handler)
|
if (_agents[agentName] == handler)
|
||||||
{
|
{
|
||||||
_agents.Remove(agentName);
|
_agents.Remove(agentName);
|
||||||
return _httpd.RemoveAgentHandler(agentName, handler);
|
// return _httpd.RemoveAgentHandler(agentName, handler);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -358,10 +360,10 @@ namespace OpenSim.ApplicationPlugins.Rest
|
||||||
_httpd.RemoveStreamHandler(h.HttpMethod, h.Path);
|
_httpd.RemoveStreamHandler(h.HttpMethod, h.Path);
|
||||||
}
|
}
|
||||||
_handlers = null;
|
_handlers = null;
|
||||||
foreach (KeyValuePair<string, IHttpAgentHandler> h in _agents)
|
// foreach (KeyValuePair<string, IHttpAgentHandler> h in _agents)
|
||||||
{
|
// {
|
||||||
_httpd.RemoveAgentHandler(h.Key, h.Value);
|
// _httpd.RemoveAgentHandler(h.Key, h.Value);
|
||||||
}
|
// }
|
||||||
_agents = null;
|
_agents = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -45,16 +45,54 @@ namespace OpenSim.Capabilities.Handlers
|
||||||
{
|
{
|
||||||
public class GetMeshHandler
|
public class GetMeshHandler
|
||||||
{
|
{
|
||||||
// private static readonly ILog m_log =
|
private static readonly ILog m_log =
|
||||||
// LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
private IAssetService m_assetService;
|
private IAssetService m_assetService;
|
||||||
|
|
||||||
|
public const string DefaultFormat = "vnd.ll.mesh";
|
||||||
|
|
||||||
public GetMeshHandler(IAssetService assService)
|
public GetMeshHandler(IAssetService assService)
|
||||||
{
|
{
|
||||||
m_assetService = assService;
|
m_assetService = assService;
|
||||||
}
|
}
|
||||||
|
public Hashtable Handle(Hashtable request)
|
||||||
|
{
|
||||||
|
Hashtable ret = new Hashtable();
|
||||||
|
ret["int_response_code"] = (int)System.Net.HttpStatusCode.NotFound;
|
||||||
|
ret["content_type"] = "text/plain";
|
||||||
|
ret["keepalive"] = false;
|
||||||
|
ret["reusecontext"] = false;
|
||||||
|
ret["int_bytes"] = 0;
|
||||||
|
ret["int_lod"] = 0;
|
||||||
|
string MeshStr = (string)request["mesh_id"];
|
||||||
|
|
||||||
|
|
||||||
|
//m_log.DebugFormat("[GETMESH]: called {0}", MeshStr);
|
||||||
|
|
||||||
|
if (m_assetService == null)
|
||||||
|
{
|
||||||
|
m_log.Error("[GETMESH]: Cannot fetch mesh " + MeshStr + " without an asset service");
|
||||||
|
}
|
||||||
|
|
||||||
|
UUID meshID;
|
||||||
|
if (!String.IsNullOrEmpty(MeshStr) && UUID.TryParse(MeshStr, out meshID))
|
||||||
|
{
|
||||||
|
// m_log.DebugFormat("[GETMESH]: Received request for mesh id {0}", meshID);
|
||||||
|
|
||||||
|
|
||||||
|
ret = ProcessGetMesh(request, UUID.Zero, null);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_log.Warn("[GETMESH]: Failed to parse a mesh_id from GetMesh request: " + (string)request["uri"]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
public Hashtable ProcessGetMesh(Hashtable request, UUID AgentId, Caps cap)
|
public Hashtable ProcessGetMesh(Hashtable request, UUID AgentId, Caps cap)
|
||||||
{
|
{
|
||||||
Hashtable responsedata = new Hashtable();
|
Hashtable responsedata = new Hashtable();
|
||||||
|
@ -62,6 +100,9 @@ namespace OpenSim.Capabilities.Handlers
|
||||||
responsedata["content_type"] = "text/plain";
|
responsedata["content_type"] = "text/plain";
|
||||||
responsedata["keepalive"] = false;
|
responsedata["keepalive"] = false;
|
||||||
responsedata["str_response_string"] = "Request wasn't what was expected";
|
responsedata["str_response_string"] = "Request wasn't what was expected";
|
||||||
|
responsedata["reusecontext"] = false;
|
||||||
|
responsedata["int_lod"] = 0;
|
||||||
|
responsedata["int_bytes"] = 0;
|
||||||
|
|
||||||
string meshStr = string.Empty;
|
string meshStr = string.Empty;
|
||||||
|
|
||||||
|
@ -77,6 +118,7 @@ namespace OpenSim.Capabilities.Handlers
|
||||||
responsedata["content_type"] = "text/plain";
|
responsedata["content_type"] = "text/plain";
|
||||||
responsedata["keepalive"] = false;
|
responsedata["keepalive"] = false;
|
||||||
responsedata["str_response_string"] = "The asset service is unavailable. So is your mesh.";
|
responsedata["str_response_string"] = "The asset service is unavailable. So is your mesh.";
|
||||||
|
responsedata["reusecontext"] = false;
|
||||||
return responsedata;
|
return responsedata;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,9 +128,100 @@ namespace OpenSim.Capabilities.Handlers
|
||||||
{
|
{
|
||||||
if (mesh.Type == (SByte)AssetType.Mesh)
|
if (mesh.Type == (SByte)AssetType.Mesh)
|
||||||
{
|
{
|
||||||
responsedata["str_response_string"] = Convert.ToBase64String(mesh.Data);
|
|
||||||
responsedata["content_type"] = "application/vnd.ll.mesh";
|
Hashtable headers = new Hashtable();
|
||||||
responsedata["int_response_code"] = 200;
|
responsedata["headers"] = headers;
|
||||||
|
|
||||||
|
string range = String.Empty;
|
||||||
|
|
||||||
|
if (((Hashtable)request["headers"])["range"] != null)
|
||||||
|
range = (string)((Hashtable)request["headers"])["range"];
|
||||||
|
|
||||||
|
else if (((Hashtable)request["headers"])["Range"] != null)
|
||||||
|
range = (string)((Hashtable)request["headers"])["Range"];
|
||||||
|
|
||||||
|
if (!String.IsNullOrEmpty(range)) // Mesh Asset LOD // Physics
|
||||||
|
{
|
||||||
|
// Range request
|
||||||
|
int start, end;
|
||||||
|
if (TryParseRange(range, out start, out end))
|
||||||
|
{
|
||||||
|
// Before clamping start make sure we can satisfy it in order to avoid
|
||||||
|
// sending back the last byte instead of an error status
|
||||||
|
if (start >= mesh.Data.Length)
|
||||||
|
{
|
||||||
|
responsedata["int_response_code"] = 404; //501; //410; //404;
|
||||||
|
responsedata["content_type"] = "text/plain";
|
||||||
|
responsedata["keepalive"] = false;
|
||||||
|
responsedata["str_response_string"] = "This range doesnt exist.";
|
||||||
|
responsedata["reusecontext"] = false;
|
||||||
|
responsedata["int_lod"] = 3;
|
||||||
|
return responsedata;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
end = Utils.Clamp(end, 0, mesh.Data.Length - 1);
|
||||||
|
start = Utils.Clamp(start, 0, end);
|
||||||
|
int len = end - start + 1;
|
||||||
|
|
||||||
|
//m_log.Debug("Serving " + start + " to " + end + " of " + texture.Data.Length + " bytes for texture " + texture.ID);
|
||||||
|
|
||||||
|
if (start > 20000)
|
||||||
|
{
|
||||||
|
responsedata["int_lod"] = 3;
|
||||||
|
}
|
||||||
|
else if (start < 4097)
|
||||||
|
{
|
||||||
|
responsedata["int_lod"] = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
responsedata["int_lod"] = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (start == 0 && len == mesh.Data.Length) // well redudante maybe
|
||||||
|
{
|
||||||
|
responsedata["int_response_code"] = (int) System.Net.HttpStatusCode.OK;
|
||||||
|
responsedata["bin_response_data"] = mesh.Data;
|
||||||
|
responsedata["int_bytes"] = mesh.Data.Length;
|
||||||
|
responsedata["reusecontext"] = false;
|
||||||
|
responsedata["int_lod"] = 3;
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
responsedata["int_response_code"] =
|
||||||
|
(int) System.Net.HttpStatusCode.PartialContent;
|
||||||
|
headers["Content-Range"] = String.Format("bytes {0}-{1}/{2}", start, end,
|
||||||
|
mesh.Data.Length);
|
||||||
|
|
||||||
|
byte[] d = new byte[len];
|
||||||
|
Array.Copy(mesh.Data, start, d, 0, len);
|
||||||
|
responsedata["bin_response_data"] = d;
|
||||||
|
responsedata["int_bytes"] = len;
|
||||||
|
responsedata["reusecontext"] = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_log.Warn("[GETMESH]: Failed to parse a range from GetMesh request, sending full asset: " + (string)request["uri"]);
|
||||||
|
responsedata["str_response_string"] = Convert.ToBase64String(mesh.Data);
|
||||||
|
responsedata["content_type"] = "application/vnd.ll.mesh";
|
||||||
|
responsedata["int_response_code"] = 200;
|
||||||
|
responsedata["reusecontext"] = false;
|
||||||
|
responsedata["int_lod"] = 3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
responsedata["str_response_string"] = Convert.ToBase64String(mesh.Data);
|
||||||
|
responsedata["content_type"] = "application/vnd.ll.mesh";
|
||||||
|
responsedata["int_response_code"] = 200;
|
||||||
|
responsedata["reusecontext"] = false;
|
||||||
|
responsedata["int_lod"] = 3;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Optionally add additional mesh types here
|
// Optionally add additional mesh types here
|
||||||
else
|
else
|
||||||
|
@ -97,6 +230,8 @@ namespace OpenSim.Capabilities.Handlers
|
||||||
responsedata["content_type"] = "text/plain";
|
responsedata["content_type"] = "text/plain";
|
||||||
responsedata["keepalive"] = false;
|
responsedata["keepalive"] = false;
|
||||||
responsedata["str_response_string"] = "Unfortunately, this asset isn't a mesh.";
|
responsedata["str_response_string"] = "Unfortunately, this asset isn't a mesh.";
|
||||||
|
responsedata["reusecontext"] = false;
|
||||||
|
responsedata["int_lod"] = 1;
|
||||||
return responsedata;
|
return responsedata;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -106,11 +241,28 @@ namespace OpenSim.Capabilities.Handlers
|
||||||
responsedata["content_type"] = "text/plain";
|
responsedata["content_type"] = "text/plain";
|
||||||
responsedata["keepalive"] = false;
|
responsedata["keepalive"] = false;
|
||||||
responsedata["str_response_string"] = "Your Mesh wasn't found. Sorry!";
|
responsedata["str_response_string"] = "Your Mesh wasn't found. Sorry!";
|
||||||
|
responsedata["reusecontext"] = false;
|
||||||
|
responsedata["int_lod"] = 0;
|
||||||
return responsedata;
|
return responsedata;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return responsedata;
|
return responsedata;
|
||||||
}
|
}
|
||||||
|
private bool TryParseRange(string header, out int start, out int end)
|
||||||
|
{
|
||||||
|
if (header.StartsWith("bytes="))
|
||||||
|
{
|
||||||
|
string[] rangeValues = header.Substring(6).Split('-');
|
||||||
|
if (rangeValues.Length == 2)
|
||||||
|
{
|
||||||
|
if (Int32.TryParse(rangeValues[0], out start) && Int32.TryParse(rangeValues[1], out end))
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
start = end = 0;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -68,7 +68,7 @@ namespace OpenSim.Capabilities.Handlers
|
||||||
ret["content_type"] = "text/plain";
|
ret["content_type"] = "text/plain";
|
||||||
ret["keepalive"] = false;
|
ret["keepalive"] = false;
|
||||||
ret["reusecontext"] = false;
|
ret["reusecontext"] = false;
|
||||||
|
ret["int_bytes"] = 0;
|
||||||
string textureStr = (string)request["texture_id"];
|
string textureStr = (string)request["texture_id"];
|
||||||
string format = (string)request["format"];
|
string format = (string)request["format"];
|
||||||
|
|
||||||
|
@ -200,11 +200,25 @@ namespace OpenSim.Capabilities.Handlers
|
||||||
int start, end;
|
int start, end;
|
||||||
if (TryParseRange(range, out start, out end))
|
if (TryParseRange(range, out start, out end))
|
||||||
{
|
{
|
||||||
|
|
||||||
// Before clamping start make sure we can satisfy it in order to avoid
|
// Before clamping start make sure we can satisfy it in order to avoid
|
||||||
// sending back the last byte instead of an error status
|
// sending back the last byte instead of an error status
|
||||||
if (start >= texture.Data.Length)
|
if (start >= texture.Data.Length)
|
||||||
{
|
{
|
||||||
|
// m_log.DebugFormat(
|
||||||
|
// "[GETTEXTURE]: Client requested range for texture {0} starting at {1} but texture has end of {2}",
|
||||||
|
// texture.ID, start, texture.Data.Length);
|
||||||
|
|
||||||
|
// Stricly speaking, as per http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html, we should be sending back
|
||||||
|
// Requested Range Not Satisfiable (416) here. However, it appears that at least recent implementations
|
||||||
|
// of the Linden Lab viewer (3.2.1 and 3.3.4 and probably earlier), a viewer that has previously
|
||||||
|
// received a very small texture may attempt to fetch bytes from the server past the
|
||||||
|
// range of data that it received originally. Whether this happens appears to depend on whether
|
||||||
|
// the viewer's estimation of how large a request it needs to make for certain discard levels
|
||||||
|
// (http://wiki.secondlife.com/wiki/Image_System#Discard_Level_and_Mip_Mapping), chiefly discard
|
||||||
|
// level 2. If this estimate is greater than the total texture size, returning a RequestedRangeNotSatisfiable
|
||||||
|
// here will cause the viewer to treat the texture as bad and never display the full resolution
|
||||||
|
// However, if we return PartialContent (or OK) instead, the viewer will display that resolution.
|
||||||
|
|
||||||
// response.StatusCode = (int)System.Net.HttpStatusCode.RequestedRangeNotSatisfiable;
|
// response.StatusCode = (int)System.Net.HttpStatusCode.RequestedRangeNotSatisfiable;
|
||||||
// viewers don't seem to handle RequestedRangeNotSatisfiable and keep retrying with same parameters
|
// viewers don't seem to handle RequestedRangeNotSatisfiable and keep retrying with same parameters
|
||||||
response["int_response_code"] = (int)System.Net.HttpStatusCode.NotFound;
|
response["int_response_code"] = (int)System.Net.HttpStatusCode.NotFound;
|
||||||
|
@ -215,7 +229,7 @@ namespace OpenSim.Capabilities.Handlers
|
||||||
start = Utils.Clamp(start, 0, end);
|
start = Utils.Clamp(start, 0, end);
|
||||||
int len = end - start + 1;
|
int len = end - start + 1;
|
||||||
|
|
||||||
//m_log.Debug("Serving " + start + " to " + end + " of " + texture.Data.Length + " bytes for texture " + texture.ID);
|
// m_log.Debug("Serving " + start + " to " + end + " of " + texture.Data.Length + " bytes for texture " + texture.ID);
|
||||||
|
|
||||||
response["content-type"] = texture.Metadata.ContentType;
|
response["content-type"] = texture.Metadata.ContentType;
|
||||||
|
|
||||||
|
@ -223,6 +237,7 @@ namespace OpenSim.Capabilities.Handlers
|
||||||
{
|
{
|
||||||
response["int_response_code"] = (int)System.Net.HttpStatusCode.OK;
|
response["int_response_code"] = (int)System.Net.HttpStatusCode.OK;
|
||||||
response["bin_response_data"] = texture.Data;
|
response["bin_response_data"] = texture.Data;
|
||||||
|
response["int_bytes"] = texture.Data.Length;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -232,6 +247,7 @@ namespace OpenSim.Capabilities.Handlers
|
||||||
byte[] d = new byte[len];
|
byte[] d = new byte[len];
|
||||||
Array.Copy(texture.Data, start, d, 0, len);
|
Array.Copy(texture.Data, start, d, 0, len);
|
||||||
response["bin_response_data"] = d;
|
response["bin_response_data"] = d;
|
||||||
|
response["int_bytes"] = len;
|
||||||
}
|
}
|
||||||
// response.Body.Write(texture.Data, start, len);
|
// response.Body.Write(texture.Data, start, len);
|
||||||
}
|
}
|
||||||
|
@ -252,6 +268,8 @@ namespace OpenSim.Capabilities.Handlers
|
||||||
response["content_type"] = "image/" + format;
|
response["content_type"] = "image/" + format;
|
||||||
|
|
||||||
response["bin_response_data"] = texture.Data;
|
response["bin_response_data"] = texture.Data;
|
||||||
|
response["int_bytes"] = texture.Data.Length;
|
||||||
|
|
||||||
// response.Body.Write(texture.Data, 0, texture.Data.Length);
|
// response.Body.Write(texture.Data, 0, texture.Data.Length);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,33 @@
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
// General Information about an assembly is controlled through the following
|
||||||
|
// set of attributes. Change these attribute values to modify the information
|
||||||
|
// associated with an assembly.
|
||||||
|
[assembly: AssemblyTitle("OpenSim.Capabilities.Handlers")]
|
||||||
|
[assembly: AssemblyDescription("")]
|
||||||
|
[assembly: AssemblyConfiguration("")]
|
||||||
|
[assembly: AssemblyCompany("http://opensimulator.org")]
|
||||||
|
[assembly: AssemblyProduct("OpenSim")]
|
||||||
|
[assembly: AssemblyCopyright("OpenSimulator developers")]
|
||||||
|
[assembly: AssemblyTrademark("")]
|
||||||
|
[assembly: AssemblyCulture("")]
|
||||||
|
|
||||||
|
// Setting ComVisible to false makes the types in this assembly not visible
|
||||||
|
// to COM components. If you need to access a type in this assembly from
|
||||||
|
// COM, set the ComVisible attribute to true on that type.
|
||||||
|
[assembly: ComVisible(false)]
|
||||||
|
|
||||||
|
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||||
|
[assembly: Guid("32350823-e1df-45e3-b7fa-0a58b4372433")]
|
||||||
|
|
||||||
|
// Version information for an assembly consists of the following four values:
|
||||||
|
//
|
||||||
|
// Major Version
|
||||||
|
// Minor Version
|
||||||
|
// Build Number
|
||||||
|
// Revision
|
||||||
|
//
|
||||||
|
[assembly: AssemblyVersion("0.7.5.*")]
|
||||||
|
[assembly: AssemblyFileVersion("1.0.0.0")]
|
|
@ -0,0 +1,33 @@
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
// General Information about an assembly is controlled through the following
|
||||||
|
// set of attributes. Change these attribute values to modify the information
|
||||||
|
// associated with an assembly.
|
||||||
|
[assembly: AssemblyTitle("OpenSim.Capabilities")]
|
||||||
|
[assembly: AssemblyDescription("")]
|
||||||
|
[assembly: AssemblyConfiguration("")]
|
||||||
|
[assembly: AssemblyCompany("http://opensimulator.org")]
|
||||||
|
[assembly: AssemblyProduct("OpenSim")]
|
||||||
|
[assembly: AssemblyCopyright("OpenSimulator developers")]
|
||||||
|
[assembly: AssemblyTrademark("")]
|
||||||
|
[assembly: AssemblyCulture("")]
|
||||||
|
|
||||||
|
// Setting ComVisible to false makes the types in this assembly not visible
|
||||||
|
// to COM components. If you need to access a type in this assembly from
|
||||||
|
// COM, set the ComVisible attribute to true on that type.
|
||||||
|
[assembly: ComVisible(false)]
|
||||||
|
|
||||||
|
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||||
|
[assembly: Guid("7d1a55b1-8fab-42ff-9c83-066a9cc34d76")]
|
||||||
|
|
||||||
|
// Version information for an assembly consists of the following four values:
|
||||||
|
//
|
||||||
|
// Major Version
|
||||||
|
// Minor Version
|
||||||
|
// Build Number
|
||||||
|
// Revision
|
||||||
|
//
|
||||||
|
[assembly: AssemblyVersion("0.7.5.*")]
|
||||||
|
[assembly: AssemblyFileVersion("1.0.0.0")]
|
|
@ -0,0 +1,33 @@
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
// General Information about an assembly is controlled through the following
|
||||||
|
// set of attributes. Change these attribute values to modify the information
|
||||||
|
// associated with an assembly.
|
||||||
|
[assembly: AssemblyTitle("OpenSim.ConsoleClient")]
|
||||||
|
[assembly: AssemblyDescription("")]
|
||||||
|
[assembly: AssemblyConfiguration("")]
|
||||||
|
[assembly: AssemblyCompany("http://opensimulator.org")]
|
||||||
|
[assembly: AssemblyProduct("OpenSim")]
|
||||||
|
[assembly: AssemblyCopyright("OpenSimulator developers")]
|
||||||
|
[assembly: AssemblyTrademark("")]
|
||||||
|
[assembly: AssemblyCulture("")]
|
||||||
|
|
||||||
|
// Setting ComVisible to false makes the types in this assembly not visible
|
||||||
|
// to COM components. If you need to access a type in this assembly from
|
||||||
|
// COM, set the ComVisible attribute to true on that type.
|
||||||
|
[assembly: ComVisible(false)]
|
||||||
|
|
||||||
|
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||||
|
[assembly: Guid("8945df94-2e5e-475b-88fa-35a7cdde6fd7")]
|
||||||
|
|
||||||
|
// Version information for an assembly consists of the following four values:
|
||||||
|
//
|
||||||
|
// Major Version
|
||||||
|
// Minor Version
|
||||||
|
// Build Number
|
||||||
|
// Revision
|
||||||
|
//
|
||||||
|
[assembly: AssemblyVersion("0.7.5.*")]
|
||||||
|
[assembly: AssemblyFileVersion("1.0.0.0")]
|
|
@ -85,21 +85,6 @@ namespace OpenSim.Data
|
||||||
List<RegionData> GetHyperlinks(UUID scopeID);
|
List<RegionData> GetHyperlinks(UUID scopeID);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Flags]
|
|
||||||
public enum RegionFlags : int
|
|
||||||
{
|
|
||||||
DefaultRegion = 1, // Used for new Rez. Random if multiple defined
|
|
||||||
FallbackRegion = 2, // Regions we redirect to when the destination is down
|
|
||||||
RegionOnline = 4, // Set when a region comes online, unset when it unregisters and DeleteOnUnregister is false
|
|
||||||
NoDirectLogin = 8, // Region unavailable for direct logins (by name)
|
|
||||||
Persistent = 16, // Don't remove on unregister
|
|
||||||
LockedOut = 32, // Don't allow registration
|
|
||||||
NoMove = 64, // Don't allow moving this region
|
|
||||||
Reservation = 128, // This is an inactive reservation
|
|
||||||
Authenticate = 256, // Require authentication
|
|
||||||
Hyperlink = 512 // Record represents a HG link
|
|
||||||
}
|
|
||||||
|
|
||||||
public class RegionDataDistanceCompare : IComparer<RegionData>
|
public class RegionDataDistanceCompare : IComparer<RegionData>
|
||||||
{
|
{
|
||||||
private Vector2 m_origin;
|
private Vector2 m_origin;
|
||||||
|
|
|
@ -40,6 +40,11 @@ namespace OpenSim.Data
|
||||||
public UUID folderID;
|
public UUID folderID;
|
||||||
public UUID agentID;
|
public UUID agentID;
|
||||||
public UUID parentFolderID;
|
public UUID parentFolderID;
|
||||||
|
|
||||||
|
public XInventoryFolder Clone()
|
||||||
|
{
|
||||||
|
return (XInventoryFolder)MemberwiseClone();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class XInventoryItem
|
public class XInventoryItem
|
||||||
|
@ -64,6 +69,11 @@ namespace OpenSim.Data
|
||||||
public UUID avatarID;
|
public UUID avatarID;
|
||||||
public UUID parentFolderID;
|
public UUID parentFolderID;
|
||||||
public int inventoryGroupPermissions;
|
public int inventoryGroupPermissions;
|
||||||
|
|
||||||
|
public XInventoryItem Clone()
|
||||||
|
{
|
||||||
|
return (XInventoryItem)MemberwiseClone();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface IXInventoryData
|
public interface IXInventoryData
|
||||||
|
@ -106,7 +116,22 @@ namespace OpenSim.Data
|
||||||
/// <returns>true if the delete was successful, false if it was not</returns>
|
/// <returns>true if the delete was successful, false if it was not</returns>
|
||||||
bool DeleteItems(string[] fields, string[] vals);
|
bool DeleteItems(string[] fields, string[] vals);
|
||||||
|
|
||||||
bool MoveItem(string id, string newParent);
|
/// <summary>
|
||||||
|
/// Move an item to another folder.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>/returns>
|
||||||
|
/// <param name='id'>UUID of the item</param>
|
||||||
|
/// <param name='newParent'>UUID of the new parent folder.</param>
|
||||||
|
bool MoveItem(string id, string newParentFolderID);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Move a folder to another folder.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>/returns>
|
||||||
|
/// <param name='id'>UUID of the item</param>
|
||||||
|
/// <param name='newParent'>UUID of the new parent folder.</param>
|
||||||
|
bool MoveFolder(string id, string newParentFolderID);
|
||||||
|
|
||||||
XInventoryItem[] GetActiveGestures(UUID principalID);
|
XInventoryItem[] GetActiveGestures(UUID principalID);
|
||||||
int GetAssetPermissions(UUID principalID, UUID assetID);
|
int GetAssetPermissions(UUID principalID, UUID assetID);
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,6 +37,7 @@ using OpenMetaverse;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using OpenSim.Region.Framework.Interfaces;
|
using OpenSim.Region.Framework.Interfaces;
|
||||||
using OpenSim.Region.Framework.Scenes;
|
using OpenSim.Region.Framework.Scenes;
|
||||||
|
using RegionFlags = OpenSim.Framework.RegionFlags;
|
||||||
|
|
||||||
namespace OpenSim.Data.MSSQL
|
namespace OpenSim.Data.MSSQL
|
||||||
{
|
{
|
||||||
|
|
|
@ -43,12 +43,12 @@ namespace OpenSim.Data.MSSQL
|
||||||
private static readonly ILog m_log = LogManager.GetLogger(
|
private static readonly ILog m_log = LogManager.GetLogger(
|
||||||
MethodBase.GetCurrentMethod().DeclaringType);
|
MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
private MSSQLGenericTableHandler<XInventoryFolder> m_Folders;
|
private MSSQLFolderHandler m_Folders;
|
||||||
private MSSQLItemHandler m_Items;
|
private MSSQLItemHandler m_Items;
|
||||||
|
|
||||||
public MSSQLXInventoryData(string conn, string realm)
|
public MSSQLXInventoryData(string conn, string realm)
|
||||||
{
|
{
|
||||||
m_Folders = new MSSQLGenericTableHandler<XInventoryFolder>(
|
m_Folders = new MSSQLFolderHandler(
|
||||||
conn, "inventoryfolders", "InventoryStore");
|
conn, "inventoryfolders", "InventoryStore");
|
||||||
m_Items = new MSSQLItemHandler(
|
m_Items = new MSSQLItemHandler(
|
||||||
conn, "inventoryitems", String.Empty);
|
conn, "inventoryitems", String.Empty);
|
||||||
|
@ -85,6 +85,7 @@ namespace OpenSim.Data.MSSQL
|
||||||
{
|
{
|
||||||
return m_Folders.Delete(field, val);
|
return m_Folders.Delete(field, val);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool DeleteFolders(string[] fields, string[] vals)
|
public bool DeleteFolders(string[] fields, string[] vals)
|
||||||
{
|
{
|
||||||
return m_Folders.Delete(fields, vals);
|
return m_Folders.Delete(fields, vals);
|
||||||
|
@ -94,15 +95,22 @@ namespace OpenSim.Data.MSSQL
|
||||||
{
|
{
|
||||||
return m_Items.Delete(field, val);
|
return m_Items.Delete(field, val);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool DeleteItems(string[] fields, string[] vals)
|
public bool DeleteItems(string[] fields, string[] vals)
|
||||||
{
|
{
|
||||||
return m_Items.Delete(fields, vals);
|
return m_Items.Delete(fields, vals);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool MoveItem(string id, string newParent)
|
public bool MoveItem(string id, string newParent)
|
||||||
{
|
{
|
||||||
return m_Items.MoveItem(id, newParent);
|
return m_Items.MoveItem(id, newParent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool MoveFolder(string id, string newParent)
|
||||||
|
{
|
||||||
|
return m_Folders.MoveFolder(id, newParent);
|
||||||
|
}
|
||||||
|
|
||||||
public XInventoryItem[] GetActiveGestures(UUID principalID)
|
public XInventoryItem[] GetActiveGestures(UUID principalID)
|
||||||
{
|
{
|
||||||
return m_Items.GetActiveGestures(principalID);
|
return m_Items.GetActiveGestures(principalID);
|
||||||
|
@ -114,7 +122,7 @@ namespace OpenSim.Data.MSSQL
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class MSSQLItemHandler : MSSQLGenericTableHandler<XInventoryItem>
|
public class MSSQLItemHandler : MSSQLInventoryHandler<XInventoryItem>
|
||||||
{
|
{
|
||||||
public MSSQLItemHandler(string c, string t, string m) :
|
public MSSQLItemHandler(string c, string t, string m) :
|
||||||
base(c, t, m)
|
base(c, t, m)
|
||||||
|
@ -123,70 +131,163 @@ namespace OpenSim.Data.MSSQL
|
||||||
|
|
||||||
public bool MoveItem(string id, string newParent)
|
public bool MoveItem(string id, string newParent)
|
||||||
{
|
{
|
||||||
using (SqlConnection conn = new SqlConnection(m_ConnectionString))
|
XInventoryItem[] retrievedItems = Get(new string[] { "inventoryID" }, new string[] { id });
|
||||||
using (SqlCommand cmd = new SqlCommand())
|
if (retrievedItems.Length == 0)
|
||||||
{
|
return false;
|
||||||
|
|
||||||
cmd.CommandText = String.Format("update {0} set parentFolderID = @ParentFolderID where inventoryID = @InventoryID", m_Realm);
|
UUID oldParent = retrievedItems[0].parentFolderID;
|
||||||
cmd.Parameters.Add(m_database.CreateParameter("@ParentFolderID", newParent));
|
|
||||||
cmd.Parameters.Add(m_database.CreateParameter("@InventoryID", id));
|
using (SqlConnection conn = new SqlConnection(m_ConnectionString))
|
||||||
cmd.Connection = conn;
|
{
|
||||||
conn.Open();
|
using (SqlCommand cmd = new SqlCommand())
|
||||||
return cmd.ExecuteNonQuery() == 0 ? false : true;
|
{
|
||||||
|
|
||||||
|
cmd.CommandText = String.Format("update {0} set parentFolderID = @ParentFolderID where inventoryID = @InventoryID", m_Realm);
|
||||||
|
cmd.Parameters.Add(m_database.CreateParameter("@ParentFolderID", newParent));
|
||||||
|
cmd.Parameters.Add(m_database.CreateParameter("@InventoryID", id));
|
||||||
|
cmd.Connection = conn;
|
||||||
|
conn.Open();
|
||||||
|
|
||||||
|
if (cmd.ExecuteNonQuery() == 0)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
IncrementFolderVersion(oldParent);
|
||||||
|
IncrementFolderVersion(newParent);
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public XInventoryItem[] GetActiveGestures(UUID principalID)
|
public XInventoryItem[] GetActiveGestures(UUID principalID)
|
||||||
{
|
{
|
||||||
using (SqlConnection conn = new SqlConnection(m_ConnectionString))
|
using (SqlConnection conn = new SqlConnection(m_ConnectionString))
|
||||||
using (SqlCommand cmd = new SqlCommand())
|
|
||||||
{
|
{
|
||||||
cmd.CommandText = String.Format("select * from inventoryitems where avatarId = @uuid and assetType = @type and flags = 1", m_Realm);
|
using (SqlCommand cmd = new SqlCommand())
|
||||||
|
{
|
||||||
|
cmd.CommandText = String.Format("select * from inventoryitems where avatarId = @uuid and assetType = @type and flags = 1", m_Realm);
|
||||||
|
|
||||||
cmd.Parameters.Add(m_database.CreateParameter("@uuid", principalID.ToString()));
|
cmd.Parameters.Add(m_database.CreateParameter("@uuid", principalID.ToString()));
|
||||||
cmd.Parameters.Add(m_database.CreateParameter("@type", (int)AssetType.Gesture));
|
cmd.Parameters.Add(m_database.CreateParameter("@type", (int)AssetType.Gesture));
|
||||||
cmd.Connection = conn;
|
cmd.Connection = conn;
|
||||||
conn.Open();
|
conn.Open();
|
||||||
return DoQuery(cmd);
|
return DoQuery(cmd);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public int GetAssetPermissions(UUID principalID, UUID assetID)
|
public int GetAssetPermissions(UUID principalID, UUID assetID)
|
||||||
{
|
{
|
||||||
using (SqlConnection conn = new SqlConnection(m_ConnectionString))
|
using (SqlConnection conn = new SqlConnection(m_ConnectionString))
|
||||||
using (SqlCommand cmd = new SqlCommand())
|
|
||||||
{
|
{
|
||||||
cmd.CommandText = String.Format("select bit_or(inventoryCurrentPermissions) as inventoryCurrentPermissions from inventoryitems where avatarID = @PrincipalID and assetID = @AssetID group by assetID", m_Realm);
|
using (SqlCommand cmd = new SqlCommand())
|
||||||
cmd.Parameters.Add(m_database.CreateParameter("@PrincipalID", principalID.ToString()));
|
|
||||||
cmd.Parameters.Add(m_database.CreateParameter("@AssetID", assetID.ToString()));
|
|
||||||
cmd.Connection = conn;
|
|
||||||
conn.Open();
|
|
||||||
using (SqlDataReader reader = cmd.ExecuteReader())
|
|
||||||
{
|
{
|
||||||
|
cmd.CommandText = String.Format("select bit_or(inventoryCurrentPermissions) as inventoryCurrentPermissions from inventoryitems where avatarID = @PrincipalID and assetID = @AssetID group by assetID", m_Realm);
|
||||||
int perms = 0;
|
cmd.Parameters.Add(m_database.CreateParameter("@PrincipalID", principalID.ToString()));
|
||||||
|
cmd.Parameters.Add(m_database.CreateParameter("@AssetID", assetID.ToString()));
|
||||||
if (reader.Read())
|
cmd.Connection = conn;
|
||||||
|
conn.Open();
|
||||||
|
using (SqlDataReader reader = cmd.ExecuteReader())
|
||||||
{
|
{
|
||||||
perms = Convert.ToInt32(reader["inventoryCurrentPermissions"]);
|
|
||||||
|
int perms = 0;
|
||||||
|
|
||||||
|
if (reader.Read())
|
||||||
|
{
|
||||||
|
perms = Convert.ToInt32(reader["inventoryCurrentPermissions"]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return perms;
|
||||||
}
|
}
|
||||||
|
|
||||||
return perms;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool Store(XInventoryItem item)
|
public override bool Store(XInventoryItem item)
|
||||||
{
|
{
|
||||||
if (!base.Store(item))
|
if (!base.Store(item))
|
||||||
return false;
|
return false;
|
||||||
string sql = "update inventoryfolders set version=version+1 where folderID = @folderID";
|
|
||||||
using (SqlConnection conn = new SqlConnection(m_ConnectionString))
|
|
||||||
using (SqlCommand cmd = new SqlCommand(sql, conn))
|
|
||||||
{
|
|
||||||
conn.Open();
|
|
||||||
|
|
||||||
cmd.Parameters.AddWithValue("@folderID", item.parentFolderID.ToString());
|
IncrementFolderVersion(item.parentFolderID);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class MSSQLFolderHandler : MSSQLInventoryHandler<XInventoryFolder>
|
||||||
|
{
|
||||||
|
public MSSQLFolderHandler(string c, string t, string m) :
|
||||||
|
base(c, t, m)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool MoveFolder(string id, string newParentFolderID)
|
||||||
|
{
|
||||||
|
XInventoryFolder[] folders = Get(new string[] { "folderID" }, new string[] { id });
|
||||||
|
|
||||||
|
if (folders.Length == 0)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
UUID oldParentFolderUUID = folders[0].parentFolderID;
|
||||||
|
|
||||||
|
using (SqlConnection conn = new SqlConnection(m_ConnectionString))
|
||||||
|
{
|
||||||
|
using (SqlCommand cmd = new SqlCommand())
|
||||||
|
{
|
||||||
|
|
||||||
|
cmd.CommandText = String.Format("update {0} set parentFolderID = @ParentFolderID where folderID = @folderID", m_Realm);
|
||||||
|
cmd.Parameters.Add(m_database.CreateParameter("@ParentFolderID", newParentFolderID));
|
||||||
|
cmd.Parameters.Add(m_database.CreateParameter("@folderID", id));
|
||||||
|
cmd.Connection = conn;
|
||||||
|
conn.Open();
|
||||||
|
|
||||||
|
if (cmd.ExecuteNonQuery() == 0)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
IncrementFolderVersion(oldParentFolderUUID);
|
||||||
|
IncrementFolderVersion(newParentFolderID);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool Store(XInventoryFolder folder)
|
||||||
|
{
|
||||||
|
if (!base.Store(folder))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
IncrementFolderVersion(folder.parentFolderID);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class MSSQLInventoryHandler<T> : MSSQLGenericTableHandler<T> where T: class, new()
|
||||||
|
{
|
||||||
|
public MSSQLInventoryHandler(string c, string t, string m) : base(c, t, m) {}
|
||||||
|
|
||||||
|
protected bool IncrementFolderVersion(UUID folderID)
|
||||||
|
{
|
||||||
|
return IncrementFolderVersion(folderID.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
|
protected bool IncrementFolderVersion(string folderID)
|
||||||
|
{
|
||||||
|
// m_log.DebugFormat("[MYSQL ITEM HANDLER]: Incrementing version on folder {0}", folderID);
|
||||||
|
// Util.PrintCallStack();
|
||||||
|
|
||||||
|
string sql = "update inventoryfolders set version=version+1 where folderID = ?folderID";
|
||||||
|
|
||||||
|
using (SqlConnection conn = new SqlConnection(m_ConnectionString))
|
||||||
|
{
|
||||||
|
using (SqlCommand cmd = new SqlCommand(sql, conn))
|
||||||
|
{
|
||||||
|
conn.Open();
|
||||||
|
|
||||||
|
cmd.Parameters.AddWithValue("@folderID", folderID);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
cmd.ExecuteNonQuery();
|
cmd.ExecuteNonQuery();
|
||||||
|
@ -194,9 +295,11 @@ namespace OpenSim.Data.MSSQL
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -61,5 +61,5 @@ using System.Runtime.InteropServices;
|
||||||
// You can specify all the values or you can default the Revision and Build Numbers
|
// You can specify all the values or you can default the Revision and Build Numbers
|
||||||
// by using the '*' as shown below:
|
// by using the '*' as shown below:
|
||||||
|
|
||||||
[assembly : AssemblyVersion("0.6.5.*")]
|
[assembly : AssemblyVersion("0.7.5.*")]
|
||||||
[assembly : AssemblyFileVersion("0.6.5.0")]
|
[assembly : AssemblyFileVersion("0.6.5.0")]
|
||||||
|
|
|
@ -224,6 +224,8 @@ namespace OpenSim.Data.MySQL
|
||||||
|
|
||||||
public virtual bool Store(T row)
|
public virtual bool Store(T row)
|
||||||
{
|
{
|
||||||
|
// m_log.DebugFormat("[MYSQL GENERIC TABLE HANDLER]: Store(T row) invoked");
|
||||||
|
|
||||||
using (MySqlCommand cmd = new MySqlCommand())
|
using (MySqlCommand cmd = new MySqlCommand())
|
||||||
{
|
{
|
||||||
string query = "";
|
string query = "";
|
||||||
|
@ -278,6 +280,10 @@ namespace OpenSim.Data.MySQL
|
||||||
|
|
||||||
public virtual bool Delete(string[] fields, string[] keys)
|
public virtual bool Delete(string[] fields, string[] keys)
|
||||||
{
|
{
|
||||||
|
// m_log.DebugFormat(
|
||||||
|
// "[MYSQL GENERIC TABLE HANDLER]: Delete(string[] fields, string[] keys) invoked with {0}:{1}",
|
||||||
|
// string.Join(",", fields), string.Join(",", keys));
|
||||||
|
|
||||||
if (fields.Length != keys.Length)
|
if (fields.Length != keys.Length)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
|
@ -30,11 +30,11 @@ using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
using MySql.Data.MySqlClient;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using OpenSim.Data;
|
using OpenSim.Data;
|
||||||
using MySql.Data.MySqlClient;
|
using RegionFlags = OpenSim.Framework.RegionFlags;
|
||||||
|
|
||||||
namespace OpenSim.Data.MySQL
|
namespace OpenSim.Data.MySQL
|
||||||
{
|
{
|
||||||
|
|
|
@ -747,95 +747,99 @@ namespace OpenSim.Data.MySQL
|
||||||
RegionLightShareData nWP = new RegionLightShareData();
|
RegionLightShareData nWP = new RegionLightShareData();
|
||||||
nWP.OnSave += StoreRegionWindlightSettings;
|
nWP.OnSave += StoreRegionWindlightSettings;
|
||||||
|
|
||||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
lock (m_dbLock)
|
||||||
{
|
{
|
||||||
dbcon.Open();
|
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||||
|
|
||||||
string command = "select * from `regionwindlight` where region_id = ?regionID";
|
|
||||||
|
|
||||||
using (MySqlCommand cmd = new MySqlCommand(command))
|
|
||||||
{
|
{
|
||||||
cmd.Connection = dbcon;
|
dbcon.Open();
|
||||||
|
|
||||||
cmd.Parameters.AddWithValue("?regionID", regionUUID.ToString());
|
string command = "select * from `regionwindlight` where region_id = ?regionID";
|
||||||
|
|
||||||
IDataReader result = ExecuteReader(cmd);
|
using (MySqlCommand cmd = new MySqlCommand(command))
|
||||||
if (!result.Read())
|
|
||||||
{
|
{
|
||||||
//No result, so store our default windlight profile and return it
|
cmd.Connection = dbcon;
|
||||||
nWP.regionID = regionUUID;
|
|
||||||
// StoreRegionWindlightSettings(nWP);
|
cmd.Parameters.AddWithValue("?regionID", regionUUID.ToString());
|
||||||
return nWP;
|
|
||||||
}
|
IDataReader result = ExecuteReader(cmd);
|
||||||
else
|
if (!result.Read())
|
||||||
{
|
{
|
||||||
nWP.regionID = DBGuid.FromDB(result["region_id"]);
|
//No result, so store our default windlight profile and return it
|
||||||
nWP.waterColor.X = Convert.ToSingle(result["water_color_r"]);
|
nWP.regionID = regionUUID;
|
||||||
nWP.waterColor.Y = Convert.ToSingle(result["water_color_g"]);
|
// StoreRegionWindlightSettings(nWP);
|
||||||
nWP.waterColor.Z = Convert.ToSingle(result["water_color_b"]);
|
return nWP;
|
||||||
nWP.waterFogDensityExponent = Convert.ToSingle(result["water_fog_density_exponent"]);
|
}
|
||||||
nWP.underwaterFogModifier = Convert.ToSingle(result["underwater_fog_modifier"]);
|
else
|
||||||
nWP.reflectionWaveletScale.X = Convert.ToSingle(result["reflection_wavelet_scale_1"]);
|
{
|
||||||
nWP.reflectionWaveletScale.Y = Convert.ToSingle(result["reflection_wavelet_scale_2"]);
|
nWP.regionID = DBGuid.FromDB(result["region_id"]);
|
||||||
nWP.reflectionWaveletScale.Z = Convert.ToSingle(result["reflection_wavelet_scale_3"]);
|
nWP.waterColor.X = Convert.ToSingle(result["water_color_r"]);
|
||||||
nWP.fresnelScale = Convert.ToSingle(result["fresnel_scale"]);
|
nWP.waterColor.Y = Convert.ToSingle(result["water_color_g"]);
|
||||||
nWP.fresnelOffset = Convert.ToSingle(result["fresnel_offset"]);
|
nWP.waterColor.Z = Convert.ToSingle(result["water_color_b"]);
|
||||||
nWP.refractScaleAbove = Convert.ToSingle(result["refract_scale_above"]);
|
nWP.waterFogDensityExponent = Convert.ToSingle(result["water_fog_density_exponent"]);
|
||||||
nWP.refractScaleBelow = Convert.ToSingle(result["refract_scale_below"]);
|
nWP.underwaterFogModifier = Convert.ToSingle(result["underwater_fog_modifier"]);
|
||||||
nWP.blurMultiplier = Convert.ToSingle(result["blur_multiplier"]);
|
nWP.reflectionWaveletScale.X = Convert.ToSingle(result["reflection_wavelet_scale_1"]);
|
||||||
nWP.bigWaveDirection.X = Convert.ToSingle(result["big_wave_direction_x"]);
|
nWP.reflectionWaveletScale.Y = Convert.ToSingle(result["reflection_wavelet_scale_2"]);
|
||||||
nWP.bigWaveDirection.Y = Convert.ToSingle(result["big_wave_direction_y"]);
|
nWP.reflectionWaveletScale.Z = Convert.ToSingle(result["reflection_wavelet_scale_3"]);
|
||||||
nWP.littleWaveDirection.X = Convert.ToSingle(result["little_wave_direction_x"]);
|
nWP.fresnelScale = Convert.ToSingle(result["fresnel_scale"]);
|
||||||
nWP.littleWaveDirection.Y = Convert.ToSingle(result["little_wave_direction_y"]);
|
nWP.fresnelOffset = Convert.ToSingle(result["fresnel_offset"]);
|
||||||
UUID.TryParse(result["normal_map_texture"].ToString(), out nWP.normalMapTexture);
|
nWP.refractScaleAbove = Convert.ToSingle(result["refract_scale_above"]);
|
||||||
nWP.horizon.X = Convert.ToSingle(result["horizon_r"]);
|
nWP.refractScaleBelow = Convert.ToSingle(result["refract_scale_below"]);
|
||||||
nWP.horizon.Y = Convert.ToSingle(result["horizon_g"]);
|
nWP.blurMultiplier = Convert.ToSingle(result["blur_multiplier"]);
|
||||||
nWP.horizon.Z = Convert.ToSingle(result["horizon_b"]);
|
nWP.bigWaveDirection.X = Convert.ToSingle(result["big_wave_direction_x"]);
|
||||||
nWP.horizon.W = Convert.ToSingle(result["horizon_i"]);
|
nWP.bigWaveDirection.Y = Convert.ToSingle(result["big_wave_direction_y"]);
|
||||||
nWP.hazeHorizon = Convert.ToSingle(result["haze_horizon"]);
|
nWP.littleWaveDirection.X = Convert.ToSingle(result["little_wave_direction_x"]);
|
||||||
nWP.blueDensity.X = Convert.ToSingle(result["blue_density_r"]);
|
nWP.littleWaveDirection.Y = Convert.ToSingle(result["little_wave_direction_y"]);
|
||||||
nWP.blueDensity.Y = Convert.ToSingle(result["blue_density_g"]);
|
UUID.TryParse(result["normal_map_texture"].ToString(), out nWP.normalMapTexture);
|
||||||
nWP.blueDensity.Z = Convert.ToSingle(result["blue_density_b"]);
|
nWP.horizon.X = Convert.ToSingle(result["horizon_r"]);
|
||||||
nWP.blueDensity.W = Convert.ToSingle(result["blue_density_i"]);
|
nWP.horizon.Y = Convert.ToSingle(result["horizon_g"]);
|
||||||
nWP.hazeDensity = Convert.ToSingle(result["haze_density"]);
|
nWP.horizon.Z = Convert.ToSingle(result["horizon_b"]);
|
||||||
nWP.densityMultiplier = Convert.ToSingle(result["density_multiplier"]);
|
nWP.horizon.W = Convert.ToSingle(result["horizon_i"]);
|
||||||
nWP.distanceMultiplier = Convert.ToSingle(result["distance_multiplier"]);
|
nWP.hazeHorizon = Convert.ToSingle(result["haze_horizon"]);
|
||||||
nWP.maxAltitude = Convert.ToUInt16(result["max_altitude"]);
|
nWP.blueDensity.X = Convert.ToSingle(result["blue_density_r"]);
|
||||||
nWP.sunMoonColor.X = Convert.ToSingle(result["sun_moon_color_r"]);
|
nWP.blueDensity.Y = Convert.ToSingle(result["blue_density_g"]);
|
||||||
nWP.sunMoonColor.Y = Convert.ToSingle(result["sun_moon_color_g"]);
|
nWP.blueDensity.Z = Convert.ToSingle(result["blue_density_b"]);
|
||||||
nWP.sunMoonColor.Z = Convert.ToSingle(result["sun_moon_color_b"]);
|
nWP.blueDensity.W = Convert.ToSingle(result["blue_density_i"]);
|
||||||
nWP.sunMoonColor.W = Convert.ToSingle(result["sun_moon_color_i"]);
|
nWP.hazeDensity = Convert.ToSingle(result["haze_density"]);
|
||||||
nWP.sunMoonPosition = Convert.ToSingle(result["sun_moon_position"]);
|
nWP.densityMultiplier = Convert.ToSingle(result["density_multiplier"]);
|
||||||
nWP.ambient.X = Convert.ToSingle(result["ambient_r"]);
|
nWP.distanceMultiplier = Convert.ToSingle(result["distance_multiplier"]);
|
||||||
nWP.ambient.Y = Convert.ToSingle(result["ambient_g"]);
|
nWP.maxAltitude = Convert.ToUInt16(result["max_altitude"]);
|
||||||
nWP.ambient.Z = Convert.ToSingle(result["ambient_b"]);
|
nWP.sunMoonColor.X = Convert.ToSingle(result["sun_moon_color_r"]);
|
||||||
nWP.ambient.W = Convert.ToSingle(result["ambient_i"]);
|
nWP.sunMoonColor.Y = Convert.ToSingle(result["sun_moon_color_g"]);
|
||||||
nWP.eastAngle = Convert.ToSingle(result["east_angle"]);
|
nWP.sunMoonColor.Z = Convert.ToSingle(result["sun_moon_color_b"]);
|
||||||
nWP.sunGlowFocus = Convert.ToSingle(result["sun_glow_focus"]);
|
nWP.sunMoonColor.W = Convert.ToSingle(result["sun_moon_color_i"]);
|
||||||
nWP.sunGlowSize = Convert.ToSingle(result["sun_glow_size"]);
|
nWP.sunMoonPosition = Convert.ToSingle(result["sun_moon_position"]);
|
||||||
nWP.sceneGamma = Convert.ToSingle(result["scene_gamma"]);
|
nWP.ambient.X = Convert.ToSingle(result["ambient_r"]);
|
||||||
nWP.starBrightness = Convert.ToSingle(result["star_brightness"]);
|
nWP.ambient.Y = Convert.ToSingle(result["ambient_g"]);
|
||||||
nWP.cloudColor.X = Convert.ToSingle(result["cloud_color_r"]);
|
nWP.ambient.Z = Convert.ToSingle(result["ambient_b"]);
|
||||||
nWP.cloudColor.Y = Convert.ToSingle(result["cloud_color_g"]);
|
nWP.ambient.W = Convert.ToSingle(result["ambient_i"]);
|
||||||
nWP.cloudColor.Z = Convert.ToSingle(result["cloud_color_b"]);
|
nWP.eastAngle = Convert.ToSingle(result["east_angle"]);
|
||||||
nWP.cloudColor.W = Convert.ToSingle(result["cloud_color_i"]);
|
nWP.sunGlowFocus = Convert.ToSingle(result["sun_glow_focus"]);
|
||||||
nWP.cloudXYDensity.X = Convert.ToSingle(result["cloud_x"]);
|
nWP.sunGlowSize = Convert.ToSingle(result["sun_glow_size"]);
|
||||||
nWP.cloudXYDensity.Y = Convert.ToSingle(result["cloud_y"]);
|
nWP.sceneGamma = Convert.ToSingle(result["scene_gamma"]);
|
||||||
nWP.cloudXYDensity.Z = Convert.ToSingle(result["cloud_density"]);
|
nWP.starBrightness = Convert.ToSingle(result["star_brightness"]);
|
||||||
nWP.cloudCoverage = Convert.ToSingle(result["cloud_coverage"]);
|
nWP.cloudColor.X = Convert.ToSingle(result["cloud_color_r"]);
|
||||||
nWP.cloudScale = Convert.ToSingle(result["cloud_scale"]);
|
nWP.cloudColor.Y = Convert.ToSingle(result["cloud_color_g"]);
|
||||||
nWP.cloudDetailXYDensity.X = Convert.ToSingle(result["cloud_detail_x"]);
|
nWP.cloudColor.Z = Convert.ToSingle(result["cloud_color_b"]);
|
||||||
nWP.cloudDetailXYDensity.Y = Convert.ToSingle(result["cloud_detail_y"]);
|
nWP.cloudColor.W = Convert.ToSingle(result["cloud_color_i"]);
|
||||||
nWP.cloudDetailXYDensity.Z = Convert.ToSingle(result["cloud_detail_density"]);
|
nWP.cloudXYDensity.X = Convert.ToSingle(result["cloud_x"]);
|
||||||
nWP.cloudScrollX = Convert.ToSingle(result["cloud_scroll_x"]);
|
nWP.cloudXYDensity.Y = Convert.ToSingle(result["cloud_y"]);
|
||||||
nWP.cloudScrollXLock = Convert.ToBoolean(result["cloud_scroll_x_lock"]);
|
nWP.cloudXYDensity.Z = Convert.ToSingle(result["cloud_density"]);
|
||||||
nWP.cloudScrollY = Convert.ToSingle(result["cloud_scroll_y"]);
|
nWP.cloudCoverage = Convert.ToSingle(result["cloud_coverage"]);
|
||||||
nWP.cloudScrollYLock = Convert.ToBoolean(result["cloud_scroll_y_lock"]);
|
nWP.cloudScale = Convert.ToSingle(result["cloud_scale"]);
|
||||||
nWP.drawClassicClouds = Convert.ToBoolean(result["draw_classic_clouds"]);
|
nWP.cloudDetailXYDensity.X = Convert.ToSingle(result["cloud_detail_x"]);
|
||||||
nWP.valid = true;
|
nWP.cloudDetailXYDensity.Y = Convert.ToSingle(result["cloud_detail_y"]);
|
||||||
|
nWP.cloudDetailXYDensity.Z = Convert.ToSingle(result["cloud_detail_density"]);
|
||||||
|
nWP.cloudScrollX = Convert.ToSingle(result["cloud_scroll_x"]);
|
||||||
|
nWP.cloudScrollXLock = Convert.ToBoolean(result["cloud_scroll_x_lock"]);
|
||||||
|
nWP.cloudScrollY = Convert.ToSingle(result["cloud_scroll_y"]);
|
||||||
|
nWP.cloudScrollYLock = Convert.ToBoolean(result["cloud_scroll_y_lock"]);
|
||||||
|
nWP.drawClassicClouds = Convert.ToBoolean(result["draw_classic_clouds"]);
|
||||||
|
nWP.valid = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return nWP;
|
return nWP;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -881,118 +885,124 @@ namespace OpenSim.Data.MySQL
|
||||||
|
|
||||||
public virtual void StoreRegionWindlightSettings(RegionLightShareData wl)
|
public virtual void StoreRegionWindlightSettings(RegionLightShareData wl)
|
||||||
{
|
{
|
||||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
lock (m_dbLock)
|
||||||
{
|
{
|
||||||
dbcon.Open();
|
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||||
|
|
||||||
using (MySqlCommand cmd = dbcon.CreateCommand())
|
|
||||||
{
|
{
|
||||||
cmd.CommandText = "REPLACE INTO `regionwindlight` (`region_id`, `water_color_r`, `water_color_g`, ";
|
dbcon.Open();
|
||||||
cmd.CommandText += "`water_color_b`, `water_fog_density_exponent`, `underwater_fog_modifier`, ";
|
|
||||||
cmd.CommandText += "`reflection_wavelet_scale_1`, `reflection_wavelet_scale_2`, `reflection_wavelet_scale_3`, ";
|
using (MySqlCommand cmd = dbcon.CreateCommand())
|
||||||
cmd.CommandText += "`fresnel_scale`, `fresnel_offset`, `refract_scale_above`, `refract_scale_below`, ";
|
{
|
||||||
cmd.CommandText += "`blur_multiplier`, `big_wave_direction_x`, `big_wave_direction_y`, `little_wave_direction_x`, ";
|
cmd.CommandText = "REPLACE INTO `regionwindlight` (`region_id`, `water_color_r`, `water_color_g`, ";
|
||||||
cmd.CommandText += "`little_wave_direction_y`, `normal_map_texture`, `horizon_r`, `horizon_g`, `horizon_b`, ";
|
cmd.CommandText += "`water_color_b`, `water_fog_density_exponent`, `underwater_fog_modifier`, ";
|
||||||
cmd.CommandText += "`horizon_i`, `haze_horizon`, `blue_density_r`, `blue_density_g`, `blue_density_b`, ";
|
cmd.CommandText += "`reflection_wavelet_scale_1`, `reflection_wavelet_scale_2`, `reflection_wavelet_scale_3`, ";
|
||||||
cmd.CommandText += "`blue_density_i`, `haze_density`, `density_multiplier`, `distance_multiplier`, `max_altitude`, ";
|
cmd.CommandText += "`fresnel_scale`, `fresnel_offset`, `refract_scale_above`, `refract_scale_below`, ";
|
||||||
cmd.CommandText += "`sun_moon_color_r`, `sun_moon_color_g`, `sun_moon_color_b`, `sun_moon_color_i`, `sun_moon_position`, ";
|
cmd.CommandText += "`blur_multiplier`, `big_wave_direction_x`, `big_wave_direction_y`, `little_wave_direction_x`, ";
|
||||||
cmd.CommandText += "`ambient_r`, `ambient_g`, `ambient_b`, `ambient_i`, `east_angle`, `sun_glow_focus`, `sun_glow_size`, ";
|
cmd.CommandText += "`little_wave_direction_y`, `normal_map_texture`, `horizon_r`, `horizon_g`, `horizon_b`, ";
|
||||||
cmd.CommandText += "`scene_gamma`, `star_brightness`, `cloud_color_r`, `cloud_color_g`, `cloud_color_b`, `cloud_color_i`, ";
|
cmd.CommandText += "`horizon_i`, `haze_horizon`, `blue_density_r`, `blue_density_g`, `blue_density_b`, ";
|
||||||
cmd.CommandText += "`cloud_x`, `cloud_y`, `cloud_density`, `cloud_coverage`, `cloud_scale`, `cloud_detail_x`, ";
|
cmd.CommandText += "`blue_density_i`, `haze_density`, `density_multiplier`, `distance_multiplier`, `max_altitude`, ";
|
||||||
cmd.CommandText += "`cloud_detail_y`, `cloud_detail_density`, `cloud_scroll_x`, `cloud_scroll_x_lock`, `cloud_scroll_y`, ";
|
cmd.CommandText += "`sun_moon_color_r`, `sun_moon_color_g`, `sun_moon_color_b`, `sun_moon_color_i`, `sun_moon_position`, ";
|
||||||
cmd.CommandText += "`cloud_scroll_y_lock`, `draw_classic_clouds`) VALUES (?region_id, ?water_color_r, ";
|
cmd.CommandText += "`ambient_r`, `ambient_g`, `ambient_b`, `ambient_i`, `east_angle`, `sun_glow_focus`, `sun_glow_size`, ";
|
||||||
cmd.CommandText += "?water_color_g, ?water_color_b, ?water_fog_density_exponent, ?underwater_fog_modifier, ?reflection_wavelet_scale_1, ";
|
cmd.CommandText += "`scene_gamma`, `star_brightness`, `cloud_color_r`, `cloud_color_g`, `cloud_color_b`, `cloud_color_i`, ";
|
||||||
cmd.CommandText += "?reflection_wavelet_scale_2, ?reflection_wavelet_scale_3, ?fresnel_scale, ?fresnel_offset, ?refract_scale_above, ";
|
cmd.CommandText += "`cloud_x`, `cloud_y`, `cloud_density`, `cloud_coverage`, `cloud_scale`, `cloud_detail_x`, ";
|
||||||
cmd.CommandText += "?refract_scale_below, ?blur_multiplier, ?big_wave_direction_x, ?big_wave_direction_y, ?little_wave_direction_x, ";
|
cmd.CommandText += "`cloud_detail_y`, `cloud_detail_density`, `cloud_scroll_x`, `cloud_scroll_x_lock`, `cloud_scroll_y`, ";
|
||||||
cmd.CommandText += "?little_wave_direction_y, ?normal_map_texture, ?horizon_r, ?horizon_g, ?horizon_b, ?horizon_i, ?haze_horizon, ";
|
cmd.CommandText += "`cloud_scroll_y_lock`, `draw_classic_clouds`) VALUES (?region_id, ?water_color_r, ";
|
||||||
cmd.CommandText += "?blue_density_r, ?blue_density_g, ?blue_density_b, ?blue_density_i, ?haze_density, ?density_multiplier, ";
|
cmd.CommandText += "?water_color_g, ?water_color_b, ?water_fog_density_exponent, ?underwater_fog_modifier, ?reflection_wavelet_scale_1, ";
|
||||||
cmd.CommandText += "?distance_multiplier, ?max_altitude, ?sun_moon_color_r, ?sun_moon_color_g, ?sun_moon_color_b, ";
|
cmd.CommandText += "?reflection_wavelet_scale_2, ?reflection_wavelet_scale_3, ?fresnel_scale, ?fresnel_offset, ?refract_scale_above, ";
|
||||||
cmd.CommandText += "?sun_moon_color_i, ?sun_moon_position, ?ambient_r, ?ambient_g, ?ambient_b, ?ambient_i, ?east_angle, ";
|
cmd.CommandText += "?refract_scale_below, ?blur_multiplier, ?big_wave_direction_x, ?big_wave_direction_y, ?little_wave_direction_x, ";
|
||||||
cmd.CommandText += "?sun_glow_focus, ?sun_glow_size, ?scene_gamma, ?star_brightness, ?cloud_color_r, ?cloud_color_g, ";
|
cmd.CommandText += "?little_wave_direction_y, ?normal_map_texture, ?horizon_r, ?horizon_g, ?horizon_b, ?horizon_i, ?haze_horizon, ";
|
||||||
cmd.CommandText += "?cloud_color_b, ?cloud_color_i, ?cloud_x, ?cloud_y, ?cloud_density, ?cloud_coverage, ?cloud_scale, ";
|
cmd.CommandText += "?blue_density_r, ?blue_density_g, ?blue_density_b, ?blue_density_i, ?haze_density, ?density_multiplier, ";
|
||||||
cmd.CommandText += "?cloud_detail_x, ?cloud_detail_y, ?cloud_detail_density, ?cloud_scroll_x, ?cloud_scroll_x_lock, ";
|
cmd.CommandText += "?distance_multiplier, ?max_altitude, ?sun_moon_color_r, ?sun_moon_color_g, ?sun_moon_color_b, ";
|
||||||
cmd.CommandText += "?cloud_scroll_y, ?cloud_scroll_y_lock, ?draw_classic_clouds)";
|
cmd.CommandText += "?sun_moon_color_i, ?sun_moon_position, ?ambient_r, ?ambient_g, ?ambient_b, ?ambient_i, ?east_angle, ";
|
||||||
|
cmd.CommandText += "?sun_glow_focus, ?sun_glow_size, ?scene_gamma, ?star_brightness, ?cloud_color_r, ?cloud_color_g, ";
|
||||||
cmd.Parameters.AddWithValue("region_id", wl.regionID);
|
cmd.CommandText += "?cloud_color_b, ?cloud_color_i, ?cloud_x, ?cloud_y, ?cloud_density, ?cloud_coverage, ?cloud_scale, ";
|
||||||
cmd.Parameters.AddWithValue("water_color_r", wl.waterColor.X);
|
cmd.CommandText += "?cloud_detail_x, ?cloud_detail_y, ?cloud_detail_density, ?cloud_scroll_x, ?cloud_scroll_x_lock, ";
|
||||||
cmd.Parameters.AddWithValue("water_color_g", wl.waterColor.Y);
|
cmd.CommandText += "?cloud_scroll_y, ?cloud_scroll_y_lock, ?draw_classic_clouds)";
|
||||||
cmd.Parameters.AddWithValue("water_color_b", wl.waterColor.Z);
|
|
||||||
cmd.Parameters.AddWithValue("water_fog_density_exponent", wl.waterFogDensityExponent);
|
cmd.Parameters.AddWithValue("region_id", wl.regionID);
|
||||||
cmd.Parameters.AddWithValue("underwater_fog_modifier", wl.underwaterFogModifier);
|
cmd.Parameters.AddWithValue("water_color_r", wl.waterColor.X);
|
||||||
cmd.Parameters.AddWithValue("reflection_wavelet_scale_1", wl.reflectionWaveletScale.X);
|
cmd.Parameters.AddWithValue("water_color_g", wl.waterColor.Y);
|
||||||
cmd.Parameters.AddWithValue("reflection_wavelet_scale_2", wl.reflectionWaveletScale.Y);
|
cmd.Parameters.AddWithValue("water_color_b", wl.waterColor.Z);
|
||||||
cmd.Parameters.AddWithValue("reflection_wavelet_scale_3", wl.reflectionWaveletScale.Z);
|
cmd.Parameters.AddWithValue("water_fog_density_exponent", wl.waterFogDensityExponent);
|
||||||
cmd.Parameters.AddWithValue("fresnel_scale", wl.fresnelScale);
|
cmd.Parameters.AddWithValue("underwater_fog_modifier", wl.underwaterFogModifier);
|
||||||
cmd.Parameters.AddWithValue("fresnel_offset", wl.fresnelOffset);
|
cmd.Parameters.AddWithValue("reflection_wavelet_scale_1", wl.reflectionWaveletScale.X);
|
||||||
cmd.Parameters.AddWithValue("refract_scale_above", wl.refractScaleAbove);
|
cmd.Parameters.AddWithValue("reflection_wavelet_scale_2", wl.reflectionWaveletScale.Y);
|
||||||
cmd.Parameters.AddWithValue("refract_scale_below", wl.refractScaleBelow);
|
cmd.Parameters.AddWithValue("reflection_wavelet_scale_3", wl.reflectionWaveletScale.Z);
|
||||||
cmd.Parameters.AddWithValue("blur_multiplier", wl.blurMultiplier);
|
cmd.Parameters.AddWithValue("fresnel_scale", wl.fresnelScale);
|
||||||
cmd.Parameters.AddWithValue("big_wave_direction_x", wl.bigWaveDirection.X);
|
cmd.Parameters.AddWithValue("fresnel_offset", wl.fresnelOffset);
|
||||||
cmd.Parameters.AddWithValue("big_wave_direction_y", wl.bigWaveDirection.Y);
|
cmd.Parameters.AddWithValue("refract_scale_above", wl.refractScaleAbove);
|
||||||
cmd.Parameters.AddWithValue("little_wave_direction_x", wl.littleWaveDirection.X);
|
cmd.Parameters.AddWithValue("refract_scale_below", wl.refractScaleBelow);
|
||||||
cmd.Parameters.AddWithValue("little_wave_direction_y", wl.littleWaveDirection.Y);
|
cmd.Parameters.AddWithValue("blur_multiplier", wl.blurMultiplier);
|
||||||
cmd.Parameters.AddWithValue("normal_map_texture", wl.normalMapTexture);
|
cmd.Parameters.AddWithValue("big_wave_direction_x", wl.bigWaveDirection.X);
|
||||||
cmd.Parameters.AddWithValue("horizon_r", wl.horizon.X);
|
cmd.Parameters.AddWithValue("big_wave_direction_y", wl.bigWaveDirection.Y);
|
||||||
cmd.Parameters.AddWithValue("horizon_g", wl.horizon.Y);
|
cmd.Parameters.AddWithValue("little_wave_direction_x", wl.littleWaveDirection.X);
|
||||||
cmd.Parameters.AddWithValue("horizon_b", wl.horizon.Z);
|
cmd.Parameters.AddWithValue("little_wave_direction_y", wl.littleWaveDirection.Y);
|
||||||
cmd.Parameters.AddWithValue("horizon_i", wl.horizon.W);
|
cmd.Parameters.AddWithValue("normal_map_texture", wl.normalMapTexture);
|
||||||
cmd.Parameters.AddWithValue("haze_horizon", wl.hazeHorizon);
|
cmd.Parameters.AddWithValue("horizon_r", wl.horizon.X);
|
||||||
cmd.Parameters.AddWithValue("blue_density_r", wl.blueDensity.X);
|
cmd.Parameters.AddWithValue("horizon_g", wl.horizon.Y);
|
||||||
cmd.Parameters.AddWithValue("blue_density_g", wl.blueDensity.Y);
|
cmd.Parameters.AddWithValue("horizon_b", wl.horizon.Z);
|
||||||
cmd.Parameters.AddWithValue("blue_density_b", wl.blueDensity.Z);
|
cmd.Parameters.AddWithValue("horizon_i", wl.horizon.W);
|
||||||
cmd.Parameters.AddWithValue("blue_density_i", wl.blueDensity.W);
|
cmd.Parameters.AddWithValue("haze_horizon", wl.hazeHorizon);
|
||||||
cmd.Parameters.AddWithValue("haze_density", wl.hazeDensity);
|
cmd.Parameters.AddWithValue("blue_density_r", wl.blueDensity.X);
|
||||||
cmd.Parameters.AddWithValue("density_multiplier", wl.densityMultiplier);
|
cmd.Parameters.AddWithValue("blue_density_g", wl.blueDensity.Y);
|
||||||
cmd.Parameters.AddWithValue("distance_multiplier", wl.distanceMultiplier);
|
cmd.Parameters.AddWithValue("blue_density_b", wl.blueDensity.Z);
|
||||||
cmd.Parameters.AddWithValue("max_altitude", wl.maxAltitude);
|
cmd.Parameters.AddWithValue("blue_density_i", wl.blueDensity.W);
|
||||||
cmd.Parameters.AddWithValue("sun_moon_color_r", wl.sunMoonColor.X);
|
cmd.Parameters.AddWithValue("haze_density", wl.hazeDensity);
|
||||||
cmd.Parameters.AddWithValue("sun_moon_color_g", wl.sunMoonColor.Y);
|
cmd.Parameters.AddWithValue("density_multiplier", wl.densityMultiplier);
|
||||||
cmd.Parameters.AddWithValue("sun_moon_color_b", wl.sunMoonColor.Z);
|
cmd.Parameters.AddWithValue("distance_multiplier", wl.distanceMultiplier);
|
||||||
cmd.Parameters.AddWithValue("sun_moon_color_i", wl.sunMoonColor.W);
|
cmd.Parameters.AddWithValue("max_altitude", wl.maxAltitude);
|
||||||
cmd.Parameters.AddWithValue("sun_moon_position", wl.sunMoonPosition);
|
cmd.Parameters.AddWithValue("sun_moon_color_r", wl.sunMoonColor.X);
|
||||||
cmd.Parameters.AddWithValue("ambient_r", wl.ambient.X);
|
cmd.Parameters.AddWithValue("sun_moon_color_g", wl.sunMoonColor.Y);
|
||||||
cmd.Parameters.AddWithValue("ambient_g", wl.ambient.Y);
|
cmd.Parameters.AddWithValue("sun_moon_color_b", wl.sunMoonColor.Z);
|
||||||
cmd.Parameters.AddWithValue("ambient_b", wl.ambient.Z);
|
cmd.Parameters.AddWithValue("sun_moon_color_i", wl.sunMoonColor.W);
|
||||||
cmd.Parameters.AddWithValue("ambient_i", wl.ambient.W);
|
cmd.Parameters.AddWithValue("sun_moon_position", wl.sunMoonPosition);
|
||||||
cmd.Parameters.AddWithValue("east_angle", wl.eastAngle);
|
cmd.Parameters.AddWithValue("ambient_r", wl.ambient.X);
|
||||||
cmd.Parameters.AddWithValue("sun_glow_focus", wl.sunGlowFocus);
|
cmd.Parameters.AddWithValue("ambient_g", wl.ambient.Y);
|
||||||
cmd.Parameters.AddWithValue("sun_glow_size", wl.sunGlowSize);
|
cmd.Parameters.AddWithValue("ambient_b", wl.ambient.Z);
|
||||||
cmd.Parameters.AddWithValue("scene_gamma", wl.sceneGamma);
|
cmd.Parameters.AddWithValue("ambient_i", wl.ambient.W);
|
||||||
cmd.Parameters.AddWithValue("star_brightness", wl.starBrightness);
|
cmd.Parameters.AddWithValue("east_angle", wl.eastAngle);
|
||||||
cmd.Parameters.AddWithValue("cloud_color_r", wl.cloudColor.X);
|
cmd.Parameters.AddWithValue("sun_glow_focus", wl.sunGlowFocus);
|
||||||
cmd.Parameters.AddWithValue("cloud_color_g", wl.cloudColor.Y);
|
cmd.Parameters.AddWithValue("sun_glow_size", wl.sunGlowSize);
|
||||||
cmd.Parameters.AddWithValue("cloud_color_b", wl.cloudColor.Z);
|
cmd.Parameters.AddWithValue("scene_gamma", wl.sceneGamma);
|
||||||
cmd.Parameters.AddWithValue("cloud_color_i", wl.cloudColor.W);
|
cmd.Parameters.AddWithValue("star_brightness", wl.starBrightness);
|
||||||
cmd.Parameters.AddWithValue("cloud_x", wl.cloudXYDensity.X);
|
cmd.Parameters.AddWithValue("cloud_color_r", wl.cloudColor.X);
|
||||||
cmd.Parameters.AddWithValue("cloud_y", wl.cloudXYDensity.Y);
|
cmd.Parameters.AddWithValue("cloud_color_g", wl.cloudColor.Y);
|
||||||
cmd.Parameters.AddWithValue("cloud_density", wl.cloudXYDensity.Z);
|
cmd.Parameters.AddWithValue("cloud_color_b", wl.cloudColor.Z);
|
||||||
cmd.Parameters.AddWithValue("cloud_coverage", wl.cloudCoverage);
|
cmd.Parameters.AddWithValue("cloud_color_i", wl.cloudColor.W);
|
||||||
cmd.Parameters.AddWithValue("cloud_scale", wl.cloudScale);
|
cmd.Parameters.AddWithValue("cloud_x", wl.cloudXYDensity.X);
|
||||||
cmd.Parameters.AddWithValue("cloud_detail_x", wl.cloudDetailXYDensity.X);
|
cmd.Parameters.AddWithValue("cloud_y", wl.cloudXYDensity.Y);
|
||||||
cmd.Parameters.AddWithValue("cloud_detail_y", wl.cloudDetailXYDensity.Y);
|
cmd.Parameters.AddWithValue("cloud_density", wl.cloudXYDensity.Z);
|
||||||
cmd.Parameters.AddWithValue("cloud_detail_density", wl.cloudDetailXYDensity.Z);
|
cmd.Parameters.AddWithValue("cloud_coverage", wl.cloudCoverage);
|
||||||
cmd.Parameters.AddWithValue("cloud_scroll_x", wl.cloudScrollX);
|
cmd.Parameters.AddWithValue("cloud_scale", wl.cloudScale);
|
||||||
cmd.Parameters.AddWithValue("cloud_scroll_x_lock", wl.cloudScrollXLock);
|
cmd.Parameters.AddWithValue("cloud_detail_x", wl.cloudDetailXYDensity.X);
|
||||||
cmd.Parameters.AddWithValue("cloud_scroll_y", wl.cloudScrollY);
|
cmd.Parameters.AddWithValue("cloud_detail_y", wl.cloudDetailXYDensity.Y);
|
||||||
cmd.Parameters.AddWithValue("cloud_scroll_y_lock", wl.cloudScrollYLock);
|
cmd.Parameters.AddWithValue("cloud_detail_density", wl.cloudDetailXYDensity.Z);
|
||||||
cmd.Parameters.AddWithValue("draw_classic_clouds", wl.drawClassicClouds);
|
cmd.Parameters.AddWithValue("cloud_scroll_x", wl.cloudScrollX);
|
||||||
|
cmd.Parameters.AddWithValue("cloud_scroll_x_lock", wl.cloudScrollXLock);
|
||||||
ExecuteNonQuery(cmd);
|
cmd.Parameters.AddWithValue("cloud_scroll_y", wl.cloudScrollY);
|
||||||
|
cmd.Parameters.AddWithValue("cloud_scroll_y_lock", wl.cloudScrollYLock);
|
||||||
|
cmd.Parameters.AddWithValue("draw_classic_clouds", wl.drawClassicClouds);
|
||||||
|
|
||||||
|
ExecuteNonQuery(cmd);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void RemoveRegionWindlightSettings(UUID regionID)
|
public virtual void RemoveRegionWindlightSettings(UUID regionID)
|
||||||
{
|
{
|
||||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
lock (m_dbLock)
|
||||||
{
|
{
|
||||||
dbcon.Open();
|
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||||
|
|
||||||
using (MySqlCommand cmd = dbcon.CreateCommand())
|
|
||||||
{
|
{
|
||||||
cmd.CommandText = "delete from `regionwindlight` where `region_id`=?regionID";
|
dbcon.Open();
|
||||||
cmd.Parameters.AddWithValue("?regionID", regionID.ToString());
|
|
||||||
ExecuteNonQuery(cmd);
|
using (MySqlCommand cmd = dbcon.CreateCommand())
|
||||||
|
{
|
||||||
|
cmd.CommandText = "delete from `regionwindlight` where `region_id`=?regionID";
|
||||||
|
cmd.Parameters.AddWithValue("?regionID", regionID.ToString());
|
||||||
|
ExecuteNonQuery(cmd);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1000,26 +1010,29 @@ namespace OpenSim.Data.MySQL
|
||||||
#region RegionEnvironmentSettings
|
#region RegionEnvironmentSettings
|
||||||
public string LoadRegionEnvironmentSettings(UUID regionUUID)
|
public string LoadRegionEnvironmentSettings(UUID regionUUID)
|
||||||
{
|
{
|
||||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
lock (m_dbLock)
|
||||||
{
|
{
|
||||||
dbcon.Open();
|
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||||
|
|
||||||
string command = "select * from `regionenvironment` where region_id = ?region_id";
|
|
||||||
|
|
||||||
using (MySqlCommand cmd = new MySqlCommand(command))
|
|
||||||
{
|
{
|
||||||
cmd.Connection = dbcon;
|
dbcon.Open();
|
||||||
|
|
||||||
cmd.Parameters.AddWithValue("?region_id", regionUUID.ToString());
|
string command = "select * from `regionenvironment` where region_id = ?region_id";
|
||||||
|
|
||||||
IDataReader result = ExecuteReader(cmd);
|
using (MySqlCommand cmd = new MySqlCommand(command))
|
||||||
if (!result.Read())
|
|
||||||
{
|
{
|
||||||
return String.Empty;
|
cmd.Connection = dbcon;
|
||||||
}
|
|
||||||
else
|
cmd.Parameters.AddWithValue("?region_id", regionUUID.ToString());
|
||||||
{
|
|
||||||
return Convert.ToString(result["llsd_settings"]);
|
IDataReader result = ExecuteReader(cmd);
|
||||||
|
if (!result.Read())
|
||||||
|
{
|
||||||
|
return String.Empty;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return Convert.ToString(result["llsd_settings"]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1027,33 +1040,39 @@ namespace OpenSim.Data.MySQL
|
||||||
|
|
||||||
public void StoreRegionEnvironmentSettings(UUID regionUUID, string settings)
|
public void StoreRegionEnvironmentSettings(UUID regionUUID, string settings)
|
||||||
{
|
{
|
||||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
lock (m_dbLock)
|
||||||
{
|
{
|
||||||
dbcon.Open();
|
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||||
|
|
||||||
using (MySqlCommand cmd = dbcon.CreateCommand())
|
|
||||||
{
|
{
|
||||||
cmd.CommandText = "REPLACE INTO `regionenvironment` (`region_id`, `llsd_settings`) VALUES (?region_id, ?llsd_settings)";
|
dbcon.Open();
|
||||||
|
|
||||||
cmd.Parameters.AddWithValue("region_id", regionUUID);
|
using (MySqlCommand cmd = dbcon.CreateCommand())
|
||||||
cmd.Parameters.AddWithValue("llsd_settings", settings);
|
{
|
||||||
|
cmd.CommandText = "REPLACE INTO `regionenvironment` (`region_id`, `llsd_settings`) VALUES (?region_id, ?llsd_settings)";
|
||||||
ExecuteNonQuery(cmd);
|
|
||||||
|
cmd.Parameters.AddWithValue("region_id", regionUUID);
|
||||||
|
cmd.Parameters.AddWithValue("llsd_settings", settings);
|
||||||
|
|
||||||
|
ExecuteNonQuery(cmd);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RemoveRegionEnvironmentSettings(UUID regionUUID)
|
public void RemoveRegionEnvironmentSettings(UUID regionUUID)
|
||||||
{
|
{
|
||||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
lock (m_dbLock)
|
||||||
{
|
{
|
||||||
dbcon.Open();
|
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||||
|
|
||||||
using (MySqlCommand cmd = dbcon.CreateCommand())
|
|
||||||
{
|
{
|
||||||
cmd.CommandText = "delete from `regionenvironment` where region_id = ?region_id";
|
dbcon.Open();
|
||||||
cmd.Parameters.AddWithValue("?region_id", regionUUID.ToString());
|
|
||||||
ExecuteNonQuery(cmd);
|
using (MySqlCommand cmd = dbcon.CreateCommand())
|
||||||
|
{
|
||||||
|
cmd.CommandText = "delete from `regionenvironment` where region_id = ?region_id";
|
||||||
|
cmd.Parameters.AddWithValue("?region_id", regionUUID.ToString());
|
||||||
|
ExecuteNonQuery(cmd);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,9 +26,10 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Data;
|
|
||||||
using System.Reflection;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Data;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Reflection;
|
||||||
using log4net;
|
using log4net;
|
||||||
using MySql.Data.MySqlClient;
|
using MySql.Data.MySqlClient;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
|
@ -41,12 +42,12 @@ namespace OpenSim.Data.MySQL
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class MySQLXInventoryData : IXInventoryData
|
public class MySQLXInventoryData : IXInventoryData
|
||||||
{
|
{
|
||||||
private MySQLGenericTableHandler<XInventoryFolder> m_Folders;
|
private MySqlFolderHandler m_Folders;
|
||||||
private MySqlItemHandler m_Items;
|
private MySqlItemHandler m_Items;
|
||||||
|
|
||||||
public MySQLXInventoryData(string conn, string realm)
|
public MySQLXInventoryData(string conn, string realm)
|
||||||
{
|
{
|
||||||
m_Folders = new MySQLGenericTableHandler<XInventoryFolder>(
|
m_Folders = new MySqlFolderHandler(
|
||||||
conn, "inventoryfolders", "InventoryStore");
|
conn, "inventoryfolders", "InventoryStore");
|
||||||
m_Items = new MySqlItemHandler(
|
m_Items = new MySqlItemHandler(
|
||||||
conn, "inventoryitems", String.Empty);
|
conn, "inventoryitems", String.Empty);
|
||||||
|
@ -105,6 +106,11 @@ namespace OpenSim.Data.MySQL
|
||||||
return m_Items.MoveItem(id, newParent);
|
return m_Items.MoveItem(id, newParent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool MoveFolder(string id, string newParent)
|
||||||
|
{
|
||||||
|
return m_Folders.MoveFolder(id, newParent);
|
||||||
|
}
|
||||||
|
|
||||||
public XInventoryItem[] GetActiveGestures(UUID principalID)
|
public XInventoryItem[] GetActiveGestures(UUID principalID)
|
||||||
{
|
{
|
||||||
return m_Items.GetActiveGestures(principalID);
|
return m_Items.GetActiveGestures(principalID);
|
||||||
|
@ -116,24 +122,71 @@ namespace OpenSim.Data.MySQL
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class MySqlItemHandler : MySQLGenericTableHandler<XInventoryItem>
|
public class MySqlItemHandler : MySqlInventoryHandler<XInventoryItem>
|
||||||
{
|
{
|
||||||
|
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
public MySqlItemHandler(string c, string t, string m) :
|
public MySqlItemHandler(string c, string t, string m) :
|
||||||
base(c, t, m)
|
base(c, t, m)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override bool Delete(string field, string val)
|
||||||
|
{
|
||||||
|
XInventoryItem[] retrievedItems = Get(new string[] { field }, new string[] { val });
|
||||||
|
if (retrievedItems.Length == 0)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (!base.Delete(field, val))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// Don't increment folder version here since Delete(string, string) calls Delete(string[], string[])
|
||||||
|
// IncrementFolderVersion(retrievedItems[0].parentFolderID);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool Delete(string[] fields, string[] vals)
|
||||||
|
{
|
||||||
|
XInventoryItem[] retrievedItems = Get(fields, vals);
|
||||||
|
if (retrievedItems.Length == 0)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (!base.Delete(fields, vals))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
HashSet<UUID> deletedItemFolderUUIDs = new HashSet<UUID>();
|
||||||
|
|
||||||
|
Array.ForEach<XInventoryItem>(retrievedItems, i => deletedItemFolderUUIDs.Add(i.parentFolderID));
|
||||||
|
|
||||||
|
foreach (UUID deletedItemFolderUUID in deletedItemFolderUUIDs)
|
||||||
|
IncrementFolderVersion(deletedItemFolderUUID);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
public bool MoveItem(string id, string newParent)
|
public bool MoveItem(string id, string newParent)
|
||||||
{
|
{
|
||||||
|
XInventoryItem[] retrievedItems = Get(new string[] { "inventoryID" }, new string[] { id });
|
||||||
|
if (retrievedItems.Length == 0)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
UUID oldParent = retrievedItems[0].parentFolderID;
|
||||||
|
|
||||||
using (MySqlCommand cmd = new MySqlCommand())
|
using (MySqlCommand cmd = new MySqlCommand())
|
||||||
{
|
{
|
||||||
|
|
||||||
cmd.CommandText = String.Format("update {0} set parentFolderID = ?ParentFolderID where inventoryID = ?InventoryID", m_Realm);
|
cmd.CommandText = String.Format("update {0} set parentFolderID = ?ParentFolderID where inventoryID = ?InventoryID", m_Realm);
|
||||||
cmd.Parameters.AddWithValue("?ParentFolderID", newParent);
|
cmd.Parameters.AddWithValue("?ParentFolderID", newParent);
|
||||||
cmd.Parameters.AddWithValue("?InventoryID", id);
|
cmd.Parameters.AddWithValue("?InventoryID", id);
|
||||||
|
|
||||||
return ExecuteNonQuery(cmd) == 0 ? false : true;
|
if (ExecuteNonQuery(cmd) == 0)
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
IncrementFolderVersion(oldParent);
|
||||||
|
IncrementFolderVersion(newParent);
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public XInventoryItem[] GetActiveGestures(UUID principalID)
|
public XInventoryItem[] GetActiveGestures(UUID principalID)
|
||||||
|
@ -184,6 +237,73 @@ namespace OpenSim.Data.MySQL
|
||||||
if (!base.Store(item))
|
if (!base.Store(item))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
IncrementFolderVersion(item.parentFolderID);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class MySqlFolderHandler : MySqlInventoryHandler<XInventoryFolder>
|
||||||
|
{
|
||||||
|
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
|
public MySqlFolderHandler(string c, string t, string m) :
|
||||||
|
base(c, t, m)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool MoveFolder(string id, string newParentFolderID)
|
||||||
|
{
|
||||||
|
XInventoryFolder[] folders = Get(new string[] { "folderID" }, new string[] { id });
|
||||||
|
|
||||||
|
if (folders.Length == 0)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
UUID oldParentFolderUUID = folders[0].parentFolderID;
|
||||||
|
|
||||||
|
using (MySqlCommand cmd = new MySqlCommand())
|
||||||
|
{
|
||||||
|
cmd.CommandText
|
||||||
|
= String.Format(
|
||||||
|
"update {0} set parentFolderID = ?ParentFolderID where folderID = ?folderID", m_Realm);
|
||||||
|
cmd.Parameters.AddWithValue("?ParentFolderID", newParentFolderID);
|
||||||
|
cmd.Parameters.AddWithValue("?folderID", id);
|
||||||
|
|
||||||
|
if (ExecuteNonQuery(cmd) == 0)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
IncrementFolderVersion(oldParentFolderUUID);
|
||||||
|
IncrementFolderVersion(newParentFolderID);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool Store(XInventoryFolder folder)
|
||||||
|
{
|
||||||
|
if (!base.Store(folder))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
IncrementFolderVersion(folder.parentFolderID);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class MySqlInventoryHandler<T> : MySQLGenericTableHandler<T> where T: class, new()
|
||||||
|
{
|
||||||
|
public MySqlInventoryHandler(string c, string t, string m) : base(c, t, m) {}
|
||||||
|
|
||||||
|
protected bool IncrementFolderVersion(UUID folderID)
|
||||||
|
{
|
||||||
|
return IncrementFolderVersion(folderID.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
|
protected bool IncrementFolderVersion(string folderID)
|
||||||
|
{
|
||||||
|
// m_log.DebugFormat("[MYSQL FOLDER HANDLER]: Incrementing version on folder {0}", folderID);
|
||||||
|
// Util.PrintCallStack();
|
||||||
|
|
||||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||||
{
|
{
|
||||||
dbcon.Open();
|
dbcon.Open();
|
||||||
|
@ -193,7 +313,7 @@ namespace OpenSim.Data.MySQL
|
||||||
cmd.Connection = dbcon;
|
cmd.Connection = dbcon;
|
||||||
|
|
||||||
cmd.CommandText = String.Format("update inventoryfolders set version=version+1 where folderID = ?folderID");
|
cmd.CommandText = String.Format("update inventoryfolders set version=version+1 where folderID = ?folderID");
|
||||||
cmd.Parameters.AddWithValue("?folderID", item.parentFolderID.ToString());
|
cmd.Parameters.AddWithValue("?folderID", folderID);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -205,9 +325,11 @@ namespace OpenSim.Data.MySQL
|
||||||
}
|
}
|
||||||
cmd.Dispose();
|
cmd.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
dbcon.Close();
|
dbcon.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -61,5 +61,5 @@ using System.Runtime.InteropServices;
|
||||||
// You can specify all the values or you can default the Revision and Build Numbers
|
// You can specify all the values or you can default the Revision and Build Numbers
|
||||||
// by using the '*' as shown below:
|
// by using the '*' as shown below:
|
||||||
|
|
||||||
[assembly : AssemblyVersion("0.6.5.*")]
|
[assembly : AssemblyVersion("0.7.5.*")]
|
||||||
[assembly : AssemblyFileVersion("0.6.5.0")]
|
[assembly : AssemblyFileVersion("0.6.5.0")]
|
||||||
|
|
|
@ -17,3 +17,8 @@ CREATE TABLE `GridUser` (
|
||||||
) ENGINE=InnoDB;
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
COMMIT;
|
COMMIT;
|
||||||
|
|
||||||
|
:VERSION 2 # --------------------------
|
||||||
|
BEGIN;
|
||||||
|
|
||||||
|
COMMIT;
|
||||||
|
|
|
@ -33,6 +33,7 @@ using OpenSim.Framework;
|
||||||
using OpenSim.Data;
|
using OpenSim.Data;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using log4net;
|
using log4net;
|
||||||
|
using RegionFlags = OpenSim.Framework.RegionFlags;
|
||||||
|
|
||||||
namespace OpenSim.Data.Null
|
namespace OpenSim.Data.Null
|
||||||
{
|
{
|
||||||
|
|
|
@ -61,5 +61,5 @@ using System.Runtime.InteropServices;
|
||||||
// You can specify all the values or you can default the Revision and Build Numbers
|
// You can specify all the values or you can default the Revision and Build Numbers
|
||||||
// by using the '*' as shown below:
|
// by using the '*' as shown below:
|
||||||
|
|
||||||
[assembly : AssemblyVersion("0.6.5.*")]
|
[assembly : AssemblyVersion("0.7.5.*")]
|
||||||
[assembly : AssemblyFileVersion("0.6.5.0")]
|
[assembly : AssemblyFileVersion("0.6.5.0")]
|
||||||
|
|
|
@ -61,5 +61,5 @@ using System.Runtime.InteropServices;
|
||||||
// You can specify all the values or you can default the Revision and Build Numbers
|
// You can specify all the values or you can default the Revision and Build Numbers
|
||||||
// by using the '*' as shown below:
|
// by using the '*' as shown below:
|
||||||
|
|
||||||
[assembly : AssemblyVersion("0.6.5.*")]
|
[assembly : AssemblyVersion("0.7.5.*")]
|
||||||
[assembly : AssemblyFileVersion("0.6.5.0")]
|
[assembly : AssemblyFileVersion("0.6.5.0")]
|
||||||
|
|
|
@ -61,5 +61,5 @@ using System.Runtime.InteropServices;
|
||||||
// You can specify all the values or you can default the Revision and Build Numbers
|
// You can specify all the values or you can default the Revision and Build Numbers
|
||||||
// by using the '*' as shown below:
|
// by using the '*' as shown below:
|
||||||
|
|
||||||
[assembly : AssemblyVersion("0.6.5.*")]
|
[assembly : AssemblyVersion("0.7.5.*")]
|
||||||
[assembly : AssemblyFileVersion("0.6.5.0")]
|
[assembly : AssemblyFileVersion("0.6.5.0")]
|
||||||
|
|
|
@ -204,7 +204,8 @@ namespace OpenSim.Data.SQLite
|
||||||
/// <returns>True if exist, or false.</returns>
|
/// <returns>True if exist, or false.</returns>
|
||||||
override public bool ExistsAsset(UUID uuid)
|
override public bool ExistsAsset(UUID uuid)
|
||||||
{
|
{
|
||||||
lock (this) {
|
lock (this)
|
||||||
|
{
|
||||||
using (SqliteCommand cmd = new SqliteCommand(SelectAssetSQL, m_conn))
|
using (SqliteCommand cmd = new SqliteCommand(SelectAssetSQL, m_conn))
|
||||||
{
|
{
|
||||||
cmd.Parameters.Add(new SqliteParameter(":UUID", uuid.ToString()));
|
cmd.Parameters.Add(new SqliteParameter(":UUID", uuid.ToString()));
|
||||||
|
@ -355,12 +356,13 @@ namespace OpenSim.Data.SQLite
|
||||||
{
|
{
|
||||||
lock (this)
|
lock (this)
|
||||||
{
|
{
|
||||||
using (SqliteCommand cmd = new SqliteCommand(DeleteAssetSQL, m_conn))
|
using (SqliteCommand cmd = new SqliteCommand(DeleteAssetSQL, m_conn))
|
||||||
{
|
{
|
||||||
cmd.Parameters.Add(new SqliteParameter(":UUID", uuid.ToString()));
|
cmd.Parameters.Add(new SqliteParameter(":UUID", uuid.ToString()));
|
||||||
cmd.ExecuteNonQuery();
|
cmd.ExecuteNonQuery();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -82,11 +82,14 @@ namespace OpenSim.Data.SQLite
|
||||||
{
|
{
|
||||||
AuthenticationData ret = new AuthenticationData();
|
AuthenticationData ret = new AuthenticationData();
|
||||||
ret.Data = new Dictionary<string, object>();
|
ret.Data = new Dictionary<string, object>();
|
||||||
|
IDataReader result;
|
||||||
|
|
||||||
SqliteCommand cmd = new SqliteCommand("select * from `" + m_Realm + "` where UUID = :PrincipalID");
|
using (SqliteCommand cmd = new SqliteCommand("select * from `" + m_Realm + "` where UUID = :PrincipalID"))
|
||||||
cmd.Parameters.Add(new SqliteParameter(":PrincipalID", principalID.ToString()));
|
{
|
||||||
|
cmd.Parameters.Add(new SqliteParameter(":PrincipalID", principalID.ToString()));
|
||||||
|
|
||||||
IDataReader result = ExecuteReader(cmd, m_Connection);
|
result = ExecuteReader(cmd, m_Connection);
|
||||||
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -121,10 +124,6 @@ namespace OpenSim.Data.SQLite
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
finally
|
|
||||||
{
|
|
||||||
//CloseCommand(cmd);
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -140,84 +139,81 @@ namespace OpenSim.Data.SQLite
|
||||||
foreach (object o in data.Data.Values)
|
foreach (object o in data.Data.Values)
|
||||||
values[i++] = o.ToString();
|
values[i++] = o.ToString();
|
||||||
|
|
||||||
SqliteCommand cmd = new SqliteCommand();
|
using (SqliteCommand cmd = new SqliteCommand())
|
||||||
|
|
||||||
if (Get(data.PrincipalID) != null)
|
|
||||||
{
|
{
|
||||||
|
if (Get(data.PrincipalID) != null)
|
||||||
|
|
||||||
string update = "update `" + m_Realm + "` set ";
|
|
||||||
bool first = true;
|
|
||||||
foreach (string field in fields)
|
|
||||||
{
|
{
|
||||||
if (!first)
|
|
||||||
update += ", ";
|
|
||||||
update += "`" + field + "` = :" + field;
|
|
||||||
cmd.Parameters.Add(new SqliteParameter(":" + field, data.Data[field]));
|
|
||||||
|
|
||||||
first = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
update += " where UUID = :UUID";
|
string update = "update `" + m_Realm + "` set ";
|
||||||
cmd.Parameters.Add(new SqliteParameter(":UUID", data.PrincipalID.ToString()));
|
bool first = true;
|
||||||
|
foreach (string field in fields)
|
||||||
cmd.CommandText = update;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (ExecuteNonQuery(cmd, m_Connection) < 1)
|
|
||||||
{
|
{
|
||||||
|
if (!first)
|
||||||
|
update += ", ";
|
||||||
|
update += "`" + field + "` = :" + field;
|
||||||
|
cmd.Parameters.Add(new SqliteParameter(":" + field, data.Data[field]));
|
||||||
|
|
||||||
|
first = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
update += " where UUID = :UUID";
|
||||||
|
cmd.Parameters.Add(new SqliteParameter(":UUID", data.PrincipalID.ToString()));
|
||||||
|
|
||||||
|
cmd.CommandText = update;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (ExecuteNonQuery(cmd, m_Connection) < 1)
|
||||||
|
{
|
||||||
|
//CloseCommand(cmd);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
m_log.Error("[SQLITE]: Exception storing authentication data", e);
|
||||||
//CloseCommand(cmd);
|
//CloseCommand(cmd);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
else
|
||||||
{
|
{
|
||||||
m_log.Error("[SQLITE]: Exception storing authentication data", e);
|
string insert = "insert into `" + m_Realm + "` (`UUID`, `" +
|
||||||
//CloseCommand(cmd);
|
String.Join("`, `", fields) +
|
||||||
return false;
|
"`) values (:UUID, :" + String.Join(", :", fields) + ")";
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
else
|
cmd.Parameters.Add(new SqliteParameter(":UUID", data.PrincipalID.ToString()));
|
||||||
{
|
foreach (string field in fields)
|
||||||
string insert = "insert into `" + m_Realm + "` (`UUID`, `" +
|
cmd.Parameters.Add(new SqliteParameter(":" + field, data.Data[field]));
|
||||||
String.Join("`, `", fields) +
|
|
||||||
"`) values (:UUID, :" + String.Join(", :", fields) + ")";
|
|
||||||
|
|
||||||
cmd.Parameters.Add(new SqliteParameter(":UUID", data.PrincipalID.ToString()));
|
cmd.CommandText = insert;
|
||||||
foreach (string field in fields)
|
|
||||||
cmd.Parameters.Add(new SqliteParameter(":" + field, data.Data[field]));
|
|
||||||
|
|
||||||
cmd.CommandText = insert;
|
try
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (ExecuteNonQuery(cmd, m_Connection) < 1)
|
|
||||||
{
|
{
|
||||||
//CloseCommand(cmd);
|
if (ExecuteNonQuery(cmd, m_Connection) < 1)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Console.WriteLine(e.ToString());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
Console.WriteLine(e.ToString());
|
|
||||||
//CloseCommand(cmd);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//CloseCommand(cmd);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool SetDataItem(UUID principalID, string item, string value)
|
public bool SetDataItem(UUID principalID, string item, string value)
|
||||||
{
|
{
|
||||||
SqliteCommand cmd = new SqliteCommand("update `" + m_Realm +
|
using (SqliteCommand cmd = new SqliteCommand("update `" + m_Realm +
|
||||||
"` set `" + item + "` = " + value + " where UUID = '" + principalID.ToString() + "'");
|
"` set `" + item + "` = " + value + " where UUID = '" + principalID.ToString() + "'"))
|
||||||
|
{
|
||||||
if (ExecuteNonQuery(cmd, m_Connection) > 0)
|
if (ExecuteNonQuery(cmd, m_Connection) > 0)
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -227,16 +223,13 @@ namespace OpenSim.Data.SQLite
|
||||||
if (System.Environment.TickCount - m_LastExpire > 30000)
|
if (System.Environment.TickCount - m_LastExpire > 30000)
|
||||||
DoExpire();
|
DoExpire();
|
||||||
|
|
||||||
SqliteCommand cmd = new SqliteCommand("insert into tokens (UUID, token, validity) values ('" + principalID.ToString() +
|
using (SqliteCommand cmd = new SqliteCommand("insert into tokens (UUID, token, validity) values ('" + principalID.ToString() +
|
||||||
"', '" + token + "', datetime('now', 'localtime', '+" + lifetime.ToString() + " minutes'))");
|
"', '" + token + "', datetime('now', 'localtime', '+" + lifetime.ToString() + " minutes'))"))
|
||||||
|
|
||||||
if (ExecuteNonQuery(cmd, m_Connection) > 0)
|
|
||||||
{
|
{
|
||||||
cmd.Dispose();
|
if (ExecuteNonQuery(cmd, m_Connection) > 0)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd.Dispose();
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -245,28 +238,22 @@ namespace OpenSim.Data.SQLite
|
||||||
if (System.Environment.TickCount - m_LastExpire > 30000)
|
if (System.Environment.TickCount - m_LastExpire > 30000)
|
||||||
DoExpire();
|
DoExpire();
|
||||||
|
|
||||||
SqliteCommand cmd = new SqliteCommand("update tokens set validity = datetime('now', 'localtime', '+" + lifetime.ToString() +
|
using (SqliteCommand cmd = new SqliteCommand("update tokens set validity = datetime('now', 'localtime', '+" + lifetime.ToString() +
|
||||||
" minutes') where UUID = '" + principalID.ToString() + "' and token = '" + token + "' and validity > datetime('now', 'localtime')");
|
" minutes') where UUID = '" + principalID.ToString() + "' and token = '" + token + "' and validity > datetime('now', 'localtime')"))
|
||||||
|
|
||||||
if (ExecuteNonQuery(cmd, m_Connection) > 0)
|
|
||||||
{
|
{
|
||||||
cmd.Dispose();
|
if (ExecuteNonQuery(cmd, m_Connection) > 0)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd.Dispose();
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DoExpire()
|
private void DoExpire()
|
||||||
{
|
{
|
||||||
SqliteCommand cmd = new SqliteCommand("delete from tokens where validity < datetime('now', 'localtime')");
|
using (SqliteCommand cmd = new SqliteCommand("delete from tokens where validity < datetime('now', 'localtime')"))
|
||||||
ExecuteNonQuery(cmd, m_Connection);
|
ExecuteNonQuery(cmd, m_Connection);
|
||||||
|
|
||||||
cmd.Dispose();
|
|
||||||
|
|
||||||
m_LastExpire = System.Environment.TickCount;
|
m_LastExpire = System.Environment.TickCount;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -56,23 +56,17 @@ namespace OpenSim.Data.SQLite
|
||||||
|
|
||||||
public bool Delete(UUID principalID, string name)
|
public bool Delete(UUID principalID, string name)
|
||||||
{
|
{
|
||||||
SqliteCommand cmd = new SqliteCommand();
|
using (SqliteCommand cmd = new SqliteCommand())
|
||||||
|
|
||||||
cmd.CommandText = String.Format("delete from {0} where `PrincipalID` = :PrincipalID and `Name` = :Name", m_Realm);
|
|
||||||
cmd.Parameters.AddWithValue(":PrincipalID", principalID.ToString());
|
|
||||||
cmd.Parameters.AddWithValue(":Name", name);
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
{
|
||||||
|
cmd.CommandText = String.Format("delete from {0} where `PrincipalID` = :PrincipalID and `Name` = :Name", m_Realm);
|
||||||
|
cmd.Parameters.AddWithValue(":PrincipalID", principalID.ToString());
|
||||||
|
cmd.Parameters.AddWithValue(":Name", name);
|
||||||
|
|
||||||
if (ExecuteNonQuery(cmd, m_Connection) > 0)
|
if (ExecuteNonQuery(cmd, m_Connection) > 0)
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
//CloseCommand(cmd);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -104,12 +104,13 @@ namespace OpenSim.Data.SQLite
|
||||||
{
|
{
|
||||||
string sql = "select estate_settings."+String.Join(",estate_settings.", FieldList)+" from estate_map left join estate_settings on estate_map.EstateID = estate_settings.EstateID where estate_settings.EstateID is not null and RegionID = :RegionID";
|
string sql = "select estate_settings."+String.Join(",estate_settings.", FieldList)+" from estate_map left join estate_settings on estate_map.EstateID = estate_settings.EstateID where estate_settings.EstateID is not null and RegionID = :RegionID";
|
||||||
|
|
||||||
SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
|
using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand())
|
||||||
|
{
|
||||||
|
cmd.CommandText = sql;
|
||||||
|
cmd.Parameters.AddWithValue(":RegionID", regionID.ToString());
|
||||||
|
|
||||||
cmd.CommandText = sql;
|
return DoLoad(cmd, regionID, create);
|
||||||
cmd.Parameters.AddWithValue(":RegionID", regionID.ToString());
|
}
|
||||||
|
|
||||||
return DoLoad(cmd, regionID, create);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private EstateSettings DoLoad(SqliteCommand cmd, UUID regionID, bool create)
|
private EstateSettings DoLoad(SqliteCommand cmd, UUID regionID, bool create)
|
||||||
|
@ -186,38 +187,40 @@ namespace OpenSim.Data.SQLite
|
||||||
{
|
{
|
||||||
List<string> names = new List<string>(FieldList);
|
List<string> names = new List<string>(FieldList);
|
||||||
|
|
||||||
SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
|
|
||||||
IDataReader r = null;
|
IDataReader r = null;
|
||||||
|
|
||||||
names.Remove("EstateID");
|
using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand())
|
||||||
|
{
|
||||||
|
names.Remove("EstateID");
|
||||||
|
|
||||||
string sql = "insert into estate_settings ("+String.Join(",", names.ToArray())+") values ( :"+String.Join(", :", names.ToArray())+")";
|
string sql = "insert into estate_settings ("+String.Join(",", names.ToArray())+") values ( :"+String.Join(", :", names.ToArray())+")";
|
||||||
|
|
||||||
cmd.CommandText = sql;
|
cmd.CommandText = sql;
|
||||||
cmd.Parameters.Clear();
|
cmd.Parameters.Clear();
|
||||||
|
|
||||||
foreach (string name in FieldList)
|
foreach (string name in FieldList)
|
||||||
{
|
|
||||||
if (m_FieldMap[name].GetValue(es) is bool)
|
|
||||||
{
|
{
|
||||||
if ((bool)m_FieldMap[name].GetValue(es))
|
if (m_FieldMap[name].GetValue(es) is bool)
|
||||||
cmd.Parameters.AddWithValue(":"+name, "1");
|
{
|
||||||
|
if ((bool)m_FieldMap[name].GetValue(es))
|
||||||
|
cmd.Parameters.AddWithValue(":"+name, "1");
|
||||||
|
else
|
||||||
|
cmd.Parameters.AddWithValue(":"+name, "0");
|
||||||
|
}
|
||||||
else
|
else
|
||||||
cmd.Parameters.AddWithValue(":"+name, "0");
|
{
|
||||||
}
|
cmd.Parameters.AddWithValue(":"+name, m_FieldMap[name].GetValue(es).ToString());
|
||||||
else
|
}
|
||||||
{
|
|
||||||
cmd.Parameters.AddWithValue(":"+name, m_FieldMap[name].GetValue(es).ToString());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cmd.ExecuteNonQuery();
|
||||||
|
|
||||||
|
cmd.CommandText = "select LAST_INSERT_ROWID() as id";
|
||||||
|
cmd.Parameters.Clear();
|
||||||
|
|
||||||
|
r = cmd.ExecuteReader();
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd.ExecuteNonQuery();
|
|
||||||
|
|
||||||
cmd.CommandText = "select LAST_INSERT_ROWID() as id";
|
|
||||||
cmd.Parameters.Clear();
|
|
||||||
|
|
||||||
r = cmd.ExecuteReader();
|
|
||||||
|
|
||||||
r.Read();
|
r.Read();
|
||||||
|
|
||||||
es.EstateID = Convert.ToUInt32(r["id"]);
|
es.EstateID = Convert.ToUInt32(r["id"]);
|
||||||
|
@ -239,26 +242,27 @@ namespace OpenSim.Data.SQLite
|
||||||
|
|
||||||
string sql = "update estate_settings set "+String.Join(", ", terms.ToArray())+" where EstateID = :EstateID";
|
string sql = "update estate_settings set "+String.Join(", ", terms.ToArray())+" where EstateID = :EstateID";
|
||||||
|
|
||||||
SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
|
using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand())
|
||||||
|
|
||||||
cmd.CommandText = sql;
|
|
||||||
|
|
||||||
foreach (string name in FieldList)
|
|
||||||
{
|
{
|
||||||
if (m_FieldMap[name].GetValue(es) is bool)
|
cmd.CommandText = sql;
|
||||||
{
|
|
||||||
if ((bool)m_FieldMap[name].GetValue(es))
|
|
||||||
cmd.Parameters.AddWithValue(":"+name, "1");
|
|
||||||
else
|
|
||||||
cmd.Parameters.AddWithValue(":"+name, "0");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
cmd.Parameters.AddWithValue(":"+name, m_FieldMap[name].GetValue(es).ToString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
cmd.ExecuteNonQuery();
|
foreach (string name in FieldList)
|
||||||
|
{
|
||||||
|
if (m_FieldMap[name].GetValue(es) is bool)
|
||||||
|
{
|
||||||
|
if ((bool)m_FieldMap[name].GetValue(es))
|
||||||
|
cmd.Parameters.AddWithValue(":"+name, "1");
|
||||||
|
else
|
||||||
|
cmd.Parameters.AddWithValue(":"+name, "0");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
cmd.Parameters.AddWithValue(":"+name, m_FieldMap[name].GetValue(es).ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cmd.ExecuteNonQuery();
|
||||||
|
}
|
||||||
|
|
||||||
SaveBanList(es);
|
SaveBanList(es);
|
||||||
SaveUUIDList(es.EstateID, "estate_managers", es.EstateManagers);
|
SaveUUIDList(es.EstateID, "estate_managers", es.EstateManagers);
|
||||||
|
@ -270,12 +274,15 @@ namespace OpenSim.Data.SQLite
|
||||||
{
|
{
|
||||||
es.ClearBans();
|
es.ClearBans();
|
||||||
|
|
||||||
SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
|
IDataReader r;
|
||||||
|
|
||||||
cmd.CommandText = "select bannedUUID from estateban where EstateID = :EstateID";
|
using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand())
|
||||||
cmd.Parameters.AddWithValue(":EstateID", es.EstateID);
|
{
|
||||||
|
cmd.CommandText = "select bannedUUID from estateban where EstateID = :EstateID";
|
||||||
|
cmd.Parameters.AddWithValue(":EstateID", es.EstateID);
|
||||||
|
|
||||||
IDataReader r = cmd.ExecuteReader();
|
r = cmd.ExecuteReader();
|
||||||
|
}
|
||||||
|
|
||||||
while (r.Read())
|
while (r.Read())
|
||||||
{
|
{
|
||||||
|
@ -294,60 +301,64 @@ namespace OpenSim.Data.SQLite
|
||||||
|
|
||||||
private void SaveBanList(EstateSettings es)
|
private void SaveBanList(EstateSettings es)
|
||||||
{
|
{
|
||||||
SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
|
using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand())
|
||||||
|
|
||||||
cmd.CommandText = "delete from estateban where EstateID = :EstateID";
|
|
||||||
cmd.Parameters.AddWithValue(":EstateID", es.EstateID.ToString());
|
|
||||||
|
|
||||||
cmd.ExecuteNonQuery();
|
|
||||||
|
|
||||||
cmd.Parameters.Clear();
|
|
||||||
|
|
||||||
cmd.CommandText = "insert into estateban (EstateID, bannedUUID, bannedIp, bannedIpHostMask, bannedNameMask) values ( :EstateID, :bannedUUID, '', '', '' )";
|
|
||||||
|
|
||||||
foreach (EstateBan b in es.EstateBans)
|
|
||||||
{
|
{
|
||||||
|
cmd.CommandText = "delete from estateban where EstateID = :EstateID";
|
||||||
cmd.Parameters.AddWithValue(":EstateID", es.EstateID.ToString());
|
cmd.Parameters.AddWithValue(":EstateID", es.EstateID.ToString());
|
||||||
cmd.Parameters.AddWithValue(":bannedUUID", b.BannedUserID.ToString());
|
|
||||||
|
|
||||||
cmd.ExecuteNonQuery();
|
cmd.ExecuteNonQuery();
|
||||||
|
|
||||||
cmd.Parameters.Clear();
|
cmd.Parameters.Clear();
|
||||||
|
|
||||||
|
cmd.CommandText = "insert into estateban (EstateID, bannedUUID, bannedIp, bannedIpHostMask, bannedNameMask) values ( :EstateID, :bannedUUID, '', '', '' )";
|
||||||
|
|
||||||
|
foreach (EstateBan b in es.EstateBans)
|
||||||
|
{
|
||||||
|
cmd.Parameters.AddWithValue(":EstateID", es.EstateID.ToString());
|
||||||
|
cmd.Parameters.AddWithValue(":bannedUUID", b.BannedUserID.ToString());
|
||||||
|
|
||||||
|
cmd.ExecuteNonQuery();
|
||||||
|
cmd.Parameters.Clear();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SaveUUIDList(uint EstateID, string table, UUID[] data)
|
void SaveUUIDList(uint EstateID, string table, UUID[] data)
|
||||||
{
|
{
|
||||||
SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
|
using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand())
|
||||||
|
|
||||||
cmd.CommandText = "delete from "+table+" where EstateID = :EstateID";
|
|
||||||
cmd.Parameters.AddWithValue(":EstateID", EstateID.ToString());
|
|
||||||
|
|
||||||
cmd.ExecuteNonQuery();
|
|
||||||
|
|
||||||
cmd.Parameters.Clear();
|
|
||||||
|
|
||||||
cmd.CommandText = "insert into "+table+" (EstateID, uuid) values ( :EstateID, :uuid )";
|
|
||||||
|
|
||||||
foreach (UUID uuid in data)
|
|
||||||
{
|
{
|
||||||
|
cmd.CommandText = "delete from "+table+" where EstateID = :EstateID";
|
||||||
cmd.Parameters.AddWithValue(":EstateID", EstateID.ToString());
|
cmd.Parameters.AddWithValue(":EstateID", EstateID.ToString());
|
||||||
cmd.Parameters.AddWithValue(":uuid", uuid.ToString());
|
|
||||||
|
|
||||||
cmd.ExecuteNonQuery();
|
cmd.ExecuteNonQuery();
|
||||||
|
|
||||||
cmd.Parameters.Clear();
|
cmd.Parameters.Clear();
|
||||||
|
|
||||||
|
cmd.CommandText = "insert into "+table+" (EstateID, uuid) values ( :EstateID, :uuid )";
|
||||||
|
|
||||||
|
foreach (UUID uuid in data)
|
||||||
|
{
|
||||||
|
cmd.Parameters.AddWithValue(":EstateID", EstateID.ToString());
|
||||||
|
cmd.Parameters.AddWithValue(":uuid", uuid.ToString());
|
||||||
|
|
||||||
|
cmd.ExecuteNonQuery();
|
||||||
|
cmd.Parameters.Clear();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
UUID[] LoadUUIDList(uint EstateID, string table)
|
UUID[] LoadUUIDList(uint EstateID, string table)
|
||||||
{
|
{
|
||||||
List<UUID> uuids = new List<UUID>();
|
List<UUID> uuids = new List<UUID>();
|
||||||
|
IDataReader r;
|
||||||
|
|
||||||
SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
|
using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand())
|
||||||
|
{
|
||||||
|
cmd.CommandText = "select uuid from "+table+" where EstateID = :EstateID";
|
||||||
|
cmd.Parameters.AddWithValue(":EstateID", EstateID);
|
||||||
|
|
||||||
cmd.CommandText = "select uuid from "+table+" where EstateID = :EstateID";
|
r = cmd.ExecuteReader();
|
||||||
cmd.Parameters.AddWithValue(":EstateID", EstateID);
|
}
|
||||||
|
|
||||||
IDataReader r = cmd.ExecuteReader();
|
|
||||||
|
|
||||||
while (r.Read())
|
while (r.Read())
|
||||||
{
|
{
|
||||||
|
@ -367,12 +378,13 @@ namespace OpenSim.Data.SQLite
|
||||||
{
|
{
|
||||||
string sql = "select estate_settings."+String.Join(",estate_settings.", FieldList)+" from estate_settings where estate_settings.EstateID = :EstateID";
|
string sql = "select estate_settings."+String.Join(",estate_settings.", FieldList)+" from estate_settings where estate_settings.EstateID = :EstateID";
|
||||||
|
|
||||||
SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
|
using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand())
|
||||||
|
{
|
||||||
|
cmd.CommandText = sql;
|
||||||
|
cmd.Parameters.AddWithValue(":EstateID", estateID.ToString());
|
||||||
|
|
||||||
cmd.CommandText = sql;
|
return DoLoad(cmd, UUID.Zero, false);
|
||||||
cmd.Parameters.AddWithValue(":EstateID", estateID.ToString());
|
}
|
||||||
|
|
||||||
return DoLoad(cmd, UUID.Zero, false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<EstateSettings> LoadEstateSettingsAll()
|
public List<EstateSettings> LoadEstateSettingsAll()
|
||||||
|
@ -391,13 +403,15 @@ namespace OpenSim.Data.SQLite
|
||||||
List<int> result = new List<int>();
|
List<int> result = new List<int>();
|
||||||
|
|
||||||
string sql = "select EstateID from estate_settings where estate_settings.EstateName = :EstateName";
|
string sql = "select EstateID from estate_settings where estate_settings.EstateName = :EstateName";
|
||||||
|
IDataReader r;
|
||||||
|
|
||||||
SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
|
using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand())
|
||||||
|
{
|
||||||
|
cmd.CommandText = sql;
|
||||||
|
cmd.Parameters.AddWithValue(":EstateName", search);
|
||||||
|
|
||||||
cmd.CommandText = sql;
|
r = cmd.ExecuteReader();
|
||||||
cmd.Parameters.AddWithValue(":EstateName", search);
|
}
|
||||||
|
|
||||||
IDataReader r = cmd.ExecuteReader();
|
|
||||||
|
|
||||||
while (r.Read())
|
while (r.Read())
|
||||||
{
|
{
|
||||||
|
@ -413,12 +427,14 @@ namespace OpenSim.Data.SQLite
|
||||||
List<int> result = new List<int>();
|
List<int> result = new List<int>();
|
||||||
|
|
||||||
string sql = "select EstateID from estate_settings";
|
string sql = "select EstateID from estate_settings";
|
||||||
|
IDataReader r;
|
||||||
|
|
||||||
SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
|
using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand())
|
||||||
|
{
|
||||||
|
cmd.CommandText = sql;
|
||||||
|
|
||||||
cmd.CommandText = sql;
|
r = cmd.ExecuteReader();
|
||||||
|
}
|
||||||
IDataReader r = cmd.ExecuteReader();
|
|
||||||
|
|
||||||
while (r.Read())
|
while (r.Read())
|
||||||
{
|
{
|
||||||
|
@ -434,13 +450,15 @@ namespace OpenSim.Data.SQLite
|
||||||
List<int> result = new List<int>();
|
List<int> result = new List<int>();
|
||||||
|
|
||||||
string sql = "select EstateID from estate_settings where estate_settings.EstateOwner = :EstateOwner";
|
string sql = "select EstateID from estate_settings where estate_settings.EstateOwner = :EstateOwner";
|
||||||
|
IDataReader r;
|
||||||
|
|
||||||
SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
|
using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand())
|
||||||
|
{
|
||||||
|
cmd.CommandText = sql;
|
||||||
|
cmd.Parameters.AddWithValue(":EstateOwner", ownerID);
|
||||||
|
|
||||||
cmd.CommandText = sql;
|
r = cmd.ExecuteReader();
|
||||||
cmd.Parameters.AddWithValue(":EstateOwner", ownerID);
|
}
|
||||||
|
|
||||||
IDataReader r = cmd.ExecuteReader();
|
|
||||||
|
|
||||||
while (r.Read())
|
while (r.Read())
|
||||||
{
|
{
|
||||||
|
|
|
@ -90,12 +90,5 @@ namespace OpenSim.Data.SQLite
|
||||||
return cmd.ExecuteReader();
|
return cmd.ExecuteReader();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void CloseCommand(SqliteCommand cmd)
|
|
||||||
{
|
|
||||||
cmd.Connection.Close();
|
|
||||||
cmd.Connection.Dispose();
|
|
||||||
cmd.Dispose();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -53,13 +53,13 @@ namespace OpenSim.Data.SQLite
|
||||||
|
|
||||||
public FriendsData[] GetFriends(string userID)
|
public FriendsData[] GetFriends(string userID)
|
||||||
{
|
{
|
||||||
SqliteCommand cmd = new SqliteCommand();
|
using (SqliteCommand cmd = new SqliteCommand())
|
||||||
|
{
|
||||||
cmd.CommandText = String.Format("select a.*,case when b.Flags is null then -1 else b.Flags end as TheirFlags from {0} as a left join {0} as b on a.PrincipalID = b.Friend and a.Friend = b.PrincipalID where a.PrincipalID = :PrincipalID", m_Realm);
|
cmd.CommandText = String.Format("select a.*,case when b.Flags is null then -1 else b.Flags end as TheirFlags from {0} as a left join {0} as b on a.PrincipalID = b.Friend and a.Friend = b.PrincipalID where a.PrincipalID = :PrincipalID", m_Realm);
|
||||||
cmd.Parameters.AddWithValue(":PrincipalID", userID.ToString());
|
cmd.Parameters.AddWithValue(":PrincipalID", userID.ToString());
|
||||||
|
|
||||||
return DoQuery(cmd);
|
|
||||||
|
|
||||||
|
return DoQuery(cmd);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Delete(UUID principalID, string friend)
|
public bool Delete(UUID principalID, string friend)
|
||||||
|
@ -69,13 +69,14 @@ namespace OpenSim.Data.SQLite
|
||||||
|
|
||||||
public bool Delete(string principalID, string friend)
|
public bool Delete(string principalID, string friend)
|
||||||
{
|
{
|
||||||
SqliteCommand cmd = new SqliteCommand();
|
using (SqliteCommand cmd = new SqliteCommand())
|
||||||
|
{
|
||||||
|
cmd.CommandText = String.Format("delete from {0} where PrincipalID = :PrincipalID and Friend = :Friend", m_Realm);
|
||||||
|
cmd.Parameters.AddWithValue(":PrincipalID", principalID.ToString());
|
||||||
|
cmd.Parameters.AddWithValue(":Friend", friend);
|
||||||
|
|
||||||
cmd.CommandText = String.Format("delete from {0} where PrincipalID = :PrincipalID and Friend = :Friend", m_Realm);
|
ExecuteNonQuery(cmd, m_Connection);
|
||||||
cmd.Parameters.AddWithValue(":PrincipalID", principalID.ToString());
|
}
|
||||||
cmd.Parameters.AddWithValue(":Friend", friend);
|
|
||||||
|
|
||||||
ExecuteNonQuery(cmd, m_Connection);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -120,34 +120,35 @@ namespace OpenSim.Data.SQLite
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public T[] Get(string field, string key)
|
public virtual T[] Get(string field, string key)
|
||||||
{
|
{
|
||||||
return Get(new string[] { field }, new string[] { key });
|
return Get(new string[] { field }, new string[] { key });
|
||||||
}
|
}
|
||||||
|
|
||||||
public T[] Get(string[] fields, string[] keys)
|
public virtual T[] Get(string[] fields, string[] keys)
|
||||||
{
|
{
|
||||||
if (fields.Length != keys.Length)
|
if (fields.Length != keys.Length)
|
||||||
return new T[0];
|
return new T[0];
|
||||||
|
|
||||||
List<string> terms = new List<string>();
|
List<string> terms = new List<string>();
|
||||||
|
|
||||||
SqliteCommand cmd = new SqliteCommand();
|
using (SqliteCommand cmd = new SqliteCommand())
|
||||||
|
|
||||||
for (int i = 0 ; i < fields.Length ; i++)
|
|
||||||
{
|
{
|
||||||
cmd.Parameters.Add(new SqliteParameter(":" + fields[i], keys[i]));
|
for (int i = 0 ; i < fields.Length ; i++)
|
||||||
terms.Add("`" + fields[i] + "` = :" + fields[i]);
|
{
|
||||||
|
cmd.Parameters.Add(new SqliteParameter(":" + fields[i], keys[i]));
|
||||||
|
terms.Add("`" + fields[i] + "` = :" + fields[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
string where = String.Join(" and ", terms.ToArray());
|
||||||
|
|
||||||
|
string query = String.Format("select * from {0} where {1}",
|
||||||
|
m_Realm, where);
|
||||||
|
|
||||||
|
cmd.CommandText = query;
|
||||||
|
|
||||||
|
return DoQuery(cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
string where = String.Join(" and ", terms.ToArray());
|
|
||||||
|
|
||||||
string query = String.Format("select * from {0} where {1}",
|
|
||||||
m_Realm, where);
|
|
||||||
|
|
||||||
cmd.CommandText = query;
|
|
||||||
|
|
||||||
return DoQuery(cmd);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected T[] DoQuery(SqliteCommand cmd)
|
protected T[] DoQuery(SqliteCommand cmd)
|
||||||
|
@ -212,53 +213,55 @@ namespace OpenSim.Data.SQLite
|
||||||
return result.ToArray();
|
return result.ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
public T[] Get(string where)
|
public virtual T[] Get(string where)
|
||||||
{
|
{
|
||||||
SqliteCommand cmd = new SqliteCommand();
|
using (SqliteCommand cmd = new SqliteCommand())
|
||||||
|
{
|
||||||
|
string query = String.Format("select * from {0} where {1}",
|
||||||
|
m_Realm, where);
|
||||||
|
|
||||||
string query = String.Format("select * from {0} where {1}",
|
cmd.CommandText = query;
|
||||||
m_Realm, where);
|
|
||||||
|
|
||||||
cmd.CommandText = query;
|
return DoQuery(cmd);
|
||||||
|
}
|
||||||
return DoQuery(cmd);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Store(T row)
|
public virtual bool Store(T row)
|
||||||
{
|
{
|
||||||
SqliteCommand cmd = new SqliteCommand();
|
using (SqliteCommand cmd = new SqliteCommand())
|
||||||
|
|
||||||
string query = "";
|
|
||||||
List<String> names = new List<String>();
|
|
||||||
List<String> values = new List<String>();
|
|
||||||
|
|
||||||
foreach (FieldInfo fi in m_Fields.Values)
|
|
||||||
{
|
{
|
||||||
names.Add(fi.Name);
|
string query = "";
|
||||||
values.Add(":" + fi.Name);
|
List<String> names = new List<String>();
|
||||||
cmd.Parameters.Add(new SqliteParameter(":" + fi.Name, fi.GetValue(row).ToString()));
|
List<String> values = new List<String>();
|
||||||
}
|
|
||||||
|
|
||||||
if (m_DataField != null)
|
foreach (FieldInfo fi in m_Fields.Values)
|
||||||
{
|
|
||||||
Dictionary<string, string> data =
|
|
||||||
(Dictionary<string, string>)m_DataField.GetValue(row);
|
|
||||||
|
|
||||||
foreach (KeyValuePair<string, string> kvp in data)
|
|
||||||
{
|
{
|
||||||
names.Add(kvp.Key);
|
names.Add(fi.Name);
|
||||||
values.Add(":" + kvp.Key);
|
values.Add(":" + fi.Name);
|
||||||
cmd.Parameters.Add(new SqliteParameter(":" + kvp.Key, kvp.Value));
|
cmd.Parameters.Add(new SqliteParameter(":" + fi.Name, fi.GetValue(row).ToString()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (m_DataField != null)
|
||||||
|
{
|
||||||
|
Dictionary<string, string> data =
|
||||||
|
(Dictionary<string, string>)m_DataField.GetValue(row);
|
||||||
|
|
||||||
|
foreach (KeyValuePair<string, string> kvp in data)
|
||||||
|
{
|
||||||
|
names.Add(kvp.Key);
|
||||||
|
values.Add(":" + kvp.Key);
|
||||||
|
cmd.Parameters.Add(new SqliteParameter(":" + kvp.Key, kvp.Value));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
query = String.Format("replace into {0} (`", m_Realm) + String.Join("`,`", names.ToArray()) + "`) values (" + String.Join(",", values.ToArray()) + ")";
|
||||||
|
|
||||||
|
cmd.CommandText = query;
|
||||||
|
|
||||||
|
if (ExecuteNonQuery(cmd, m_Connection) > 0)
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
query = String.Format("replace into {0} (`", m_Realm) + String.Join("`,`", names.ToArray()) + "`) values (" + String.Join(",", values.ToArray()) + ")";
|
|
||||||
|
|
||||||
cmd.CommandText = query;
|
|
||||||
|
|
||||||
if (ExecuteNonQuery(cmd, m_Connection) > 0)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -267,28 +270,29 @@ namespace OpenSim.Data.SQLite
|
||||||
return Delete(new string[] { field }, new string[] { key });
|
return Delete(new string[] { field }, new string[] { key });
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Delete(string[] fields, string[] keys)
|
public virtual bool Delete(string[] fields, string[] keys)
|
||||||
{
|
{
|
||||||
if (fields.Length != keys.Length)
|
if (fields.Length != keys.Length)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
List<string> terms = new List<string>();
|
List<string> terms = new List<string>();
|
||||||
|
|
||||||
SqliteCommand cmd = new SqliteCommand();
|
using (SqliteCommand cmd = new SqliteCommand())
|
||||||
|
|
||||||
for (int i = 0 ; i < fields.Length ; i++)
|
|
||||||
{
|
{
|
||||||
cmd.Parameters.Add(new SqliteParameter(":" + fields[i], keys[i]));
|
for (int i = 0 ; i < fields.Length ; i++)
|
||||||
terms.Add("`" + fields[i] + "` = :" + fields[i]);
|
{
|
||||||
|
cmd.Parameters.Add(new SqliteParameter(":" + fields[i], keys[i]));
|
||||||
|
terms.Add("`" + fields[i] + "` = :" + fields[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
string where = String.Join(" and ", terms.ToArray());
|
||||||
|
|
||||||
|
string query = String.Format("delete from {0} where {1}", m_Realm, where);
|
||||||
|
|
||||||
|
cmd.CommandText = query;
|
||||||
|
|
||||||
|
return ExecuteNonQuery(cmd, m_Connection) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
string where = String.Join(" and ", terms.ToArray());
|
|
||||||
|
|
||||||
string query = String.Format("delete from {0} where {1}", m_Realm, where);
|
|
||||||
|
|
||||||
cmd.CommandText = query;
|
|
||||||
|
|
||||||
return ExecuteNonQuery(cmd, m_Connection) > 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1366,6 +1366,13 @@ namespace OpenSim.Data.SQLite
|
||||||
createCol(land, "UserLookAtZ", typeof(Double));
|
createCol(land, "UserLookAtZ", typeof(Double));
|
||||||
createCol(land, "AuthbuyerID", typeof(String));
|
createCol(land, "AuthbuyerID", typeof(String));
|
||||||
createCol(land, "OtherCleanTime", typeof(Int32));
|
createCol(land, "OtherCleanTime", typeof(Int32));
|
||||||
|
createCol(land, "Dwell", typeof(Int32));
|
||||||
|
createCol(land, "MediaType", typeof(String));
|
||||||
|
createCol(land, "MediaDescription", typeof(String));
|
||||||
|
createCol(land, "MediaSize", typeof(String));
|
||||||
|
createCol(land, "MediaLoop", typeof(Boolean));
|
||||||
|
createCol(land, "ObscureMedia", typeof(Boolean));
|
||||||
|
createCol(land, "ObscureMusic", typeof(Boolean));
|
||||||
|
|
||||||
land.PrimaryKey = new DataColumn[] { land.Columns["UUID"] };
|
land.PrimaryKey = new DataColumn[] { land.Columns["UUID"] };
|
||||||
|
|
||||||
|
@ -1781,9 +1788,16 @@ namespace OpenSim.Data.SQLite
|
||||||
newData.PassHours = Convert.ToSingle(row["PassHours"]);
|
newData.PassHours = Convert.ToSingle(row["PassHours"]);
|
||||||
newData.PassPrice = Convert.ToInt32(row["PassPrice"]);
|
newData.PassPrice = Convert.ToInt32(row["PassPrice"]);
|
||||||
newData.SnapshotID = (UUID)(String)row["SnapshotUUID"];
|
newData.SnapshotID = (UUID)(String)row["SnapshotUUID"];
|
||||||
|
newData.Dwell = Convert.ToInt32(row["Dwell"]);
|
||||||
|
newData.MediaType = (String)row["MediaType"];
|
||||||
|
newData.MediaDescription = (String)row["MediaDescription"];
|
||||||
|
newData.MediaWidth = Convert.ToInt32((((string)row["MediaSize"]).Split(','))[0]);
|
||||||
|
newData.MediaHeight = Convert.ToInt32((((string)row["MediaSize"]).Split(','))[1]);
|
||||||
|
newData.MediaLoop = Convert.ToBoolean(row["MediaLoop"]);
|
||||||
|
newData.ObscureMedia = Convert.ToBoolean(row["ObscureMedia"]);
|
||||||
|
newData.ObscureMusic = Convert.ToBoolean(row["ObscureMusic"]);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
||||||
newData.UserLocation =
|
newData.UserLocation =
|
||||||
new Vector3(Convert.ToSingle(row["UserLocationX"]), Convert.ToSingle(row["UserLocationY"]),
|
new Vector3(Convert.ToSingle(row["UserLocationX"]), Convert.ToSingle(row["UserLocationY"]),
|
||||||
Convert.ToSingle(row["UserLocationZ"]));
|
Convert.ToSingle(row["UserLocationZ"]));
|
||||||
|
@ -2195,12 +2209,13 @@ namespace OpenSim.Data.SQLite
|
||||||
row["UserLookAtZ"] = land.UserLookAt.Z;
|
row["UserLookAtZ"] = land.UserLookAt.Z;
|
||||||
row["AuthbuyerID"] = land.AuthBuyerID.ToString();
|
row["AuthbuyerID"] = land.AuthBuyerID.ToString();
|
||||||
row["OtherCleanTime"] = land.OtherCleanTime;
|
row["OtherCleanTime"] = land.OtherCleanTime;
|
||||||
|
row["Dwell"] = land.Dwell;
|
||||||
row["MediaType"] = land.MediaType;
|
row["MediaType"] = land.MediaType;
|
||||||
row["MediaDescription"] = land.MediaDescription;
|
row["MediaDescription"] = land.MediaDescription;
|
||||||
row["MediaSize"] = land.MediaWidth.ToString() + "," + land.MediaHeight.ToString();
|
row["MediaSize"] = String.Format("{0},{1}", land.MediaWidth, land.MediaHeight);
|
||||||
row["MediaLoop"] = land.MediaLoop.ToString();
|
row["MediaLoop"] = land.MediaLoop;
|
||||||
row["ObscureMusic"] = land.ObscureMusic.ToString();
|
row["ObscureMusic"] = land.ObscureMusic;
|
||||||
row["ObscureMedia"] = land.ObscureMedia.ToString();
|
row["ObscureMedia"] = land.ObscureMedia;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -66,20 +66,21 @@ namespace OpenSim.Data.SQLite
|
||||||
if (words.Length > 2)
|
if (words.Length > 2)
|
||||||
return new UserAccountData[0];
|
return new UserAccountData[0];
|
||||||
|
|
||||||
SqliteCommand cmd = new SqliteCommand();
|
using (SqliteCommand cmd = new SqliteCommand())
|
||||||
|
|
||||||
if (words.Length == 1)
|
|
||||||
{
|
{
|
||||||
cmd.CommandText = String.Format("select * from {0} where (ScopeID='{1}' or ScopeID='00000000-0000-0000-0000-000000000000') and (FirstName like '{2}%' or LastName like '{2}%')",
|
if (words.Length == 1)
|
||||||
m_Realm, scopeID.ToString(), words[0]);
|
{
|
||||||
}
|
cmd.CommandText = String.Format("select * from {0} where (ScopeID='{1}' or ScopeID='00000000-0000-0000-0000-000000000000') and (FirstName like '{2}%' or LastName like '{2}%')",
|
||||||
else
|
m_Realm, scopeID.ToString(), words[0]);
|
||||||
{
|
}
|
||||||
cmd.CommandText = String.Format("select * from {0} where (ScopeID='{1}' or ScopeID='00000000-0000-0000-0000-000000000000') and (FirstName like '{2}%' or LastName like '{3}%')",
|
else
|
||||||
m_Realm, scopeID.ToString(), words[0], words[1]);
|
{
|
||||||
}
|
cmd.CommandText = String.Format("select * from {0} where (ScopeID='{1}' or ScopeID='00000000-0000-0000-0000-000000000000') and (FirstName like '{2}%' or LastName like '{3}%')",
|
||||||
|
m_Realm, scopeID.ToString(), words[0], words[1]);
|
||||||
|
}
|
||||||
|
|
||||||
return DoQuery(cmd);
|
return DoQuery(cmd);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public UserAccountData[] GetUsersWhere(UUID scopeID, string where)
|
public UserAccountData[] GetUsersWhere(UUID scopeID, string where)
|
||||||
|
|
|
@ -47,7 +47,7 @@ namespace OpenSim.Data.SQLite
|
||||||
{
|
{
|
||||||
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
private SQLiteGenericTableHandler<XInventoryFolder> m_Folders;
|
private SqliteFolderHandler m_Folders;
|
||||||
private SqliteItemHandler m_Items;
|
private SqliteItemHandler m_Items;
|
||||||
|
|
||||||
public SQLiteXInventoryData(string conn, string realm)
|
public SQLiteXInventoryData(string conn, string realm)
|
||||||
|
@ -55,7 +55,7 @@ namespace OpenSim.Data.SQLite
|
||||||
if (Util.IsWindows())
|
if (Util.IsWindows())
|
||||||
Util.LoadArchSpecificWindowsDll("sqlite3.dll");
|
Util.LoadArchSpecificWindowsDll("sqlite3.dll");
|
||||||
|
|
||||||
m_Folders = new SQLiteGenericTableHandler<XInventoryFolder>(
|
m_Folders = new SqliteFolderHandler(
|
||||||
conn, "inventoryfolders", "XInventoryStore");
|
conn, "inventoryfolders", "XInventoryStore");
|
||||||
m_Items = new SqliteItemHandler(
|
m_Items = new SqliteItemHandler(
|
||||||
conn, "inventoryitems", String.Empty);
|
conn, "inventoryitems", String.Empty);
|
||||||
|
@ -114,6 +114,11 @@ namespace OpenSim.Data.SQLite
|
||||||
return m_Items.MoveItem(id, newParent);
|
return m_Items.MoveItem(id, newParent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool MoveFolder(string id, string newParent)
|
||||||
|
{
|
||||||
|
return m_Folders.MoveFolder(id, newParent);
|
||||||
|
}
|
||||||
|
|
||||||
public XInventoryItem[] GetActiveGestures(UUID principalID)
|
public XInventoryItem[] GetActiveGestures(UUID principalID)
|
||||||
{
|
{
|
||||||
return m_Items.GetActiveGestures(principalID);
|
return m_Items.GetActiveGestures(principalID);
|
||||||
|
@ -125,44 +130,106 @@ namespace OpenSim.Data.SQLite
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class SqliteItemHandler : SQLiteGenericTableHandler<XInventoryItem>
|
public class SqliteItemHandler : SqliteInventoryHandler<XInventoryItem>
|
||||||
{
|
{
|
||||||
public SqliteItemHandler(string c, string t, string m) :
|
public SqliteItemHandler(string c, string t, string m) :
|
||||||
base(c, t, m)
|
base(c, t, m)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override bool Store(XInventoryItem item)
|
||||||
|
{
|
||||||
|
if (!base.Store(item))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
IncrementFolderVersion(item.parentFolderID);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool Delete(string field, string val)
|
||||||
|
{
|
||||||
|
XInventoryItem[] retrievedItems = Get(new string[] { field }, new string[] { val });
|
||||||
|
if (retrievedItems.Length == 0)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (!base.Delete(field, val))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// Don't increment folder version here since Delete(string, string) calls Delete(string[], string[])
|
||||||
|
// IncrementFolderVersion(retrievedItems[0].parentFolderID);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool Delete(string[] fields, string[] vals)
|
||||||
|
{
|
||||||
|
XInventoryItem[] retrievedItems = Get(fields, vals);
|
||||||
|
if (retrievedItems.Length == 0)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (!base.Delete(fields, vals))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
HashSet<UUID> deletedItemFolderUUIDs = new HashSet<UUID>();
|
||||||
|
|
||||||
|
Array.ForEach<XInventoryItem>(retrievedItems, i => deletedItemFolderUUIDs.Add(i.parentFolderID));
|
||||||
|
|
||||||
|
foreach (UUID deletedItemFolderUUID in deletedItemFolderUUIDs)
|
||||||
|
IncrementFolderVersion(deletedItemFolderUUID);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
public bool MoveItem(string id, string newParent)
|
public bool MoveItem(string id, string newParent)
|
||||||
{
|
{
|
||||||
SqliteCommand cmd = new SqliteCommand();
|
XInventoryItem[] retrievedItems = Get(new string[] { "inventoryID" }, new string[] { id });
|
||||||
|
if (retrievedItems.Length == 0)
|
||||||
|
return false;
|
||||||
|
|
||||||
cmd.CommandText = String.Format("update {0} set parentFolderID = :ParentFolderID where inventoryID = :InventoryID", m_Realm);
|
UUID oldParent = retrievedItems[0].parentFolderID;
|
||||||
cmd.Parameters.Add(new SqliteParameter(":ParentFolderID", newParent));
|
|
||||||
cmd.Parameters.Add(new SqliteParameter(":InventoryID", id));
|
|
||||||
|
|
||||||
return ExecuteNonQuery(cmd, m_Connection) == 0 ? false : true;
|
using (SqliteCommand cmd = new SqliteCommand())
|
||||||
|
{
|
||||||
|
cmd.CommandText = String.Format("update {0} set parentFolderID = :ParentFolderID where inventoryID = :InventoryID", m_Realm);
|
||||||
|
cmd.Parameters.Add(new SqliteParameter(":ParentFolderID", newParent));
|
||||||
|
cmd.Parameters.Add(new SqliteParameter(":InventoryID", id));
|
||||||
|
|
||||||
|
if (ExecuteNonQuery(cmd, m_Connection) == 0)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
IncrementFolderVersion(oldParent);
|
||||||
|
IncrementFolderVersion(newParent);
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public XInventoryItem[] GetActiveGestures(UUID principalID)
|
public XInventoryItem[] GetActiveGestures(UUID principalID)
|
||||||
{
|
{
|
||||||
SqliteCommand cmd = new SqliteCommand();
|
using (SqliteCommand cmd = new SqliteCommand())
|
||||||
cmd.CommandText = String.Format("select * from inventoryitems where avatarId = :uuid and assetType = :type and flags = 1", m_Realm);
|
{
|
||||||
|
cmd.CommandText = String.Format("select * from inventoryitems where avatarId = :uuid and assetType = :type and flags = 1", m_Realm);
|
||||||
|
|
||||||
cmd.Parameters.Add(new SqliteParameter(":uuid", principalID.ToString()));
|
cmd.Parameters.Add(new SqliteParameter(":uuid", principalID.ToString()));
|
||||||
cmd.Parameters.Add(new SqliteParameter(":type", (int)AssetType.Gesture));
|
cmd.Parameters.Add(new SqliteParameter(":type", (int)AssetType.Gesture));
|
||||||
|
|
||||||
return DoQuery(cmd);
|
return DoQuery(cmd);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public int GetAssetPermissions(UUID principalID, UUID assetID)
|
public int GetAssetPermissions(UUID principalID, UUID assetID)
|
||||||
{
|
{
|
||||||
SqliteCommand cmd = new SqliteCommand();
|
IDataReader reader;
|
||||||
|
|
||||||
cmd.CommandText = String.Format("select inventoryCurrentPermissions from inventoryitems where avatarID = :PrincipalID and assetID = :AssetID", m_Realm);
|
using (SqliteCommand cmd = new SqliteCommand())
|
||||||
cmd.Parameters.Add(new SqliteParameter(":PrincipalID", principalID.ToString()));
|
{
|
||||||
cmd.Parameters.Add(new SqliteParameter(":AssetID", assetID.ToString()));
|
cmd.CommandText = String.Format("select inventoryCurrentPermissions from inventoryitems where avatarID = :PrincipalID and assetID = :AssetID", m_Realm);
|
||||||
|
cmd.Parameters.Add(new SqliteParameter(":PrincipalID", principalID.ToString()));
|
||||||
|
cmd.Parameters.Add(new SqliteParameter(":AssetID", assetID.ToString()));
|
||||||
|
|
||||||
IDataReader reader = ExecuteReader(cmd, m_Connection);
|
reader = ExecuteReader(cmd, m_Connection);
|
||||||
|
}
|
||||||
|
|
||||||
int perms = 0;
|
int perms = 0;
|
||||||
|
|
||||||
|
@ -177,4 +244,81 @@ namespace OpenSim.Data.SQLite
|
||||||
return perms;
|
return perms;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
public class SqliteFolderHandler : SqliteInventoryHandler<XInventoryFolder>
|
||||||
|
{
|
||||||
|
public SqliteFolderHandler(string c, string t, string m) :
|
||||||
|
base(c, t, m)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool Store(XInventoryFolder folder)
|
||||||
|
{
|
||||||
|
if (!base.Store(folder))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
IncrementFolderVersion(folder.parentFolderID);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool MoveFolder(string id, string newParentFolderID)
|
||||||
|
{
|
||||||
|
XInventoryFolder[] folders = Get(new string[] { "folderID" }, new string[] { id });
|
||||||
|
|
||||||
|
if (folders.Length == 0)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
UUID oldParentFolderUUID = folders[0].parentFolderID;
|
||||||
|
|
||||||
|
using (SqliteCommand cmd = new SqliteCommand())
|
||||||
|
{
|
||||||
|
cmd.CommandText = String.Format("update {0} set parentFolderID = :ParentFolderID where folderID = :FolderID", m_Realm);
|
||||||
|
cmd.Parameters.Add(new SqliteParameter(":ParentFolderID", newParentFolderID));
|
||||||
|
cmd.Parameters.Add(new SqliteParameter(":FolderID", id));
|
||||||
|
|
||||||
|
if (ExecuteNonQuery(cmd, m_Connection) == 0)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
IncrementFolderVersion(oldParentFolderUUID);
|
||||||
|
IncrementFolderVersion(newParentFolderID);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public class SqliteInventoryHandler<T> : SQLiteGenericTableHandler<T> where T: class, new()
|
||||||
|
{
|
||||||
|
public SqliteInventoryHandler(string c, string t, string m) : base(c, t, m) {}
|
||||||
|
|
||||||
|
protected bool IncrementFolderVersion(UUID folderID)
|
||||||
|
{
|
||||||
|
return IncrementFolderVersion(folderID.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
|
protected bool IncrementFolderVersion(string folderID)
|
||||||
|
{
|
||||||
|
// m_log.DebugFormat("[MYSQL ITEM HANDLER]: Incrementing version on folder {0}", folderID);
|
||||||
|
// Util.PrintCallStack();
|
||||||
|
|
||||||
|
using (SqliteCommand cmd = new SqliteCommand())
|
||||||
|
{
|
||||||
|
cmd.CommandText = "update inventoryfolders set version=version+1 where folderID = ?folderID";
|
||||||
|
cmd.Parameters.Add(new SqliteParameter(":folderID", folderID));
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
cmd.ExecuteNonQuery();
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -59,5 +59,5 @@ using System.Runtime.InteropServices;
|
||||||
// Revision
|
// Revision
|
||||||
//
|
//
|
||||||
|
|
||||||
[assembly : AssemblyVersion("0.6.5.*")]
|
[assembly : AssemblyVersion("0.7.5.*")]
|
||||||
[assembly : AssemblyFileVersion("0.6.5.0")]
|
[assembly : AssemblyFileVersion("0.6.5.0")]
|
|
@ -0,0 +1,33 @@
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
// General Information about an assembly is controlled through the following
|
||||||
|
// set of attributes. Change these attribute values to modify the information
|
||||||
|
// associated with an assembly.
|
||||||
|
[assembly: AssemblyTitle("OpenSim.Framework.AssetLoader.Filesystem")]
|
||||||
|
[assembly: AssemblyDescription("")]
|
||||||
|
[assembly: AssemblyConfiguration("")]
|
||||||
|
[assembly: AssemblyCompany("http://opensimulator.org")]
|
||||||
|
[assembly: AssemblyProduct("OpenSim")]
|
||||||
|
[assembly: AssemblyCopyright("OpenSimulator developers")]
|
||||||
|
[assembly: AssemblyTrademark("")]
|
||||||
|
[assembly: AssemblyCulture("")]
|
||||||
|
|
||||||
|
// Setting ComVisible to false makes the types in this assembly not visible
|
||||||
|
// to COM components. If you need to access a type in this assembly from
|
||||||
|
// COM, set the ComVisible attribute to true on that type.
|
||||||
|
[assembly: ComVisible(false)]
|
||||||
|
|
||||||
|
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||||
|
[assembly: Guid("8cb9cf69-4771-4d3a-a2ba-bac7230de326")]
|
||||||
|
|
||||||
|
// Version information for an assembly consists of the following four values:
|
||||||
|
//
|
||||||
|
// Major Version
|
||||||
|
// Minor Version
|
||||||
|
// Build Number
|
||||||
|
// Revision
|
||||||
|
//
|
||||||
|
[assembly: AssemblyVersion("0.7.5.*")]
|
||||||
|
[assembly: AssemblyFileVersion("1.0.0.0")]
|
|
@ -0,0 +1,84 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Reflection;
|
||||||
|
|
||||||
|
using Nini.Config;
|
||||||
|
using log4net;
|
||||||
|
|
||||||
|
using OpenMetaverse;
|
||||||
|
|
||||||
|
namespace OpenSim.Framework
|
||||||
|
{
|
||||||
|
public class AssetPermissions
|
||||||
|
{
|
||||||
|
private static readonly ILog m_log =
|
||||||
|
LogManager.GetLogger(
|
||||||
|
MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
|
private bool[] m_DisallowExport, m_DisallowImport;
|
||||||
|
private string[] m_AssetTypeNames;
|
||||||
|
|
||||||
|
public AssetPermissions(IConfig config)
|
||||||
|
{
|
||||||
|
Type enumType = typeof(AssetType);
|
||||||
|
m_AssetTypeNames = Enum.GetNames(enumType);
|
||||||
|
for (int i = 0; i < m_AssetTypeNames.Length; i++)
|
||||||
|
m_AssetTypeNames[i] = m_AssetTypeNames[i].ToLower();
|
||||||
|
int n = Enum.GetValues(enumType).Length;
|
||||||
|
m_DisallowExport = new bool[n];
|
||||||
|
m_DisallowImport = new bool[n];
|
||||||
|
|
||||||
|
LoadPermsFromConfig(config, "DisallowExport", m_DisallowExport);
|
||||||
|
LoadPermsFromConfig(config, "DisallowImport", m_DisallowImport);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LoadPermsFromConfig(IConfig assetConfig, string variable, bool[] bitArray)
|
||||||
|
{
|
||||||
|
if (assetConfig == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
string perms = assetConfig.GetString(variable, String.Empty);
|
||||||
|
string[] parts = perms.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
|
||||||
|
foreach (string s in parts)
|
||||||
|
{
|
||||||
|
int index = Array.IndexOf(m_AssetTypeNames, s.Trim().ToLower());
|
||||||
|
if (index >= 0)
|
||||||
|
bitArray[index] = true;
|
||||||
|
else
|
||||||
|
m_log.WarnFormat("[Asset Permissions]: Invalid AssetType {0}", s);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool AllowedExport(sbyte type)
|
||||||
|
{
|
||||||
|
string assetTypeName = ((AssetType)type).ToString();
|
||||||
|
|
||||||
|
int index = Array.IndexOf(m_AssetTypeNames, assetTypeName.ToLower());
|
||||||
|
if (index >= 0 && m_DisallowExport[index])
|
||||||
|
{
|
||||||
|
m_log.DebugFormat("[Asset Permissions]: Export denied: configuration does not allow export of AssetType {0}", assetTypeName);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool AllowedImport(sbyte type)
|
||||||
|
{
|
||||||
|
string assetTypeName = ((AssetType)type).ToString();
|
||||||
|
|
||||||
|
int index = Array.IndexOf(m_AssetTypeNames, assetTypeName.ToLower());
|
||||||
|
if (index >= 0 && m_DisallowImport[index])
|
||||||
|
{
|
||||||
|
m_log.DebugFormat("[Asset Permissions]: Import denied: configuration does not allow import of AssetType {0}", assetTypeName);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -358,6 +358,9 @@ namespace OpenSim.Framework
|
||||||
SetVisualParams(visualParams);
|
SetVisualParams(visualParams);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Set avatar height by a calculation based on their visual parameters.
|
||||||
|
/// </summary>
|
||||||
public virtual void SetHeight()
|
public virtual void SetHeight()
|
||||||
{
|
{
|
||||||
// Start with shortest possible female avatar height
|
// Start with shortest possible female avatar height
|
||||||
|
|
|
@ -199,7 +199,14 @@ namespace OpenSim.Framework
|
||||||
//
|
//
|
||||||
public class Cache
|
public class Cache
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Must only be accessed under lock.
|
||||||
|
/// </summary>
|
||||||
private List<CacheItemBase> m_Index = new List<CacheItemBase>();
|
private List<CacheItemBase> m_Index = new List<CacheItemBase>();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Must only be accessed under m_Index lock.
|
||||||
|
/// </summary>
|
||||||
private Dictionary<string, CacheItemBase> m_Lookup =
|
private Dictionary<string, CacheItemBase> m_Lookup =
|
||||||
new Dictionary<string, CacheItemBase>();
|
new Dictionary<string, CacheItemBase>();
|
||||||
|
|
||||||
|
@ -320,19 +327,19 @@ namespace OpenSim.Framework
|
||||||
{
|
{
|
||||||
if (m_Lookup.ContainsKey(index))
|
if (m_Lookup.ContainsKey(index))
|
||||||
item = m_Lookup[index];
|
item = m_Lookup[index];
|
||||||
}
|
|
||||||
|
|
||||||
if (item == null)
|
if (item == null)
|
||||||
{
|
{
|
||||||
|
Expire(true);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
item.hits++;
|
||||||
|
item.lastUsed = DateTime.Now;
|
||||||
|
|
||||||
Expire(true);
|
Expire(true);
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
item.hits++;
|
|
||||||
item.lastUsed = DateTime.Now;
|
|
||||||
|
|
||||||
Expire(true);
|
|
||||||
|
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -385,7 +392,10 @@ namespace OpenSim.Framework
|
||||||
//
|
//
|
||||||
public Object Find(Predicate<CacheItemBase> d)
|
public Object Find(Predicate<CacheItemBase> d)
|
||||||
{
|
{
|
||||||
CacheItemBase item = m_Index.Find(d);
|
CacheItemBase item;
|
||||||
|
|
||||||
|
lock (m_Index)
|
||||||
|
item = m_Index.Find(d);
|
||||||
|
|
||||||
if (item == null)
|
if (item == null)
|
||||||
return null;
|
return null;
|
||||||
|
@ -419,12 +429,12 @@ namespace OpenSim.Framework
|
||||||
public virtual void Store(string index, Object data, Type container,
|
public virtual void Store(string index, Object data, Type container,
|
||||||
Object[] parameters)
|
Object[] parameters)
|
||||||
{
|
{
|
||||||
Expire(false);
|
|
||||||
|
|
||||||
CacheItemBase item;
|
CacheItemBase item;
|
||||||
|
|
||||||
lock (m_Index)
|
lock (m_Index)
|
||||||
{
|
{
|
||||||
|
Expire(false);
|
||||||
|
|
||||||
if (m_Index.Contains(new CacheItemBase(index)))
|
if (m_Index.Contains(new CacheItemBase(index)))
|
||||||
{
|
{
|
||||||
if ((m_Flags & CacheFlags.AllowUpdate) != 0)
|
if ((m_Flags & CacheFlags.AllowUpdate) != 0)
|
||||||
|
@ -450,9 +460,17 @@ namespace OpenSim.Framework
|
||||||
m_Index.Add(item);
|
m_Index.Add(item);
|
||||||
m_Lookup[index] = item;
|
m_Lookup[index] = item;
|
||||||
}
|
}
|
||||||
|
|
||||||
item.Store(data);
|
item.Store(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Expire items as appropriate.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// Callers must lock m_Index.
|
||||||
|
/// </remarks>
|
||||||
|
/// <param name='getting'></param>
|
||||||
protected virtual void Expire(bool getting)
|
protected virtual void Expire(bool getting)
|
||||||
{
|
{
|
||||||
if (getting && (m_Strategy == CacheStrategy.Aggressive))
|
if (getting && (m_Strategy == CacheStrategy.Aggressive))
|
||||||
|
@ -475,12 +493,10 @@ namespace OpenSim.Framework
|
||||||
|
|
||||||
switch (m_Strategy)
|
switch (m_Strategy)
|
||||||
{
|
{
|
||||||
case CacheStrategy.Aggressive:
|
case CacheStrategy.Aggressive:
|
||||||
if (Count < Size)
|
if (Count < Size)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
lock (m_Index)
|
|
||||||
{
|
|
||||||
m_Index.Sort(new SortLRU());
|
m_Index.Sort(new SortLRU());
|
||||||
m_Index.Reverse();
|
m_Index.Reverse();
|
||||||
|
|
||||||
|
@ -490,7 +506,7 @@ namespace OpenSim.Framework
|
||||||
|
|
||||||
ExpireDelegate doExpire = OnExpire;
|
ExpireDelegate doExpire = OnExpire;
|
||||||
|
|
||||||
if (doExpire != null)
|
if (doExpire != null)
|
||||||
{
|
{
|
||||||
List<CacheItemBase> candidates =
|
List<CacheItemBase> candidates =
|
||||||
m_Index.GetRange(target, Count - target);
|
m_Index.GetRange(target, Count - target);
|
||||||
|
@ -513,27 +529,34 @@ namespace OpenSim.Framework
|
||||||
foreach (CacheItemBase item in m_Index)
|
foreach (CacheItemBase item in m_Index)
|
||||||
m_Lookup[item.uuid] = item;
|
m_Lookup[item.uuid] = item;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
default:
|
|
||||||
break;
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Invalidate(string uuid)
|
public void Invalidate(string uuid)
|
||||||
{
|
{
|
||||||
if (!m_Lookup.ContainsKey(uuid))
|
lock (m_Index)
|
||||||
return;
|
{
|
||||||
|
if (!m_Lookup.ContainsKey(uuid))
|
||||||
|
return;
|
||||||
|
|
||||||
CacheItemBase item = m_Lookup[uuid];
|
CacheItemBase item = m_Lookup[uuid];
|
||||||
m_Lookup.Remove(uuid);
|
m_Lookup.Remove(uuid);
|
||||||
m_Index.Remove(item);
|
m_Index.Remove(item);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Clear()
|
public void Clear()
|
||||||
{
|
{
|
||||||
m_Index.Clear();
|
lock (m_Index)
|
||||||
m_Lookup.Clear();
|
{
|
||||||
|
m_Index.Clear();
|
||||||
|
m_Lookup.Clear();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -312,6 +312,7 @@ namespace OpenSim.Framework
|
||||||
public AgentGroupData[] Groups;
|
public AgentGroupData[] Groups;
|
||||||
public Animation[] Anims;
|
public Animation[] Anims;
|
||||||
public Animation DefaultAnim = null;
|
public Animation DefaultAnim = null;
|
||||||
|
public Animation AnimState = null;
|
||||||
|
|
||||||
public UUID GranterID;
|
public UUID GranterID;
|
||||||
public UUID ParentPart;
|
public UUID ParentPart;
|
||||||
|
@ -403,6 +404,11 @@ namespace OpenSim.Framework
|
||||||
args["default_animation"] = DefaultAnim.PackUpdateMessage();
|
args["default_animation"] = DefaultAnim.PackUpdateMessage();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (AnimState != null)
|
||||||
|
{
|
||||||
|
args["animation_state"] = AnimState.PackUpdateMessage();
|
||||||
|
}
|
||||||
|
|
||||||
if (Appearance != null)
|
if (Appearance != null)
|
||||||
args["packed_appearance"] = Appearance.Pack();
|
args["packed_appearance"] = Appearance.Pack();
|
||||||
|
|
||||||
|
@ -612,6 +618,18 @@ namespace OpenSim.Framework
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (args["animation_state"] != null)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
AnimState = new Animation((OSDMap)args["animation_state"]);
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
AnimState = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//if ((args["agent_textures"] != null) && (args["agent_textures"]).Type == OSDType.Array)
|
//if ((args["agent_textures"] != null) && (args["agent_textures"]).Type == OSDType.Array)
|
||||||
//{
|
//{
|
||||||
// OSDArray textures = (OSDArray)(args["agent_textures"]);
|
// OSDArray textures = (OSDArray)(args["agent_textures"]);
|
||||||
|
|
|
@ -33,7 +33,8 @@ namespace OpenSim.Framework.Client
|
||||||
{
|
{
|
||||||
event ChatMessage OnChatFromClient;
|
event ChatMessage OnChatFromClient;
|
||||||
|
|
||||||
void SendChatMessage(string message, byte type, Vector3 fromPos, string fromName, UUID fromAgentID, byte source,
|
void SendChatMessage(
|
||||||
byte audible);
|
string message, byte type, Vector3 fromPos, string fromName, UUID fromAgentID, UUID ownerID, byte source,
|
||||||
|
byte audible);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -32,12 +32,12 @@ using System.Runtime.InteropServices;
|
||||||
// set of attributes. Change these attribute values to modify the information
|
// set of attributes. Change these attribute values to modify the information
|
||||||
// associated with an assembly.
|
// associated with an assembly.
|
||||||
|
|
||||||
[assembly : AssemblyTitle("OpenGrid.Framework.Communications")]
|
[assembly : AssemblyTitle("OpenSim.Framework.Communications")]
|
||||||
[assembly : AssemblyDescription("")]
|
[assembly : AssemblyDescription("")]
|
||||||
[assembly : AssemblyConfiguration("")]
|
[assembly : AssemblyConfiguration("")]
|
||||||
[assembly : AssemblyCompany("http://opensimulator.org")]
|
[assembly : AssemblyCompany("http://opensimulator.org")]
|
||||||
[assembly : AssemblyProduct("OpenGrid.Framework.Communications")]
|
[assembly : AssemblyProduct("OpenSim")]
|
||||||
[assembly : AssemblyCopyright("Copyright (c) OpenSimulator.org Developers 2007-2009")]
|
[assembly : AssemblyCopyright("Copyright (c) OpenSimulator.org Developers")]
|
||||||
[assembly : AssemblyTrademark("")]
|
[assembly : AssemblyTrademark("")]
|
||||||
[assembly : AssemblyCulture("")]
|
[assembly : AssemblyCulture("")]
|
||||||
|
|
||||||
|
@ -61,5 +61,5 @@ using System.Runtime.InteropServices;
|
||||||
// You can specify all the values or you can default the Revision and Build Numbers
|
// You can specify all the values or you can default the Revision and Build Numbers
|
||||||
// by using the '*' as shown below:
|
// by using the '*' as shown below:
|
||||||
|
|
||||||
[assembly : AssemblyVersion("0.6.5.*")]
|
[assembly : AssemblyVersion("0.7.5.*")]
|
||||||
[assembly : AssemblyFileVersion("0.6.5.0")]
|
[assembly : AssemblyFileVersion("0.6.5.0")]
|
||||||
|
|
|
@ -0,0 +1,33 @@
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
// General Information about an assembly is controlled through the following
|
||||||
|
// set of attributes. Change these attribute values to modify the information
|
||||||
|
// associated with an assembly.
|
||||||
|
[assembly: AssemblyTitle("OpenSim.Framework.Configuration.HTTP")]
|
||||||
|
[assembly: AssemblyDescription("")]
|
||||||
|
[assembly: AssemblyConfiguration("")]
|
||||||
|
[assembly: AssemblyCompany("http://opensimulator.org")]
|
||||||
|
[assembly: AssemblyProduct("OpenSim")]
|
||||||
|
[assembly: AssemblyCopyright("OpenSimulator develoeprs")]
|
||||||
|
[assembly: AssemblyTrademark("")]
|
||||||
|
[assembly: AssemblyCulture("")]
|
||||||
|
|
||||||
|
// Setting ComVisible to false makes the types in this assembly not visible
|
||||||
|
// to COM components. If you need to access a type in this assembly from
|
||||||
|
// COM, set the ComVisible attribute to true on that type.
|
||||||
|
[assembly: ComVisible(false)]
|
||||||
|
|
||||||
|
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||||
|
[assembly: Guid("cb78b672-d000-4f93-88f9-dae151cc0061")]
|
||||||
|
|
||||||
|
// Version information for an assembly consists of the following four values:
|
||||||
|
//
|
||||||
|
// Major Version
|
||||||
|
// Minor Version
|
||||||
|
// Build Number
|
||||||
|
// Revision
|
||||||
|
//
|
||||||
|
[assembly: AssemblyVersion("0.7.5.*")]
|
||||||
|
[assembly: AssemblyFileVersion("1.0.0.0")]
|
|
@ -0,0 +1,33 @@
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
// General Information about an assembly is controlled through the following
|
||||||
|
// set of attributes. Change these attribute values to modify the information
|
||||||
|
// associated with an assembly.
|
||||||
|
[assembly: AssemblyTitle("OpenSim.Framework.Configuration.XML")]
|
||||||
|
[assembly: AssemblyDescription("")]
|
||||||
|
[assembly: AssemblyConfiguration("")]
|
||||||
|
[assembly: AssemblyCompany("http://opensimulator.org")]
|
||||||
|
[assembly: AssemblyProduct("OpenSim")]
|
||||||
|
[assembly: AssemblyCopyright("OpenSimulator developers")]
|
||||||
|
[assembly: AssemblyTrademark("")]
|
||||||
|
[assembly: AssemblyCulture("")]
|
||||||
|
|
||||||
|
// Setting ComVisible to false makes the types in this assembly not visible
|
||||||
|
// to COM components. If you need to access a type in this assembly from
|
||||||
|
// COM, set the ComVisible attribute to true on that type.
|
||||||
|
[assembly: ComVisible(false)]
|
||||||
|
|
||||||
|
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||||
|
[assembly: Guid("eeb880df-0112-4c3d-87ed-b2108d614c55")]
|
||||||
|
|
||||||
|
// Version information for an assembly consists of the following four values:
|
||||||
|
//
|
||||||
|
// Major Version
|
||||||
|
// Minor Version
|
||||||
|
// Build Number
|
||||||
|
// Revision
|
||||||
|
//
|
||||||
|
[assembly: AssemblyVersion("0.7.5.*")]
|
||||||
|
[assembly: AssemblyFileVersion("1.0.0.0")]
|
|
@ -39,7 +39,7 @@ using System.Runtime.InteropServices;
|
||||||
[assembly: AssemblyConfiguration("")]
|
[assembly: AssemblyConfiguration("")]
|
||||||
[assembly: AssemblyCompany("http://opensimulator.org")]
|
[assembly: AssemblyCompany("http://opensimulator.org")]
|
||||||
[assembly : AssemblyProduct("ServerConsole")]
|
[assembly : AssemblyProduct("ServerConsole")]
|
||||||
[assembly: AssemblyCopyright("Copyright (c) OpenSimulator.org Developers 2007-2009")]
|
[assembly: AssemblyCopyright("Copyright (c) OpenSimulator.org Developers")]
|
||||||
[assembly: AssemblyTrademark("")]
|
[assembly: AssemblyTrademark("")]
|
||||||
[assembly: AssemblyCulture("")]
|
[assembly: AssemblyCulture("")]
|
||||||
|
|
||||||
|
@ -55,4 +55,4 @@ using System.Runtime.InteropServices;
|
||||||
// You can specify all values by your own or you can build default build and revision
|
// You can specify all values by your own or you can build default build and revision
|
||||||
// numbers with the '*' character (the default):
|
// numbers with the '*' character (the default):
|
||||||
|
|
||||||
[assembly : AssemblyVersion("0.6.5.*")]
|
[assembly : AssemblyVersion("0.7.5.*")]
|
||||||
|
|
|
@ -83,7 +83,8 @@ namespace OpenSim.Framework.Console
|
||||||
= "To enter an argument that contains spaces, surround the argument with double quotes.\nFor example, show object name \"My long object name\"\n";
|
= "To enter an argument that contains spaces, surround the argument with double quotes.\nFor example, show object name \"My long object name\"\n";
|
||||||
|
|
||||||
public const string ItemHelpText
|
public const string ItemHelpText
|
||||||
= "For more information, type 'help <item>' where <item> is one of the following:";
|
= @"For more information, type 'help' to get a list of all commands,
|
||||||
|
or type help <item>' where <item> is one of the following:";
|
||||||
|
|
||||||
/// <value>
|
/// <value>
|
||||||
/// Commands organized by keyword in a tree
|
/// Commands organized by keyword in a tree
|
||||||
|
@ -111,6 +112,12 @@ namespace OpenSim.Framework.Console
|
||||||
|
|
||||||
// General help
|
// General help
|
||||||
if (helpParts.Count == 0)
|
if (helpParts.Count == 0)
|
||||||
|
{
|
||||||
|
help.Add(""); // Will become a newline.
|
||||||
|
help.Add(GeneralHelpText);
|
||||||
|
help.AddRange(CollectAllCommandsHelp());
|
||||||
|
}
|
||||||
|
else if (helpParts.Count == 1 && helpParts[0] == "categories")
|
||||||
{
|
{
|
||||||
help.Add(""); // Will become a newline.
|
help.Add(""); // Will become a newline.
|
||||||
help.Add(GeneralHelpText);
|
help.Add(GeneralHelpText);
|
||||||
|
@ -124,6 +131,31 @@ namespace OpenSim.Framework.Console
|
||||||
|
|
||||||
return help;
|
return help;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Collects the help from all commands and return in alphabetical order.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
private List<string> CollectAllCommandsHelp()
|
||||||
|
{
|
||||||
|
List<string> help = new List<string>();
|
||||||
|
|
||||||
|
lock (m_modulesCommands)
|
||||||
|
{
|
||||||
|
foreach (List<CommandInfo> commands in m_modulesCommands.Values)
|
||||||
|
{
|
||||||
|
foreach (CommandInfo c in commands)
|
||||||
|
{
|
||||||
|
if (c.long_help != String.Empty)
|
||||||
|
help.Add(string.Format("{0} - {1}", c.help_text, c.long_help));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
help.Sort();
|
||||||
|
|
||||||
|
return help;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// See if we can find the requested command in order to display longer help
|
/// See if we can find the requested command in order to display longer help
|
||||||
|
@ -711,7 +743,7 @@ namespace OpenSim.Framework.Console
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void Prompt()
|
public void Prompt()
|
||||||
{
|
{
|
||||||
string line = ReadLine(m_defaultPrompt + "# ", true, true);
|
string line = ReadLine(DefaultPrompt + "# ", true, true);
|
||||||
|
|
||||||
if (line != String.Empty)
|
if (line != String.Empty)
|
||||||
Output("Invalid command");
|
Output("Invalid command");
|
||||||
|
|
|
@ -43,15 +43,7 @@ namespace OpenSim.Framework.Console
|
||||||
|
|
||||||
public object ConsoleScene { get; set; }
|
public object ConsoleScene { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
public string DefaultPrompt { get; set; }
|
||||||
/// The default prompt text.
|
|
||||||
/// </summary>
|
|
||||||
public string DefaultPrompt
|
|
||||||
{
|
|
||||||
set { m_defaultPrompt = value; }
|
|
||||||
get { return m_defaultPrompt; }
|
|
||||||
}
|
|
||||||
protected string m_defaultPrompt;
|
|
||||||
|
|
||||||
public ConsoleBase(string defaultPrompt)
|
public ConsoleBase(string defaultPrompt)
|
||||||
{
|
{
|
||||||
|
|
|
@ -0,0 +1,228 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* * Neither the name of the OpenSimulator Project nor the
|
||||||
|
* names of its contributors may be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||||
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Reflection;
|
||||||
|
using log4net;
|
||||||
|
using OpenMetaverse;
|
||||||
|
|
||||||
|
namespace OpenSim.Framework.Console
|
||||||
|
{
|
||||||
|
public class ConsoleUtil
|
||||||
|
{
|
||||||
|
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
|
public const int LocalIdNotFound = 0;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Used by modules to display stock co-ordinate help, though possibly this should be under some general section
|
||||||
|
/// rather than in each help summary.
|
||||||
|
/// </summary>
|
||||||
|
public const string CoordHelp
|
||||||
|
= @"Each component of the coord is comma separated. There must be no spaces between the commas.
|
||||||
|
If you don't care about the z component you can simply omit it.
|
||||||
|
If you don't care about the x or y components then you can leave them blank (though a comma is still required)
|
||||||
|
If you want to specify the maxmimum value of a component then you can use ~ instead of a number
|
||||||
|
If you want to specify the minimum value of a component then you can use -~ instead of a number
|
||||||
|
e.g.
|
||||||
|
delete object pos 20,20,20 to 40,40,40
|
||||||
|
delete object pos 20,20 to 40,40
|
||||||
|
delete object pos ,20,20 to ,40,40
|
||||||
|
delete object pos ,,30 to ,,~
|
||||||
|
delete object pos ,,-~ to ,,30";
|
||||||
|
|
||||||
|
public const string MinRawConsoleVectorValue = "-~";
|
||||||
|
public const string MaxRawConsoleVectorValue = "~";
|
||||||
|
|
||||||
|
public const string VectorSeparator = ",";
|
||||||
|
public static char[] VectorSeparatorChars = VectorSeparator.ToCharArray();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Check if the given file path exists.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>If not, warning is printed to the given console.</remarks>
|
||||||
|
/// <returns>true if the file does not exist, false otherwise.</returns>
|
||||||
|
/// <param name='console'></param>
|
||||||
|
/// <param name='path'></param>
|
||||||
|
public static bool CheckFileDoesNotExist(ICommandConsole console, string path)
|
||||||
|
{
|
||||||
|
if (File.Exists(path))
|
||||||
|
{
|
||||||
|
console.OutputFormat("File {0} already exists. Please move or remove it.", path);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Try to parse a console UUID from the console.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// Will complain to the console if parsing fails.
|
||||||
|
/// </remarks>
|
||||||
|
/// <returns></returns>
|
||||||
|
/// <param name='console'>If null then no complaint is printed.</param>
|
||||||
|
/// <param name='rawUuid'></param>
|
||||||
|
/// <param name='uuid'></param>
|
||||||
|
public static bool TryParseConsoleUuid(ICommandConsole console, string rawUuid, out UUID uuid)
|
||||||
|
{
|
||||||
|
if (!UUID.TryParse(rawUuid, out uuid))
|
||||||
|
{
|
||||||
|
if (console != null)
|
||||||
|
console.OutputFormat("{0} is not a valid uuid", rawUuid);
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool TryParseConsoleLocalId(ICommandConsole console, string rawLocalId, out uint localId)
|
||||||
|
{
|
||||||
|
if (!uint.TryParse(rawLocalId, out localId))
|
||||||
|
{
|
||||||
|
if (console != null)
|
||||||
|
console.OutputFormat("{0} is not a valid local id", localId);
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (localId == 0)
|
||||||
|
{
|
||||||
|
if (console != null)
|
||||||
|
console.OutputFormat("{0} is not a valid local id - it must be greater than 0", localId);
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Tries to parse the input as either a UUID or a local ID.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>true if parsing succeeded, false otherwise.</returns>
|
||||||
|
/// <param name='console'></param>
|
||||||
|
/// <param name='rawId'></param>
|
||||||
|
/// <param name='uuid'></param>
|
||||||
|
/// <param name='localId'>
|
||||||
|
/// Will be set to ConsoleUtil.LocalIdNotFound if parsing result was a UUID or no parse succeeded.
|
||||||
|
/// </param>
|
||||||
|
public static bool TryParseConsoleId(ICommandConsole console, string rawId, out UUID uuid, out uint localId)
|
||||||
|
{
|
||||||
|
if (TryParseConsoleUuid(null, rawId, out uuid))
|
||||||
|
{
|
||||||
|
localId = LocalIdNotFound;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (TryParseConsoleLocalId(null, rawId, out localId))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (console != null)
|
||||||
|
console.OutputFormat("{0} is not a valid UUID or local id", rawId);
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Convert a minimum vector input from the console to an OpenMetaverse.Vector3
|
||||||
|
/// </summary>
|
||||||
|
/// <param name='rawConsoleVector'>/param>
|
||||||
|
/// <param name='vector'></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static bool TryParseConsoleMinVector(string rawConsoleVector, out Vector3 vector)
|
||||||
|
{
|
||||||
|
return TryParseConsoleVector(rawConsoleVector, c => float.MinValue.ToString(), out vector);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Convert a maximum vector input from the console to an OpenMetaverse.Vector3
|
||||||
|
/// </summary>
|
||||||
|
/// <param name='rawConsoleVector'>/param>
|
||||||
|
/// <param name='vector'></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static bool TryParseConsoleMaxVector(string rawConsoleVector, out Vector3 vector)
|
||||||
|
{
|
||||||
|
return TryParseConsoleVector(rawConsoleVector, c => float.MaxValue.ToString(), out vector);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Convert a vector input from the console to an OpenMetaverse.Vector3
|
||||||
|
/// </summary>
|
||||||
|
/// <param name='rawConsoleVector'>
|
||||||
|
/// A string in the form <x>,<y>,<z> where there is no space between values.
|
||||||
|
/// Any component can be missing (e.g. ,,40). blankComponentFunc is invoked to replace the blank with a suitable value
|
||||||
|
/// Also, if the blank component is at the end, then the comma can be missed off entirely (e.g. 40,30 or 40)
|
||||||
|
/// The strings "~" and "-~" are valid in components. The first substitutes float.MaxValue whilst the second is float.MinValue
|
||||||
|
/// Other than that, component values must be numeric.
|
||||||
|
/// </param>
|
||||||
|
/// <param name='blankComponentFunc'></param>
|
||||||
|
/// <param name='vector'></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static bool TryParseConsoleVector(
|
||||||
|
string rawConsoleVector, Func<string, string> blankComponentFunc, out Vector3 vector)
|
||||||
|
{
|
||||||
|
List<string> components = rawConsoleVector.Split(VectorSeparatorChars).ToList();
|
||||||
|
|
||||||
|
if (components.Count < 1 || components.Count > 3)
|
||||||
|
{
|
||||||
|
vector = Vector3.Zero;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = components.Count; i < 3; i++)
|
||||||
|
components.Add("");
|
||||||
|
|
||||||
|
List<string> semiDigestedComponents
|
||||||
|
= components.ConvertAll<string>(
|
||||||
|
c =>
|
||||||
|
{
|
||||||
|
if (c == "")
|
||||||
|
return blankComponentFunc.Invoke(c);
|
||||||
|
else if (c == MaxRawConsoleVectorValue)
|
||||||
|
return float.MaxValue.ToString();
|
||||||
|
else if (c == MinRawConsoleVectorValue)
|
||||||
|
return float.MinValue.ToString();
|
||||||
|
else
|
||||||
|
return c;
|
||||||
|
});
|
||||||
|
|
||||||
|
string semiDigestedConsoleVector = string.Join(VectorSeparator, semiDigestedComponents.ToArray());
|
||||||
|
|
||||||
|
// m_log.DebugFormat("[CONSOLE UTIL]: Parsing {0} into OpenMetaverse.Vector3", semiDigestedConsoleVector);
|
||||||
|
|
||||||
|
return Vector3.TryParse(semiDigestedConsoleVector, out vector);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -46,13 +46,18 @@ namespace OpenSim.Framework.Console
|
||||||
|
|
||||||
public ICommands Commands { get { return m_commands; } }
|
public ICommands Commands { get { return m_commands; } }
|
||||||
|
|
||||||
|
public string DefaultPrompt { get; set; }
|
||||||
|
|
||||||
public void Prompt() {}
|
public void Prompt() {}
|
||||||
|
|
||||||
public void RunCommand(string cmd) {}
|
public void RunCommand(string cmd) {}
|
||||||
|
|
||||||
public string ReadLine(string p, bool isCommand, bool e) { return ""; }
|
public string ReadLine(string p, bool isCommand, bool e) { return ""; }
|
||||||
|
|
||||||
public object ConsoleScene { get { return null; } }
|
public object ConsoleScene {
|
||||||
|
get { return null; }
|
||||||
|
set {}
|
||||||
|
}
|
||||||
|
|
||||||
public void Output(string text, string level) {}
|
public void Output(string text, string level) {}
|
||||||
public void Output(string text) {}
|
public void Output(string text) {}
|
||||||
|
|
|
@ -31,6 +31,7 @@ namespace OpenSim.Framework
|
||||||
public class Constants
|
public class Constants
|
||||||
{
|
{
|
||||||
public const uint RegionSize = 256;
|
public const uint RegionSize = 256;
|
||||||
|
public const uint RegionHeight = 4096;
|
||||||
public const byte TerrainPatchSize = 16;
|
public const byte TerrainPatchSize = 16;
|
||||||
public const string DefaultTexture = "89556747-24cb-43ed-920b-47caed15465f";
|
public const string DefaultTexture = "89556747-24cb-43ed-920b-47caed15465f";
|
||||||
|
|
||||||
|
|
|
@ -419,11 +419,11 @@ namespace OpenSim.Framework
|
||||||
|
|
||||||
public void SetFromFlags(ulong regionFlags)
|
public void SetFromFlags(ulong regionFlags)
|
||||||
{
|
{
|
||||||
ResetHomeOnTeleport = ((regionFlags & (ulong)RegionFlags.ResetHomeOnTeleport) == (ulong)RegionFlags.ResetHomeOnTeleport);
|
ResetHomeOnTeleport = ((regionFlags & (ulong)OpenMetaverse.RegionFlags.ResetHomeOnTeleport) == (ulong)OpenMetaverse.RegionFlags.ResetHomeOnTeleport);
|
||||||
BlockDwell = ((regionFlags & (ulong)RegionFlags.BlockDwell) == (ulong)RegionFlags.BlockDwell);
|
BlockDwell = ((regionFlags & (ulong)OpenMetaverse.RegionFlags.BlockDwell) == (ulong)OpenMetaverse.RegionFlags.BlockDwell);
|
||||||
AllowLandmark = ((regionFlags & (ulong)RegionFlags.AllowLandmark) == (ulong)RegionFlags.AllowLandmark);
|
AllowLandmark = ((regionFlags & (ulong)OpenMetaverse.RegionFlags.AllowLandmark) == (ulong)OpenMetaverse.RegionFlags.AllowLandmark);
|
||||||
AllowParcelChanges = ((regionFlags & (ulong)RegionFlags.AllowParcelChanges) == (ulong)RegionFlags.AllowParcelChanges);
|
AllowParcelChanges = ((regionFlags & (ulong)OpenMetaverse.RegionFlags.AllowParcelChanges) == (ulong)OpenMetaverse.RegionFlags.AllowParcelChanges);
|
||||||
AllowSetHome = ((regionFlags & (ulong)RegionFlags.AllowSetHome) == (ulong)RegionFlags.AllowSetHome);
|
AllowSetHome = ((regionFlags & (ulong)OpenMetaverse.RegionFlags.AllowSetHome) == (ulong)OpenMetaverse.RegionFlags.AllowSetHome);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool GroupAccess(UUID groupID)
|
public bool GroupAccess(UUID groupID)
|
||||||
|
|
|
@ -44,7 +44,6 @@ namespace OpenSim.Framework
|
||||||
public Vector3 Position;
|
public Vector3 Position;
|
||||||
public byte[] binaryBucket;
|
public byte[] binaryBucket;
|
||||||
|
|
||||||
|
|
||||||
public uint ParentEstateID;
|
public uint ParentEstateID;
|
||||||
public Guid RegionID;
|
public Guid RegionID;
|
||||||
public uint timestamp;
|
public uint timestamp;
|
||||||
|
@ -58,7 +57,7 @@ namespace OpenSim.Framework
|
||||||
string _fromAgentName, UUID _toAgentID,
|
string _fromAgentName, UUID _toAgentID,
|
||||||
byte _dialog, bool _fromGroup, string _message,
|
byte _dialog, bool _fromGroup, string _message,
|
||||||
UUID _imSessionID, bool _offline, Vector3 _position,
|
UUID _imSessionID, bool _offline, Vector3 _position,
|
||||||
byte[] _binaryBucket)
|
byte[] _binaryBucket, bool addTimestamp)
|
||||||
{
|
{
|
||||||
fromAgentID = _fromAgentID.Guid;
|
fromAgentID = _fromAgentID.Guid;
|
||||||
fromAgentName = _fromAgentName;
|
fromAgentName = _fromAgentName;
|
||||||
|
@ -79,7 +78,9 @@ namespace OpenSim.Framework
|
||||||
ParentEstateID = scene.RegionInfo.EstateSettings.ParentEstateID;
|
ParentEstateID = scene.RegionInfo.EstateSettings.ParentEstateID;
|
||||||
RegionID = scene.RegionInfo.RegionSettings.RegionUUID.Guid;
|
RegionID = scene.RegionInfo.RegionSettings.RegionUUID.Guid;
|
||||||
}
|
}
|
||||||
timestamp = (uint)Util.UnixTimeSinceEpoch();
|
|
||||||
|
if (addTimestamp)
|
||||||
|
timestamp = (uint)Util.UnixTimeSinceEpoch();
|
||||||
}
|
}
|
||||||
|
|
||||||
public GridInstantMessage(IScene scene, UUID _fromAgentID,
|
public GridInstantMessage(IScene scene, UUID _fromAgentID,
|
||||||
|
@ -87,7 +88,7 @@ namespace OpenSim.Framework
|
||||||
string _message, bool _offline,
|
string _message, bool _offline,
|
||||||
Vector3 _position) : this(scene, _fromAgentID, _fromAgentName,
|
Vector3 _position) : this(scene, _fromAgentID, _fromAgentName,
|
||||||
_toAgentID, _dialog, false, _message,
|
_toAgentID, _dialog, false, _message,
|
||||||
_fromAgentID ^ _toAgentID, _offline, _position, new byte[0])
|
_fromAgentID ^ _toAgentID, _offline, _position, new byte[0], true)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -815,8 +815,23 @@ namespace OpenSim.Framework
|
||||||
event Action<IClientAPI> OnRegionHandShakeReply;
|
event Action<IClientAPI> OnRegionHandShakeReply;
|
||||||
event GenericCall1 OnRequestWearables;
|
event GenericCall1 OnRequestWearables;
|
||||||
event Action<IClientAPI, bool> OnCompleteMovementToRegion;
|
event Action<IClientAPI, bool> OnCompleteMovementToRegion;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Called when an AgentUpdate message is received and before OnAgentUpdate.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// Listeners must not retain a reference to AgentUpdateArgs since this object may be reused for subsequent AgentUpdates.
|
||||||
|
/// </remarks>
|
||||||
event UpdateAgent OnPreAgentUpdate;
|
event UpdateAgent OnPreAgentUpdate;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Called when an AgentUpdate message is received and after OnPreAgentUpdate.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// Listeners must not retain a reference to AgentUpdateArgs since this object may be reused for subsequent AgentUpdates.
|
||||||
|
/// </remarks>
|
||||||
event UpdateAgent OnAgentUpdate;
|
event UpdateAgent OnAgentUpdate;
|
||||||
|
|
||||||
event AgentRequestSit OnAgentRequestSit;
|
event AgentRequestSit OnAgentRequestSit;
|
||||||
event AgentSit OnAgentSit;
|
event AgentSit OnAgentSit;
|
||||||
event AvatarPickerRequest OnAvatarPickerRequest;
|
event AvatarPickerRequest OnAvatarPickerRequest;
|
||||||
|
@ -1038,7 +1053,7 @@ namespace OpenSim.Framework
|
||||||
event MuteListEntryRemove OnRemoveMuteListEntry;
|
event MuteListEntryRemove OnRemoveMuteListEntry;
|
||||||
event GodlikeMessage onGodlikeMessage;
|
event GodlikeMessage onGodlikeMessage;
|
||||||
event GodUpdateRegionInfoUpdate OnGodUpdateRegionInfoUpdate;
|
event GodUpdateRegionInfoUpdate OnGodUpdateRegionInfoUpdate;
|
||||||
|
event GenericCall2 OnUpdateThrottles;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Set the debug level at which packet output should be printed to console.
|
/// Set the debug level at which packet output should be printed to console.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -1046,8 +1061,21 @@ namespace OpenSim.Framework
|
||||||
|
|
||||||
void InPacket(object NewPack);
|
void InPacket(object NewPack);
|
||||||
void ProcessInPacket(Packet NewPack);
|
void ProcessInPacket(Packet NewPack);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Close this client
|
||||||
|
/// </summary>
|
||||||
void Close();
|
void Close();
|
||||||
void Close(bool sendStop);
|
|
||||||
|
/// <summary>
|
||||||
|
/// Close this client
|
||||||
|
/// </summary>
|
||||||
|
/// <param name='force'>
|
||||||
|
/// If true, attempts the close without checking active status. You do not want to try this except as a last
|
||||||
|
/// ditch attempt where Active == false but the ScenePresence still exists.
|
||||||
|
/// </param>
|
||||||
|
void Close(bool sendStop, bool force);
|
||||||
|
|
||||||
void Kick(string message);
|
void Kick(string message);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -1084,8 +1112,20 @@ namespace OpenSim.Framework
|
||||||
void SendAnimations(UUID[] animID, int[] seqs, UUID sourceAgentId, UUID[] objectIDs);
|
void SendAnimations(UUID[] animID, int[] seqs, UUID sourceAgentId, UUID[] objectIDs);
|
||||||
void SendRegionHandshake(RegionInfo regionInfo, RegionHandshakeArgs args);
|
void SendRegionHandshake(RegionInfo regionInfo, RegionHandshakeArgs args);
|
||||||
|
|
||||||
void SendChatMessage(string message, byte type, Vector3 fromPos, string fromName, UUID fromAgentID, byte source,
|
/// <summary>
|
||||||
byte audible);
|
/// Send chat to the viewer.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name='message'></param>
|
||||||
|
/// <param name='type'></param>
|
||||||
|
/// <param name='fromPos'></param>
|
||||||
|
/// <param name='fromName'></param>
|
||||||
|
/// <param name='fromAgentID'></param>
|
||||||
|
/// <param name='ownerID'></param>
|
||||||
|
/// <param name='source'></param>
|
||||||
|
/// <param name='audible'></param>
|
||||||
|
void SendChatMessage(
|
||||||
|
string message, byte type, Vector3 fromPos, string fromName, UUID fromAgentID, UUID ownerID, byte source,
|
||||||
|
byte audible);
|
||||||
|
|
||||||
void SendInstantMessage(GridInstantMessage im);
|
void SendInstantMessage(GridInstantMessage im);
|
||||||
|
|
||||||
|
@ -1135,6 +1175,8 @@ namespace OpenSim.Framework
|
||||||
|
|
||||||
void SetChildAgentThrottle(byte[] throttle);
|
void SetChildAgentThrottle(byte[] throttle);
|
||||||
|
|
||||||
|
void SetAgentThrottleSilent(int throttle, int setting);
|
||||||
|
|
||||||
void SendAvatarDataImmediate(ISceneEntity avatar);
|
void SendAvatarDataImmediate(ISceneEntity avatar);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -82,6 +82,11 @@ namespace OpenSim.Framework
|
||||||
|
|
||||||
ICommands Commands { get; }
|
ICommands Commands { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The default prompt text.
|
||||||
|
/// </summary>
|
||||||
|
string DefaultPrompt { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Display a command prompt on the console and wait for user input
|
/// Display a command prompt on the console and wait for user input
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -32,7 +32,7 @@ namespace OpenSim.Framework
|
||||||
{
|
{
|
||||||
public interface IConsole
|
public interface IConsole
|
||||||
{
|
{
|
||||||
object ConsoleScene { get; }
|
object ConsoleScene { get; set; }
|
||||||
|
|
||||||
void Output(string text, string level);
|
void Output(string text, string level);
|
||||||
void Output(string text);
|
void Output(string text);
|
||||||
|
|
|
@ -33,7 +33,7 @@ namespace OpenSim.Framework
|
||||||
public interface IMoneyModule
|
public interface IMoneyModule
|
||||||
{
|
{
|
||||||
bool ObjectGiveMoney(UUID objectID, UUID fromID, UUID toID,
|
bool ObjectGiveMoney(UUID objectID, UUID fromID, UUID toID,
|
||||||
int amount);
|
int amount, UUID txn);
|
||||||
|
|
||||||
int GetBalance(UUID agentID);
|
int GetBalance(UUID agentID);
|
||||||
bool UploadCovered(UUID agentID, int amount);
|
bool UploadCovered(UUID agentID, int amount);
|
||||||
|
|
|
@ -73,33 +73,27 @@ namespace OpenSim.Framework
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public InventoryFolderBase(UUID id)
|
public InventoryFolderBase(UUID id) : this()
|
||||||
{
|
{
|
||||||
ID = id;
|
ID = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public InventoryFolderBase(UUID id, UUID owner)
|
public InventoryFolderBase(UUID id, UUID owner) : this(id)
|
||||||
{
|
{
|
||||||
ID = id;
|
|
||||||
Owner = owner;
|
Owner = owner;
|
||||||
}
|
}
|
||||||
|
|
||||||
public InventoryFolderBase(UUID id, string name, UUID owner, UUID parent)
|
public InventoryFolderBase(UUID id, string name, UUID owner, UUID parent) : this(id, owner)
|
||||||
{
|
{
|
||||||
ID = id;
|
|
||||||
Name = name;
|
Name = name;
|
||||||
Owner = owner;
|
|
||||||
ParentID = parent;
|
ParentID = parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
public InventoryFolderBase(UUID id, string name, UUID owner, short type, UUID parent, ushort version)
|
public InventoryFolderBase(
|
||||||
|
UUID id, string name, UUID owner, short type, UUID parent, ushort version) : this(id, name, owner, parent)
|
||||||
{
|
{
|
||||||
ID = id;
|
|
||||||
Name = name;
|
|
||||||
Owner = owner;
|
|
||||||
Type = type;
|
Type = type;
|
||||||
ParentID = parent;
|
|
||||||
Version = version;
|
Version = version;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -87,16 +87,7 @@ namespace OpenSim.Framework
|
||||||
protected string m_creatorId;
|
protected string m_creatorId;
|
||||||
|
|
||||||
/// <value>
|
/// <value>
|
||||||
/// The UUID for the creator. This may be different from the canonical CreatorId. This property is used
|
/// The CreatorId expressed as a UUID.tely
|
||||||
/// for communication with the client over the Second Life protocol, since that protocol can only understand
|
|
||||||
/// UUIDs. As this is a basic framework class, this means that both the string creator id and the uuid
|
|
||||||
/// reference have to be settable separately
|
|
||||||
///
|
|
||||||
/// Database plugins don't need to set this, it will be set by
|
|
||||||
/// upstream code (or set by the get accessor if left unset).
|
|
||||||
///
|
|
||||||
/// XXX: An alternative to having a separate uuid property would be to hash the CreatorId appropriately
|
|
||||||
/// every time there was communication with a UUID-only client. This may be much more expensive.
|
|
||||||
/// </value>
|
/// </value>
|
||||||
public UUID CreatorIdAsUuid
|
public UUID CreatorIdAsUuid
|
||||||
{
|
{
|
||||||
|
@ -109,20 +100,18 @@ namespace OpenSim.Framework
|
||||||
|
|
||||||
return m_creatorIdAsUuid;
|
return m_creatorIdAsUuid;
|
||||||
}
|
}
|
||||||
|
|
||||||
set
|
|
||||||
{
|
|
||||||
m_creatorIdAsUuid = value;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
protected UUID m_creatorIdAsUuid = UUID.Zero;
|
protected UUID m_creatorIdAsUuid = UUID.Zero;
|
||||||
|
|
||||||
protected string m_creatorData = string.Empty;
|
/// <summary>
|
||||||
|
/// Extended creator information of the form <profile url>;<name>
|
||||||
|
/// </summary>
|
||||||
public string CreatorData // = <profile url>;<name>
|
public string CreatorData // = <profile url>;<name>
|
||||||
{
|
{
|
||||||
get { return m_creatorData; }
|
get { return m_creatorData; }
|
||||||
set { m_creatorData = value; }
|
set { m_creatorData = value; }
|
||||||
}
|
}
|
||||||
|
protected string m_creatorData = string.Empty;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Used by the DB layer to retrieve / store the entire user identification.
|
/// Used by the DB layer to retrieve / store the entire user identification.
|
||||||
|
@ -162,7 +151,6 @@ namespace OpenSim.Framework
|
||||||
name = parts[2];
|
name = parts[2];
|
||||||
|
|
||||||
m_creatorData += ';' + name;
|
m_creatorData += ';' + name;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,8 +49,8 @@ namespace OpenSim.Framework
|
||||||
// use only one serializer to give the runtime a chance to
|
// use only one serializer to give the runtime a chance to
|
||||||
// optimize it (it won't do that if you use a new instance
|
// optimize it (it won't do that if you use a new instance
|
||||||
// every time)
|
// every time)
|
||||||
private static XmlSerializer serializer = new XmlSerializer(typeof (LandData));
|
private static XmlSerializer serializer = new XmlSerializer(typeof(LandData));
|
||||||
|
|
||||||
private Vector3 _AABBMax = new Vector3();
|
private Vector3 _AABBMax = new Vector3();
|
||||||
private Vector3 _AABBMin = new Vector3();
|
private Vector3 _AABBMin = new Vector3();
|
||||||
private int _area = 0;
|
private int _area = 0;
|
||||||
|
@ -65,11 +65,11 @@ namespace OpenSim.Framework
|
||||||
private byte[] _bitmap = new byte[512];
|
private byte[] _bitmap = new byte[512];
|
||||||
private string _description = String.Empty;
|
private string _description = String.Empty;
|
||||||
|
|
||||||
private uint _flags = (uint) ParcelFlags.AllowFly | (uint) ParcelFlags.AllowLandmark |
|
private uint _flags = (uint)ParcelFlags.AllowFly | (uint)ParcelFlags.AllowLandmark |
|
||||||
(uint) ParcelFlags.AllowAPrimitiveEntry |
|
(uint)ParcelFlags.AllowAPrimitiveEntry |
|
||||||
(uint) ParcelFlags.AllowDeedToGroup |
|
(uint)ParcelFlags.AllowDeedToGroup |
|
||||||
(uint) ParcelFlags.CreateObjects | (uint) ParcelFlags.AllowOtherScripts |
|
(uint)ParcelFlags.CreateObjects | (uint)ParcelFlags.AllowOtherScripts |
|
||||||
(uint) ParcelFlags.SoundLocal | (uint) ParcelFlags.AllowVoiceChat;
|
(uint)ParcelFlags.AllowVoiceChat;
|
||||||
|
|
||||||
private byte _landingType = 0;
|
private byte _landingType = 0;
|
||||||
private string _name = "Your Parcel";
|
private string _name = "Your Parcel";
|
||||||
|
@ -97,16 +97,36 @@ namespace OpenSim.Framework
|
||||||
private bool _mediaLoop = false;
|
private bool _mediaLoop = false;
|
||||||
private bool _obscureMusic = false;
|
private bool _obscureMusic = false;
|
||||||
private bool _obscureMedia = false;
|
private bool _obscureMedia = false;
|
||||||
|
private float _dwell = 0;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Traffic count of parcel
|
||||||
|
/// </summary>
|
||||||
|
[XmlIgnore]
|
||||||
|
public float Dwell
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return _dwell;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_dwell = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether to obscure parcel media URL
|
/// Whether to obscure parcel media URL
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[XmlIgnore]
|
[XmlIgnore]
|
||||||
public bool ObscureMedia {
|
public bool ObscureMedia
|
||||||
get {
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
return _obscureMedia;
|
return _obscureMedia;
|
||||||
}
|
}
|
||||||
set {
|
set
|
||||||
|
{
|
||||||
_obscureMedia = value;
|
_obscureMedia = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -115,11 +135,14 @@ namespace OpenSim.Framework
|
||||||
/// Whether to obscure parcel music URL
|
/// Whether to obscure parcel music URL
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[XmlIgnore]
|
[XmlIgnore]
|
||||||
public bool ObscureMusic {
|
public bool ObscureMusic
|
||||||
get {
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
return _obscureMusic;
|
return _obscureMusic;
|
||||||
}
|
}
|
||||||
set {
|
set
|
||||||
|
{
|
||||||
_obscureMusic = value;
|
_obscureMusic = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -128,11 +151,14 @@ namespace OpenSim.Framework
|
||||||
/// Whether to loop parcel media
|
/// Whether to loop parcel media
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[XmlIgnore]
|
[XmlIgnore]
|
||||||
public bool MediaLoop {
|
public bool MediaLoop
|
||||||
get {
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
return _mediaLoop;
|
return _mediaLoop;
|
||||||
}
|
}
|
||||||
set {
|
set
|
||||||
|
{
|
||||||
_mediaLoop = value;
|
_mediaLoop = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -141,11 +167,14 @@ namespace OpenSim.Framework
|
||||||
/// Height of parcel media render
|
/// Height of parcel media render
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[XmlIgnore]
|
[XmlIgnore]
|
||||||
public int MediaHeight {
|
public int MediaHeight
|
||||||
get {
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
return _mediaHeight;
|
return _mediaHeight;
|
||||||
}
|
}
|
||||||
set {
|
set
|
||||||
|
{
|
||||||
_mediaHeight = value;
|
_mediaHeight = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -154,11 +183,14 @@ namespace OpenSim.Framework
|
||||||
/// Width of parcel media render
|
/// Width of parcel media render
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[XmlIgnore]
|
[XmlIgnore]
|
||||||
public int MediaWidth {
|
public int MediaWidth
|
||||||
get {
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
return _mediaWidth;
|
return _mediaWidth;
|
||||||
}
|
}
|
||||||
set {
|
set
|
||||||
|
{
|
||||||
_mediaWidth = value;
|
_mediaWidth = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -167,11 +199,14 @@ namespace OpenSim.Framework
|
||||||
/// Upper corner of the AABB for the parcel
|
/// Upper corner of the AABB for the parcel
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[XmlIgnore]
|
[XmlIgnore]
|
||||||
public Vector3 AABBMax {
|
public Vector3 AABBMax
|
||||||
get {
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
return _AABBMax;
|
return _AABBMax;
|
||||||
}
|
}
|
||||||
set {
|
set
|
||||||
|
{
|
||||||
_AABBMax = value;
|
_AABBMax = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -179,11 +214,14 @@ namespace OpenSim.Framework
|
||||||
/// Lower corner of the AABB for the parcel
|
/// Lower corner of the AABB for the parcel
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[XmlIgnore]
|
[XmlIgnore]
|
||||||
public Vector3 AABBMin {
|
public Vector3 AABBMin
|
||||||
get {
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
return _AABBMin;
|
return _AABBMin;
|
||||||
}
|
}
|
||||||
set {
|
set
|
||||||
|
{
|
||||||
_AABBMin = value;
|
_AABBMin = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -191,11 +229,14 @@ namespace OpenSim.Framework
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Area in meters^2 the parcel contains
|
/// Area in meters^2 the parcel contains
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int Area {
|
public int Area
|
||||||
get {
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
return _area;
|
return _area;
|
||||||
}
|
}
|
||||||
set {
|
set
|
||||||
|
{
|
||||||
_area = value;
|
_area = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -203,11 +244,14 @@ namespace OpenSim.Framework
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// ID of auction (3rd Party Integration) when parcel is being auctioned
|
/// ID of auction (3rd Party Integration) when parcel is being auctioned
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public uint AuctionID {
|
public uint AuctionID
|
||||||
get {
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
return _auctionID;
|
return _auctionID;
|
||||||
}
|
}
|
||||||
set {
|
set
|
||||||
|
{
|
||||||
_auctionID = value;
|
_auctionID = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -215,11 +259,14 @@ namespace OpenSim.Framework
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// UUID of authorized buyer of parcel. This is UUID.Zero if anyone can buy it.
|
/// UUID of authorized buyer of parcel. This is UUID.Zero if anyone can buy it.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public UUID AuthBuyerID {
|
public UUID AuthBuyerID
|
||||||
get {
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
return _authBuyerID;
|
return _authBuyerID;
|
||||||
}
|
}
|
||||||
set {
|
set
|
||||||
|
{
|
||||||
_authBuyerID = value;
|
_authBuyerID = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -227,11 +274,14 @@ namespace OpenSim.Framework
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Category of parcel. Used for classifying the parcel in classified listings
|
/// Category of parcel. Used for classifying the parcel in classified listings
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ParcelCategory Category {
|
public ParcelCategory Category
|
||||||
get {
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
return _category;
|
return _category;
|
||||||
}
|
}
|
||||||
set {
|
set
|
||||||
|
{
|
||||||
_category = value;
|
_category = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -239,11 +289,14 @@ namespace OpenSim.Framework
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Date that the current owner purchased or claimed the parcel
|
/// Date that the current owner purchased or claimed the parcel
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int ClaimDate {
|
public int ClaimDate
|
||||||
get {
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
return _claimDate;
|
return _claimDate;
|
||||||
}
|
}
|
||||||
set {
|
set
|
||||||
|
{
|
||||||
_claimDate = value;
|
_claimDate = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -251,11 +304,14 @@ namespace OpenSim.Framework
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The last price that the parcel was sold at
|
/// The last price that the parcel was sold at
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int ClaimPrice {
|
public int ClaimPrice
|
||||||
get {
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
return _claimPrice;
|
return _claimPrice;
|
||||||
}
|
}
|
||||||
set {
|
set
|
||||||
|
{
|
||||||
_claimPrice = value;
|
_claimPrice = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -263,11 +319,14 @@ namespace OpenSim.Framework
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Global ID for the parcel. (3rd Party Integration)
|
/// Global ID for the parcel. (3rd Party Integration)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public UUID GlobalID {
|
public UUID GlobalID
|
||||||
get {
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
return _globalID;
|
return _globalID;
|
||||||
}
|
}
|
||||||
set {
|
set
|
||||||
|
{
|
||||||
_globalID = value;
|
_globalID = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -275,11 +334,14 @@ namespace OpenSim.Framework
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Unique ID of the Group that owns
|
/// Unique ID of the Group that owns
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public UUID GroupID {
|
public UUID GroupID
|
||||||
get {
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
return _groupID;
|
return _groupID;
|
||||||
}
|
}
|
||||||
set {
|
set
|
||||||
|
{
|
||||||
_groupID = value;
|
_groupID = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -287,11 +349,14 @@ namespace OpenSim.Framework
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns true if the Land Parcel is owned by a group
|
/// Returns true if the Land Parcel is owned by a group
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool IsGroupOwned {
|
public bool IsGroupOwned
|
||||||
get {
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
return _isGroupOwned;
|
return _isGroupOwned;
|
||||||
}
|
}
|
||||||
set {
|
set
|
||||||
|
{
|
||||||
_isGroupOwned = value;
|
_isGroupOwned = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -299,11 +364,14 @@ namespace OpenSim.Framework
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// jp2 data for the image representative of the parcel in the parcel dialog
|
/// jp2 data for the image representative of the parcel in the parcel dialog
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public byte[] Bitmap {
|
public byte[] Bitmap
|
||||||
get {
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
return _bitmap;
|
return _bitmap;
|
||||||
}
|
}
|
||||||
set {
|
set
|
||||||
|
{
|
||||||
_bitmap = value;
|
_bitmap = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -311,11 +379,14 @@ namespace OpenSim.Framework
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Parcel Description
|
/// Parcel Description
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Description {
|
public string Description
|
||||||
get {
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
return _description;
|
return _description;
|
||||||
}
|
}
|
||||||
set {
|
set
|
||||||
|
{
|
||||||
_description = value;
|
_description = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -323,11 +394,14 @@ namespace OpenSim.Framework
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Parcel settings. Access flags, Fly, NoPush, Voice, Scripts allowed, etc. ParcelFlags
|
/// Parcel settings. Access flags, Fly, NoPush, Voice, Scripts allowed, etc. ParcelFlags
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public uint Flags {
|
public uint Flags
|
||||||
get {
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
return _flags;
|
return _flags;
|
||||||
}
|
}
|
||||||
set {
|
set
|
||||||
|
{
|
||||||
_flags = value;
|
_flags = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -336,11 +410,14 @@ namespace OpenSim.Framework
|
||||||
/// Determines if people are able to teleport where they please on the parcel or if they
|
/// Determines if people are able to teleport where they please on the parcel or if they
|
||||||
/// get constrainted to a specific point on teleport within the parcel
|
/// get constrainted to a specific point on teleport within the parcel
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public byte LandingType {
|
public byte LandingType
|
||||||
get {
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
return _landingType;
|
return _landingType;
|
||||||
}
|
}
|
||||||
set {
|
set
|
||||||
|
{
|
||||||
_landingType = value;
|
_landingType = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -348,11 +425,14 @@ namespace OpenSim.Framework
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Parcel Name
|
/// Parcel Name
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Name {
|
public string Name
|
||||||
get {
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
return _name;
|
return _name;
|
||||||
}
|
}
|
||||||
set {
|
set
|
||||||
|
{
|
||||||
_name = value;
|
_name = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -360,11 +440,14 @@ namespace OpenSim.Framework
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Status of Parcel, Leased, Abandoned, For Sale
|
/// Status of Parcel, Leased, Abandoned, For Sale
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ParcelStatus Status {
|
public ParcelStatus Status
|
||||||
get {
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
return _status;
|
return _status;
|
||||||
}
|
}
|
||||||
set {
|
set
|
||||||
|
{
|
||||||
_status = value;
|
_status = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -372,11 +455,14 @@ namespace OpenSim.Framework
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Internal ID of the parcel. Sometimes the client will try to use this value
|
/// Internal ID of the parcel. Sometimes the client will try to use this value
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int LocalID {
|
public int LocalID
|
||||||
get {
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
return _localID;
|
return _localID;
|
||||||
}
|
}
|
||||||
set {
|
set
|
||||||
|
{
|
||||||
_localID = value;
|
_localID = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -384,11 +470,14 @@ namespace OpenSim.Framework
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Determines if we scale the media based on the surface it's on
|
/// Determines if we scale the media based on the surface it's on
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public byte MediaAutoScale {
|
public byte MediaAutoScale
|
||||||
get {
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
return _mediaAutoScale;
|
return _mediaAutoScale;
|
||||||
}
|
}
|
||||||
set {
|
set
|
||||||
|
{
|
||||||
_mediaAutoScale = value;
|
_mediaAutoScale = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -396,11 +485,14 @@ namespace OpenSim.Framework
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Texture Guid to replace with the output of the media stream
|
/// Texture Guid to replace with the output of the media stream
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public UUID MediaID {
|
public UUID MediaID
|
||||||
get {
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
return _mediaID;
|
return _mediaID;
|
||||||
}
|
}
|
||||||
set {
|
set
|
||||||
|
{
|
||||||
_mediaID = value;
|
_mediaID = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -408,11 +500,14 @@ namespace OpenSim.Framework
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// URL to the media file to display
|
/// URL to the media file to display
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string MediaURL {
|
public string MediaURL
|
||||||
get {
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
return _mediaURL;
|
return _mediaURL;
|
||||||
}
|
}
|
||||||
set {
|
set
|
||||||
|
{
|
||||||
_mediaURL = value;
|
_mediaURL = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -432,11 +527,14 @@ namespace OpenSim.Framework
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// URL to the shoutcast music stream to play on the parcel
|
/// URL to the shoutcast music stream to play on the parcel
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string MusicURL {
|
public string MusicURL
|
||||||
get {
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
return _musicURL;
|
return _musicURL;
|
||||||
}
|
}
|
||||||
set {
|
set
|
||||||
|
{
|
||||||
_musicURL = value;
|
_musicURL = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -445,11 +543,14 @@ namespace OpenSim.Framework
|
||||||
/// Owner Avatar or Group of the parcel. Naturally, all land masses must be
|
/// Owner Avatar or Group of the parcel. Naturally, all land masses must be
|
||||||
/// owned by someone
|
/// owned by someone
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public UUID OwnerID {
|
public UUID OwnerID
|
||||||
get {
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
return _ownerID;
|
return _ownerID;
|
||||||
}
|
}
|
||||||
set {
|
set
|
||||||
|
{
|
||||||
_ownerID = value;
|
_ownerID = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -457,11 +558,14 @@ namespace OpenSim.Framework
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// List of access data for the parcel. User data, some bitflags, and a time
|
/// List of access data for the parcel. User data, some bitflags, and a time
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public List<LandAccessEntry> ParcelAccessList {
|
public List<LandAccessEntry> ParcelAccessList
|
||||||
get {
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
return _parcelAccessList;
|
return _parcelAccessList;
|
||||||
}
|
}
|
||||||
set {
|
set
|
||||||
|
{
|
||||||
_parcelAccessList = value;
|
_parcelAccessList = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -469,11 +573,14 @@ namespace OpenSim.Framework
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// How long in hours a Pass to the parcel is given
|
/// How long in hours a Pass to the parcel is given
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public float PassHours {
|
public float PassHours
|
||||||
get {
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
return _passHours;
|
return _passHours;
|
||||||
}
|
}
|
||||||
set {
|
set
|
||||||
|
{
|
||||||
_passHours = value;
|
_passHours = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -481,11 +588,14 @@ namespace OpenSim.Framework
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Price to purchase a Pass to a restricted parcel
|
/// Price to purchase a Pass to a restricted parcel
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int PassPrice {
|
public int PassPrice
|
||||||
get {
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
return _passPrice;
|
return _passPrice;
|
||||||
}
|
}
|
||||||
set {
|
set
|
||||||
|
{
|
||||||
_passPrice = value;
|
_passPrice = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -493,11 +603,14 @@ namespace OpenSim.Framework
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// When the parcel is being sold, this is the price to purchase the parcel
|
/// When the parcel is being sold, this is the price to purchase the parcel
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int SalePrice {
|
public int SalePrice
|
||||||
get {
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
return _salePrice;
|
return _salePrice;
|
||||||
}
|
}
|
||||||
set {
|
set
|
||||||
|
{
|
||||||
_salePrice = value;
|
_salePrice = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -506,11 +619,14 @@ namespace OpenSim.Framework
|
||||||
/// Number of meters^2 in the Simulator
|
/// Number of meters^2 in the Simulator
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[XmlIgnore]
|
[XmlIgnore]
|
||||||
public int SimwideArea {
|
public int SimwideArea
|
||||||
get {
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
return _simwideArea;
|
return _simwideArea;
|
||||||
}
|
}
|
||||||
set {
|
set
|
||||||
|
{
|
||||||
_simwideArea = value;
|
_simwideArea = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -519,11 +635,14 @@ namespace OpenSim.Framework
|
||||||
/// Number of SceneObjectPart in the Simulator
|
/// Number of SceneObjectPart in the Simulator
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[XmlIgnore]
|
[XmlIgnore]
|
||||||
public int SimwidePrims {
|
public int SimwidePrims
|
||||||
get {
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
return _simwidePrims;
|
return _simwidePrims;
|
||||||
}
|
}
|
||||||
set {
|
set
|
||||||
|
{
|
||||||
_simwidePrims = value;
|
_simwidePrims = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -531,11 +650,14 @@ namespace OpenSim.Framework
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// ID of the snapshot used in the client parcel dialog of the parcel
|
/// ID of the snapshot used in the client parcel dialog of the parcel
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public UUID SnapshotID {
|
public UUID SnapshotID
|
||||||
get {
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
return _snapshotID;
|
return _snapshotID;
|
||||||
}
|
}
|
||||||
set {
|
set
|
||||||
|
{
|
||||||
_snapshotID = value;
|
_snapshotID = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -544,11 +666,14 @@ namespace OpenSim.Framework
|
||||||
/// When teleporting is restricted to a certain point, this is the location
|
/// When teleporting is restricted to a certain point, this is the location
|
||||||
/// that the user will be redirected to
|
/// that the user will be redirected to
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Vector3 UserLocation {
|
public Vector3 UserLocation
|
||||||
get {
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
return _userLocation;
|
return _userLocation;
|
||||||
}
|
}
|
||||||
set {
|
set
|
||||||
|
{
|
||||||
_userLocation = value;
|
_userLocation = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -557,11 +682,14 @@ namespace OpenSim.Framework
|
||||||
/// When teleporting is restricted to a certain point, this is the rotation
|
/// When teleporting is restricted to a certain point, this is the rotation
|
||||||
/// that the user will be positioned
|
/// that the user will be positioned
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Vector3 UserLookAt {
|
public Vector3 UserLookAt
|
||||||
get {
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
return _userLookAt;
|
return _userLookAt;
|
||||||
}
|
}
|
||||||
set {
|
set
|
||||||
|
{
|
||||||
_userLookAt = value;
|
_userLookAt = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -570,11 +698,14 @@ namespace OpenSim.Framework
|
||||||
/// Autoreturn number of minutes to return SceneObjectGroup that are owned by someone who doesn't own
|
/// Autoreturn number of minutes to return SceneObjectGroup that are owned by someone who doesn't own
|
||||||
/// the parcel and isn't set to the same 'group' as the parcel.
|
/// the parcel and isn't set to the same 'group' as the parcel.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int OtherCleanTime {
|
public int OtherCleanTime
|
||||||
get {
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
return _otherCleanTime;
|
return _otherCleanTime;
|
||||||
}
|
}
|
||||||
set {
|
set
|
||||||
|
{
|
||||||
_otherCleanTime = value;
|
_otherCleanTime = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -582,11 +713,14 @@ namespace OpenSim.Framework
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// parcel media description
|
/// parcel media description
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string MediaDescription {
|
public string MediaDescription
|
||||||
get {
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
return _mediaDescription;
|
return _mediaDescription;
|
||||||
}
|
}
|
||||||
set {
|
set
|
||||||
|
{
|
||||||
_mediaDescription = value;
|
_mediaDescription = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -622,7 +756,7 @@ namespace OpenSim.Framework
|
||||||
landData._mediaURL = _mediaURL;
|
landData._mediaURL = _mediaURL;
|
||||||
landData._musicURL = _musicURL;
|
landData._musicURL = _musicURL;
|
||||||
landData._ownerID = _ownerID;
|
landData._ownerID = _ownerID;
|
||||||
landData._bitmap = (byte[]) _bitmap.Clone();
|
landData._bitmap = (byte[])_bitmap.Clone();
|
||||||
landData._description = _description;
|
landData._description = _description;
|
||||||
landData._flags = _flags;
|
landData._flags = _flags;
|
||||||
landData._name = _name;
|
landData._name = _name;
|
||||||
|
@ -643,6 +777,7 @@ namespace OpenSim.Framework
|
||||||
landData._obscureMedia = _obscureMedia;
|
landData._obscureMedia = _obscureMedia;
|
||||||
landData._simwideArea = _simwideArea;
|
landData._simwideArea = _simwideArea;
|
||||||
landData._simwidePrims = _simwidePrims;
|
landData._simwidePrims = _simwidePrims;
|
||||||
|
landData._dwell = _dwell;
|
||||||
|
|
||||||
landData._parcelAccessList.Clear();
|
landData._parcelAccessList.Clear();
|
||||||
foreach (LandAccessEntry entry in _parcelAccessList)
|
foreach (LandAccessEntry entry in _parcelAccessList)
|
||||||
|
|
|
@ -43,27 +43,32 @@ namespace OpenSim.Framework.Monitoring
|
||||||
StringBuilder sb = new StringBuilder(Environment.NewLine);
|
StringBuilder sb = new StringBuilder(Environment.NewLine);
|
||||||
sb.Append("MEMORY STATISTICS");
|
sb.Append("MEMORY STATISTICS");
|
||||||
sb.Append(Environment.NewLine);
|
sb.Append(Environment.NewLine);
|
||||||
sb.Append(
|
sb.AppendFormat(
|
||||||
string.Format(
|
|
||||||
"Allocated to OpenSim objects: {0} MB\n",
|
"Allocated to OpenSim objects: {0} MB\n",
|
||||||
Math.Round(GC.GetTotalMemory(false) / 1024.0 / 1024.0)));
|
Math.Round(GC.GetTotalMemory(false) / 1024.0 / 1024.0));
|
||||||
|
|
||||||
|
sb.AppendFormat(
|
||||||
|
"OpenSim last object memory churn : {0} MB/s\n",
|
||||||
|
Math.Round((MemoryWatchdog.LastMemoryChurn * 1000) / 1024.0 / 1024, 3));
|
||||||
|
|
||||||
|
sb.AppendFormat(
|
||||||
|
"OpenSim average object memory churn : {0} MB/s\n",
|
||||||
|
Math.Round((MemoryWatchdog.AverageMemoryChurn * 1000) / 1024.0 / 1024, 3));
|
||||||
|
|
||||||
Process myprocess = Process.GetCurrentProcess();
|
Process myprocess = Process.GetCurrentProcess();
|
||||||
if (!myprocess.HasExited)
|
if (!myprocess.HasExited)
|
||||||
{
|
{
|
||||||
myprocess.Refresh();
|
myprocess.Refresh();
|
||||||
sb.Append(
|
sb.AppendFormat(
|
||||||
string.Format(
|
|
||||||
"Process memory: Physical {0} MB \t Paged {1} MB \t Virtual {2} MB\n",
|
"Process memory: Physical {0} MB \t Paged {1} MB \t Virtual {2} MB\n",
|
||||||
Math.Round(Process.GetCurrentProcess().WorkingSet64 / 1024.0 / 1024.0),
|
Math.Round(Process.GetCurrentProcess().WorkingSet64 / 1024.0 / 1024.0),
|
||||||
Math.Round(Process.GetCurrentProcess().PagedMemorySize64 / 1024.0 / 1024.0),
|
Math.Round(Process.GetCurrentProcess().PagedMemorySize64 / 1024.0 / 1024.0),
|
||||||
Math.Round(Process.GetCurrentProcess().VirtualMemorySize64 / 1024.0 / 1024.0)));
|
Math.Round(Process.GetCurrentProcess().VirtualMemorySize64 / 1024.0 / 1024.0));
|
||||||
sb.Append(
|
sb.AppendFormat(
|
||||||
string.Format(
|
|
||||||
"Peak process memory: Physical {0} MB \t Paged {1} MB \t Virtual {2} MB\n",
|
"Peak process memory: Physical {0} MB \t Paged {1} MB \t Virtual {2} MB\n",
|
||||||
Math.Round(Process.GetCurrentProcess().PeakWorkingSet64 / 1024.0 / 1024.0),
|
Math.Round(Process.GetCurrentProcess().PeakWorkingSet64 / 1024.0 / 1024.0),
|
||||||
Math.Round(Process.GetCurrentProcess().PeakPagedMemorySize64 / 1024.0 / 1024.0),
|
Math.Round(Process.GetCurrentProcess().PeakPagedMemorySize64 / 1024.0 / 1024.0),
|
||||||
Math.Round(Process.GetCurrentProcess().PeakVirtualMemorySize64 / 1024.0 / 1024.0)));
|
Math.Round(Process.GetCurrentProcess().PeakVirtualMemorySize64 / 1024.0 / 1024.0));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
sb.Append("Process reported as Exited \n");
|
sb.Append("Process reported as Exited \n");
|
||||||
|
|
|
@ -60,13 +60,21 @@ namespace OpenSim.Framework.Monitoring
|
||||||
private static bool m_enabled;
|
private static bool m_enabled;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Average memory churn in bytes per millisecond.
|
/// Last memory churn in bytes per millisecond.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static double AverageMemoryChurn
|
public static double AverageMemoryChurn
|
||||||
{
|
{
|
||||||
get { if (m_samples.Count > 0) return m_samples.Average(); else return 0; }
|
get { if (m_samples.Count > 0) return m_samples.Average(); else return 0; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Average memory churn in bytes per millisecond.
|
||||||
|
/// </summary>
|
||||||
|
public static double LastMemoryChurn
|
||||||
|
{
|
||||||
|
get { if (m_samples.Count > 0) return m_samples.Last(); else return 0; }
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Maximum number of statistical samples.
|
/// Maximum number of statistical samples.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -0,0 +1,33 @@
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
// General Information about an assembly is controlled through the following
|
||||||
|
// set of attributes. Change these attribute values to modify the information
|
||||||
|
// associated with an assembly.
|
||||||
|
[assembly: AssemblyTitle("OpenSim.Framework.Monitoring")]
|
||||||
|
[assembly: AssemblyDescription("")]
|
||||||
|
[assembly: AssemblyConfiguration("")]
|
||||||
|
[assembly: AssemblyCompany("http://opensimulator.org")]
|
||||||
|
[assembly: AssemblyProduct("OpenSim")]
|
||||||
|
[assembly: AssemblyCopyright("OpenSimulator developers")]
|
||||||
|
[assembly: AssemblyTrademark("")]
|
||||||
|
[assembly: AssemblyCulture("")]
|
||||||
|
|
||||||
|
// Setting ComVisible to false makes the types in this assembly not visible
|
||||||
|
// to COM components. If you need to access a type in this assembly from
|
||||||
|
// COM, set the ComVisible attribute to true on that type.
|
||||||
|
[assembly: ComVisible(false)]
|
||||||
|
|
||||||
|
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||||
|
[assembly: Guid("74506fe3-2f9d-44c1-94c9-a30f79d9e0cb")]
|
||||||
|
|
||||||
|
// Version information for an assembly consists of the following four values:
|
||||||
|
//
|
||||||
|
// Major Version
|
||||||
|
// Minor Version
|
||||||
|
// Build Number
|
||||||
|
// Revision
|
||||||
|
//
|
||||||
|
[assembly: AssemblyVersion("0.7.5.*")]
|
||||||
|
[assembly: AssemblyFileVersion("1.0.0.0")]
|
|
@ -355,10 +355,25 @@ Asset service request failures: {3}" + Environment.NewLine,
|
||||||
sb.Append(Environment.NewLine);
|
sb.Append(Environment.NewLine);
|
||||||
sb.Append(
|
sb.Append(
|
||||||
string.Format(
|
string.Format(
|
||||||
"{0,6:0} {1,6:0} {2,6:0} {3,6:0} {4,6:0} {5,6:0.0} {6,6:0.0} {7,6:0.0} {8,6:0.0} {9,6:0.0} {10,6:0.0}",
|
"{0,6:0} {1,6:0} {2,6:0} {3,6:0} {4,6:0} {5,6:0.0} {6,6:0.0} {7,6:0.0} {8,6:0.0} {9,6:0.0} {10,6:0.0}\n\n",
|
||||||
inPacketsPerSecond, outPacketsPerSecond, pendingDownloads, pendingUploads, unackedBytes, totalFrameTime,
|
inPacketsPerSecond, outPacketsPerSecond, pendingDownloads, pendingUploads, unackedBytes, totalFrameTime,
|
||||||
netFrameTime, physicsFrameTime, otherFrameTime, agentFrameTime, imageFrameTime));
|
netFrameTime, physicsFrameTime, otherFrameTime, agentFrameTime, imageFrameTime));
|
||||||
sb.Append(Environment.NewLine);
|
|
||||||
|
Dictionary<string, Dictionary<string, Stat>> sceneStats;
|
||||||
|
|
||||||
|
if (StatsManager.TryGetStats("scene", out sceneStats))
|
||||||
|
{
|
||||||
|
foreach (KeyValuePair<string, Dictionary<string, Stat>> kvp in sceneStats)
|
||||||
|
{
|
||||||
|
foreach (Stat stat in kvp.Value.Values)
|
||||||
|
{
|
||||||
|
if (stat.Verbosity == StatVerbosity.Info)
|
||||||
|
{
|
||||||
|
sb.AppendFormat("{0} ({1}): {2}{3}\n", stat.Name, stat.Container, stat.Value, stat.UnitName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
sb.Append(Environment.NewLine);
|
sb.Append(Environment.NewLine);
|
||||||
|
|
|
@ -0,0 +1,88 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* * Neither the name of the OpenSimulator Project nor the
|
||||||
|
* names of its contributors may be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||||
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace OpenSim.Framework.Monitoring
|
||||||
|
{
|
||||||
|
public class PercentageStat : Stat
|
||||||
|
{
|
||||||
|
public long Antecedent { get; set; }
|
||||||
|
public long Consequent { get; set; }
|
||||||
|
|
||||||
|
public override double Value
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
// Asking for an update here means that the updater cannot access this value without infinite recursion.
|
||||||
|
// XXX: A slightly messy but simple solution may be to flick a flag so we can tell if this is being
|
||||||
|
// called by the pull action and just return the value.
|
||||||
|
if (StatType == StatType.Pull)
|
||||||
|
PullAction(this);
|
||||||
|
|
||||||
|
long c = Consequent;
|
||||||
|
|
||||||
|
// Avoid any chance of a multi-threaded divide-by-zero
|
||||||
|
if (c == 0)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
return (double)Antecedent / c * 100;
|
||||||
|
}
|
||||||
|
|
||||||
|
set
|
||||||
|
{
|
||||||
|
throw new InvalidOperationException("Cannot set value on a PercentageStat");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public PercentageStat(
|
||||||
|
string shortName,
|
||||||
|
string name,
|
||||||
|
string description,
|
||||||
|
string category,
|
||||||
|
string container,
|
||||||
|
StatType type,
|
||||||
|
Action<Stat> pullAction,
|
||||||
|
StatVerbosity verbosity)
|
||||||
|
: base(shortName, name, description, "%", category, container, type, pullAction, verbosity) {}
|
||||||
|
|
||||||
|
public override string ToConsoleString()
|
||||||
|
{
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
|
||||||
|
sb.AppendFormat(
|
||||||
|
"{0}.{1}.{2} : {3:0.##}{4} ({5}/{6})",
|
||||||
|
Category, Container, ShortName, Value, UnitName, Antecedent, Consequent);
|
||||||
|
|
||||||
|
AppendMeasuresOfInterest(sb);
|
||||||
|
|
||||||
|
return sb.ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,238 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* * Neither the name of the OpenSimulator Project nor the
|
||||||
|
* names of its contributors may be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||||
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace OpenSim.Framework.Monitoring
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Holds individual statistic details
|
||||||
|
/// </summary>
|
||||||
|
public class Stat
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Category of this stat (e.g. cache, scene, etc).
|
||||||
|
/// </summary>
|
||||||
|
public string Category { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Containing name for this stat.
|
||||||
|
/// FIXME: In the case of a scene, this is currently the scene name (though this leaves
|
||||||
|
/// us with a to-be-resolved problem of non-unique region names).
|
||||||
|
/// </summary>
|
||||||
|
/// <value>
|
||||||
|
/// The container.
|
||||||
|
/// </value>
|
||||||
|
public string Container { get; private set; }
|
||||||
|
|
||||||
|
public StatType StatType { get; private set; }
|
||||||
|
|
||||||
|
public MeasuresOfInterest MeasuresOfInterest { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Action used to update this stat when the value is requested if it's a pull type.
|
||||||
|
/// </summary>
|
||||||
|
public Action<Stat> PullAction { get; private set; }
|
||||||
|
|
||||||
|
public StatVerbosity Verbosity { get; private set; }
|
||||||
|
public string ShortName { get; private set; }
|
||||||
|
public string Name { get; private set; }
|
||||||
|
public string Description { get; private set; }
|
||||||
|
public virtual string UnitName { get; private set; }
|
||||||
|
|
||||||
|
public virtual double Value
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
// Asking for an update here means that the updater cannot access this value without infinite recursion.
|
||||||
|
// XXX: A slightly messy but simple solution may be to flick a flag so we can tell if this is being
|
||||||
|
// called by the pull action and just return the value.
|
||||||
|
if (StatType == StatType.Pull)
|
||||||
|
PullAction(this);
|
||||||
|
|
||||||
|
return m_value;
|
||||||
|
}
|
||||||
|
|
||||||
|
set
|
||||||
|
{
|
||||||
|
m_value = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private double m_value;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Historical samples for calculating measures of interest average.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// Will be null if no measures of interest require samples.
|
||||||
|
/// </remarks>
|
||||||
|
private static Queue<double> m_samples;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Maximum number of statistical samples.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// At the moment this corresponds to 1 minute since the sampling rate is every 2.5 seconds as triggered from
|
||||||
|
/// the main Watchdog.
|
||||||
|
/// </remarks>
|
||||||
|
private static int m_maxSamples = 24;
|
||||||
|
|
||||||
|
public Stat(
|
||||||
|
string shortName,
|
||||||
|
string name,
|
||||||
|
string description,
|
||||||
|
string unitName,
|
||||||
|
string category,
|
||||||
|
string container,
|
||||||
|
StatType type,
|
||||||
|
Action<Stat> pullAction,
|
||||||
|
StatVerbosity verbosity)
|
||||||
|
: this(
|
||||||
|
shortName,
|
||||||
|
name,
|
||||||
|
description,
|
||||||
|
unitName,
|
||||||
|
category,
|
||||||
|
container,
|
||||||
|
type,
|
||||||
|
MeasuresOfInterest.None,
|
||||||
|
pullAction,
|
||||||
|
verbosity)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Constructor
|
||||||
|
/// </summary>
|
||||||
|
/// <param name='shortName'>Short name for the stat. Must not contain spaces. e.g. "LongFrames"</param>
|
||||||
|
/// <param name='name'>Human readable name for the stat. e.g. "Long frames"</param>
|
||||||
|
/// <param name='description'>Description of stat</param>
|
||||||
|
/// <param name='unitName'>
|
||||||
|
/// Unit name for the stat. Should be preceeded by a space if the unit name isn't normally appeneded immediately to the value.
|
||||||
|
/// e.g. " frames"
|
||||||
|
/// </param>
|
||||||
|
/// <param name='category'>Category under which this stat should appear, e.g. "scene". Do not capitalize.</param>
|
||||||
|
/// <param name='container'>Entity to which this stat relates. e.g. scene name if this is a per scene stat.</param>
|
||||||
|
/// <param name='type'>Push or pull</param>
|
||||||
|
/// <param name='pullAction'>Pull stats need an action to update the stat on request. Push stats should set null here.</param>
|
||||||
|
/// <param name='moi'>Measures of interest</param>
|
||||||
|
/// <param name='verbosity'>Verbosity of stat. Controls whether it will appear in short stat display or only full display.</param>
|
||||||
|
public Stat(
|
||||||
|
string shortName,
|
||||||
|
string name,
|
||||||
|
string description,
|
||||||
|
string unitName,
|
||||||
|
string category,
|
||||||
|
string container,
|
||||||
|
StatType type,
|
||||||
|
MeasuresOfInterest moi,
|
||||||
|
Action<Stat> pullAction,
|
||||||
|
StatVerbosity verbosity)
|
||||||
|
{
|
||||||
|
if (StatsManager.SubCommands.Contains(category))
|
||||||
|
throw new Exception(
|
||||||
|
string.Format("Stat cannot be in category '{0}' since this is reserved for a subcommand", category));
|
||||||
|
|
||||||
|
ShortName = shortName;
|
||||||
|
Name = name;
|
||||||
|
Description = description;
|
||||||
|
UnitName = unitName;
|
||||||
|
Category = category;
|
||||||
|
Container = container;
|
||||||
|
StatType = type;
|
||||||
|
|
||||||
|
if (StatType == StatType.Push && pullAction != null)
|
||||||
|
throw new Exception("A push stat cannot have a pull action");
|
||||||
|
else
|
||||||
|
PullAction = pullAction;
|
||||||
|
|
||||||
|
MeasuresOfInterest = moi;
|
||||||
|
|
||||||
|
if ((moi & MeasuresOfInterest.AverageChangeOverTime) == MeasuresOfInterest.AverageChangeOverTime)
|
||||||
|
m_samples = new Queue<double>(m_maxSamples);
|
||||||
|
|
||||||
|
Verbosity = verbosity;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Record a value in the sample set.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// Do not call this if MeasuresOfInterest.None
|
||||||
|
/// </remarks>
|
||||||
|
public void RecordValue()
|
||||||
|
{
|
||||||
|
double newValue = Value;
|
||||||
|
|
||||||
|
lock (m_samples)
|
||||||
|
{
|
||||||
|
if (m_samples.Count >= m_maxSamples)
|
||||||
|
m_samples.Dequeue();
|
||||||
|
|
||||||
|
m_samples.Enqueue(newValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual string ToConsoleString()
|
||||||
|
{
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
sb.AppendFormat("{0}.{1}.{2} : {3}{4}", Category, Container, ShortName, Value, UnitName);
|
||||||
|
|
||||||
|
AppendMeasuresOfInterest(sb);
|
||||||
|
|
||||||
|
return sb.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void AppendMeasuresOfInterest(StringBuilder sb)
|
||||||
|
{
|
||||||
|
if ((MeasuresOfInterest & MeasuresOfInterest.AverageChangeOverTime)
|
||||||
|
== MeasuresOfInterest.AverageChangeOverTime)
|
||||||
|
{
|
||||||
|
double totalChange = 0;
|
||||||
|
double? lastSample = null;
|
||||||
|
|
||||||
|
lock (m_samples)
|
||||||
|
{
|
||||||
|
foreach (double s in m_samples)
|
||||||
|
{
|
||||||
|
if (lastSample != null)
|
||||||
|
totalChange += s - (double)lastSample;
|
||||||
|
|
||||||
|
lastSample = s;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int divisor = m_samples.Count <= 1 ? 1 : m_samples.Count - 1;
|
||||||
|
|
||||||
|
sb.AppendFormat(", {0:0.##}{1}/s", totalChange / divisor / (Watchdog.WATCHDOG_INTERVAL_MS / 1000), UnitName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -25,6 +25,10 @@
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
namespace OpenSim.Framework.Monitoring
|
namespace OpenSim.Framework.Monitoring
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -32,6 +36,24 @@ namespace OpenSim.Framework.Monitoring
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class StatsManager
|
public class StatsManager
|
||||||
{
|
{
|
||||||
|
// Subcommand used to list other stats.
|
||||||
|
public const string AllSubCommand = "all";
|
||||||
|
|
||||||
|
// Subcommand used to list other stats.
|
||||||
|
public const string ListSubCommand = "list";
|
||||||
|
|
||||||
|
// All subcommands
|
||||||
|
public static HashSet<string> SubCommands = new HashSet<string> { AllSubCommand, ListSubCommand };
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Registered stats categorized by category/container/shortname
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// Do not add or remove directly from this dictionary.
|
||||||
|
/// </remarks>
|
||||||
|
public static Dictionary<string, Dictionary<string, Dictionary<string, Stat>>> RegisteredStats
|
||||||
|
= new Dictionary<string, Dictionary<string, Dictionary<string, Stat>>>();
|
||||||
|
|
||||||
private static AssetStatsCollector assetStats;
|
private static AssetStatsCollector assetStats;
|
||||||
private static UserStatsCollector userStats;
|
private static UserStatsCollector userStats;
|
||||||
private static SimExtraStatsCollector simExtraStats = new SimExtraStatsCollector();
|
private static SimExtraStatsCollector simExtraStats = new SimExtraStatsCollector();
|
||||||
|
@ -40,6 +62,75 @@ namespace OpenSim.Framework.Monitoring
|
||||||
public static UserStatsCollector UserStats { get { return userStats; } }
|
public static UserStatsCollector UserStats { get { return userStats; } }
|
||||||
public static SimExtraStatsCollector SimExtraStats { get { return simExtraStats; } }
|
public static SimExtraStatsCollector SimExtraStats { get { return simExtraStats; } }
|
||||||
|
|
||||||
|
public static void RegisterConsoleCommands(ICommandConsole console)
|
||||||
|
{
|
||||||
|
console.Commands.AddCommand(
|
||||||
|
"General",
|
||||||
|
false,
|
||||||
|
"show stats",
|
||||||
|
"show stats [list|all|<category>]",
|
||||||
|
"Show statistical information for this server",
|
||||||
|
"If no final argument is specified then legacy statistics information is currently shown.\n"
|
||||||
|
+ "If list is specified then statistic categories are shown.\n"
|
||||||
|
+ "If all is specified then all registered statistics are shown.\n"
|
||||||
|
+ "If a category name is specified then only statistics from that category are shown.\n"
|
||||||
|
+ "THIS STATS FACILITY IS EXPERIMENTAL AND DOES NOT YET CONTAIN ALL STATS",
|
||||||
|
HandleShowStatsCommand);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void HandleShowStatsCommand(string module, string[] cmd)
|
||||||
|
{
|
||||||
|
ICommandConsole con = MainConsole.Instance;
|
||||||
|
|
||||||
|
if (cmd.Length > 2)
|
||||||
|
{
|
||||||
|
var categoryName = cmd[2];
|
||||||
|
|
||||||
|
if (categoryName == AllSubCommand)
|
||||||
|
{
|
||||||
|
foreach (var category in RegisteredStats.Values)
|
||||||
|
{
|
||||||
|
OutputCategoryStatsToConsole(con, category);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (categoryName == ListSubCommand)
|
||||||
|
{
|
||||||
|
con.Output("Statistic categories available are:");
|
||||||
|
foreach (string category in RegisteredStats.Keys)
|
||||||
|
con.OutputFormat(" {0}", category);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Dictionary<string, Dictionary<string, Stat>> category;
|
||||||
|
if (!RegisteredStats.TryGetValue(categoryName, out category))
|
||||||
|
{
|
||||||
|
con.OutputFormat("No such category as {0}", categoryName);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
OutputCategoryStatsToConsole(con, category);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Legacy
|
||||||
|
con.Output(SimExtraStats.Report());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void OutputCategoryStatsToConsole(
|
||||||
|
ICommandConsole con, Dictionary<string, Dictionary<string, Stat>> category)
|
||||||
|
{
|
||||||
|
foreach (var container in category.Values)
|
||||||
|
{
|
||||||
|
foreach (Stat stat in container.Values)
|
||||||
|
{
|
||||||
|
con.Output(stat.ToConsoleString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Start collecting statistics related to assets.
|
/// Start collecting statistics related to assets.
|
||||||
/// Should only be called once.
|
/// Should only be called once.
|
||||||
|
@ -61,5 +152,153 @@ namespace OpenSim.Framework.Monitoring
|
||||||
|
|
||||||
return userStats;
|
return userStats;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Registers a statistic.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name='stat'></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static bool RegisterStat(Stat stat)
|
||||||
|
{
|
||||||
|
Dictionary<string, Dictionary<string, Stat>> category = null, newCategory;
|
||||||
|
Dictionary<string, Stat> container = null, newContainer;
|
||||||
|
|
||||||
|
lock (RegisteredStats)
|
||||||
|
{
|
||||||
|
// Stat name is not unique across category/container/shortname key.
|
||||||
|
// XXX: For now just return false. This is to avoid problems in regression tests where all tests
|
||||||
|
// in a class are run in the same instance of the VM.
|
||||||
|
if (TryGetStat(stat, out category, out container))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// We take a copy-on-write approach here of replacing dictionaries when keys are added or removed.
|
||||||
|
// This means that we don't need to lock or copy them on iteration, which will be a much more
|
||||||
|
// common operation after startup.
|
||||||
|
if (container != null)
|
||||||
|
newContainer = new Dictionary<string, Stat>(container);
|
||||||
|
else
|
||||||
|
newContainer = new Dictionary<string, Stat>();
|
||||||
|
|
||||||
|
if (category != null)
|
||||||
|
newCategory = new Dictionary<string, Dictionary<string, Stat>>(category);
|
||||||
|
else
|
||||||
|
newCategory = new Dictionary<string, Dictionary<string, Stat>>();
|
||||||
|
|
||||||
|
newContainer[stat.ShortName] = stat;
|
||||||
|
newCategory[stat.Container] = newContainer;
|
||||||
|
RegisteredStats[stat.Category] = newCategory;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Deregister a statistic
|
||||||
|
/// </summary>>
|
||||||
|
/// <param name='stat'></param>
|
||||||
|
/// <returns></returns
|
||||||
|
public static bool DeregisterStat(Stat stat)
|
||||||
|
{
|
||||||
|
Dictionary<string, Dictionary<string, Stat>> category = null, newCategory;
|
||||||
|
Dictionary<string, Stat> container = null, newContainer;
|
||||||
|
|
||||||
|
lock (RegisteredStats)
|
||||||
|
{
|
||||||
|
if (!TryGetStat(stat, out category, out container))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
newContainer = new Dictionary<string, Stat>(container);
|
||||||
|
newContainer.Remove(stat.ShortName);
|
||||||
|
|
||||||
|
newCategory = new Dictionary<string, Dictionary<string, Stat>>(category);
|
||||||
|
newCategory.Remove(stat.Container);
|
||||||
|
|
||||||
|
newCategory[stat.Container] = newContainer;
|
||||||
|
RegisteredStats[stat.Category] = newCategory;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool TryGetStats(string category, out Dictionary<string, Dictionary<string, Stat>> stats)
|
||||||
|
{
|
||||||
|
return RegisteredStats.TryGetValue(category, out stats);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool TryGetStat(
|
||||||
|
Stat stat,
|
||||||
|
out Dictionary<string, Dictionary<string, Stat>> category,
|
||||||
|
out Dictionary<string, Stat> container)
|
||||||
|
{
|
||||||
|
category = null;
|
||||||
|
container = null;
|
||||||
|
|
||||||
|
lock (RegisteredStats)
|
||||||
|
{
|
||||||
|
if (RegisteredStats.TryGetValue(stat.Category, out category))
|
||||||
|
{
|
||||||
|
if (category.TryGetValue(stat.Container, out container))
|
||||||
|
{
|
||||||
|
if (container.ContainsKey(stat.ShortName))
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void RecordStats()
|
||||||
|
{
|
||||||
|
lock (RegisteredStats)
|
||||||
|
{
|
||||||
|
foreach (Dictionary<string, Dictionary<string, Stat>> category in RegisteredStats.Values)
|
||||||
|
{
|
||||||
|
foreach (Dictionary<string, Stat> container in category.Values)
|
||||||
|
{
|
||||||
|
foreach (Stat stat in container.Values)
|
||||||
|
{
|
||||||
|
if (stat.MeasuresOfInterest != MeasuresOfInterest.None)
|
||||||
|
stat.RecordValue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Stat type.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// A push stat is one which is continually updated and so it's value can simply by read.
|
||||||
|
/// A pull stat is one where reading the value triggers a collection method - the stat is not continually updated.
|
||||||
|
/// </remarks>
|
||||||
|
public enum StatType
|
||||||
|
{
|
||||||
|
Push,
|
||||||
|
Pull
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Measures of interest for this stat.
|
||||||
|
/// </summary>
|
||||||
|
[Flags]
|
||||||
|
public enum MeasuresOfInterest
|
||||||
|
{
|
||||||
|
None,
|
||||||
|
AverageChangeOverTime
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Verbosity of stat.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// Info will always be displayed.
|
||||||
|
/// </remarks>
|
||||||
|
public enum StatVerbosity
|
||||||
|
{
|
||||||
|
Debug,
|
||||||
|
Info
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -39,7 +39,7 @@ namespace OpenSim.Framework.Monitoring
|
||||||
public static class Watchdog
|
public static class Watchdog
|
||||||
{
|
{
|
||||||
/// <summary>Timer interval in milliseconds for the watchdog timer</summary>
|
/// <summary>Timer interval in milliseconds for the watchdog timer</summary>
|
||||||
const double WATCHDOG_INTERVAL_MS = 2500.0d;
|
public const double WATCHDOG_INTERVAL_MS = 2500.0d;
|
||||||
|
|
||||||
/// <summary>Default timeout in milliseconds before a thread is considered dead</summary>
|
/// <summary>Default timeout in milliseconds before a thread is considered dead</summary>
|
||||||
public const int DEFAULT_WATCHDOG_TIMEOUT_MS = 5000;
|
public const int DEFAULT_WATCHDOG_TIMEOUT_MS = 5000;
|
||||||
|
@ -89,6 +89,17 @@ namespace OpenSim.Framework.Monitoring
|
||||||
FirstTick = Environment.TickCount & Int32.MaxValue;
|
FirstTick = Environment.TickCount & Int32.MaxValue;
|
||||||
LastTick = FirstTick;
|
LastTick = FirstTick;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ThreadWatchdogInfo(ThreadWatchdogInfo previousTwi)
|
||||||
|
{
|
||||||
|
Thread = previousTwi.Thread;
|
||||||
|
FirstTick = previousTwi.FirstTick;
|
||||||
|
LastTick = previousTwi.LastTick;
|
||||||
|
Timeout = previousTwi.Timeout;
|
||||||
|
IsTimedOut = previousTwi.IsTimedOut;
|
||||||
|
AlarmIfTimeout = previousTwi.AlarmIfTimeout;
|
||||||
|
AlarmMethod = previousTwi.AlarmMethod;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -220,7 +231,25 @@ namespace OpenSim.Framework.Monitoring
|
||||||
private static bool RemoveThread(int threadID)
|
private static bool RemoveThread(int threadID)
|
||||||
{
|
{
|
||||||
lock (m_threads)
|
lock (m_threads)
|
||||||
return m_threads.Remove(threadID);
|
{
|
||||||
|
ThreadWatchdogInfo twi;
|
||||||
|
if (m_threads.TryGetValue(threadID, out twi))
|
||||||
|
{
|
||||||
|
m_log.DebugFormat(
|
||||||
|
"[WATCHDOG]: Removing thread {0}, ID {1}", twi.Thread.Name, twi.Thread.ManagedThreadId);
|
||||||
|
|
||||||
|
m_threads.Remove(threadID);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_log.WarnFormat(
|
||||||
|
"[WATCHDOG]: Requested to remove thread with ID {0} but this is not being monitored", threadID);
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool AbortThread(int threadID)
|
public static bool AbortThread(int threadID)
|
||||||
|
@ -335,7 +364,9 @@ namespace OpenSim.Framework.Monitoring
|
||||||
if (callbackInfos == null)
|
if (callbackInfos == null)
|
||||||
callbackInfos = new List<ThreadWatchdogInfo>();
|
callbackInfos = new List<ThreadWatchdogInfo>();
|
||||||
|
|
||||||
callbackInfos.Add(threadInfo);
|
// Send a copy of the watchdog info to prevent race conditions where the watchdog
|
||||||
|
// thread updates the monitoring info after an alarm has been sent out.
|
||||||
|
callbackInfos.Add(new ThreadWatchdogInfo(threadInfo));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -349,6 +380,8 @@ namespace OpenSim.Framework.Monitoring
|
||||||
if (MemoryWatchdog.Enabled)
|
if (MemoryWatchdog.Enabled)
|
||||||
MemoryWatchdog.Update();
|
MemoryWatchdog.Update();
|
||||||
|
|
||||||
|
StatsManager.RecordStats();
|
||||||
|
|
||||||
m_watchdogTimer.Start();
|
m_watchdogTimer.Start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,56 +27,65 @@
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Reflection;
|
|
||||||
using Nini.Config;
|
|
||||||
using OpenSim.Framework;
|
|
||||||
using OpenSim.Data;
|
|
||||||
using OpenSim.Services.Interfaces;
|
|
||||||
using OpenSim.Services.Base;
|
|
||||||
|
|
||||||
namespace OpenSim.Services.InventoryService
|
namespace OpenSim.Framework
|
||||||
{
|
{
|
||||||
public class InventoryServiceBase : ServiceBase
|
/// <summary>
|
||||||
|
/// Naive pool implementation.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// Currently assumes that objects are in a useable state when returned.
|
||||||
|
/// </remarks>
|
||||||
|
public class Pool<T>
|
||||||
{
|
{
|
||||||
protected IInventoryDataPlugin m_Database = null;
|
/// <summary>
|
||||||
|
/// Number of objects in the pool.
|
||||||
public InventoryServiceBase(IConfigSource config) : base(config)
|
/// </summary>
|
||||||
|
public int Count
|
||||||
{
|
{
|
||||||
string dllName = String.Empty;
|
get
|
||||||
string connString = String.Empty;
|
|
||||||
|
|
||||||
//
|
|
||||||
// Try reading the [DatabaseService] section first, if it exists
|
|
||||||
//
|
|
||||||
IConfig dbConfig = config.Configs["DatabaseService"];
|
|
||||||
if (dbConfig != null)
|
|
||||||
{
|
{
|
||||||
dllName = dbConfig.GetString("StorageProvider", String.Empty);
|
lock (m_pool)
|
||||||
connString = dbConfig.GetString("ConnectionString", String.Empty);
|
return m_pool.Count;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Try reading the more specific [InventoryService] section, if it exists
|
|
||||||
//
|
|
||||||
IConfig inventoryConfig = config.Configs["InventoryService"];
|
|
||||||
if (inventoryConfig != null)
|
|
||||||
{
|
|
||||||
dllName = inventoryConfig.GetString("StorageProvider", dllName);
|
|
||||||
connString = inventoryConfig.GetString("ConnectionString", connString);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// We tried, but this doesn't exist. We can't proceed.
|
|
||||||
//
|
|
||||||
if (dllName.Equals(String.Empty))
|
|
||||||
throw new Exception("No InventoryService configuration");
|
|
||||||
|
|
||||||
m_Database = LoadPlugin<IInventoryDataPlugin>(dllName);
|
|
||||||
if (m_Database == null)
|
|
||||||
throw new Exception("Could not find a storage interface in the given module");
|
|
||||||
|
|
||||||
m_Database.Initialise(connString);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Stack<T> m_pool;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Maximum pool size. Beyond this, any returned objects are not pooled.
|
||||||
|
/// </summary>
|
||||||
|
private int m_maxPoolSize;
|
||||||
|
|
||||||
|
private Func<T> m_createFunction;
|
||||||
|
|
||||||
|
public Pool(Func<T> createFunction, int maxSize)
|
||||||
|
{
|
||||||
|
m_maxPoolSize = maxSize;
|
||||||
|
m_createFunction = createFunction;
|
||||||
|
m_pool = new Stack<T>(m_maxPoolSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
public T GetObject()
|
||||||
|
{
|
||||||
|
lock (m_pool)
|
||||||
|
{
|
||||||
|
if (m_pool.Count > 0)
|
||||||
|
return m_pool.Pop();
|
||||||
|
else
|
||||||
|
return m_createFunction();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ReturnObject(T obj)
|
||||||
|
{
|
||||||
|
lock (m_pool)
|
||||||
|
{
|
||||||
|
if (m_pool.Count >= m_maxPoolSize)
|
||||||
|
return;
|
||||||
|
else
|
||||||
|
m_pool.Push(obj);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -0,0 +1,53 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* * Neither the name of the OpenSimulator Project nor the
|
||||||
|
* names of its contributors may be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||||
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace OpenSim.Framework
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Region flags used internally by OpenSimulator to store installation specific information about regions.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// Don't confuse with OpenMetaverse.RegionFlags which are client facing flags (i.e. they go over the wire).
|
||||||
|
/// Returned by IGridService.GetRegionFlags()
|
||||||
|
/// </remarks>
|
||||||
|
[Flags]
|
||||||
|
public enum RegionFlags : int
|
||||||
|
{
|
||||||
|
DefaultRegion = 1, // Used for new Rez. Random if multiple defined
|
||||||
|
FallbackRegion = 2, // Regions we redirect to when the destination is down
|
||||||
|
RegionOnline = 4, // Set when a region comes online, unset when it unregisters and DeleteOnUnregister is false
|
||||||
|
NoDirectLogin = 8, // Region unavailable for direct logins (by name)
|
||||||
|
Persistent = 16, // Don't remove on unregister
|
||||||
|
LockedOut = 32, // Don't allow registration
|
||||||
|
NoMove = 64, // Don't allow moving this region
|
||||||
|
Reservation = 128, // This is an inactive reservation
|
||||||
|
Authenticate = 256, // Require authentication
|
||||||
|
Hyperlink = 512 // Record represents a HG link
|
||||||
|
}
|
||||||
|
}
|
|
@ -122,10 +122,13 @@ namespace OpenSim.Framework
|
||||||
public UUID lastMapUUID = UUID.Zero;
|
public UUID lastMapUUID = UUID.Zero;
|
||||||
public string lastMapRefresh = "0";
|
public string lastMapRefresh = "0";
|
||||||
|
|
||||||
|
private float m_nonphysPrimMin = 0;
|
||||||
private int m_nonphysPrimMax = 0;
|
private int m_nonphysPrimMax = 0;
|
||||||
|
private float m_physPrimMin = 0;
|
||||||
private int m_physPrimMax = 0;
|
private int m_physPrimMax = 0;
|
||||||
private bool m_clampPrimSize = false;
|
private bool m_clampPrimSize = false;
|
||||||
private int m_objectCapacity = 0;
|
private int m_objectCapacity = 0;
|
||||||
|
private int m_linksetCapacity = 0;
|
||||||
private int m_agentCapacity = 0;
|
private int m_agentCapacity = 0;
|
||||||
private string m_regionType = String.Empty;
|
private string m_regionType = String.Empty;
|
||||||
private RegionLightShareData m_windlight = new RegionLightShareData();
|
private RegionLightShareData m_windlight = new RegionLightShareData();
|
||||||
|
@ -287,11 +290,21 @@ namespace OpenSim.Framework
|
||||||
set { m_windlight = value; }
|
set { m_windlight = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public float NonphysPrimMin
|
||||||
|
{
|
||||||
|
get { return m_nonphysPrimMin; }
|
||||||
|
}
|
||||||
|
|
||||||
public int NonphysPrimMax
|
public int NonphysPrimMax
|
||||||
{
|
{
|
||||||
get { return m_nonphysPrimMax; }
|
get { return m_nonphysPrimMax; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public float PhysPrimMin
|
||||||
|
{
|
||||||
|
get { return m_physPrimMin; }
|
||||||
|
}
|
||||||
|
|
||||||
public int PhysPrimMax
|
public int PhysPrimMax
|
||||||
{
|
{
|
||||||
get { return m_physPrimMax; }
|
get { return m_physPrimMax; }
|
||||||
|
@ -307,6 +320,11 @@ namespace OpenSim.Framework
|
||||||
get { return m_objectCapacity; }
|
get { return m_objectCapacity; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int LinksetCapacity
|
||||||
|
{
|
||||||
|
get { return m_linksetCapacity; }
|
||||||
|
}
|
||||||
|
|
||||||
public int AgentCapacity
|
public int AgentCapacity
|
||||||
{
|
{
|
||||||
get { return m_agentCapacity; }
|
get { return m_agentCapacity; }
|
||||||
|
@ -625,16 +643,31 @@ namespace OpenSim.Framework
|
||||||
m_regionType = config.GetString("RegionType", String.Empty);
|
m_regionType = config.GetString("RegionType", String.Empty);
|
||||||
allKeys.Remove("RegionType");
|
allKeys.Remove("RegionType");
|
||||||
|
|
||||||
// Prim stuff
|
#region Prim stuff
|
||||||
//
|
|
||||||
m_nonphysPrimMax = config.GetInt("NonphysicalPrimMax", 0);
|
m_nonphysPrimMin = config.GetFloat("NonPhysicalPrimMin", 0);
|
||||||
allKeys.Remove("NonphysicalPrimMax");
|
allKeys.Remove("NonPhysicalPrimMin");
|
||||||
|
|
||||||
|
m_nonphysPrimMax = config.GetInt("NonPhysicalPrimMax", 0);
|
||||||
|
allKeys.Remove("NonPhysicalPrimMax");
|
||||||
|
|
||||||
|
m_physPrimMin = config.GetFloat("PhysicalPrimMin", 0);
|
||||||
|
allKeys.Remove("PhysicalPrimMin");
|
||||||
|
|
||||||
m_physPrimMax = config.GetInt("PhysicalPrimMax", 0);
|
m_physPrimMax = config.GetInt("PhysicalPrimMax", 0);
|
||||||
allKeys.Remove("PhysicalPrimMax");
|
allKeys.Remove("PhysicalPrimMax");
|
||||||
|
|
||||||
m_clampPrimSize = config.GetBoolean("ClampPrimSize", false);
|
m_clampPrimSize = config.GetBoolean("ClampPrimSize", false);
|
||||||
allKeys.Remove("ClampPrimSize");
|
allKeys.Remove("ClampPrimSize");
|
||||||
|
|
||||||
m_objectCapacity = config.GetInt("MaxPrims", 15000);
|
m_objectCapacity = config.GetInt("MaxPrims", 15000);
|
||||||
allKeys.Remove("MaxPrims");
|
allKeys.Remove("MaxPrims");
|
||||||
|
|
||||||
|
m_linksetCapacity = config.GetInt("LinksetPrims", 0);
|
||||||
|
allKeys.Remove("LinksetPrims");
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
m_agentCapacity = config.GetInt("MaxAgents", 100);
|
m_agentCapacity = config.GetInt("MaxAgents", 100);
|
||||||
allKeys.Remove("MaxAgents");
|
allKeys.Remove("MaxAgents");
|
||||||
|
|
||||||
|
@ -673,16 +706,27 @@ namespace OpenSim.Framework
|
||||||
|
|
||||||
config.Set("ExternalHostName", m_externalHostName);
|
config.Set("ExternalHostName", m_externalHostName);
|
||||||
|
|
||||||
if (m_nonphysPrimMax != 0)
|
if (m_nonphysPrimMin > 0)
|
||||||
|
config.Set("NonphysicalPrimMax", m_nonphysPrimMin);
|
||||||
|
|
||||||
|
if (m_nonphysPrimMax > 0)
|
||||||
config.Set("NonphysicalPrimMax", m_nonphysPrimMax);
|
config.Set("NonphysicalPrimMax", m_nonphysPrimMax);
|
||||||
if (m_physPrimMax != 0)
|
|
||||||
|
if (m_physPrimMin > 0)
|
||||||
|
config.Set("PhysicalPrimMax", m_physPrimMin);
|
||||||
|
|
||||||
|
if (m_physPrimMax > 0)
|
||||||
config.Set("PhysicalPrimMax", m_physPrimMax);
|
config.Set("PhysicalPrimMax", m_physPrimMax);
|
||||||
|
|
||||||
config.Set("ClampPrimSize", m_clampPrimSize.ToString());
|
config.Set("ClampPrimSize", m_clampPrimSize.ToString());
|
||||||
|
|
||||||
if (m_objectCapacity != 0)
|
if (m_objectCapacity > 0)
|
||||||
config.Set("MaxPrims", m_objectCapacity);
|
config.Set("MaxPrims", m_objectCapacity);
|
||||||
|
|
||||||
if (m_agentCapacity != 0)
|
if (m_linksetCapacity > 0)
|
||||||
|
config.Set("LinksetPrims", m_linksetCapacity);
|
||||||
|
|
||||||
|
if (m_agentCapacity > 0)
|
||||||
config.Set("MaxAgents", m_agentCapacity);
|
config.Set("MaxAgents", m_agentCapacity);
|
||||||
|
|
||||||
if (ScopeID != UUID.Zero)
|
if (ScopeID != UUID.Zero)
|
||||||
|
@ -759,9 +803,15 @@ namespace OpenSim.Framework
|
||||||
configMember.addConfigurationOption("lastmap_refresh", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY,
|
configMember.addConfigurationOption("lastmap_refresh", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY,
|
||||||
"Last Map Refresh", Util.UnixTimeSinceEpoch().ToString(), true);
|
"Last Map Refresh", Util.UnixTimeSinceEpoch().ToString(), true);
|
||||||
|
|
||||||
|
configMember.addConfigurationOption("nonphysical_prim_min", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT,
|
||||||
|
"Minimum size for nonphysical prims", m_nonphysPrimMin.ToString(), true);
|
||||||
|
|
||||||
configMember.addConfigurationOption("nonphysical_prim_max", ConfigurationOption.ConfigurationTypes.TYPE_INT32,
|
configMember.addConfigurationOption("nonphysical_prim_max", ConfigurationOption.ConfigurationTypes.TYPE_INT32,
|
||||||
"Maximum size for nonphysical prims", m_nonphysPrimMax.ToString(), true);
|
"Maximum size for nonphysical prims", m_nonphysPrimMax.ToString(), true);
|
||||||
|
|
||||||
|
configMember.addConfigurationOption("physical_prim_min", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT,
|
||||||
|
"Minimum size for nonphysical prims", m_physPrimMin.ToString(), true);
|
||||||
|
|
||||||
configMember.addConfigurationOption("physical_prim_max", ConfigurationOption.ConfigurationTypes.TYPE_INT32,
|
configMember.addConfigurationOption("physical_prim_max", ConfigurationOption.ConfigurationTypes.TYPE_INT32,
|
||||||
"Maximum size for physical prims", m_physPrimMax.ToString(), true);
|
"Maximum size for physical prims", m_physPrimMax.ToString(), true);
|
||||||
|
|
||||||
|
@ -771,6 +821,9 @@ namespace OpenSim.Framework
|
||||||
configMember.addConfigurationOption("object_capacity", ConfigurationOption.ConfigurationTypes.TYPE_INT32,
|
configMember.addConfigurationOption("object_capacity", ConfigurationOption.ConfigurationTypes.TYPE_INT32,
|
||||||
"Max objects this sim will hold", m_objectCapacity.ToString(), true);
|
"Max objects this sim will hold", m_objectCapacity.ToString(), true);
|
||||||
|
|
||||||
|
configMember.addConfigurationOption("linkset_capacity", ConfigurationOption.ConfigurationTypes.TYPE_INT32,
|
||||||
|
"Max prims an object will hold", m_linksetCapacity.ToString(), true);
|
||||||
|
|
||||||
configMember.addConfigurationOption("agent_capacity", ConfigurationOption.ConfigurationTypes.TYPE_INT32,
|
configMember.addConfigurationOption("agent_capacity", ConfigurationOption.ConfigurationTypes.TYPE_INT32,
|
||||||
"Max avatars this sim will hold", m_agentCapacity.ToString(), true);
|
"Max avatars this sim will hold", m_agentCapacity.ToString(), true);
|
||||||
|
|
||||||
|
@ -892,6 +945,9 @@ namespace OpenSim.Framework
|
||||||
case "object_capacity":
|
case "object_capacity":
|
||||||
m_objectCapacity = (int)configuration_result;
|
m_objectCapacity = (int)configuration_result;
|
||||||
break;
|
break;
|
||||||
|
case "linkset_capacity":
|
||||||
|
m_linksetCapacity = (int)configuration_result;
|
||||||
|
break;
|
||||||
case "agent_capacity":
|
case "agent_capacity":
|
||||||
m_agentCapacity = (int)configuration_result;
|
m_agentCapacity = (int)configuration_result;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -0,0 +1,33 @@
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
// General Information about an assembly is controlled through the following
|
||||||
|
// set of attributes. Change these attribute values to modify the information
|
||||||
|
// associated with an assembly.
|
||||||
|
[assembly: AssemblyTitle("OpenSim.Framework.RegionLoader.Filesystem")]
|
||||||
|
[assembly: AssemblyDescription("")]
|
||||||
|
[assembly: AssemblyConfiguration("")]
|
||||||
|
[assembly: AssemblyCompany("http://opensimulator.org")]
|
||||||
|
[assembly: AssemblyProduct("OpenSim")]
|
||||||
|
[assembly: AssemblyCopyright("OpenSimulator developers")]
|
||||||
|
[assembly: AssemblyTrademark("")]
|
||||||
|
[assembly: AssemblyCulture("")]
|
||||||
|
|
||||||
|
// Setting ComVisible to false makes the types in this assembly not visible
|
||||||
|
// to COM components. If you need to access a type in this assembly from
|
||||||
|
// COM, set the ComVisible attribute to true on that type.
|
||||||
|
[assembly: ComVisible(false)]
|
||||||
|
|
||||||
|
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||||
|
[assembly: Guid("4ab5c74b-e886-40a1-b67d-a04df285e706")]
|
||||||
|
|
||||||
|
// Version information for an assembly consists of the following four values:
|
||||||
|
//
|
||||||
|
// Major Version
|
||||||
|
// Minor Version
|
||||||
|
// Build Number
|
||||||
|
// Revision
|
||||||
|
//
|
||||||
|
[assembly: AssemblyVersion("0.7.5.*")]
|
||||||
|
[assembly: AssemblyFileVersion("1.0.0.0")]
|
|
@ -0,0 +1,33 @@
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
// General Information about an assembly is controlled through the following
|
||||||
|
// set of attributes. Change these attribute values to modify the information
|
||||||
|
// associated with an assembly.
|
||||||
|
[assembly: AssemblyTitle("OpenSim.Framework.RegionLoader.Web")]
|
||||||
|
[assembly: AssemblyDescription("")]
|
||||||
|
[assembly: AssemblyConfiguration("")]
|
||||||
|
[assembly: AssemblyCompany("http://opensimulator.org")]
|
||||||
|
[assembly: AssemblyProduct("OpenSim")]
|
||||||
|
[assembly: AssemblyCopyright("OpenSimulator developers")]
|
||||||
|
[assembly: AssemblyTrademark("")]
|
||||||
|
[assembly: AssemblyCulture("")]
|
||||||
|
|
||||||
|
// Setting ComVisible to false makes the types in this assembly not visible
|
||||||
|
// to COM components. If you need to access a type in this assembly from
|
||||||
|
// COM, set the ComVisible attribute to true on that type.
|
||||||
|
[assembly: ComVisible(false)]
|
||||||
|
|
||||||
|
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||||
|
[assembly: Guid("985afff8-e7ed-4056-acce-39abf7a43d33")]
|
||||||
|
|
||||||
|
// Version information for an assembly consists of the following four values:
|
||||||
|
//
|
||||||
|
// Major Version
|
||||||
|
// Minor Version
|
||||||
|
// Build Number
|
||||||
|
// Revision
|
||||||
|
//
|
||||||
|
[assembly: AssemblyVersion("0.7.5.*")]
|
||||||
|
[assembly: AssemblyFileVersion("1.0.0.0")]
|
|
@ -52,6 +52,11 @@ namespace OpenSim.Framework.Serialization
|
||||||
/// </value>
|
/// </value>
|
||||||
public const string INVENTORY_PATH = "inventory/";
|
public const string INVENTORY_PATH = "inventory/";
|
||||||
|
|
||||||
|
/// <value>
|
||||||
|
/// Path for regions in a multi-region archive
|
||||||
|
/// </value>
|
||||||
|
public const string REGIONS_PATH = "regions/";
|
||||||
|
|
||||||
/// <value>
|
/// <value>
|
||||||
/// Path for the prims file
|
/// Path for the prims file
|
||||||
/// </value>
|
/// </value>
|
||||||
|
|
|
@ -65,9 +65,14 @@ namespace OpenSim.Framework.Serialization
|
||||||
|
|
||||||
UserAccount account = userService.GetUserAccount(UUID.Zero, userId);
|
UserAccount account = userService.GetUserAccount(UUID.Zero, userId);
|
||||||
if (account != null)
|
if (account != null)
|
||||||
|
{
|
||||||
return MakeOspa(account.FirstName, account.LastName);
|
return MakeOspa(account.FirstName, account.LastName);
|
||||||
|
}
|
||||||
// else
|
// else
|
||||||
|
// {
|
||||||
// m_log.WarnFormat("[OSP RESOLVER]: No user account for {0}", userId);
|
// m_log.WarnFormat("[OSP RESOLVER]: No user account for {0}", userId);
|
||||||
|
// System.Console.WriteLine("[OSP RESOLVER]: No user account for {0}", userId);
|
||||||
|
// }
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -79,10 +84,13 @@ namespace OpenSim.Framework.Serialization
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static string MakeOspa(string firstName, string lastName)
|
public static string MakeOspa(string firstName, string lastName)
|
||||||
{
|
{
|
||||||
// m_log.DebugFormat("[OSP RESOLVER]: Making OSPA for {0} {1}", firstName, lastName);
|
string ospa
|
||||||
|
= OSPA_PREFIX + OSPA_NAME_KEY + OSPA_PAIR_SEPARATOR + firstName + OSPA_NAME_VALUE_SEPARATOR + lastName;
|
||||||
|
|
||||||
|
// m_log.DebugFormat("[OSP RESOLVER]: Made OSPA {0} for {1} {2}", ospa, firstName, lastName);
|
||||||
|
// System.Console.WriteLine("[OSP RESOLVER]: Made OSPA {0} for {1} {2}", ospa, firstName, lastName);
|
||||||
|
|
||||||
return
|
return ospa;
|
||||||
OSPA_PREFIX + OSPA_NAME_KEY + OSPA_PAIR_SEPARATOR + firstName + OSPA_NAME_VALUE_SEPARATOR + lastName;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -0,0 +1,33 @@
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
// General Information about an assembly is controlled through the following
|
||||||
|
// set of attributes. Change these attribute values to modify the information
|
||||||
|
// associated with an assembly.
|
||||||
|
[assembly: AssemblyTitle("OpenSim.Framework.Serialization")]
|
||||||
|
[assembly: AssemblyDescription("")]
|
||||||
|
[assembly: AssemblyConfiguration("")]
|
||||||
|
[assembly: AssemblyCompany("http://opensimulator.org")]
|
||||||
|
[assembly: AssemblyProduct("OpenSim")]
|
||||||
|
[assembly: AssemblyCopyright("OpenSimulator developers")]
|
||||||
|
[assembly: AssemblyTrademark("")]
|
||||||
|
[assembly: AssemblyCulture("")]
|
||||||
|
|
||||||
|
// Setting ComVisible to false makes the types in this assembly not visible
|
||||||
|
// to COM components. If you need to access a type in this assembly from
|
||||||
|
// COM, set the ComVisible attribute to true on that type.
|
||||||
|
[assembly: ComVisible(false)]
|
||||||
|
|
||||||
|
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||||
|
[assembly: Guid("919db41e-4ac0-4f24-9992-81d62c0ee183")]
|
||||||
|
|
||||||
|
// Version information for an assembly consists of the following four values:
|
||||||
|
//
|
||||||
|
// Major Version
|
||||||
|
// Minor Version
|
||||||
|
// Build Number
|
||||||
|
// Revision
|
||||||
|
//
|
||||||
|
[assembly: AssemblyVersion("0.7.5.*")]
|
||||||
|
[assembly: AssemblyFileVersion("1.0.0.0")]
|
|
@ -38,6 +38,8 @@ using log4net;
|
||||||
using log4net.Appender;
|
using log4net.Appender;
|
||||||
using log4net.Core;
|
using log4net.Core;
|
||||||
using log4net.Repository;
|
using log4net.Repository;
|
||||||
|
using OpenMetaverse;
|
||||||
|
using OpenMetaverse.StructuredData;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using OpenSim.Framework.Console;
|
using OpenSim.Framework.Console;
|
||||||
using OpenSim.Framework.Monitoring;
|
using OpenSim.Framework.Monitoring;
|
||||||
|
@ -45,16 +47,12 @@ using OpenSim.Framework.Servers;
|
||||||
using OpenSim.Framework.Servers.HttpServer;
|
using OpenSim.Framework.Servers.HttpServer;
|
||||||
using Timer=System.Timers.Timer;
|
using Timer=System.Timers.Timer;
|
||||||
|
|
||||||
using OpenMetaverse;
|
|
||||||
using OpenMetaverse.StructuredData;
|
|
||||||
|
|
||||||
|
|
||||||
namespace OpenSim.Framework.Servers
|
namespace OpenSim.Framework.Servers
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Common base for the main OpenSimServers (user, grid, inventory, region, etc)
|
/// Common base for the main OpenSimServers (user, grid, inventory, region, etc)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public abstract class BaseOpenSimServer
|
public abstract class BaseOpenSimServer : ServerBase
|
||||||
{
|
{
|
||||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
|
@ -63,27 +61,6 @@ namespace OpenSim.Framework.Servers
|
||||||
/// server.
|
/// server.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private Timer m_periodicDiagnosticsTimer = new Timer(60 * 60 * 1000);
|
private Timer m_periodicDiagnosticsTimer = new Timer(60 * 60 * 1000);
|
||||||
|
|
||||||
protected CommandConsole m_console;
|
|
||||||
protected OpenSimAppender m_consoleAppender;
|
|
||||||
protected IAppender m_logFileAppender = null;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Time at which this server was started
|
|
||||||
/// </summary>
|
|
||||||
protected DateTime m_startuptime;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Record the initial startup directory for info purposes
|
|
||||||
/// </summary>
|
|
||||||
protected string m_startupDirectory = Environment.CurrentDirectory;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Server version information. Usually VersionInfo + information about git commit, operating system, etc.
|
|
||||||
/// </summary>
|
|
||||||
protected string m_version;
|
|
||||||
|
|
||||||
protected string m_pidFile = String.Empty;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Random uuid for private data
|
/// Random uuid for private data
|
||||||
|
@ -96,35 +73,13 @@ namespace OpenSim.Framework.Servers
|
||||||
get { return m_httpServer; }
|
get { return m_httpServer; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
public BaseOpenSimServer() : base()
|
||||||
/// Holds the non-viewer statistics collection object for this service/server
|
|
||||||
/// </summary>
|
|
||||||
protected IStatsCollector m_stats;
|
|
||||||
|
|
||||||
public BaseOpenSimServer()
|
|
||||||
{
|
{
|
||||||
m_startuptime = DateTime.Now;
|
|
||||||
m_version = VersionInfo.Version;
|
|
||||||
|
|
||||||
// Random uuid for private data
|
// Random uuid for private data
|
||||||
m_osSecret = UUID.Random().ToString();
|
m_osSecret = UUID.Random().ToString();
|
||||||
|
|
||||||
m_periodicDiagnosticsTimer.Elapsed += new ElapsedEventHandler(LogDiagnostics);
|
m_periodicDiagnosticsTimer.Elapsed += new ElapsedEventHandler(LogDiagnostics);
|
||||||
m_periodicDiagnosticsTimer.Enabled = true;
|
m_periodicDiagnosticsTimer.Enabled = true;
|
||||||
|
|
||||||
// This thread will go on to become the console listening thread
|
|
||||||
Thread.CurrentThread.Name = "ConsoleThread";
|
|
||||||
|
|
||||||
ILoggerRepository repository = LogManager.GetRepository();
|
|
||||||
IAppender[] appenders = repository.GetAppenders();
|
|
||||||
|
|
||||||
foreach (IAppender appender in appenders)
|
|
||||||
{
|
|
||||||
if (appender.Name == "LogFileAppender")
|
|
||||||
{
|
|
||||||
m_logFileAppender = appender;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -132,76 +87,46 @@ namespace OpenSim.Framework.Servers
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected virtual void StartupSpecific()
|
protected virtual void StartupSpecific()
|
||||||
{
|
{
|
||||||
if (m_console != null)
|
if (m_console == null)
|
||||||
{
|
return;
|
||||||
ILoggerRepository repository = LogManager.GetRepository();
|
|
||||||
IAppender[] appenders = repository.GetAppenders();
|
|
||||||
|
|
||||||
foreach (IAppender appender in appenders)
|
RegisterCommonCommands();
|
||||||
{
|
|
||||||
if (appender.Name == "Console")
|
m_console.Commands.AddCommand("General", false, "quit",
|
||||||
{
|
"quit",
|
||||||
m_consoleAppender = (OpenSimAppender)appender;
|
"Quit the application", HandleQuit);
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (null == m_consoleAppender)
|
m_console.Commands.AddCommand("General", false, "shutdown",
|
||||||
{
|
"shutdown",
|
||||||
Notice("No appender named Console found (see the log4net config file for this executable)!");
|
"Quit the application", HandleQuit);
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_consoleAppender.Console = m_console;
|
|
||||||
|
|
||||||
// If there is no threshold set then the threshold is effectively everything.
|
|
||||||
if (null == m_consoleAppender.Threshold)
|
|
||||||
m_consoleAppender.Threshold = Level.All;
|
|
||||||
|
|
||||||
Notice(String.Format("Console log level is {0}", m_consoleAppender.Threshold));
|
|
||||||
}
|
|
||||||
|
|
||||||
m_console.Commands.AddCommand("General", false, "quit",
|
|
||||||
"quit",
|
|
||||||
"Quit the application", HandleQuit);
|
|
||||||
|
|
||||||
m_console.Commands.AddCommand("General", false, "shutdown",
|
m_console.Commands.AddCommand("General", false, "show threads",
|
||||||
"shutdown",
|
"show threads",
|
||||||
"Quit the application", HandleQuit);
|
"Show thread status", HandleShow);
|
||||||
|
|
||||||
m_console.Commands.AddCommand("General", false, "set log level",
|
m_console.Commands.AddCommand("General", false, "show version",
|
||||||
"set log level <level>",
|
"show version",
|
||||||
"Set the console logging level", HandleLogLevel);
|
"Show server version", HandleShow);
|
||||||
|
|
||||||
m_console.Commands.AddCommand("General", false, "show info",
|
m_console.Commands.AddCommand("General", false, "threads abort",
|
||||||
"show info",
|
"threads abort <thread-id>",
|
||||||
"Show general information about the server", HandleShow);
|
"Abort a managed thread. Use \"show threads\" to find possible threads.", HandleThreadsAbort);
|
||||||
|
|
||||||
m_console.Commands.AddCommand("General", false, "show stats",
|
m_console.Commands.AddCommand("General", false, "threads show",
|
||||||
"show stats",
|
"threads show",
|
||||||
"Show statistics", HandleShow);
|
"Show thread status. Synonym for \"show threads\"",
|
||||||
|
(string module, string[] args) => Notice(GetThreadsReport()));
|
||||||
|
|
||||||
m_console.Commands.AddCommand("General", false, "show threads",
|
m_console.Commands.AddCommand("General", false, "force gc",
|
||||||
"show threads",
|
"force gc",
|
||||||
"Show thread status", HandleShow);
|
"Manually invoke runtime garbage collection. For debugging purposes",
|
||||||
|
HandleForceGc);
|
||||||
|
}
|
||||||
|
|
||||||
m_console.Commands.AddCommand("General", false, "show uptime",
|
private void HandleForceGc(string module, string[] args)
|
||||||
"show uptime",
|
{
|
||||||
"Show server uptime", HandleShow);
|
MainConsole.Instance.Output("Manually invoking runtime garbage collection");
|
||||||
|
GC.Collect();
|
||||||
m_console.Commands.AddCommand("General", false, "show version",
|
|
||||||
"show version",
|
|
||||||
"Show server version", HandleShow);
|
|
||||||
|
|
||||||
m_console.Commands.AddCommand("General", false, "threads abort",
|
|
||||||
"threads abort <thread-id>",
|
|
||||||
"Abort a managed thread. Use \"show threads\" to find possible threads.", HandleThreadsAbort);
|
|
||||||
|
|
||||||
m_console.Commands.AddCommand("General", false, "threads show",
|
|
||||||
"threads show",
|
|
||||||
"Show thread status. Synonym for \"show threads\"",
|
|
||||||
(string module, string[] args) => Notice(GetThreadsReport()));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -226,12 +151,7 @@ namespace OpenSim.Framework.Servers
|
||||||
{
|
{
|
||||||
StringBuilder sb = new StringBuilder("DIAGNOSTICS\n\n");
|
StringBuilder sb = new StringBuilder("DIAGNOSTICS\n\n");
|
||||||
sb.Append(GetUptimeReport());
|
sb.Append(GetUptimeReport());
|
||||||
|
sb.Append(StatsManager.SimExtraStats.Report());
|
||||||
if (m_stats != null)
|
|
||||||
{
|
|
||||||
sb.Append(m_stats.Report());
|
|
||||||
}
|
|
||||||
|
|
||||||
sb.Append(Environment.NewLine);
|
sb.Append(Environment.NewLine);
|
||||||
sb.Append(GetThreadsReport());
|
sb.Append(GetThreadsReport());
|
||||||
|
|
||||||
|
@ -286,27 +206,12 @@ namespace OpenSim.Framework.Servers
|
||||||
return sb.ToString();
|
return sb.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Return a report about the uptime of this server
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
protected string GetUptimeReport()
|
|
||||||
{
|
|
||||||
StringBuilder sb = new StringBuilder(String.Format("Time now is {0}\n", DateTime.Now));
|
|
||||||
sb.Append(String.Format("Server has been running since {0}, {1}\n", m_startuptime.DayOfWeek, m_startuptime));
|
|
||||||
sb.Append(String.Format("That is an elapsed time of {0}\n", DateTime.Now - m_startuptime));
|
|
||||||
|
|
||||||
return sb.ToString();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Performs initialisation of the scene, such as loading configuration from disk.
|
/// Performs initialisation of the scene, such as loading configuration from disk.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public virtual void Startup()
|
public virtual void Startup()
|
||||||
{
|
{
|
||||||
m_log.Info("[STARTUP]: Beginning startup processing");
|
m_log.Info("[STARTUP]: Beginning startup processing");
|
||||||
|
|
||||||
EnhanceVersionInformation();
|
|
||||||
|
|
||||||
m_log.Info("[STARTUP]: Careminster version: " + m_version + Environment.NewLine);
|
m_log.Info("[STARTUP]: Careminster version: " + m_version + Environment.NewLine);
|
||||||
// clr version potentially is more confusing than helpful, since it doesn't tell us if we're running under Mono/MS .NET and
|
// clr version potentially is more confusing than helpful, since it doesn't tell us if we're running under Mono/MS .NET and
|
||||||
|
@ -343,60 +248,10 @@ namespace OpenSim.Framework.Servers
|
||||||
Shutdown();
|
Shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void HandleLogLevel(string module, string[] cmd)
|
public override void HandleShow(string module, string[] cmd)
|
||||||
{
|
{
|
||||||
if (null == m_consoleAppender)
|
base.HandleShow(module, cmd);
|
||||||
{
|
|
||||||
Notice("No appender named Console found (see the log4net config file for this executable)!");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (cmd.Length > 3)
|
|
||||||
{
|
|
||||||
string rawLevel = cmd[3];
|
|
||||||
|
|
||||||
ILoggerRepository repository = LogManager.GetRepository();
|
|
||||||
Level consoleLevel = repository.LevelMap[rawLevel];
|
|
||||||
|
|
||||||
if (consoleLevel != null)
|
|
||||||
m_consoleAppender.Threshold = consoleLevel;
|
|
||||||
else
|
|
||||||
Notice(
|
|
||||||
String.Format(
|
|
||||||
"{0} is not a valid logging level. Valid logging levels are ALL, DEBUG, INFO, WARN, ERROR, FATAL, OFF",
|
|
||||||
rawLevel));
|
|
||||||
}
|
|
||||||
|
|
||||||
Notice(String.Format("Console log level is {0}", m_consoleAppender.Threshold));
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Show help information
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="helpArgs"></param>
|
|
||||||
protected virtual void ShowHelp(string[] helpArgs)
|
|
||||||
{
|
|
||||||
Notice("");
|
|
||||||
|
|
||||||
if (helpArgs.Length == 0)
|
|
||||||
{
|
|
||||||
Notice("set log level [level] - change the console logging level only. For example, off or debug.");
|
|
||||||
Notice("show info - show server information (e.g. startup path).");
|
|
||||||
|
|
||||||
if (m_stats != null)
|
|
||||||
Notice("show stats - show statistical information for this server");
|
|
||||||
|
|
||||||
Notice("show threads - list tracked threads");
|
|
||||||
Notice("show uptime - show server startup time and uptime.");
|
|
||||||
Notice("show version - show server version.");
|
|
||||||
Notice("");
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual void HandleShow(string module, string[] cmd)
|
|
||||||
{
|
|
||||||
List<string> args = new List<string>(cmd);
|
List<string> args = new List<string>(cmd);
|
||||||
|
|
||||||
args.RemoveAt(0);
|
args.RemoveAt(0);
|
||||||
|
@ -405,23 +260,10 @@ namespace OpenSim.Framework.Servers
|
||||||
|
|
||||||
switch (showParams[0])
|
switch (showParams[0])
|
||||||
{
|
{
|
||||||
case "info":
|
|
||||||
ShowInfo();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case "stats":
|
|
||||||
if (m_stats != null)
|
|
||||||
Notice(m_stats.Report());
|
|
||||||
break;
|
|
||||||
|
|
||||||
case "threads":
|
case "threads":
|
||||||
Notice(GetThreadsReport());
|
Notice(GetThreadsReport());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "uptime":
|
|
||||||
Notice(GetUptimeReport());
|
|
||||||
break;
|
|
||||||
|
|
||||||
case "version":
|
case "version":
|
||||||
Notice(GetVersionText());
|
Notice(GetVersionText());
|
||||||
break;
|
break;
|
||||||
|
@ -447,165 +289,11 @@ namespace OpenSim.Framework.Servers
|
||||||
MainConsole.Instance.OutputFormat("Aborted thread with id {0}", threadId);
|
MainConsole.Instance.OutputFormat("Aborted thread with id {0}", threadId);
|
||||||
else
|
else
|
||||||
MainConsole.Instance.OutputFormat("ERROR - Thread with id {0} not found in managed threads", threadId);
|
MainConsole.Instance.OutputFormat("ERROR - Thread with id {0} not found in managed threads", threadId);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void ShowInfo()
|
|
||||||
{
|
|
||||||
Notice(GetVersionText());
|
|
||||||
Notice("Startup directory: " + m_startupDirectory);
|
|
||||||
if (null != m_consoleAppender)
|
|
||||||
Notice(String.Format("Console log level: {0}", m_consoleAppender.Threshold));
|
|
||||||
}
|
|
||||||
|
|
||||||
protected string GetVersionText()
|
|
||||||
{
|
|
||||||
return String.Format("Version: {0} (interface version {1})", m_version, VersionInfo.MajorInterfaceVersion);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Console output is only possible if a console has been established.
|
|
||||||
/// That is something that cannot be determined within this class. So
|
|
||||||
/// all attempts to use the console MUST be verified.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="msg"></param>
|
|
||||||
protected void Notice(string msg)
|
|
||||||
{
|
|
||||||
if (m_console != null)
|
|
||||||
{
|
|
||||||
m_console.Output(msg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Console output is only possible if a console has been established.
|
|
||||||
/// That is something that cannot be determined within this class. So
|
|
||||||
/// all attempts to use the console MUST be verified.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="format"></param>
|
|
||||||
/// <param name="components"></param>
|
|
||||||
protected void Notice(string format, params string[] components)
|
|
||||||
{
|
|
||||||
if (m_console != null)
|
|
||||||
m_console.OutputFormat(format, components);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Enhance the version string with extra information if it's available.
|
|
||||||
/// </summary>
|
|
||||||
protected void EnhanceVersionInformation()
|
|
||||||
{
|
|
||||||
string buildVersion = string.Empty;
|
|
||||||
|
|
||||||
// The subversion information is deprecated and will be removed at a later date
|
|
||||||
// Add subversion revision information if available
|
|
||||||
// Try file "svn_revision" in the current directory first, then the .svn info.
|
|
||||||
// This allows to make the revision available in simulators not running from the source tree.
|
|
||||||
// FIXME: Making an assumption about the directory we're currently in - we do this all over the place
|
|
||||||
// elsewhere as well
|
|
||||||
string gitDir = "../.git/";
|
|
||||||
string gitRefPointerPath = gitDir + "HEAD";
|
|
||||||
|
|
||||||
string svnRevisionFileName = "svn_revision";
|
|
||||||
string svnFileName = ".svn/entries";
|
|
||||||
string manualVersionFileName = ".version";
|
|
||||||
string inputLine;
|
|
||||||
int strcmp;
|
|
||||||
|
|
||||||
if (File.Exists(manualVersionFileName))
|
|
||||||
{
|
|
||||||
using (StreamReader CommitFile = File.OpenText(manualVersionFileName))
|
|
||||||
buildVersion = CommitFile.ReadLine();
|
|
||||||
|
|
||||||
m_version += buildVersion ?? "";
|
|
||||||
}
|
|
||||||
else if (File.Exists(gitRefPointerPath))
|
|
||||||
{
|
|
||||||
// m_log.DebugFormat("[OPENSIM]: Found {0}", gitRefPointerPath);
|
|
||||||
|
|
||||||
string rawPointer = "";
|
|
||||||
|
|
||||||
using (StreamReader pointerFile = File.OpenText(gitRefPointerPath))
|
|
||||||
rawPointer = pointerFile.ReadLine();
|
|
||||||
|
|
||||||
// m_log.DebugFormat("[OPENSIM]: rawPointer [{0}]", rawPointer);
|
|
||||||
|
|
||||||
Match m = Regex.Match(rawPointer, "^ref: (.+)$");
|
|
||||||
|
|
||||||
if (m.Success)
|
|
||||||
{
|
|
||||||
// m_log.DebugFormat("[OPENSIM]: Matched [{0}]", m.Groups[1].Value);
|
|
||||||
|
|
||||||
string gitRef = m.Groups[1].Value;
|
|
||||||
string gitRefPath = gitDir + gitRef;
|
|
||||||
if (File.Exists(gitRefPath))
|
|
||||||
{
|
|
||||||
// m_log.DebugFormat("[OPENSIM]: Found gitRefPath [{0}]", gitRefPath);
|
|
||||||
|
|
||||||
using (StreamReader refFile = File.OpenText(gitRefPath))
|
|
||||||
{
|
|
||||||
string gitHash = refFile.ReadLine();
|
|
||||||
m_version += gitHash.Substring(0, 7);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Remove the else logic when subversion mirror is no longer used
|
|
||||||
if (File.Exists(svnRevisionFileName))
|
|
||||||
{
|
|
||||||
StreamReader RevisionFile = File.OpenText(svnRevisionFileName);
|
|
||||||
buildVersion = RevisionFile.ReadLine();
|
|
||||||
buildVersion.Trim();
|
|
||||||
RevisionFile.Close();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(buildVersion) && File.Exists(svnFileName))
|
|
||||||
{
|
|
||||||
StreamReader EntriesFile = File.OpenText(svnFileName);
|
|
||||||
inputLine = EntriesFile.ReadLine();
|
|
||||||
while (inputLine != null)
|
|
||||||
{
|
|
||||||
// using the dir svn revision at the top of entries file
|
|
||||||
strcmp = String.Compare(inputLine, "dir");
|
|
||||||
if (strcmp == 0)
|
|
||||||
{
|
|
||||||
buildVersion = EntriesFile.ReadLine();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
inputLine = EntriesFile.ReadLine();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
EntriesFile.Close();
|
|
||||||
}
|
|
||||||
|
|
||||||
m_version += string.IsNullOrEmpty(buildVersion) ? " " : ("." + buildVersion + " ").Substring(0, 6);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void CreatePIDFile(string path)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
string pidstring = System.Diagnostics.Process.GetCurrentProcess().Id.ToString();
|
|
||||||
FileStream fs = File.Create(path);
|
|
||||||
|
|
||||||
Byte[] buf = Encoding.ASCII.GetBytes(pidstring);
|
|
||||||
fs.Write(buf, 0, buf.Length);
|
|
||||||
fs.Close();
|
|
||||||
m_pidFile = path;
|
|
||||||
}
|
|
||||||
catch (Exception)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public string osSecret {
|
public string osSecret {
|
||||||
// Secret uuid for the simulator
|
// Secret uuid for the simulator
|
||||||
get { return m_osSecret; }
|
get { return m_osSecret; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public string StatReport(IOSHttpRequest httpRequest)
|
public string StatReport(IOSHttpRequest httpRequest)
|
||||||
|
@ -613,27 +301,12 @@ namespace OpenSim.Framework.Servers
|
||||||
// If we catch a request for "callback", wrap the response in the value for jsonp
|
// If we catch a request for "callback", wrap the response in the value for jsonp
|
||||||
if (httpRequest.Query.ContainsKey("callback"))
|
if (httpRequest.Query.ContainsKey("callback"))
|
||||||
{
|
{
|
||||||
return httpRequest.Query["callback"].ToString() + "(" + m_stats.XReport((DateTime.Now - m_startuptime).ToString() , m_version) + ");";
|
return httpRequest.Query["callback"].ToString() + "(" + StatsManager.SimExtraStats.XReport((DateTime.Now - m_startuptime).ToString() , m_version) + ");";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return m_stats.XReport((DateTime.Now - m_startuptime).ToString() , m_version);
|
return StatsManager.SimExtraStats.XReport((DateTime.Now - m_startuptime).ToString() , m_version);
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void RemovePIDFile()
|
|
||||||
{
|
|
||||||
if (m_pidFile != String.Empty)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
File.Delete(m_pidFile);
|
|
||||||
m_pidFile = String.Empty;
|
|
||||||
}
|
|
||||||
catch (Exception)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -54,8 +54,23 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
private HttpServerLogWriter httpserverlog = new HttpServerLogWriter();
|
private HttpServerLogWriter httpserverlog = new HttpServerLogWriter();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the debug level.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>
|
||||||
|
/// See MainServer.DebugLevel.
|
||||||
|
/// </value>
|
||||||
public int DebugLevel { get; set; }
|
public int DebugLevel { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Request number for diagnostic purposes.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// This is an internal number. In some debug situations an external number may also be supplied in the
|
||||||
|
/// opensim-request-id header but we are not currently logging this.
|
||||||
|
/// </remarks>
|
||||||
|
public int RequestNumber { get; private set; }
|
||||||
|
|
||||||
private volatile int NotSocketErrors = 0;
|
private volatile int NotSocketErrors = 0;
|
||||||
public volatile bool HTTPDRunning = false;
|
public volatile bool HTTPDRunning = false;
|
||||||
|
|
||||||
|
@ -67,7 +82,7 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||||
protected Dictionary<string, LLSDMethod> m_llsdHandlers = new Dictionary<string, LLSDMethod>();
|
protected Dictionary<string, LLSDMethod> m_llsdHandlers = new Dictionary<string, LLSDMethod>();
|
||||||
protected Dictionary<string, IRequestHandler> m_streamHandlers = new Dictionary<string, IRequestHandler>();
|
protected Dictionary<string, IRequestHandler> m_streamHandlers = new Dictionary<string, IRequestHandler>();
|
||||||
protected Dictionary<string, GenericHTTPMethod> m_HTTPHandlers = new Dictionary<string, GenericHTTPMethod>();
|
protected Dictionary<string, GenericHTTPMethod> m_HTTPHandlers = new Dictionary<string, GenericHTTPMethod>();
|
||||||
protected Dictionary<string, IHttpAgentHandler> m_agentHandlers = new Dictionary<string, IHttpAgentHandler>();
|
// protected Dictionary<string, IHttpAgentHandler> m_agentHandlers = new Dictionary<string, IHttpAgentHandler>();
|
||||||
protected Dictionary<string, PollServiceEventArgs> m_pollHandlers =
|
protected Dictionary<string, PollServiceEventArgs> m_pollHandlers =
|
||||||
new Dictionary<string, PollServiceEventArgs>();
|
new Dictionary<string, PollServiceEventArgs>();
|
||||||
|
|
||||||
|
@ -245,29 +260,29 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||||
return new List<string>(m_pollHandlers.Keys);
|
return new List<string>(m_pollHandlers.Keys);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Note that the agent string is provided simply to differentiate
|
// // Note that the agent string is provided simply to differentiate
|
||||||
// the handlers - it is NOT required to be an actual agent header
|
// // the handlers - it is NOT required to be an actual agent header
|
||||||
// value.
|
// // value.
|
||||||
public bool AddAgentHandler(string agent, IHttpAgentHandler handler)
|
// public bool AddAgentHandler(string agent, IHttpAgentHandler handler)
|
||||||
{
|
// {
|
||||||
lock (m_agentHandlers)
|
// lock (m_agentHandlers)
|
||||||
{
|
// {
|
||||||
if (!m_agentHandlers.ContainsKey(agent))
|
// if (!m_agentHandlers.ContainsKey(agent))
|
||||||
{
|
// {
|
||||||
m_agentHandlers.Add(agent, handler);
|
// m_agentHandlers.Add(agent, handler);
|
||||||
return true;
|
// return true;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
//must already have a handler for that path so return false
|
// //must already have a handler for that path so return false
|
||||||
return false;
|
// return false;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public List<string> GetAgentHandlerKeys()
|
// public List<string> GetAgentHandlerKeys()
|
||||||
{
|
// {
|
||||||
lock (m_agentHandlers)
|
// lock (m_agentHandlers)
|
||||||
return new List<string>(m_agentHandlers.Keys);
|
// return new List<string>(m_agentHandlers.Keys);
|
||||||
}
|
// }
|
||||||
|
|
||||||
public bool AddLLSDHandler(string path, LLSDMethod handler)
|
public bool AddLLSDHandler(string path, LLSDMethod handler)
|
||||||
{
|
{
|
||||||
|
@ -296,6 +311,8 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||||
|
|
||||||
private void OnRequest(object source, RequestEventArgs args)
|
private void OnRequest(object source, RequestEventArgs args)
|
||||||
{
|
{
|
||||||
|
RequestNumber++;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
IHttpClientContext context = (IHttpClientContext)source;
|
IHttpClientContext context = (IHttpClientContext)source;
|
||||||
|
@ -406,7 +423,6 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||||
string requestMethod = request.HttpMethod;
|
string requestMethod = request.HttpMethod;
|
||||||
string uriString = request.RawUrl;
|
string uriString = request.RawUrl;
|
||||||
|
|
||||||
// string reqnum = "unknown";
|
|
||||||
int requestStartTick = Environment.TickCount;
|
int requestStartTick = Environment.TickCount;
|
||||||
|
|
||||||
// Will be adjusted later on.
|
// Will be adjusted later on.
|
||||||
|
@ -423,22 +439,22 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||||
|
|
||||||
Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US", true);
|
Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US", true);
|
||||||
|
|
||||||
// This is the REST agent interface. We require an agent to properly identify
|
// // This is the REST agent interface. We require an agent to properly identify
|
||||||
// itself. If the REST handler recognizes the prefix it will attempt to
|
// // itself. If the REST handler recognizes the prefix it will attempt to
|
||||||
// satisfy the request. If it is not recognizable, and no damage has occurred
|
// // satisfy the request. If it is not recognizable, and no damage has occurred
|
||||||
// the request can be passed through to the other handlers. This is a low
|
// // the request can be passed through to the other handlers. This is a low
|
||||||
// probability event; if a request is matched it is normally expected to be
|
// // probability event; if a request is matched it is normally expected to be
|
||||||
// handled
|
// // handled
|
||||||
IHttpAgentHandler agentHandler;
|
// IHttpAgentHandler agentHandler;
|
||||||
|
//
|
||||||
if (TryGetAgentHandler(request, response, out agentHandler))
|
// if (TryGetAgentHandler(request, response, out agentHandler))
|
||||||
{
|
// {
|
||||||
if (HandleAgentRequest(agentHandler, request, response))
|
// if (HandleAgentRequest(agentHandler, request, response))
|
||||||
{
|
// {
|
||||||
requestEndTick = Environment.TickCount;
|
// requestEndTick = Environment.TickCount;
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
//response.KeepAlive = true;
|
//response.KeepAlive = true;
|
||||||
response.SendChunked = false;
|
response.SendChunked = false;
|
||||||
|
@ -450,9 +466,7 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||||
if (TryGetStreamHandler(handlerKey, out requestHandler))
|
if (TryGetStreamHandler(handlerKey, out requestHandler))
|
||||||
{
|
{
|
||||||
if (DebugLevel >= 3)
|
if (DebugLevel >= 3)
|
||||||
m_log.DebugFormat(
|
LogIncomingToStreamHandler(request, requestHandler);
|
||||||
"[BASE HTTP SERVER]: Found stream handler for {0} {1} {2} {3}",
|
|
||||||
request.HttpMethod, request.Url.PathAndQuery, requestHandler.Name, requestHandler.Description);
|
|
||||||
|
|
||||||
response.ContentType = requestHandler.ContentType; // Lets do this defaulting before in case handler has varying content type.
|
response.ContentType = requestHandler.ContentType; // Lets do this defaulting before in case handler has varying content type.
|
||||||
|
|
||||||
|
@ -529,11 +543,8 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||||
{
|
{
|
||||||
case null:
|
case null:
|
||||||
case "text/html":
|
case "text/html":
|
||||||
|
|
||||||
if (DebugLevel >= 3)
|
if (DebugLevel >= 3)
|
||||||
m_log.DebugFormat(
|
LogIncomingToContentTypeHandler(request);
|
||||||
"[BASE HTTP SERVER]: Found a {0} content type handler for {1} {2}",
|
|
||||||
request.ContentType, request.HttpMethod, request.Url.PathAndQuery);
|
|
||||||
|
|
||||||
buffer = HandleHTTPRequest(request, response);
|
buffer = HandleHTTPRequest(request, response);
|
||||||
break;
|
break;
|
||||||
|
@ -541,11 +552,8 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||||
case "application/llsd+xml":
|
case "application/llsd+xml":
|
||||||
case "application/xml+llsd":
|
case "application/xml+llsd":
|
||||||
case "application/llsd+json":
|
case "application/llsd+json":
|
||||||
|
|
||||||
if (DebugLevel >= 3)
|
if (DebugLevel >= 3)
|
||||||
m_log.DebugFormat(
|
LogIncomingToContentTypeHandler(request);
|
||||||
"[BASE HTTP SERVER]: Found a {0} content type handler for {1} {2}",
|
|
||||||
request.ContentType, request.HttpMethod, request.Url.PathAndQuery);
|
|
||||||
|
|
||||||
buffer = HandleLLSDRequests(request, response);
|
buffer = HandleLLSDRequests(request, response);
|
||||||
break;
|
break;
|
||||||
|
@ -564,9 +572,7 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||||
if (DoWeHaveALLSDHandler(request.RawUrl))
|
if (DoWeHaveALLSDHandler(request.RawUrl))
|
||||||
{
|
{
|
||||||
if (DebugLevel >= 3)
|
if (DebugLevel >= 3)
|
||||||
m_log.DebugFormat(
|
LogIncomingToContentTypeHandler(request);
|
||||||
"[BASE HTTP SERVER]: Found a {0} content type handler for {1} {2}",
|
|
||||||
request.ContentType, request.HttpMethod, request.Url.PathAndQuery);
|
|
||||||
|
|
||||||
buffer = HandleLLSDRequests(request, response);
|
buffer = HandleLLSDRequests(request, response);
|
||||||
}
|
}
|
||||||
|
@ -574,18 +580,14 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||||
else if (DoWeHaveAHTTPHandler(request.RawUrl))
|
else if (DoWeHaveAHTTPHandler(request.RawUrl))
|
||||||
{
|
{
|
||||||
if (DebugLevel >= 3)
|
if (DebugLevel >= 3)
|
||||||
m_log.DebugFormat(
|
LogIncomingToContentTypeHandler(request);
|
||||||
"[BASE HTTP SERVER]: Found a {0} content type handler for {1} {2}",
|
|
||||||
request.ContentType, request.HttpMethod, request.Url.PathAndQuery);
|
|
||||||
|
|
||||||
buffer = HandleHTTPRequest(request, response);
|
buffer = HandleHTTPRequest(request, response);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (DebugLevel >= 3)
|
if (DebugLevel >= 3)
|
||||||
m_log.DebugFormat(
|
LogIncomingToXmlRpcHandler(request);
|
||||||
"[BASE HTTP SERVER]: Assuming a generic XMLRPC request for {0} {1}",
|
|
||||||
request.HttpMethod, request.Url.PathAndQuery);
|
|
||||||
|
|
||||||
// generic login request.
|
// generic login request.
|
||||||
buffer = HandleXmlRpcRequests(request, response);
|
buffer = HandleXmlRpcRequests(request, response);
|
||||||
|
@ -629,11 +631,11 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||||
}
|
}
|
||||||
catch (IOException e)
|
catch (IOException e)
|
||||||
{
|
{
|
||||||
m_log.Error(String.Format("[BASE HTTP SERVER]: HandleRequest() threw {0} ", e.Message), e);
|
m_log.Error(String.Format("[BASE HTTP SERVER]: HandleRequest() threw {0} ", e.StackTrace), e);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
m_log.Error(String.Format("[BASE HTTP SERVER]: HandleRequest() threw {0} ", e.Message), e);
|
m_log.Error(String.Format("[BASE HTTP SERVER]: HandleRequest() threw {0} ", e.StackTrace), e);
|
||||||
SendHTML500(response);
|
SendHTML500(response);
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
|
@ -644,14 +646,93 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||||
if (tickdiff > 3000 && (requestHandler == null || requestHandler.Name == null || requestHandler.Name != "GetTexture"))
|
if (tickdiff > 3000 && (requestHandler == null || requestHandler.Name == null || requestHandler.Name != "GetTexture"))
|
||||||
{
|
{
|
||||||
m_log.InfoFormat(
|
m_log.InfoFormat(
|
||||||
"[BASE HTTP SERVER]: Slow handling of {0} {1} {2} {3} from {4} took {5}ms",
|
"[BASE HTTP SERVER]: Slow handling of {0} {1} {2} {3} {4} from {5} took {6}ms",
|
||||||
|
RequestNumber,
|
||||||
requestMethod,
|
requestMethod,
|
||||||
uriString,
|
uriString,
|
||||||
requestHandler != null ? requestHandler.Name : "",
|
requestHandler != null ? requestHandler.Name : "",
|
||||||
requestHandler != null ? requestHandler.Description : "",
|
requestHandler != null ? requestHandler.Description : "",
|
||||||
request.RemoteIPEndPoint.ToString(),
|
request.RemoteIPEndPoint,
|
||||||
tickdiff);
|
tickdiff);
|
||||||
}
|
}
|
||||||
|
else if (DebugLevel >= 4)
|
||||||
|
{
|
||||||
|
m_log.DebugFormat(
|
||||||
|
"[BASE HTTP SERVER]: HTTP IN {0} :{1} took {2}ms",
|
||||||
|
RequestNumber,
|
||||||
|
Port,
|
||||||
|
tickdiff);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LogIncomingToStreamHandler(OSHttpRequest request, IRequestHandler requestHandler)
|
||||||
|
{
|
||||||
|
m_log.DebugFormat(
|
||||||
|
"[BASE HTTP SERVER]: HTTP IN {0} :{1} stream handler {2} {3} {4} {5} from {6}",
|
||||||
|
RequestNumber,
|
||||||
|
Port,
|
||||||
|
request.HttpMethod,
|
||||||
|
request.Url.PathAndQuery,
|
||||||
|
requestHandler.Name,
|
||||||
|
requestHandler.Description,
|
||||||
|
request.RemoteIPEndPoint);
|
||||||
|
|
||||||
|
if (DebugLevel >= 5)
|
||||||
|
LogIncomingInDetail(request);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LogIncomingToContentTypeHandler(OSHttpRequest request)
|
||||||
|
{
|
||||||
|
m_log.DebugFormat(
|
||||||
|
"[BASE HTTP SERVER]: HTTP IN {0} :{1} {2} content type handler {3} {4} from {5}",
|
||||||
|
RequestNumber,
|
||||||
|
Port,
|
||||||
|
(request.ContentType == null || request.ContentType == "") ? "not set" : request.ContentType,
|
||||||
|
request.HttpMethod,
|
||||||
|
request.Url.PathAndQuery,
|
||||||
|
request.RemoteIPEndPoint);
|
||||||
|
|
||||||
|
if (DebugLevel >= 5)
|
||||||
|
LogIncomingInDetail(request);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LogIncomingToXmlRpcHandler(OSHttpRequest request)
|
||||||
|
{
|
||||||
|
m_log.DebugFormat(
|
||||||
|
"[BASE HTTP SERVER]: HTTP IN {0} :{1} assumed generic XMLRPC request {2} {3} from {4}",
|
||||||
|
RequestNumber,
|
||||||
|
Port,
|
||||||
|
request.HttpMethod,
|
||||||
|
request.Url.PathAndQuery,
|
||||||
|
request.RemoteIPEndPoint);
|
||||||
|
|
||||||
|
if (DebugLevel >= 5)
|
||||||
|
LogIncomingInDetail(request);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LogIncomingInDetail(OSHttpRequest request)
|
||||||
|
{
|
||||||
|
using (StreamReader reader = new StreamReader(Util.Copy(request.InputStream), Encoding.UTF8))
|
||||||
|
{
|
||||||
|
string output;
|
||||||
|
|
||||||
|
if (DebugLevel == 5)
|
||||||
|
{
|
||||||
|
const int sampleLength = 80;
|
||||||
|
char[] sampleChars = new char[sampleLength + 3];
|
||||||
|
reader.Read(sampleChars, 0, sampleLength);
|
||||||
|
sampleChars[80] = '.';
|
||||||
|
sampleChars[81] = '.';
|
||||||
|
sampleChars[82] = '.';
|
||||||
|
output = new string(sampleChars);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
output = reader.ReadToEnd();
|
||||||
|
}
|
||||||
|
|
||||||
|
m_log.DebugFormat("[BASE HTTP SERVER]: {0}", output.Replace("\n", @"\n"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -747,24 +828,24 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool TryGetAgentHandler(OSHttpRequest request, OSHttpResponse response, out IHttpAgentHandler agentHandler)
|
// private bool TryGetAgentHandler(OSHttpRequest request, OSHttpResponse response, out IHttpAgentHandler agentHandler)
|
||||||
{
|
// {
|
||||||
agentHandler = null;
|
// agentHandler = null;
|
||||||
|
//
|
||||||
lock (m_agentHandlers)
|
// lock (m_agentHandlers)
|
||||||
{
|
// {
|
||||||
foreach (IHttpAgentHandler handler in m_agentHandlers.Values)
|
// foreach (IHttpAgentHandler handler in m_agentHandlers.Values)
|
||||||
{
|
// {
|
||||||
if (handler.Match(request, response))
|
// if (handler.Match(request, response))
|
||||||
{
|
// {
|
||||||
agentHandler = handler;
|
// agentHandler = handler;
|
||||||
return true;
|
// return true;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
return false;
|
// return false;
|
||||||
}
|
// }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Try all the registered xmlrpc handlers when an xmlrpc request is received.
|
/// Try all the registered xmlrpc handlers when an xmlrpc request is received.
|
||||||
|
@ -1737,21 +1818,21 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||||
m_pollHandlers.Remove(path);
|
m_pollHandlers.Remove(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool RemoveAgentHandler(string agent, IHttpAgentHandler handler)
|
// public bool RemoveAgentHandler(string agent, IHttpAgentHandler handler)
|
||||||
{
|
// {
|
||||||
lock (m_agentHandlers)
|
// lock (m_agentHandlers)
|
||||||
{
|
// {
|
||||||
IHttpAgentHandler foundHandler;
|
// IHttpAgentHandler foundHandler;
|
||||||
|
//
|
||||||
if (m_agentHandlers.TryGetValue(agent, out foundHandler) && foundHandler == handler)
|
// if (m_agentHandlers.TryGetValue(agent, out foundHandler) && foundHandler == handler)
|
||||||
{
|
// {
|
||||||
m_agentHandlers.Remove(agent);
|
// m_agentHandlers.Remove(agent);
|
||||||
return true;
|
// return true;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
return false;
|
// return false;
|
||||||
}
|
// }
|
||||||
|
|
||||||
public void RemoveXmlRPCHandler(string method)
|
public void RemoveXmlRPCHandler(string method)
|
||||||
{
|
{
|
||||||
|
|
|
@ -41,10 +41,10 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||||
uint Port { get; }
|
uint Port { get; }
|
||||||
bool UseSSL { get; }
|
bool UseSSL { get; }
|
||||||
|
|
||||||
// Note that the agent string is provided simply to differentiate
|
// // Note that the agent string is provided simply to differentiate
|
||||||
// the handlers - it is NOT required to be an actual agent header
|
// // the handlers - it is NOT required to be an actual agent header
|
||||||
// value.
|
// // value.
|
||||||
bool AddAgentHandler(string agent, IHttpAgentHandler handler);
|
// bool AddAgentHandler(string agent, IHttpAgentHandler handler);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Add a handler for an HTTP request.
|
/// Add a handler for an HTTP request.
|
||||||
|
@ -106,13 +106,13 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||||
|
|
||||||
bool SetDefaultLLSDHandler(DefaultLLSDMethod handler);
|
bool SetDefaultLLSDHandler(DefaultLLSDMethod handler);
|
||||||
|
|
||||||
/// <summary>
|
// /// <summary>
|
||||||
/// Remove the agent if it is registered.
|
// /// Remove the agent if it is registered.
|
||||||
/// </summary>
|
// /// </summary>
|
||||||
/// <param name="agent"></param>
|
// /// <param name="agent"></param>
|
||||||
/// <param name="handler"></param>
|
// /// <param name="handler"></param>
|
||||||
/// <returns></returns>
|
// /// <returns></returns>
|
||||||
bool RemoveAgentHandler(string agent, IHttpAgentHandler handler);
|
// bool RemoveAgentHandler(string agent, IHttpAgentHandler handler);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Remove an HTTP handler
|
/// Remove an HTTP handler
|
||||||
|
|
|
@ -53,7 +53,8 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||||
Normal = 0,
|
Normal = 0,
|
||||||
LslHttp = 1,
|
LslHttp = 1,
|
||||||
Inventory = 2,
|
Inventory = 2,
|
||||||
Texture = 3
|
Texture = 3,
|
||||||
|
Mesh = 4
|
||||||
}
|
}
|
||||||
|
|
||||||
public PollServiceEventArgs(
|
public PollServiceEventArgs(
|
||||||
|
|
|
@ -0,0 +1,33 @@
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
// General Information about an assembly is controlled through the following
|
||||||
|
// set of attributes. Change these attribute values to modify the information
|
||||||
|
// associated with an assembly.
|
||||||
|
[assembly: AssemblyTitle("OpenSim.Framework.Servers.HttpServer")]
|
||||||
|
[assembly: AssemblyDescription("")]
|
||||||
|
[assembly: AssemblyConfiguration("")]
|
||||||
|
[assembly: AssemblyCompany("http://opensimulator.org")]
|
||||||
|
[assembly: AssemblyProduct("OpenSim")]
|
||||||
|
[assembly: AssemblyCopyright("OpenSimulator developers")]
|
||||||
|
[assembly: AssemblyTrademark("")]
|
||||||
|
[assembly: AssemblyCulture("")]
|
||||||
|
|
||||||
|
// Setting ComVisible to false makes the types in this assembly not visible
|
||||||
|
// to COM components. If you need to access a type in this assembly from
|
||||||
|
// COM, set the ComVisible attribute to true on that type.
|
||||||
|
[assembly: ComVisible(false)]
|
||||||
|
|
||||||
|
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||||
|
[assembly: Guid("c4ea5baa-81c4-4867-a645-1ec360c1f164")]
|
||||||
|
|
||||||
|
// Version information for an assembly consists of the following four values:
|
||||||
|
//
|
||||||
|
// Major Version
|
||||||
|
// Minor Version
|
||||||
|
// Build Number
|
||||||
|
// Revision
|
||||||
|
//
|
||||||
|
[assembly: AssemblyVersion("0.7.5.*")]
|
||||||
|
[assembly: AssemblyFileVersion("1.0.0.0")]
|
|
@ -29,6 +29,7 @@ using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
|
using System.Text;
|
||||||
using log4net;
|
using log4net;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using OpenSim.Framework.Console;
|
using OpenSim.Framework.Console;
|
||||||
|
@ -47,9 +48,12 @@ namespace OpenSim.Framework.Servers
|
||||||
/// Control the printing of certain debug messages.
|
/// Control the printing of certain debug messages.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <remarks>
|
/// <remarks>
|
||||||
/// If DebugLevel >= 1, then short warnings are logged when receiving bad input data.
|
/// If DebugLevel >= 1 then short warnings are logged when receiving bad input data.
|
||||||
/// If DebugLevel >= 2, then long warnings are logged when receiving bad input data.
|
/// If DebugLevel >= 2 then long warnings are logged when receiving bad input data.
|
||||||
/// If DebugLevel >= 3, then short notices about all incoming non-poll HTTP requests are logged.
|
/// If DebugLevel >= 3 then short notices about all incoming non-poll HTTP requests are logged.
|
||||||
|
/// If DebugLevel >= 4 then the time taken to fulfill the request is logged.
|
||||||
|
/// If DebugLevel >= 5 then the start of the body of incoming non-poll HTTP requests will be logged.
|
||||||
|
/// If DebugLevel >= 6 then the entire body of incoming non-poll HTTP requests will be logged.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
public static int DebugLevel
|
public static int DebugLevel
|
||||||
{
|
{
|
||||||
|
@ -101,17 +105,28 @@ namespace OpenSim.Framework.Servers
|
||||||
get { return new Dictionary<uint, BaseHttpServer>(m_Servers); }
|
get { return new Dictionary<uint, BaseHttpServer>(m_Servers); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static void RegisterHttpConsoleCommands(ICommandConsole console)
|
public static void RegisterHttpConsoleCommands(ICommandConsole console)
|
||||||
{
|
{
|
||||||
console.Commands.AddCommand(
|
console.Commands.AddCommand(
|
||||||
"Debug", false, "debug http", "debug http [<level>]",
|
"Comms", false, "show http-handlers",
|
||||||
"Turn on inbound non-poll http request debugging.",
|
"show http-handlers",
|
||||||
"If level <= 0, then no extra logging is done.\n"
|
"Show all registered http handlers", HandleShowHttpHandlersCommand);
|
||||||
+ "If level >= 1, then short warnings are logged when receiving bad input data.\n"
|
|
||||||
+ "If level >= 2, then long warnings are logged when receiving bad input data.\n"
|
console.Commands.AddCommand(
|
||||||
+ "If level >= 3, then short notices about all incoming non-poll HTTP requests are logged.\n"
|
"Debug", false, "debug http", "debug http <in|out|all> [<level>]",
|
||||||
+ "If no level is specified then the current level is returned.",
|
"Turn on http request logging.",
|
||||||
|
"If in or all and\n"
|
||||||
|
+ " level <= 0 then no extra logging is done.\n"
|
||||||
|
+ " level >= 1 then short warnings are logged when receiving bad input data.\n"
|
||||||
|
+ " level >= 2 then long warnings are logged when receiving bad input data.\n"
|
||||||
|
+ " level >= 3 then short notices about all incoming non-poll HTTP requests are logged.\n"
|
||||||
|
+ " level >= 4 then the time taken to fulfill the request is logged.\n"
|
||||||
|
+ " level >= 5 then a sample from the beginning of the incoming data is logged.\n"
|
||||||
|
+ " level >= 6 then the entire incoming data is logged.\n"
|
||||||
|
+ " no level is specified then the current level is returned.\n\n"
|
||||||
|
+ "If out or all and\n"
|
||||||
|
+ " level >= 3 then short notices about all outgoing requests going through WebUtil are logged.\n"
|
||||||
|
+ " level >= 4 then the time taken to fulfill the request is logged.\n",
|
||||||
HandleDebugHttpCommand);
|
HandleDebugHttpCommand);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -119,25 +134,120 @@ namespace OpenSim.Framework.Servers
|
||||||
/// Turn on some debugging values for OpenSim.
|
/// Turn on some debugging values for OpenSim.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="args"></param>
|
/// <param name="args"></param>
|
||||||
private static void HandleDebugHttpCommand(string module, string[] args)
|
private static void HandleDebugHttpCommand(string module, string[] cmdparams)
|
||||||
{
|
{
|
||||||
if (args.Length == 3)
|
if (cmdparams.Length < 3)
|
||||||
{
|
{
|
||||||
int newDebug;
|
MainConsole.Instance.Output("Usage: debug http <in|out|all> 0..6");
|
||||||
if (int.TryParse(args[2], out newDebug))
|
return;
|
||||||
{
|
|
||||||
MainServer.DebugLevel = newDebug;
|
|
||||||
MainConsole.Instance.OutputFormat("Debug http level set to {0}", newDebug);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if (args.Length == 2)
|
|
||||||
|
bool inReqs = false;
|
||||||
|
bool outReqs = false;
|
||||||
|
bool allReqs = false;
|
||||||
|
|
||||||
|
string subCommand = cmdparams[2];
|
||||||
|
|
||||||
|
if (subCommand.ToLower() == "in")
|
||||||
{
|
{
|
||||||
MainConsole.Instance.OutputFormat("Current debug http level is {0}", MainServer.DebugLevel);
|
inReqs = true;
|
||||||
|
}
|
||||||
|
else if (subCommand.ToLower() == "out")
|
||||||
|
{
|
||||||
|
outReqs = true;
|
||||||
|
}
|
||||||
|
else if (subCommand.ToLower() == "all")
|
||||||
|
{
|
||||||
|
allReqs = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
MainConsole.Instance.Output("Usage: debug http 0..3");
|
MainConsole.Instance.Output("You must specify in, out or all");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (cmdparams.Length >= 4)
|
||||||
|
{
|
||||||
|
string rawNewDebug = cmdparams[3];
|
||||||
|
int newDebug;
|
||||||
|
|
||||||
|
if (!int.TryParse(rawNewDebug, out newDebug))
|
||||||
|
{
|
||||||
|
MainConsole.Instance.OutputFormat("{0} is not a valid debug level", rawNewDebug);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (newDebug < 0 || newDebug > 6)
|
||||||
|
{
|
||||||
|
MainConsole.Instance.OutputFormat("{0} is outside the valid debug level range of 0..6", newDebug);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (allReqs || inReqs)
|
||||||
|
{
|
||||||
|
MainServer.DebugLevel = newDebug;
|
||||||
|
MainConsole.Instance.OutputFormat("IN debug level set to {0}", newDebug);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (allReqs || outReqs)
|
||||||
|
{
|
||||||
|
WebUtil.DebugLevel = newDebug;
|
||||||
|
MainConsole.Instance.OutputFormat("OUT debug level set to {0}", newDebug);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (allReqs || inReqs)
|
||||||
|
MainConsole.Instance.OutputFormat("Current IN debug level is {0}", MainServer.DebugLevel);
|
||||||
|
|
||||||
|
if (allReqs || outReqs)
|
||||||
|
MainConsole.Instance.OutputFormat("Current OUT debug level is {0}", WebUtil.DebugLevel);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void HandleShowHttpHandlersCommand(string module, string[] args)
|
||||||
|
{
|
||||||
|
if (args.Length != 2)
|
||||||
|
{
|
||||||
|
MainConsole.Instance.Output("Usage: show http-handlers");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
StringBuilder handlers = new StringBuilder();
|
||||||
|
|
||||||
|
lock (m_Servers)
|
||||||
|
{
|
||||||
|
foreach (BaseHttpServer httpServer in m_Servers.Values)
|
||||||
|
{
|
||||||
|
handlers.AppendFormat(
|
||||||
|
"Registered HTTP Handlers for server at {0}:{1}\n", httpServer.ListenIPAddress, httpServer.Port);
|
||||||
|
|
||||||
|
handlers.AppendFormat("* XMLRPC:\n");
|
||||||
|
foreach (String s in httpServer.GetXmlRpcHandlerKeys())
|
||||||
|
handlers.AppendFormat("\t{0}\n", s);
|
||||||
|
|
||||||
|
handlers.AppendFormat("* HTTP:\n");
|
||||||
|
List<String> poll = httpServer.GetPollServiceHandlerKeys();
|
||||||
|
foreach (String s in httpServer.GetHTTPHandlerKeys())
|
||||||
|
handlers.AppendFormat("\t{0} {1}\n", s, (poll.Contains(s) ? "(poll service)" : string.Empty));
|
||||||
|
|
||||||
|
// handlers.AppendFormat("* Agent:\n");
|
||||||
|
// foreach (String s in httpServer.GetAgentHandlerKeys())
|
||||||
|
// handlers.AppendFormat("\t{0}\n", s);
|
||||||
|
|
||||||
|
handlers.AppendFormat("* LLSD:\n");
|
||||||
|
foreach (String s in httpServer.GetLLSDHandlerKeys())
|
||||||
|
handlers.AppendFormat("\t{0}\n", s);
|
||||||
|
|
||||||
|
handlers.AppendFormat("* StreamHandlers ({0}):\n", httpServer.GetStreamHandlerKeys().Count);
|
||||||
|
foreach (String s in httpServer.GetStreamHandlerKeys())
|
||||||
|
handlers.AppendFormat("\t{0}\n", s);
|
||||||
|
|
||||||
|
handlers.Append("\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
MainConsole.Instance.Output(handlers.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -0,0 +1,33 @@
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
// General Information about an assembly is controlled through the following
|
||||||
|
// set of attributes. Change these attribute values to modify the information
|
||||||
|
// associated with an assembly.
|
||||||
|
[assembly: AssemblyTitle("OpenSim.Framework.Servers")]
|
||||||
|
[assembly: AssemblyDescription("")]
|
||||||
|
[assembly: AssemblyConfiguration("")]
|
||||||
|
[assembly: AssemblyCompany("http://opensimulator.org")]
|
||||||
|
[assembly: AssemblyProduct("OpenSim")]
|
||||||
|
[assembly: AssemblyCopyright("OpenSimulator developers")]
|
||||||
|
[assembly: AssemblyTrademark("")]
|
||||||
|
[assembly: AssemblyCulture("")]
|
||||||
|
|
||||||
|
// Setting ComVisible to false makes the types in this assembly not visible
|
||||||
|
// to COM components. If you need to access a type in this assembly from
|
||||||
|
// COM, set the ComVisible attribute to true on that type.
|
||||||
|
[assembly: ComVisible(false)]
|
||||||
|
|
||||||
|
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||||
|
[assembly: Guid("b48e8b3e-5c5c-4673-b31f-21e13b8e568b")]
|
||||||
|
|
||||||
|
// Version information for an assembly consists of the following four values:
|
||||||
|
//
|
||||||
|
// Major Version
|
||||||
|
// Minor Version
|
||||||
|
// Build Number
|
||||||
|
// Revision
|
||||||
|
//
|
||||||
|
[assembly: AssemblyVersion("0.7.5.*")]
|
||||||
|
[assembly: AssemblyFileVersion("1.0.0.0")]
|
|
@ -0,0 +1,566 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* * Neither the name of the OpenSimulator Project nor the
|
||||||
|
* names of its contributors may be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||||
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Text;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
using log4net;
|
||||||
|
using log4net.Appender;
|
||||||
|
using log4net.Core;
|
||||||
|
using log4net.Repository;
|
||||||
|
using Nini.Config;
|
||||||
|
using OpenSim.Framework.Console;
|
||||||
|
|
||||||
|
namespace OpenSim.Framework.Servers
|
||||||
|
{
|
||||||
|
public class ServerBase
|
||||||
|
{
|
||||||
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
|
public IConfigSource Config { get; protected set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Console to be used for any command line output. Can be null, in which case there should be no output.
|
||||||
|
/// </summary>
|
||||||
|
protected ICommandConsole m_console;
|
||||||
|
|
||||||
|
protected OpenSimAppender m_consoleAppender;
|
||||||
|
protected FileAppender m_logFileAppender;
|
||||||
|
|
||||||
|
protected DateTime m_startuptime;
|
||||||
|
protected string m_startupDirectory = Environment.CurrentDirectory;
|
||||||
|
|
||||||
|
protected string m_pidFile = String.Empty;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Server version information. Usually VersionInfo + information about git commit, operating system, etc.
|
||||||
|
/// </summary>
|
||||||
|
protected string m_version;
|
||||||
|
|
||||||
|
public ServerBase()
|
||||||
|
{
|
||||||
|
m_startuptime = DateTime.Now;
|
||||||
|
m_version = VersionInfo.Version;
|
||||||
|
EnhanceVersionInformation();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void CreatePIDFile(string path)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string pidstring = System.Diagnostics.Process.GetCurrentProcess().Id.ToString();
|
||||||
|
|
||||||
|
using (FileStream fs = File.Create(path))
|
||||||
|
{
|
||||||
|
Byte[] buf = Encoding.ASCII.GetBytes(pidstring);
|
||||||
|
fs.Write(buf, 0, buf.Length);
|
||||||
|
}
|
||||||
|
|
||||||
|
m_pidFile = path;
|
||||||
|
|
||||||
|
m_log.InfoFormat("[SERVER BASE]: Created pid file {0}", m_pidFile);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
m_log.Warn(string.Format("[SERVER BASE]: Could not create PID file at {0} ", path), e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void RemovePIDFile()
|
||||||
|
{
|
||||||
|
if (m_pidFile != String.Empty)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
File.Delete(m_pidFile);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
m_log.Error(string.Format("[SERVER BASE]: Error whilst removing {0} ", m_pidFile), e);
|
||||||
|
}
|
||||||
|
|
||||||
|
m_pidFile = String.Empty;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RegisterCommonAppenders(IConfig startupConfig)
|
||||||
|
{
|
||||||
|
ILoggerRepository repository = LogManager.GetRepository();
|
||||||
|
IAppender[] appenders = repository.GetAppenders();
|
||||||
|
|
||||||
|
foreach (IAppender appender in appenders)
|
||||||
|
{
|
||||||
|
if (appender.Name == "Console")
|
||||||
|
{
|
||||||
|
m_consoleAppender = (OpenSimAppender)appender;
|
||||||
|
}
|
||||||
|
else if (appender.Name == "LogFileAppender")
|
||||||
|
{
|
||||||
|
m_logFileAppender = (FileAppender)appender;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (null == m_consoleAppender)
|
||||||
|
{
|
||||||
|
Notice("No appender named Console found (see the log4net config file for this executable)!");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// FIXME: This should be done through an interface rather than casting.
|
||||||
|
m_consoleAppender.Console = (ConsoleBase)m_console;
|
||||||
|
|
||||||
|
// If there is no threshold set then the threshold is effectively everything.
|
||||||
|
if (null == m_consoleAppender.Threshold)
|
||||||
|
m_consoleAppender.Threshold = Level.All;
|
||||||
|
|
||||||
|
Notice(String.Format("Console log level is {0}", m_consoleAppender.Threshold));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_logFileAppender != null && startupConfig != null)
|
||||||
|
{
|
||||||
|
string cfgFileName = startupConfig.GetString("LogFile", null);
|
||||||
|
if (cfgFileName != null)
|
||||||
|
{
|
||||||
|
m_logFileAppender.File = cfgFileName;
|
||||||
|
m_logFileAppender.ActivateOptions();
|
||||||
|
}
|
||||||
|
|
||||||
|
m_log.InfoFormat("[SERVER BASE]: Logging started to file {0}", m_logFileAppender.File);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Register common commands once m_console has been set if it is going to be set
|
||||||
|
/// </summary>
|
||||||
|
public void RegisterCommonCommands()
|
||||||
|
{
|
||||||
|
if (m_console == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
m_console.Commands.AddCommand(
|
||||||
|
"General", false, "show info", "show info", "Show general information about the server", HandleShow);
|
||||||
|
|
||||||
|
m_console.Commands.AddCommand(
|
||||||
|
"General", false, "show uptime", "show uptime", "Show server uptime", HandleShow);
|
||||||
|
|
||||||
|
m_console.Commands.AddCommand(
|
||||||
|
"General", false, "get log level", "get log level", "Get the current console logging level",
|
||||||
|
(mod, cmd) => ShowLogLevel());
|
||||||
|
|
||||||
|
m_console.Commands.AddCommand(
|
||||||
|
"General", false, "set log level", "set log level <level>",
|
||||||
|
"Set the console logging level for this session.", HandleSetLogLevel);
|
||||||
|
|
||||||
|
m_console.Commands.AddCommand(
|
||||||
|
"General", false, "config set",
|
||||||
|
"config set <section> <key> <value>",
|
||||||
|
"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);
|
||||||
|
|
||||||
|
m_console.Commands.AddCommand(
|
||||||
|
"General", false, "config get",
|
||||||
|
"config get [<section>] [<key>]",
|
||||||
|
"Synonym for config show",
|
||||||
|
HandleConfig);
|
||||||
|
|
||||||
|
m_console.Commands.AddCommand(
|
||||||
|
"General", false, "config show",
|
||||||
|
"config show [<section>] [<key>]",
|
||||||
|
"Show config information",
|
||||||
|
"If neither section nor field are specified, then the whole current configuration is printed." + Environment.NewLine
|
||||||
|
+ "If a section is given but not a field, then all fields in that section are printed.",
|
||||||
|
HandleConfig);
|
||||||
|
|
||||||
|
m_console.Commands.AddCommand(
|
||||||
|
"General", false, "config save",
|
||||||
|
"config save <path>",
|
||||||
|
"Save current configuration to a file at the given path", HandleConfig);
|
||||||
|
|
||||||
|
m_console.Commands.AddCommand(
|
||||||
|
"General", false, "command-script",
|
||||||
|
"command-script <script>",
|
||||||
|
"Run a command script from file", HandleScript);
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual void HandleShow(string module, string[] cmd)
|
||||||
|
{
|
||||||
|
List<string> args = new List<string>(cmd);
|
||||||
|
|
||||||
|
args.RemoveAt(0);
|
||||||
|
|
||||||
|
string[] showParams = args.ToArray();
|
||||||
|
|
||||||
|
switch (showParams[0])
|
||||||
|
{
|
||||||
|
case "info":
|
||||||
|
ShowInfo();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "uptime":
|
||||||
|
Notice(GetUptimeReport());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Change and load configuration file data.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="module"></param>
|
||||||
|
/// <param name="cmd"></param>
|
||||||
|
private void HandleConfig(string module, string[] cmd)
|
||||||
|
{
|
||||||
|
List<string> args = new List<string>(cmd);
|
||||||
|
args.RemoveAt(0);
|
||||||
|
string[] cmdparams = args.ToArray();
|
||||||
|
|
||||||
|
if (cmdparams.Length > 0)
|
||||||
|
{
|
||||||
|
string firstParam = cmdparams[0].ToLower();
|
||||||
|
|
||||||
|
switch (firstParam)
|
||||||
|
{
|
||||||
|
case "set":
|
||||||
|
if (cmdparams.Length < 4)
|
||||||
|
{
|
||||||
|
Notice("Syntax: config set <section> <key> <value>");
|
||||||
|
Notice("Example: config set ScriptEngine.DotNetEngine NumberOfScriptThreads 5");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
IConfig c;
|
||||||
|
IConfigSource source = new IniConfigSource();
|
||||||
|
c = source.AddConfig(cmdparams[1]);
|
||||||
|
if (c != null)
|
||||||
|
{
|
||||||
|
string _value = String.Join(" ", cmdparams, 3, cmdparams.Length - 3);
|
||||||
|
c.Set(cmdparams[2], _value);
|
||||||
|
Config.Merge(source);
|
||||||
|
|
||||||
|
Notice("In section [{0}], set {1} = {2}", c.Name, cmdparams[2], _value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "get":
|
||||||
|
case "show":
|
||||||
|
if (cmdparams.Length == 1)
|
||||||
|
{
|
||||||
|
foreach (IConfig config in Config.Configs)
|
||||||
|
{
|
||||||
|
Notice("[{0}]", config.Name);
|
||||||
|
string[] keys = config.GetKeys();
|
||||||
|
foreach (string key in keys)
|
||||||
|
Notice(" {0} = {1}", key, config.GetString(key));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (cmdparams.Length == 2 || cmdparams.Length == 3)
|
||||||
|
{
|
||||||
|
IConfig config = Config.Configs[cmdparams[1]];
|
||||||
|
if (config == null)
|
||||||
|
{
|
||||||
|
Notice("Section \"{0}\" does not exist.",cmdparams[1]);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (cmdparams.Length == 2)
|
||||||
|
{
|
||||||
|
Notice("[{0}]", config.Name);
|
||||||
|
foreach (string key in config.GetKeys())
|
||||||
|
Notice(" {0} = {1}", key, config.GetString(key));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Notice(
|
||||||
|
"config get {0} {1} : {2}",
|
||||||
|
cmdparams[1], cmdparams[2], config.GetString(cmdparams[2]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Notice("Syntax: config {0} [<section>] [<key>]", firstParam);
|
||||||
|
Notice("Example: config {0} ScriptEngine.DotNetEngine NumberOfScriptThreads", firstParam);
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "save":
|
||||||
|
if (cmdparams.Length < 2)
|
||||||
|
{
|
||||||
|
Notice("Syntax: config save <path>");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
string path = cmdparams[1];
|
||||||
|
Notice("Saving configuration file: {0}", path);
|
||||||
|
|
||||||
|
if (Config is IniConfigSource)
|
||||||
|
{
|
||||||
|
IniConfigSource iniCon = (IniConfigSource)Config;
|
||||||
|
iniCon.Save(path);
|
||||||
|
}
|
||||||
|
else if (Config is XmlConfigSource)
|
||||||
|
{
|
||||||
|
XmlConfigSource xmlCon = (XmlConfigSource)Config;
|
||||||
|
xmlCon.Save(path);
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void HandleSetLogLevel(string module, string[] cmd)
|
||||||
|
{
|
||||||
|
if (cmd.Length != 4)
|
||||||
|
{
|
||||||
|
Notice("Usage: set log level <level>");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (null == m_consoleAppender)
|
||||||
|
{
|
||||||
|
Notice("No appender named Console found (see the log4net config file for this executable)!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
string rawLevel = cmd[3];
|
||||||
|
|
||||||
|
ILoggerRepository repository = LogManager.GetRepository();
|
||||||
|
Level consoleLevel = repository.LevelMap[rawLevel];
|
||||||
|
|
||||||
|
if (consoleLevel != null)
|
||||||
|
m_consoleAppender.Threshold = consoleLevel;
|
||||||
|
else
|
||||||
|
Notice(
|
||||||
|
"{0} is not a valid logging level. Valid logging levels are ALL, DEBUG, INFO, WARN, ERROR, FATAL, OFF",
|
||||||
|
rawLevel);
|
||||||
|
|
||||||
|
ShowLogLevel();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ShowLogLevel()
|
||||||
|
{
|
||||||
|
Notice("Console log level is {0}", m_consoleAppender.Threshold);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected virtual void HandleScript(string module, string[] parms)
|
||||||
|
{
|
||||||
|
if (parms.Length != 2)
|
||||||
|
{
|
||||||
|
Notice("Usage: command-script <path-to-script");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
RunCommandScript(parms[1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Run an optional startup list of commands
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="fileName"></param>
|
||||||
|
protected void RunCommandScript(string fileName)
|
||||||
|
{
|
||||||
|
if (m_console == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (File.Exists(fileName))
|
||||||
|
{
|
||||||
|
m_log.Info("[SERVER BASE]: Running " + fileName);
|
||||||
|
|
||||||
|
using (StreamReader readFile = File.OpenText(fileName))
|
||||||
|
{
|
||||||
|
string currentCommand;
|
||||||
|
while ((currentCommand = readFile.ReadLine()) != null)
|
||||||
|
{
|
||||||
|
currentCommand = currentCommand.Trim();
|
||||||
|
if (!(currentCommand == ""
|
||||||
|
|| currentCommand.StartsWith(";")
|
||||||
|
|| currentCommand.StartsWith("//")
|
||||||
|
|| currentCommand.StartsWith("#")))
|
||||||
|
{
|
||||||
|
m_log.Info("[SERVER BASE]: Running '" + currentCommand + "'");
|
||||||
|
m_console.RunCommand(currentCommand);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Return a report about the uptime of this server
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
protected string GetUptimeReport()
|
||||||
|
{
|
||||||
|
StringBuilder sb = new StringBuilder(String.Format("Time now is {0}\n", DateTime.Now));
|
||||||
|
sb.Append(String.Format("Server has been running since {0}, {1}\n", m_startuptime.DayOfWeek, m_startuptime));
|
||||||
|
sb.Append(String.Format("That is an elapsed time of {0}\n", DateTime.Now - m_startuptime));
|
||||||
|
|
||||||
|
return sb.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void ShowInfo()
|
||||||
|
{
|
||||||
|
Notice(GetVersionText());
|
||||||
|
Notice("Startup directory: " + m_startupDirectory);
|
||||||
|
if (null != m_consoleAppender)
|
||||||
|
Notice(String.Format("Console log level: {0}", m_consoleAppender.Threshold));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Enhance the version string with extra information if it's available.
|
||||||
|
/// </summary>
|
||||||
|
protected void EnhanceVersionInformation()
|
||||||
|
{
|
||||||
|
string buildVersion = string.Empty;
|
||||||
|
|
||||||
|
// The subversion information is deprecated and will be removed at a later date
|
||||||
|
// Add subversion revision information if available
|
||||||
|
// Try file "svn_revision" in the current directory first, then the .svn info.
|
||||||
|
// This allows to make the revision available in simulators not running from the source tree.
|
||||||
|
// FIXME: Making an assumption about the directory we're currently in - we do this all over the place
|
||||||
|
// elsewhere as well
|
||||||
|
string gitDir = "../.git/";
|
||||||
|
string gitRefPointerPath = gitDir + "HEAD";
|
||||||
|
|
||||||
|
string svnRevisionFileName = "svn_revision";
|
||||||
|
string svnFileName = ".svn/entries";
|
||||||
|
string manualVersionFileName = ".version";
|
||||||
|
string inputLine;
|
||||||
|
int strcmp;
|
||||||
|
|
||||||
|
if (File.Exists(manualVersionFileName))
|
||||||
|
{
|
||||||
|
using (StreamReader CommitFile = File.OpenText(manualVersionFileName))
|
||||||
|
buildVersion = CommitFile.ReadLine();
|
||||||
|
|
||||||
|
m_version += buildVersion ?? "";
|
||||||
|
}
|
||||||
|
else if (File.Exists(gitRefPointerPath))
|
||||||
|
{
|
||||||
|
// m_log.DebugFormat("[SERVER BASE]: Found {0}", gitRefPointerPath);
|
||||||
|
|
||||||
|
string rawPointer = "";
|
||||||
|
|
||||||
|
using (StreamReader pointerFile = File.OpenText(gitRefPointerPath))
|
||||||
|
rawPointer = pointerFile.ReadLine();
|
||||||
|
|
||||||
|
// m_log.DebugFormat("[SERVER BASE]: rawPointer [{0}]", rawPointer);
|
||||||
|
|
||||||
|
Match m = Regex.Match(rawPointer, "^ref: (.+)$");
|
||||||
|
|
||||||
|
if (m.Success)
|
||||||
|
{
|
||||||
|
// m_log.DebugFormat("[SERVER BASE]: Matched [{0}]", m.Groups[1].Value);
|
||||||
|
|
||||||
|
string gitRef = m.Groups[1].Value;
|
||||||
|
string gitRefPath = gitDir + gitRef;
|
||||||
|
if (File.Exists(gitRefPath))
|
||||||
|
{
|
||||||
|
// m_log.DebugFormat("[SERVER BASE]: Found gitRefPath [{0}]", gitRefPath);
|
||||||
|
|
||||||
|
using (StreamReader refFile = File.OpenText(gitRefPath))
|
||||||
|
{
|
||||||
|
string gitHash = refFile.ReadLine();
|
||||||
|
m_version += gitHash.Substring(0, 7);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Remove the else logic when subversion mirror is no longer used
|
||||||
|
if (File.Exists(svnRevisionFileName))
|
||||||
|
{
|
||||||
|
StreamReader RevisionFile = File.OpenText(svnRevisionFileName);
|
||||||
|
buildVersion = RevisionFile.ReadLine();
|
||||||
|
buildVersion.Trim();
|
||||||
|
RevisionFile.Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(buildVersion) && File.Exists(svnFileName))
|
||||||
|
{
|
||||||
|
StreamReader EntriesFile = File.OpenText(svnFileName);
|
||||||
|
inputLine = EntriesFile.ReadLine();
|
||||||
|
while (inputLine != null)
|
||||||
|
{
|
||||||
|
// using the dir svn revision at the top of entries file
|
||||||
|
strcmp = String.Compare(inputLine, "dir");
|
||||||
|
if (strcmp == 0)
|
||||||
|
{
|
||||||
|
buildVersion = EntriesFile.ReadLine();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
inputLine = EntriesFile.ReadLine();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
EntriesFile.Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
m_version += string.IsNullOrEmpty(buildVersion) ? " " : ("." + buildVersion + " ").Substring(0, 6);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected string GetVersionText()
|
||||||
|
{
|
||||||
|
return String.Format("Version: {0} (interface version {1})", m_version, VersionInfo.MajorInterfaceVersion);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Console output is only possible if a console has been established.
|
||||||
|
/// That is something that cannot be determined within this class. So
|
||||||
|
/// all attempts to use the console MUST be verified.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="msg"></param>
|
||||||
|
protected void Notice(string msg)
|
||||||
|
{
|
||||||
|
if (m_console != null)
|
||||||
|
{
|
||||||
|
m_console.Output(msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Console output is only possible if a console has been established.
|
||||||
|
/// That is something that cannot be determined within this class. So
|
||||||
|
/// all attempts to use the console MUST be verified.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="format"></param>
|
||||||
|
/// <param name="components"></param>
|
||||||
|
protected void Notice(string format, params object[] components)
|
||||||
|
{
|
||||||
|
if (m_console != null)
|
||||||
|
m_console.OutputFormat(format, components);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -29,7 +29,7 @@ namespace OpenSim
|
||||||
{
|
{
|
||||||
public class VersionInfo
|
public class VersionInfo
|
||||||
{
|
{
|
||||||
private const string VERSION_NUMBER = "0.7.4CM";
|
private const string VERSION_NUMBER = "0.7.5CM";
|
||||||
private const Flavour VERSION_FLAVOUR = Flavour.Dev;
|
private const Flavour VERSION_FLAVOUR = Flavour.Dev;
|
||||||
|
|
||||||
public enum Flavour
|
public enum Flavour
|
||||||
|
|
|
@ -39,10 +39,12 @@ using OpenMetaverse;
|
||||||
namespace OpenSim.Framework
|
namespace OpenSim.Framework
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A dictionary for task inventory.
|
/// A dictionary containing task inventory items. Indexed by item UUID.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
/// This class is not thread safe. Callers must synchronize on Dictionary methods or Clone() this object before
|
/// This class is not thread safe. Callers must synchronize on Dictionary methods or Clone() this object before
|
||||||
/// iterating over it.
|
/// iterating over it.
|
||||||
|
/// </remarks>
|
||||||
public class TaskInventoryDictionary : Dictionary<UUID, TaskInventoryItem>,
|
public class TaskInventoryDictionary : Dictionary<UUID, TaskInventoryItem>,
|
||||||
ICloneable, IXmlSerializable
|
ICloneable, IXmlSerializable
|
||||||
{
|
{
|
||||||
|
|
|
@ -73,9 +73,6 @@ namespace OpenSim.Framework
|
||||||
|
|
||||||
private bool _ownerChanged = false;
|
private bool _ownerChanged = false;
|
||||||
|
|
||||||
// This used ONLY during copy. It can't be relied on at other times!
|
|
||||||
private bool _scriptRunning = true;
|
|
||||||
|
|
||||||
public UUID AssetID {
|
public UUID AssetID {
|
||||||
get {
|
get {
|
||||||
return _assetID;
|
return _assetID;
|
||||||
|
@ -353,14 +350,13 @@ namespace OpenSim.Framework
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool ScriptRunning {
|
/// <summary>
|
||||||
get {
|
/// This used ONLY during copy. It can't be relied on at other times!
|
||||||
return _scriptRunning;
|
/// </summary>
|
||||||
}
|
/// <remarks>
|
||||||
set {
|
/// For true script running status, use IEntityInventory.TryGetScriptInstanceRunning() for now.
|
||||||
_scriptRunning = value;
|
/// </remarks>
|
||||||
}
|
public bool ScriptRunning { get; set; }
|
||||||
}
|
|
||||||
|
|
||||||
// See ICloneable
|
// See ICloneable
|
||||||
|
|
||||||
|
@ -388,6 +384,7 @@ namespace OpenSim.Framework
|
||||||
|
|
||||||
public TaskInventoryItem()
|
public TaskInventoryItem()
|
||||||
{
|
{
|
||||||
|
ScriptRunning = true;
|
||||||
CreationDate = (uint)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
|
CreationDate = (uint)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -545,6 +545,19 @@ namespace OpenSim.Framework
|
||||||
return (x + y - (min >> 1) - (min >> 2) + (min >> 4));
|
return (x + y - (min >> 1) - (min >> 2) + (min >> 4));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Determines whether a point is inside a bounding box.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name='v'></param>
|
||||||
|
/// <param name='min'></param>
|
||||||
|
/// <param name='max'></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static bool IsInsideBox(Vector3 v, Vector3 min, Vector3 max)
|
||||||
|
{
|
||||||
|
return v.X >= min.X & v.Y >= min.Y && v.Z >= min.Z
|
||||||
|
&& v.X <= max.X && v.Y <= max.Y && v.Z <= max.Z;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Are the co-ordinates of the new region visible from the old region?
|
/// Are the co-ordinates of the new region visible from the old region?
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -862,6 +875,12 @@ namespace OpenSim.Framework
|
||||||
return Math.Min(Math.Max(x, min), max);
|
return Math.Min(Math.Max(x, min), max);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Vector3 Clip(Vector3 vec, float min, float max)
|
||||||
|
{
|
||||||
|
return new Vector3(Clip(vec.X, min, max), Clip(vec.Y, min, max),
|
||||||
|
Clip(vec.Z, min, max));
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Convert an UUID to a raw uuid string. Right now this is a string without hyphens.
|
/// Convert an UUID to a raw uuid string. Right now this is a string without hyphens.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -1013,6 +1032,38 @@ namespace OpenSim.Framework
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Copy data from one stream to another, leaving the read position of both streams at the beginning.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name='inputStream'>
|
||||||
|
/// Input stream. Must be seekable.
|
||||||
|
/// </param>
|
||||||
|
/// <exception cref='ArgumentException'>
|
||||||
|
/// Thrown if the input stream is not seekable.
|
||||||
|
/// </exception>
|
||||||
|
public static Stream Copy(Stream inputStream)
|
||||||
|
{
|
||||||
|
if (!inputStream.CanSeek)
|
||||||
|
throw new ArgumentException("Util.Copy(Stream inputStream) must receive an inputStream that can seek");
|
||||||
|
|
||||||
|
const int readSize = 256;
|
||||||
|
byte[] buffer = new byte[readSize];
|
||||||
|
MemoryStream ms = new MemoryStream();
|
||||||
|
|
||||||
|
int count = inputStream.Read(buffer, 0, readSize);
|
||||||
|
|
||||||
|
while (count > 0)
|
||||||
|
{
|
||||||
|
ms.Write(buffer, 0, count);
|
||||||
|
count = inputStream.Read(buffer, 0, readSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
ms.Position = 0;
|
||||||
|
inputStream.Position = 0;
|
||||||
|
|
||||||
|
return ms;
|
||||||
|
}
|
||||||
|
|
||||||
public static XmlRpcResponse XmlRpcCommand(string url, string methodName, params object[] args)
|
public static XmlRpcResponse XmlRpcCommand(string url, string methodName, params object[] args)
|
||||||
{
|
{
|
||||||
return SendXmlRpcCommand(url, methodName, args);
|
return SendXmlRpcCommand(url, methodName, args);
|
||||||
|
|
|
@ -53,10 +53,18 @@ namespace OpenSim.Framework
|
||||||
LogManager.GetLogger(
|
LogManager.GetLogger(
|
||||||
MethodBase.GetCurrentMethod().DeclaringType);
|
MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Control the printing of certain debug messages.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// If DebugLevel >= 3 then short notices about outgoing HTTP requests are logged.
|
||||||
|
/// </remarks>
|
||||||
|
public static int DebugLevel { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Request number for diagnostic purposes.
|
/// Request number for diagnostic purposes.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static int RequestNumber = 0;
|
public static int RequestNumber { get; internal set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// this is the header field used to communicate the local request id
|
/// this is the header field used to communicate the local request id
|
||||||
|
@ -146,7 +154,11 @@ namespace OpenSim.Framework
|
||||||
private static OSDMap ServiceOSDRequestWorker(string url, OSDMap data, string method, int timeout, bool compressed)
|
private static OSDMap ServiceOSDRequestWorker(string url, OSDMap data, string method, int timeout, bool compressed)
|
||||||
{
|
{
|
||||||
int reqnum = RequestNumber++;
|
int reqnum = RequestNumber++;
|
||||||
// m_log.DebugFormat("[WEB UTIL]: <{0}> start osd request for {1}, method {2}",reqnum,url,method);
|
|
||||||
|
if (DebugLevel >= 3)
|
||||||
|
m_log.DebugFormat(
|
||||||
|
"[WEB UTIL]: HTTP OUT {0} ServiceOSD {1} {2} (timeout {3}, compressed {4})",
|
||||||
|
reqnum, method, url, timeout, compressed);
|
||||||
|
|
||||||
string errorMessage = "unknown error";
|
string errorMessage = "unknown error";
|
||||||
int tickstart = Util.EnvironmentTickCount();
|
int tickstart = Util.EnvironmentTickCount();
|
||||||
|
@ -230,7 +242,7 @@ namespace OpenSim.Framework
|
||||||
int tickdiff = Util.EnvironmentTickCountSubtract(tickstart);
|
int tickdiff = Util.EnvironmentTickCountSubtract(tickstart);
|
||||||
if (tickdiff > LongCallTime)
|
if (tickdiff > LongCallTime)
|
||||||
m_log.InfoFormat(
|
m_log.InfoFormat(
|
||||||
"[OSD REQUEST]: Slow request to <{0}> {1} {2} took {3}ms, {4}ms writing, {5}",
|
"[WEB UTIL]: Slow ServiceOSD request {0} {1} {2} took {3}ms, {4}ms writing, {5}",
|
||||||
reqnum,
|
reqnum,
|
||||||
method,
|
method,
|
||||||
url,
|
url,
|
||||||
|
@ -239,10 +251,14 @@ namespace OpenSim.Framework
|
||||||
strBuffer != null
|
strBuffer != null
|
||||||
? (strBuffer.Length > MaxRequestDiagLength ? strBuffer.Remove(MaxRequestDiagLength) : strBuffer)
|
? (strBuffer.Length > MaxRequestDiagLength ? strBuffer.Remove(MaxRequestDiagLength) : strBuffer)
|
||||||
: "");
|
: "");
|
||||||
|
else if (DebugLevel >= 4)
|
||||||
|
m_log.DebugFormat(
|
||||||
|
"[WEB UTIL]: HTTP OUT {0} took {1}ms, {2}ms writing",
|
||||||
|
reqnum, tickdiff, tickdata);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_log.DebugFormat(
|
m_log.DebugFormat(
|
||||||
"[WEB UTIL]: <{0}> osd request for {1}, method {2} FAILED: {3}", reqnum, url, method, errorMessage);
|
"[WEB UTIL]: ServiceOSD request {0} {1} {2} FAILED: {3}", reqnum, url, method, errorMessage);
|
||||||
|
|
||||||
return ErrorResponseMap(errorMessage);
|
return ErrorResponseMap(errorMessage);
|
||||||
}
|
}
|
||||||
|
@ -318,7 +334,11 @@ namespace OpenSim.Framework
|
||||||
{
|
{
|
||||||
int reqnum = RequestNumber++;
|
int reqnum = RequestNumber++;
|
||||||
string method = (data != null && data["RequestMethod"] != null) ? data["RequestMethod"] : "unknown";
|
string method = (data != null && data["RequestMethod"] != null) ? data["RequestMethod"] : "unknown";
|
||||||
// m_log.DebugFormat("[WEB UTIL]: <{0}> start form request for {1}, method {2}",reqnum,url,method);
|
|
||||||
|
if (DebugLevel >= 3)
|
||||||
|
m_log.DebugFormat(
|
||||||
|
"[WEB UTIL]: HTTP OUT {0} ServiceForm {1} {2} (timeout {3})",
|
||||||
|
reqnum, method, url, timeout);
|
||||||
|
|
||||||
string errorMessage = "unknown error";
|
string errorMessage = "unknown error";
|
||||||
int tickstart = Util.EnvironmentTickCount();
|
int tickstart = Util.EnvironmentTickCount();
|
||||||
|
@ -381,7 +401,7 @@ namespace OpenSim.Framework
|
||||||
int tickdiff = Util.EnvironmentTickCountSubtract(tickstart);
|
int tickdiff = Util.EnvironmentTickCountSubtract(tickstart);
|
||||||
if (tickdiff > LongCallTime)
|
if (tickdiff > LongCallTime)
|
||||||
m_log.InfoFormat(
|
m_log.InfoFormat(
|
||||||
"[SERVICE FORM]: Slow request to <{0}> {1} {2} took {3}ms, {4}ms writing, {5}",
|
"[WEB UTIL]: Slow ServiceForm request {0} {1} {2} took {3}ms, {4}ms writing, {5}",
|
||||||
reqnum,
|
reqnum,
|
||||||
method,
|
method,
|
||||||
url,
|
url,
|
||||||
|
@ -390,9 +410,13 @@ namespace OpenSim.Framework
|
||||||
queryString != null
|
queryString != null
|
||||||
? (queryString.Length > MaxRequestDiagLength) ? queryString.Remove(MaxRequestDiagLength) : queryString
|
? (queryString.Length > MaxRequestDiagLength) ? queryString.Remove(MaxRequestDiagLength) : queryString
|
||||||
: "");
|
: "");
|
||||||
|
else if (DebugLevel >= 4)
|
||||||
|
m_log.DebugFormat(
|
||||||
|
"[WEB UTIL]: HTTP OUT {0} took {1}ms, {2}ms writing",
|
||||||
|
reqnum, tickdiff, tickdata);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_log.WarnFormat("[SERVICE FORM]: <{0}> form request to {1} failed: {2}", reqnum, url, errorMessage);
|
m_log.WarnFormat("[WEB UTIL]: ServiceForm request {0} {1} {2} failed: {2}", reqnum, method, url, errorMessage);
|
||||||
|
|
||||||
return ErrorResponseMap(errorMessage);
|
return ErrorResponseMap(errorMessage);
|
||||||
}
|
}
|
||||||
|
@ -644,7 +668,6 @@ namespace OpenSim.Framework
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static string[] GetPreferredImageTypes(string accept)
|
public static string[] GetPreferredImageTypes(string accept)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (accept == null || accept == string.Empty)
|
if (accept == null || accept == string.Empty)
|
||||||
return new string[0];
|
return new string[0];
|
||||||
|
|
||||||
|
@ -703,14 +726,16 @@ namespace OpenSim.Framework
|
||||||
int maxConnections)
|
int maxConnections)
|
||||||
{
|
{
|
||||||
int reqnum = WebUtil.RequestNumber++;
|
int reqnum = WebUtil.RequestNumber++;
|
||||||
// m_log.DebugFormat("[WEB UTIL]: <{0}> start osd request for {1}, method {2}",reqnum,url,method);
|
|
||||||
|
if (WebUtil.DebugLevel >= 3)
|
||||||
|
m_log.DebugFormat(
|
||||||
|
"[WEB UTIL]: HTTP OUT {0} AsynchronousRequestObject {1} {2}",
|
||||||
|
reqnum, verb, requestUrl);
|
||||||
|
|
||||||
int tickstart = Util.EnvironmentTickCount();
|
int tickstart = Util.EnvironmentTickCount();
|
||||||
// int tickdata = 0;
|
// int tickdata = 0;
|
||||||
int tickdiff = 0;
|
int tickdiff = 0;
|
||||||
|
|
||||||
// m_log.DebugFormat("[ASYNC REQUEST]: Starting {0} {1}", verb, requestUrl);
|
|
||||||
|
|
||||||
Type type = typeof(TRequest);
|
Type type = typeof(TRequest);
|
||||||
|
|
||||||
WebRequest request = WebRequest.Create(requestUrl);
|
WebRequest request = WebRequest.Create(requestUrl);
|
||||||
|
@ -868,7 +893,7 @@ namespace OpenSim.Framework
|
||||||
}
|
}
|
||||||
|
|
||||||
m_log.InfoFormat(
|
m_log.InfoFormat(
|
||||||
"[ASYNC REQUEST]: Slow request to <{0}> {1} {2} took {3}ms, {4}ms writing, {5}",
|
"[ASYNC REQUEST]: Slow request {0} {1} {2} took {3}ms, {4}ms writing, {5}",
|
||||||
reqnum,
|
reqnum,
|
||||||
verb,
|
verb,
|
||||||
requestUrl,
|
requestUrl,
|
||||||
|
@ -883,6 +908,12 @@ namespace OpenSim.Framework
|
||||||
requestUrl,
|
requestUrl,
|
||||||
tickdiff);
|
tickdiff);
|
||||||
}
|
}
|
||||||
|
else if (WebUtil.DebugLevel >= 4)
|
||||||
|
{
|
||||||
|
m_log.DebugFormat(
|
||||||
|
"[WEB UTIL]: HTTP OUT {0} took {1}ms",
|
||||||
|
reqnum, tickdiff);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -903,7 +934,11 @@ namespace OpenSim.Framework
|
||||||
public static string MakeRequest(string verb, string requestUrl, string obj)
|
public static string MakeRequest(string verb, string requestUrl, string obj)
|
||||||
{
|
{
|
||||||
int reqnum = WebUtil.RequestNumber++;
|
int reqnum = WebUtil.RequestNumber++;
|
||||||
// m_log.DebugFormat("[WEB UTIL]: <{0}> start osd request for {1}, method {2}",reqnum,url,method);
|
|
||||||
|
if (WebUtil.DebugLevel >= 3)
|
||||||
|
m_log.DebugFormat(
|
||||||
|
"[WEB UTIL]: HTTP OUT {0} SynchronousRestForms {1} {2}",
|
||||||
|
reqnum, verb, requestUrl);
|
||||||
|
|
||||||
int tickstart = Util.EnvironmentTickCount();
|
int tickstart = Util.EnvironmentTickCount();
|
||||||
int tickdata = 0;
|
int tickdata = 0;
|
||||||
|
@ -990,7 +1025,7 @@ namespace OpenSim.Framework
|
||||||
int tickdiff = Util.EnvironmentTickCountSubtract(tickstart);
|
int tickdiff = Util.EnvironmentTickCountSubtract(tickstart);
|
||||||
if (tickdiff > WebUtil.LongCallTime)
|
if (tickdiff > WebUtil.LongCallTime)
|
||||||
m_log.InfoFormat(
|
m_log.InfoFormat(
|
||||||
"[FORMS]: Slow request to <{0}> {1} {2} took {3}ms {4}ms writing {5}",
|
"[FORMS]: Slow request {0} {1} {2} took {3}ms, {4}ms writing, {5}",
|
||||||
reqnum,
|
reqnum,
|
||||||
verb,
|
verb,
|
||||||
requestUrl,
|
requestUrl,
|
||||||
|
@ -998,6 +1033,10 @@ namespace OpenSim.Framework
|
||||||
tickset,
|
tickset,
|
||||||
tickdata,
|
tickdata,
|
||||||
obj.Length > WebUtil.MaxRequestDiagLength ? obj.Remove(WebUtil.MaxRequestDiagLength) : obj);
|
obj.Length > WebUtil.MaxRequestDiagLength ? obj.Remove(WebUtil.MaxRequestDiagLength) : obj);
|
||||||
|
else if (WebUtil.DebugLevel >= 4)
|
||||||
|
m_log.DebugFormat(
|
||||||
|
"[WEB UTIL]: HTTP OUT {0} took {1}ms, {2}ms writing",
|
||||||
|
reqnum, tickdiff, tickdata);
|
||||||
|
|
||||||
return respstring;
|
return respstring;
|
||||||
}
|
}
|
||||||
|
@ -1032,7 +1071,11 @@ namespace OpenSim.Framework
|
||||||
public static TResponse MakeRequest<TRequest, TResponse>(string verb, string requestUrl, TRequest obj, int pTimeout, int maxConnections)
|
public static TResponse MakeRequest<TRequest, TResponse>(string verb, string requestUrl, TRequest obj, int pTimeout, int maxConnections)
|
||||||
{
|
{
|
||||||
int reqnum = WebUtil.RequestNumber++;
|
int reqnum = WebUtil.RequestNumber++;
|
||||||
// m_log.DebugFormat("[WEB UTIL]: <{0}> start osd request for {1}, method {2}",reqnum,url,method);
|
|
||||||
|
if (WebUtil.DebugLevel >= 3)
|
||||||
|
m_log.DebugFormat(
|
||||||
|
"[WEB UTIL]: HTTP OUT {0} SynchronousRestObject {1} {2}",
|
||||||
|
reqnum, verb, requestUrl);
|
||||||
|
|
||||||
int tickstart = Util.EnvironmentTickCount();
|
int tickstart = Util.EnvironmentTickCount();
|
||||||
int tickdata = 0;
|
int tickdata = 0;
|
||||||
|
@ -1151,7 +1194,7 @@ namespace OpenSim.Framework
|
||||||
}
|
}
|
||||||
|
|
||||||
m_log.InfoFormat(
|
m_log.InfoFormat(
|
||||||
"[SynchronousRestObjectRequester]: Slow request to <{0}> {1} {2} took {3}ms, {4}ms writing, {5}",
|
"[SynchronousRestObjectRequester]: Slow request {0} {1} {2} took {3}ms, {4}ms writing, {5}",
|
||||||
reqnum,
|
reqnum,
|
||||||
verb,
|
verb,
|
||||||
requestUrl,
|
requestUrl,
|
||||||
|
@ -1159,6 +1202,12 @@ namespace OpenSim.Framework
|
||||||
tickdata,
|
tickdata,
|
||||||
originalRequest);
|
originalRequest);
|
||||||
}
|
}
|
||||||
|
else if (WebUtil.DebugLevel >= 4)
|
||||||
|
{
|
||||||
|
m_log.DebugFormat(
|
||||||
|
"[WEB UTIL]: HTTP OUT {0} took {1}ms, {2}ms writing",
|
||||||
|
reqnum, tickdiff, tickdata);
|
||||||
|
}
|
||||||
|
|
||||||
return deserial;
|
return deserial;
|
||||||
}
|
}
|
||||||
|
|
|
@ -188,7 +188,6 @@ namespace OpenSim
|
||||||
// Make sure command line options take precedence
|
// Make sure command line options take precedence
|
||||||
m_config.Source.Merge(argvSource);
|
m_config.Source.Merge(argvSource);
|
||||||
|
|
||||||
|
|
||||||
IConfig enVars = m_config.Source.Configs["Environment"];
|
IConfig enVars = m_config.Source.Configs["Environment"];
|
||||||
|
|
||||||
if( enVars != null )
|
if( enVars != null )
|
||||||
|
|
|
@ -35,6 +35,7 @@ using System.Text;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using System.Timers;
|
using System.Timers;
|
||||||
using log4net;
|
using log4net;
|
||||||
|
using NDesk.Options;
|
||||||
using Nini.Config;
|
using Nini.Config;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
|
@ -81,8 +82,8 @@ namespace OpenSim
|
||||||
{
|
{
|
||||||
base.ReadExtraConfigSettings();
|
base.ReadExtraConfigSettings();
|
||||||
|
|
||||||
IConfig startupConfig = m_config.Source.Configs["Startup"];
|
IConfig startupConfig = Config.Configs["Startup"];
|
||||||
IConfig networkConfig = m_config.Source.Configs["Network"];
|
IConfig networkConfig = Config.Configs["Network"];
|
||||||
|
|
||||||
int stpMaxThreads = 15;
|
int stpMaxThreads = 15;
|
||||||
|
|
||||||
|
@ -105,22 +106,6 @@ namespace OpenSim
|
||||||
m_timeInterval = startupConfig.GetInt("timer_Interval", 1200);
|
m_timeInterval = startupConfig.GetInt("timer_Interval", 1200);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_logFileAppender != null)
|
|
||||||
{
|
|
||||||
if (m_logFileAppender is log4net.Appender.FileAppender)
|
|
||||||
{
|
|
||||||
log4net.Appender.FileAppender appender =
|
|
||||||
(log4net.Appender.FileAppender)m_logFileAppender;
|
|
||||||
string fileName = startupConfig.GetString("LogFile", String.Empty);
|
|
||||||
if (fileName != String.Empty)
|
|
||||||
{
|
|
||||||
appender.File = fileName;
|
|
||||||
appender.ActivateOptions();
|
|
||||||
}
|
|
||||||
m_log.InfoFormat("[LOGGING]: Logging started to file {0}", appender.File);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
string asyncCallMethodStr = startupConfig.GetString("async_call_method", String.Empty);
|
string asyncCallMethodStr = startupConfig.GetString("async_call_method", String.Empty);
|
||||||
FireAndForgetMethod asyncCallMethod;
|
FireAndForgetMethod asyncCallMethod;
|
||||||
if (!String.IsNullOrEmpty(asyncCallMethodStr) && Utils.EnumTryParse<FireAndForgetMethod>(asyncCallMethodStr, out asyncCallMethod))
|
if (!String.IsNullOrEmpty(asyncCallMethodStr) && Utils.EnumTryParse<FireAndForgetMethod>(asyncCallMethodStr, out asyncCallMethod))
|
||||||
|
@ -163,7 +148,7 @@ namespace OpenSim
|
||||||
break;
|
break;
|
||||||
case "rest":
|
case "rest":
|
||||||
m_console = new RemoteConsole("Region");
|
m_console = new RemoteConsole("Region");
|
||||||
((RemoteConsole)m_console).ReadConfig(m_config.Source);
|
((RemoteConsole)m_console).ReadConfig(Config);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
m_console = new LocalConsole("Region");
|
m_console = new LocalConsole("Region");
|
||||||
|
@ -173,6 +158,7 @@ namespace OpenSim
|
||||||
|
|
||||||
MainConsole.Instance = m_console;
|
MainConsole.Instance = m_console;
|
||||||
|
|
||||||
|
RegisterCommonAppenders(Config.Configs["Startup"]);
|
||||||
RegisterConsoleCommands();
|
RegisterConsoleCommands();
|
||||||
|
|
||||||
base.StartupSpecific();
|
base.StartupSpecific();
|
||||||
|
@ -253,8 +239,14 @@ namespace OpenSim
|
||||||
m_console.Commands.AddCommand("Debug", false, "debug teleport", "debug teleport", "Toggle teleport route debugging", Debug);
|
m_console.Commands.AddCommand("Debug", false, "debug teleport", "debug teleport", "Toggle teleport route debugging", Debug);
|
||||||
|
|
||||||
m_console.Commands.AddCommand("Debug", false, "debug scene",
|
m_console.Commands.AddCommand("Debug", false, "debug scene",
|
||||||
"debug scene <scripting> <collisions> <physics>",
|
"debug scene active|collisions|physics|scripting|teleport true|false",
|
||||||
"Turn on scene debugging", Debug);
|
"Turn on scene debugging.",
|
||||||
|
"If active is false then main scene update and maintenance loops are suspended.\n"
|
||||||
|
+ "If collisions is false then collisions with other objects are turned off.\n"
|
||||||
|
+ "If physics is false then all physics objects are non-physical.\n"
|
||||||
|
+ "If scripting is false then no scripting operations happen.\n"
|
||||||
|
+ "If teleport is true then some extra teleport debug information is logged.",
|
||||||
|
Debug);
|
||||||
|
|
||||||
m_console.Commands.AddCommand("General", false, "change region",
|
m_console.Commands.AddCommand("General", false, "change region",
|
||||||
"change region <region name>",
|
"change region <region name>",
|
||||||
|
@ -291,7 +283,7 @@ namespace OpenSim
|
||||||
|
|
||||||
m_console.Commands.AddCommand("Archiving", false, "save oar",
|
m_console.Commands.AddCommand("Archiving", false, "save oar",
|
||||||
//"save oar [-v|--version=<N>] [-p|--profile=<url>] [<OAR path>]",
|
//"save oar [-v|--version=<N>] [-p|--profile=<url>] [<OAR path>]",
|
||||||
"save oar [-h|--home=<url>] [--noassets] [--publish] [--perm=<permissions>] [<OAR path>]",
|
"save oar [-h|--home=<url>] [--noassets] [--publish] [--perm=<permissions>] [--all] [<OAR path>]",
|
||||||
"Save a region's data to an OAR archive.",
|
"Save a region's data to an OAR archive.",
|
||||||
// "-v|--version=<N> generates scene objects as per older versions of the serialization (e.g. -v=0)" + Environment.NewLine
|
// "-v|--version=<N> generates scene objects as per older versions of the serialization (e.g. -v=0)" + Environment.NewLine
|
||||||
"-h|--home=<url> adds the url of the profile service to the saved user information.\n"
|
"-h|--home=<url> adds the url of the profile service to the saved user information.\n"
|
||||||
|
@ -301,6 +293,7 @@ namespace OpenSim
|
||||||
+ " this is useful if you're making oars generally available that might be reloaded to the same grid from which you published\n"
|
+ " this is useful if you're making oars generally available that might be reloaded to the same grid from which you published\n"
|
||||||
+ "--perm=<permissions> stops objects with insufficient permissions from being saved to the OAR.\n"
|
+ "--perm=<permissions> stops objects with insufficient permissions from being saved to the OAR.\n"
|
||||||
+ " <permissions> can contain one or more of these characters: \"C\" = Copy, \"T\" = Transfer\n"
|
+ " <permissions> can contain one or more of these characters: \"C\" = Copy, \"T\" = Transfer\n"
|
||||||
|
+ "--all saves all the regions in the simulator, instead of just the current region.\n"
|
||||||
+ "The OAR path must be a filesystem path."
|
+ "The OAR path must be a filesystem path."
|
||||||
+ " If this is not given then the oar is saved to region.oar in the current directory.",
|
+ " If this is not given then the oar is saved to region.oar in the current directory.",
|
||||||
SaveOar);
|
SaveOar);
|
||||||
|
@ -310,8 +303,11 @@ namespace OpenSim
|
||||||
"Change the scale of a named prim", HandleEditScale);
|
"Change the scale of a named prim", HandleEditScale);
|
||||||
|
|
||||||
m_console.Commands.AddCommand("Users", false, "kick user",
|
m_console.Commands.AddCommand("Users", false, "kick user",
|
||||||
"kick user <first> <last> [message]",
|
"kick user <first> <last> [--force] [message]",
|
||||||
"Kick a user off the simulator", KickUserCommand);
|
"Kick a user off the simulator",
|
||||||
|
"The --force option will kick the user without any checks to see whether it's already in the process of closing\n"
|
||||||
|
+ "Only use this option if you are sure the avatar is inactive and a normal kick user operation does not removed them",
|
||||||
|
KickUserCommand);
|
||||||
|
|
||||||
m_console.Commands.AddCommand("Users", false, "show users",
|
m_console.Commands.AddCommand("Users", false, "show users",
|
||||||
"show users [full]",
|
"show users [full]",
|
||||||
|
@ -328,10 +324,6 @@ namespace OpenSim
|
||||||
"show circuits",
|
"show circuits",
|
||||||
"Show agent circuit data", HandleShow);
|
"Show agent circuit data", HandleShow);
|
||||||
|
|
||||||
m_console.Commands.AddCommand("Comms", false, "show http-handlers",
|
|
||||||
"show http-handlers",
|
|
||||||
"Show all registered http handlers", HandleShow);
|
|
||||||
|
|
||||||
m_console.Commands.AddCommand("Comms", false, "show pending-objects",
|
m_console.Commands.AddCommand("Comms", false, "show pending-objects",
|
||||||
"show pending-objects",
|
"show pending-objects",
|
||||||
"Show # of objects on the pending queues of all scene viewers", HandleShow);
|
"Show # of objects on the pending queues of all scene viewers", HandleShow);
|
||||||
|
@ -365,26 +357,6 @@ namespace OpenSim
|
||||||
"restart",
|
"restart",
|
||||||
"Restart all sims in this instance", RunCommand);
|
"Restart all sims in this instance", RunCommand);
|
||||||
|
|
||||||
m_console.Commands.AddCommand("General", false, "config set",
|
|
||||||
"config set <section> <key> <value>",
|
|
||||||
"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);
|
|
||||||
|
|
||||||
m_console.Commands.AddCommand("General", false, "config get",
|
|
||||||
"config get [<section>] [<key>]",
|
|
||||||
"Synonym for config show",
|
|
||||||
HandleConfig);
|
|
||||||
|
|
||||||
m_console.Commands.AddCommand("General", false, "config show",
|
|
||||||
"config show [<section>] [<key>]",
|
|
||||||
"Show config information",
|
|
||||||
"If neither section nor field are specified, then the whole current configuration is printed." + Environment.NewLine
|
|
||||||
+ "If a section is given but not a field, then all fields in that section are printed.",
|
|
||||||
HandleConfig);
|
|
||||||
|
|
||||||
m_console.Commands.AddCommand("General", false, "config save",
|
|
||||||
"config save <path>",
|
|
||||||
"Save current configuration to a file at the given path", HandleConfig);
|
|
||||||
|
|
||||||
m_console.Commands.AddCommand("General", false, "command-script",
|
m_console.Commands.AddCommand("General", false, "command-script",
|
||||||
"command-script <script>",
|
"command-script <script>",
|
||||||
"Run a command script from file", RunCommand);
|
"Run a command script from file", RunCommand);
|
||||||
|
@ -416,6 +388,7 @@ namespace OpenSim
|
||||||
{
|
{
|
||||||
RunCommandScript(m_shutdownCommandsFile);
|
RunCommandScript(m_shutdownCommandsFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
base.ShutdownSpecific();
|
base.ShutdownSpecific();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -453,11 +426,17 @@ namespace OpenSim
|
||||||
/// <param name="cmdparams">name of avatar to kick</param>
|
/// <param name="cmdparams">name of avatar to kick</param>
|
||||||
private void KickUserCommand(string module, string[] cmdparams)
|
private void KickUserCommand(string module, string[] cmdparams)
|
||||||
{
|
{
|
||||||
if (cmdparams.Length < 4)
|
bool force = false;
|
||||||
|
|
||||||
|
OptionSet options = new OptionSet().Add("f|force", delegate (string v) { force = v != null; });
|
||||||
|
|
||||||
|
List<string> mainParams = options.Parse(cmdparams);
|
||||||
|
|
||||||
|
if (mainParams.Count < 4)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
string alert = null;
|
string alert = null;
|
||||||
if (cmdparams.Length > 4)
|
if (mainParams.Count > 4)
|
||||||
alert = String.Format("\n{0}\n", String.Join(" ", cmdparams, 4, cmdparams.Length - 4));
|
alert = String.Format("\n{0}\n", String.Join(" ", cmdparams, 4, cmdparams.Length - 4));
|
||||||
|
|
||||||
IList agents = SceneManager.GetCurrentSceneAvatars();
|
IList agents = SceneManager.GetCurrentSceneAvatars();
|
||||||
|
@ -466,8 +445,8 @@ namespace OpenSim
|
||||||
{
|
{
|
||||||
RegionInfo regionInfo = presence.Scene.RegionInfo;
|
RegionInfo regionInfo = presence.Scene.RegionInfo;
|
||||||
|
|
||||||
if (presence.Firstname.ToLower().Contains(cmdparams[2].ToLower()) &&
|
if (presence.Firstname.ToLower().Contains(mainParams[2].ToLower()) &&
|
||||||
presence.Lastname.ToLower().Contains(cmdparams[3].ToLower()))
|
presence.Lastname.ToLower().Contains(mainParams[3].ToLower()))
|
||||||
{
|
{
|
||||||
MainConsole.Instance.Output(
|
MainConsole.Instance.Output(
|
||||||
String.Format(
|
String.Format(
|
||||||
|
@ -480,42 +459,13 @@ namespace OpenSim
|
||||||
else
|
else
|
||||||
presence.ControllingClient.Kick("\nYou have been logged out by an administrator.\n");
|
presence.ControllingClient.Kick("\nYou have been logged out by an administrator.\n");
|
||||||
|
|
||||||
presence.Scene.IncomingCloseAgent(presence.UUID);
|
presence.Scene.IncomingCloseAgent(presence.UUID, force);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MainConsole.Instance.Output("");
|
MainConsole.Instance.Output("");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Run an optional startup list of commands
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="fileName"></param>
|
|
||||||
private void RunCommandScript(string fileName)
|
|
||||||
{
|
|
||||||
if (File.Exists(fileName))
|
|
||||||
{
|
|
||||||
m_log.Info("[COMMANDFILE]: Running " + fileName);
|
|
||||||
|
|
||||||
using (StreamReader readFile = File.OpenText(fileName))
|
|
||||||
{
|
|
||||||
string currentCommand;
|
|
||||||
while ((currentCommand = readFile.ReadLine()) != null)
|
|
||||||
{
|
|
||||||
currentCommand = currentCommand.Trim();
|
|
||||||
if (!(currentCommand == ""
|
|
||||||
|| currentCommand.StartsWith(";")
|
|
||||||
|| currentCommand.StartsWith("//")
|
|
||||||
|| currentCommand.StartsWith("#")))
|
|
||||||
{
|
|
||||||
m_log.Info("[COMMANDFILE]: Running '" + currentCommand + "'");
|
|
||||||
m_console.RunCommand(currentCommand);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Opens a file and uses it as input to the console command parser.
|
/// Opens a file and uses it as input to the console command parser.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -620,111 +570,9 @@ namespace OpenSim
|
||||||
bool changed = PopulateRegionEstateInfo(regInfo);
|
bool changed = PopulateRegionEstateInfo(regInfo);
|
||||||
IScene scene;
|
IScene scene;
|
||||||
CreateRegion(regInfo, true, out scene);
|
CreateRegion(regInfo, true, out scene);
|
||||||
|
|
||||||
if (changed)
|
if (changed)
|
||||||
regInfo.EstateSettings.Save();
|
regInfo.EstateSettings.Save();
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Change and load configuration file data.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="module"></param>
|
|
||||||
/// <param name="cmd"></param>
|
|
||||||
private void HandleConfig(string module, string[] cmd)
|
|
||||||
{
|
|
||||||
List<string> args = new List<string>(cmd);
|
|
||||||
args.RemoveAt(0);
|
|
||||||
string[] cmdparams = args.ToArray();
|
|
||||||
|
|
||||||
if (cmdparams.Length > 0)
|
|
||||||
{
|
|
||||||
string firstParam = cmdparams[0].ToLower();
|
|
||||||
|
|
||||||
switch (firstParam)
|
|
||||||
{
|
|
||||||
case "set":
|
|
||||||
if (cmdparams.Length < 4)
|
|
||||||
{
|
|
||||||
Notice("Syntax: config set <section> <key> <value>");
|
|
||||||
Notice("Example: config set ScriptEngine.DotNetEngine NumberOfScriptThreads 5");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
IConfig c;
|
|
||||||
IConfigSource source = new IniConfigSource();
|
|
||||||
c = source.AddConfig(cmdparams[1]);
|
|
||||||
if (c != null)
|
|
||||||
{
|
|
||||||
string _value = String.Join(" ", cmdparams, 3, cmdparams.Length - 3);
|
|
||||||
c.Set(cmdparams[2], _value);
|
|
||||||
m_config.Source.Merge(source);
|
|
||||||
|
|
||||||
Notice("In section [{0}], set {1} = {2}", c.Name, cmdparams[2], _value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case "get":
|
|
||||||
case "show":
|
|
||||||
if (cmdparams.Length == 1)
|
|
||||||
{
|
|
||||||
foreach (IConfig config in m_config.Source.Configs)
|
|
||||||
{
|
|
||||||
Notice("[{0}]", config.Name);
|
|
||||||
string[] keys = config.GetKeys();
|
|
||||||
foreach (string key in keys)
|
|
||||||
Notice(" {0} = {1}", key, config.GetString(key));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (cmdparams.Length == 2 || cmdparams.Length == 3)
|
|
||||||
{
|
|
||||||
IConfig config = m_config.Source.Configs[cmdparams[1]];
|
|
||||||
if (config == null)
|
|
||||||
{
|
|
||||||
Notice("Section \"{0}\" does not exist.",cmdparams[1]);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (cmdparams.Length == 2)
|
|
||||||
{
|
|
||||||
Notice("[{0}]", config.Name);
|
|
||||||
foreach (string key in config.GetKeys())
|
|
||||||
Notice(" {0} = {1}", key, config.GetString(key));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Notice(
|
|
||||||
"config get {0} {1} : {2}",
|
|
||||||
cmdparams[1], cmdparams[2], config.GetString(cmdparams[2]));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Notice("Syntax: config {0} [<section>] [<key>]", firstParam);
|
|
||||||
Notice("Example: config {0} ScriptEngine.DotNetEngine NumberOfScriptThreads", firstParam);
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
case "save":
|
|
||||||
if (cmdparams.Length < 2)
|
|
||||||
{
|
|
||||||
Notice("Syntax: config save <path>");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Application.iniFilePath == cmdparams[1])
|
|
||||||
{
|
|
||||||
Notice("Path can not be " + Application.iniFilePath);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Notice("Saving configuration file: " + cmdparams[1]);
|
|
||||||
m_config.Save(cmdparams[1]);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -743,33 +591,13 @@ namespace OpenSim
|
||||||
switch (cmdparams[0].ToLower())
|
switch (cmdparams[0].ToLower())
|
||||||
{
|
{
|
||||||
case "list":
|
case "list":
|
||||||
foreach (IRegionModule irm in m_moduleLoader.GetLoadedSharedModules)
|
//TODO: Convert to new region modules
|
||||||
{
|
|
||||||
MainConsole.Instance.Output(String.Format("Shared region module: {0}", irm.Name));
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case "unload":
|
case "unload":
|
||||||
if (cmdparams.Length > 1)
|
//TODO: Convert to new region modules
|
||||||
{
|
|
||||||
foreach (IRegionModule rm in new ArrayList(m_moduleLoader.GetLoadedSharedModules))
|
|
||||||
{
|
|
||||||
if (rm.Name.ToLower() == cmdparams[1].ToLower())
|
|
||||||
{
|
|
||||||
MainConsole.Instance.Output(String.Format("Unloading module: {0}", rm.Name));
|
|
||||||
m_moduleLoader.UnloadModule(rm);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case "load":
|
case "load":
|
||||||
if (cmdparams.Length > 1)
|
//TODO: Convert to new region modules
|
||||||
{
|
|
||||||
foreach (Scene s in new ArrayList(SceneManager.Scenes))
|
|
||||||
{
|
|
||||||
MainConsole.Instance.Output(String.Format("Loading module: {0}", cmdparams[1]));
|
|
||||||
m_moduleLoader.LoadRegionModules(cmdparams[1], s);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -793,13 +621,6 @@ namespace OpenSim
|
||||||
|
|
||||||
switch (command)
|
switch (command)
|
||||||
{
|
{
|
||||||
case "command-script":
|
|
||||||
if (cmdparams.Length > 0)
|
|
||||||
{
|
|
||||||
RunCommandScript(cmdparams[0]);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case "backup":
|
case "backup":
|
||||||
MainConsole.Instance.Output("Triggering save of pending object updates to persistent store");
|
MainConsole.Instance.Output("Triggering save of pending object updates to persistent store");
|
||||||
SceneManager.BackupCurrentScene();
|
SceneManager.BackupCurrentScene();
|
||||||
|
@ -843,12 +664,20 @@ namespace OpenSim
|
||||||
|
|
||||||
if (!SceneManager.TrySetCurrentScene(newRegionName))
|
if (!SceneManager.TrySetCurrentScene(newRegionName))
|
||||||
MainConsole.Instance.Output(String.Format("Couldn't select region {0}", newRegionName));
|
MainConsole.Instance.Output(String.Format("Couldn't select region {0}", newRegionName));
|
||||||
|
else
|
||||||
|
RefreshPrompt();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
MainConsole.Instance.Output("Usage: change region <region name>");
|
MainConsole.Instance.Output("Usage: change region <region name>");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Refreshs prompt with the current selection details.
|
||||||
|
/// </summary>
|
||||||
|
private void RefreshPrompt()
|
||||||
|
{
|
||||||
string regionName = (SceneManager.CurrentScene == null ? "root" : SceneManager.CurrentScene.RegionInfo.RegionName);
|
string regionName = (SceneManager.CurrentScene == null ? "root" : SceneManager.CurrentScene.RegionInfo.RegionName);
|
||||||
MainConsole.Instance.Output(String.Format("Currently selected region is {0}", regionName));
|
MainConsole.Instance.Output(String.Format("Currently selected region is {0}", regionName));
|
||||||
|
|
||||||
|
@ -870,6 +699,18 @@ namespace OpenSim
|
||||||
m_console.ConsoleScene = SceneManager.CurrentScene;
|
m_console.ConsoleScene = SceneManager.CurrentScene;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void HandleRestartRegion(RegionInfo whichRegion)
|
||||||
|
{
|
||||||
|
base.HandleRestartRegion(whichRegion);
|
||||||
|
|
||||||
|
// Where we are restarting multiple scenes at once, a previous call to RefreshPrompt may have set the
|
||||||
|
// m_console.ConsoleScene to null (indicating all scenes).
|
||||||
|
if (m_console.ConsoleScene != null && whichRegion.RegionName == ((Scene)m_console.ConsoleScene).Name)
|
||||||
|
SceneManager.TrySetCurrentScene(whichRegion.RegionName);
|
||||||
|
|
||||||
|
RefreshPrompt();
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Turn on some debugging values for OpenSim.
|
/// Turn on some debugging values for OpenSim.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -922,7 +763,8 @@ namespace OpenSim
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
MainConsole.Instance.Output("Usage: debug scene scripting|collisions|physics|teleport true|false");
|
MainConsole.Instance.Output(
|
||||||
|
"Usage: debug scene active|scripting|collisions|physics|teleport true|false");
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
@ -1002,56 +844,10 @@ namespace OpenSim
|
||||||
HandleShowCircuits();
|
HandleShowCircuits();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "http-handlers":
|
|
||||||
System.Text.StringBuilder handlers = new System.Text.StringBuilder("Registered HTTP Handlers:\n");
|
|
||||||
|
|
||||||
handlers.AppendFormat("* XMLRPC:\n");
|
|
||||||
foreach (String s in HttpServer.GetXmlRpcHandlerKeys())
|
|
||||||
handlers.AppendFormat("\t{0}\n", s);
|
|
||||||
|
|
||||||
handlers.AppendFormat("* HTTP:\n");
|
|
||||||
List<String> poll = HttpServer.GetPollServiceHandlerKeys();
|
|
||||||
foreach (String s in HttpServer.GetHTTPHandlerKeys())
|
|
||||||
handlers.AppendFormat("\t{0} {1}\n", s, (poll.Contains(s) ? "(poll service)" : string.Empty));
|
|
||||||
|
|
||||||
handlers.AppendFormat("* Agent:\n");
|
|
||||||
foreach (String s in HttpServer.GetAgentHandlerKeys())
|
|
||||||
handlers.AppendFormat("\t{0}\n", s);
|
|
||||||
|
|
||||||
handlers.AppendFormat("* LLSD:\n");
|
|
||||||
foreach (String s in HttpServer.GetLLSDHandlerKeys())
|
|
||||||
handlers.AppendFormat("\t{0}\n", s);
|
|
||||||
|
|
||||||
handlers.AppendFormat("* StreamHandlers ({0}):\n", HttpServer.GetStreamHandlerKeys().Count);
|
|
||||||
foreach (String s in HttpServer.GetStreamHandlerKeys())
|
|
||||||
handlers.AppendFormat("\t{0}\n", s);
|
|
||||||
|
|
||||||
MainConsole.Instance.Output(handlers.ToString());
|
|
||||||
break;
|
|
||||||
|
|
||||||
case "modules":
|
case "modules":
|
||||||
MainConsole.Instance.Output("The currently loaded shared modules are:");
|
|
||||||
foreach (IRegionModule module in m_moduleLoader.GetLoadedSharedModules)
|
|
||||||
{
|
|
||||||
MainConsole.Instance.Output("Shared Module: " + module.Name);
|
|
||||||
}
|
|
||||||
|
|
||||||
SceneManager.ForEachScene(
|
SceneManager.ForEachScene(
|
||||||
delegate(Scene scene) {
|
delegate(Scene scene) {
|
||||||
m_log.Error("The currently loaded modules in " + scene.RegionInfo.RegionName + " are:");
|
MainConsole.Instance.Output("Loaded region modules in" + scene.RegionInfo.RegionName + " are:");
|
||||||
foreach (IRegionModule module in scene.Modules.Values)
|
|
||||||
{
|
|
||||||
if (!module.IsSharedModule)
|
|
||||||
{
|
|
||||||
m_log.Error("Region Module: " + module.Name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
SceneManager.ForEachScene(
|
|
||||||
delegate(Scene scene) {
|
|
||||||
MainConsole.Instance.Output("Loaded new region modules in" + scene.RegionInfo.RegionName + " are:");
|
|
||||||
foreach (IRegionModuleBase module in scene.RegionModules.Values)
|
foreach (IRegionModuleBase module in scene.RegionModules.Values)
|
||||||
{
|
{
|
||||||
Type type = module.GetType().GetInterface("ISharedRegionModule");
|
Type type = module.GetType().GetInterface("ISharedRegionModule");
|
||||||
|
@ -1123,7 +919,7 @@ namespace OpenSim
|
||||||
aCircuit.Name,
|
aCircuit.Name,
|
||||||
aCircuit.child ? "child" : "root",
|
aCircuit.child ? "child" : "root",
|
||||||
aCircuit.circuitcode.ToString(),
|
aCircuit.circuitcode.ToString(),
|
||||||
aCircuit.IPAddress.ToString(),
|
aCircuit.IPAddress != null ? aCircuit.IPAddress.ToString() : "not set",
|
||||||
aCircuit.Viewer);
|
aCircuit.Viewer);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -104,13 +104,7 @@ namespace OpenSim
|
||||||
/// <value>
|
/// <value>
|
||||||
/// The config information passed into the OpenSimulator region server.
|
/// The config information passed into the OpenSimulator region server.
|
||||||
/// </value>
|
/// </value>
|
||||||
public OpenSimConfigSource ConfigSource
|
public OpenSimConfigSource ConfigSource { get; private set; }
|
||||||
{
|
|
||||||
get { return m_config; }
|
|
||||||
set { m_config = value; }
|
|
||||||
}
|
|
||||||
|
|
||||||
protected OpenSimConfigSource m_config;
|
|
||||||
|
|
||||||
public List<IClientNetworkServer> ClientServers
|
public List<IClientNetworkServer> ClientServers
|
||||||
{
|
{
|
||||||
|
@ -131,14 +125,6 @@ namespace OpenSim
|
||||||
get { return m_httpServerPort; }
|
get { return m_httpServerPort; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public ModuleLoader ModuleLoader
|
|
||||||
{
|
|
||||||
get { return m_moduleLoader; }
|
|
||||||
set { m_moduleLoader = value; }
|
|
||||||
}
|
|
||||||
|
|
||||||
protected ModuleLoader m_moduleLoader;
|
|
||||||
|
|
||||||
protected IRegistryCore m_applicationRegistry = new RegistryCore();
|
protected IRegistryCore m_applicationRegistry = new RegistryCore();
|
||||||
|
|
||||||
public IRegistryCore ApplicationRegistry
|
public IRegistryCore ApplicationRegistry
|
||||||
|
@ -158,13 +144,14 @@ namespace OpenSim
|
||||||
protected virtual void LoadConfigSettings(IConfigSource configSource)
|
protected virtual void LoadConfigSettings(IConfigSource configSource)
|
||||||
{
|
{
|
||||||
m_configLoader = new ConfigurationLoader();
|
m_configLoader = new ConfigurationLoader();
|
||||||
m_config = m_configLoader.LoadConfigSettings(configSource, envConfigSource, out m_configSettings, out m_networkServersInfo);
|
ConfigSource = m_configLoader.LoadConfigSettings(configSource, envConfigSource, out m_configSettings, out m_networkServersInfo);
|
||||||
|
Config = ConfigSource.Source;
|
||||||
ReadExtraConfigSettings();
|
ReadExtraConfigSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual void ReadExtraConfigSettings()
|
protected virtual void ReadExtraConfigSettings()
|
||||||
{
|
{
|
||||||
IConfig networkConfig = m_config.Source.Configs["Network"];
|
IConfig networkConfig = Config.Configs["Network"];
|
||||||
if (networkConfig != null)
|
if (networkConfig != null)
|
||||||
{
|
{
|
||||||
proxyUrl = networkConfig.GetString("proxy_url", "");
|
proxyUrl = networkConfig.GetString("proxy_url", "");
|
||||||
|
@ -197,7 +184,7 @@ namespace OpenSim
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected override void StartupSpecific()
|
protected override void StartupSpecific()
|
||||||
{
|
{
|
||||||
IConfig startupConfig = m_config.Source.Configs["Startup"];
|
IConfig startupConfig = Config.Configs["Startup"];
|
||||||
if (startupConfig != null)
|
if (startupConfig != null)
|
||||||
{
|
{
|
||||||
string pidFile = startupConfig.GetString("PIDFile", String.Empty);
|
string pidFile = startupConfig.GetString("PIDFile", String.Empty);
|
||||||
|
@ -213,30 +200,39 @@ namespace OpenSim
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load the simulation data service
|
// Load the simulation data service
|
||||||
IConfig simDataConfig = m_config.Source.Configs["SimulationDataStore"];
|
IConfig simDataConfig = Config.Configs["SimulationDataStore"];
|
||||||
if (simDataConfig == null)
|
if (simDataConfig == null)
|
||||||
throw new Exception("Configuration file is missing the [SimulationDataStore] section. Have you copied OpenSim.ini.example to OpenSim.ini to reference config-include/ files?");
|
throw new Exception("Configuration file is missing the [SimulationDataStore] section. Have you copied OpenSim.ini.example to OpenSim.ini to reference config-include/ files?");
|
||||||
|
|
||||||
string module = simDataConfig.GetString("LocalServiceModule", String.Empty);
|
string module = simDataConfig.GetString("LocalServiceModule", String.Empty);
|
||||||
if (String.IsNullOrEmpty(module))
|
if (String.IsNullOrEmpty(module))
|
||||||
throw new Exception("Configuration file is missing the LocalServiceModule parameter in the [SimulationDataStore] section.");
|
throw new Exception("Configuration file is missing the LocalServiceModule parameter in the [SimulationDataStore] section.");
|
||||||
m_simulationDataService = ServerUtils.LoadPlugin<ISimulationDataService>(module, new object[] { m_config.Source });
|
|
||||||
|
m_simulationDataService = ServerUtils.LoadPlugin<ISimulationDataService>(module, new object[] { Config });
|
||||||
|
if (m_simulationDataService == null)
|
||||||
|
throw new Exception(
|
||||||
|
string.Format(
|
||||||
|
"Could not load an ISimulationDataService implementation from {0}, as configured in the LocalServiceModule parameter of the [SimulationDataStore] config section.",
|
||||||
|
module));
|
||||||
|
|
||||||
// Load the estate data service
|
// Load the estate data service
|
||||||
IConfig estateDataConfig = m_config.Source.Configs["EstateDataStore"];
|
IConfig estateDataConfig = Config.Configs["EstateDataStore"];
|
||||||
if (estateDataConfig == null)
|
if (estateDataConfig == null)
|
||||||
throw new Exception("Configuration file is missing the [EstateDataStore] section. Have you copied OpenSim.ini.example to OpenSim.ini to reference config-include/ files?");
|
throw new Exception("Configuration file is missing the [EstateDataStore] section. Have you copied OpenSim.ini.example to OpenSim.ini to reference config-include/ files?");
|
||||||
|
|
||||||
module = estateDataConfig.GetString("LocalServiceModule", String.Empty);
|
module = estateDataConfig.GetString("LocalServiceModule", String.Empty);
|
||||||
if (String.IsNullOrEmpty(module))
|
if (String.IsNullOrEmpty(module))
|
||||||
throw new Exception("Configuration file is missing the LocalServiceModule parameter in the [EstateDataStore] section");
|
throw new Exception("Configuration file is missing the LocalServiceModule parameter in the [EstateDataStore] section");
|
||||||
m_estateDataService = ServerUtils.LoadPlugin<IEstateDataService>(module, new object[] { m_config.Source });
|
|
||||||
|
m_estateDataService = ServerUtils.LoadPlugin<IEstateDataService>(module, new object[] { Config });
|
||||||
|
if (m_estateDataService == null)
|
||||||
|
throw new Exception(
|
||||||
|
string.Format(
|
||||||
|
"Could not load an IEstateDataService implementation from {0}, as configured in the LocalServiceModule parameter of the [EstateDataStore] config section.",
|
||||||
|
module));
|
||||||
|
|
||||||
base.StartupSpecific();
|
base.StartupSpecific();
|
||||||
|
|
||||||
m_stats = StatsManager.SimExtraStats;
|
|
||||||
|
|
||||||
// Create a ModuleLoader instance
|
|
||||||
m_moduleLoader = new ModuleLoader(m_config.Source);
|
|
||||||
|
|
||||||
LoadPlugins();
|
LoadPlugins();
|
||||||
|
|
||||||
if (m_plugins.Count == 0) // We failed to load any modules. Mono Addins glitch!
|
if (m_plugins.Count == 0) // We failed to load any modules. Mono Addins glitch!
|
||||||
|
@ -249,51 +245,51 @@ namespace OpenSim
|
||||||
plugin.PostInitialise();
|
plugin.PostInitialise();
|
||||||
}
|
}
|
||||||
|
|
||||||
AddPluginCommands();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected virtual void AddPluginCommands()
|
|
||||||
{
|
|
||||||
// If console exists add plugin commands.
|
|
||||||
if (m_console != null)
|
if (m_console != null)
|
||||||
{
|
{
|
||||||
List<string> topics = GetHelpTopics();
|
StatsManager.RegisterConsoleCommands(m_console);
|
||||||
|
AddPluginCommands(m_console);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
foreach (string topic in topics)
|
protected virtual void AddPluginCommands(ICommandConsole console)
|
||||||
|
{
|
||||||
|
List<string> topics = GetHelpTopics();
|
||||||
|
|
||||||
|
foreach (string topic in topics)
|
||||||
|
{
|
||||||
|
string capitalizedTopic = char.ToUpper(topic[0]) + topic.Substring(1);
|
||||||
|
|
||||||
|
// This is a hack to allow the user to enter the help command in upper or lowercase. This will go
|
||||||
|
// away at some point.
|
||||||
|
console.Commands.AddCommand(capitalizedTopic, false, "help " + topic,
|
||||||
|
"help " + capitalizedTopic,
|
||||||
|
"Get help on plugin command '" + topic + "'",
|
||||||
|
HandleCommanderHelp);
|
||||||
|
// console.Commands.AddCommand(capitalizedTopic, false, "help " + capitalizedTopic,
|
||||||
|
// "help " + capitalizedTopic,
|
||||||
|
// "Get help on plugin command '" + topic + "'",
|
||||||
|
// HandleCommanderHelp);
|
||||||
|
|
||||||
|
ICommander commander = null;
|
||||||
|
|
||||||
|
Scene s = SceneManager.CurrentOrFirstScene;
|
||||||
|
|
||||||
|
if (s != null && s.GetCommanders() != null)
|
||||||
{
|
{
|
||||||
string capitalizedTopic = char.ToUpper(topic[0]) + topic.Substring(1);
|
if (s.GetCommanders().ContainsKey(topic))
|
||||||
|
commander = s.GetCommanders()[topic];
|
||||||
|
}
|
||||||
|
|
||||||
// This is a hack to allow the user to enter the help command in upper or lowercase. This will go
|
if (commander == null)
|
||||||
// away at some point.
|
continue;
|
||||||
m_console.Commands.AddCommand(capitalizedTopic, false, "help " + topic,
|
|
||||||
"help " + capitalizedTopic,
|
|
||||||
"Get help on plugin command '" + topic + "'",
|
|
||||||
HandleCommanderHelp);
|
|
||||||
m_console.Commands.AddCommand(capitalizedTopic, false, "help " + capitalizedTopic,
|
|
||||||
"help " + capitalizedTopic,
|
|
||||||
"Get help on plugin command '" + topic + "'",
|
|
||||||
HandleCommanderHelp);
|
|
||||||
|
|
||||||
ICommander commander = null;
|
foreach (string command in commander.Commands.Keys)
|
||||||
|
{
|
||||||
Scene s = SceneManager.CurrentOrFirstScene;
|
console.Commands.AddCommand(capitalizedTopic, false,
|
||||||
|
topic + " " + command,
|
||||||
if (s != null && s.GetCommanders() != null)
|
topic + " " + commander.Commands[command].ShortHelp(),
|
||||||
{
|
String.Empty, HandleCommanderCommand);
|
||||||
if (s.GetCommanders().ContainsKey(topic))
|
|
||||||
commander = s.GetCommanders()[topic];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (commander == null)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
foreach (string command in commander.Commands.Keys)
|
|
||||||
{
|
|
||||||
m_console.Commands.AddCommand(capitalizedTopic, false,
|
|
||||||
topic + " " + command,
|
|
||||||
topic + " " + commander.Commands[command].ShortHelp(),
|
|
||||||
String.Empty, HandleCommanderCommand);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -318,7 +314,7 @@ namespace OpenSim
|
||||||
// Called from base.StartUp()
|
// Called from base.StartUp()
|
||||||
|
|
||||||
m_httpServerPort = m_networkServersInfo.HttpListenerPort;
|
m_httpServerPort = m_networkServersInfo.HttpListenerPort;
|
||||||
SceneManager.OnRestartSim += handleRestartRegion;
|
SceneManager.OnRestartSim += HandleRestartRegion;
|
||||||
|
|
||||||
// Only enable the watchdogs when all regions are ready. Otherwise we get false positives when cpu is
|
// Only enable the watchdogs when all regions are ready. Otherwise we get false positives when cpu is
|
||||||
// heavily used during initial startup.
|
// heavily used during initial startup.
|
||||||
|
@ -383,16 +379,10 @@ namespace OpenSim
|
||||||
}
|
}
|
||||||
|
|
||||||
IClientNetworkServer clientServer;
|
IClientNetworkServer clientServer;
|
||||||
Scene scene = SetupScene(regionInfo, proxyOffset, m_config.Source, out clientServer);
|
Scene scene = SetupScene(regionInfo, proxyOffset, Config, out clientServer);
|
||||||
|
|
||||||
m_log.Info("[MODULES]: Loading Region's modules (old style)");
|
m_log.Info("[MODULES]: Loading Region's modules (old style)");
|
||||||
|
|
||||||
List<IRegionModule> modules = m_moduleLoader.PickupModules(scene, ".");
|
|
||||||
|
|
||||||
// This needs to be ahead of the script engine load, so the
|
|
||||||
// script module can pick up events exposed by a module
|
|
||||||
m_moduleLoader.InitialiseSharedModules(scene);
|
|
||||||
|
|
||||||
// Use this in the future, the line above will be deprecated soon
|
// Use this in the future, the line above will be deprecated soon
|
||||||
m_log.Info("[REGIONMODULES]: Loading Region's modules (new style)");
|
m_log.Info("[REGIONMODULES]: Loading Region's modules (new style)");
|
||||||
IRegionModulesController controller;
|
IRegionModulesController controller;
|
||||||
|
@ -402,28 +392,29 @@ namespace OpenSim
|
||||||
}
|
}
|
||||||
else m_log.Error("[REGIONMODULES]: The new RegionModulesController is missing...");
|
else m_log.Error("[REGIONMODULES]: The new RegionModulesController is missing...");
|
||||||
|
|
||||||
if (m_securePermissionsLoading)
|
// XPTO: Fix this
|
||||||
{
|
// if (m_securePermissionsLoading)
|
||||||
foreach (string s in m_permsModules)
|
// {
|
||||||
{
|
// foreach (string s in m_permsModules)
|
||||||
if (!scene.RegionModules.ContainsKey(s))
|
// {
|
||||||
{
|
// if (!scene.RegionModules.ContainsKey(s))
|
||||||
bool found = false;
|
// {
|
||||||
foreach (IRegionModule m in modules)
|
// bool found = false;
|
||||||
{
|
// foreach (IRegionModule m in modules)
|
||||||
if (m.Name == s)
|
// {
|
||||||
{
|
// if (m.Name == s)
|
||||||
found = true;
|
// {
|
||||||
}
|
// found = true;
|
||||||
}
|
// }
|
||||||
if (!found)
|
// }
|
||||||
{
|
// if (!found)
|
||||||
m_log.Fatal("[MODULES]: Required module " + s + " not found.");
|
// {
|
||||||
Environment.Exit(0);
|
// m_log.Fatal("[MODULES]: Required module " + s + " not found.");
|
||||||
}
|
// Environment.Exit(0);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
scene.SetModuleInterfaces();
|
scene.SetModuleInterfaces();
|
||||||
// First Step of bootreport sequence
|
// First Step of bootreport sequence
|
||||||
|
@ -500,13 +491,6 @@ namespace OpenSim
|
||||||
{
|
{
|
||||||
scene.SnmpService.BootInfo("Initializing region modules", scene);
|
scene.SnmpService.BootInfo("Initializing region modules", scene);
|
||||||
}
|
}
|
||||||
if (do_post_init)
|
|
||||||
{
|
|
||||||
foreach (IRegionModule module in modules)
|
|
||||||
{
|
|
||||||
module.PostInitialise();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
scene.EventManager.OnShutdown += delegate() { ShutdownRegion(scene); };
|
scene.EventManager.OnShutdown += delegate() { ShutdownRegion(scene); };
|
||||||
|
|
||||||
mscene = scene;
|
mscene = scene;
|
||||||
|
@ -541,10 +525,10 @@ namespace OpenSim
|
||||||
string estateOwnerPassword = null;
|
string estateOwnerPassword = null;
|
||||||
string rawEstateOwnerUuid = null;
|
string rawEstateOwnerUuid = null;
|
||||||
|
|
||||||
if (m_config.Source.Configs[ESTATE_SECTION_NAME] != null)
|
if (Config.Configs[ESTATE_SECTION_NAME] != null)
|
||||||
{
|
{
|
||||||
string defaultEstateOwnerName
|
string defaultEstateOwnerName
|
||||||
= m_config.Source.Configs[ESTATE_SECTION_NAME].GetString("DefaultEstateOwnerName", "").Trim();
|
= Config.Configs[ESTATE_SECTION_NAME].GetString("DefaultEstateOwnerName", "").Trim();
|
||||||
string[] ownerNames = defaultEstateOwnerName.Split(' ');
|
string[] ownerNames = defaultEstateOwnerName.Split(' ');
|
||||||
|
|
||||||
if (ownerNames.Length >= 2)
|
if (ownerNames.Length >= 2)
|
||||||
|
@ -554,9 +538,9 @@ namespace OpenSim
|
||||||
}
|
}
|
||||||
|
|
||||||
// Info to be used only on Standalone Mode
|
// Info to be used only on Standalone Mode
|
||||||
rawEstateOwnerUuid = m_config.Source.Configs[ESTATE_SECTION_NAME].GetString("DefaultEstateOwnerUUID", null);
|
rawEstateOwnerUuid = Config.Configs[ESTATE_SECTION_NAME].GetString("DefaultEstateOwnerUUID", null);
|
||||||
estateOwnerEMail = m_config.Source.Configs[ESTATE_SECTION_NAME].GetString("DefaultEstateOwnerEMail", null);
|
estateOwnerEMail = Config.Configs[ESTATE_SECTION_NAME].GetString("DefaultEstateOwnerEMail", null);
|
||||||
estateOwnerPassword = m_config.Source.Configs[ESTATE_SECTION_NAME].GetString("DefaultEstateOwnerPassword", null);
|
estateOwnerPassword = Config.Configs[ESTATE_SECTION_NAME].GetString("DefaultEstateOwnerPassword", null);
|
||||||
}
|
}
|
||||||
|
|
||||||
MainConsole.Instance.OutputFormat("Estate {0} has no owner set.", regionInfo.EstateSettings.EstateName);
|
MainConsole.Instance.OutputFormat("Estate {0} has no owner set.", regionInfo.EstateSettings.EstateName);
|
||||||
|
@ -623,7 +607,7 @@ namespace OpenSim
|
||||||
if (account == null)
|
if (account == null)
|
||||||
{
|
{
|
||||||
m_log.ErrorFormat(
|
m_log.ErrorFormat(
|
||||||
"[OPENSIM]: Unable to store account. If this simulator is connected to a grid, you must create the estate owner account first.");
|
"[OPENSIM]: Unable to store account. If this simulator is connected to a grid, you must create the estate owner account first at the grid level.");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -807,8 +791,8 @@ namespace OpenSim
|
||||||
|
|
||||||
return new Scene(
|
return new Scene(
|
||||||
regionInfo, circuitManager, sceneGridService,
|
regionInfo, circuitManager, sceneGridService,
|
||||||
simDataService, estateDataService, m_moduleLoader, false,
|
simDataService, estateDataService, false,
|
||||||
m_config.Source, m_version);
|
Config, m_version);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void ShutdownClientServer(RegionInfo whichRegion)
|
protected void ShutdownClientServer(RegionInfo whichRegion)
|
||||||
|
@ -835,9 +819,11 @@ namespace OpenSim
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void handleRestartRegion(RegionInfo whichRegion)
|
protected virtual void HandleRestartRegion(RegionInfo whichRegion)
|
||||||
{
|
{
|
||||||
m_log.Info("[OPENSIM]: Got restart signal from SceneManager");
|
m_log.InfoFormat(
|
||||||
|
"[OPENSIM]: Got restart signal from SceneManager for region {0} ({1},{2})",
|
||||||
|
whichRegion.RegionName, whichRegion.RegionLocX, whichRegion.RegionLocY);
|
||||||
|
|
||||||
ShutdownClientServer(whichRegion);
|
ShutdownClientServer(whichRegion);
|
||||||
IScene scene;
|
IScene scene;
|
||||||
|
@ -849,7 +835,7 @@ namespace OpenSim
|
||||||
protected override PhysicsScene GetPhysicsScene(string osSceneIdentifier)
|
protected override PhysicsScene GetPhysicsScene(string osSceneIdentifier)
|
||||||
{
|
{
|
||||||
return GetPhysicsScene(
|
return GetPhysicsScene(
|
||||||
m_configSettings.PhysicsEngine, m_configSettings.MeshEngineName, m_config.Source, osSceneIdentifier);
|
m_configSettings.PhysicsEngine, m_configSettings.MeshEngineName, Config, osSceneIdentifier);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -983,7 +969,6 @@ namespace OpenSim
|
||||||
m_log.Info("[SHUTDOWN]: Closing all threads");
|
m_log.Info("[SHUTDOWN]: Closing all threads");
|
||||||
m_log.Info("[SHUTDOWN]: Killing listener thread");
|
m_log.Info("[SHUTDOWN]: Killing listener thread");
|
||||||
m_log.Info("[SHUTDOWN]: Killing clients");
|
m_log.Info("[SHUTDOWN]: Killing clients");
|
||||||
// TODO: implement this
|
|
||||||
m_log.Info("[SHUTDOWN]: Closing console and terminating");
|
m_log.Info("[SHUTDOWN]: Closing console and terminating");
|
||||||
|
|
||||||
try
|
try
|
||||||
|
@ -992,7 +977,7 @@ namespace OpenSim
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
m_log.ErrorFormat("[SHUTDOWN]: Ignoring failure during shutdown - {0}", e);
|
m_log.Error("[SHUTDOWN]: Ignoring failure during shutdown - ", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1086,9 +1071,9 @@ namespace OpenSim
|
||||||
|
|
||||||
string defaultEstateName = null;
|
string defaultEstateName = null;
|
||||||
|
|
||||||
if (m_config.Source.Configs[ESTATE_SECTION_NAME] != null)
|
if (Config.Configs[ESTATE_SECTION_NAME] != null)
|
||||||
{
|
{
|
||||||
defaultEstateName = m_config.Source.Configs[ESTATE_SECTION_NAME].GetString("DefaultEstateName", null);
|
defaultEstateName = Config.Configs[ESTATE_SECTION_NAME].GetString("DefaultEstateName", null);
|
||||||
|
|
||||||
if (defaultEstateName != null)
|
if (defaultEstateName != null)
|
||||||
{
|
{
|
||||||
|
@ -1171,28 +1156,14 @@ namespace OpenSim
|
||||||
MainConsole.Instance.Output("Joining the estate failed. Please try again.");
|
MainConsole.Instance.Output("Joining the estate failed. Please try again.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true; // need to update the database
|
return true; // need to update the database
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class OpenSimConfigSource
|
public class OpenSimConfigSource
|
||||||
{
|
{
|
||||||
public IConfigSource Source;
|
public IConfigSource Source;
|
||||||
|
|
||||||
public void Save(string path)
|
|
||||||
{
|
|
||||||
if (Source is IniConfigSource)
|
|
||||||
{
|
|
||||||
IniConfigSource iniCon = (IniConfigSource) Source;
|
|
||||||
iniCon.Save(path);
|
|
||||||
}
|
|
||||||
else if (Source is XmlConfigSource)
|
|
||||||
{
|
|
||||||
XmlConfigSource xmlCon = (XmlConfigSource) Source;
|
|
||||||
xmlCon.Save(path);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -241,8 +241,8 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||||
m_HostCapsObj.RegisterHandler(
|
m_HostCapsObj.RegisterHandler(
|
||||||
"SEED", new RestStreamHandler("POST", capsBase + m_requestPath, SeedCapRequest, "SEED", null));
|
"SEED", new RestStreamHandler("POST", capsBase + m_requestPath, SeedCapRequest, "SEED", null));
|
||||||
|
|
||||||
m_log.DebugFormat(
|
// m_log.DebugFormat(
|
||||||
"[CAPS]: Registered seed capability {0} for {1}", capsBase + m_requestPath, m_HostCapsObj.AgentID);
|
// "[CAPS]: Registered seed capability {0} for {1}", capsBase + m_requestPath, m_HostCapsObj.AgentID);
|
||||||
|
|
||||||
//m_capsHandlers["MapLayer"] =
|
//m_capsHandlers["MapLayer"] =
|
||||||
// new LLSDStreamhandler<OSDMapRequest, OSDMapLayerResponse>("POST",
|
// new LLSDStreamhandler<OSDMapRequest, OSDMapLayerResponse>("POST",
|
||||||
|
@ -337,11 +337,12 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||||
public string SeedCapRequest(string request, string path, string param,
|
public string SeedCapRequest(string request, string path, string param,
|
||||||
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||||
{
|
{
|
||||||
// m_log.Debug("[CAPS]: Seed Caps Request in region: " + m_regionName);
|
m_log.DebugFormat(
|
||||||
|
"[CAPS]: Received SEED caps request in {0} for agent {1}", m_regionName, m_HostCapsObj.AgentID);
|
||||||
|
|
||||||
if (!m_Scene.CheckClient(m_HostCapsObj.AgentID, httpRequest.RemoteIPEndPoint))
|
if (!m_Scene.CheckClient(m_HostCapsObj.AgentID, httpRequest.RemoteIPEndPoint))
|
||||||
{
|
{
|
||||||
m_log.DebugFormat(
|
m_log.WarnFormat(
|
||||||
"[CAPS]: Unauthorized CAPS client {0} from {1}",
|
"[CAPS]: Unauthorized CAPS client {0} from {1}",
|
||||||
m_HostCapsObj.AgentID, httpRequest.RemoteIPEndPoint);
|
m_HostCapsObj.AgentID, httpRequest.RemoteIPEndPoint);
|
||||||
|
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue