Fix loading modules with alternate configurations and ports into ROBUST.

Make all current modules support the configuration name option
remotes/origin/0.6.7-post-fixes
Melanie 2009-09-29 09:56:17 +01:00
parent 13c6202da9
commit 691f1e8aa0
14 changed files with 75 additions and 55 deletions

View File

@ -41,7 +41,7 @@ namespace OpenSim.Server.Base
{
// Logger
//
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private static readonly ILog m_Log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
// The http server instance
//
@ -55,8 +55,14 @@ namespace OpenSim.Server.Base
get { return m_HttpServer; }
}
public uint DefaultPort
{
get { return m_Port; }
}
public IHttpServer GetHttpServer(uint port)
{
m_Log.InfoFormat("[SERVER]: Requested port {0}", port);
if (port == m_Port)
return HttpServer;
@ -64,6 +70,8 @@ namespace OpenSim.Server.Base
return m_Servers[port];
m_Servers[port] = new BaseHttpServer(port);
m_Servers[port].Start();
return m_Servers[port];
}

View File

@ -141,7 +141,9 @@ namespace OpenSim.Server.Base
}
catch (Exception e)
{
m_log.ErrorFormat("Error loading plugin from {0}, exception {1}", dllName, e.InnerException);
if (!(e is System.MissingMethodException))
m_log.ErrorFormat("Error loading plugin from {0}, exception {1}", dllName, e.InnerException);
return null;
}
return plug;

View File

@ -37,13 +37,17 @@ namespace OpenSim.Server.Handlers.Asset
public class AssetServiceConnector : ServiceConnector
{
private IAssetService m_AssetService;
private string m_ConfigName = "AssetService";
public AssetServiceConnector(IConfigSource config, IHttpServer server) :
base(config, server)
public AssetServiceConnector(IConfigSource config, IHttpServer server, string configName) :
base(config, server, configName)
{
IConfig serverConfig = config.Configs["AssetService"];
if (configName != String.Empty)
m_ConfigName = configName;
IConfig serverConfig = config.Configs[m_ConfigName];
if (serverConfig == null)
throw new Exception("No section 'Server' in config file");
throw new Exception(String.Format("No section '{0}' in config file", m_ConfigName));
string assetService = serverConfig.GetString("LocalServiceModule",
String.Empty);
@ -55,7 +59,6 @@ namespace OpenSim.Server.Handlers.Asset
m_AssetService =
ServerUtils.LoadPlugin<IAssetService>(assetService, args);
//System.Console.WriteLine("XXXXXXXXXXXXXXXXXXX m_AssetSetvice == null? " + ((m_AssetService == null) ? "yes" : "no"));
server.AddStreamHandler(new AssetServerGetHandler(m_AssetService));
server.AddStreamHandler(new AssetServerPostHandler(m_AssetService));
server.AddStreamHandler(new AssetServerDeleteHandler(m_AssetService));

View File

@ -37,13 +37,17 @@ namespace OpenSim.Server.Handlers.Authentication
public class AuthenticationServiceConnector : ServiceConnector
{
private IAuthenticationService m_AuthenticationService;
private string m_ConfigName = "AuthenticationService";
public AuthenticationServiceConnector(IConfigSource config, IHttpServer server) :
base(config, server)
public AuthenticationServiceConnector(IConfigSource config, IHttpServer server, string configName) :
base(config, server, configName)
{
IConfig serverConfig = config.Configs["AuthenticationService"];
if (configName != String.Empty)
m_ConfigName = configName;
IConfig serverConfig = config.Configs[m_ConfigName];
if (serverConfig == null)
throw new Exception("No section 'Server' in config file");
throw new Exception(String.Format("No section '{0}' in config file", m_ConfigName));
string authenticationService = serverConfig.GetString("AuthenticationServiceModule",
String.Empty);

View File

@ -37,13 +37,16 @@ namespace OpenSim.Server.Handlers.Authorization
public class AuthorizationServerConnector : ServiceConnector
{
private IAuthorizationService m_AuthorizationService;
private string m_ConfigName = "AuthorizationService";
public AuthorizationServerConnector(IConfigSource config, IHttpServer server) :
base(config, server)
public AuthorizationServerConnector(IConfigSource config, IHttpServer server, string configName) :
base(config, server, configName)
{
IConfig serverConfig = config.Configs["AuthorizationService"];
if (configName != String.Empty)
m_ConfigName = configName;
IConfig serverConfig = config.Configs[m_ConfigName];
if (serverConfig == null)
throw new Exception("No section 'Server' in config file");
throw new Exception(String.Format("No section '{0}' in config file", m_ConfigName));
string authorizationService = serverConfig.GetString("LocalServiceModule",
String.Empty);

View File

@ -39,7 +39,7 @@ namespace OpenSim.Server.Handlers.Base
public class ServiceConnector : IServiceConnector
{
public ServiceConnector(IConfigSource config, IHttpServer server)
public ServiceConnector(IConfigSource config, IHttpServer server, string configName)
{
}
}

View File

@ -37,19 +37,23 @@ namespace OpenSim.Server.Handlers.Freeswitch
public class FreeswitchServerConnector : ServiceConnector
{
private IFreeswitchService m_FreeswitchService;
private string m_ConfigName = "FreeswitchService";
public FreeswitchServerConnector(IConfigSource config, IHttpServer server) :
base(config, server)
public FreeswitchServerConnector(IConfigSource config, IHttpServer server, string configName) :
base(config, server, configName)
{
IConfig serverConfig = config.Configs["FreeswitchService"];
if (configName != String.Empty)
m_ConfigName = configName;
IConfig serverConfig = config.Configs[m_ConfigName];
if (serverConfig == null)
throw new Exception("No section 'Server' in config file");
throw new Exception(String.Format("No section '{0}' in config file", m_ConfigName));
string freeswitchService = serverConfig.GetString("LocalServiceModule",
String.Empty);
if (freeswitchService == String.Empty)
throw new Exception("No FreeswitchService in config file");
throw new Exception("No LocalServiceModule in config file");
Object[] args = new Object[] { config };
m_FreeswitchService =

View File

@ -37,19 +37,20 @@ namespace OpenSim.Server.Handlers.Grid
public class GridServiceConnector : ServiceConnector
{
private IGridService m_GridService;
private string m_ConfigName = "GridService";
public GridServiceConnector(IConfigSource config, IHttpServer server) :
base(config, server)
public GridServiceConnector(IConfigSource config, IHttpServer server, string configName) :
base(config, server, configName)
{
IConfig serverConfig = config.Configs["GridService"];
IConfig serverConfig = config.Configs[m_ConfigName];
if (serverConfig == null)
throw new Exception("No section 'Server' in config file");
throw new Exception(String.Format("No section {0} in config file", m_ConfigName));
string gridService = serverConfig.GetString("LocalServiceModule",
String.Empty);
if (gridService == String.Empty)
throw new Exception("No GridService in config file");
throw new Exception("No LocalServiceModule in config file");
Object[] args = new Object[] { config };
m_GridService = ServerUtils.LoadPlugin<IGridService>(gridService, args);

View File

@ -51,7 +51,7 @@ namespace OpenSim.Server.Handlers.Grid
private List<SimpleRegionInfo> m_RegionsOnSim = new List<SimpleRegionInfo>();
public HypergridServiceInConnector(IConfigSource config, IHttpServer server) :
base(config, server)
base(config, server, String.Empty)
{
server.AddXmlRPCHandler("linkk_region", LinkRegionRequest, false);
}

View File

@ -54,19 +54,20 @@ namespace OpenSim.Server.Handlers.Inventory
//private AuthedSessionCache m_session_cache = new AuthedSessionCache(INVENTORY_DEFAULT_SESSION_TIME);
private string m_userserver_url;
private string m_ConfigName = "InventoryService";
public InventoryServiceInConnector(IConfigSource config, IHttpServer server) :
base(config, server)
public InventoryServiceInConnector(IConfigSource config, IHttpServer server, string configName) :
base(config, server, configName)
{
IConfig serverConfig = config.Configs["InventoryService"];
IConfig serverConfig = config.Configs[m_ConfigName];
if (serverConfig == null)
throw new Exception("No section 'InventoryService' in config file");
throw new Exception(String.Format("No section '{0}' in config file", m_ConfigName));
string inventoryService = serverConfig.GetString("LocalServiceModule",
String.Empty);
if (inventoryService == String.Empty)
throw new Exception("No InventoryService in config file");
throw new Exception("No LocalServiceModule in config file");
Object[] args = new Object[] { config };
m_InventoryService =

View File

@ -46,7 +46,7 @@ namespace OpenSim.Server.Handlers.Land
// TODO : private IAuthenticationService m_AuthenticationService;
public LandServiceInConnector(IConfigSource source, IHttpServer server, ILandService service, IScene scene) :
base(source, server)
base(source, server, String.Empty)
{
m_LandService = service;
if (m_LandService == null)

View File

@ -46,7 +46,7 @@ namespace OpenSim.Server.Handlers.Neighbour
private IAuthenticationService m_AuthenticationService = null;
public NeighbourServiceInConnector(IConfigSource source, IHttpServer server, INeighbourService nService, IScene scene) :
base(source, server)
base(source, server, String.Empty)
{
m_NeighbourService = nService;

View File

@ -41,7 +41,7 @@ namespace OpenSim.Server.Handlers.Simulation
private IAuthenticationService m_AuthenticationService;
public SimulationServiceInConnector(IConfigSource config, IHttpServer server, IScene scene) :
base(config, server)
base(config, server, String.Empty)
{
IConfig serverConfig = config.Configs["SimulationService"];
if (serverConfig == null)

View File

@ -96,29 +96,23 @@ namespace OpenSim.Server
if (port != 0)
server = m_Server.GetHttpServer(port);
m_log.InfoFormat("[SERVER]: Loading {0}", friendlyName);
if (port != m_Server.DefaultPort)
m_log.InfoFormat("[SERVER]: Loading {0} on port {1}", friendlyName, port);
else
m_log.InfoFormat("[SERVER]: Loading {0}", friendlyName);
IServiceConnector connector = null;
try
{
Object[] modargs = null;
if (configName != string.Empty)
{
modargs = new Object[] { m_Server.Config, server,
configName };
connector = ServerUtils.LoadPlugin<IServiceConnector>(conn,
modargs);
}
if (connector == null)
{
modargs = new Object[] { m_Server.Config, server };
connector =
ServerUtils.LoadPlugin<IServiceConnector>(conn,
modargs);
}
}
catch (Exception)
Object[] modargs = new Object[] { m_Server.Config, server,
configName };
connector = ServerUtils.LoadPlugin<IServiceConnector>(conn,
modargs);
if (connector == null)
{
modargs = new Object[] { m_Server.Config, server };
connector =
ServerUtils.LoadPlugin<IServiceConnector>(conn,
modargs);
}
if (connector != null)