public GridRegion GetHyperlinkRegion(GridRegion gatekeeper, UUID regionID)
{
Hashtable hash = new Hashtable ();
hash["region_uuid"] = regionID.ToString ();
IList paramList = new ArrayList ();
paramList.Add (hash);
XmlRpcRequest request = new XmlRpcRequest ("get_region", paramList);
MainConsole.Instance.Debug ("[GATEKEEPER SERVICE CONNECTOR]: contacting " + gatekeeper.ServerURI);
XmlRpcResponse response = null;
try
{
response = request.Send (gatekeeper.ServerURI, 10000);
}
catch (Exception e)
{
MainConsole.Instance.Debug ("[GATEKEEPER SERVICE CONNECTOR]: Exception " + e.Message);
return null;
}
if (response.IsFault)
{
MainConsole.Instance.ErrorFormat ("[GATEKEEPER SERVICE CONNECTOR]: remote call returned an error: {0}", response.FaultString);
return null;
}
hash = (Hashtable)response.Value;
//foreach (Object o in hash)
// MainConsole.Instance.Debug(">> " + ((DictionaryEntry)o).Key + ":" + ((DictionaryEntry)o).Value);
try
{
bool success = false;
Boolean.TryParse ((string)hash["result"], out success);
if (success)
{
GridRegion region = new GridRegion ();
UUID.TryParse ((string)hash["uuid"], out region.RegionID);
//MainConsole.Instance.Debug(">> HERE, uuid: " + region.RegionID);
int n = 0;
if (hash["x"] != null)
{
Int32.TryParse ((string)hash["x"], out n);
region.RegionLocX = n;
//MainConsole.Instance.Debug(">> HERE, x: " + region.RegionLocX);
}
if (hash["y"] != null)
{
Int32.TryParse ((string)hash["y"], out n);
region.RegionLocY = n;
//MainConsole.Instance.Debug(">> HERE, y: " + region.RegionLocY);
}
if (hash["region_name"] != null)
{
region.RegionName = (string)hash["region_name"];
//MainConsole.Instance.Debug(">> HERE, region_name: " + region.RegionName);
}
if (hash["hostname"] != null)
{
region.ExternalHostName = (string)hash["hostname"];
//MainConsole.Instance.Debug(">> HERE, hostname: " + region.ExternalHostName);
}
if (hash["http_port"] != null)
{
uint p = 0;
UInt32.TryParse ((string)hash["http_port"], out p);
region.HttpPort = p;
//MainConsole.Instance.Debug(">> HERE, http_port: " + region.HttpPort);
}
if (hash["internal_port"] != null)
{
int p = 0;
Int32.TryParse ((string)hash["internal_port"], out p);
region.InternalEndPoint = new IPEndPoint (IPAddress.Parse ("0.0.0.0"), p);
//MainConsole.Instance.Debug(">> HERE, internal_port: " + region.InternalEndPoint);
}
if (hash["server_uri"] != null)
{
region.ServerURI = (string)hash["server_uri"];
//MainConsole.Instance.Debug(">> HERE, server_uri: " + region.ServerURI);
}
// Successful return
return region;
}
}
catch (Exception e)
{
MainConsole.Instance.Error ("[GATEKEEPER SERVICE CONNECTOR]: Got exception while parsing hyperlink response " + e.StackTrace);
return null;
}
return null;
}