Renamed IGridMessagingModule to IGridMessagingMapper.
Plus some general cleanup of the GridMessagingModule.GenericGridServerConcept
parent
03ff84426f
commit
931754a1ab
|
@ -37,7 +37,7 @@ using OpenSim.Framework;
|
|||
|
||||
namespace OpenSim.Grid.GridServer
|
||||
{
|
||||
public class GridMessagingModule : IGridMessagingModule
|
||||
public class GridMessagingModule : IGridMessagingMapper
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
|
@ -54,12 +54,7 @@ namespace OpenSim.Grid.GridServer
|
|||
protected BaseHttpServer m_httpServer;
|
||||
|
||||
// This is here so that the grid server can hand out MessageServer settings to regions on registration
|
||||
private List<MessageServerInfo> _MessageServers = new List<MessageServerInfo>();
|
||||
|
||||
public List<MessageServerInfo> MessageServers
|
||||
{
|
||||
get { return _MessageServers; }
|
||||
}
|
||||
private List<MessageServerInfo> m_messageServers = new List<MessageServerInfo>();
|
||||
|
||||
public GridMessagingModule()
|
||||
{
|
||||
|
@ -72,7 +67,7 @@ namespace OpenSim.Grid.GridServer
|
|||
m_gridCore = gridCore;
|
||||
m_config = config;
|
||||
|
||||
m_gridCore.RegisterInterface<IGridMessagingModule>(this);
|
||||
m_gridCore.RegisterInterface<IGridMessagingMapper>(this);
|
||||
|
||||
RegisterHandlers();
|
||||
}
|
||||
|
@ -92,6 +87,14 @@ namespace OpenSim.Grid.GridServer
|
|||
m_httpServer.AddXmlRPCHandler("deregister_messageserver", XmlRPCDeRegisterMessageServer);
|
||||
}
|
||||
|
||||
public List<MessageServerInfo> GetMessageServersList()
|
||||
{
|
||||
lock (m_messageServers)
|
||||
{
|
||||
return new List<MessageServerInfo>(m_messageServers);
|
||||
}
|
||||
}
|
||||
|
||||
public XmlRpcResponse XmlRPCRegisterMessageServer(XmlRpcRequest request)
|
||||
{
|
||||
XmlRpcResponse response = new XmlRpcResponse();
|
||||
|
@ -107,8 +110,7 @@ namespace OpenSim.Grid.GridServer
|
|||
m.URI = URI;
|
||||
m.sendkey = sendkey;
|
||||
m.recvkey = recvkey;
|
||||
if (!_MessageServers.Contains(m))
|
||||
_MessageServers.Add(m);
|
||||
RegisterMessageServer(m);
|
||||
responseData["responsestring"] = "TRUE";
|
||||
response.Value = responseData;
|
||||
}
|
||||
|
@ -130,12 +132,29 @@ namespace OpenSim.Grid.GridServer
|
|||
m.URI = URI;
|
||||
m.sendkey = sendkey;
|
||||
m.recvkey = recvkey;
|
||||
if (_MessageServers.Contains(m))
|
||||
_MessageServers.Remove(m);
|
||||
DeRegisterMessageServer(m);
|
||||
responseData["responsestring"] = "TRUE";
|
||||
response.Value = responseData;
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
public void RegisterMessageServer(MessageServerInfo m)
|
||||
{
|
||||
lock (m_messageServers)
|
||||
{
|
||||
if (!m_messageServers.Contains(m))
|
||||
m_messageServers.Add(m);
|
||||
}
|
||||
}
|
||||
|
||||
public void DeRegisterMessageServer(MessageServerInfo m)
|
||||
{
|
||||
lock (m_messageServers)
|
||||
{
|
||||
if (m_messageServers.Contains(m))
|
||||
m_messageServers.Remove(m);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -50,7 +50,7 @@ namespace OpenSim.Grid.GridServer
|
|||
|
||||
protected GridConfig m_config;
|
||||
|
||||
protected IGridMessagingModule m_messagingServerMapper;
|
||||
protected IGridMessagingMapper m_messagingServerMapper;
|
||||
/// <value>
|
||||
/// Used to notify old regions as to which OpenSim version to upgrade to
|
||||
/// </value>
|
||||
|
@ -79,8 +79,8 @@ namespace OpenSim.Grid.GridServer
|
|||
|
||||
public void PostInitialise()
|
||||
{
|
||||
IGridMessagingModule messagingModule;
|
||||
if (m_gridCore.TryGet<IGridMessagingModule>(out messagingModule))
|
||||
IGridMessagingMapper messagingModule;
|
||||
if (m_gridCore.TryGet<IGridMessagingMapper>(out messagingModule))
|
||||
{
|
||||
m_messagingServerMapper = messagingModule;
|
||||
}
|
||||
|
@ -401,7 +401,7 @@ namespace OpenSim.Grid.GridServer
|
|||
//{
|
||||
if(m_messagingServerMapper != null)
|
||||
{
|
||||
List<MessageServerInfo> messageServers = m_messagingServerMapper.MessageServers;
|
||||
List<MessageServerInfo> messageServers = m_messagingServerMapper.GetMessageServersList();
|
||||
responseData["messageserver_count"] = messageServers.Count;
|
||||
|
||||
for (int i = 0; i < messageServers.Count; i++)
|
||||
|
|
|
@ -1,38 +1,40 @@
|
|||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using OpenSim.Framework.Servers;
|
||||
|
||||
namespace OpenSim.Grid.GridServer
|
||||
{
|
||||
public interface IGridMessagingModule
|
||||
{
|
||||
List<MessageServerInfo> MessageServers { get; }
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using OpenSim.Framework.Servers;
|
||||
|
||||
namespace OpenSim.Grid.GridServer
|
||||
{
|
||||
public interface IGridMessagingMapper
|
||||
{
|
||||
List<MessageServerInfo> GetMessageServersList();
|
||||
void RegisterMessageServer(MessageServerInfo m);
|
||||
void DeRegisterMessageServer(MessageServerInfo m);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue