diff options
author | Diva Canto | 2010-01-29 18:59:41 -0800 |
---|---|---|
committer | Diva Canto | 2010-01-29 18:59:41 -0800 |
commit | 5001f61c08fea2ebfcb2590be69073d04d129d70 (patch) | |
tree | 08a0470b0b566f814209bfb803fbcc0959333bcd /OpenSim/Region/CoreModules/ServiceConnectorsOut | |
parent | Works for grid login. (diff) | |
download | opensim-SC_OLD-5001f61c08fea2ebfcb2590be69073d04d129d70.zip opensim-SC_OLD-5001f61c08fea2ebfcb2590be69073d04d129d70.tar.gz opensim-SC_OLD-5001f61c08fea2ebfcb2590be69073d04d129d70.tar.bz2 opensim-SC_OLD-5001f61c08fea2ebfcb2590be69073d04d129d70.tar.xz |
* HGGridConnector is no longer necessary.
* Handle logout properly. This needed an addition to IClientAPI, because of how the logout packet is currently being handled -- the agent is being removed from the scene before the different event handlers are executed, which is broken.
Diffstat (limited to 'OpenSim/Region/CoreModules/ServiceConnectorsOut')
-rw-r--r-- | OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/HGGridConnector.cs | 257 |
1 files changed, 0 insertions, 257 deletions
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/HGGridConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/HGGridConnector.cs deleted file mode 100644 index 67eae87..0000000 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/HGGridConnector.cs +++ /dev/null | |||
@@ -1,257 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Net; | ||
31 | using System.Reflection; | ||
32 | using System.Xml; | ||
33 | |||
34 | |||
35 | using OpenSim.Framework; | ||
36 | using OpenSim.Region.Framework.Interfaces; | ||
37 | using OpenSim.Region.Framework.Scenes; | ||
38 | using OpenSim.Region.Framework.Scenes.Hypergrid; | ||
39 | using OpenSim.Services.Interfaces; | ||
40 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; | ||
41 | using PresenceInfo = OpenSim.Services.Interfaces.PresenceInfo; | ||
42 | using OpenSim.Server.Base; | ||
43 | using OpenSim.Framework.Console; | ||
44 | |||
45 | using OpenMetaverse; | ||
46 | using log4net; | ||
47 | using Nini.Config; | ||
48 | |||
49 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid | ||
50 | { | ||
51 | public class HGGridConnector : ISharedRegionModule, IGridService | ||
52 | { | ||
53 | private static readonly ILog m_log = | ||
54 | LogManager.GetLogger( | ||
55 | MethodBase.GetCurrentMethod().DeclaringType); | ||
56 | |||
57 | private bool m_Enabled = false; | ||
58 | private bool m_Initialized = false; | ||
59 | |||
60 | private Scene m_aScene; | ||
61 | private Dictionary<ulong, Scene> m_LocalScenes = new Dictionary<ulong, Scene>(); | ||
62 | |||
63 | private IGridService m_GridServiceConnector; | ||
64 | |||
65 | #region ISharedRegionModule | ||
66 | |||
67 | public Type ReplaceableInterface | ||
68 | { | ||
69 | get { return null; } | ||
70 | } | ||
71 | |||
72 | public string Name | ||
73 | { | ||
74 | get { return "HGGridServicesConnector"; } | ||
75 | } | ||
76 | |||
77 | public void Initialise(IConfigSource source) | ||
78 | { | ||
79 | IConfig moduleConfig = source.Configs["Modules"]; | ||
80 | if (moduleConfig != null) | ||
81 | { | ||
82 | string name = moduleConfig.GetString("GridServices", ""); | ||
83 | if (name == Name) | ||
84 | { | ||
85 | IConfig gridConfig = source.Configs["GridService"]; | ||
86 | if (gridConfig == null) | ||
87 | { | ||
88 | m_log.Error("[HGGRID CONNECTOR]: GridService missing from OpenSim.ini"); | ||
89 | return; | ||
90 | } | ||
91 | |||
92 | |||
93 | InitialiseConnectorModule(source); | ||
94 | |||
95 | m_Enabled = true; | ||
96 | m_log.Info("[HGGRID CONNECTOR]: HG grid enabled"); | ||
97 | } | ||
98 | } | ||
99 | } | ||
100 | |||
101 | private void InitialiseConnectorModule(IConfigSource source) | ||
102 | { | ||
103 | IConfig gridConfig = source.Configs["GridService"]; | ||
104 | if (gridConfig == null) | ||
105 | { | ||
106 | m_log.Error("[HGGRID CONNECTOR]: GridService missing from OpenSim.ini"); | ||
107 | throw new Exception("Grid connector init error"); | ||
108 | } | ||
109 | |||
110 | string module = gridConfig.GetString("GridServiceConnectorModule", String.Empty); | ||
111 | if (module == String.Empty) | ||
112 | { | ||
113 | m_log.Error("[HGGRID CONNECTOR]: No GridServiceConnectorModule named in section GridService"); | ||
114 | throw new Exception("Unable to proceed. Please make sure your ini files in config-include are updated according to .example's"); | ||
115 | } | ||
116 | |||
117 | Object[] args = new Object[] { source }; | ||
118 | m_GridServiceConnector = ServerUtils.LoadPlugin<IGridService>(module, args); | ||
119 | |||
120 | } | ||
121 | |||
122 | public void PostInitialise() | ||
123 | { | ||
124 | if (m_Enabled) | ||
125 | ((ISharedRegionModule)m_GridServiceConnector).PostInitialise(); | ||
126 | } | ||
127 | |||
128 | public void Close() | ||
129 | { | ||
130 | } | ||
131 | |||
132 | public void AddRegion(Scene scene) | ||
133 | { | ||
134 | if (!m_Enabled) | ||
135 | return; | ||
136 | |||
137 | m_LocalScenes[scene.RegionInfo.RegionHandle] = scene; | ||
138 | scene.RegisterModuleInterface<IGridService>(this); | ||
139 | |||
140 | ((ISharedRegionModule)m_GridServiceConnector).AddRegion(scene); | ||
141 | |||
142 | } | ||
143 | |||
144 | public void RemoveRegion(Scene scene) | ||
145 | { | ||
146 | if (m_Enabled) | ||
147 | { | ||
148 | m_LocalScenes.Remove(scene.RegionInfo.RegionHandle); | ||
149 | scene.UnregisterModuleInterface<IGridService>(this); | ||
150 | ((ISharedRegionModule)m_GridServiceConnector).RemoveRegion(scene); | ||
151 | } | ||
152 | } | ||
153 | |||
154 | public void RegionLoaded(Scene scene) | ||
155 | { | ||
156 | if (!m_Enabled) | ||
157 | return; | ||
158 | |||
159 | if (!m_Initialized) | ||
160 | { | ||
161 | m_aScene = scene; | ||
162 | |||
163 | m_Initialized = true; | ||
164 | } | ||
165 | } | ||
166 | |||
167 | #endregion | ||
168 | |||
169 | #region IGridService | ||
170 | |||
171 | public string RegisterRegion(UUID scopeID, GridRegion regionInfo) | ||
172 | { | ||
173 | return m_GridServiceConnector.RegisterRegion(scopeID, regionInfo); | ||
174 | } | ||
175 | |||
176 | public bool DeregisterRegion(UUID regionID) | ||
177 | { | ||
178 | return m_GridServiceConnector.DeregisterRegion(regionID); | ||
179 | } | ||
180 | |||
181 | public List<GridRegion> GetNeighbours(UUID scopeID, UUID regionID) | ||
182 | { | ||
183 | // No serving neighbours on hyperliked regions. | ||
184 | // Just the regular regions. | ||
185 | return m_GridServiceConnector.GetNeighbours(scopeID, regionID); | ||
186 | } | ||
187 | |||
188 | public GridRegion GetRegionByUUID(UUID scopeID, UUID regionID) | ||
189 | { | ||
190 | return m_GridServiceConnector.GetRegionByUUID(scopeID, regionID); | ||
191 | //if (region != null) | ||
192 | // return region; | ||
193 | |||
194 | //region = m_HypergridService.GetRegionByUUID(regionID); | ||
195 | |||
196 | //return region; | ||
197 | } | ||
198 | |||
199 | public GridRegion GetRegionByPosition(UUID scopeID, int x, int y) | ||
200 | { | ||
201 | int snapX = (int) (x / Constants.RegionSize) * (int)Constants.RegionSize; | ||
202 | int snapY = (int) (y / Constants.RegionSize) * (int)Constants.RegionSize; | ||
203 | |||
204 | GridRegion region = m_GridServiceConnector.GetRegionByPosition(scopeID, x, y); | ||
205 | //if (region != null) | ||
206 | // return region; | ||
207 | |||
208 | //region = m_HypergridService.GetRegionByPosition(snapX, snapY); | ||
209 | |||
210 | return region; | ||
211 | } | ||
212 | |||
213 | public GridRegion GetRegionByName(UUID scopeID, string regionName) | ||
214 | { | ||
215 | // Try normal grid first | ||
216 | GridRegion region = m_GridServiceConnector.GetRegionByName(scopeID, regionName); | ||
217 | if (region != null) | ||
218 | return region; | ||
219 | |||
220 | //region = m_HypergridService.GetRegionByName(regionName); | ||
221 | |||
222 | return region; | ||
223 | } | ||
224 | |||
225 | public List<GridRegion> GetRegionsByName(UUID scopeID, string name, int maxNumber) | ||
226 | { | ||
227 | if (name == string.Empty) | ||
228 | return new List<GridRegion>(); | ||
229 | |||
230 | return m_GridServiceConnector.GetRegionsByName(scopeID, name, maxNumber); | ||
231 | } | ||
232 | |||
233 | public List<GridRegion> GetRegionRange(UUID scopeID, int xmin, int xmax, int ymin, int ymax) | ||
234 | { | ||
235 | return m_GridServiceConnector.GetRegionRange(scopeID, xmin, xmax, ymin, ymax); | ||
236 | } | ||
237 | |||
238 | public List<GridRegion> GetDefaultRegions(UUID scopeID) | ||
239 | { | ||
240 | return m_GridServiceConnector.GetDefaultRegions(scopeID); | ||
241 | } | ||
242 | |||
243 | public List<GridRegion> GetFallbackRegions(UUID scopeID, int x, int y) | ||
244 | { | ||
245 | return m_GridServiceConnector.GetFallbackRegions(scopeID, x, y); | ||
246 | } | ||
247 | |||
248 | public int GetRegionFlags(UUID scopeID, UUID regionID) | ||
249 | { | ||
250 | return m_GridServiceConnector.GetRegionFlags(scopeID, regionID); | ||
251 | } | ||
252 | |||
253 | #endregion | ||
254 | |||
255 | |||
256 | } | ||
257 | } | ||