diff options
author | Johan Berntsson | 2008-03-24 01:21:01 +0000 |
---|---|---|
committer | Johan Berntsson | 2008-03-24 01:21:01 +0000 |
commit | 12a32b06083547a0b789bc58d3b32603700ce1f2 (patch) | |
tree | cdf367a28052f62771af30167fa00ba45563fb31 /OpenSim/Grid/GridServer/GridServerBase.cs | |
parent | * minor: check in the rest of a comment I forgot to finish off in the last re... (diff) | |
download | opensim-SC-12a32b06083547a0b789bc58d3b32603700ce1f2.zip opensim-SC-12a32b06083547a0b789bc58d3b32603700ce1f2.tar.gz opensim-SC-12a32b06083547a0b789bc58d3b32603700ce1f2.tar.bz2 opensim-SC-12a32b06083547a0b789bc58d3b32603700ce1f2.tar.xz |
Added a plugin loader in GridServer
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Grid/GridServer/GridServerBase.cs | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/OpenSim/Grid/GridServer/GridServerBase.cs b/OpenSim/Grid/GridServer/GridServerBase.cs index faf1d8b..c29924b 100644 --- a/OpenSim/Grid/GridServer/GridServerBase.cs +++ b/OpenSim/Grid/GridServer/GridServerBase.cs | |||
@@ -28,9 +28,14 @@ | |||
28 | using System; | 28 | using System; |
29 | using System.IO; | 29 | using System.IO; |
30 | using System.Timers; | 30 | using System.Timers; |
31 | using System.Collections; | ||
32 | using System.Collections.Generic; | ||
31 | using OpenSim.Framework; | 33 | using OpenSim.Framework; |
32 | using OpenSim.Framework.Console; | 34 | using OpenSim.Framework.Console; |
33 | using OpenSim.Framework.Servers; | 35 | using OpenSim.Framework.Servers; |
36 | using Nwc.XmlRpc; | ||
37 | using Mono.Addins; | ||
38 | using Mono.Addins.Description; | ||
34 | 39 | ||
35 | namespace OpenSim.Grid.GridServer | 40 | namespace OpenSim.Grid.GridServer |
36 | { | 41 | { |
@@ -40,6 +45,13 @@ namespace OpenSim.Grid.GridServer | |||
40 | { | 45 | { |
41 | protected GridConfig m_config; | 46 | protected GridConfig m_config; |
42 | protected GridManager m_gridManager; | 47 | protected GridManager m_gridManager; |
48 | protected BaseHttpServer httpServer; | ||
49 | protected List<IGridPlugin> m_plugins = new List<IGridPlugin>(); | ||
50 | |||
51 | public BaseHttpServer | ||
52 | { | ||
53 | get { return httpServer; } | ||
54 | } | ||
43 | 55 | ||
44 | public void Work() | 56 | public void Work() |
45 | { | 57 | { |
@@ -76,7 +88,7 @@ namespace OpenSim.Grid.GridServer | |||
76 | SetupGridManager(); | 88 | SetupGridManager(); |
77 | 89 | ||
78 | m_console.Status("[GRID]: Starting HTTP process"); | 90 | m_console.Status("[GRID]: Starting HTTP process"); |
79 | BaseHttpServer httpServer = new BaseHttpServer(m_config.HttpPort); | 91 | httpServer = new BaseHttpServer(m_config.HttpPort); |
80 | //GridManagementAgent GridManagerAgent = new GridManagementAgent(httpServer, "gridserver", m_config.SimSendKey, m_config.SimRecvKey, managercallback); | 92 | //GridManagementAgent GridManagerAgent = new GridManagementAgent(httpServer, "gridserver", m_config.SimSendKey, m_config.SimRecvKey, managercallback); |
81 | 93 | ||
82 | httpServer.AddXmlRPCHandler("simulator_login", m_gridManager.XmlRpcSimulatorLoginMethod); | 94 | httpServer.AddXmlRPCHandler("simulator_login", m_gridManager.XmlRpcSimulatorLoginMethod); |
@@ -99,6 +111,8 @@ namespace OpenSim.Grid.GridServer | |||
99 | //httpServer.AddRestHandler("GET", "/regions/", m_gridManager.RestGetRegionMethod); | 111 | //httpServer.AddRestHandler("GET", "/regions/", m_gridManager.RestGetRegionMethod); |
100 | //httpServer.AddRestHandler("POST", "/regions/", m_gridManager.RestSetRegionMethod); | 112 | //httpServer.AddRestHandler("POST", "/regions/", m_gridManager.RestSetRegionMethod); |
101 | 113 | ||
114 | LoadGridPlugins(); | ||
115 | |||
102 | httpServer.Start(); | 116 | httpServer.Start(); |
103 | 117 | ||
104 | m_console.Status("[GRID]: Starting sim status checker"); | 118 | m_console.Status("[GRID]: Starting sim status checker"); |
@@ -108,6 +122,23 @@ namespace OpenSim.Grid.GridServer | |||
108 | simCheckTimer.Enabled = true; | 122 | simCheckTimer.Enabled = true; |
109 | } | 123 | } |
110 | 124 | ||
125 | protected void LoadGridPlugins() | ||
126 | { | ||
127 | //m_console.Status("[GRIDPLUGINS]: Looking for plugins"); | ||
128 | AddinManager.Initialize("."); | ||
129 | AddinManager.Registry.Update(null); | ||
130 | |||
131 | ExtensionNodeList nodes = AddinManager.GetExtensionNodes("/OpenSim/GridServer"); | ||
132 | foreach (TypeExtensionNode node in nodes) | ||
133 | { | ||
134 | m_console.Status("[GRIDPLUGINS]: Loading OpenSim plugin "+node.Path); | ||
135 | IGridPlugin plugin = (IGridPlugin) node.CreateInstance(); | ||
136 | plugin.Initialise(this); | ||
137 | m_plugins.Add(plugin); | ||
138 | } | ||
139 | } | ||
140 | |||
141 | |||
111 | protected virtual void SetupGridManager() | 142 | protected virtual void SetupGridManager() |
112 | { | 143 | { |
113 | m_console.Status("[GRID]: Connecting to Storage Server"); | 144 | m_console.Status("[GRID]: Connecting to Storage Server"); |
@@ -169,6 +200,7 @@ namespace OpenSim.Grid.GridServer | |||
169 | break; | 200 | break; |
170 | 201 | ||
171 | case "shutdown": | 202 | case "shutdown": |
203 | foreach(IGridPlugin plugin in m_plugins) plugin.Close(); | ||
172 | m_console.Close(); | 204 | m_console.Close(); |
173 | Environment.Exit(0); | 205 | Environment.Exit(0); |
174 | break; | 206 | break; |