parent
5feeea00ae
commit
9fbcceb1db
|
@ -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);
|
||||
|
||||
|
|
|
@ -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];
|
||||
|
|
|
@ -41,22 +41,49 @@ using OpenMetaverse;
|
|||
using OpenMetaverse.Imaging;
|
||||
using log4net;
|
||||
using Nwc.XmlRpc;
|
||||
using Nini.Config;
|
||||
|
||||
namespace OpenSim.Services.Connectors.Hypergrid
|
||||
{
|
||||
public class HypergridServiceConnector
|
||||
public class HypergridServiceConnector : IHypergridService
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private IAssetService m_AssetService;
|
||||
private string m_ServerURL;
|
||||
|
||||
public HypergridServiceConnector() : this(null) { }
|
||||
public HypergridServiceConnector() { }
|
||||
|
||||
public HypergridServiceConnector(IAssetService assService)
|
||||
{
|
||||
m_AssetService = assService;
|
||||
}
|
||||
|
||||
public HypergridServiceConnector(IConfigSource source)
|
||||
{
|
||||
Initialise(source);
|
||||
}
|
||||
|
||||
public virtual void Initialise(IConfigSource source)
|
||||
{
|
||||
IConfig hgConfig = source.Configs["HypergridService"];
|
||||
if (hgConfig == null)
|
||||
{
|
||||
m_log.Error("[HYPERGRID CONNECTOR]: HypergridService missing from OpenSim.ini");
|
||||
throw new Exception("Hypergrid connector init error");
|
||||
}
|
||||
|
||||
string serviceURI = hgConfig.GetString("HypergridServerURI",
|
||||
String.Empty);
|
||||
|
||||
if (serviceURI == String.Empty)
|
||||
{
|
||||
m_log.Error("[HYPERGRID CONNECTOR]: No Server URI named in section HypergridService");
|
||||
throw new Exception("Hypergrid connector init error");
|
||||
}
|
||||
m_ServerURL = serviceURI;
|
||||
}
|
||||
|
||||
public bool LinkRegion(GridRegion info, out UUID regionID, out ulong realHandle, out string imageURL, out string reason)
|
||||
{
|
||||
regionID = UUID.Zero;
|
||||
|
@ -246,5 +273,82 @@ namespace OpenSim.Services.Connectors.Hypergrid
|
|||
|
||||
return null;
|
||||
}
|
||||
|
||||
#region From local regions to grid-wide hypergrid service
|
||||
|
||||
public bool LinkRegion(string regionDescriptor, out UUID regionID, out ulong realHandle, out string imageURL, out string reason)
|
||||
{
|
||||
regionID = UUID.Zero;
|
||||
imageURL = string.Empty;
|
||||
realHandle = 0;
|
||||
reason = string.Empty;
|
||||
|
||||
Hashtable hash = new Hashtable();
|
||||
hash["region_desc"] = regionDescriptor;
|
||||
|
||||
IList paramList = new ArrayList();
|
||||
paramList.Add(hash);
|
||||
|
||||
XmlRpcRequest request = new XmlRpcRequest("link_region_by_desc", paramList);
|
||||
XmlRpcResponse response = null;
|
||||
try
|
||||
{
|
||||
response = request.Send(m_ServerURL, 10000);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.Debug("[HGrid]: Exception " + e.Message);
|
||||
reason = "Error contacting remote server";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (response.IsFault)
|
||||
{
|
||||
reason = response.FaultString;
|
||||
m_log.ErrorFormat("[HGrid]: remote call returned an error: {0}", response.FaultString);
|
||||
return false;
|
||||
}
|
||||
|
||||
hash = (Hashtable)response.Value;
|
||||
//foreach (Object o in hash)
|
||||
// m_log.Debug(">> " + ((DictionaryEntry)o).Key + ":" + ((DictionaryEntry)o).Value);
|
||||
try
|
||||
{
|
||||
bool success = false;
|
||||
Boolean.TryParse((string)hash["result"], out success);
|
||||
if (success)
|
||||
{
|
||||
UUID.TryParse((string)hash["uuid"], out regionID);
|
||||
//m_log.Debug(">> HERE, uuid: " + uuid);
|
||||
if ((string)hash["handle"] != null)
|
||||
{
|
||||
realHandle = Convert.ToUInt64((string)hash["handle"]);
|
||||
//m_log.Debug(">> HERE, realHandle: " + realHandle);
|
||||
}
|
||||
if (hash["region_image"] != null)
|
||||
{
|
||||
imageURL = (string)hash["region_image"];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
reason = "Error parsing return arguments";
|
||||
m_log.Error("[HGrid]: Got exception while parsing hyperlink response " + e.StackTrace);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// TODO !!!
|
||||
public GridRegion GetRegionByUUID(UUID regionID) { return null; }
|
||||
public GridRegion GetRegionByPosition(int x, int y) { return null; }
|
||||
public GridRegion GetRegionByName(string name) { return null; }
|
||||
public List<GridRegion> GetRegionsByName(string name) { return null; }
|
||||
public List<GridRegion> GetRegionRange(int xmin, int xmax, int ymin, int ymax) { return null; }
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,7 +42,6 @@ ServiceConnectors = "OpenSim.Server.Handlers.dll:AssetServiceConnector,OpenSim.S
|
|||
; *
|
||||
[InventoryService]
|
||||
LocalServiceModule = "OpenSim.Services.InventoryService.dll:InventoryService"
|
||||
UserServerURI = "http://127.0.0.1:8002"
|
||||
SessionAuthentication = "false"
|
||||
StorageProvider = "OpenSim.Data.MySQL.dll"
|
||||
ConnectionString = "Data Source=localhost;Database=opensim;User ID=opensim;Password=opensim123;"
|
||||
|
@ -58,10 +57,12 @@ ServiceConnectors = "OpenSim.Server.Handlers.dll:AssetServiceConnector,OpenSim.S
|
|||
Realm = "regions"
|
||||
; AllowDuplicateNames = "True"
|
||||
;; Next, we can specify properties of regions, including default and fallback regions
|
||||
;; The syntax is: Region_<RegioName> = "<flags>"
|
||||
;; The syntax is: Region_<RegionName> = "<flags>"
|
||||
;; or: Region_<RegionID> = "<flags>"
|
||||
;; where <flags> can be DefaultRegion, FallbackRegion, NoDirectLogin, Persistent, LockedOut,Reservation,NoMove,Authenticate
|
||||
;; For example:
|
||||
; Region_Welcome_Area = "DefaultRegion, FallbackRegion"
|
||||
; (replace spaces with underscore)
|
||||
|
||||
; * This is the configuration for the freeswitch server in grid mode
|
||||
[FreeswitchService]
|
||||
|
|
|
@ -17,18 +17,17 @@
|
|||
AvatarServices = "RemoteAvatarServicesConnector"
|
||||
NeighbourServices = "RemoteNeighbourServicesConnector"
|
||||
AuthenticationServices = "RemoteAuthenticationServicesConnector"
|
||||
AuthorizationServices = "LocalAuthorizationServicesConnector"
|
||||
PresenceServices = "RemotePresenceServicesConnector"
|
||||
UserAccountServices = "RemoteUserAccountServicesConnector"
|
||||
SimulationServices = "RemoteSimulationConnectorModule"
|
||||
EntityTransferModule = "BasicEntityTransferModule"
|
||||
EntityTransferModule = "HGEntityTransferModule"
|
||||
LandServiceInConnector = true
|
||||
NeighbourServiceInConnector = true
|
||||
HypergridServiceInConnector = true
|
||||
SimulationServiceInConnector = true
|
||||
LibraryModule = true
|
||||
InventoryServiceInConnector = false
|
||||
AssetServiceInConnector = false
|
||||
LLLoginServiceInConnector = false
|
||||
|
||||
[AssetService]
|
||||
LocalGridAssetService = "OpenSim.Services.Connectors.dll:AssetServicesConnector"
|
||||
|
@ -41,12 +40,12 @@
|
|||
[GridService]
|
||||
; for the HGGridServicesConnector to instantiate
|
||||
GridServiceConnectorModule = "OpenSim.Region.CoreModules.dll:RemoteGridServicesConnector"
|
||||
HypergridService = "OpenSim.Services.HypergridService.dll:HypergridService"
|
||||
; RemoteGridServicesConnector instantiates a LocalGridServicesConnector,
|
||||
; which in turn uses this
|
||||
LocalServiceModule = "OpenSim.Services.GridService.dll:GridService"
|
||||
StorageProvider = "OpenSim.Data.Null.dll:NullRegionData"
|
||||
|
||||
[LibraryService]
|
||||
LocalServiceModule = "OpenSim.Services.InventoryService.dll:LibraryService"
|
||||
LibraryName = "OpenSim Library"
|
||||
DefaultLibrary = "./inventory/Libraries.xml"
|
||||
[HypergridService]
|
||||
GridService = "OpenSim.Services.GridService.dll:GridService"
|
||||
AssetService = "OpenSim.Services.AssetService.dll:AssetService"
|
||||
|
|
Loading…
Reference in New Issue