Fixed SimianGrid connectors to gracefully exit if the required config sections are missing

slimupdates
John Hurliman 2010-03-12 13:16:44 -08:00
parent aad17e7513
commit 0b5141d45b
9 changed files with 63 additions and 56 deletions

View File

@ -46,7 +46,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
/// Connects to the SimianGrid asset service
/// </summary>
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
public class SimianAssetServiceConnector : IAssetService
public class SimianAssetServiceConnector : IAssetService, ISharedRegionModule
{
private static readonly ILog m_log =
LogManager.GetLogger(
@ -73,9 +73,9 @@ namespace OpenSim.Services.Connectors.SimianGrid
public SimianAssetServiceConnector() { }
public string Name { get { return "SimianAssetServiceConnector"; } }
public void AddRegion(Scene scene) { scene.RegisterModuleInterface<IAssetService>(this); }
public void RemoveRegion(Scene scene) { scene.UnregisterModuleInterface<IAssetService>(this); }
public void AddRegion(Scene scene) { if (!String.IsNullOrEmpty(m_serverUrl)) { scene.RegisterModuleInterface<IAssetService>(this); } }
public void RemoveRegion(Scene scene) { if (!String.IsNullOrEmpty(m_serverUrl)) { scene.UnregisterModuleInterface<IAssetService>(this); } }
#endregion ISharedRegionModule
public SimianAssetServiceConnector(IConfigSource source)
@ -88,8 +88,8 @@ namespace OpenSim.Services.Connectors.SimianGrid
IConfig gridConfig = source.Configs["AssetService"];
if (gridConfig == null)
{
m_log.Error("[ASSET CONNECTOR]: AssetService missing from OpenSim.ini");
throw new Exception("Asset connector init error");
m_log.Info("[ASSET CONNECTOR]: AssetService missing from OpenSim.ini, skipping SimianAssetServiceConnector");
return;
}
string serviceUrl = gridConfig.GetString("AssetServerURI");

View File

@ -44,7 +44,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
/// Connects authentication/authorization to the SimianGrid backend
/// </summary>
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
public class SimianAuthenticationServiceConnector : IAuthenticationService
public class SimianAuthenticationServiceConnector : IAuthenticationService, ISharedRegionModule
{
private static readonly ILog m_log =
LogManager.GetLogger(
@ -61,8 +61,8 @@ namespace OpenSim.Services.Connectors.SimianGrid
public SimianAuthenticationServiceConnector() { }
public string Name { get { return "SimianAuthenticationServiceConnector"; } }
public void AddRegion(Scene scene) { scene.RegisterModuleInterface<IAuthenticationService>(this); }
public void RemoveRegion(Scene scene) { scene.UnregisterModuleInterface<IAuthenticationService>(this); }
public void AddRegion(Scene scene) { if (!String.IsNullOrEmpty(m_serverUrl)) { scene.RegisterModuleInterface<IAuthenticationService>(this); } }
public void RemoveRegion(Scene scene) { if (!String.IsNullOrEmpty(m_serverUrl)) { scene.UnregisterModuleInterface<IAuthenticationService>(this); } }
#endregion ISharedRegionModule
@ -76,8 +76,8 @@ namespace OpenSim.Services.Connectors.SimianGrid
IConfig assetConfig = source.Configs["AuthenticationService"];
if (assetConfig == null)
{
m_log.Error("[AUTH CONNECTOR]: AuthenticationService missing from OpenSim.ini");
throw new Exception("Authentication connector init error");
m_log.Info("[AUTH CONNECTOR]: AuthenticationService missing from OpenSim.ini, skipping SimianAuthenticationServiceConnector");
return;
}
string serviceURI = assetConfig.GetString("AuthenticationServerURI");

View File

@ -48,7 +48,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
/// Connects avatar appearance data to the SimianGrid backend
/// </summary>
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
public class SimianAvatarServiceConnector : IAvatarService
public class SimianAvatarServiceConnector : IAvatarService, ISharedRegionModule
{
private static readonly ILog m_log =
LogManager.GetLogger(
@ -66,8 +66,8 @@ namespace OpenSim.Services.Connectors.SimianGrid
public SimianAvatarServiceConnector() { }
public string Name { get { return "SimianAvatarServiceConnector"; } }
public void AddRegion(Scene scene) { scene.RegisterModuleInterface<IAvatarService>(this); }
public void RemoveRegion(Scene scene) { scene.UnregisterModuleInterface<IAvatarService>(this); }
public void AddRegion(Scene scene) { if (!String.IsNullOrEmpty(m_serverUrl)) { scene.RegisterModuleInterface<IAvatarService>(this); } }
public void RemoveRegion(Scene scene) { if (!String.IsNullOrEmpty(m_serverUrl)) { scene.UnregisterModuleInterface<IAvatarService>(this); } }
#endregion ISharedRegionModule
@ -81,8 +81,8 @@ namespace OpenSim.Services.Connectors.SimianGrid
IConfig gridConfig = source.Configs["AvatarService"];
if (gridConfig == null)
{
m_log.Error("[AVATAR CONNECTOR]: AvatarService missing from OpenSim.ini");
throw new Exception("Avatar connector init error");
m_log.Info("[AVATAR CONNECTOR]: AvatarService missing from OpenSim.ini, skipping SimianAvatarServiceConnector");
return;
}
string serviceUrl = gridConfig.GetString("AvatarServerURI");

View File

@ -47,7 +47,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
/// Stores and retrieves friend lists from the SimianGrid backend
/// </summary>
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
public class SimianFriendsServiceConnector : IFriendsService
public class SimianFriendsServiceConnector : IFriendsService, ISharedRegionModule
{
private static readonly ILog m_log =
LogManager.GetLogger(
@ -64,8 +64,8 @@ namespace OpenSim.Services.Connectors.SimianGrid
public SimianFriendsServiceConnector() { }
public string Name { get { return "SimianFriendsServiceConnector"; } }
public void AddRegion(Scene scene) { scene.RegisterModuleInterface<IFriendsService>(this); }
public void RemoveRegion(Scene scene) { scene.UnregisterModuleInterface<IFriendsService>(this); }
public void AddRegion(Scene scene) { if (!String.IsNullOrEmpty(m_serverUrl)) { scene.RegisterModuleInterface<IFriendsService>(this); } }
public void RemoveRegion(Scene scene) { if (!String.IsNullOrEmpty(m_serverUrl)) { scene.UnregisterModuleInterface<IFriendsService>(this); } }
#endregion ISharedRegionModule
@ -79,8 +79,8 @@ namespace OpenSim.Services.Connectors.SimianGrid
IConfig assetConfig = source.Configs["FriendsService"];
if (assetConfig == null)
{
m_log.Error("[FRIENDS CONNECTOR]: FriendsService missing from OpenSim.ini");
throw new Exception("Friends connector init error");
m_log.Info("[FRIENDS CONNECTOR]: FriendsService missing from OpenSim.ini, skipping SimianFriendsServiceConnector");
return;
}
string serviceURI = assetConfig.GetString("FriendsServerURI");

View File

@ -51,7 +51,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
/// backend
/// </summary>
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
public class SimianGridServiceConnector : IGridService
public class SimianGridServiceConnector : IGridService, ISharedRegionModule
{
private static readonly ILog m_log =
LogManager.GetLogger(
@ -68,8 +68,8 @@ namespace OpenSim.Services.Connectors.SimianGrid
public SimianGridServiceConnector() { }
public string Name { get { return "SimianGridServiceConnector"; } }
public void AddRegion(Scene scene) { scene.RegisterModuleInterface<IGridService>(this); }
public void RemoveRegion(Scene scene) { scene.UnregisterModuleInterface<IGridService>(this); }
public void AddRegion(Scene scene) { if (!String.IsNullOrEmpty(m_serverUrl)) { scene.RegisterModuleInterface<IGridService>(this); } }
public void RemoveRegion(Scene scene) { if (!String.IsNullOrEmpty(m_serverUrl)) { scene.UnregisterModuleInterface<IGridService>(this); } }
#endregion ISharedRegionModule
@ -83,8 +83,8 @@ namespace OpenSim.Services.Connectors.SimianGrid
IConfig gridConfig = source.Configs["GridService"];
if (gridConfig == null)
{
m_log.Error("[GRID CONNECTOR]: GridService missing from OpenSim.ini");
throw new Exception("Grid connector init error");
m_log.Info("[GRID CONNECTOR]: GridService missing from OpenSim.ini, skipping SimianGridServiceConnector");
return;
}
string serviceUrl = gridConfig.GetString("GridServerURI");

View File

@ -61,7 +61,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
/// Connects avatar inventories to the SimianGrid backend
/// </summary>
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
public class SimianInventoryServiceConnector : IInventoryService
public class SimianInventoryServiceConnector : IInventoryService, ISharedRegionModule
{
private static readonly ILog m_log =
LogManager.GetLogger(
@ -80,8 +80,8 @@ namespace OpenSim.Services.Connectors.SimianGrid
public SimianInventoryServiceConnector() { }
public string Name { get { return "SimianInventoryServiceConnector"; } }
public void AddRegion(Scene scene) { scene.RegisterModuleInterface<IInventoryService>(this); }
public void RemoveRegion(Scene scene) { scene.UnregisterModuleInterface<IInventoryService>(this); }
public void AddRegion(Scene scene) { if (!String.IsNullOrEmpty(m_serverUrl)) { scene.RegisterModuleInterface<IInventoryService>(this); } }
public void RemoveRegion(Scene scene) { if (!String.IsNullOrEmpty(m_serverUrl)) { scene.UnregisterModuleInterface<IInventoryService>(this); } }
#endregion ISharedRegionModule
@ -95,8 +95,8 @@ namespace OpenSim.Services.Connectors.SimianGrid
IConfig gridConfig = source.Configs["InventoryService"];
if (gridConfig == null)
{
m_log.Error("[INVENTORY CONNECTOR]: InventoryService missing from OpenSim.ini");
throw new Exception("Inventory connector init error");
m_log.Info("[INVENTORY CONNECTOR]: InventoryService missing from OpenSim.ini, skipping SimianInventoryServiceConnector");
return;
}
string serviceUrl = gridConfig.GetString("InventoryServerURI");

View File

@ -51,7 +51,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
/// message routing) to the SimianGrid backend
/// </summary>
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
public class SimianPresenceServiceConnector : IPresenceService
public class SimianPresenceServiceConnector : IPresenceService, ISharedRegionModule
{
private static readonly ILog m_log =
LogManager.GetLogger(
@ -70,23 +70,29 @@ namespace OpenSim.Services.Connectors.SimianGrid
public string Name { get { return "SimianPresenceServiceConnector"; } }
public void AddRegion(Scene scene)
{
scene.RegisterModuleInterface<IPresenceService>(this);
if (!String.IsNullOrEmpty(m_serverUrl))
{
scene.RegisterModuleInterface<IPresenceService>(this);
scene.EventManager.OnMakeRootAgent += MakeRootAgentHandler;
scene.EventManager.OnNewClient += NewClientHandler;
scene.EventManager.OnSignificantClientMovement += SignificantClientMovementHandler;
scene.EventManager.OnMakeRootAgent += MakeRootAgentHandler;
scene.EventManager.OnNewClient += NewClientHandler;
scene.EventManager.OnSignificantClientMovement += SignificantClientMovementHandler;
LogoutRegionAgents(scene.RegionInfo.RegionID);
LogoutRegionAgents(scene.RegionInfo.RegionID);
}
}
public void RemoveRegion(Scene scene)
{
scene.UnregisterModuleInterface<IPresenceService>(this);
if (!String.IsNullOrEmpty(m_serverUrl))
{
scene.UnregisterModuleInterface<IPresenceService>(this);
scene.EventManager.OnMakeRootAgent -= MakeRootAgentHandler;
scene.EventManager.OnNewClient -= NewClientHandler;
scene.EventManager.OnSignificantClientMovement -= SignificantClientMovementHandler;
scene.EventManager.OnMakeRootAgent -= MakeRootAgentHandler;
scene.EventManager.OnNewClient -= NewClientHandler;
scene.EventManager.OnSignificantClientMovement -= SignificantClientMovementHandler;
LogoutRegionAgents(scene.RegionInfo.RegionID);
LogoutRegionAgents(scene.RegionInfo.RegionID);
}
}
#endregion ISharedRegionModule
@ -101,8 +107,8 @@ namespace OpenSim.Services.Connectors.SimianGrid
IConfig gridConfig = source.Configs["PresenceService"];
if (gridConfig == null)
{
m_log.Error("[PRESENCE CONNECTOR]: PresenceService missing from OpenSim.ini");
throw new Exception("Presence connector init error");
m_log.Info("[PRESENCE CONNECTOR]: PresenceService missing from OpenSim.ini, skipping SimianPresenceServiceConnector");
return;
}
string serviceUrl = gridConfig.GetString("PresenceServerURI");

View File

@ -60,7 +60,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
/// backend
/// </summary>
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
public class SimianProfiles
public class SimianProfiles : INonSharedRegionModule
{
private static readonly ILog m_log =
LogManager.GetLogger(
@ -69,15 +69,15 @@ namespace OpenSim.Services.Connectors.SimianGrid
private string m_serverUrl = String.Empty;
#region INonSharedRegionModule
public Type ReplaceableInterface { get { return null; } }
public void RegionLoaded(Scene scene) { }
public void Close() { }
public SimianProfiles() { }
public string Name { get { return "SimianProfiles"; } }
public void AddRegion(Scene scene) { CheckEstateManager(scene); scene.EventManager.OnClientConnect += ClientConnectHandler; }
public void RemoveRegion(Scene scene) { scene.EventManager.OnClientConnect -= ClientConnectHandler; }
public void AddRegion(Scene scene) { if (!String.IsNullOrEmpty(m_serverUrl)) { CheckEstateManager(scene); scene.EventManager.OnClientConnect += ClientConnectHandler; } }
public void RemoveRegion(Scene scene) { if (!String.IsNullOrEmpty(m_serverUrl)) { scene.EventManager.OnClientConnect -= ClientConnectHandler; } }
#endregion INonSharedRegionModule
@ -91,8 +91,8 @@ namespace OpenSim.Services.Connectors.SimianGrid
IConfig gridConfig = source.Configs["UserAccountService"];
if (gridConfig == null)
{
m_log.Error("[PROFILES]: UserAccountService missing from OpenSim.ini");
throw new Exception("Profiles init error");
m_log.Error("[PROFILES]: UserAccountService missing from OpenSim.ini, skipping SimianProfiles");
return;
}
string serviceUrl = gridConfig.GetString("UserAccountServerURI");

View File

@ -47,14 +47,14 @@ namespace OpenSim.Services.Connectors.SimianGrid
/// users) to the SimianGrid backend
/// </summary>
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
public class SimianUserAccountServiceConnector : IUserAccountService
public class SimianUserAccountServiceConnector : IUserAccountService, ISharedRegionModule
{
private static readonly ILog m_log =
LogManager.GetLogger(
MethodBase.GetCurrentMethod().DeclaringType);
private string m_serverUrl = String.Empty;
private ExpiringCache<UUID, UserAccount> m_accountCache = new ExpiringCache<UUID, UserAccount>();
private ExpiringCache<UUID, UserAccount> m_accountCache;
#region ISharedRegionModule
@ -65,8 +65,8 @@ namespace OpenSim.Services.Connectors.SimianGrid
public SimianUserAccountServiceConnector() { }
public string Name { get { return "SimianUserAccountServiceConnector"; } }
public void AddRegion(Scene scene) { scene.RegisterModuleInterface<IUserAccountService>(this); }
public void RemoveRegion(Scene scene) { scene.UnregisterModuleInterface<IUserAccountService>(this); }
public void AddRegion(Scene scene) { if (!String.IsNullOrEmpty(m_serverUrl)) { scene.RegisterModuleInterface<IUserAccountService>(this); } }
public void RemoveRegion(Scene scene) { if (!String.IsNullOrEmpty(m_serverUrl)) { scene.UnregisterModuleInterface<IUserAccountService>(this); } }
#endregion ISharedRegionModule
@ -80,8 +80,8 @@ namespace OpenSim.Services.Connectors.SimianGrid
IConfig assetConfig = source.Configs["UserAccountService"];
if (assetConfig == null)
{
m_log.Error("[ACCOUNT CONNECTOR]: UserAccountService missing from OpenSim.ini");
throw new Exception("User account connector init error");
m_log.Error("[ACCOUNT CONNECTOR]: UserAccountService missing from OpenSim.ini, skipping SimianUserAccountServiceConnector");
return;
}
string serviceURI = assetConfig.GetString("UserAccountServerURI");
@ -91,6 +91,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
throw new Exception("User account connector init error");
}
m_accountCache = new ExpiringCache<UUID, UserAccount>();
m_serverUrl = serviceURI;
}