diff options
author | lbsa71 | 2008-03-12 10:13:19 +0000 |
---|---|---|
committer | lbsa71 | 2008-03-12 10:13:19 +0000 |
commit | 3f45cfc5917af6d46f9d17eea01bf433bddd3d15 (patch) | |
tree | def545a4d409a4c05148fc925c90a2c40f586b44 /OpenSim/Grid | |
parent | * Refactored some internals in Grid Server Main (diff) | |
download | opensim-SC-3f45cfc5917af6d46f9d17eea01bf433bddd3d15.zip opensim-SC-3f45cfc5917af6d46f9d17eea01bf433bddd3d15.tar.gz opensim-SC-3f45cfc5917af6d46f9d17eea01bf433bddd3d15.tar.bz2 opensim-SC-3f45cfc5917af6d46f9d17eea01bf433bddd3d15.tar.xz |
* Refactored out exe bit out of Grid Server for great justice
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Grid/GridServer/Main.cs | 70 | ||||
-rw-r--r-- | OpenSim/Grid/GridServer/Program.cs | 28 |
2 files changed, 44 insertions, 54 deletions
diff --git a/OpenSim/Grid/GridServer/Main.cs b/OpenSim/Grid/GridServer/Main.cs index bf78cf9..5d21750 100644 --- a/OpenSim/Grid/GridServer/Main.cs +++ b/OpenSim/Grid/GridServer/Main.cs | |||
@@ -39,32 +39,10 @@ namespace OpenSim.Grid.GridServer | |||
39 | /// </summary> | 39 | /// </summary> |
40 | public class OpenGrid_Main : BaseOpenSimServer, conscmd_callback | 40 | public class OpenGrid_Main : BaseOpenSimServer, conscmd_callback |
41 | { | 41 | { |
42 | private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); | ||
43 | private GridConfig m_config; | 42 | private GridConfig m_config; |
44 | private GridManager m_gridManager; | 43 | private GridManager m_gridManager; |
45 | 44 | ||
46 | [STAThread] | 45 | public void Work() |
47 | public static void Main(string[] args) | ||
48 | { | ||
49 | log4net.Config.XmlConfigurator.Configure(); | ||
50 | |||
51 | OpenGrid_Main app = new OpenGrid_Main(); | ||
52 | |||
53 | if (args.Length > 0 && args[0] == "-setuponly") | ||
54 | { | ||
55 | app.Config(); | ||
56 | } | ||
57 | else | ||
58 | { | ||
59 | m_log.Info("Starting...\n"); | ||
60 | |||
61 | app.Startup(); | ||
62 | |||
63 | app.Work(); | ||
64 | } | ||
65 | } | ||
66 | |||
67 | private void Work() | ||
68 | { | 46 | { |
69 | m_console.Notice("Enter help for a list of commands\n"); | 47 | m_console.Notice("Enter help for a list of commands\n"); |
70 | 48 | ||
@@ -74,7 +52,7 @@ namespace OpenSim.Grid.GridServer | |||
74 | } | 52 | } |
75 | } | 53 | } |
76 | 54 | ||
77 | private OpenGrid_Main() | 55 | public OpenGrid_Main( ) |
78 | { | 56 | { |
79 | m_console = new ConsoleBase("OpenGrid", this); | 57 | m_console = new ConsoleBase("OpenGrid", this); |
80 | MainConsole.Instance = m_console; | 58 | MainConsole.Instance = m_console; |
@@ -92,14 +70,13 @@ namespace OpenSim.Grid.GridServer | |||
92 | 70 | ||
93 | public void Startup() | 71 | public void Startup() |
94 | { | 72 | { |
73 | m_console.Status("Starting...\n"); | ||
74 | |||
95 | Config(); | 75 | Config(); |
96 | 76 | ||
97 | m_log.Info("[GRID]: Connecting to Storage Server"); | 77 | SetupGridManager(); |
98 | m_gridManager = new GridManager(); | ||
99 | m_gridManager.AddPlugin(m_config.DatabaseProvider); // Made of win | ||
100 | m_gridManager.Config = m_config; | ||
101 | 78 | ||
102 | m_log.Info("[GRID]: Starting HTTP process"); | 79 | m_console.Status("[GRID]: Starting HTTP process"); |
103 | BaseHttpServer httpServer = new BaseHttpServer(m_config.HttpPort); | 80 | BaseHttpServer httpServer = new BaseHttpServer(m_config.HttpPort); |
104 | //GridManagementAgent GridManagerAgent = new GridManagementAgent(httpServer, "gridserver", m_config.SimSendKey, m_config.SimRecvKey, managercallback); | 81 | //GridManagementAgent GridManagerAgent = new GridManagementAgent(httpServer, "gridserver", m_config.SimSendKey, m_config.SimRecvKey, managercallback); |
105 | 82 | ||
@@ -125,14 +102,22 @@ namespace OpenSim.Grid.GridServer | |||
125 | 102 | ||
126 | httpServer.Start(); | 103 | httpServer.Start(); |
127 | 104 | ||
128 | m_log.Info("[GRID]: Starting sim status checker"); | 105 | m_console.Status("[GRID]: Starting sim status checker"); |
129 | 106 | ||
130 | Timer simCheckTimer = new Timer(3600000*3); // 3 Hours between updates. | 107 | Timer simCheckTimer = new Timer(3600000*3); // 3 Hours between updates. |
131 | simCheckTimer.Elapsed += new ElapsedEventHandler(CheckSims); | 108 | simCheckTimer.Elapsed += new ElapsedEventHandler(CheckSims); |
132 | simCheckTimer.Enabled = true; | 109 | simCheckTimer.Enabled = true; |
133 | } | 110 | } |
134 | 111 | ||
135 | private void Config() | 112 | protected virtual void SetupGridManager() |
113 | { | ||
114 | m_console.Status("[GRID]: Connecting to Storage Server"); | ||
115 | m_gridManager = new GridManager(); | ||
116 | m_gridManager.AddPlugin(m_config.DatabaseProvider); | ||
117 | m_gridManager.Config = m_config; | ||
118 | } | ||
119 | |||
120 | public void Config() | ||
136 | { | 121 | { |
137 | m_config = new GridConfig("GRID SERVER", (Path.Combine(Util.configDir(), "GridServer_Config.xml"))); | 122 | m_config = new GridConfig("GRID SERVER", (Path.Combine(Util.configDir(), "GridServer_Config.xml"))); |
138 | } | 123 | } |
@@ -190,28 +175,5 @@ namespace OpenSim.Grid.GridServer | |||
190 | break; | 175 | break; |
191 | } | 176 | } |
192 | } | 177 | } |
193 | |||
194 | /*private void ConfigDB(IGenericConfig configData) | ||
195 | { | ||
196 | try | ||
197 | { | ||
198 | string attri = String.Empty; | ||
199 | attri = configData.GetAttribute("DataBaseProvider"); | ||
200 | if (attri == String.Empty) | ||
201 | { | ||
202 | GridDll = "OpenSim.Framework.Data.DB4o.dll"; | ||
203 | configData.SetAttribute("DataBaseProvider", "OpenSim.Framework.Data.DB4o.dll"); | ||
204 | } | ||
205 | else | ||
206 | { | ||
207 | GridDll = attri; | ||
208 | } | ||
209 | configData.Commit(); | ||
210 | } | ||
211 | catch | ||
212 | { | ||
213 | |||
214 | } | ||
215 | }*/ | ||
216 | } | 178 | } |
217 | } | 179 | } |
diff --git a/OpenSim/Grid/GridServer/Program.cs b/OpenSim/Grid/GridServer/Program.cs new file mode 100644 index 0000000..7247a63 --- /dev/null +++ b/OpenSim/Grid/GridServer/Program.cs | |||
@@ -0,0 +1,28 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | using OpenSim.Framework.Console; | ||
5 | |||
6 | namespace OpenSim.Grid.GridServer | ||
7 | { | ||
8 | public class Program | ||
9 | { | ||
10 | [STAThread] | ||
11 | public static void Main(string[] args) | ||
12 | { | ||
13 | log4net.Config.XmlConfigurator.Configure(); | ||
14 | |||
15 | OpenGrid_Main app = new OpenGrid_Main(); | ||
16 | |||
17 | if (args.Length > 0 && args[0] == "-setuponly") | ||
18 | { | ||
19 | app.Config(); | ||
20 | } | ||
21 | else | ||
22 | { | ||
23 | app.Startup(); | ||
24 | app.Work(); | ||
25 | } | ||
26 | } | ||
27 | } | ||
28 | } | ||