aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/ApplicationPlugins/CreateCommsManager/CreateCommsManagerPlugin.cs16
-rw-r--r--OpenSim/Region/Application/Application.cs8
-rw-r--r--OpenSim/Region/Application/HGCommands.cs (renamed from OpenSim/Region/Application/HGOpenSimNode.cs)86
-rw-r--r--OpenSim/Region/Application/OpenSim.cs16
-rw-r--r--OpenSim/Region/Application/OpenSimBase.cs5
5 files changed, 50 insertions, 81 deletions
diff --git a/OpenSim/ApplicationPlugins/CreateCommsManager/CreateCommsManagerPlugin.cs b/OpenSim/ApplicationPlugins/CreateCommsManager/CreateCommsManagerPlugin.cs
index 3b98038..2bf5133 100644
--- a/OpenSim/ApplicationPlugins/CreateCommsManager/CreateCommsManagerPlugin.cs
+++ b/OpenSim/ApplicationPlugins/CreateCommsManager/CreateCommsManagerPlugin.cs
@@ -130,20 +130,6 @@ namespace OpenSim.ApplicationPlugins.CreateCommsManager
130 130
131 protected void InitialiseHGServices(OpenSimBase openSim, LibraryRootFolder libraryRootFolder) 131 protected void InitialiseHGServices(OpenSimBase openSim, LibraryRootFolder libraryRootFolder)
132 { 132 {
133 HGOpenSimNode hgNode = null;
134 try
135 {
136 hgNode = (HGOpenSimNode) openSim;
137 }
138 catch (Exception e)
139 {
140 m_log.Error("[CreateComms] " + e.Message);
141 m_log.Error("[CreateComms] The OpenSim application class was : " + openSim.ToString());
142 m_log.Error("[CreateComms] To use hypergrid mode, please make sure you are starting opensim with the command line: opensim.exe -hypergrid=true");
143 m_log.Error("[CreateComms] Also hypergrid mode can not be ran while using the -background=true command line argument.");
144 Environment.Exit(1);
145 }
146
147 // Standalone mode is determined by !startupConfig.GetBoolean("gridmode", false) 133 // Standalone mode is determined by !startupConfig.GetBoolean("gridmode", false)
148 if (m_openSim.ConfigurationSettings.Standalone) 134 if (m_openSim.ConfigurationSettings.Standalone)
149 { 135 {
@@ -154,7 +140,7 @@ namespace OpenSim.ApplicationPlugins.CreateCommsManager
154 // We are in grid mode 140 // We are in grid mode
155 InitialiseHGGridServices(libraryRootFolder); 141 InitialiseHGGridServices(libraryRootFolder);
156 } 142 }
157 hgNode.HGServices = HGServices; 143 HGCommands.HGServices = HGServices;
158 } 144 }
159 145
160 protected void InitialiseStandardServices(LibraryRootFolder libraryRootFolder) 146 protected void InitialiseStandardServices(LibraryRootFolder libraryRootFolder)
diff --git a/OpenSim/Region/Application/Application.cs b/OpenSim/Region/Application/Application.cs
index 7244dc9..46e3fc9 100644
--- a/OpenSim/Region/Application/Application.cs
+++ b/OpenSim/Region/Application/Application.cs
@@ -94,14 +94,12 @@ namespace OpenSim
94 configSource.AddSwitch("Startup", "inidirectory"); 94 configSource.AddSwitch("Startup", "inidirectory");
95 configSource.AddSwitch("Startup", "gridmode"); 95 configSource.AddSwitch("Startup", "gridmode");
96 configSource.AddSwitch("Startup", "physics"); 96 configSource.AddSwitch("Startup", "physics");
97 configSource.AddSwitch("Startup", "hypergrid");
98 configSource.AddSwitch("Startup", "gui"); 97 configSource.AddSwitch("Startup", "gui");
99 98
100 configSource.AddConfig("StandAlone"); 99 configSource.AddConfig("StandAlone");
101 configSource.AddConfig("Network"); 100 configSource.AddConfig("Network");
102 101
103 bool background = configSource.Configs["Startup"].GetBoolean("background", false); 102 bool background = configSource.Configs["Startup"].GetBoolean("background", false);
104 bool hgrid = configSource.Configs["Startup"].GetBoolean("hypergrid", false);
105 m_saveCrashDumps = configSource.Configs["Startup"].GetBoolean("save_crashes", false); 103 m_saveCrashDumps = configSource.Configs["Startup"].GetBoolean("save_crashes", false);
106 m_crashDir = configSource.Configs["Startup"].GetString("crash_dir", m_crashDir); 104 m_crashDir = configSource.Configs["Startup"].GetString("crash_dir", m_crashDir);
107 105
@@ -112,11 +110,7 @@ namespace OpenSim
112 } 110 }
113 else 111 else
114 { 112 {
115 m_sim = null; 113 m_sim = new OpenSim(configSource);
116 if (hgrid)
117 m_sim = new HGOpenSimNode(configSource);
118 else
119 m_sim = new OpenSim(configSource);
120 114
121 m_sim.Startup(); 115 m_sim.Startup();
122 116
diff --git a/OpenSim/Region/Application/HGOpenSimNode.cs b/OpenSim/Region/Application/HGCommands.cs
index f4f3062..07d3dcb 100644
--- a/OpenSim/Region/Application/HGOpenSimNode.cs
+++ b/OpenSim/Region/Application/HGCommands.cs
@@ -40,42 +40,17 @@ using OpenSim.Region.Framework.Scenes.Hypergrid;
40 40
41namespace OpenSim 41namespace OpenSim
42{ 42{
43 public class HGOpenSimNode : OpenSim 43 public class HGCommands
44 { 44 {
45 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 45 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
46 public IHyperlink HGServices = null; 46 public static IHyperlink HGServices = null;
47 47
48 private uint m_autoMappingX = 0; 48 private static uint m_autoMappingX = 0;
49 private uint m_autoMappingY = 0; 49 private static uint m_autoMappingY = 0;
50 private bool m_enableAutoMapping = false; 50 private static bool m_enableAutoMapping = false;
51 51
52 public HGOpenSimNode(IConfigSource configSource) : base(configSource) 52 public static Scene CreateScene(RegionInfo regionInfo, AgentCircuitManager circuitManager, CommunicationsManager m_commsManager,
53 { 53 StorageManager storageManager, ModuleLoader m_moduleLoader, ConfigSettings m_configSettings, OpenSimConfigSource m_config, string m_version)
54 }
55
56 /// <summary>
57 /// Performs initialisation of the scene, such as loading configuration from disk.
58 /// </summary>
59 protected override void StartupSpecific()
60 {
61 m_log.Info("====================================================================");
62 m_log.Info("=================== STARTING HYPERGRID NODE ========================");
63 m_log.Info("====================================================================");
64
65 base.StartupSpecific();
66
67 MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-mapping", "link-mapping [<x> <y>] <cr>",
68 "Set local coordinate to map HG regions to", RunCommand);
69 MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-region",
70 "link-region <Xloc> <Yloc> <HostName>:<HttpPort>[:<RemoteRegionName>] <cr>",
71 "Link a hypergrid region", RunCommand);
72 MainConsole.Instance.Commands.AddCommand("hypergrid", false, "unlink-region",
73 "unlink-region <local name> or <HostName>:<HttpPort> <cr>",
74 "Unlink a hypergrid region", RunCommand);
75 }
76
77 protected override Scene CreateScene(RegionInfo regionInfo, StorageManager storageManager,
78 AgentCircuitManager circuitManager)
79 { 54 {
80 HGSceneCommunicationService sceneGridService = new HGSceneCommunicationService(m_commsManager, HGServices); 55 HGSceneCommunicationService sceneGridService = new HGSceneCommunicationService(m_commsManager, HGServices);
81 56
@@ -86,18 +61,11 @@ namespace OpenSim
86 m_configSettings.See_into_region_from_neighbor, m_config.Source, m_version); 61 m_configSettings.See_into_region_from_neighbor, m_config.Source, m_version);
87 } 62 }
88 63
89 private new void RunCommand(string module, string[] cp) 64 public static void RunHGCommand(string command, string[] cmdparams, Scene scene)
90 { 65 {
91 List<string> cmdparams = new List<string>(cp);
92 if (cmdparams.Count < 1)
93 return;
94
95 string command = cmdparams[0];
96 cmdparams.RemoveAt(0);
97
98 if (command.Equals("link-mapping")) 66 if (command.Equals("link-mapping"))
99 { 67 {
100 if (cmdparams.Count == 2) 68 if (cmdparams.Length == 2)
101 { 69 {
102 try 70 try
103 { 71 {
@@ -115,11 +83,11 @@ namespace OpenSim
115 } 83 }
116 else if (command.Equals("link-region")) 84 else if (command.Equals("link-region"))
117 { 85 {
118 if (cmdparams.Count < 3) 86 if (cmdparams.Length < 3)
119 { 87 {
120 if ((cmdparams.Count == 1) || (cmdparams.Count == 2)) 88 if ((cmdparams.Length == 1) || (cmdparams.Length == 2))
121 { 89 {
122 LoadXmlLinkFile(cmdparams); 90 LoadXmlLinkFile(cmdparams, scene);
123 } 91 }
124 else 92 else
125 { 93 {
@@ -138,8 +106,8 @@ namespace OpenSim
138 xloc = Convert.ToUInt32(cmdparams[0]); 106 xloc = Convert.ToUInt32(cmdparams[0]);
139 yloc = Convert.ToUInt32(cmdparams[1]); 107 yloc = Convert.ToUInt32(cmdparams[1]);
140 mapName = cmdparams[2]; 108 mapName = cmdparams[2];
141 if (cmdparams.Count > 3) 109 if (cmdparams.Length > 3)
142 for (int i = 3; i < cmdparams.Count; i++) 110 for (int i = 3; i < cmdparams.Length; i++)
143 mapName += " " + cmdparams[i]; 111 mapName += " " + cmdparams[i];
144 112
145 m_log.Info(">> MapName: " + mapName); 113 m_log.Info(">> MapName: " + mapName);
@@ -153,7 +121,7 @@ namespace OpenSim
153 return; 121 return;
154 } 122 }
155 123
156 HGHyperlink.TryLinkRegionToCoords(m_sceneManager.CurrentOrFirstScene, null, mapName, xloc, yloc); 124 HGHyperlink.TryLinkRegionToCoords(scene, null, mapName, xloc, yloc);
157 } 125 }
158 else 126 else
159 { 127 {
@@ -179,12 +147,12 @@ namespace OpenSim
179 } 147 }
180 148
181 //if (TryCreateLink(xloc, yloc, externalPort, externalHostName, out regInfo)) 149 //if (TryCreateLink(xloc, yloc, externalPort, externalHostName, out regInfo))
182 if (HGHyperlink.TryCreateLink(m_sceneManager.CurrentOrFirstScene, null, xloc, yloc, "", externalPort, externalHostName, out regInfo)) 150 if (HGHyperlink.TryCreateLink(scene, null, xloc, yloc, "", externalPort, externalHostName, out regInfo))
183 { 151 {
184 if (cmdparams.Count >= 5) 152 if (cmdparams.Length >= 5)
185 { 153 {
186 regInfo.RegionName = ""; 154 regInfo.RegionName = "";
187 for (int i = 4; i < cmdparams.Count; i++) 155 for (int i = 4; i < cmdparams.Length; i++)
188 regInfo.RegionName += cmdparams[i] + " "; 156 regInfo.RegionName += cmdparams[i] + " ";
189 } 157 }
190 } 158 }
@@ -193,19 +161,19 @@ namespace OpenSim
193 } 161 }
194 else if (command.Equals("unlink-region")) 162 else if (command.Equals("unlink-region"))
195 { 163 {
196 if (cmdparams.Count < 1) 164 if (cmdparams.Length < 1)
197 { 165 {
198 UnlinkRegionCmdUsage(); 166 UnlinkRegionCmdUsage();
199 return; 167 return;
200 } 168 }
201 if (HGHyperlink.TryUnlinkRegion(m_sceneManager.CurrentOrFirstScene, cmdparams[0])) 169 if (HGHyperlink.TryUnlinkRegion(scene, cmdparams[0]))
202 m_log.InfoFormat("[HGrid]: Successfully unlinked {0}", cmdparams[0]); 170 m_log.InfoFormat("[HGrid]: Successfully unlinked {0}", cmdparams[0]);
203 else 171 else
204 m_log.InfoFormat("[HGrid]: Unable to unlink {0}, region not found", cmdparams[0]); 172 m_log.InfoFormat("[HGrid]: Unable to unlink {0}, region not found", cmdparams[0]);
205 } 173 }
206 } 174 }
207 175
208 private void LoadXmlLinkFile(List<string> cmdparams) 176 private static void LoadXmlLinkFile(string[] cmdparams, Scene scene)
209 { 177 {
210 //use http://www.hgurl.com/hypergrid.xml for test 178 //use http://www.hgurl.com/hypergrid.xml for test
211 try 179 try
@@ -214,7 +182,7 @@ namespace OpenSim
214 XmlConfigSource cs = new XmlConfigSource(r); 182 XmlConfigSource cs = new XmlConfigSource(r);
215 string[] excludeSections = null; 183 string[] excludeSections = null;
216 184
217 if (cmdparams.Count == 2) 185 if (cmdparams.Length == 2)
218 { 186 {
219 if (cmdparams[1].ToLower().StartsWith("excludelist:")) 187 if (cmdparams[1].ToLower().StartsWith("excludelist:"))
220 { 188 {
@@ -242,7 +210,7 @@ namespace OpenSim
242 } 210 }
243 if (!skip) 211 if (!skip)
244 { 212 {
245 ReadLinkFromConfig(cs.Configs[i]); 213 ReadLinkFromConfig(cs.Configs[i], scene);
246 } 214 }
247 } 215 }
248 } 216 }
@@ -253,7 +221,7 @@ namespace OpenSim
253 } 221 }
254 222
255 223
256 private void ReadLinkFromConfig(IConfig config) 224 private static void ReadLinkFromConfig(IConfig config, Scene scene)
257 { 225 {
258 RegionInfo regInfo; 226 RegionInfo regInfo;
259 uint xloc, yloc; 227 uint xloc, yloc;
@@ -279,7 +247,7 @@ namespace OpenSim
279 ((realYLoc - yloc < 3896) || (yloc - realYLoc < 3896)))) 247 ((realYLoc - yloc < 3896) || (yloc - realYLoc < 3896))))
280 { 248 {
281 if ( 249 if (
282 HGHyperlink.TryCreateLink(m_sceneManager.CurrentOrFirstScene, null, xloc, yloc, "", externalPort, 250 HGHyperlink.TryCreateLink(scene, null, xloc, yloc, "", externalPort,
283 externalHostName, out regInfo)) 251 externalHostName, out regInfo))
284 { 252 {
285 regInfo.RegionName = config.GetString("localName", ""); 253 regInfo.RegionName = config.GetString("localName", "");
@@ -288,14 +256,14 @@ namespace OpenSim
288 } 256 }
289 257
290 258
291 private void LinkRegionCmdUsage() 259 private static void LinkRegionCmdUsage()
292 { 260 {
293 m_log.Info("Usage: link-region <Xloc> <Yloc> <HostName>:<HttpPort>[:<RemoteRegionName>]"); 261 m_log.Info("Usage: link-region <Xloc> <Yloc> <HostName>:<HttpPort>[:<RemoteRegionName>]");
294 m_log.Info("Usage: link-region <Xloc> <Yloc> <HostName> <HttpPort> [<LocalName>]"); 262 m_log.Info("Usage: link-region <Xloc> <Yloc> <HostName> <HttpPort> [<LocalName>]");
295 m_log.Info("Usage: link-region <URI_of_xml> [<exclude>]"); 263 m_log.Info("Usage: link-region <URI_of_xml> [<exclude>]");
296 } 264 }
297 265
298 private void UnlinkRegionCmdUsage() 266 private static void UnlinkRegionCmdUsage()
299 { 267 {
300 m_log.Info("Usage: unlink-region <HostName>:<HttpPort>"); 268 m_log.Info("Usage: unlink-region <HostName>:<HttpPort>");
301 m_log.Info("Usage: unlink-region <LocalName>"); 269 m_log.Info("Usage: unlink-region <LocalName>");
diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs
index a0b9568..d3941d6 100644
--- a/OpenSim/Region/Application/OpenSim.cs
+++ b/OpenSim/Region/Application/OpenSim.cs
@@ -291,6 +291,16 @@ namespace OpenSim
291 "reset user password [<first> [<last> [<password>]]]", 291 "reset user password [<first> [<last> [<password>]]]",
292 "Reset a user password", HandleResetUserPassword); 292 "Reset a user password", HandleResetUserPassword);
293 } 293 }
294
295 m_console.Commands.AddCommand("hypergrid", false, "link-mapping", "link-mapping [<x> <y>] <cr>",
296 "Set local coordinate to map HG regions to", RunCommand);
297 m_console.Commands.AddCommand("hypergrid", false, "link-region",
298 "link-region <Xloc> <Yloc> <HostName>:<HttpPort>[:<RemoteRegionName>] <cr>",
299 "Link a hypergrid region", RunCommand);
300 m_console.Commands.AddCommand("hypergrid", false, "unlink-region",
301 "unlink-region <local name> or <HostName>:<HttpPort> <cr>",
302 "Unlink a hypergrid region", RunCommand);
303
294 } 304 }
295 305
296 public override void ShutdownSpecific() 306 public override void ShutdownSpecific()
@@ -625,6 +635,12 @@ namespace OpenSim
625 m_sceneManager.CacheJ2kDecode(1); 635 m_sceneManager.CacheJ2kDecode(1);
626 } 636 }
627 break; 637 break;
638
639 case "link-region":
640 case "unlink-region":
641 case "link-mapping":
642 HGCommands.RunHGCommand(command, cmdparams, m_sceneManager.CurrentOrFirstScene);
643 break;
628 } 644 }
629 } 645 }
630 646
diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs
index 286c5a1..6838ab5 100644
--- a/OpenSim/Region/Application/OpenSimBase.cs
+++ b/OpenSim/Region/Application/OpenSimBase.cs
@@ -736,6 +736,11 @@ namespace OpenSim
736 protected override Scene CreateScene(RegionInfo regionInfo, StorageManager storageManager, 736 protected override Scene CreateScene(RegionInfo regionInfo, StorageManager storageManager,
737 AgentCircuitManager circuitManager) 737 AgentCircuitManager circuitManager)
738 { 738 {
739 bool hgrid = ConfigSource.Source.Configs["Startup"].GetBoolean("hypergrid", false);
740 if (hgrid)
741 return HGCommands.CreateScene(regionInfo, circuitManager, m_commsManager,
742 storageManager, m_moduleLoader, m_configSettings, m_config, m_version);
743
739 SceneCommunicationService sceneGridService = new SceneCommunicationService(m_commsManager); 744 SceneCommunicationService sceneGridService = new SceneCommunicationService(m_commsManager);
740 745
741 return new Scene( 746 return new Scene(