* Cleanup and CCC (Code Convention Conformance)

0.6.5-rc1
lbsa71 2009-03-10 20:27:41 +00:00
parent 63a5a01945
commit 91a096dca6
7 changed files with 305 additions and 283 deletions

View File

@ -39,7 +39,7 @@ namespace OpenSim
public class Application
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public static string iniFilePath = "";
public static bool m_saveCrashDumps = false;
@ -51,7 +51,8 @@ namespace OpenSim
public static void Main(string[] args)
{
// First line
AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
AppDomain.CurrentDomain.UnhandledException +=
new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
XmlConfigurator.Configure();
@ -143,7 +144,7 @@ namespace OpenSim
msg += "\r\n";
msg += "Exception: " + e.ExceptionObject.ToString() + "\r\n";
Exception ex = (Exception)e.ExceptionObject;
Exception ex = (Exception) e.ExceptionObject;
if (ex.InnerException != null)
{
msg += "InnerException: " + ex.InnerException.ToString() + "\r\n";
@ -177,7 +178,7 @@ namespace OpenSim
m_log.ErrorFormat("[CRASH LOGGER CRASHED]: {0}", e2);
}
_IsHandlingException=false;
_IsHandlingException = false;
}
}
}
}

View File

@ -45,10 +45,11 @@ namespace OpenSim
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public ConfigurationLoader()
{
{
}
public OpenSimConfigSource LoadConfigSettings(IConfigSource configSource, out ConfigSettings configSettings, out NetworkServersInfo networkInfo)
public OpenSimConfigSource LoadConfigSettings(IConfigSource configSource, out ConfigSettings configSettings,
out NetworkServersInfo networkInfo)
{
m_configSettings = configSettings = new ConfigSettings();
m_networkServersInfo = networkInfo = new NetworkServersInfo();
@ -70,16 +71,17 @@ namespace OpenSim
m_config.Source.Merge(DefaultConfig());
m_log.Info("[CONFIG] Reading configuration settings");
Uri configUri;
String xmlPath = Path.Combine(Util.configDir(), "OpenSim.xml");
String xmlPath = Path.Combine(Util.configDir(), "OpenSim.xml");
//check for master .INI file (name passed in command line, no default), or XML over http
if (masterFileName.Length > 0) // If a master file name is given ...
{
m_log.InfoFormat("[CONFIG] Reading config master file {0}", masterfilePath);
bool isMasterUri = Uri.TryCreate(masterFileName, UriKind.Absolute, out configUri) && configUri.Scheme == Uri.UriSchemeHttp;
bool isMasterUri = Uri.TryCreate(masterFileName, UriKind.Absolute, out configUri) &&
configUri.Scheme == Uri.UriSchemeHttp;
if (!ReadConfig(masterFileName, masterfilePath, m_config, isMasterUri))
{
@ -100,10 +102,11 @@ namespace OpenSim
}
}
}
// Check for .INI file (either default or name passed on command
// line) or XML config source over http
bool isIniUri = Uri.TryCreate(iniFileName, UriKind.Absolute, out configUri) && configUri.Scheme == Uri.UriSchemeHttp;
bool isIniUri = Uri.TryCreate(iniFileName, UriKind.Absolute, out configUri) &&
configUri.Scheme == Uri.UriSchemeHttp;
iniFileExists = ReadConfig(iniFileName, Application.iniFilePath, m_config, isIniUri);
if (!iniFileExists)
@ -119,7 +122,7 @@ namespace OpenSim
m_config.Source = new XmlConfigSource();
m_config.Source.Merge(new XmlConfigSource(Application.iniFilePath));
}
}
}
m_config.Source.Merge(configSource);
@ -152,7 +155,7 @@ namespace OpenSim
private bool ReadConfig(string iniName, string iniPath, OpenSimConfigSource m_config, bool isUri)
{
bool success = false;
if (!isUri && File.Exists(iniPath))
{
m_log.InfoFormat("[CONFIG] Reading configuration file {0}", Path.GetFullPath(iniPath));
@ -235,7 +238,7 @@ namespace OpenSim
config.Set("userDatabase_plugin", "OpenSim.Data.SQLite.dll");
config.Set("user_source", "");
config.Set("asset_plugin", "OpenSim.Data.SQLite.dll");
config.Set("asset_source", "");
config.Set("asset_source", "");
config.Set("LibrariesXMLFile", string.Format(".{0}inventory{0}Libraries.xml", Path.DirectorySeparatorChar));
config.Set("AssetSetsXMLFile", string.Format(".{0}assets{0}AssetSets.xml", Path.DirectorySeparatorChar));
config.Set("dump_assets_to_file", false);
@ -307,11 +310,11 @@ namespace OpenSim
m_configSettings.LibrariesXMLFile = standaloneConfig.GetString("LibrariesXMLFile");
m_configSettings.AssetSetsXMLFile = standaloneConfig.GetString("AssetSetsXMLFile");
m_configSettings.DumpAssetsToFile = standaloneConfig.GetBoolean("dump_assets_to_file", false);
m_configSettings.DumpAssetsToFile = standaloneConfig.GetBoolean("dump_assets_to_file", false);
}
m_networkServersInfo.loadFromConfiguration(m_config.Source);
}
}
}
}

View File

@ -33,11 +33,7 @@ using log4net;
using Nini.Config;
using OpenSim.Framework;
using OpenSim.Framework.Communications;
using OpenSim.Framework.Communications.Cache;
using OpenSim.Framework.Console;
using OpenSim.Framework.Servers;
using OpenSim.Region.Communications.Hypergrid;
using OpenSim.Region.Communications.Local;
using OpenSim.Region.Framework;
using OpenSim.Region.Framework.Scenes;
using OpenSim.Region.Framework.Scenes.Hypergrid;
@ -68,24 +64,26 @@ namespace OpenSim
base.StartupSpecific();
MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-mapping", "link-mapping [<x> <y>] <cr>", "Set local coordinate to map HG regions to", RunCommand);
MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-region", "link-region <Xloc> <Yloc> <HostName>:<HttpPort>[:<RemoteRegionName>] <cr>", "Link a hypergrid region", RunCommand);
MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-mapping", "link-mapping [<x> <y>] <cr>",
"Set local coordinate to map HG regions to", RunCommand);
MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-region",
"link-region <Xloc> <Yloc> <HostName>:<HttpPort>[:<RemoteRegionName>] <cr>",
"Link a hypergrid region", RunCommand);
}
protected override Scene CreateScene(RegionInfo regionInfo, StorageManager storageManager,
AgentCircuitManager circuitManager)
AgentCircuitManager circuitManager)
{
HGSceneCommunicationService sceneGridService = new HGSceneCommunicationService(m_commsManager, HGServices);
return
new HGScene(
regionInfo, circuitManager, m_commsManager, sceneGridService, storageManager,
m_moduleLoader, m_configSettings.DumpAssetsToFile, m_configSettings.PhysicalPrim,
m_moduleLoader, m_configSettings.DumpAssetsToFile, m_configSettings.PhysicalPrim,
m_configSettings.See_into_region_from_neighbor, m_config.Source, m_version);
}
new void RunCommand(string module, string[] cp)
private new void RunCommand(string module, string[] cp)
{
List<string> cmdparams = new List<string>(cp);
if (cmdparams.Count < 1)
@ -128,7 +126,8 @@ namespace OpenSim
}
if (cmdparams[2].Contains(":"))
{ // New format
{
// New format
uint xloc, yloc;
string mapName;
try
@ -154,7 +153,8 @@ namespace OpenSim
HGHyperlink.TryLinkRegionToCoords(m_sceneManager.CurrentOrFirstScene, null, mapName, xloc, yloc);
}
else
{ // old format
{
// old format
RegionInfo regInfo;
uint xloc, yloc;
uint externalPort;
@ -205,7 +205,7 @@ namespace OpenSim
{
string excludeString = cmdparams[1].ToLower();
excludeString = excludeString.Remove(0, 12);
char[] splitter = { ';' };
char[] splitter = {';'};
excludeSections = excludeString.Split(splitter);
}
@ -236,7 +236,7 @@ namespace OpenSim
m_log.Error(e.ToString());
}
}
private void ReadLinkFromConfig(IConfig config)
{
@ -255,19 +255,23 @@ namespace OpenSim
if (m_enableAutoMapping)
{
xloc = (uint)((xloc % 100) + m_autoMappingX);
yloc = (uint)((yloc % 100) + m_autoMappingY);
xloc = (uint) ((xloc%100) + m_autoMappingX);
yloc = (uint) ((yloc%100) + m_autoMappingY);
}
if (((realXLoc == 0) && (realYLoc == 0)) || (((realXLoc - xloc < 3896) || (xloc - realXLoc < 3896)) && ((realYLoc - yloc < 3896) || (yloc - realYLoc < 3896))))
if (((realXLoc == 0) && (realYLoc == 0)) ||
(((realXLoc - xloc < 3896) || (xloc - realXLoc < 3896)) &&
((realYLoc - yloc < 3896) || (yloc - realYLoc < 3896))))
{
if (HGHyperlink.TryCreateLink(m_sceneManager.CurrentOrFirstScene, null, xloc, yloc, "", externalPort, externalHostName, out regInfo))
if (
HGHyperlink.TryCreateLink(m_sceneManager.CurrentOrFirstScene, null, xloc, yloc, "", externalPort,
externalHostName, out regInfo))
{
regInfo.RegionName = config.GetString("localName", "");
}
}
}
private void LinkRegionCmdUsage()
{
@ -276,4 +280,4 @@ namespace OpenSim
m_log.Info("Usage: link-region <URI_of_xml> [<exclude>]");
}
}
}
}

View File

@ -38,11 +38,16 @@ namespace OpenSim
public class ApplicationPluginInitialiser : PluginInitialiserBase
{
private OpenSimBase server;
public ApplicationPluginInitialiser (OpenSimBase s) { server = s; }
public override void Initialise (IPlugin plugin)
public ApplicationPluginInitialiser(OpenSimBase s)
{
server = s;
}
public override void Initialise(IPlugin plugin)
{
IApplicationPlugin p = plugin as IApplicationPlugin;
p.Initialise (server);
p.Initialise(server);
}
}
}
}

View File

@ -85,7 +85,8 @@ namespace OpenSim
m_log.Info("====================================================================");
m_log.Info("========================= STARTING OPENSIM =========================");
m_log.Info("====================================================================");
m_log.InfoFormat("[OPENSIM MAIN]: Running in {0} mode", (ConfigurationSettings.Standalone ? "sandbox" : "grid"));
m_log.InfoFormat("[OPENSIM MAIN]: Running in {0} mode",
(ConfigurationSettings.Standalone ? "sandbox" : "grid"));
//m_log.InfoFormat("[OPENSIM MAIN]: GC Is Server GC: {0}", GCSettings.IsServerGC.ToString());
// http://msdn.microsoft.com/en-us/library/bb384202.aspx
//GCSettings.LatencyMode = GCLatencyMode.Batch;
@ -100,7 +101,7 @@ namespace OpenSim
base.StartupSpecific();
//Run Startup Commands
if (String.IsNullOrEmpty( m_startupCommandsFile ))
if (String.IsNullOrEmpty(m_startupCommandsFile))
{
m_log.Info("[STARTUP]: No startup command script specified. Moving on...");
}
@ -114,7 +115,7 @@ namespace OpenSim
{
m_scriptTimer = new Timer();
m_scriptTimer.Enabled = true;
m_scriptTimer.Interval = 1200 * 1000;
m_scriptTimer.Interval = 1200*1000;
m_scriptTimer.Elapsed += RunAutoTimerScript;
}
@ -122,7 +123,8 @@ namespace OpenSim
// For now, start at the 'root' level by default
if (m_sceneManager.Scenes.Count == 1) // If there is only one region, select it
ChangeSelectedRegion("region", new string[] {"change", "region", m_sceneManager.Scenes[0].RegionInfo.RegionName});
ChangeSelectedRegion("region",
new string[] {"change", "region", m_sceneManager.Scenes[0].RegionInfo.RegionName});
else
ChangeSelectedRegion("region", new string[] {"change", "region", "root"});
}
@ -130,164 +132,164 @@ namespace OpenSim
private void RegisterConsoleCommands()
{
m_console.Commands.AddCommand("region", false, "clear assets",
"clear assets",
"Clear the asset cache", HandleClearAssets);
"clear assets",
"Clear the asset cache", HandleClearAssets);
m_console.Commands.AddCommand("region", false, "force update",
"force update",
"Force the update of all objects on clients",
HandleForceUpdate);
"force update",
"Force the update of all objects on clients",
HandleForceUpdate);
m_console.Commands.AddCommand("region", false, "debug packet",
"debug packet <level>",
"Turn on packet debugging", Debug);
"debug packet <level>",
"Turn on packet debugging", Debug);
m_console.Commands.AddCommand("region", false, "debug scene",
"debug scene <cripting> <collisions> <physics>",
"Turn on scene debugging", Debug);
"debug scene <cripting> <collisions> <physics>",
"Turn on scene debugging", Debug);
m_console.Commands.AddCommand("region", false, "change region",
"change region <region name>",
"Change current console region", ChangeSelectedRegion);
"change region <region name>",
"Change current console region", ChangeSelectedRegion);
m_console.Commands.AddCommand("region", false, "save xml",
"save xml",
"Save a region's data in XML format", SaveXml);
"save xml",
"Save a region's data in XML format", SaveXml);
m_console.Commands.AddCommand("region", false, "save xml2",
"save xml2",
"Save a region's data in XML2 format", SaveXml2);
"save xml2",
"Save a region's data in XML2 format", SaveXml2);
m_console.Commands.AddCommand("region", false, "load xml",
"load xml [-newIDs [<x> <y> <z>]]",
"Load a region's data from XML format", LoadXml);
"load xml [-newIDs [<x> <y> <z>]]",
"Load a region's data from XML format", LoadXml);
m_console.Commands.AddCommand("region", false, "load xml2",
"load xml2",
"Load a region's data from XML2 format", LoadXml2);
"load xml2",
"Load a region's data from XML2 format", LoadXml2);
m_console.Commands.AddCommand("region", false, "save prims xml2",
"save prims xml2 [<prim name> <file name>]",
"Save named prim to XML2", SavePrimsXml2);
"save prims xml2 [<prim name> <file name>]",
"Save named prim to XML2", SavePrimsXml2);
m_console.Commands.AddCommand("region", false, "load oar",
"load oar <oar name>",
"Load a region's data from OAR archive", LoadOar);
"load oar <oar name>",
"Load a region's data from OAR archive", LoadOar);
m_console.Commands.AddCommand("region", false, "save oar",
"save oar <oar name>",
"Save a region's data to an OAR archive",
"More information on forthcoming options here soon", SaveOar);
"save oar <oar name>",
"Save a region's data to an OAR archive",
"More information on forthcoming options here soon", SaveOar);
m_console.Commands.AddCommand("region", false, "edit scale",
"edit scale <name> <x> <y> <z>",
"Change the scale of a named prim", HandleEditScale);
"edit scale <name> <x> <y> <z>",
"Change the scale of a named prim", HandleEditScale);
m_console.Commands.AddCommand("region", false, "kick user",
"kick user <first> <last>",
"Kick a user off the simulator", KickUserCommand);
"kick user <first> <last>",
"Kick a user off the simulator", KickUserCommand);
m_console.Commands.AddCommand("region", false, "show assets",
"show assets",
"Show asset data", HandleShow);
"show assets",
"Show asset data", HandleShow);
m_console.Commands.AddCommand("region", false, "show users",
"show users [full]",
"Show user data", HandleShow);
"show users [full]",
"Show user data", HandleShow);
m_console.Commands.AddCommand("region", false, "show users full",
"show users full",
String.Empty, HandleShow);
"show users full",
String.Empty, HandleShow);
m_console.Commands.AddCommand("region", false, "show modules",
"show modules",
"Show module data", HandleShow);
"show modules",
"Show module data", HandleShow);
m_console.Commands.AddCommand("region", false, "show regions",
"show regions",
"Show region data", HandleShow);
"show regions",
"Show region data", HandleShow);
m_console.Commands.AddCommand("region", false, "show queues",
"show queues",
"Show queue data", HandleShow);
"show queues",
"Show queue data", HandleShow);
m_console.Commands.AddCommand("region", false, "backup",
"backup",
"Persist objects to the database now", RunCommand);
"backup",
"Persist objects to the database now", RunCommand);
m_console.Commands.AddCommand("region", false, "create region",
"create region",
"Create a new region", HandleCreateRegion);
"create region",
"Create a new region", HandleCreateRegion);
m_console.Commands.AddCommand("region", false, "login enable",
"login enable",
"Enable logins to the simulator", HandleLoginEnable);
"login enable",
"Enable logins to the simulator", HandleLoginEnable);
m_console.Commands.AddCommand("region", false, "login disable",
"login disable",
"Disable logins to the simulator", HandleLoginDisable);
"login disable",
"Disable logins to the simulator", HandleLoginDisable);
m_console.Commands.AddCommand("region", false, "login status",
"login status",
"Display status of logins", HandleLoginStatus);
"login status",
"Display status of logins", HandleLoginStatus);
m_console.Commands.AddCommand("region", false, "restart",
"restart",
"Restart all sims in this instance", RunCommand);
"restart",
"Restart all sims in this instance", RunCommand);
m_console.Commands.AddCommand("region", false, "config set",
"config set <section> <field> <value>",
"Set a config option", HandleConfig);
"config set <section> <field> <value>",
"Set a config option", HandleConfig);
m_console.Commands.AddCommand("region", false, "config get",
"config get <section> <field>",
"Read a config option", HandleConfig);
"config get <section> <field>",
"Read a config option", HandleConfig);
m_console.Commands.AddCommand("region", false, "config save",
"config save",
"Save current configuration", HandleConfig);
"config save",
"Save current configuration", HandleConfig);
m_console.Commands.AddCommand("region", false, "command-script",
"command-script <script>",
"Run a command script from file", RunCommand);
"command-script <script>",
"Run a command script from file", RunCommand);
m_console.Commands.AddCommand("region", false, "remove-region",
"remove-region <name>",
"Remove a region from this simulator", RunCommand);
"remove-region <name>",
"Remove a region from this simulator", RunCommand);
m_console.Commands.AddCommand("region", false, "delete-region",
"delete-region <name>",
"Delete a region from disk", RunCommand);
"delete-region <name>",
"Delete a region from disk", RunCommand);
m_console.Commands.AddCommand("region", false, "predecode-j2k",
"predecode-j2k [<num threads>]>",
"Precache assets,decode j2k layerdata", RunCommand);
"predecode-j2k [<num threads>]>",
"Precache assets,decode j2k layerdata", RunCommand);
m_console.Commands.AddCommand("region", false, "modules list",
"modules list",
"List modules", HandleModules);
"modules list",
"List modules", HandleModules);
m_console.Commands.AddCommand("region", false, "modules load",
"modules load <name>",
"Load a module", HandleModules);
"modules load <name>",
"Load a module", HandleModules);
m_console.Commands.AddCommand("region", false, "modules unload",
"modules unload <name>",
"Unload a module", HandleModules);
"modules unload <name>",
"Unload a module", HandleModules);
m_console.Commands.AddCommand("region", false, "Add-InventoryHost",
"Add-InventoryHost <host>",
String.Empty, RunCommand);
"Add-InventoryHost <host>",
String.Empty, RunCommand);
if (ConfigurationSettings.Standalone)
{
m_console.Commands.AddCommand("region", false, "create user",
"create user [<first> [<last> [<pass> [<x> <y> [<email>]]]]]",
"Create a new user", HandleCreateUser);
"create user [<first> [<last> [<pass> [<x> <y> [<email>]]]]]",
"Create a new user", HandleCreateUser);
m_console.Commands.AddCommand("region", false, "reset user password",
"reset user password [<first> [<last> [<password>]]]",
"Reset a user password", HandleResetUserPassword);
"reset user password [<first> [<last> [<password>]]]",
"Reset a user password", HandleResetUserPassword);
}
}
@ -321,15 +323,16 @@ namespace OpenSim
{
RegionInfo regionInfo = m_sceneManager.GetRegionInfo(presence.RegionHandle);
if (presence.Firstname.ToLower().Contains(cmdparams[2].ToLower()) && presence.Lastname.ToLower().Contains(cmdparams[3].ToLower()))
if (presence.Firstname.ToLower().Contains(cmdparams[2].ToLower()) &&
presence.Lastname.ToLower().Contains(cmdparams[3].ToLower()))
{
m_console.Notice(
String.Format(
"Kicking user: {0,-16}{1,-16}{2,-37} in region: {3,-16}",
presence.Firstname,
presence.Lastname,
presence.UUID,
regionInfo.RegionName));
"Kicking user: {0,-16}{1,-16}{2,-37} in region: {3,-16}",
presence.Firstname,
presence.Lastname,
presence.UUID,
regionInfo.RegionName));
presence.Scene.IncomingCloseAgent(presence.UUID);
}
@ -458,9 +461,9 @@ namespace OpenSim
}
else
{
// IConfig c = DefaultConfig().Configs[cmdparams[1]];
// if (c == null)
// c = DefaultConfig().AddConfig(cmdparams[1]);
// IConfig c = DefaultConfig().Configs[cmdparams[1]];
// if (c == null)
// c = DefaultConfig().AddConfig(cmdparams[1]);
IConfig c;
IConfigSource source = new IniConfigSource();
c = source.AddConfig(cmdparams[1]);
@ -471,11 +474,11 @@ namespace OpenSim
m_config.Source.Merge(source);
m_console.Error(n, n + " " + n + " " + cmdparams[1] + " " + cmdparams[2] + " " +
_value);
_value);
}
}
break;
case "get":
if (cmdparams.Length < 3)
{
@ -498,7 +501,7 @@ namespace OpenSim
}
break;
case "save":
m_console.Notice("Saving configuration file: " + Application.iniFilePath);
m_config.Save(Application.iniFilePath);
@ -541,7 +544,6 @@ namespace OpenSim
{
foreach (Scene s in new ArrayList(m_sceneManager.Scenes))
{
m_console.Notice("Loading module: " + cmdparams[1]);
m_moduleLoader.LoadRegionModules(cmdparams[1], s);
}
@ -569,58 +571,58 @@ namespace OpenSim
switch (command)
{
case "command-script":
if (cmdparams.Length > 0)
{
RunCommandScript(cmdparams[0]);
}
break;
case "command-script":
if (cmdparams.Length > 0)
{
RunCommandScript(cmdparams[0]);
}
break;
case "backup":
m_sceneManager.BackupCurrentScene();
break;
case "backup":
m_sceneManager.BackupCurrentScene();
break;
case "remove-region":
string regRemoveName = CombineParams(cmdparams, 0);
case "remove-region":
string regRemoveName = CombineParams(cmdparams, 0);
Scene removeScene;
if (m_sceneManager.TryGetScene(regRemoveName, out removeScene))
RemoveRegion(removeScene, false);
else
m_console.Error("no region with that name");
break;
Scene removeScene;
if (m_sceneManager.TryGetScene(regRemoveName, out removeScene))
RemoveRegion(removeScene, false);
else
m_console.Error("no region with that name");
break;
case "delete-region":
string regDeleteName = CombineParams(cmdparams, 0);
case "delete-region":
string regDeleteName = CombineParams(cmdparams, 0);
Scene killScene;
if (m_sceneManager.TryGetScene(regDeleteName, out killScene))
RemoveRegion(killScene, true);
else
m_console.Error("no region with that name");
break;
Scene killScene;
if (m_sceneManager.TryGetScene(regDeleteName, out killScene))
RemoveRegion(killScene, true);
else
m_console.Error("no region with that name");
break;
case "restart":
m_sceneManager.RestartCurrentScene();
break;
case "restart":
m_sceneManager.RestartCurrentScene();
break;
case "Add-InventoryHost":
if (cmdparams.Length > 0)
{
m_commsManager.AddInventoryService(cmdparams[0]);
}
break;
case "Add-InventoryHost":
if (cmdparams.Length > 0)
{
m_commsManager.AddInventoryService(cmdparams[0]);
}
break;
case "predecode-j2k":
if (cmdparams.Length > 0)
{
m_sceneManager.CacheJ2kDecode(Convert.ToInt32(cmdparams[0]));
}
else
{
m_sceneManager.CacheJ2kDecode(1);
}
break;
case "predecode-j2k":
if (cmdparams.Length > 0)
{
m_sceneManager.CacheJ2kDecode(Convert.ToInt32(cmdparams[0]));
}
else
{
m_sceneManager.CacheJ2kDecode(1);
}
break;
}
}
@ -743,10 +745,10 @@ namespace OpenSim
}
// see BaseOpenSimServer
override public void HandleShow(string mod, string[] cmd)
public override void HandleShow(string mod, string[] cmd)
{
base.HandleShow(mod, cmd);
List<string> args = new List<string>(cmd);
args.RemoveAt(0);
string[] showParams = args.ToArray();
@ -812,11 +814,12 @@ namespace OpenSim
case "regions":
m_sceneManager.ForEachScene(
delegate(Scene scene)
{
m_console.Notice("Region Name: " + scene.RegionInfo.RegionName + " , Region XLoc: " +
scene.RegionInfo.RegionLocX + " , Region YLoc: " +
scene.RegionInfo.RegionLocY + " , Region Port: " + scene.RegionInfo.InternalEndPoint.Port.ToString());
});
{
m_console.Notice("Region Name: " + scene.RegionInfo.RegionName + " , Region XLoc: " +
scene.RegionInfo.RegionLocX + " , Region YLoc: " +
scene.RegionInfo.RegionLocY + " , Region Port: " +
scene.RegionInfo.InternalEndPoint.Port.ToString());
});
break;
case "queues":
@ -842,16 +845,16 @@ namespace OpenSim
(IStatsCollector) client;
report = report + string.Format("{0,7} {1,7} {2,7} {3,7} {4,7} {5,7} {6,7} {7,7} {8,7} {9,7}\n",
"Send",
"In",
"Out",
"Resend",
"Land",
"Wind",
"Cloud",
"Task",
"Texture",
"Asset");
"Send",
"In",
"Out",
"Resend",
"Land",
"Wind",
"Cloud",
"Task",
"Texture",
"Asset");
report = report + stats.Report() +
"\n\n";
}
@ -878,7 +881,7 @@ namespace OpenSim
firstName = MainConsole.Instance.CmdPrompt("First name", "Default");
else firstName = cmdparams[2];
if ( cmdparams.Length < 4 )
if (cmdparams.Length < 4)
lastName = MainConsole.Instance.CmdPrompt("Last name", "User");
else lastName = cmdparams[3];
@ -886,11 +889,11 @@ namespace OpenSim
password = MainConsole.Instance.PasswdPrompt("Password");
else password = cmdparams[4];
if ( cmdparams.Length < 6 )
if (cmdparams.Length < 6)
regX = Convert.ToUInt32(MainConsole.Instance.CmdPrompt("Start Region X", regX.ToString()));
else regX = Convert.ToUInt32(cmdparams[5]);
if ( cmdparams.Length < 7 )
if (cmdparams.Length < 7)
regY = Convert.ToUInt32(MainConsole.Instance.CmdPrompt("Start Region Y", regY.ToString()));
else regY = Convert.ToUInt32(cmdparams[6]);
@ -922,11 +925,11 @@ namespace OpenSim
firstName = MainConsole.Instance.CmdPrompt("First name");
else firstName = cmdparams[3];
if ( cmdparams.Length < 5 )
if (cmdparams.Length < 5)
lastName = MainConsole.Instance.CmdPrompt("Last name");
else lastName = cmdparams[4];
if ( cmdparams.Length < 6 )
if (cmdparams.Length < 6)
newPassword = MainConsole.Instance.PasswdPrompt("New password");
else newPassword = cmdparams[5];
@ -1114,4 +1117,4 @@ namespace OpenSim
#endregion
}
}
}

View File

@ -56,7 +56,8 @@ namespace OpenSim
m_log.Info("====================================================================");
m_log.Info("========================= STARTING OPENSIM =========================");
m_log.Info("====================================================================");
m_log.InfoFormat("[OPENSIM MAIN]: Running in background {0} mode", ConfigurationSettings.Standalone ? "sandbox" : "grid");
m_log.InfoFormat("[OPENSIM MAIN]: Running in background {0} mode",
ConfigurationSettings.Standalone ? "sandbox" : "grid");
base.Startup();
@ -77,4 +78,4 @@ namespace OpenSim
base.Shutdown();
}
}
}
}

View File

@ -41,8 +41,6 @@ using OpenSim.Framework.Console;
using OpenSim.Framework.Servers;
using OpenSim.Framework.Statistics;
using OpenSim.Region.ClientStack;
using OpenSim.Region.Communications.Local;
using OpenSim.Region.Communications.OGS1;
using OpenSim.Region.Framework;
using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes;
@ -60,7 +58,7 @@ namespace OpenSim
// These are the names of the plugin-points extended by this
// class during system startup.
private const string PLUGIN_ASSET_CACHE = "/OpenSim/AssetCache";
private const string PLUGIN_ASSET_CACHE = "/OpenSim/AssetCache";
private const string PLUGIN_ASSET_SERVER_CLIENT = "/OpenSim/AssetClient";
protected string proxyUrl;
@ -77,20 +75,21 @@ namespace OpenSim
/// The file used to load and save an opensim archive if no filename has been specified
/// </summary>
protected const string DEFAULT_OAR_BACKUP_FILENAME = "scene.oar.tar.gz";
public ConfigSettings ConfigurationSettings
{
get { return m_configSettings; }
set { m_configSettings = value; }
}
protected ConfigSettings m_configSettings;
protected ConfigurationLoader m_configLoader;
protected GridInfoService m_gridInfoService;
protected GridInfoService m_gridInfoService;
public ConsoleCommand CreateAccount = null;
protected List<IApplicationPlugin> m_plugins = new List<IApplicationPlugin>();
/// <value>
@ -101,13 +100,15 @@ namespace OpenSim
get { return m_config; }
set { m_config = value; }
}
protected OpenSimConfigSource m_config;
public List<IClientNetworkServer> ClientServers
{
get { return m_clientServers; }
}
protected List<IClientNetworkServer> m_clientServers = new List<IClientNetworkServer>();
}
protected List<IClientNetworkServer> m_clientServers = new List<IClientNetworkServer>();
public new BaseHttpServer HttpServer
{
@ -117,13 +118,14 @@ namespace OpenSim
public uint 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();
@ -167,17 +169,17 @@ namespace OpenSim
loader.Load("/OpenSim/Startup");
m_plugins = loader.Plugins;
}
protected override List<string> GetHelpTopics()
protected override List<string> GetHelpTopics()
{
List<string> topics = base.GetHelpTopics();
Scene s = SceneManager.CurrentOrFirstScene;
if (s != null && s.GetCommanders() != null)
topics.AddRange(s.GetCommanders().Keys);
return topics;
}
}
/// <summary>
/// Performs startup specific to the region server, including initialization of the scene
/// such as loading configuration from disk.
@ -185,18 +187,18 @@ namespace OpenSim
protected override void StartupSpecific()
{
base.StartupSpecific();
m_stats = StatsManager.StartCollectingSimExtraStats();
// Create a ModuleLoader instance
m_moduleLoader = new ModuleLoader(m_config.Source);
LoadPlugins();
LoadPlugins();
foreach (IApplicationPlugin plugin in m_plugins)
{
plugin.PostInitialise();
}
// Only enable logins to the regions once we have completely finished starting up (apart from scripts)
if ((m_commsManager != null) && (m_commsManager.GridService != null))
{
@ -216,14 +218,14 @@ namespace OpenSim
foreach (string topic in topics)
{
m_console.Commands.AddCommand("plugin", false, "help " + topic,
"help " + topic,
"Get help on plugin command '" + topic + "'",
HandleCommanderHelp);
"help " + topic,
"Get help on plugin command '" + topic + "'",
HandleCommanderHelp);
m_console.Commands.AddCommand("plugin", false, topic,
topic,
"Execute subcommand for plugin '" + topic + "'",
null);
topic,
"Execute subcommand for plugin '" + topic + "'",
null);
ICommander commander = null;
@ -241,9 +243,9 @@ namespace OpenSim
foreach (string command in commander.Commands.Keys)
{
m_console.Commands.AddCommand(topic, false,
topic + " " + command,
topic + " " + commander.Commands[command].ShortHelp(),
String.Empty, HandleCommanderCommand);
topic + " " + command,
topic + " " + commander.Commands[command].ShortHelp(),
String.Empty, HandleCommanderCommand);
}
}
}
@ -288,80 +290,82 @@ namespace OpenSim
{
LegacyAssetClientPluginInitialiser linit = null;
CryptoAssetClientPluginInitialiser cinit = null;
AssetClientPluginInitialiser init = null;
AssetClientPluginInitialiser init = null;
IAssetServer assetServer = null;
string mode = m_configSettings.AssetStorage;
if (mode == null | mode == String.Empty)
if (mode == null | mode == String.Empty)
mode = "default";
// If "default" is specified, then the value is adjusted
// according to whether or not the server is running in
// standalone mode.
if (mode.ToLower() == "default")
if (mode.ToLower() == "default")
{
if (m_configSettings.Standalone == false)
mode = "grid";
mode = "grid";
else
mode = "local";
mode = "local";
}
switch (mode.ToLower())
{
// If grid is specified then the grid server is chose regardless
// of whether the server is standalone.
case "grid" :
// If grid is specified then the grid server is chose regardless
// of whether the server is standalone.
case "grid":
linit = new LegacyAssetClientPluginInitialiser(m_configSettings, m_networkServersInfo.AssetURL);
assetServer = loadAssetServer("Grid", linit);
break;
// If cryptogrid is specified then the cryptogrid server is chose regardless
// of whether the server is standalone.
case "cryptogrid" :
// If cryptogrid is specified then the cryptogrid server is chose regardless
// of whether the server is standalone.
case "cryptogrid":
cinit = new CryptoAssetClientPluginInitialiser(m_configSettings, m_networkServersInfo.AssetURL,
Environment.CurrentDirectory, true);
Environment.CurrentDirectory, true);
assetServer = loadAssetServer("Crypto", cinit);
break;
// If cryptogrid_eou is specified then the cryptogrid_eou server is chose regardless
// of whether the server is standalone.
case "cryptogrid_eou" :
// If cryptogrid_eou is specified then the cryptogrid_eou server is chose regardless
// of whether the server is standalone.
case "cryptogrid_eou":
cinit = new CryptoAssetClientPluginInitialiser(m_configSettings, m_networkServersInfo.AssetURL,
Environment.CurrentDirectory, false);
Environment.CurrentDirectory, false);
assetServer = loadAssetServer("Crypto", cinit);
break;
// If file is specified then the file server is chose regardless
// of whether the server is standalone.
case "file" :
// If file is specified then the file server is chose regardless
// of whether the server is standalone.
case "file":
linit = new LegacyAssetClientPluginInitialiser(m_configSettings, m_networkServersInfo.AssetURL);
assetServer = loadAssetServer("File", linit);
break;
// If local is specified then we're going to use the local SQL server
// implementation. We drop through, because that will be the fallback
// for the following default clause too.
case "local" :
// If local is specified then we're going to use the local SQL server
// implementation. We drop through, because that will be the fallback
// for the following default clause too.
case "local":
break;
// If the asset_database value is none of the previously mentioned strings, then we
// try to load a turnkey plugin that matches this value. If not we drop through to
// a local default.
default :
// If the asset_database value is none of the previously mentioned strings, then we
// try to load a turnkey plugin that matches this value. If not we drop through to
// a local default.
default:
try
{
init = new AssetClientPluginInitialiser(m_configSettings);
assetServer = loadAssetServer(m_configSettings.AssetStorage, init);
break;
}
catch {}
catch
{
}
m_log.Info("[OPENSIMBASE] Default assetserver will be used");
break;
}
// Open the local SQL-based database asset server
if (assetServer == null)
if (assetServer == null)
{
init = new AssetClientPluginInitialiser(m_configSettings);
SQLAssetServer sqlAssetServer = (SQLAssetServer) loadAssetServer("SQL", init);
@ -426,7 +430,7 @@ namespace OpenSim
loader.AddFilter(PLUGIN_ASSET_CACHE, new PluginProviderFilter(m_configSettings.AssetCache));
loader.Load(PLUGIN_ASSET_CACHE);
if (loader.Plugins.Count > 0)
if (loader.Plugins.Count > 0)
assetCache = (IAssetCache) loader.Plugins[0];
}
catch (Exception e)
@ -450,8 +454,8 @@ namespace OpenSim
else
{
m_log.Info("[Login] Login are now disabled ");
m_commsManager.GridService.RegionLoginsEnabled = false;
}
m_commsManager.GridService.RegionLoginsEnabled = false;
}
}
/// <summary>
@ -511,16 +515,16 @@ namespace OpenSim
m_log.Info("[MODULES]: Loading Region's modules");
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);
scene.SetModuleInterfaces();
// Prims have to be loaded after module configuration since some modules may be invoked during the load
scene.LoadPrimsFromStorage(regionInfo.originRegionID);
scene.StartTimer();
// moved these here as the terrain texture has to be created after the modules are initialized
@ -576,11 +580,11 @@ namespace OpenSim
{
m_sceneManager.TrySetCurrentScene("..");
}
scene.DeleteAllSceneObjects();
m_sceneManager.CloseScene(scene);
if (!cleanup)
if (!cleanup)
return;
if (!String.IsNullOrEmpty(scene.RegionInfo.RegionFile))
@ -624,7 +628,7 @@ namespace OpenSim
//if (!IPAddress.TryParse(regionInfo.InternalEndPoint, out listenIP))
// listenIP = IPAddress.Parse("0.0.0.0");
uint port = (uint)regionInfo.InternalEndPoint.Port;
uint port = (uint) regionInfo.InternalEndPoint.Port;
if (m_autoCreateClientStack)
{
@ -638,7 +642,7 @@ namespace OpenSim
clientServer = null;
}
regionInfo.InternalEndPoint.Port = (int)port;
regionInfo.InternalEndPoint.Port = (int) port;
Scene scene = CreateScene(regionInfo, m_storageManager, circuitManager);
@ -651,7 +655,7 @@ namespace OpenSim
scene.PhysicsScene = GetPhysicsScene(scene.RegionInfo.RegionName);
scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised());
scene.PhysicsScene.SetWaterLevel((float)regionInfo.RegionSettings.WaterHeight);
scene.PhysicsScene.SetWaterLevel((float) regionInfo.RegionSettings.WaterHeight);
// TODO: Remove this cruft once MasterAvatar is fully deprecated
//Master Avatar Setup
@ -687,7 +691,8 @@ namespace OpenSim
protected override StorageManager CreateStorageManager()
{
return CreateStorageManager(m_configSettings.StorageConnectionString, m_configSettings.EstateConnectionString);
return
CreateStorageManager(m_configSettings.StorageConnectionString, m_configSettings.EstateConnectionString);
}
protected StorageManager CreateStorageManager(string connectionstring, string estateconnectionstring)
@ -704,10 +709,10 @@ namespace OpenSim
AgentCircuitManager circuitManager)
{
SceneCommunicationService sceneGridService = new SceneCommunicationService(m_commsManager);
return new Scene(
regionInfo, circuitManager, m_commsManager, sceneGridService,
storageManager, m_moduleLoader, m_configSettings.DumpAssetsToFile, m_configSettings.PhysicalPrim,
storageManager, m_moduleLoader, m_configSettings.DumpAssetsToFile, m_configSettings.PhysicalPrim,
m_configSettings.See_into_region_from_neighbor, m_config.Source, m_version);
}
@ -728,7 +733,7 @@ namespace OpenSim
break;
}
}
if (foundClientServer)
{
m_clientServers[clientServerElement].Server.Close();
@ -793,7 +798,7 @@ namespace OpenSim
m_log.Info("[SHUTDOWN]: Closing console and terminating");
try
{
{
m_sceneManager.Close();
}
catch (Exception e)
@ -840,14 +845,14 @@ namespace OpenSim
{
if (Source is IniConfigSource)
{
IniConfigSource iniCon = (IniConfigSource)Source;
IniConfigSource iniCon = (IniConfigSource) Source;
iniCon.Save(path);
}
else if (Source is XmlConfigSource)
{
XmlConfigSource xmlCon = (XmlConfigSource)Source;
XmlConfigSource xmlCon = (XmlConfigSource) Source;
xmlCon.Save(path);
}
}
}
}
}