aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Application/HGOpenSimNode.cs
diff options
context:
space:
mode:
authorJustin Clarke Casey2008-11-25 15:19:00 +0000
committerJustin Clarke Casey2008-11-25 15:19:00 +0000
commite187972377c19bdd85093677c4c54034e4f9196e (patch)
treecc1bb5f003628b018b823eafc9ee0a67f98df31c /OpenSim/Region/Application/HGOpenSimNode.cs
parent* Adding some virtual hooks and making some privaets protected for great just... (diff)
downloadopensim-SC_OLD-e187972377c19bdd85093677c4c54034e4f9196e.zip
opensim-SC_OLD-e187972377c19bdd85093677c4c54034e4f9196e.tar.gz
opensim-SC_OLD-e187972377c19bdd85093677c4c54034e4f9196e.tar.bz2
opensim-SC_OLD-e187972377c19bdd85093677c4c54034e4f9196e.tar.xz
* Apply http://opensimulator.org/mantis/view.php?id=2640
* This is Diva's hypergrid patch, as perviously discussed on the opensim-dev mailing list * Applied some minor prebuild.xml jiggling to resolve a dependency issue * Thanks Diva!
Diffstat (limited to 'OpenSim/Region/Application/HGOpenSimNode.cs')
-rw-r--r--OpenSim/Region/Application/HGOpenSimNode.cs184
1 files changed, 184 insertions, 0 deletions
diff --git a/OpenSim/Region/Application/HGOpenSimNode.cs b/OpenSim/Region/Application/HGOpenSimNode.cs
new file mode 100644
index 0000000..8bb93a6
--- /dev/null
+++ b/OpenSim/Region/Application/HGOpenSimNode.cs
@@ -0,0 +1,184 @@
1using System;
2using System.Collections;
3using System.Collections.Generic;
4using System.IO;
5using System.Net;
6using System.Reflection;
7using log4net;
8using Nini.Config;
9using OpenSim.Framework;
10using OpenSim.Framework.Console;
11using OpenSim.Framework.Servers;
12using OpenSim.Framework.Statistics;
13using OpenSim.Region.ClientStack;
14using OpenSim.Framework.Communications;
15using OpenSim.Framework.Communications.Cache;
16using OpenSim.Region.Communications.Local;
17using OpenSim.Region.Communications.Hypergrid;
18using OpenSim.Region.Environment;
19using OpenSim.Region.Environment.Interfaces;
20using OpenSim.Region.Environment.Scenes;
21using OpenSim.Region.Environment.Scenes.Hypergrid;
22
23using Timer = System.Timers.Timer;
24
25namespace OpenSim
26{
27 public class HGOpenSimNode : OpenSim
28 {
29 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
30 private IHyperlink HGServices = null;
31
32 public HGOpenSimNode(IConfigSource configSource) : base(configSource)
33 {
34 }
35
36
37 /// <summary>
38 /// Performs initialisation of the scene, such as loading configuration from disk.
39 /// </summary>
40 protected override void StartupSpecific()
41 {
42 m_log.Info("====================================================================");
43 m_log.Info("=================== STARTING HYPERGRID NODE ========================");
44 m_log.Info("====================================================================");
45
46 base.StartupSpecific();
47 }
48
49
50 protected override void InitialiseStandaloneServices(LibraryRootFolder libraryRootFolder)
51 {
52 // Standalone mode
53
54 HGInventoryService inventoryService = new HGInventoryService(m_networkServersInfo.InventoryURL, null, false);
55 inventoryService.AddPlugin(m_configSettings.StandaloneInventoryPlugin, m_configSettings.StandaloneInventorySource);
56
57 LocalUserServices userService =
58 new LocalUserServices(m_networkServersInfo, m_networkServersInfo.DefaultHomeLocX,
59 m_networkServersInfo.DefaultHomeLocY, inventoryService);
60 userService.AddPlugin(m_configSettings.StandaloneUserPlugin, m_configSettings.StandaloneUserSource);
61
62 //LocalBackEndServices backendService = new LocalBackEndServices();
63 HGGridServicesStandalone gridService = new HGGridServicesStandalone(m_networkServersInfo, m_httpServer, m_assetCache, m_sceneManager);
64
65 LocalLoginService loginService =
66 new LocalLoginService(
67 userService, m_configSettings.StandaloneWelcomeMessage, inventoryService, gridService.LocalBackend, m_networkServersInfo,
68 m_configSettings.StandaloneAuthenticate, libraryRootFolder);
69
70
71 m_commsManager = new HGCommunicationsStandalone(m_networkServersInfo, m_httpServer, m_assetCache,
72 userService, userService, inventoryService, gridService, gridService, userService, libraryRootFolder, m_configSettings.DumpAssetsToFile);
73
74 inventoryService.UserProfileCache = m_commsManager.UserProfileCacheService;
75 HGServices = gridService;
76
77 // set up XMLRPC handler for client's initial login request message
78 m_httpServer.AddXmlRPCHandler("login_to_simulator", loginService.XmlRpcLoginMethod);
79
80 // provides the web form login
81 m_httpServer.AddHTTPHandler("login", loginService.ProcessHTMLLogin);
82
83 // Provides the LLSD login
84 m_httpServer.SetDefaultLLSDHandler(loginService.LLSDLoginMethod);
85
86 // provide grid info
87 // m_gridInfoService = new GridInfoService(m_config.Source.Configs["Startup"].GetString("inifile", Path.Combine(Util.configDir(), "OpenSim.ini")));
88 m_gridInfoService = new GridInfoService(m_config.Source);
89 m_httpServer.AddXmlRPCHandler("get_grid_info", m_gridInfoService.XmlRpcGridInfoMethod);
90 m_httpServer.AddStreamHandler(new RestStreamHandler("GET", "/get_grid_info", m_gridInfoService.RestGetGridInfoMethod));
91 }
92
93 protected override void InitialiseGridServices(LibraryRootFolder libraryRootFolder)
94 {
95 m_commsManager = new HGCommunicationsGridMode(m_networkServersInfo, m_httpServer, m_assetCache, m_sceneManager, libraryRootFolder);
96
97 HGServices = ((HGCommunicationsGridMode)m_commsManager).HGServices;
98
99 m_httpServer.AddStreamHandler(new SimStatusHandler());
100 }
101
102 protected override Scene CreateScene(RegionInfo regionInfo, StorageManager storageManager,
103 AgentCircuitManager circuitManager)
104 {
105 HGSceneCommunicationService sceneGridService = new HGSceneCommunicationService(m_commsManager, HGServices);
106 return
107 new HGScene(regionInfo, circuitManager, m_commsManager, sceneGridService, m_assetCache,
108 storageManager, m_httpServer,
109 m_moduleLoader, m_configSettings.DumpAssetsToFile, m_configSettings.PhysicalPrim, m_configSettings.See_into_region_from_neighbor, m_config.Source,
110 m_version);
111 }
112
113 public override void RunCmd(string command, string[] cmdparams)
114 {
115 if (command.Equals("link-region"))
116 {
117 // link-region <Xloc> <Yloc> <HostName> <HttpPort> <LocalName>
118 if (cmdparams.Length < 4)
119 {
120 LinkRegionCmdUsage();
121 return;
122 }
123
124 RegionInfo regInfo = new RegionInfo();
125 uint xloc, yloc;
126 uint externalPort;
127 try
128 {
129 xloc = Convert.ToUInt32(cmdparams[0]);
130 yloc = Convert.ToUInt32(cmdparams[1]);
131 externalPort = Convert.ToUInt32(cmdparams[3]);
132 //internalPort = Convert.ToUInt32(cmdparams[4]);
133 //remotingPort = Convert.ToUInt32(cmdparams[5]);
134 }
135 catch (Exception e)
136 {
137 m_log.Warn("[HGrid] Wrong format for link-region command: " + e.Message);
138 LinkRegionCmdUsage();
139 return;
140 }
141 regInfo.RegionLocX = xloc;
142 regInfo.RegionLocY = yloc;
143 regInfo.ExternalHostName = cmdparams[2];
144 regInfo.HttpPort = externalPort;
145 //regInfo.RemotingPort = remotingPort;
146 try
147 {
148 regInfo.InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), (int)0);
149 }
150 catch (Exception e)
151 {
152 m_log.Warn("[HGrid] Wrong format for link-region command: " + e.Message);
153 LinkRegionCmdUsage();
154 return;
155 }
156 regInfo.RemotingAddress = regInfo.ExternalEndPoint.Address.ToString();
157
158 // Finally, link it
159 try
160 {
161 m_sceneManager.CurrentOrFirstScene.CommsManager.GridService.RegisterRegion(regInfo);
162 }
163 catch (Exception e)
164 {
165 m_log.Warn("[HGrid] Unable to link region: " + e.StackTrace);
166 }
167 if (cmdparams.Length >= 5)
168 {
169 regInfo.RegionName = "";
170 for (int i = 4; i < cmdparams.Length; i++)
171 regInfo.RegionName += cmdparams[i] + " ";
172 }
173 }
174
175 base.RunCmd(command, cmdparams);
176
177 }
178
179 private void LinkRegionCmdUsage()
180 {
181 Console.WriteLine("Usage: link-region <Xloc> <Yloc> <HostName> <HttpPort> [<LocalName>]");
182 }
183 }
184}