* Towards enabling hyperlinks at grid-level.

* Updated grid configs
This commit is contained in:
Diva Canto
2010-01-18 20:35:59 -08:00
parent 5feeea00ae
commit 9fbcceb1db
5 changed files with 158 additions and 15 deletions

View File

@@ -51,6 +51,8 @@ namespace OpenSim.Server.Handlers.Hypergrid
get { return m_GatekeeperService; }
}
private IHypergridService m_HypergridService;
public GatekeeperServiceInConnector(IConfigSource config, IHttpServer server, ISimulationService simService) :
base(config, server, String.Empty)
{
@@ -60,12 +62,17 @@ namespace OpenSim.Server.Handlers.Hypergrid
string serviceDll = gridConfig.GetString("LocalServiceModule", string.Empty);
Object[] args = new Object[] { config, simService };
m_GatekeeperService = ServerUtils.LoadPlugin<IGatekeeperService>(serviceDll, args);
serviceDll = gridConfig.GetString("HypergridService", string.Empty);
m_HypergridService = ServerUtils.LoadPlugin<IHypergridService>(serviceDll, args);
}
if (m_GatekeeperService == null)
if (m_GatekeeperService == null || m_HypergridService == null)
throw new Exception("Gatekeeper server connector cannot proceed because of missing service");
HypergridHandlers hghandlers = new HypergridHandlers(m_GatekeeperService);
HypergridHandlers hghandlers = new HypergridHandlers(m_GatekeeperService, m_HypergridService);
server.AddXmlRPCHandler("link_region", hghandlers.LinkRegionRequest, false);
server.AddXmlRPCHandler("link_region_by_desc", hghandlers.LinkRegionByDescRequest, false);
server.AddXmlRPCHandler("get_region", hghandlers.GetRegion, false);
server.AddXmlRPCHandler("get_home_region", hghandlers.GetHomeRegion, false);

View File

@@ -44,10 +44,12 @@ namespace OpenSim.Server.Handlers.Hypergrid
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private IGatekeeperService m_GatekeeperService;
private IHypergridService m_HypergridService;
public HypergridHandlers(IGatekeeperService gatekeeper)
public HypergridHandlers(IGatekeeperService gatekeeper, IHypergridService hyper)
{
m_GatekeeperService = gatekeeper;
m_HypergridService = hyper;
}
/// <summary>
@@ -80,6 +82,36 @@ namespace OpenSim.Server.Handlers.Hypergrid
return response;
}
/// <summary>
/// A local region wants to establish a grid-wide hyperlink to another region
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public XmlRpcResponse LinkRegionByDescRequest(XmlRpcRequest request, IPEndPoint remoteClient)
{
Hashtable requestData = (Hashtable)request.Params[0];
//string host = (string)requestData["host"];
//string portstr = (string)requestData["port"];
string descriptor = (string)requestData["region_desc"];
UUID regionID = UUID.Zero;
string imageURL = string.Empty;
ulong regionHandle = 0;
string reason = string.Empty;
bool success = m_HypergridService.LinkRegion(descriptor, out regionID, out regionHandle, out imageURL, out reason);
Hashtable hash = new Hashtable();
hash["result"] = success.ToString();
hash["uuid"] = regionID.ToString();
hash["handle"] = regionHandle.ToString();
hash["region_image"] = imageURL;
XmlRpcResponse response = new XmlRpcResponse();
response.Value = hash;
return response;
}
public XmlRpcResponse GetRegion(XmlRpcRequest request, IPEndPoint remoteClient)
{
Hashtable requestData = (Hashtable)request.Params[0];