aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Grid/GridServer
diff options
context:
space:
mode:
authorMW2009-02-27 15:57:09 +0000
committerMW2009-02-27 15:57:09 +0000
commitd45fa9c2df01286d35542665d65071deca0fbb07 (patch)
tree70518a46cbb08431a02128cb73784b2bda67e594 /OpenSim/Grid/GridServer
parentApplied patch from Mantis# 3240, thanks tlaukkan/Tommil (diff)
downloadopensim-SC_OLD-d45fa9c2df01286d35542665d65071deca0fbb07.zip
opensim-SC_OLD-d45fa9c2df01286d35542665d65071deca0fbb07.tar.gz
opensim-SC_OLD-d45fa9c2df01286d35542665d65071deca0fbb07.tar.bz2
opensim-SC_OLD-d45fa9c2df01286d35542665d65071deca0fbb07.tar.xz
Added GridServerPlugin class (which implements IGridPlugin) to OpenSim.Grid.GridServer.Modules.
This class handles all the initialising of the grid server. And made GridServer into basically a generic server that just loads plugins. So this is a step towards having a generic server that loads service modules.
Diffstat (limited to 'OpenSim/Grid/GridServer')
-rw-r--r--OpenSim/Grid/GridServer/GridServerBase.cs101
1 files changed, 10 insertions, 91 deletions
diff --git a/OpenSim/Grid/GridServer/GridServerBase.cs b/OpenSim/Grid/GridServer/GridServerBase.cs
index 1ee97f4..a1170f8 100644
--- a/OpenSim/Grid/GridServer/GridServerBase.cs
+++ b/OpenSim/Grid/GridServer/GridServerBase.cs
@@ -35,7 +35,6 @@ using OpenSim.Framework;
35using OpenSim.Framework.Console; 35using OpenSim.Framework.Console;
36using OpenSim.Framework.Servers; 36using OpenSim.Framework.Servers;
37using OpenSim.Grid.Framework; 37using OpenSim.Grid.Framework;
38using OpenSim.Grid.GridServer.Modules;
39 38
40namespace OpenSim.Grid.GridServer 39namespace OpenSim.Grid.GridServer
41{ 40{
@@ -47,11 +46,15 @@ namespace OpenSim.Grid.GridServer
47 46
48 protected GridConfig m_config; 47 protected GridConfig m_config;
49 48
50 protected GridXmlRpcModule m_gridXmlRpcModule; 49 public GridConfig Config
51 protected GridMessagingModule m_gridMessageModule; 50 {
52 protected GridRestModule m_gridRestModule; 51 get { return m_config; }
52 }
53 53
54 protected GridDBService m_gridDBService; 54 public string Version
55 {
56 get { return m_version; }
57 }
55 58
56 protected List<IGridPlugin> m_plugins = new List<IGridPlugin>(); 59 protected List<IGridPlugin> m_plugins = new List<IGridPlugin>();
57 60
@@ -71,34 +74,6 @@ namespace OpenSim.Grid.GridServer
71 MainConsole.Instance = m_console; 74 MainConsole.Instance = m_console;
72 } 75 }
73 76
74 private void HandleRegistration(string module, string[] cmd)
75 {
76 switch (cmd[0])
77 {
78 case "enable":
79 m_config.AllowRegionRegistration = true;
80 m_log.Info("Region registration enabled");
81 break;
82 case "disable":
83 m_config.AllowRegionRegistration = false;
84 m_log.Info("Region registration disabled");
85 break;
86 }
87 }
88
89 private void HandleShowStatus(string module, string[] cmd)
90 {
91 if (m_config.AllowRegionRegistration)
92 {
93 m_log.Info("Region registration enabled.");
94 }
95 else
96 {
97 m_log.Info("Region registration disabled.");
98 }
99 }
100
101
102 protected override void StartupSpecific() 77 protected override void StartupSpecific()
103 { 78 {
104 m_config = new GridConfig("GRID SERVER", (Path.Combine(Util.configDir(), "GridServer_Config.xml"))); 79 m_config = new GridConfig("GRID SERVER", (Path.Combine(Util.configDir(), "GridServer_Config.xml")));
@@ -106,43 +81,14 @@ namespace OpenSim.Grid.GridServer
106 m_log.Info("[GRID]: Starting HTTP process"); 81 m_log.Info("[GRID]: Starting HTTP process");
107 m_httpServer = new BaseHttpServer(m_config.HttpPort); 82 m_httpServer = new BaseHttpServer(m_config.HttpPort);
108 83
109 SetupGridServices();
110
111 AddHttpHandlers();
112
113 LoadPlugins(); 84 LoadPlugins();
114 85
115 m_httpServer.Start(); 86 m_httpServer.Start();
116 87
117 // m_log.Info("[GRID]: Starting sim status checker");
118 //
119 // Timer simCheckTimer = new Timer(3600000 * 3); // 3 Hours between updates.
120 // simCheckTimer.Elapsed += new ElapsedEventHandler(CheckSims);
121 // simCheckTimer.Enabled = true;
122
123 base.StartupSpecific(); 88 base.StartupSpecific();
124
125 m_console.Commands.AddCommand("gridserver", false,
126 "enable registration",
127 "enable registration",
128 "Enable new regions to register", HandleRegistration);
129
130 m_console.Commands.AddCommand("gridserver", false,
131 "disable registration",
132 "disable registration",
133 "Disable registering new regions", HandleRegistration);
134
135 m_console.Commands.AddCommand("gridserver", false, "show status",
136 "show status",
137 "Show registration status", HandleShowStatus);
138 } 89 }
139 90
140 protected void AddHttpHandlers() 91 protected virtual void LoadPlugins()
141 {
142 // Registering Handlers is now done in the components/modules
143 }
144
145 protected void LoadPlugins()
146 { 92 {
147 PluginLoader<IGridPlugin> loader = 93 PluginLoader<IGridPlugin> loader =
148 new PluginLoader<IGridPlugin>(new GridPluginInitialiser(this)); 94 new PluginLoader<IGridPlugin>(new GridPluginInitialiser(this));
@@ -151,39 +97,12 @@ namespace OpenSim.Grid.GridServer
151 m_plugins = loader.Plugins; 97 m_plugins = loader.Plugins;
152 } 98 }
153 99
154 protected virtual void SetupGridServices()
155 {
156 m_log.Info("[DATA]: Connecting to Storage Server");
157 m_gridDBService = new GridDBService();
158 m_gridDBService.AddPlugin(m_config.DatabaseProvider, m_config.DatabaseConnect);
159
160 //Register the database access service so modules can fetch it
161 // RegisterInterface<GridDBService>(m_gridDBService);
162
163 m_gridMessageModule = new GridMessagingModule();
164 m_gridMessageModule.Initialise(m_version, m_gridDBService, this, m_config);
165
166 m_gridXmlRpcModule = new GridXmlRpcModule();
167 m_gridXmlRpcModule.Initialise(m_version, m_gridDBService, this, m_config);
168
169 m_gridRestModule = new GridRestModule();
170 m_gridRestModule.Initialise(m_version, m_gridDBService, this, m_config);
171
172 m_gridMessageModule.PostInitialise();
173 m_gridXmlRpcModule.PostInitialise();
174 m_gridRestModule.PostInitialise();
175 }
176
177 public void CheckSims(object sender, ElapsedEventArgs e)
178 {
179 }
180
181 public override void ShutdownSpecific() 100 public override void ShutdownSpecific()
182 { 101 {
183 foreach (IGridPlugin plugin in m_plugins) plugin.Dispose(); 102 foreach (IGridPlugin plugin in m_plugins) plugin.Dispose();
184 } 103 }
185 104
186 #region IUGAIMCore 105 #region IServiceCore
187 protected Dictionary<Type, object> m_moduleInterfaces = new Dictionary<Type, object>(); 106 protected Dictionary<Type, object> m_moduleInterfaces = new Dictionary<Type, object>();
188 107
189 /// <summary> 108 /// <summary>