diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Services/HypergridService/HGCommands.cs (renamed from OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/HGCommands.cs) | 90 |
1 files changed, 52 insertions, 38 deletions
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/HGCommands.cs b/OpenSim/Services/HypergridService/HGCommands.cs index 0974372..10d04ff 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/HGCommands.cs +++ b/OpenSim/Services/HypergridService/HGCommands.cs | |||
@@ -34,41 +34,52 @@ using Nini.Config; | |||
34 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
35 | //using OpenSim.Framework.Communications; | 35 | //using OpenSim.Framework.Communications; |
36 | using OpenSim.Framework.Console; | 36 | using OpenSim.Framework.Console; |
37 | using OpenSim.Region.Framework; | 37 | using OpenSim.Services.Interfaces; |
38 | using OpenSim.Region.Framework.Scenes; | ||
39 | using OpenSim.Region.Framework.Scenes.Hypergrid; | ||
40 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; | 38 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; |
41 | 39 | ||
42 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid | 40 | namespace OpenSim.Services.HypergridService |
43 | { | 41 | { |
44 | public class HGCommands | 42 | public class HGCommands |
45 | { | 43 | { |
46 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 44 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
47 | private HGGridConnector m_HGGridConnector; | 45 | private HypergridService m_HypergridService; |
48 | private Scene m_scene; | ||
49 | 46 | ||
50 | private static uint m_autoMappingX = 0; | 47 | private static uint m_autoMappingX = 0; |
51 | private static uint m_autoMappingY = 0; | 48 | private static uint m_autoMappingY = 0; |
52 | private static bool m_enableAutoMapping = false; | 49 | private static bool m_enableAutoMapping = false; |
53 | 50 | ||
54 | public HGCommands(HGGridConnector hgConnector, Scene scene) | 51 | public HGCommands(HypergridService service) |
55 | { | 52 | { |
56 | m_HGGridConnector = hgConnector; | 53 | m_HypergridService = service; |
57 | m_scene = scene; | ||
58 | } | 54 | } |
59 | 55 | ||
60 | //public static Scene CreateScene(RegionInfo regionInfo, AgentCircuitManager circuitManager, CommunicationsManager m_commsManager, | 56 | public void HandleShow(string module, string[] cmd) |
61 | // StorageManager storageManager, ModuleLoader m_moduleLoader, ConfigSettings m_configSettings, OpenSimConfigSource m_config, string m_version) | 57 | { |
62 | //{ | 58 | if (cmd.Length != 2) |
63 | // HGSceneCommunicationService sceneGridService = new HGSceneCommunicationService(m_commsManager, HGServices); | 59 | { |
64 | 60 | MainConsole.Instance.Output("Syntax: show hyperlinks"); | |
65 | // return | 61 | return; |
66 | // new HGScene( | 62 | } |
67 | // regionInfo, circuitManager, m_commsManager, sceneGridService, storageManager, | 63 | List<GridRegion> regions = new List<GridRegion>(m_HypergridService.m_HyperlinkRegions.Values); |
68 | // m_moduleLoader, false, m_configSettings.PhysicalPrim, | 64 | if (regions == null || regions.Count < 1) |
69 | // m_configSettings.See_into_region_from_neighbor, m_config.Source, m_version); | 65 | { |
70 | //} | 66 | MainConsole.Instance.Output("No hyperlinks"); |
67 | return; | ||
68 | } | ||
71 | 69 | ||
70 | MainConsole.Instance.Output("Region Name Region UUID"); | ||
71 | MainConsole.Instance.Output("Location URI"); | ||
72 | MainConsole.Instance.Output("Owner ID Flags"); | ||
73 | MainConsole.Instance.Output("-------------------------------------------------------------------------------"); | ||
74 | foreach (GridRegion r in regions) | ||
75 | { | ||
76 | MainConsole.Instance.Output(String.Format("{0,-20} {1}\n{2,-20} {3}\n{4,-39} \n\n", | ||
77 | r.RegionName, r.RegionID, | ||
78 | String.Format("{0},{1}", r.RegionLocX, r.RegionLocY), "http://" + r.ExternalHostName + ":" + r.HttpPort.ToString(), | ||
79 | r.EstateOwner.ToString())); | ||
80 | } | ||
81 | return; | ||
82 | } | ||
72 | public void RunCommand(string module, string[] cmdparams) | 83 | public void RunCommand(string module, string[] cmdparams) |
73 | { | 84 | { |
74 | List<string> args = new List<string>(cmdparams); | 85 | List<string> args = new List<string>(cmdparams); |
@@ -133,13 +144,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid | |||
133 | for (int i = 3; i < cmdparams.Length; i++) | 144 | for (int i = 3; i < cmdparams.Length; i++) |
134 | mapName += " " + cmdparams[i]; | 145 | mapName += " " + cmdparams[i]; |
135 | 146 | ||
136 | m_log.Info(">> MapName: " + mapName); | 147 | //m_log.Info(">> MapName: " + mapName); |
137 | //internalPort = Convert.ToUInt32(cmdparams[4]); | ||
138 | //remotingPort = Convert.ToUInt32(cmdparams[5]); | ||
139 | } | 148 | } |
140 | catch (Exception e) | 149 | catch (Exception e) |
141 | { | 150 | { |
142 | m_log.Warn("[HGrid] Wrong format for link-region command: " + e.Message); | 151 | MainConsole.Instance.Output("[HGrid] Wrong format for link-region command: " + e.Message); |
143 | LinkRegionCmdUsage(); | 152 | LinkRegionCmdUsage(); |
144 | return; | 153 | return; |
145 | } | 154 | } |
@@ -147,7 +156,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid | |||
147 | // Convert cell coordinates given by the user to meters | 156 | // Convert cell coordinates given by the user to meters |
148 | xloc = xloc * (int)Constants.RegionSize; | 157 | xloc = xloc * (int)Constants.RegionSize; |
149 | yloc = yloc * (int)Constants.RegionSize; | 158 | yloc = yloc * (int)Constants.RegionSize; |
150 | m_HGGridConnector.TryLinkRegionToCoords(m_scene, null, mapName, xloc, yloc); | 159 | string reason = string.Empty; |
160 | if (m_HypergridService.TryLinkRegionToCoords(mapName, xloc, yloc, out reason) == null) | ||
161 | MainConsole.Instance.Output("Failed to link region: " + reason); | ||
151 | } | 162 | } |
152 | else | 163 | else |
153 | { | 164 | { |
@@ -167,7 +178,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid | |||
167 | } | 178 | } |
168 | catch (Exception e) | 179 | catch (Exception e) |
169 | { | 180 | { |
170 | m_log.Warn("[HGrid] Wrong format for link-region command: " + e.Message); | 181 | MainConsole.Instance.Output("[HGrid] Wrong format for link-region command: " + e.Message); |
171 | LinkRegionCmdUsage(); | 182 | LinkRegionCmdUsage(); |
172 | return; | 183 | return; |
173 | } | 184 | } |
@@ -175,7 +186,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid | |||
175 | // Convert cell coordinates given by the user to meters | 186 | // Convert cell coordinates given by the user to meters |
176 | xloc = xloc * (int)Constants.RegionSize; | 187 | xloc = xloc * (int)Constants.RegionSize; |
177 | yloc = yloc * (int)Constants.RegionSize; | 188 | yloc = yloc * (int)Constants.RegionSize; |
178 | if (m_HGGridConnector.TryCreateLink(m_scene, null, xloc, yloc, "", externalPort, externalHostName, out regInfo)) | 189 | string reason = string.Empty; |
190 | if (m_HypergridService.TryCreateLink(xloc, yloc, "", externalPort, externalHostName, out regInfo, out reason)) | ||
179 | { | 191 | { |
180 | if (cmdparams.Length >= 5) | 192 | if (cmdparams.Length >= 5) |
181 | { | 193 | { |
@@ -194,10 +206,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid | |||
194 | UnlinkRegionCmdUsage(); | 206 | UnlinkRegionCmdUsage(); |
195 | return; | 207 | return; |
196 | } | 208 | } |
197 | if (m_HGGridConnector.TryUnlinkRegion(m_scene, cmdparams[0])) | 209 | if (m_HypergridService.TryUnlinkRegion(cmdparams[0])) |
198 | m_log.InfoFormat("[HGrid]: Successfully unlinked {0}", cmdparams[0]); | 210 | MainConsole.Instance.Output("Successfully unlinked " + cmdparams[0]); |
199 | else | 211 | else |
200 | m_log.InfoFormat("[HGrid]: Unable to unlink {0}, region not found", cmdparams[0]); | 212 | MainConsole.Instance.Output("Unable to unlink " + cmdparams[0] + ", region not found."); |
201 | } | 213 | } |
202 | } | 214 | } |
203 | 215 | ||
@@ -276,27 +288,29 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid | |||
276 | { | 288 | { |
277 | xloc = xloc * (int)Constants.RegionSize; | 289 | xloc = xloc * (int)Constants.RegionSize; |
278 | yloc = yloc * (int)Constants.RegionSize; | 290 | yloc = yloc * (int)Constants.RegionSize; |
279 | if ( | 291 | string reason = string.Empty; |
280 | m_HGGridConnector.TryCreateLink(m_scene, null, xloc, yloc, "", externalPort, | 292 | if (m_HypergridService.TryCreateLink(xloc, yloc, "", externalPort, |
281 | externalHostName, out regInfo)) | 293 | externalHostName, out regInfo, out reason)) |
282 | { | 294 | { |
283 | regInfo.RegionName = config.GetString("localName", ""); | 295 | regInfo.RegionName = config.GetString("localName", ""); |
284 | } | 296 | } |
297 | else | ||
298 | MainConsole.Instance.Output("Unable to link " + externalHostName + ": " + reason); | ||
285 | } | 299 | } |
286 | } | 300 | } |
287 | 301 | ||
288 | 302 | ||
289 | private void LinkRegionCmdUsage() | 303 | private void LinkRegionCmdUsage() |
290 | { | 304 | { |
291 | m_log.Info("Usage: link-region <Xloc> <Yloc> <HostName>:<HttpPort>[:<RemoteRegionName>]"); | 305 | MainConsole.Instance.Output("Usage: link-region <Xloc> <Yloc> <HostName>:<HttpPort>[:<RemoteRegionName>]"); |
292 | m_log.Info("Usage: link-region <Xloc> <Yloc> <HostName> <HttpPort> [<LocalName>]"); | 306 | MainConsole.Instance.Output("Usage: link-region <Xloc> <Yloc> <HostName> <HttpPort> [<LocalName>]"); |
293 | m_log.Info("Usage: link-region <URI_of_xml> [<exclude>]"); | 307 | MainConsole.Instance.Output("Usage: link-region <URI_of_xml> [<exclude>]"); |
294 | } | 308 | } |
295 | 309 | ||
296 | private void UnlinkRegionCmdUsage() | 310 | private void UnlinkRegionCmdUsage() |
297 | { | 311 | { |
298 | m_log.Info("Usage: unlink-region <HostName>:<HttpPort>"); | 312 | MainConsole.Instance.Output("Usage: unlink-region <HostName>:<HttpPort>"); |
299 | m_log.Info("Usage: unlink-region <LocalName>"); | 313 | MainConsole.Instance.Output("Usage: unlink-region <LocalName>"); |
300 | } | 314 | } |
301 | 315 | ||
302 | } | 316 | } |