From 4025b85a07619e1d1e22095eb3f65d2238c15378 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 5 Sep 2010 17:24:05 +0100 Subject: [PATCH] As an exmple, add the code to disable connectors intot he simian asset connector --- .../SimianGrid/SimianAssetServiceConnector.cs | 35 ++++++++++++------- 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs index 3a4f84f69c..99e69838ab 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs @@ -55,6 +55,7 @@ namespace OpenSim.Services.Connectors.SimianGrid private string m_serverUrl = String.Empty; private IImprovedAssetCache m_cache; + private bool m_Enabled = false; #region ISharedRegionModule @@ -73,8 +74,8 @@ namespace OpenSim.Services.Connectors.SimianGrid public SimianAssetServiceConnector() { } public string Name { get { return "SimianAssetServiceConnector"; } } - public void AddRegion(Scene scene) { if (!String.IsNullOrEmpty(m_serverUrl)) { scene.RegisterModuleInterface(this); } } - public void RemoveRegion(Scene scene) { if (!String.IsNullOrEmpty(m_serverUrl)) { scene.UnregisterModuleInterface(this); } } + public void AddRegion(Scene scene) { if (m_Enabled) { scene.RegisterModuleInterface(this); } } + public void RemoveRegion(Scene scene) { if (m_Enabled) { scene.UnregisterModuleInterface(this); } } #endregion ISharedRegionModule @@ -85,20 +86,30 @@ namespace OpenSim.Services.Connectors.SimianGrid public void Initialise(IConfigSource source) { - IConfig gridConfig = source.Configs["AssetService"]; - if (gridConfig != null) + IConfig moduleConfig = source.Configs["Modules"]; + if (moduleConfig != null) { - string serviceUrl = gridConfig.GetString("AssetServerURI"); - if (!String.IsNullOrEmpty(serviceUrl)) + string name = moduleConfig.GetString("AssetServices", ""); + if (name == Name) { - if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("=")) - serviceUrl = serviceUrl + '/'; - m_serverUrl = serviceUrl; + IConfig gridConfig = source.Configs["AssetService"]; + if (gridConfig != null) + { + string serviceUrl = gridConfig.GetString("AssetServerURI"); + if (!String.IsNullOrEmpty(serviceUrl)) + { + if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("=")) + serviceUrl = serviceUrl + '/'; + m_serverUrl = serviceUrl; + } + } + + if (String.IsNullOrEmpty(m_serverUrl)) + m_log.Info("[SIMIAN ASSET CONNECTOR]: No AssetServerURI specified, disabling connector"); + else + m_Enabled = true; } } - - if (String.IsNullOrEmpty(m_serverUrl)) - m_log.Info("[SIMIAN ASSET CONNECTOR]: No AssetServerURI specified, disabling connector"); } #region IAssetService