Add m_Enabled pattern to SimianGridConnector
parent
4025b85a07
commit
d9e9c41e13
|
@ -60,6 +60,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
||||||
|
|
||||||
private string m_serverUrl = String.Empty;
|
private string m_serverUrl = String.Empty;
|
||||||
private Dictionary<UUID, Scene> m_scenes = new Dictionary<UUID, Scene>();
|
private Dictionary<UUID, Scene> m_scenes = new Dictionary<UUID, Scene>();
|
||||||
|
private bool m_Enabled = false;
|
||||||
|
|
||||||
#region ISharedRegionModule
|
#region ISharedRegionModule
|
||||||
|
|
||||||
|
@ -72,20 +73,24 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
||||||
public string Name { get { return "SimianGridServiceConnector"; } }
|
public string Name { get { return "SimianGridServiceConnector"; } }
|
||||||
public void AddRegion(Scene scene)
|
public void AddRegion(Scene scene)
|
||||||
{
|
{
|
||||||
|
if (!m_Enabled)
|
||||||
|
return;
|
||||||
|
|
||||||
// Every shared region module has to maintain an indepedent list of
|
// Every shared region module has to maintain an indepedent list of
|
||||||
// currently running regions
|
// currently running regions
|
||||||
lock (m_scenes)
|
lock (m_scenes)
|
||||||
m_scenes[scene.RegionInfo.RegionID] = scene;
|
m_scenes[scene.RegionInfo.RegionID] = scene;
|
||||||
|
|
||||||
if (!String.IsNullOrEmpty(m_serverUrl))
|
|
||||||
scene.RegisterModuleInterface<IGridService>(this);
|
scene.RegisterModuleInterface<IGridService>(this);
|
||||||
}
|
}
|
||||||
public void RemoveRegion(Scene scene)
|
public void RemoveRegion(Scene scene)
|
||||||
{
|
{
|
||||||
|
if (!m_Enabled)
|
||||||
|
return;
|
||||||
|
|
||||||
lock (m_scenes)
|
lock (m_scenes)
|
||||||
m_scenes.Remove(scene.RegionInfo.RegionID);
|
m_scenes.Remove(scene.RegionInfo.RegionID);
|
||||||
|
|
||||||
if (!String.IsNullOrEmpty(m_serverUrl))
|
|
||||||
scene.UnregisterModuleInterface<IGridService>(this);
|
scene.UnregisterModuleInterface<IGridService>(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,6 +102,12 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Initialise(IConfigSource source)
|
public void Initialise(IConfigSource source)
|
||||||
|
{
|
||||||
|
IConfig moduleConfig = source.Configs["Modules"];
|
||||||
|
if (moduleConfig != null)
|
||||||
|
{
|
||||||
|
string name = moduleConfig.GetString("GridServices", "");
|
||||||
|
if (name == Name)
|
||||||
{
|
{
|
||||||
IConfig gridConfig = source.Configs["GridService"];
|
IConfig gridConfig = source.Configs["GridService"];
|
||||||
if (gridConfig != null)
|
if (gridConfig != null)
|
||||||
|
@ -107,12 +118,15 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
||||||
if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("="))
|
if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("="))
|
||||||
serviceUrl = serviceUrl + '/';
|
serviceUrl = serviceUrl + '/';
|
||||||
m_serverUrl = serviceUrl;
|
m_serverUrl = serviceUrl;
|
||||||
|
m_Enabled = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (String.IsNullOrEmpty(m_serverUrl))
|
if (String.IsNullOrEmpty(m_serverUrl))
|
||||||
m_log.Info("[SIMIAN GRID CONNECTOR]: No GridServerURI specified, disabling connector");
|
m_log.Info("[SIMIAN GRID CONNECTOR]: No GridServerURI specified, disabling connector");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#region IGridService
|
#region IGridService
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue