aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorMelanie2010-09-05 17:34:51 +0100
committerMelanie2010-09-05 17:34:51 +0100
commitd9e9c41e1311d2a3bc11d16d031b0c1f969027e8 (patch)
tree9c61efd54dff00ec39ede1bc0695de1457d3fee3 /OpenSim
parentAs an exmple, add the code to disable connectors intot he simian asset (diff)
downloadopensim-SC_OLD-d9e9c41e1311d2a3bc11d16d031b0c1f969027e8.zip
opensim-SC_OLD-d9e9c41e1311d2a3bc11d16d031b0c1f969027e8.tar.gz
opensim-SC_OLD-d9e9c41e1311d2a3bc11d16d031b0c1f969027e8.tar.bz2
opensim-SC_OLD-d9e9c41e1311d2a3bc11d16d031b0c1f969027e8.tar.xz
Add m_Enabled pattern to SimianGridConnector
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs42
1 files changed, 28 insertions, 14 deletions
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs
index 9d67ccb..a94620b 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs
@@ -60,6 +60,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
60 60
61 private string m_serverUrl = String.Empty; 61 private string m_serverUrl = String.Empty;
62 private Dictionary<UUID, Scene> m_scenes = new Dictionary<UUID, Scene>(); 62 private Dictionary<UUID, Scene> m_scenes = new Dictionary<UUID, Scene>();
63 private bool m_Enabled = false;
63 64
64 #region ISharedRegionModule 65 #region ISharedRegionModule
65 66
@@ -72,21 +73,25 @@ namespace OpenSim.Services.Connectors.SimianGrid
72 public string Name { get { return "SimianGridServiceConnector"; } } 73 public string Name { get { return "SimianGridServiceConnector"; } }
73 public void AddRegion(Scene scene) 74 public void AddRegion(Scene scene)
74 { 75 {
76 if (!m_Enabled)
77 return;
78
75 // Every shared region module has to maintain an indepedent list of 79 // Every shared region module has to maintain an indepedent list of
76 // currently running regions 80 // currently running regions
77 lock (m_scenes) 81 lock (m_scenes)
78 m_scenes[scene.RegionInfo.RegionID] = scene; 82 m_scenes[scene.RegionInfo.RegionID] = scene;
79 83
80 if (!String.IsNullOrEmpty(m_serverUrl)) 84 scene.RegisterModuleInterface<IGridService>(this);
81 scene.RegisterModuleInterface<IGridService>(this);
82 } 85 }
83 public void RemoveRegion(Scene scene) 86 public void RemoveRegion(Scene scene)
84 { 87 {
88 if (!m_Enabled)
89 return;
90
85 lock (m_scenes) 91 lock (m_scenes)
86 m_scenes.Remove(scene.RegionInfo.RegionID); 92 m_scenes.Remove(scene.RegionInfo.RegionID);
87 93
88 if (!String.IsNullOrEmpty(m_serverUrl)) 94 scene.UnregisterModuleInterface<IGridService>(this);
89 scene.UnregisterModuleInterface<IGridService>(this);
90 } 95 }
91 96
92 #endregion ISharedRegionModule 97 #endregion ISharedRegionModule
@@ -98,20 +103,29 @@ namespace OpenSim.Services.Connectors.SimianGrid
98 103
99 public void Initialise(IConfigSource source) 104 public void Initialise(IConfigSource source)
100 { 105 {
101 IConfig gridConfig = source.Configs["GridService"]; 106 IConfig moduleConfig = source.Configs["Modules"];
102 if (gridConfig != null) 107 if (moduleConfig != null)
103 { 108 {
104 string serviceUrl = gridConfig.GetString("GridServerURI"); 109 string name = moduleConfig.GetString("GridServices", "");
105 if (!String.IsNullOrEmpty(serviceUrl)) 110 if (name == Name)
106 { 111 {
107 if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("=")) 112 IConfig gridConfig = source.Configs["GridService"];
108 serviceUrl = serviceUrl + '/'; 113 if (gridConfig != null)
109 m_serverUrl = serviceUrl; 114 {
115 string serviceUrl = gridConfig.GetString("GridServerURI");
116 if (!String.IsNullOrEmpty(serviceUrl))
117 {
118 if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("="))
119 serviceUrl = serviceUrl + '/';
120 m_serverUrl = serviceUrl;
121 m_Enabled = true;
122 }
123 }
124
125 if (String.IsNullOrEmpty(m_serverUrl))
126 m_log.Info("[SIMIAN GRID CONNECTOR]: No GridServerURI specified, disabling connector");
110 } 127 }
111 } 128 }
112
113 if (String.IsNullOrEmpty(m_serverUrl))
114 m_log.Info("[SIMIAN GRID CONNECTOR]: No GridServerURI specified, disabling connector");
115 } 129 }
116 130
117 #region IGridService 131 #region IGridService