diff options
Diffstat (limited to 'OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs')
-rw-r--r-- | OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs | 42 |
1 files changed, 28 insertions, 14 deletions
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs index 204dbe5..4fceef6 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 |