From 20a9bf08f51351e1e0a9de94f184ff56cd572665 Mon Sep 17 00:00:00 2001 From: Adam Frisby Date: Thu, 1 May 2008 18:04:42 +0000 Subject: * Rolled back a few changes. --- OpenSim/Grid/AssetServer/Main.cs | 81 +++++---- .../Grid/AssetServer/Properties/AssemblyInfo.cs | 2 +- OpenSim/Grid/AssetServer/RestService.cs | 42 ++--- OpenSim/Grid/GridServer/GridManager.cs | 185 ++++++++++----------- OpenSim/Grid/GridServer/GridServerBase.cs | 60 ++++--- OpenSim/Grid/GridServer/IGridPlugin.cs | 2 +- OpenSim/Grid/GridServer/Program.cs | 2 +- OpenSim/Grid/GridServer/Properties/AssemblyInfo.cs | 2 +- .../Grid/InventoryServer/GridInventoryService.cs | 50 +++--- OpenSim/Grid/InventoryServer/InventoryManager.cs | 18 +- OpenSim/Grid/InventoryServer/Main.cs | 65 ++++---- OpenSim/Grid/MessagingServer/Main.cs | 78 +++++---- OpenSim/Grid/MessagingServer/MessageService.cs | 151 +++++++++-------- OpenSim/Grid/MessagingServer/PresenceInformer.cs | 11 +- OpenSim/Grid/MessagingServer/UserPresenceData.cs | 10 +- OpenSim/Grid/MessagingServer/WorkUnitBase.cs | 2 +- .../Grid/MessagingServer/WorkUnitPresenceUpdate.cs | 2 +- OpenSim/Grid/MessagingServer/XMPPHTTPService.cs | 24 +-- OpenSim/Grid/ScriptServer/Application.cs | 6 +- OpenSim/Grid/ScriptServer/FakeScene.cs | 4 +- .../Grid/ScriptServer/Properties/AssemblyInfo.cs | 2 +- OpenSim/Grid/ScriptServer/RemotingObject.cs | 6 +- OpenSim/Grid/ScriptServer/RemotingServer.cs | 9 +- .../ScriptServer/ScriptServer/Region/RegionBase.cs | 5 - .../ScriptServer/Region/RegionConnectionManager.cs | 2 +- .../ScriptServer/ScriptServer/RegionCommManager.cs | 6 +- .../ScriptServer/ScriptEngineLoader.cs | 6 +- .../ScriptServer/ScriptEnginesManager.cs | 6 +- OpenSim/Grid/ScriptServer/ScriptServerMain.cs | 16 +- OpenSim/Grid/UserServer/Main.cs | 145 ++++++++-------- OpenSim/Grid/UserServer/MessageServersConnector.cs | 70 ++++---- OpenSim/Grid/UserServer/Properties/AssemblyInfo.cs | 2 +- OpenSim/Grid/UserServer/UserLoginService.cs | 118 +++++++------ OpenSim/Grid/UserServer/UserManager.cs | 132 +++++++-------- 34 files changed, 648 insertions(+), 674 deletions(-) (limited to 'OpenSim/Grid') diff --git a/OpenSim/Grid/AssetServer/Main.cs b/OpenSim/Grid/AssetServer/Main.cs index c26c506..26f4bc8 100644 --- a/OpenSim/Grid/AssetServer/Main.cs +++ b/OpenSim/Grid/AssetServer/Main.cs @@ -46,48 +46,14 @@ namespace OpenSim.Grid.AssetServer { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - public static OpenAsset_Main assetserver; + public AssetConfig m_config; + public static OpenAsset_Main assetserver; + // Temporarily hardcoded - should be a plugin - protected IAssetLoader assetLoader = new AssetLoaderFileSystem(); - + protected IAssetLoader assetLoader = new AssetLoaderFileSystem(); + private IAssetProvider m_assetProvider; - public AssetConfig m_config; - - public OpenAsset_Main() - { - m_console = new ConsoleBase("OpenAsset", this); - - MainConsole.Instance = m_console; - } - - #region conscmd_callback Members - - public override void RunCmd(string cmd, string[] cmdparams) - { - base.RunCmd(cmd, cmdparams); - - switch (cmd) - { - case "help": - m_console.Notice( - @"shutdown - shutdown this asset server (USE CAUTION!) - stats - statistical information for this server"); - - break; - - case "stats": - m_console.Notice("STATS", Environment.NewLine + StatsManager.AssetStats.Report()); - break; - - case "shutdown": - m_console.Close(); - Environment.Exit(0); - break; - } - } - - #endregion [STAThread] public static void Main(string[] args) @@ -112,6 +78,13 @@ namespace OpenSim.Grid.AssetServer } } + public OpenAsset_Main() + { + m_console = new ConsoleBase("OpenAsset", this); + + MainConsole.Instance = m_console; + } + public void Startup() { m_config = new AssetConfig("ASSET SERVER", (Path.Combine(Util.configDir(), "AssetServer_Config.xml"))); @@ -187,18 +160,42 @@ namespace OpenSim.Grid.AssetServer catch (Exception e) { m_log.Warn("[ASSET]: setupDB() - Exception occured"); - m_log.Warn("[ASSET]: " + e); + m_log.Warn("[ASSET]: " + e.ToString()); } } public void LoadDefaultAssets() { - assetLoader.ForEachDefaultXmlAsset(StoreAsset); + assetLoader.ForEachDefaultXmlAsset(StoreAsset); } protected void StoreAsset(AssetBase asset) { m_assetProvider.CreateAsset(asset); } + + public override void RunCmd(string cmd, string[] cmdparams) + { + base.RunCmd(cmd, cmdparams); + + switch (cmd) + { + case "help": + m_console.Notice( + @"shutdown - shutdown this asset server (USE CAUTION!) + stats - statistical information for this server"); + + break; + + case "stats": + m_console.Notice("STATS", Environment.NewLine + StatsManager.AssetStats.Report()); + break; + + case "shutdown": + m_console.Close(); + Environment.Exit(0); + break; + } + } } -} \ No newline at end of file +} diff --git a/OpenSim/Grid/AssetServer/Properties/AssemblyInfo.cs b/OpenSim/Grid/AssetServer/Properties/AssemblyInfo.cs index 3bae064..6f219a6 100644 --- a/OpenSim/Grid/AssetServer/Properties/AssemblyInfo.cs +++ b/OpenSim/Grid/AssetServer/Properties/AssemblyInfo.cs @@ -60,4 +60,4 @@ using System.Runtime.InteropServices; // [assembly : AssemblyVersion("1.0.0.0")] -[assembly : AssemblyFileVersion("1.0.0.0")] \ No newline at end of file +[assembly : AssemblyFileVersion("1.0.0.0")] diff --git a/OpenSim/Grid/AssetServer/RestService.cs b/OpenSim/Grid/AssetServer/RestService.cs index 93f86b8..ece826e 100644 --- a/OpenSim/Grid/AssetServer/RestService.cs +++ b/OpenSim/Grid/AssetServer/RestService.cs @@ -43,8 +43,8 @@ namespace OpenSim.Grid.AssetServer { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - private readonly IAssetProvider m_assetProvider; private OpenAsset_Main m_assetManager; + private IAssetProvider m_assetProvider; /// /// Constructor. @@ -58,28 +58,28 @@ namespace OpenSim.Grid.AssetServer m_assetManager = assetManager; m_assetProvider = assetProvider; } - + public override byte[] Handle(string path, Stream request) { string param = GetParam(path); byte[] result = new byte[] {}; - string[] p = param.Split(new[] {'/', '?', '&'}, StringSplitOptions.RemoveEmptyEntries); + string[] p = param.Split(new char[] {'/', '?', '&'}, StringSplitOptions.RemoveEmptyEntries); if (p.Length > 0) { - LLUUID assetID = null; - + LLUUID assetID = null; + if (!LLUUID.TryParse(p[0], out assetID)) { m_log.InfoFormat( "[REST]: GET:/asset ignoring request with malformed UUID {0}", p[0]); return result; - } + } if (StatsManager.AssetStats != null) StatsManager.AssetStats.AddRequest(); - + AssetBase asset = m_assetProvider.FetchAsset(assetID); if (asset != null) { @@ -94,39 +94,32 @@ namespace OpenSim.Grid.AssetServer //StreamReader sr = new StreamReader(ms); result = ms.GetBuffer(); - + m_log.InfoFormat( "[REST]: GET:/asset found {0} with name {1}, size {2} bytes", assetID, asset.Name, result.Length); - Array.Resize(ref result, (int) ms.Length); + Array.Resize(ref result, (int) ms.Length); } else { if (StatsManager.AssetStats != null) StatsManager.AssetStats.AddNotFoundRequest(); - + m_log.InfoFormat("[REST]: GET:/asset failed to find {0}", assetID); } } - return result; - } + return result; + } } public class PostAssetStreamHandler : BaseStreamHandler { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - private readonly IAssetProvider m_assetProvider; private OpenAsset_Main m_assetManager; - - public PostAssetStreamHandler(OpenAsset_Main assetManager, IAssetProvider assetProvider) - : base("POST", "/assets") - { - m_assetManager = assetManager; - m_assetProvider = assetProvider; - } + private IAssetProvider m_assetProvider; public override byte[] Handle(string path, Stream request) { @@ -146,5 +139,12 @@ namespace OpenSim.Grid.AssetServer return new byte[] {}; } + + public PostAssetStreamHandler(OpenAsset_Main assetManager, IAssetProvider assetProvider) + : base("POST", "/assets") + { + m_assetManager = assetManager; + m_assetProvider = assetProvider; + } } -} \ No newline at end of file +} diff --git a/OpenSim/Grid/GridServer/GridManager.cs b/OpenSim/Grid/GridServer/GridManager.cs index 32f002a..7eb9c34 100644 --- a/OpenSim/Grid/GridServer/GridManager.cs +++ b/OpenSim/Grid/GridServer/GridManager.cs @@ -44,11 +44,11 @@ namespace OpenSim.Grid.GridServer { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - private readonly Dictionary _logplugins = new Dictionary(); + private Dictionary _plugins = new Dictionary(); + private Dictionary _logplugins = new Dictionary(); // This is here so that the grid server can hand out MessageServer settings to regions on registration - private readonly List _MessageServers = new List(); - private readonly Dictionary _plugins = new Dictionary(); + private List _MessageServers = new List(); public GridConfig Config; @@ -72,7 +72,7 @@ namespace OpenSim.Grid.GridServer if (typeInterface != null) { IGridData plug = - (IGridData) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); + (IGridData)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); plug.Initialise(); _plugins.Add(plug.getName(), plug); m_log.Info("[DATA]: Added IGridData Interface"); @@ -84,7 +84,7 @@ namespace OpenSim.Grid.GridServer if (typeInterface != null) { ILogData plug = - (ILogData) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); + (ILogData)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); plug.Initialise(); _logplugins.Add(plug.getName(), plug); m_log.Info("[DATA]: Added ILogData Interface"); @@ -152,7 +152,7 @@ namespace OpenSim.Grid.GridServer } catch { - m_log.Warn("[storage]: Unable to find region " + handle + " via " + kvp.Key); + m_log.Warn("[storage]: Unable to find region " + handle.ToString() + " via " + kvp.Key); } } return null; @@ -218,20 +218,20 @@ namespace OpenSim.Grid.GridServer { if ( GetRegion( - Util.UIntsToLong((uint) ((central_region.regionLocX + x) * Constants.RegionSize), - (uint) (central_region.regionLocY + y) * Constants.RegionSize)) != null) + Util.UIntsToLong((uint)((central_region.regionLocX + x) * Constants.RegionSize), + (uint)(central_region.regionLocY + y) * Constants.RegionSize)) != null) { neighbour = GetRegion( - Util.UIntsToLong((uint) ((central_region.regionLocX + x) * Constants.RegionSize), - (uint) (central_region.regionLocY + y) * Constants.RegionSize)); + Util.UIntsToLong((uint)((central_region.regionLocX + x) * Constants.RegionSize), + (uint)(central_region.regionLocY + y) * Constants.RegionSize)); response += ""; response += "" + neighbour.serverIP + ""; - response += "" + neighbour.serverPort + ""; - response += "" + neighbour.regionLocX + ""; - response += "" + neighbour.regionLocY + ""; - response += "" + neighbour.regionHandle + ""; + response += "" + neighbour.serverPort.ToString() + ""; + response += "" + neighbour.regionLocX.ToString() + ""; + response += "" + neighbour.regionLocY.ToString() + ""; + response += "" + neighbour.regionHandle.ToString() + ""; response += ""; } } @@ -287,10 +287,10 @@ namespace OpenSim.Grid.GridServer RegionProfileData sim; RegionProfileData existingSim; - Hashtable requestData = (Hashtable) request.Params[0]; + Hashtable requestData = (Hashtable)request.Params[0]; LLUUID uuid; - if (!requestData.ContainsKey("UUID") || !LLUUID.TryParse((string) requestData["UUID"], out uuid)) + if (!requestData.ContainsKey("UUID") || !LLUUID.TryParse((string)requestData["UUID"], out uuid)) { m_log.Info("[GRID]: Region connected without a UUID, ignoring."); return ErrorResponse("No UUID passed to grid server - unable to connect you"); @@ -303,7 +303,7 @@ namespace OpenSim.Grid.GridServer catch (FormatException e) { m_log.Info("[GRID]: Invalid login parameters, ignoring."); - return ErrorResponse("Wrong format in login parameters. Please verify parameters." + e); + return ErrorResponse("Wrong format in login parameters. Please verify parameters." + e.ToString() ); } existingSim = GetRegion(sim.regionHandle); @@ -329,7 +329,7 @@ namespace OpenSim.Grid.GridServer { DataResponse insertResponse; - if (existingSim == null) + if( existingSim == null ) { insertResponse = kvp.Value.AddProfile(sim); } @@ -348,20 +348,20 @@ namespace OpenSim.Grid.GridServer break; case DataResponse.RESPONSE_INVALIDCREDENTIALS: m_log.Warn("[storage]: " + - "New sim creation failed (Invalid Credentials): " + sim.regionName); + "New sim creation failed (Invalid Credentials): " + sim.regionName); break; case DataResponse.RESPONSE_AUTHREQUIRED: m_log.Warn("[storage]: " + - "New sim creation failed (Authentication Required): " + - sim.regionName); + "New sim creation failed (Authentication Required): " + + sim.regionName); break; } } catch (Exception e) { m_log.Warn("[storage]: " + - "Unable to add region " + sim.UUID + " via " + kvp.Key); - m_log.Warn("[storage]: " + e); + "Unable to add region " + sim.UUID.ToString() + " via " + kvp.Key); + m_log.Warn("[storage]: " + e.ToString()); } } @@ -375,8 +375,7 @@ namespace OpenSim.Grid.GridServer { m_log.Warn("[grid]: Authentication failed when trying to add new region " + sim.regionName + " at location " + sim.regionLocX + - " " + sim.regionLocY + " with TheSim.regionRecvKey " + sim.regionRecvKey + "(" + Config.SimSendKey + - ") and TheSim.regionRecvKey " + sim.regionSendKey + "(" + Config.SimRecvKey + ") "); + " " + sim.regionLocY + " with TheSim.regionRecvKey " + sim.regionRecvKey + "(" + Config.SimSendKey + ") and TheSim.regionRecvKey " + sim.regionSendKey + "(" + Config.SimRecvKey + ") "); } else { @@ -390,8 +389,7 @@ namespace OpenSim.Grid.GridServer } else { - m_log.Warn("[grid]: Failed to add new region " + sim.regionName + " at location " + sim.regionLocX + " " + sim.regionLocY + - " currently occupied by " + existingSim.regionName); + m_log.Warn("[grid]: Failed to add new region " + sim.regionName + " at location " + sim.regionLocX + " " + sim.regionLocY + " currently occupied by " + existingSim.regionName); return ErrorResponse("Another region already exists at that location. Try another"); } } @@ -466,7 +464,7 @@ namespace OpenSim.Grid.GridServer foreach (KeyValuePair aSim in neighbours) { NeighbourBlock = new Hashtable(); - NeighbourBlock["sim_ip"] = Util.GetHostFromDNS(aSim.Value.serverIP).ToString(); + NeighbourBlock["sim_ip"] = Util.GetHostFromDNS(aSim.Value.serverIP.ToString()).ToString(); NeighbourBlock["sim_port"] = aSim.Value.serverPort.ToString(); NeighbourBlock["region_locx"] = aSim.Value.regionLocX.ToString(); NeighbourBlock["region_locy"] = aSim.Value.regionLocY.ToString(); @@ -487,13 +485,13 @@ namespace OpenSim.Grid.GridServer { if ( GetRegion( - Helpers.UIntsToLong((uint) ((sim.regionLocX + x) * Constants.RegionSize), - (uint) (sim.regionLocY + y) * Constants.RegionSize)) != null) + Helpers.UIntsToLong((uint)((sim.regionLocX + x) * Constants.RegionSize), + (uint)(sim.regionLocY + y) * Constants.RegionSize)) != null) { neighbour = GetRegion( - Helpers.UIntsToLong((uint) ((sim.regionLocX + x) * Constants.RegionSize), - (uint) (sim.regionLocY + y) * Constants.RegionSize)); + Helpers.UIntsToLong((uint)((sim.regionLocX + x) * Constants.RegionSize), + (uint)(sim.regionLocY + y) * Constants.RegionSize)); NeighbourBlock = new Hashtable(); NeighbourBlock["sim_ip"] = Util.GetHostFromDNS(neighbour.serverIP).ToString(); @@ -521,26 +519,27 @@ namespace OpenSim.Grid.GridServer RegionProfileData sim; sim = new RegionProfileData(); - sim.UUID = new LLUUID((string) requestData["UUID"]); - sim.originUUID = new LLUUID((string) requestData["originUUID"]); + sim.UUID = new LLUUID((string)requestData["UUID"]); + sim.originUUID = new LLUUID((string)requestData["originUUID"]); sim.regionRecvKey = String.Empty; sim.regionSendKey = String.Empty; - + if (requestData.ContainsKey("region_secret")) { - string regionsecret = (string) requestData["region_secret"]; + string regionsecret = (string)requestData["region_secret"]; if (regionsecret.Length > 0) sim.regionSecret = regionsecret; else sim.regionSecret = Config.SimRecvKey; + } else { sim.regionSecret = Config.SimRecvKey; } - - + + sim.regionDataURI = String.Empty; sim.regionAssetURI = Config.DefaultAssetServer; sim.regionAssetRecvKey = Config.AssetRecvKey; @@ -549,16 +548,16 @@ namespace OpenSim.Grid.GridServer sim.regionUserSendKey = Config.UserSendKey; sim.regionUserRecvKey = Config.UserRecvKey; - sim.serverIP = (string) requestData["sim_ip"]; - sim.serverPort = Convert.ToUInt32((string) requestData["sim_port"]); - sim.httpPort = Convert.ToUInt32((string) requestData["http_port"]); - sim.remotingPort = Convert.ToUInt32((string) requestData["remoting_port"]); - sim.regionLocX = Convert.ToUInt32((string) requestData["region_locx"]); - sim.regionLocY = Convert.ToUInt32((string) requestData["region_locy"]); + sim.serverIP = (string)requestData["sim_ip"]; + sim.serverPort = Convert.ToUInt32((string)requestData["sim_port"]); + sim.httpPort = Convert.ToUInt32((string)requestData["http_port"]); + sim.remotingPort = Convert.ToUInt32((string)requestData["remoting_port"]); + sim.regionLocX = Convert.ToUInt32((string)requestData["region_locx"]); + sim.regionLocY = Convert.ToUInt32((string)requestData["region_locy"]); sim.regionLocZ = 0; LLUUID textureID; - if (LLUUID.TryParse((string) requestData["map-image-id"], out textureID)) + if (LLUUID.TryParse((string)requestData["map-image-id"], out textureID)) { sim.regionMapTextureID = textureID; } @@ -571,23 +570,21 @@ namespace OpenSim.Grid.GridServer // // this particular section of the mod attempts to receive a value from the region's xml file by way of // OSG1GridServices for the region's owner - sim.owner_uuid = (string) requestData["master_avatar_uuid"]; + sim.owner_uuid = (string)requestData["master_avatar_uuid"]; try { - sim.regionRecvKey = (string) requestData["recvkey"]; - sim.regionSendKey = (string) requestData["authkey"]; - } - catch (KeyNotFoundException) - { + sim.regionRecvKey = (string)requestData["recvkey"]; + sim.regionSendKey = (string)requestData["authkey"]; } + catch (KeyNotFoundException) { } sim.regionHandle = Helpers.UIntsToLong((sim.regionLocX * Constants.RegionSize), (sim.regionLocY * Constants.RegionSize)); - sim.serverURI = (string) requestData["server_uri"]; + sim.serverURI = (string)requestData["server_uri"]; sim.httpServerURI = "http://" + sim.serverIP + ":" + sim.httpPort + "/"; - sim.regionName = (string) requestData["sim_name"]; + sim.regionName = (string)requestData["sim_name"]; return sim; } @@ -607,7 +604,7 @@ namespace OpenSim.Grid.GridServer //RegionProfileData TheSim = null; string uuid; - Hashtable requestData = (Hashtable) request.Params[0]; + Hashtable requestData = (Hashtable)request.Params[0]; if (requestData.ContainsKey("UUID")) { @@ -627,7 +624,7 @@ namespace OpenSim.Grid.GridServer //OpenSim.Data.MySQL.MySQLGridData dbengine = new OpenSim.Data.MySQL.MySQLGridData(); try { - MySQLGridData mysqldata = (MySQLGridData) (kvp.Value); + MySQLGridData mysqldata = (MySQLGridData)(kvp.Value); //DataResponse insertResponse = mysqldata.DeleteProfile(TheSim); DataResponse insertResponse = mysqldata.DeleteProfile(uuid); switch (insertResponse) @@ -667,22 +664,22 @@ namespace OpenSim.Grid.GridServer /// public XmlRpcResponse XmlRpcSimulatorDataRequestMethod(XmlRpcRequest request) { - Hashtable requestData = (Hashtable) request.Params[0]; + Hashtable requestData = (Hashtable)request.Params[0]; Hashtable responseData = new Hashtable(); RegionProfileData simData = null; if (requestData.ContainsKey("region_UUID")) { - simData = GetRegion(new LLUUID((string) requestData["region_UUID"])); + simData = GetRegion(new LLUUID((string)requestData["region_UUID"])); } else if (requestData.ContainsKey("region_handle")) { //CFK: The if/else below this makes this message redundant. //CFK: Console.WriteLine("requesting data for region " + (string) requestData["region_handle"]); - simData = GetRegion(Convert.ToUInt64((string) requestData["region_handle"])); + simData = GetRegion(Convert.ToUInt64((string)requestData["region_handle"])); } else if (requestData.ContainsKey("region_name_search")) { - simData = GetRegion((string) requestData["region_name_search"]); + simData = GetRegion((string)requestData["region_name_search"]); } if (simData == null) @@ -693,8 +690,8 @@ namespace OpenSim.Grid.GridServer } else { - m_log.Info("[DATA]: found " + simData.regionName + " regionHandle = " + - (string) requestData["region_handle"]); + m_log.Info("[DATA]: found " + (string)simData.regionName + " regionHandle = " + + (string)requestData["region_handle"]); responseData["sim_ip"] = Util.GetHostFromDNS(simData.serverIP).ToString(); responseData["sim_port"] = simData.serverPort.ToString(); responseData["server_uri"] = simData.serverURI; @@ -716,22 +713,22 @@ namespace OpenSim.Grid.GridServer { int xmin = 980, ymin = 980, xmax = 1020, ymax = 1020; - Hashtable requestData = (Hashtable) request.Params[0]; + Hashtable requestData = (Hashtable)request.Params[0]; if (requestData.ContainsKey("xmin")) { - xmin = (Int32) requestData["xmin"]; + xmin = (Int32)requestData["xmin"]; } if (requestData.ContainsKey("ymin")) { - ymin = (Int32) requestData["ymin"]; + ymin = (Int32)requestData["ymin"]; } if (requestData.ContainsKey("xmax")) { - xmax = (Int32) requestData["xmax"]; + xmax = (Int32)requestData["xmax"]; } if (requestData.ContainsKey("ymax")) { - ymax = (Int32) requestData["ymax"]; + ymax = (Int32)requestData["ymax"]; } //CFK: The second log is more meaningful and either standard or fast generally occurs. //CFK: m_log.Info("[MAP]: World map request for range (" + xmin + "," + ymin + ")..(" + xmax + "," + ymax + ")"); @@ -746,15 +743,15 @@ namespace OpenSim.Grid.GridServer if (fastMode) { Dictionary neighbours = - GetRegions((uint) xmin, (uint) ymin, (uint) xmax, (uint) ymax); + GetRegions((uint)xmin, (uint)ymin, (uint)xmax, (uint)ymax); foreach (KeyValuePair aSim in neighbours) { Hashtable simProfileBlock = new Hashtable(); simProfileBlock["x"] = aSim.Value.regionLocX.ToString(); simProfileBlock["y"] = aSim.Value.regionLocY.ToString(); - Console.WriteLine("send neighbour info for " + aSim.Value.regionLocX + " , " + - aSim.Value.regionLocY); + Console.WriteLine("send neighbour info for " + aSim.Value.regionLocX.ToString() + " , " + + aSim.Value.regionLocY.ToString()); simProfileBlock["name"] = aSim.Value.regionName; simProfileBlock["access"] = 21; simProfileBlock["region-flags"] = 512; @@ -764,15 +761,15 @@ namespace OpenSim.Grid.GridServer // For Sugilite compatibility simProfileBlock["regionhandle"] = aSim.Value.regionHandle.ToString(); - simProfileBlock["sim_ip"] = aSim.Value.serverIP; + simProfileBlock["sim_ip"] = aSim.Value.serverIP.ToString(); simProfileBlock["sim_port"] = aSim.Value.serverPort.ToString(); - simProfileBlock["sim_uri"] = aSim.Value.serverURI; + simProfileBlock["sim_uri"] = aSim.Value.serverURI.ToString(); simProfileBlock["uuid"] = aSim.Value.UUID.ToString(); simProfileBlock["remoting_port"] = aSim.Value.remotingPort; simProfileList.Add(simProfileBlock); } - m_log.Info("[MAP]: Fast map " + simProfileList.Count + + m_log.Info("[MAP]: Fast map " + simProfileList.Count.ToString() + " regions @ (" + xmin + "," + ymin + ")..(" + xmax + "," + ymax + ")"); } else @@ -782,7 +779,7 @@ namespace OpenSim.Grid.GridServer { for (int y = ymin; y < ymax + 1; y++) { - ulong regHandle = Helpers.UIntsToLong((uint) (x * Constants.RegionSize), (uint) (y * Constants.RegionSize)); + ulong regHandle = Helpers.UIntsToLong((uint)(x * Constants.RegionSize), (uint)(y * Constants.RegionSize)); simProfile = GetRegion(regHandle); if (simProfile != null) { @@ -798,16 +795,16 @@ namespace OpenSim.Grid.GridServer // For Sugilite compatibility simProfileBlock["regionhandle"] = simProfile.regionHandle.ToString(); - simProfileBlock["sim_ip"] = simProfile.serverIP; + simProfileBlock["sim_ip"] = simProfile.serverIP.ToString(); simProfileBlock["sim_port"] = simProfile.serverPort.ToString(); - simProfileBlock["sim_uri"] = simProfile.serverURI; + simProfileBlock["sim_uri"] = simProfile.serverURI.ToString(); simProfileBlock["uuid"] = simProfile.UUID.ToString(); simProfileList.Add(simProfileBlock); } } } - m_log.Info("[MAP]: Std map " + simProfileList.Count + + m_log.Info("[MAP]: Std map " + simProfileList.Count.ToString() + " regions @ (" + xmin + "," + ymin + ")..(" + xmax + "," + ymax + ")"); } @@ -863,12 +860,12 @@ namespace OpenSim.Grid.GridServer respstring = ""; respstring += "" + TheSim.regionSendKey + ""; respstring += ""; - respstring += "" + TheSim.UUID + ""; + respstring += "" + TheSim.UUID.ToString() + ""; respstring += "" + TheSim.regionName + ""; - respstring += "" + Util.GetHostFromDNS(TheSim.serverIP) + ""; - respstring += "" + TheSim.serverPort + ""; - respstring += "" + TheSim.regionLocX + ""; - respstring += "" + TheSim.regionLocY + ""; + respstring += "" + Util.GetHostFromDNS(TheSim.serverIP).ToString() + ""; + respstring += "" + TheSim.serverPort.ToString() + ""; + respstring += "" + TheSim.regionLocX.ToString() + ""; + respstring += "" + TheSim.regionLocY.ToString() + ""; respstring += "1"; respstring += ""; respstring += ""; @@ -949,12 +946,12 @@ namespace OpenSim.Grid.GridServer break; case "region_locx": - theSim.regionLocX = Convert.ToUInt32(simnode.ChildNodes[i].InnerText); + theSim.regionLocX = Convert.ToUInt32((string)simnode.ChildNodes[i].InnerText); theSim.regionHandle = Helpers.UIntsToLong((theSim.regionLocX * Constants.RegionSize), (theSim.regionLocY * Constants.RegionSize)); break; case "region_locy": - theSim.regionLocY = Convert.ToUInt32(simnode.ChildNodes[i].InnerText); + theSim.regionLocY = Convert.ToUInt32((string)simnode.ChildNodes[i].InnerText); theSim.regionHandle = Helpers.UIntsToLong((theSim.regionLocX * Constants.RegionSize), (theSim.regionLocY * Constants.RegionSize)); break; } @@ -1008,28 +1005,28 @@ namespace OpenSim.Grid.GridServer catch (Exception e) { m_log.Warn("[GRID]: GetRegionPlugin Handle " + kvp.Key + " unable to add new sim: " + - e); + e.ToString()); } } return "OK"; } catch (Exception e) { - return "ERROR! Could not save to database! (" + e + ")"; + return "ERROR! Could not save to database! (" + e.ToString() + ")"; } } public XmlRpcResponse XmlRPCRegisterMessageServer(XmlRpcRequest request) { XmlRpcResponse response = new XmlRpcResponse(); - Hashtable requestData = (Hashtable) request.Params[0]; + Hashtable requestData = (Hashtable)request.Params[0]; Hashtable responseData = new Hashtable(); if (requestData.Contains("uri")) { - string URI = (string) requestData["URI"]; - string sendkey = (string) requestData["sendkey"]; - string recvkey = (string) requestData["recvkey"]; + string URI = (string)requestData["URI"]; + string sendkey = (string)requestData["sendkey"]; + string recvkey = (string)requestData["recvkey"]; MessageServerInfo m = new MessageServerInfo(); m.URI = URI; m.sendkey = sendkey; @@ -1045,14 +1042,14 @@ namespace OpenSim.Grid.GridServer public XmlRpcResponse XmlRPCDeRegisterMessageServer(XmlRpcRequest request) { XmlRpcResponse response = new XmlRpcResponse(); - Hashtable requestData = (Hashtable) request.Params[0]; + Hashtable requestData = (Hashtable)request.Params[0]; Hashtable responseData = new Hashtable(); if (requestData.Contains("uri")) { - string URI = (string) requestData["uri"]; - string sendkey = (string) requestData["sendkey"]; - string recvkey = (string) requestData["recvkey"]; + string URI = (string)requestData["uri"]; + string sendkey = (string)requestData["sendkey"]; + string recvkey = (string)requestData["recvkey"]; MessageServerInfo m = new MessageServerInfo(); m.URI = URI; m.sendkey = sendkey; @@ -1065,4 +1062,4 @@ namespace OpenSim.Grid.GridServer return response; } } -} \ No newline at end of file +} diff --git a/OpenSim/Grid/GridServer/GridServerBase.cs b/OpenSim/Grid/GridServer/GridServerBase.cs index ac33a6c..2feaac3 100644 --- a/OpenSim/Grid/GridServer/GridServerBase.cs +++ b/OpenSim/Grid/GridServer/GridServerBase.cs @@ -44,34 +44,6 @@ namespace OpenSim.Grid.GridServer protected GridManager m_gridManager; protected List m_plugins = new List(); - public GridServerBase() - { - m_console = new ConsoleBase("OpenGrid", this); - MainConsole.Instance = m_console; - } - - #region conscmd_callback Members - - public override void RunCmd(string cmd, string[] cmdparams) - { - base.RunCmd(cmd, cmdparams); - - switch (cmd) - { - case "help": - m_console.Notice("shutdown - shutdown the grid (USE CAUTION!)"); - break; - - case "shutdown": - foreach (IGridPlugin plugin in m_plugins) plugin.Close(); - m_console.Close(); - Environment.Exit(0); - break; - } - } - - #endregion - public void Work() { m_console.Notice("Enter help for a list of commands\n"); @@ -82,6 +54,12 @@ namespace OpenSim.Grid.GridServer } } + public GridServerBase() + { + m_console = new ConsoleBase("OpenGrid", this); + MainConsole.Instance = m_console; + } + public void managercallback(string cmd) { switch (cmd) @@ -105,14 +83,14 @@ namespace OpenSim.Grid.GridServer AddHttpHandlers(); - LoadGridPlugins(); + LoadGridPlugins( ); m_httpServer.Start(); m_console.Status("[GRID]: Starting sim status checker"); Timer simCheckTimer = new Timer(3600000 * 3); // 3 Hours between updates. - simCheckTimer.Elapsed += CheckSims; + simCheckTimer.Elapsed += new ElapsedEventHandler(CheckSims); simCheckTimer.Enabled = true; } @@ -144,7 +122,7 @@ namespace OpenSim.Grid.GridServer foreach (TypeExtensionNode node in nodes) { m_console.Status("[GRIDPLUGINS]: Loading OpenSim plugin " + node.Path); - IGridPlugin plugin = (IGridPlugin) node.CreateInstance(); + IGridPlugin plugin = (IGridPlugin)node.CreateInstance(); plugin.Initialise(this); m_plugins.Add(plugin); } @@ -199,5 +177,23 @@ namespace OpenSim.Grid.GridServer } */ } + + public override void RunCmd(string cmd, string[] cmdparams) + { + base.RunCmd(cmd, cmdparams); + + switch (cmd) + { + case "help": + m_console.Notice("shutdown - shutdown the grid (USE CAUTION!)"); + break; + + case "shutdown": + foreach (IGridPlugin plugin in m_plugins) plugin.Close(); + m_console.Close(); + Environment.Exit(0); + break; + } + } } -} \ No newline at end of file +} diff --git a/OpenSim/Grid/GridServer/IGridPlugin.cs b/OpenSim/Grid/GridServer/IGridPlugin.cs index 40d208c..fbadfce 100644 --- a/OpenSim/Grid/GridServer/IGridPlugin.cs +++ b/OpenSim/Grid/GridServer/IGridPlugin.cs @@ -38,4 +38,4 @@ namespace OpenSim.Grid.GridServer void Initialise(GridServerBase gridServer); void Close(); } -} \ No newline at end of file +} diff --git a/OpenSim/Grid/GridServer/Program.cs b/OpenSim/Grid/GridServer/Program.cs index 06d8e3d..6eb4e15 100644 --- a/OpenSim/Grid/GridServer/Program.cs +++ b/OpenSim/Grid/GridServer/Program.cs @@ -50,4 +50,4 @@ namespace OpenSim.Grid.GridServer } } } -} \ No newline at end of file +} diff --git a/OpenSim/Grid/GridServer/Properties/AssemblyInfo.cs b/OpenSim/Grid/GridServer/Properties/AssemblyInfo.cs index 2b07547..1468edd 100644 --- a/OpenSim/Grid/GridServer/Properties/AssemblyInfo.cs +++ b/OpenSim/Grid/GridServer/Properties/AssemblyInfo.cs @@ -60,4 +60,4 @@ using System.Runtime.InteropServices; // [assembly : AssemblyVersion("1.0.0.0")] -[assembly : AssemblyFileVersion("1.0.0.0")] \ No newline at end of file +[assembly : AssemblyFileVersion("1.0.0.0")] diff --git a/OpenSim/Grid/InventoryServer/GridInventoryService.cs b/OpenSim/Grid/InventoryServer/GridInventoryService.cs index c3e3a28..db9a864 100644 --- a/OpenSim/Grid/InventoryServer/GridInventoryService.cs +++ b/OpenSim/Grid/InventoryServer/GridInventoryService.cs @@ -40,7 +40,7 @@ namespace OpenSim.Grid.InventoryServer /// public class GridInventoryService : InventoryServiceBase { - private static readonly ILog m_log + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); public override void RequestInventoryForUser(LLUUID userID, InventoryReceiptCallback callback) @@ -55,7 +55,7 @@ namespace OpenSim.Grid.InventoryServer /// /// true if the inventory was retrieved, false otherwise private bool GetUsersInventory(LLUUID userID, out List folderList, - out List itemsList) + out List itemsList) { List allFolders = GetInventorySkeleton(userID); List allItems = new List(); @@ -109,28 +109,28 @@ namespace OpenSim.Grid.InventoryServer { // uncomment me to simulate an overloaded inventory server //Thread.Sleep(20000); - + LLUUID userID = new LLUUID(rawUserID); - m_log.InfoFormat("[GRID AGENT INVENTORY]: Processing request for inventory of {0}", userID); + m_log.InfoFormat("[GRID AGENT INVENTORY]: Processing request for inventory of {0}", userID); InventoryCollection invCollection = new InventoryCollection(); - + List allFolders = GetInventorySkeleton(userID); - + if (null == allFolders) { m_log.WarnFormat("[GRID AGENT INVENTORY]: No inventory found for user {0}", rawUserID); - + return invCollection; } - + List allItems = new List(); foreach (InventoryFolderBase folder in allFolders) { List items = RequestFolderItems(folder.ID); - + if (items != null) { allItems.InsertRange(0, items); @@ -138,9 +138,9 @@ namespace OpenSim.Grid.InventoryServer } invCollection.UserID = userID; - invCollection.Folders = allFolders; - invCollection.Items = allItems; - + invCollection.Folders = allFolders; + invCollection.Items = allItems; + // foreach (InventoryFolderBase folder in invCollection.Folders) // { // m_log.DebugFormat("[GRID AGENT INVENTORY]: Sending back folder {0} {1}", folder.Name, folder.ID); @@ -150,14 +150,14 @@ namespace OpenSim.Grid.InventoryServer // { // m_log.DebugFormat("[GRID AGENT INVENTORY]: Sending back item {0} {1}, folder {2}", item.Name, item.ID, item.Folder); // } - + m_log.InfoFormat( "[GRID AGENT INVENTORY]: Sending back inventory response to user {0} containing {1} folders and {2} items", - invCollection.UserID, invCollection.Folders.Count, invCollection.Items.Count); - + invCollection.UserID, invCollection.Folders.Count, invCollection.Items.Count); + return invCollection; } - + /// /// Guid to UUID wrapper for same name IInventoryServices method /// @@ -166,10 +166,10 @@ namespace OpenSim.Grid.InventoryServer public List GetInventorySkeleton(Guid rawUserID) { //Thread.Sleep(10000); - + LLUUID userID = new LLUUID(rawUserID); return GetInventorySkeleton(userID); - } + } /// /// Create an inventory for the given user. @@ -196,11 +196,11 @@ namespace OpenSim.Grid.InventoryServer { MoveFolder(folder); } - + public override void PurgeInventoryFolder(LLUUID userID, InventoryFolderBase folder) { - PurgeFolder(folder); - } + PurgeFolder(folder); + } public override void AddNewInventoryItem(LLUUID userID, InventoryItemBase item) { @@ -230,15 +230,15 @@ namespace OpenSim.Grid.InventoryServer MoveExistingInventoryFolder(folder); return true; } - + public bool PurgeInventoryFolder(InventoryFolderBase folder) { m_log.InfoFormat( "[GRID AGENT INVENTORY]: Purging folder {0} {1} of its contents", folder.Name, folder.ID); - + PurgeInventoryFolder(folder.Owner, folder); return true; - } + } public bool AddInventoryItem(InventoryItemBase item) { @@ -267,4 +267,4 @@ namespace OpenSim.Grid.InventoryServer return true; } } -} \ No newline at end of file +} diff --git a/OpenSim/Grid/InventoryServer/InventoryManager.cs b/OpenSim/Grid/InventoryServer/InventoryManager.cs index 350a618..5c65317 100644 --- a/OpenSim/Grid/InventoryServer/InventoryManager.cs +++ b/OpenSim/Grid/InventoryServer/InventoryManager.cs @@ -54,7 +54,7 @@ namespace OpenSim.Grid.InventoryServer Assembly pluginAssembly = Assembly.LoadFrom(FileName); m_log.Info("[" + OpenInventory_Main.LogName + "]: " + - "Invenstorage: Found " + pluginAssembly.GetTypes().Length + " interfaces."); + "Invenstorage: Found " + pluginAssembly.GetTypes().Length + " interfaces."); foreach (Type pluginType in pluginAssembly.GetTypes()) { if (!pluginType.IsAbstract) @@ -68,7 +68,7 @@ namespace OpenSim.Grid.InventoryServer plug.Initialise(dbconnect); _databasePlugin = plug; m_log.Info("[" + OpenInventory_Main.LogName + "]: " + - "Invenstorage: Added IInventoryData Interface"); + "Invenstorage: Added IInventoryData Interface"); break; } } @@ -136,12 +136,10 @@ namespace OpenSim.Grid.InventoryServer return fixupFolder(inventory.root, null); } - #region Nested type: GetInventory - public class GetInventory : BaseStreamHandler { - private readonly SerializableInventory _inventory; - private readonly InventoryManager _manager; + private SerializableInventory _inventory; + private InventoryManager _manager; public GetInventory(InventoryManager manager) : base("GET", "/inventory") @@ -183,7 +181,7 @@ namespace OpenSim.Grid.InventoryServer { byte[] result = new byte[] {}; - string[] parms = path.Split(new[] {'/'}, StringSplitOptions.RemoveEmptyEntries); + string[] parms = path.Split(new char[] {'/'}, StringSplitOptions.RemoveEmptyEntries); if (parms.Length > 1) { if (string.Compare(parms[1], "library", true) == 0) @@ -192,7 +190,7 @@ namespace OpenSim.Grid.InventoryServer saveInventoryToStream(_inventory, ms); result = ms.GetBuffer(); - Array.Resize(ref result, (int) ms.Length); + Array.Resize(ref result, (int) ms.Length); } else if (string.Compare(parms[1], "user", true) == 0) { @@ -205,7 +203,5 @@ namespace OpenSim.Grid.InventoryServer return result; } } - - #endregion } -} \ No newline at end of file +} diff --git a/OpenSim/Grid/InventoryServer/Main.cs b/OpenSim/Grid/InventoryServer/Main.cs index 453d64d..870997b 100644 --- a/OpenSim/Grid/InventoryServer/Main.cs +++ b/OpenSim/Grid/InventoryServer/Main.cs @@ -40,38 +40,13 @@ namespace OpenSim.Grid.InventoryServer { public class OpenInventory_Main : BaseOpenSimServer, conscmd_callback { - public const string LogName = "INVENTORY"; private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - private InventoryConfig m_config; private InventoryManager m_inventoryManager; + private InventoryConfig m_config; private GridInventoryService m_inventoryService; - public OpenInventory_Main() - { - m_console = new ConsoleBase(LogName, this); - MainConsole.Instance = m_console; - } - - #region conscmd_callback Members - - public override void RunCmd(string cmd, string[] cmdparams) - { - base.RunCmd(cmd, cmdparams); - - switch (cmd) - { - case "add-user": - m_inventoryService.CreateUsersInventory(LLUUID.Random().UUID); - break; - case "shutdown": - m_console.Close(); - Environment.Exit(0); - break; - } - } - - #endregion + public const string LogName = "INVENTORY"; [STAThread] public static void Main(string[] args) @@ -84,6 +59,12 @@ namespace OpenSim.Grid.InventoryServer theServer.Work(); } + public OpenInventory_Main() + { + m_console = new ConsoleBase(LogName, this); + MainConsole.Instance = m_console; + } + public void Startup() { m_log.Info("Initialising inventory manager..."); @@ -94,7 +75,7 @@ namespace OpenSim.Grid.InventoryServer m_inventoryService.AddPlugin(m_config.DatabaseProvider, m_config.DatabaseConnect); m_log.Info("[" + LogName + "]: Starting HTTP server ..."); - + m_httpServer = new BaseHttpServer(m_config.HttpPort); AddHttpHandlers(); m_httpServer.Start(); @@ -107,11 +88,11 @@ namespace OpenSim.Grid.InventoryServer m_httpServer.AddStreamHandler( new RestDeserialisehandler( "POST", "/GetInventory/", m_inventoryService.GetUserInventory)); - + m_httpServer.AddStreamHandler( new RestDeserialisehandler( "POST", "/CreateInventory/", m_inventoryService.CreateUsersInventory)); - + m_httpServer.AddStreamHandler( new RestDeserialisehandler( "POST", "/NewFolder/", m_inventoryService.AddInventoryFolder)); @@ -119,15 +100,15 @@ namespace OpenSim.Grid.InventoryServer m_httpServer.AddStreamHandler( new RestDeserialisehandler( "POST", "/MoveFolder/", m_inventoryService.MoveInventoryFolder)); - + m_httpServer.AddStreamHandler( new RestDeserialisehandler( - "POST", "/PurgeFolder/", m_inventoryService.PurgeInventoryFolder)); + "POST", "/PurgeFolder/", m_inventoryService.PurgeInventoryFolder)); m_httpServer.AddStreamHandler( new RestDeserialisehandler( "POST", "/NewItem/", m_inventoryService.AddInventoryItem)); - + m_httpServer.AddStreamHandler( new RestDeserialisehandler( "POST", "/DeleteItem/", m_inventoryService.DeleteInvItem)); @@ -153,5 +134,21 @@ namespace OpenSim.Grid.InventoryServer m_console.Prompt(); } } + + public override void RunCmd(string cmd, string[] cmdparams) + { + base.RunCmd(cmd, cmdparams); + + switch (cmd) + { + case "add-user": + m_inventoryService.CreateUsersInventory(LLUUID.Random().UUID); + break; + case "shutdown": + m_console.Close(); + Environment.Exit(0); + break; + } + } } -} \ No newline at end of file +} diff --git a/OpenSim/Grid/MessagingServer/Main.cs b/OpenSim/Grid/MessagingServer/Main.cs index e6e18d4..bf793bf 100644 --- a/OpenSim/Grid/MessagingServer/Main.cs +++ b/OpenSim/Grid/MessagingServer/Main.cs @@ -44,42 +44,9 @@ namespace OpenSim.Grid.MessagingServer private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private MessageServerConfig Cfg; - - private LLUUID m_lastCreatedUser = LLUUID.Random(); private MessageService msgsvc; - - private OpenMessage_Main() - { - m_console = new ConsoleBase("OpenMessage", this); - MainConsole.Instance = m_console; - } - - #region conscmd_callback Members - - public override void RunCmd(string cmd, string[] cmdparams) - { - base.RunCmd(cmd, cmdparams); - - switch (cmd) - { - case "help": - m_console.Notice("shutdown - shutdown the message server (USE CAUTION!)"); - break; - - case "shutdown": - msgsvc.deregisterWithUserServer(); - m_console.Close(); - Environment.Exit(0); - break; - } - } - - public override void Show(string ShowWhat) - { - base.Show(ShowWhat); - } - - #endregion + + private LLUUID m_lastCreatedUser = LLUUID.Random(); [STAThread] public static void Main(string[] args) @@ -88,6 +55,7 @@ namespace OpenSim.Grid.MessagingServer m_log.Info("Launching MessagingServer..."); + OpenMessage_Main messageserver = new OpenMessage_Main(); @@ -95,6 +63,12 @@ namespace OpenSim.Grid.MessagingServer messageserver.Work(); } + private OpenMessage_Main() + { + m_console = new ConsoleBase("OpenMessage", this); + MainConsole.Instance = m_console; + } + private void Work() { m_console.Notice("Enter help for a list of commands\n"); @@ -144,13 +118,12 @@ namespace OpenSim.Grid.MessagingServer switch (what) { case "user": - + try { //userID = - //m_userManager.AddUserProfile(tempfirstname, templastname, tempMD5Passwd, regX, regY); - } - catch (Exception ex) + //m_userManager.AddUserProfile(tempfirstname, templastname, tempMD5Passwd, regX, regY); + } catch (Exception ex) { m_console.Error("[SERVER]: Error creating user: {0}", ex.ToString()); } @@ -158,7 +131,7 @@ namespace OpenSim.Grid.MessagingServer try { //RestObjectPoster.BeginPostObject(m_userManager._config.InventoryUrl + "CreateInventory/", - //userID.UUID); + //userID.UUID); } catch (Exception ex) { @@ -168,5 +141,28 @@ namespace OpenSim.Grid.MessagingServer break; } } + + public override void RunCmd(string cmd, string[] cmdparams) + { + base.RunCmd(cmd, cmdparams); + + switch (cmd) + { + case "help": + m_console.Notice("shutdown - shutdown the message server (USE CAUTION!)"); + break; + + case "shutdown": + msgsvc.deregisterWithUserServer(); + m_console.Close(); + Environment.Exit(0); + break; + } + } + + public override void Show(string ShowWhat) + { + base.Show(ShowWhat); + } } -} \ No newline at end of file +} diff --git a/OpenSim/Grid/MessagingServer/MessageService.cs b/OpenSim/Grid/MessagingServer/MessageService.cs index 33c133d..50e06af 100644 --- a/OpenSim/Grid/MessagingServer/MessageService.cs +++ b/OpenSim/Grid/MessagingServer/MessageService.cs @@ -45,16 +45,16 @@ namespace OpenSim.Grid.MessagingServer { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - private readonly MessageServerConfig m_cfg; - private readonly Hashtable m_presence_BackReferences = new Hashtable(); + private MessageServerConfig m_cfg; //A hashtable of all current presences this server knows about - private readonly Hashtable m_presences = new Hashtable(); + private Hashtable m_presences = new Hashtable(); //a hashtable of all current regions this server knows about - private readonly Hashtable m_regionInfoCache = new Hashtable(); + private Hashtable m_regionInfoCache = new Hashtable(); //A hashtable containing lists of UUIDs keyed by UUID for fast backreferencing + private Hashtable m_presence_BackReferences = new Hashtable(); // Hashtable containing work units that need to be processed private Hashtable m_unProcessedWorkUnits = new Hashtable(); @@ -63,13 +63,13 @@ namespace OpenSim.Grid.MessagingServer { m_cfg = cfg; } - + #region RegionComms Methods #endregion #region FriendList Methods - + /// /// Process Friendlist subscriptions for a user /// The login method calls this for a User @@ -87,14 +87,14 @@ namespace OpenSim.Grid.MessagingServer for (int i = 0; i < uFriendList.Count; i++) { //m_presence_BackReferences.Add(userpresence.agentData.AgentID, uFriendList[i].Friend); - // m_presence_BackReferences.Add(uFriendList[i].Friend, userpresence.agentData.AgentID); + // m_presence_BackReferences.Add(uFriendList[i].Friend, userpresence.agentData.AgentID); if (m_presences.Contains(uFriendList[i].Friend)) { - UserPresenceData friendup = (UserPresenceData) m_presences[uFriendList[i].Friend]; + UserPresenceData friendup = (UserPresenceData)m_presences[uFriendList[i].Friend]; // Add backreference - - SubscribeToPresenceUpdates(userpresence, friendup, uFriendList[i], i); + + SubscribeToPresenceUpdates(userpresence, friendup, uFriendList[i],i); } } } @@ -108,10 +108,10 @@ namespace OpenSim.Grid.MessagingServer /// P2 /// /// - public void SubscribeToPresenceUpdates(UserPresenceData userpresence, UserPresenceData friendpresence, - FriendListItem uFriendListItem, int uFriendListIndex) + public void SubscribeToPresenceUpdates(UserPresenceData userpresence, UserPresenceData friendpresence, + FriendListItem uFriendListItem, int uFriendListIndex) { - if ((uFriendListItem.FriendListOwnerPerms & (uint) FriendRights.CanSeeOnline) != 0) + if ((uFriendListItem.FriendListOwnerPerms & (uint)FriendRights.CanSeeOnline) != 0) { // Subscribe and Send Out updates if (!friendpresence.subscriptionData.Contains(friendpresence.agentData.AgentID)) @@ -126,13 +126,13 @@ namespace OpenSim.Grid.MessagingServer PresenceInformer friendlistupdater = new PresenceInformer(); friendlistupdater.presence1 = friendpresence; friendlistupdater.presence2 = userpresence; - WaitCallback cb = friendlistupdater.go; + WaitCallback cb = new WaitCallback(friendlistupdater.go); ThreadPool.QueueUserWorkItem(cb); //SendRegionPresenceUpdate(friendpresence, userpresence); } - if ((uFriendListItem.FriendPerms & (uint) FriendRights.CanSeeOnline) != 0) + if ((uFriendListItem.FriendPerms & (uint)FriendRights.CanSeeOnline) != 0) { if (!friendpresence.subscriptionData.Contains(userpresence.agentData.AgentID)) { @@ -147,9 +147,9 @@ namespace OpenSim.Grid.MessagingServer friendlistupdater.presence1 = userpresence; friendlistupdater.presence2 = friendpresence; - WaitCallback cb2 = friendlistupdater.go; + WaitCallback cb2 = new WaitCallback(friendlistupdater.go); ThreadPool.QueueUserWorkItem(cb2); - + //SendRegionPresenceUpdate(userpresence, friendpresence); } } @@ -164,7 +164,7 @@ namespace OpenSim.Grid.MessagingServer { if (m_presence_BackReferences.Contains(friendID)) { - List presenseBackReferences = (List) m_presence_BackReferences[friendID]; + List presenseBackReferences = (List)m_presence_BackReferences[friendID]; if (!presenseBackReferences.Contains(agentID)) { presenseBackReferences.Add(agentID); @@ -188,7 +188,7 @@ namespace OpenSim.Grid.MessagingServer { if (m_presence_BackReferences.Contains(friendID)) { - List presenseBackReferences = (List) m_presence_BackReferences[friendID]; + List presenseBackReferences = (List)m_presence_BackReferences[friendID]; if (presenseBackReferences.Contains(agentID)) { presenseBackReferences.Remove(agentID); @@ -216,29 +216,29 @@ namespace OpenSim.Grid.MessagingServer { if (m_presences.Contains(AgentID)) { - AgentData = (UserPresenceData) m_presences[AgentID]; + AgentData = (UserPresenceData)m_presences[AgentID]; } } if (AgentData != null) { - AgentsNeedingNotification = AgentData.subscriptionData; + AgentsNeedingNotification = AgentData.subscriptionData; //lock (m_presence_BackReferences) //{ - //if (m_presence_BackReferences.Contains(AgentID)) - //{ - //AgentsNeedingNotification = (List)m_presence_BackReferences[AgentID]; - //} + //if (m_presence_BackReferences.Contains(AgentID)) + //{ + //AgentsNeedingNotification = (List)m_presence_BackReferences[AgentID]; + //} //} for (int i = 0; i < AgentsNeedingNotification.Count; i++) { // TODO: Do Region Notifications - lock (m_presences) + lock(m_presences) { if (m_presences.Contains(AgentsNeedingNotification[i])) { - friendd = (UserPresenceData) m_presences[AgentsNeedingNotification[i]]; + friendd = (UserPresenceData)m_presences[AgentsNeedingNotification[i]]; } } @@ -266,7 +266,7 @@ namespace OpenSim.Grid.MessagingServer friendlistupdater.presence1 = AgentData; friendlistupdater.presence2 = friendd; - WaitCallback cb3 = friendlistupdater.go; + WaitCallback cb3 = new WaitCallback(friendlistupdater.go); ThreadPool.QueueUserWorkItem(cb3); //SendRegionPresenceUpdate(AgentData, friendd); @@ -276,7 +276,7 @@ namespace OpenSim.Grid.MessagingServer } } } - + #endregion #region UserServer Comms @@ -298,17 +298,18 @@ namespace OpenSim.Grid.MessagingServer parameters.Add(param); XmlRpcRequest req = new XmlRpcRequest("get_user_friend_list", parameters); XmlRpcResponse resp = req.Send(m_cfg.UserServerURL, 3000); - Hashtable respData = (Hashtable) resp.Value; + Hashtable respData = (Hashtable)resp.Value; if (respData.Contains("avcount")) { buddylist = ConvertXMLRPCDataToFriendListItemList(respData); } + } catch (WebException e) { m_log.Warn("Error when trying to fetch Avatar's friends list: " + - e.Message); + e.Message); // Return Empty list (no friends) } return buddylist; @@ -322,16 +323,16 @@ namespace OpenSim.Grid.MessagingServer public List ConvertXMLRPCDataToFriendListItemList(Hashtable data) { List buddylist = new List(); - int buddycount = Convert.ToInt32((string) data["avcount"]); + int buddycount = Convert.ToInt32((string)data["avcount"]); for (int i = 0; i < buddycount; i++) { FriendListItem buddylistitem = new FriendListItem(); - buddylistitem.FriendListOwner = new LLUUID((string) data["ownerID" + i]); - buddylistitem.Friend = new LLUUID((string) data["friendID" + i]); - buddylistitem.FriendListOwnerPerms = (uint) Convert.ToInt32((string) data["ownerPerms" + i]); - buddylistitem.FriendPerms = (uint) Convert.ToInt32((string) data["friendPerms" + i]); + buddylistitem.FriendListOwner = new LLUUID((string)data["ownerID" + i.ToString()]); + buddylistitem.Friend = new LLUUID((string)data["friendID" + i.ToString()]); + buddylistitem.FriendListOwnerPerms = (uint)Convert.ToInt32((string)data["ownerPerms" + i.ToString()]); + buddylistitem.FriendPerms = (uint)Convert.ToInt32((string)data["friendPerms" + i.ToString()]); buddylist.Add(buddylistitem); } @@ -349,7 +350,7 @@ namespace OpenSim.Grid.MessagingServer public XmlRpcResponse UserLoggedOn(XmlRpcRequest request) { m_log.Info("[LOGON]: User logged on, building indexes for user"); - Hashtable requestData = (Hashtable) request.Params[0]; + Hashtable requestData = (Hashtable)request.Params[0]; //requestData["sendkey"] = serv.sendkey; //requestData["agentid"] = agentID.ToString(); @@ -363,13 +364,13 @@ namespace OpenSim.Grid.MessagingServer //requestData["lastname"] = lastname; AgentCircuitData agentData = new AgentCircuitData(); - agentData.SessionID = new LLUUID((string) requestData["sessionid"]); - agentData.SecureSessionID = new LLUUID((string) requestData["secure_session_id"]); - agentData.firstname = (string) requestData["firstname"]; - agentData.lastname = (string) requestData["lastname"]; - agentData.AgentID = new LLUUID((string) requestData["agentid"]); + agentData.SessionID = new LLUUID((string)requestData["sessionid"]); + agentData.SecureSessionID = new LLUUID((string)requestData["secure_session_id"]); + agentData.firstname = (string)requestData["firstname"]; + agentData.lastname = (string)requestData["lastname"]; + agentData.AgentID = new LLUUID((string)requestData["agentid"]); agentData.circuitcode = Convert.ToUInt32(requestData["circuit_code"]); - agentData.CapsPath = (string) requestData["caps_path"]; + agentData.CapsPath = (string)requestData["caps_path"]; if (requestData.ContainsKey("child_agent") && requestData["child_agent"].Equals("1")) { @@ -378,13 +379,13 @@ namespace OpenSim.Grid.MessagingServer else { agentData.startpos = - new LLVector3(Convert.ToUInt32(requestData["positionx"]), + new LLVector3(Convert.ToUInt32(requestData["positionx"]), Convert.ToUInt32(requestData["positiony"]), Convert.ToUInt32(requestData["positionz"])); agentData.child = false; } - ulong regionHandle = Convert.ToUInt64((string) requestData["regionhandle"]); + ulong regionHandle = Convert.ToUInt64((string)requestData["regionhandle"]); UserPresenceData up = new UserPresenceData(); up.agentData = agentData; @@ -397,7 +398,7 @@ namespace OpenSim.Grid.MessagingServer return new XmlRpcResponse(); } - + /// /// The UserServer got a Logoff message /// Cleanup time for that user. Send out presence notifications @@ -406,9 +407,9 @@ namespace OpenSim.Grid.MessagingServer /// public XmlRpcResponse UserLoggedOff(XmlRpcRequest request) { - Hashtable requestData = (Hashtable) request.Params[0]; - - LLUUID AgentID = new LLUUID((string) requestData["agentid"]); + Hashtable requestData = (Hashtable)request.Params[0]; + + LLUUID AgentID = new LLUUID((string)requestData["agentid"]); ProcessLogOff(AgentID); @@ -430,9 +431,9 @@ namespace OpenSim.Grid.MessagingServer RegionProfileData regionInfo = null; if (m_regionInfoCache.Contains(regionhandle)) { - regionInfo = (RegionProfileData) m_regionInfoCache[regionhandle]; + regionInfo = (RegionProfileData)m_regionInfoCache[regionhandle]; } - else + else { regionInfo = RequestRegionInfo(regionhandle); } @@ -446,8 +447,7 @@ namespace OpenSim.Grid.MessagingServer /// /// public RegionProfileData RequestRegionInfo(ulong regionHandle) - { - RegionProfileData regionProfile = null; + { RegionProfileData regionProfile = null; try { Hashtable requestData = new Hashtable(); @@ -457,8 +457,8 @@ namespace OpenSim.Grid.MessagingServer SendParams.Add(requestData); XmlRpcRequest GridReq = new XmlRpcRequest("simulator_data_request", SendParams); XmlRpcResponse GridResp = GridReq.Send(m_cfg.GridServerURL, 3000); - - Hashtable responseData = (Hashtable) GridResp.Value; + + Hashtable responseData = (Hashtable)GridResp.Value; if (responseData.ContainsKey("error")) { @@ -466,23 +466,23 @@ namespace OpenSim.Grid.MessagingServer return null; } - uint regX = Convert.ToUInt32((string) responseData["region_locx"]); - uint regY = Convert.ToUInt32((string) responseData["region_locy"]); - string internalIpStr = (string) responseData["sim_ip"]; + uint regX = Convert.ToUInt32((string)responseData["region_locx"]); + uint regY = Convert.ToUInt32((string)responseData["region_locy"]); + string internalIpStr = (string)responseData["sim_ip"]; uint port = Convert.ToUInt32(responseData["sim_port"]); - string externalUri = (string) responseData["sim_uri"]; + string externalUri = (string)responseData["sim_uri"]; string neighbourExternalUri = externalUri; regionProfile = new RegionProfileData(); - regionProfile.httpPort = (uint) Convert.ToInt32((string) responseData["http_port"]); + regionProfile.httpPort = (uint)Convert.ToInt32((string)responseData["http_port"]); regionProfile.httpServerURI = "http://" + internalIpStr + ":" + regionProfile.httpPort + "/"; regionProfile.regionHandle = Helpers.UIntsToLong((regX * Constants.RegionSize), (regY * Constants.RegionSize)); regionProfile.regionLocX = regX; regionProfile.regionLocY = regY; - - regionProfile.remotingPort = Convert.ToUInt32((string) responseData["remoting_port"]); - regionProfile.UUID = new LLUUID((string) responseData["region_UUID"]); - regionProfile.regionName = (string) responseData["region_name"]; + + regionProfile.remotingPort = Convert.ToUInt32((string)responseData["remoting_port"]); + regionProfile.UUID = new LLUUID((string)responseData["region_UUID"]); + regionProfile.regionName = (string)responseData["region_name"]; lock (m_regionInfoCache) { if (!m_regionInfoCache.Contains(regionHandle)) @@ -494,31 +494,31 @@ namespace OpenSim.Grid.MessagingServer catch (WebException) { m_log.Error("[GRID]: " + - "Region lookup failed for: " + regionHandle + + "Region lookup failed for: " + regionHandle.ToString() + " - Is the GridServer down?"); return null; } - + return regionProfile; } - public bool registerWithUserServer() + public bool registerWithUserServer () { Hashtable UserParams = new Hashtable(); // Login / Authentication - + if (m_cfg.HttpSSL) { UserParams["uri"] = "https://" + m_cfg.MessageServerIP + ":" + m_cfg.HttpPort; } - else + else { UserParams["uri"] = "http://" + m_cfg.MessageServerIP + ":" + m_cfg.HttpPort; } UserParams["recvkey"] = m_cfg.UserRecvKey; UserParams["sendkey"] = m_cfg.UserRecvKey; - + // Package into an XMLRPC Request ArrayList SendParams = new ArrayList(); SendParams.Add(UserParams); @@ -530,13 +530,12 @@ namespace OpenSim.Grid.MessagingServer { UserReq = new XmlRpcRequest("register_messageserver", SendParams); UserResp = UserReq.Send(m_cfg.UserServerURL, 16000); - } - catch (Exception ex) + } catch (Exception ex) { m_log.Error("Unable to connect to grid. Grid server not running?"); - throw (ex); + throw(ex); } - Hashtable GridRespData = (Hashtable) UserResp.Value; + Hashtable GridRespData = (Hashtable)UserResp.Value; Hashtable griddatahash = GridRespData; // Process Response @@ -584,7 +583,7 @@ namespace OpenSim.Grid.MessagingServer m_log.Error("Unable to connect to grid. Grid server not running?"); throw (ex); } - Hashtable UserRespData = (Hashtable) UserResp.Value; + Hashtable UserRespData = (Hashtable)UserResp.Value; Hashtable userdatahash = UserRespData; // Process Response @@ -600,4 +599,4 @@ namespace OpenSim.Grid.MessagingServer #endregion } -} \ No newline at end of file +} diff --git a/OpenSim/Grid/MessagingServer/PresenceInformer.cs b/OpenSim/Grid/MessagingServer/PresenceInformer.cs index dd2fa5b..59d0e13 100644 --- a/OpenSim/Grid/MessagingServer/PresenceInformer.cs +++ b/OpenSim/Grid/MessagingServer/PresenceInformer.cs @@ -35,16 +35,21 @@ namespace OpenSim.Grid.MessagingServer { public class PresenceInformer { + public UserPresenceData presence1 = null; + public UserPresenceData presence2 = null; private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - public UserPresenceData presence1; - public UserPresenceData presence2; + public PresenceInformer() + { + + } public void go(object o) { if (presence1 != null && presence2 != null) { SendRegionPresenceUpdate(presence1, presence2); } + } /// @@ -69,4 +74,4 @@ namespace OpenSim.Grid.MessagingServer XmlRpcResponse RegionResp = RegionReq.Send(whichRegion.httpServerURI, 6000); } } -} \ No newline at end of file +} diff --git a/OpenSim/Grid/MessagingServer/UserPresenceData.cs b/OpenSim/Grid/MessagingServer/UserPresenceData.cs index 790e999..7188201 100644 --- a/OpenSim/Grid/MessagingServer/UserPresenceData.cs +++ b/OpenSim/Grid/MessagingServer/UserPresenceData.cs @@ -36,9 +36,13 @@ namespace OpenSim.Grid.MessagingServer public class UserPresenceData { public AgentCircuitData agentData = new AgentCircuitData(); - public List friendData = new List(); - public string httpURI = String.Empty; public RegionProfileData regionData = new RegionProfileData(); + public string httpURI = String.Empty; + public List friendData = new List (); public List subscriptionData = new List(); + + public UserPresenceData() + { + } } -} \ No newline at end of file +} diff --git a/OpenSim/Grid/MessagingServer/WorkUnitBase.cs b/OpenSim/Grid/MessagingServer/WorkUnitBase.cs index 1c1503b..d25f044 100644 --- a/OpenSim/Grid/MessagingServer/WorkUnitBase.cs +++ b/OpenSim/Grid/MessagingServer/WorkUnitBase.cs @@ -30,4 +30,4 @@ namespace OpenSim.Grid.MessagingServer public class WorkUnitBase { } -} \ No newline at end of file +} diff --git a/OpenSim/Grid/MessagingServer/WorkUnitPresenceUpdate.cs b/OpenSim/Grid/MessagingServer/WorkUnitPresenceUpdate.cs index 625a9f6..c31f0c7 100644 --- a/OpenSim/Grid/MessagingServer/WorkUnitPresenceUpdate.cs +++ b/OpenSim/Grid/MessagingServer/WorkUnitPresenceUpdate.cs @@ -30,4 +30,4 @@ namespace OpenSim.Grid.MessagingServer public class WorkUnitPresenceUpdate : WorkUnitBase { } -} \ No newline at end of file +} diff --git a/OpenSim/Grid/MessagingServer/XMPPHTTPService.cs b/OpenSim/Grid/MessagingServer/XMPPHTTPService.cs index 257e802..df3bc22 100644 --- a/OpenSim/Grid/MessagingServer/XMPPHTTPService.cs +++ b/OpenSim/Grid/MessagingServer/XMPPHTTPService.cs @@ -48,26 +48,28 @@ namespace OpenSim.Grid.MessagingServer : base("GET", "/presence") { m_log.Info("[REST]: In Get Request"); + } - + public override byte[] Handle(string path, Stream request) { string param = GetParam(path); byte[] result = new byte[] {}; try { - string[] p = param.Split(new[] {'/', '?', '&'}, StringSplitOptions.RemoveEmptyEntries); + string[] p = param.Split(new char[] {'/', '?', '&'}, StringSplitOptions.RemoveEmptyEntries); if (p.Length > 0) { - LLUUID assetID = null; - + LLUUID assetID = null; + if (!LLUUID.TryParse(p[0], out assetID)) { m_log.InfoFormat( "[REST]: GET:/presence ignoring request with malformed UUID {0}", p[0]); return result; } + } } catch (Exception e) @@ -82,11 +84,6 @@ namespace OpenSim.Grid.MessagingServer { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - public PostXMPPStreamHandler() - : base("POST", "/presence") - { - } - public override byte[] Handle(string path, Stream request) { string param = GetParam(path); @@ -100,5 +97,12 @@ namespace OpenSim.Grid.MessagingServer return new byte[] {}; } + + public PostXMPPStreamHandler() + : base("POST", "/presence") + { + + } + } -} \ No newline at end of file +} diff --git a/OpenSim/Grid/ScriptServer/Application.cs b/OpenSim/Grid/ScriptServer/Application.cs index dc0bf62..ef93f65 100644 --- a/OpenSim/Grid/ScriptServer/Application.cs +++ b/OpenSim/Grid/ScriptServer/Application.cs @@ -39,7 +39,7 @@ namespace OpenSim.Grid.ScriptServer XmlConfigurator.Configure(); AppDomain.CurrentDomain.UnhandledException += - CurrentDomain_UnhandledException; + new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); // Application is starting SE = new ScriptServerMain(); @@ -50,9 +50,9 @@ namespace OpenSim.Grid.ScriptServer Console.WriteLine(String.Empty); Console.WriteLine("APPLICATION EXCEPTION DETECTED"); Console.WriteLine(String.Empty); - Console.WriteLine("Application is terminating: " + e.IsTerminating); + Console.WriteLine("Application is terminating: " + e.IsTerminating.ToString()); //Console.WriteLine("Exception:"); //Console.WriteLine(e.ExceptionObject.ToString()); } } -} \ No newline at end of file +} diff --git a/OpenSim/Grid/ScriptServer/FakeScene.cs b/OpenSim/Grid/ScriptServer/FakeScene.cs index e037698..480050d 100644 --- a/OpenSim/Grid/ScriptServer/FakeScene.cs +++ b/OpenSim/Grid/ScriptServer/FakeScene.cs @@ -34,7 +34,7 @@ using OpenSim.Region.Environment.Scenes; namespace OpenSim.Grid.ScriptServer { - public class FakeScene : Scene + public class FakeScene: Scene { public FakeScene(RegionInfo regInfo, AgentCircuitManager authen, PermissionManager permissionManager, CommunicationsManager commsMan, SceneCommunicationService sceneGridService, @@ -48,4 +48,4 @@ namespace OpenSim.Grid.ScriptServer // What does a scene have to do? :P } -} \ No newline at end of file +} diff --git a/OpenSim/Grid/ScriptServer/Properties/AssemblyInfo.cs b/OpenSim/Grid/ScriptServer/Properties/AssemblyInfo.cs index bb33e02..e4161d3 100644 --- a/OpenSim/Grid/ScriptServer/Properties/AssemblyInfo.cs +++ b/OpenSim/Grid/ScriptServer/Properties/AssemblyInfo.cs @@ -60,4 +60,4 @@ using System.Runtime.InteropServices; // [assembly : AssemblyVersion("1.0.0.0")] -[assembly : AssemblyFileVersion("1.0.0.0")] \ No newline at end of file +[assembly : AssemblyFileVersion("1.0.0.0")] diff --git a/OpenSim/Grid/ScriptServer/RemotingObject.cs b/OpenSim/Grid/ScriptServer/RemotingObject.cs index 6686b26..9d3065b 100644 --- a/OpenSim/Grid/ScriptServer/RemotingObject.cs +++ b/OpenSim/Grid/ScriptServer/RemotingObject.cs @@ -34,13 +34,9 @@ namespace OpenSim.Grid.ScriptServer { // This object will be exposed over remoting. It is a singleton, so it exists only in as one instance. - #region ServerRemotingObject Members - ScriptServerInterfaces.RemoteEvents ScriptServerInterfaces.ServerRemotingObject.Events() { return ScriptServerMain.Engine.EventManager(); } - - #endregion } -} \ No newline at end of file +} diff --git a/OpenSim/Grid/ScriptServer/RemotingServer.cs b/OpenSim/Grid/ScriptServer/RemotingServer.cs index 9d75a83..7d0e334 100644 --- a/OpenSim/Grid/ScriptServer/RemotingServer.cs +++ b/OpenSim/Grid/ScriptServer/RemotingServer.cs @@ -31,10 +31,9 @@ using System.Runtime.Remoting.Channels.Tcp; namespace OpenSim.Grid.ScriptServer { - internal class RemotingServer + class RemotingServer { - private readonly TcpChannel channel; - + TcpChannel channel; public RemotingServer(int port, string instanceName) { // Create an instance of a channel @@ -43,9 +42,9 @@ namespace OpenSim.Grid.ScriptServer // Register as an available service with the name HelloWorld RemotingConfiguration.RegisterWellKnownServiceType( - typeof (RemotingObject), + typeof(RemotingObject), instanceName, WellKnownObjectMode.Singleton); } } -} \ No newline at end of file +} diff --git a/OpenSim/Grid/ScriptServer/ScriptServer/Region/RegionBase.cs b/OpenSim/Grid/ScriptServer/ScriptServer/Region/RegionBase.cs index 4f9f2e7..a02429c 100644 --- a/OpenSim/Grid/ScriptServer/ScriptServer/Region/RegionBase.cs +++ b/OpenSim/Grid/ScriptServer/ScriptServer/Region/RegionBase.cs @@ -32,13 +32,8 @@ namespace OpenSim.Grid.ScriptServer.ScriptServer.Region // These are events that the region needs to have // TEMP: Using System.Delegate -- needs replacing with a real delegate - - #region Delegates - public delegate void DefaultDelegate(); - #endregion - public event DefaultDelegate onScriptRez; public event DefaultDelegate onstate_entry; public event DefaultDelegate onstate_exit; diff --git a/OpenSim/Grid/ScriptServer/ScriptServer/Region/RegionConnectionManager.cs b/OpenSim/Grid/ScriptServer/ScriptServer/Region/RegionConnectionManager.cs index 3c20272..8c31b9b 100644 --- a/OpenSim/Grid/ScriptServer/ScriptServer/Region/RegionConnectionManager.cs +++ b/OpenSim/Grid/ScriptServer/ScriptServer/Region/RegionConnectionManager.cs @@ -29,8 +29,8 @@ namespace OpenSim.Grid.ScriptServer.ScriptServer.Region { public class RegionConnectionManager : RegionBase { - private object m_Connection; private ScriptServerMain m_ScriptServerMain; + private object m_Connection; public RegionConnectionManager(ScriptServerMain scm, object Connection) { diff --git a/OpenSim/Grid/ScriptServer/ScriptServer/RegionCommManager.cs b/OpenSim/Grid/ScriptServer/ScriptServer/RegionCommManager.cs index c1449bf..8422bea 100644 --- a/OpenSim/Grid/ScriptServer/ScriptServer/RegionCommManager.cs +++ b/OpenSim/Grid/ScriptServer/ScriptServer/RegionCommManager.cs @@ -34,10 +34,12 @@ namespace OpenSim.Grid.ScriptServer.ScriptServer { internal class RegionCommManager { - private readonly ScriptServerMain m_ScriptServerMain; - private readonly List Regions = new List(); private Thread listenThread; + private List Regions = new List(); + + private ScriptServerMain m_ScriptServerMain; + public RegionCommManager(ScriptServerMain scm) { m_ScriptServerMain = scm; diff --git a/OpenSim/Grid/ScriptServer/ScriptServer/ScriptEngineLoader.cs b/OpenSim/Grid/ScriptServer/ScriptServer/ScriptEngineLoader.cs index dce92ce..4d8c559 100644 --- a/OpenSim/Grid/ScriptServer/ScriptServer/ScriptEngineLoader.cs +++ b/OpenSim/Grid/ScriptServer/ScriptServer/ScriptEngineLoader.cs @@ -51,7 +51,7 @@ namespace OpenSim.Grid.ScriptServer.ScriptServer { m_log.Error("[ScriptEngine]: " + "Error loading assembly \"" + EngineName + "\": " + e.Message + ", " + - e.StackTrace); + e.StackTrace.ToString()); } return ret; } @@ -104,7 +104,7 @@ namespace OpenSim.Grid.ScriptServer.ScriptServer ScriptServerInterfaces.ScriptEngine ret; //try //{ - ret = (ScriptServerInterfaces.ScriptEngine) Activator.CreateInstance(t); + ret = (ScriptServerInterfaces.ScriptEngine)Activator.CreateInstance(t); //} //catch (Exception e) //{ @@ -114,4 +114,4 @@ namespace OpenSim.Grid.ScriptServer.ScriptServer return ret; } } -} \ No newline at end of file +} diff --git a/OpenSim/Grid/ScriptServer/ScriptServer/ScriptEnginesManager.cs b/OpenSim/Grid/ScriptServer/ScriptServer/ScriptEnginesManager.cs index 9ecd179..9d67602 100644 --- a/OpenSim/Grid/ScriptServer/ScriptServer/ScriptEnginesManager.cs +++ b/OpenSim/Grid/ScriptServer/ScriptServer/ScriptEnginesManager.cs @@ -32,8 +32,8 @@ namespace OpenSim.Grid.ScriptServer.ScriptServer { internal class ScriptEngineManager { - private readonly ScriptEngineLoader ScriptEngineLoader; - private readonly List scriptEngines = new List(); + private ScriptEngineLoader ScriptEngineLoader; + private List scriptEngines = new List(); private ScriptServerMain m_ScriptServerMain; // Initialize @@ -58,4 +58,4 @@ namespace OpenSim.Grid.ScriptServer.ScriptServer return sei; } } -} \ No newline at end of file +} diff --git a/OpenSim/Grid/ScriptServer/ScriptServerMain.cs b/OpenSim/Grid/ScriptServer/ScriptServerMain.cs index 131ff34..528b51c 100644 --- a/OpenSim/Grid/ScriptServer/ScriptServerMain.cs +++ b/OpenSim/Grid/ScriptServer/ScriptServerMain.cs @@ -44,20 +44,20 @@ namespace OpenSim.Grid.ScriptServer // // Root object. Creates objects used. // + private int listenPort = 8010; // TEMP public static ScriptServerInterfaces.ScriptEngine Engine; - private int listenPort = 8010; //public static FakeScene m_Scene = new FakeScene(null,null,null,null,null,null,null,null,null,false, false, false); // Objects we use + internal RegionCommManager RegionScriptDaemon; // Listen for incoming from region + internal ScriptEngineManager ScriptEngines; // Loads scriptengines //internal RemotingServer m_RemotingServer; internal TCPServer m_TCPServer; - internal RegionCommManager RegionScriptDaemon; // Listen for incoming from region internal TRPC_Remote RPC; - internal ScriptEngineManager ScriptEngines; // Loads scriptengines - public ScriptServerMain() + public ScriptServerMain() { m_console = CreateConsole(); @@ -68,13 +68,13 @@ namespace OpenSim.Grid.ScriptServer Engine = ScriptEngines.LoadEngine("DotNetEngine"); Engine.InitializeEngine(null, null, false, Engine.GetScriptManager()); - + // Set up server //m_RemotingServer = new RemotingServer(listenPort, "DotNetEngine"); m_TCPServer = new TCPServer(listenPort); RPC = new TRPC_Remote(m_TCPServer); - RPC.ReceiveCommand += RPC_ReceiveCommand; + RPC.ReceiveCommand += new TRPC_Remote.ReceiveCommandDelegate(RPC_ReceiveCommand); m_TCPServer.StartListen(); Console.ReadLine(); @@ -93,7 +93,7 @@ namespace OpenSim.Grid.ScriptServer if (Command == "OnRezScript") { - Engine.EventManager().OnRezScript((uint) p[0], new LLUUID((string) p[1]), (string) p[2]); + Engine.EventManager().OnRezScript((uint)p[0], new LLUUID((string)p[1]), (string)p[2]); } } @@ -106,4 +106,4 @@ namespace OpenSim.Grid.ScriptServer return new ConsoleBase("ScriptServer", this); } } -} \ No newline at end of file +} diff --git a/OpenSim/Grid/UserServer/Main.cs b/OpenSim/Grid/UserServer/Main.cs index 25e1585..0534e3b 100644 --- a/OpenSim/Grid/UserServer/Main.cs +++ b/OpenSim/Grid/UserServer/Main.cs @@ -48,61 +48,12 @@ namespace OpenSim.Grid.UserServer private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private UserConfig Cfg; - private LLUUID m_lastCreatedUser = LLUUID.Random(); - - public UserLoginService m_loginService; - public MessageServersConnector m_messagesService; + public UserManager m_userManager; + public UserLoginService m_loginService; + public MessageServersConnector m_messagesService; - private OpenUser_Main() - { - m_console = new ConsoleBase("OpenUser", this); - MainConsole.Instance = m_console; - } - - #region conscmd_callback Members - - public override void RunCmd(string cmd, string[] cmdparams) - { - base.RunCmd(cmd, cmdparams); - - switch (cmd) - { - case "help": - m_console.Notice("create user - create a new user"); - m_console.Notice("stats - statistical information for this server"); - m_console.Notice("shutdown - shutdown the grid (USE CAUTION!)"); - break; - - case "create": - do_create(cmdparams[0]); - break; - - case "shutdown": - m_loginService.OnUserLoggedInAtLocation -= NotifyMessageServersUserLoggedInToLocation; - m_console.Close(); - Environment.Exit(0); - break; - - case "stats": - m_console.Notice(StatsManager.UserStats.Report()); - break; - - case "test-inventory": - // RestObjectPosterResponse> requester = new RestObjectPosterResponse>(); - // requester.ReturnResponseVal = TestResponse; - // requester.BeginPostObject(m_userManager._config.InventoryUrl + "RootFolders/", m_lastCreatedUser); - SynchronousRestObjectPoster.BeginPostObject>("POST", - m_userManager. - _config. - InventoryUrl + - "RootFolders/", - m_lastCreatedUser); - break; - } - } - - #endregion + private LLUUID m_lastCreatedUser = LLUUID.Random(); [STAThread] public static void Main(string[] args) @@ -117,6 +68,12 @@ namespace OpenSim.Grid.UserServer userserver.Work(); } + private OpenUser_Main() + { + m_console = new ConsoleBase("OpenUser", this); + MainConsole.Instance = m_console; + } + private void Work() { m_console.Notice("Enter help for a list of commands\n"); @@ -130,16 +87,16 @@ namespace OpenSim.Grid.UserServer public void Startup() { Cfg = new UserConfig("USER SERVER", (Path.Combine(Util.configDir(), "UserServer_Config.xml"))); - + StatsManager.StartCollectingUserStats(); m_log.Info("[REGION]: Establishing data connection"); - m_userManager = new UserManager(); + m_userManager = new UserManager(); m_userManager._config = Cfg; - m_userManager.AddPlugin(Cfg.DatabaseProvider); + m_userManager.AddPlugin(Cfg.DatabaseProvider); m_loginService = new UserLoginService( - m_userManager, new LibraryRootFolder(), Cfg, Cfg.DefaultStartupMsg); + m_userManager, new LibraryRootFolder(), Cfg, Cfg.DefaultStartupMsg); m_messagesService = new MessageServersConnector(); @@ -147,7 +104,7 @@ namespace OpenSim.Grid.UserServer m_userManager.OnLogOffUser += NotifyMessageServersUserLoggOff; m_log.Info("[REGION]: Starting HTTP process"); - + m_httpServer = new BaseHttpServer(Cfg.HttpPort); AddHttpHandlers(); m_httpServer.Start(); @@ -160,7 +117,7 @@ namespace OpenSim.Grid.UserServer m_httpServer.AddXmlRPCHandler("login_to_simulator", m_loginService.XmlRpcLoginMethod); m_httpServer.AddHTTPHandler("login", m_loginService.ProcessHTMLLogin); - + m_httpServer.SetLLSDHandler(m_loginService.LLSDLoginMethod); m_httpServer.AddXmlRPCHandler("get_user_by_name", m_userManager.XmlRPCGetUserMethodName); @@ -171,7 +128,7 @@ namespace OpenSim.Grid.UserServer m_httpServer.AddXmlRPCHandler("update_user_friend_perms", m_userManager.XmlRpcResponseXmlRPCUpdateUserFriendPerms); m_httpServer.AddXmlRPCHandler("get_user_friend_list", m_userManager.XmlRpcResponseXmlRPCGetUserFriendList); m_httpServer.AddXmlRPCHandler("logout_of_simulator", m_userManager.XmlRPCLogOffUserMethodUUID); - + // Message Server ---> User Server m_httpServer.AddXmlRPCHandler("register_messageserver", m_messagesService.XmlRPCRegisterMessageServer); m_httpServer.AddXmlRPCHandler("agent_change_region", m_messagesService.XmlRPCUserMovedtoRegion); @@ -206,17 +163,17 @@ namespace OpenSim.Grid.UserServer { m_log.ErrorFormat( "[USERS]: A user with the name {0} {1} already exists!", tempfirstname, templastname); - + break; } - + tempMD5Passwd = Util.Md5Hash(Util.Md5Hash(tempMD5Passwd) + ":" + String.Empty); LLUUID userID = new LLUUID(); try { userID = m_userManager.AddUserProfile(tempfirstname, templastname, tempMD5Passwd, regX, regY); - } + } catch (Exception ex) { m_log.ErrorFormat("[USERS]: Error creating user: {0}", ex.ToString()); @@ -224,35 +181,76 @@ namespace OpenSim.Grid.UserServer try { - bool created + bool created = SynchronousRestObjectPoster.BeginPostObject( "POST", m_userManager._config.InventoryUrl + "CreateInventory/", userID.UUID); - + if (!created) { throw new Exception( String.Format( "The inventory creation request for user {0} did not succeed." - + " Please contact your inventory service provider for more information.", + + " Please contact your inventory service provider for more information.", userID)); } + } catch (WebException e) { m_log.ErrorFormat( - "[USERS]: Could not contact the inventory service at {0} to create an inventory for {1}", + "[USERS]: Could not contact the inventory service at {0} to create an inventory for {1}", m_userManager._config.InventoryUrl + "CreateInventory/", userID.UUID); } catch (Exception e) { m_log.ErrorFormat("[USERS]: Error creating inventory for user: {0}", e); } - + m_lastCreatedUser = userID; break; } } + public override void RunCmd(string cmd, string[] cmdparams) + { + base.RunCmd(cmd, cmdparams); + + switch (cmd) + { + case "help": + m_console.Notice("create user - create a new user"); + m_console.Notice("stats - statistical information for this server"); + m_console.Notice("shutdown - shutdown the grid (USE CAUTION!)"); + break; + + case "create": + do_create(cmdparams[0]); + break; + + case "shutdown": + m_loginService.OnUserLoggedInAtLocation -= NotifyMessageServersUserLoggedInToLocation; + m_console.Close(); + Environment.Exit(0); + break; + + case "stats": + m_console.Notice(StatsManager.UserStats.Report()); + break; + + case "test-inventory": + // RestObjectPosterResponse> requester = new RestObjectPosterResponse>(); + // requester.ReturnResponseVal = TestResponse; + // requester.BeginPostObject(m_userManager._config.InventoryUrl + "RootFolders/", m_lastCreatedUser); + SynchronousRestObjectPoster.BeginPostObject>("POST", + m_userManager. + _config. + InventoryUrl + + "RootFolders/", + m_lastCreatedUser); + break; + } + } + public void TestResponse(List resp) { m_console.Notice("response got"); @@ -264,11 +262,12 @@ namespace OpenSim.Grid.UserServer } public void NotifyMessageServersUserLoggedInToLocation(LLUUID agentID, LLUUID sessionID, LLUUID RegionID, - ulong regionhandle, float positionX, float positionY, - float positionZ, string firstname, string lastname) + ulong regionhandle, float positionX, float positionY, + float positionZ, string firstname, string lastname) { - m_messagesService.TellMessageServersAboutUser(agentID, sessionID, RegionID, regionhandle, positionX, - positionY, positionZ, firstname, lastname); + + m_messagesService.TellMessageServersAboutUser( agentID, sessionID, RegionID, regionhandle, positionX, + positionY, positionZ, firstname, lastname); } } -} \ No newline at end of file +} diff --git a/OpenSim/Grid/UserServer/MessageServersConnector.cs b/OpenSim/Grid/UserServer/MessageServersConnector.cs index 70068e0..28f5c4c 100644 --- a/OpenSim/Grid/UserServer/MessageServersConnector.cs +++ b/OpenSim/Grid/UserServer/MessageServersConnector.cs @@ -41,12 +41,12 @@ namespace OpenSim.Grid.UserServer private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); public Dictionary MessageServers; - + public MessageServersConnector() { MessageServers = new Dictionary(); } - + public void RegisterMessageServer(string URI, MessageServerInfo serverData) { lock (MessageServers) @@ -55,7 +55,7 @@ namespace OpenSim.Grid.UserServer MessageServers.Add(URI, serverData); } } - + public void DeRegisterMessageServer(string URI) { lock (MessageServers) @@ -64,7 +64,7 @@ namespace OpenSim.Grid.UserServer MessageServers.Remove(URI); } } - + public void AddResponsibleRegion(string URI, ulong regionhandle) { if (!MessageServers.ContainsKey(URI)) @@ -76,9 +76,8 @@ namespace OpenSim.Grid.UserServer MessageServerInfo msginfo = MessageServers["URI"]; msginfo.responsibleForRegions.Add(regionhandle); MessageServers["URI"] = msginfo; - } + } } - public void RemoveResponsibleRegion(string URI, ulong regionhandle) { if (!MessageServers.ContainsKey(URI)) @@ -93,20 +92,20 @@ namespace OpenSim.Grid.UserServer msginfo.responsibleForRegions.Remove(regionhandle); MessageServers["URI"] = msginfo; } - } - } + } + } public XmlRpcResponse XmlRPCRegisterMessageServer(XmlRpcRequest request) { XmlRpcResponse response = new XmlRpcResponse(); - Hashtable requestData = (Hashtable) request.Params[0]; + Hashtable requestData = (Hashtable)request.Params[0]; Hashtable responseData = new Hashtable(); if (requestData.Contains("uri")) { - string URI = (string) requestData["uri"]; - string sendkey = (string) requestData["sendkey"]; - string recvkey = (string) requestData["recvkey"]; + string URI = (string)requestData["uri"]; + string sendkey=(string)requestData["sendkey"]; + string recvkey=(string)requestData["recvkey"]; MessageServerInfo m = new MessageServerInfo(); m.URI = URI; m.sendkey = sendkey; @@ -117,16 +116,15 @@ namespace OpenSim.Grid.UserServer } return response; } - public XmlRpcResponse XmlRPCDeRegisterMessageServer(XmlRpcRequest request) { XmlRpcResponse response = new XmlRpcResponse(); - Hashtable requestData = (Hashtable) request.Params[0]; + Hashtable requestData = (Hashtable)request.Params[0]; Hashtable responseData = new Hashtable(); if (requestData.Contains("uri")) { - string URI = (string) requestData["uri"]; + string URI = (string)requestData["uri"]; DeRegisterMessageServer(URI); responseData["responsestring"] = "TRUE"; @@ -134,24 +132,23 @@ namespace OpenSim.Grid.UserServer } return response; } - public XmlRpcResponse XmlRPCUserMovedtoRegion(XmlRpcRequest request) { XmlRpcResponse response = new XmlRpcResponse(); - Hashtable requestData = (Hashtable) request.Params[0]; + Hashtable requestData = (Hashtable)request.Params[0]; Hashtable responseData = new Hashtable(); if (requestData.Contains("fromuri")) { - string sURI = (string) requestData["fromuri"]; - string sagentID = (string) requestData["agentid"]; - string ssessionID = (string) requestData["sessionid"]; - string scurrentRegionID = (string) requestData["regionid"]; - string sregionhandle = (string) requestData["regionhandle"]; - string scurrentpos = (string) requestData["currentpos"]; + string sURI = (string)requestData["fromuri"]; + string sagentID = (string)requestData["agentid"]; + string ssessionID = (string)requestData["sessionid"]; + string scurrentRegionID = (string)requestData["regionid"]; + string sregionhandle = (string)requestData["regionhandle"]; + string scurrentpos = (string)requestData["currentpos"]; //LLVector3.TryParse((string)reader["currentPos"], out retval.currentPos); // TODO: Okay now raise event so the user server can pass this data to the Usermanager - + responseData["responsestring"] = "TRUE"; response.Value = responseData; } @@ -159,7 +156,7 @@ namespace OpenSim.Grid.UserServer } public void TellMessageServersAboutUser(LLUUID agentID, LLUUID sessionID, LLUUID RegionID, - ulong regionhandle, float positionX, float positionY, + ulong regionhandle, float positionX, float positionY, float positionZ, string firstname, string lastname) { // Loop over registered Message Servers ( AND THERE WILL BE MORE THEN ONE :D ) @@ -176,8 +173,8 @@ namespace OpenSim.Grid.UserServer foreach (MessageServerInfo serv in MessageServers.Values) { NotifyMessageServerAboutUser(serv, agentID, sessionID, RegionID, - regionhandle, positionX, positionY, positionZ, - firstname, lastname); + regionhandle, positionX, positionY, positionZ, + firstname, lastname); } } } @@ -194,10 +191,10 @@ namespace OpenSim.Grid.UserServer // { // m_log.Debug("[MSGCONNECTOR]: No Message Servers registered, ignoring"); // } - foreach (MessageServerInfo serv in MessageServers.Values) - { - NotifyMessageServerAboutUserLogoff(serv, agentID); - } + foreach (MessageServerInfo serv in MessageServers.Values) + { + NotifyMessageServerAboutUserLogoff(serv,agentID); + } } } @@ -221,10 +218,10 @@ namespace OpenSim.Grid.UserServer m_log.Info("[LOGOUT]: Notified : " + serv.URI + " about user logout"); } - private void NotifyMessageServerAboutUser(MessageServerInfo serv, - LLUUID agentID, LLUUID sessionID, LLUUID RegionID, - ulong regionhandle, float positionX, float positionY, float positionZ, - string firstname, string lastname) + private void NotifyMessageServerAboutUser(MessageServerInfo serv, + LLUUID agentID, LLUUID sessionID, LLUUID RegionID, + ulong regionhandle, float positionX, float positionY, float positionZ, + string firstname, string lastname) { Hashtable reqparams = new Hashtable(); reqparams["sendkey"] = serv.sendkey; @@ -253,6 +250,7 @@ namespace OpenSim.Grid.UserServer { m_log.Warn("[MSGCONNECTOR]: Unable to notify Message Server about login. Presence might be borked for this user"); } + } } -} \ No newline at end of file +} diff --git a/OpenSim/Grid/UserServer/Properties/AssemblyInfo.cs b/OpenSim/Grid/UserServer/Properties/AssemblyInfo.cs index eb60f11..680b357 100644 --- a/OpenSim/Grid/UserServer/Properties/AssemblyInfo.cs +++ b/OpenSim/Grid/UserServer/Properties/AssemblyInfo.cs @@ -60,4 +60,4 @@ using System.Runtime.InteropServices; // [assembly : AssemblyVersion("1.0.0.0")] -[assembly : AssemblyFileVersion("1.0.0.0")] \ No newline at end of file +[assembly : AssemblyFileVersion("1.0.0.0")] diff --git a/OpenSim/Grid/UserServer/UserLoginService.cs b/OpenSim/Grid/UserServer/UserLoginService.cs index b19b74d..b123b8c 100644 --- a/OpenSim/Grid/UserServer/UserLoginService.cs +++ b/OpenSim/Grid/UserServer/UserLoginService.cs @@ -41,26 +41,26 @@ using OpenSim.Framework.Servers; namespace OpenSim.Grid.UserServer { public delegate void UserLoggedInAtLocation(LLUUID agentID, LLUUID sessionID, LLUUID RegionID, - ulong regionhandle, float positionX, float positionY, float positionZ, string firstname, string lastname); + ulong regionhandle, float positionX, float positionY, float positionZ, string firstname, string lastname); public class UserLoginService : LoginService { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - private UserLoggedInAtLocation handlerUserLoggedInAtLocation; + public event UserLoggedInAtLocation OnUserLoggedInAtLocation; + private UserLoggedInAtLocation handlerUserLoggedInAtLocation = null; + public UserConfig m_config; public UserLoginService( - UserManagerBase userManager, LibraryRootFolder libraryRootFolder, + UserManagerBase userManager, LibraryRootFolder libraryRootFolder, UserConfig config, string welcomeMess) : base(userManager, libraryRootFolder, welcomeMess) { m_config = config; } - public event UserLoggedInAtLocation OnUserLoggedInAtLocation; - /// /// Customises the login response and fills in missing values. /// @@ -95,8 +95,7 @@ namespace OpenSim.Grid.UserServer else { string[] startLocationRequestParsed = Util.ParseStartLocationRequest(startLocationRequest); - m_log.Info("[DEBUGLOGINPARSE]: 1:" + startLocationRequestParsed[0] + ", 2:" + startLocationRequestParsed[1] + ", 3:" + - startLocationRequestParsed[2] + ", 4:" + startLocationRequestParsed[3]); + m_log.Info("[DEBUGLOGINPARSE]: 1:" + startLocationRequestParsed[0] + ", 2:" + startLocationRequestParsed[1] + ", 3:" + startLocationRequestParsed[2] + ", 4:" + startLocationRequestParsed[3]); if (startLocationRequestParsed[0] == "last") { // TODO: Parse out startlocationrequest string in the format; 'uri:RegionName&X&Y&Z' @@ -109,9 +108,9 @@ namespace OpenSim.Grid.UserServer { m_log.Info("[LOGIN]: Looking up Sim: " + startLocationRequestParsed[0]); SimInfo = - RegionProfileData.RequestSimProfileData( - startLocationRequestParsed[0], m_config.GridServerURL, - m_config.GridSendKey, m_config.GridRecvKey); + RegionProfileData.RequestSimProfileData( + startLocationRequestParsed[0], m_config.GridServerURL, + m_config.GridSendKey, m_config.GridRecvKey); if (SimInfo == null) { @@ -120,9 +119,7 @@ namespace OpenSim.Grid.UserServer RegionProfileData.RequestSimProfileData( theUser.HomeRegion, m_config.GridServerURL, m_config.GridSendKey, m_config.GridRecvKey); - } - else - { + } else { start_x = Convert.ToInt32(startLocationRequestParsed[1]); start_y = Convert.ToInt32(startLocationRequestParsed[2]); start_z = Convert.ToInt32(startLocationRequestParsed[3]); @@ -133,30 +130,30 @@ namespace OpenSim.Grid.UserServer // Customise the response //CFK: This is redundant and the next message should always appear. //CFK: m_log.Info("[LOGIN]: Home Location"); - response.Home = "{'region_handle':[r" + (SimInfo.regionLocX * Constants.RegionSize) + ",r" + - (SimInfo.regionLocY * Constants.RegionSize) + "], " + - "'position':[r" + theUser.HomeLocation.X + ",r" + - theUser.HomeLocation.Y + ",r" + theUser.HomeLocation.Z + "], " + - "'look_at':[r" + theUser.HomeLocation.X + ",r" + - theUser.HomeLocation.Y + ",r" + theUser.HomeLocation.Z + "]}"; + response.Home = "{'region_handle':[r" + (SimInfo.regionLocX * Constants.RegionSize).ToString() + ",r" + + (SimInfo.regionLocY * Constants.RegionSize).ToString() + "], " + + "'position':[r" + theUser.HomeLocation.X.ToString() + ",r" + + theUser.HomeLocation.Y.ToString() + ",r" + theUser.HomeLocation.Z.ToString() + "], " + + "'look_at':[r" + theUser.HomeLocation.X.ToString() + ",r" + + theUser.HomeLocation.Y.ToString() + ",r" + theUser.HomeLocation.Z.ToString() + "]}"; // Destination //CFK: The "Notifying" message always seems to appear, so subsume the data from this message into //CFK: the next one for X & Y and comment this one. //CFK: m_log.Info("[LOGIN]: CUSTOMISERESPONSE: Region X: " + SimInfo.regionLocX + //CFK: "; Region Y: " + SimInfo.regionLocY); - response.SimAddress = Util.GetHostFromDNS(SimInfo.serverURI.Split(new[] {'/', ':'})[3]).ToString(); - response.SimPort = uint.Parse(SimInfo.serverURI.Split(new[] {'/', ':'})[4]); + response.SimAddress = Util.GetHostFromDNS(SimInfo.serverURI.Split(new char[] { '/', ':' })[3]).ToString(); + response.SimPort = uint.Parse(SimInfo.serverURI.Split(new char[] { '/', ':' })[4]); response.RegionX = SimInfo.regionLocX; response.RegionY = SimInfo.regionLocY; //Not sure if the + "/CAPS/" should in fact be +"CAPS/" depending if there is already a / as part of httpServerURI string capsPath = Util.GetRandomCapsPath(); response.SeedCapability = SimInfo.httpServerURI + "CAPS/" + capsPath + "0000/"; - + m_log.DebugFormat( - "[LOGIN]: Sending new CAPS seed url {0} to client {1}", - response.SeedCapability, response.AgentID); + "[LOGIN]: Sending new CAPS seed url {0} to client {1}", + response.SeedCapability, response.AgentID); // Notify the target of an incoming user //CFK: The "Notifying" message always seems to appear, so subsume the data from this message into @@ -166,8 +163,7 @@ namespace OpenSim.Grid.UserServer theUser.CurrentAgent.Region = SimInfo.UUID; theUser.CurrentAgent.Handle = SimInfo.regionHandle; - if (start_x >= 0 && start_y >= 0 && start_z >= 0) - { + if (start_x >= 0 && start_y >= 0 && start_z >= 0) { LLVector3 tmp_v = new LLVector3(start_x, start_y, start_z); theUser.CurrentAgent.Position = tmp_v; } @@ -190,43 +186,42 @@ namespace OpenSim.Grid.UserServer // Update agent with target sim m_log.InfoFormat( - "[LOGIN]: Telling region {0} @ {1},{2} ({3}) to expect user connection", - SimInfo.regionName, response.RegionX, response.RegionY, SimInfo.httpServerURI); + "[LOGIN]: Telling region {0} @ {1},{2} ({3}) to expect user connection", + SimInfo.regionName, response.RegionX, response.RegionY, SimInfo.httpServerURI); - XmlRpcRequest GridReq = new XmlRpcRequest("expect_user", SendParams); + XmlRpcRequest GridReq = new XmlRpcRequest("expect_user", SendParams); XmlRpcResponse GridResp = GridReq.Send(SimInfo.httpServerURI, 6000); - + if (GridResp.IsFault) { m_log.ErrorFormat( - "[LOGIN]: XMLRPC request for {0} failed, fault code: {1}, reason: {2}", + "[LOGIN]: XMLRPC request for {0} failed, fault code: {1}, reason: {2}", SimInfo.httpServerURI, GridResp.FaultCode, GridResp.FaultString); } handlerUserLoggedInAtLocation = OnUserLoggedInAtLocation; if (handlerUserLoggedInAtLocation != null) { //m_log.Info("[LOGIN]: Letting other objects know about login"); - handlerUserLoggedInAtLocation(theUser.ID, theUser.CurrentAgent.SessionID, theUser.CurrentAgent.Region, - theUser.CurrentAgent.Handle, theUser.CurrentAgent.Position.X, theUser.CurrentAgent.Position.Y, - theUser.CurrentAgent.Position.Z, - theUser.FirstName, theUser.SurName); + handlerUserLoggedInAtLocation(theUser.ID, theUser.CurrentAgent.SessionID, theUser.CurrentAgent.Region, + theUser.CurrentAgent.Handle, theUser.CurrentAgent.Position.X,theUser.CurrentAgent.Position.Y,theUser.CurrentAgent.Position.Z, + theUser.FirstName,theUser.SurName); } } catch (Exception) - //catch (System.AccessViolationException) + //catch (System.AccessViolationException) { tryDefault = true; } - + if (tryDefault) { // Send him to default region instead // Load information from the gridserver - ulong defaultHandle = (((ulong) m_config.DefaultX * Constants.RegionSize) << 32) | ((ulong) m_config.DefaultY * Constants.RegionSize); + ulong defaultHandle = (((ulong)m_config.DefaultX * Constants.RegionSize) << 32) | ((ulong)m_config.DefaultY * Constants.RegionSize); m_log.Warn( - "[LOGIN]: Home region not available: sending to default " + defaultHandle); + "[LOGIN]: Home region not available: sending to default " + defaultHandle.ToString()); try { @@ -236,19 +231,19 @@ namespace OpenSim.Grid.UserServer // Customise the response m_log.Info("[LOGIN]: Home Location"); - response.Home = "{'region_handle':[r" + (SimInfo.regionLocX * Constants.RegionSize) + ",r" + - (SimInfo.regionLocY * Constants.RegionSize) + "], " + - "'position':[r" + theUser.HomeLocation.X + ",r" + - theUser.HomeLocation.Y + ",r" + theUser.HomeLocation.Z + "], " + - "'look_at':[r" + theUser.HomeLocation.X + ",r" + - theUser.HomeLocation.Y + ",r" + theUser.HomeLocation.Z + "]}"; + response.Home = "{'region_handle':[r" + (SimInfo.regionLocX * Constants.RegionSize).ToString() + ",r" + + (SimInfo.regionLocY * Constants.RegionSize).ToString() + "], " + + "'position':[r" + theUser.HomeLocation.X.ToString() + ",r" + + theUser.HomeLocation.Y.ToString() + ",r" + theUser.HomeLocation.Z.ToString() + "], " + + "'look_at':[r" + theUser.HomeLocation.X.ToString() + ",r" + + theUser.HomeLocation.Y.ToString() + ",r" + theUser.HomeLocation.Z.ToString() + "]}"; // Destination m_log.Info("[LOGIN]: " + "CUSTOMISERESPONSE: Region X: " + SimInfo.regionLocX + "; Region Y: " + SimInfo.regionLocY); - response.SimAddress = Util.GetHostFromDNS(SimInfo.serverURI.Split(new[] {'/', ':'})[3]).ToString(); - response.SimPort = uint.Parse(SimInfo.serverURI.Split(new[] {'/', ':'})[4]); + response.SimAddress = Util.GetHostFromDNS(SimInfo.serverURI.Split(new char[] { '/', ':' })[3]).ToString(); + response.SimPort = uint.Parse(SimInfo.serverURI.Split(new char[] { '/', ':' })[4]); response.RegionX = SimInfo.regionLocX; response.RegionY = SimInfo.regionLocY; @@ -288,16 +283,15 @@ namespace OpenSim.Grid.UserServer { m_log.Info("[LOGIN]: Letting other objects know about login"); handlerUserLoggedInAtLocation(theUser.ID, theUser.CurrentAgent.SessionID, theUser.CurrentAgent.Region, - theUser.CurrentAgent.Handle, theUser.CurrentAgent.Position.X, theUser.CurrentAgent.Position.Y, - theUser.CurrentAgent.Position.Z, - theUser.FirstName, theUser.SurName); + theUser.CurrentAgent.Handle, theUser.CurrentAgent.Position.X, theUser.CurrentAgent.Position.Y, theUser.CurrentAgent.Position.Z, + theUser.FirstName, theUser.SurName); } } catch (Exception e) { m_log.Warn("[LOGIN]: Default region also not available"); - m_log.Warn("[LOGIN]: " + e); + m_log.Warn("[LOGIN]: " + e.ToString()); } } } @@ -306,8 +300,8 @@ namespace OpenSim.Grid.UserServer protected override InventoryData GetInventorySkeleton(LLUUID userID) { m_log.DebugFormat( - "[LOGIN]: Contacting inventory service at {0} for inventory skeleton of user {1}", - m_config.InventoryUrl, userID); + "[LOGIN]: Contacting inventory service at {0} for inventory skeleton of user {1}", + m_config.InventoryUrl, userID); List folders = SynchronousRestObjectPoster.BeginPostObject>( @@ -322,23 +316,23 @@ namespace OpenSim.Grid.UserServer // tools are creating the user profile directly in the database without creating the inventory. At // this time we'll accomodate them by lazily creating the user inventory now if it doesn't already // exist. - bool created = + bool created = SynchronousRestObjectPoster.BeginPostObject( "POST", m_config.InventoryUrl + "CreateInventory/", userID.UUID); - + if (!created) { throw new Exception( String.Format( "The inventory creation request for user {0} did not succeed." - + " Please contact your inventory service provider for more information.", + + " Please contact your inventory service provider for more information.", userID)); } else { m_log.InfoFormat("[LOGIN]: A new inventory skeleton was successfully created for user {0}", userID); } - + folders = SynchronousRestObjectPoster.BeginPostObject>( "POST", m_config.InventoryUrl + "RootFolders/", userID.UUID); } @@ -348,11 +342,11 @@ namespace OpenSim.Grid.UserServer LLUUID rootID = LLUUID.Zero; ArrayList AgentInventoryArray = new ArrayList(); Hashtable TempHash; - + foreach (InventoryFolderBase InvFolder in folders) { // m_log.DebugFormat("[LOGIN]: Received agent inventory folder {0}", InvFolder.name); - + if (InvFolder.ParentID == LLUUID.Zero) { rootID = InvFolder.ID; @@ -365,16 +359,16 @@ namespace OpenSim.Grid.UserServer TempHash["folder_id"] = InvFolder.ID.ToString(); AgentInventoryArray.Add(TempHash); } - + return new InventoryData(AgentInventoryArray, rootID); } else { throw new Exception( String.Format( - "A root inventory folder for user {0} could not be retrieved from the inventory service", + "A root inventory folder for user {0} could not be retrieved from the inventory service", userID)); } } } -} \ No newline at end of file +} diff --git a/OpenSim/Grid/UserServer/UserManager.cs b/OpenSim/Grid/UserServer/UserManager.cs index 0122ad0..5d0e1d6 100644 --- a/OpenSim/Grid/UserServer/UserManager.cs +++ b/OpenSim/Grid/UserServer/UserManager.cs @@ -41,11 +41,11 @@ namespace OpenSim.Grid.UserServer public delegate void logOffUser(LLUUID AgentID); public class UserManager : UserManagerBase - { + { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - private logOffUser handlerLogOffUser; public event logOffUser OnLogOffUser; + private logOffUser handlerLogOffUser = null; /// /// Deletes an active agent session @@ -81,17 +81,17 @@ namespace OpenSim.Grid.UserServer XmlRpcResponse response = new XmlRpcResponse(); Hashtable responseData = new Hashtable(); // Query Result Information - responseData["queryid"] = queryID.ToString(); - responseData["avcount"] = returnUsers.Count.ToString(); + responseData["queryid"] = (string) queryID.ToString(); + responseData["avcount"] = (string) returnUsers.Count.ToString(); for (int i = 0; i < returnUsers.Count; i++) { - responseData["avatarid" + i] = returnUsers[i].AvatarID.ToString(); - responseData["firstname" + i] = returnUsers[i].firstName; - responseData["lastname" + i] = returnUsers[i].lastName; + responseData["avatarid" + i.ToString()] = returnUsers[i].AvatarID.ToString(); + responseData["firstname" + i.ToString()] = returnUsers[i].firstName; + responseData["lastname" + i.ToString()] = returnUsers[i].lastName; } response.Value = responseData; - + return response; } @@ -101,14 +101,14 @@ namespace OpenSim.Grid.UserServer Hashtable responseData = new Hashtable(); // Query Result Information - responseData["avcount"] = returnUsers.Count.ToString(); + responseData["avcount"] = (string)returnUsers.Count.ToString(); for (int i = 0; i < returnUsers.Count; i++) { - responseData["ownerID" + i] = returnUsers[i].FriendListOwner.UUID.ToString(); - responseData["friendID" + i] = returnUsers[i].Friend.UUID.ToString(); - responseData["ownerPerms" + i] = returnUsers[i].FriendListOwnerPerms.ToString(); - responseData["friendPerms" + i] = returnUsers[i].FriendPerms.ToString(); + responseData["ownerID" + i.ToString()] = returnUsers[i].FriendListOwner.UUID.ToString(); + responseData["friendID" + i.ToString()] = returnUsers[i].Friend.UUID.ToString(); + responseData["ownerPerms" + i.ToString()] = returnUsers[i].FriendListOwnerPerms.ToString(); + responseData["friendPerms" + i.ToString()] = returnUsers[i].FriendPerms.ToString(); } response.Value = responseData; @@ -156,21 +156,6 @@ namespace OpenSim.Grid.UserServer return response; } - public override UserProfileData SetupMasterUser(string firstName, string lastName) - { - throw new Exception("The method or operation is not implemented."); - } - - public override UserProfileData SetupMasterUser(string firstName, string lastName, string password) - { - throw new Exception("The method or operation is not implemented."); - } - - public override UserProfileData SetupMasterUser(LLUUID uuid) - { - throw new Exception("The method or operation is not implemented."); - } - #region XMLRPC User Methods public XmlRpcResponse XmlRPCGetAvatarPickerAvatar(XmlRpcRequest request) @@ -193,16 +178,15 @@ namespace OpenSim.Grid.UserServer public XmlRpcResponse XmlRpcResponseXmlRPCAddUserFriend(XmlRpcRequest request) { XmlRpcResponse response = new XmlRpcResponse(); - Hashtable requestData = (Hashtable) request.Params[0]; + Hashtable requestData = (Hashtable)request.Params[0]; Hashtable responseData = new Hashtable(); string returnString = "FALSE"; // Query Result Information - + if (requestData.Contains("ownerID") && requestData.Contains("friendID") && requestData.Contains("friendPerms")) { // UserManagerBase.AddNewuserFriend - AddNewUserFriend(new LLUUID((string) requestData["ownerID"]), new LLUUID((string) requestData["friendID"]), - (uint) Convert.ToInt32((string) requestData["friendPerms"])); + AddNewUserFriend(new LLUUID((string)requestData["ownerID"]), new LLUUID((string)requestData["friendID"]), (uint)Convert.ToInt32((string)requestData["friendPerms"])); returnString = "TRUE"; } responseData["returnString"] = returnString; @@ -213,15 +197,15 @@ namespace OpenSim.Grid.UserServer public XmlRpcResponse XmlRpcResponseXmlRPCRemoveUserFriend(XmlRpcRequest request) { XmlRpcResponse response = new XmlRpcResponse(); - Hashtable requestData = (Hashtable) request.Params[0]; + Hashtable requestData = (Hashtable)request.Params[0]; Hashtable responseData = new Hashtable(); string returnString = "FALSE"; // Query Result Information - + if (requestData.Contains("ownerID") && requestData.Contains("friendID")) { // UserManagerBase.AddNewuserFriend - RemoveUserFriend(new LLUUID((string) requestData["ownerID"]), new LLUUID((string) requestData["friendID"])); + RemoveUserFriend(new LLUUID((string)requestData["ownerID"]), new LLUUID((string)requestData["friendID"])); returnString = "TRUE"; } responseData["returnString"] = returnString; @@ -232,14 +216,13 @@ namespace OpenSim.Grid.UserServer public XmlRpcResponse XmlRpcResponseXmlRPCUpdateUserFriendPerms(XmlRpcRequest request) { XmlRpcResponse response = new XmlRpcResponse(); - Hashtable requestData = (Hashtable) request.Params[0]; + Hashtable requestData = (Hashtable)request.Params[0]; Hashtable responseData = new Hashtable(); string returnString = "FALSE"; - + if (requestData.Contains("ownerID") && requestData.Contains("friendID") && requestData.Contains("friendPerms")) { - UpdateUserFriendPerms(new LLUUID((string) requestData["ownerID"]), new LLUUID((string) requestData["friendID"]), - (uint) Convert.ToInt32((string) requestData["friendPerms"])); + UpdateUserFriendPerms(new LLUUID((string)requestData["ownerID"]), new LLUUID((string)requestData["friendID"]), (uint)Convert.ToInt32((string)requestData["friendPerms"])); // UserManagerBase. returnString = "TRUE"; } @@ -251,16 +234,16 @@ namespace OpenSim.Grid.UserServer public XmlRpcResponse XmlRpcResponseXmlRPCGetUserFriendList(XmlRpcRequest request) { XmlRpcResponse response = new XmlRpcResponse(); - Hashtable requestData = (Hashtable) request.Params[0]; + Hashtable requestData = (Hashtable)request.Params[0]; Hashtable responseData = new Hashtable(); List returndata = new List(); if (requestData.Contains("ownerID")) { - returndata = GetUserFriendList(new LLUUID((string) requestData["ownerID"])); + returndata = this.GetUserFriendList(new LLUUID((string)requestData["ownerID"])); } - + return FriendListItemListtoXmlRPCResponse(returndata); } @@ -338,7 +321,7 @@ namespace OpenSim.Grid.UserServer { m_log.Debug("[UserManager]: Got request to update user profile"); XmlRpcResponse response = new XmlRpcResponse(); - Hashtable requestData = (Hashtable) request.Params[0]; + Hashtable requestData = (Hashtable)request.Params[0]; Hashtable responseData = new Hashtable(); UserProfileData userProfile; @@ -347,7 +330,7 @@ namespace OpenSim.Grid.UserServer return CreateUnknownUserErrorResponse(); } - LLUUID UserUUID = new LLUUID((string) requestData["avatar_uuid"]); + LLUUID UserUUID = new LLUUID((string)requestData["avatar_uuid"]); userProfile = GetUserProfile(UserUUID); if (null == userProfile) { @@ -359,33 +342,33 @@ namespace OpenSim.Grid.UserServer } if (requestData.Contains("FLImageID")) { - userProfile.FirstLifeImage = new LLUUID((string) requestData["FLImageID"]); + userProfile.FirstLifeImage = new LLUUID((string)requestData["FLImageID"]); } if (requestData.Contains("ImageID")) { - userProfile.Image = new LLUUID((string) requestData["ImageID"]); + userProfile.Image = new LLUUID((string)requestData["ImageID"]); } // dont' know how yet if (requestData.Contains("MaturePublish")) - { + { } if (requestData.Contains("AboutText")) { - userProfile.AboutText = (string) requestData["AboutText"]; + userProfile.AboutText = (string)requestData["AboutText"]; } if (requestData.Contains("FLAboutText")) { - userProfile.FirstLifeAboutText = (string) requestData["FLAboutText"]; + userProfile.FirstLifeAboutText = (string)requestData["FLAboutText"]; } // not in DB yet. if (requestData.Contains("ProfileURL")) - { + { } if (requestData.Contains("home_region")) { try { - userProfile.HomeRegion = Convert.ToUInt64((string) requestData["home_region"]); + userProfile.HomeRegion = Convert.ToUInt64((string)requestData["home_region"]); } catch (ArgumentException) { @@ -399,23 +382,25 @@ namespace OpenSim.Grid.UserServer { m_log.Error("[PROFILE]:Failed to set home region, Value was too large"); } + } if (requestData.Contains("home_pos_x")) { try { - userProfile.HomeLocationX = (float) Convert.ToDecimal((string) requestData["home_pos_x"]); + userProfile.HomeLocationX = (float)Convert.ToDecimal((string)requestData["home_pos_x"]); } catch (InvalidCastException) { m_log.Error("[PROFILE]:Failed to set home postion x"); } + } if (requestData.Contains("home_pos_y")) { try { - userProfile.HomeLocationY = (float) Convert.ToDecimal((string) requestData["home_pos_y"]); + userProfile.HomeLocationY = (float)Convert.ToDecimal((string)requestData["home_pos_y"]); } catch (InvalidCastException) { @@ -426,7 +411,7 @@ namespace OpenSim.Grid.UserServer { try { - userProfile.HomeLocationZ = (float) Convert.ToDecimal((string) requestData["home_pos_z"]); + userProfile.HomeLocationZ = (float)Convert.ToDecimal((string)requestData["home_pos_z"]); } catch (InvalidCastException) { @@ -437,7 +422,7 @@ namespace OpenSim.Grid.UserServer { try { - userProfile.HomeLookAtX = (float) Convert.ToDecimal((string) requestData["home_look_x"]); + userProfile.HomeLookAtX = (float)Convert.ToDecimal((string)requestData["home_look_x"]); } catch (InvalidCastException) { @@ -448,7 +433,7 @@ namespace OpenSim.Grid.UserServer { try { - userProfile.HomeLookAtY = (float) Convert.ToDecimal((string) requestData["home_look_y"]); + userProfile.HomeLookAtY = (float)Convert.ToDecimal((string)requestData["home_look_y"]); } catch (InvalidCastException) { @@ -457,9 +442,9 @@ namespace OpenSim.Grid.UserServer } if (requestData.Contains("home_look_z")) { - try + try { - userProfile.HomeLookAtZ = (float) Convert.ToDecimal((string) requestData["home_look_z"]); + userProfile.HomeLookAtZ = (float)Convert.ToDecimal((string)requestData["home_look_z"]); } catch (InvalidCastException) { @@ -476,18 +461,18 @@ namespace OpenSim.Grid.UserServer public XmlRpcResponse XmlRPCLogOffUserMethodUUID(XmlRpcRequest request) { XmlRpcResponse response = new XmlRpcResponse(); - Hashtable requestData = (Hashtable) request.Params[0]; + Hashtable requestData = (Hashtable)request.Params[0]; if (requestData.Contains("avatar_uuid")) { try { - LLUUID userUUID = new LLUUID((string) requestData["avatar_uuid"]); - LLUUID RegionID = new LLUUID((string) requestData["region_uuid"]); - ulong regionhandle = (ulong) Convert.ToInt64((string) requestData["region_handle"]); - float posx = (float) Convert.ToDecimal((string) requestData["region_pos_x"]); - float posy = (float) Convert.ToDecimal((string) requestData["region_pos_y"]); - float posz = (float) Convert.ToDecimal((string) requestData["region_pos_z"]); + LLUUID userUUID = new LLUUID((string)requestData["avatar_uuid"]); + LLUUID RegionID = new LLUUID((string)requestData["region_uuid"]); + ulong regionhandle = (ulong)Convert.ToInt64((string)requestData["region_handle"]); + float posx = (float)Convert.ToDecimal((string)requestData["region_pos_x"]); + float posy = (float)Convert.ToDecimal((string)requestData["region_pos_y"]); + float posz = (float)Convert.ToDecimal((string)requestData["region_pos_z"]); handlerLogOffUser = OnLogOffUser; if (handlerLogOffUser != null) @@ -510,5 +495,20 @@ namespace OpenSim.Grid.UserServer } #endregion + + public override UserProfileData SetupMasterUser(string firstName, string lastName) + { + throw new Exception("The method or operation is not implemented."); + } + + public override UserProfileData SetupMasterUser(string firstName, string lastName, string password) + { + throw new Exception("The method or operation is not implemented."); + } + + public override UserProfileData SetupMasterUser(LLUUID uuid) + { + throw new Exception("The method or operation is not implemented."); + } } -} \ No newline at end of file +} -- cgit v1.1