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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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