From 6a5d7650d02979c74abcbbb3595729a4a6b55411 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Thu, 24 Sep 2009 18:23:55 -0700 Subject: All tests pass for MySQL/MySQLRegionData. Added OpenSim.GridServer.ini.example that I have been using for testing the ROBUST grid service with the GridClient. --- OpenSim/Data/MySQL/MySQLRegionData.cs | 15 ++----- OpenSim/Services/GridService/GridService.cs | 5 ++- OpenSim/Services/Interfaces/IGridService.cs | 61 +++++++++-------------------- bin/OpenSim.GridServer.ini.example | 35 +++++++++++++++++ 4 files changed, 59 insertions(+), 57 deletions(-) create mode 100644 bin/OpenSim.GridServer.ini.example diff --git a/OpenSim/Data/MySQL/MySQLRegionData.cs b/OpenSim/Data/MySQL/MySQLRegionData.cs index ced26a4..e13e12c 100644 --- a/OpenSim/Data/MySQL/MySQLRegionData.cs +++ b/OpenSim/Data/MySQL/MySQLRegionData.cs @@ -77,7 +77,7 @@ namespace OpenSim.Data.MySQL cmd.Parameters.AddWithValue("?scopeID", scopeID.ToString()); List ret = RunCommand(cmd); - if (ret == null) + if (ret.Count == 0) return null; return ret[0]; @@ -95,7 +95,7 @@ namespace OpenSim.Data.MySQL cmd.Parameters.AddWithValue("?scopeID", scopeID.ToString()); List ret = RunCommand(cmd); - if (ret == null) + if (ret.Count == 0) return null; return ret[0]; @@ -170,10 +170,7 @@ namespace OpenSim.Data.MySQL result.Close(); CloseReaderCommand(cmd); - if (retList.Count > 0) - return retList; - - return null; + return retList; } public bool Store(RegionData data) @@ -182,12 +179,6 @@ namespace OpenSim.Data.MySQL data.Data.Remove("uuid"); if (data.Data.ContainsKey("ScopeID")) data.Data.Remove("ScopeID"); - if (data.Data.ContainsKey("regionName")) - data.Data.Remove("regionName"); - if (data.Data.ContainsKey("posX")) - data.Data.Remove("posX"); - if (data.Data.ContainsKey("posY")) - data.Data.Remove("posY"); string[] fields = new List(data.Data.Keys).ToArray(); diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index 01ffa1d..41344ad 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -183,9 +183,9 @@ namespace OpenSim.Services.GridService rdata.posX = (int)rinfo.RegionLocX; rdata.posY = (int)rinfo.RegionLocY; rdata.RegionID = rinfo.RegionID; - rdata.Data = rinfo.ToKeyValuePairs(); rdata.RegionName = rinfo.RegionName; - + rdata.Data = rinfo.ToKeyValuePairs(); + rdata.Data["regionHandle"] = Utils.UIntsToLong((uint)rdata.posX, (uint)rdata.posY); return rdata; } @@ -196,6 +196,7 @@ namespace OpenSim.Services.GridService rinfo.RegionLocY = rdata.posY; rinfo.RegionID = rdata.RegionID; rinfo.RegionName = rdata.RegionName; + rinfo.ScopeID = rdata.ScopeID; return rinfo; } diff --git a/OpenSim/Services/Interfaces/IGridService.cs b/OpenSim/Services/Interfaces/IGridService.cs index 4bdcde2..513b1b0 100644 --- a/OpenSim/Services/Interfaces/IGridService.cs +++ b/OpenSim/Services/Interfaces/IGridService.cs @@ -263,72 +263,47 @@ namespace OpenSim.Services.Interfaces kvp["uuid"] = RegionID.ToString(); kvp["locX"] = RegionLocX.ToString(); kvp["locY"] = RegionLocY.ToString(); - kvp["name"] = RegionName; - kvp["external_ip_address"] = ExternalEndPoint.Address.ToString(); - kvp["external_port"] = ExternalEndPoint.Port.ToString(); - kvp["external_host_name"] = ExternalHostName; - kvp["http_port"] = HttpPort.ToString(); - kvp["internal_ip_address"] = InternalEndPoint.Address.ToString(); - kvp["internal_port"] = InternalEndPoint.Port.ToString(); - kvp["alternate_ports"] = m_allow_alternate_ports.ToString(); - kvp["server_uri"] = ServerURI; + kvp["regionName"] = RegionName; + kvp["serverIP"] = ExternalHostName; //ExternalEndPoint.Address.ToString(); + kvp["serverHttpPort"] = HttpPort.ToString(); + kvp["serverURI"] = ServerURI; return kvp; } public GridRegion(Dictionary kvp) { - if (kvp["uuid"] != null) + if (kvp.ContainsKey("uuid")) RegionID = new UUID((string)kvp["uuid"]); - if (kvp["locX"] != null) + if (kvp.ContainsKey("locX")) RegionLocX = Convert.ToInt32((string)kvp["locX"]); - if (kvp["locY"] != null) + if (kvp.ContainsKey("locY")) RegionLocY = Convert.ToInt32((string)kvp["locY"]); - if (kvp["name"] != null) - RegionName = (string)kvp["name"]; + if (kvp.ContainsKey("regionName")) + RegionName = (string)kvp["regionName"]; - if ((kvp["external_ip_address"] != null) && (kvp["external_port"] != null)) + if (kvp.ContainsKey("serverIP")) { int port = 0; - Int32.TryParse((string)kvp["external_port"], out port); - IPEndPoint ep = new IPEndPoint(IPAddress.Parse((string)kvp["external_ip_address"]), port); - ExternalEndPoint = ep; + //Int32.TryParse((string)kvp["serverPort"], out port); + //IPEndPoint ep = new IPEndPoint(IPAddress.Parse((string)kvp["serverIP"]), port); + ExternalHostName = (string)kvp["serverIP"]; } else - ExternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), 0); + ExternalHostName = "127.0.0.1"; - if (kvp["external_host_name"] != null) - ExternalHostName = (string)kvp["external_host_name"]; - - if (kvp["http_port"] != null) + if (kvp.ContainsKey("serverHttpPort")) { UInt32 port = 0; - UInt32.TryParse((string)kvp["http_port"], out port); + UInt32.TryParse((string)kvp["serverHttpPort"], out port); HttpPort = port; } - if ((kvp["internal_ip_address"] != null) && (kvp["internal_port"] != null)) - { - int port = 0; - Int32.TryParse((string)kvp["internal_port"], out port); - IPEndPoint ep = new IPEndPoint(IPAddress.Parse((string)kvp["internal_ip_address"]), port); - InternalEndPoint = ep; - } - else - InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), 0); - - if (kvp["alternate_ports"] != null) - { - bool alts = false; - Boolean.TryParse((string)kvp["alternate_ports"], out alts); - m_allow_alternate_ports = alts; - } - - if (kvp["server_uri"] != null) - ServerURI = (string)kvp["server_uri"]; + if (kvp.ContainsKey("serverURI")) + ServerURI = (string)kvp["serverURI"]; } } diff --git a/bin/OpenSim.GridServer.ini.example b/bin/OpenSim.GridServer.ini.example new file mode 100644 index 0000000..695bf9e --- /dev/null +++ b/bin/OpenSim.GridServer.ini.example @@ -0,0 +1,35 @@ +; * The startup section lists all the connectors to start up in this server +; * instance. This may be only one, or it may be the entire server suite. +; * Multiple connectors should be seaprated by commas. +; * +; * These are the IN connectors the server uses, the in connectors +; * read this config file and load the needed OUT and database connectors +; * +; * +[Startup] + ServiceConnectors = "OpenSim.Server.Handlers.dll:GridServiceConnector" + +; * This is common for all services, it's the network setup for the entire +; * server instance +; * +[Network] + port = 8002 + +; * The following are for the remote console +; * They have no effect for the local or basic console types +; * Leave commented to diable logins to the console +;ConsoleUser = Test +;ConsolePass = secret + +; * As an example, the below configuration precisely mimicks the legacy +; * asset server. It is read by the asset IN connector (defined above) +; * and it then loads the OUT connector (a local database module). That, +; * in turn, reads the asset loader and database connection information +; * +[GridService] + LocalServiceModule = "OpenSim.Services.GridService.dll:GridService" + StorageProvider = "OpenSim.Data.Null.dll:NullRegionData" + ;StorageProvider = "OpenSim.Data.MySQL.dll:MySqlRegionData" + ;ConnectionString = "Data Source=localhost;Database=opensim;User ID=opensim;Password=***;" + Realm = "regions" + -- cgit v1.1