aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Grid
diff options
context:
space:
mode:
authorJohan Berntsson2008-03-24 01:21:01 +0000
committerJohan Berntsson2008-03-24 01:21:01 +0000
commit12a32b06083547a0b789bc58d3b32603700ce1f2 (patch)
treecdf367a28052f62771af30167fa00ba45563fb31 /OpenSim/Grid
parent* minor: check in the rest of a comment I forgot to finish off in the last re... (diff)
downloadopensim-SC_OLD-12a32b06083547a0b789bc58d3b32603700ce1f2.zip
opensim-SC_OLD-12a32b06083547a0b789bc58d3b32603700ce1f2.tar.gz
opensim-SC_OLD-12a32b06083547a0b789bc58d3b32603700ce1f2.tar.bz2
opensim-SC_OLD-12a32b06083547a0b789bc58d3b32603700ce1f2.tar.xz
Added a plugin loader in GridServer
Diffstat (limited to 'OpenSim/Grid')
-rw-r--r--OpenSim/Grid/GridServer/GridServerBase.cs34
-rw-r--r--OpenSim/Grid/GridServer/IGridPlugin.cs41
2 files changed, 74 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 @@
28using System; 28using System;
29using System.IO; 29using System.IO;
30using System.Timers; 30using System.Timers;
31using System.Collections;
32using System.Collections.Generic;
31using OpenSim.Framework; 33using OpenSim.Framework;
32using OpenSim.Framework.Console; 34using OpenSim.Framework.Console;
33using OpenSim.Framework.Servers; 35using OpenSim.Framework.Servers;
36using Nwc.XmlRpc;
37using Mono.Addins;
38using Mono.Addins.Description;
34 39
35namespace OpenSim.Grid.GridServer 40namespace 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;
diff --git a/OpenSim/Grid/GridServer/IGridPlugin.cs b/OpenSim/Grid/GridServer/IGridPlugin.cs
new file mode 100644
index 0000000..fbadfce
--- /dev/null
+++ b/OpenSim/Grid/GridServer/IGridPlugin.cs
@@ -0,0 +1,41 @@
1/*
2* Copyright (c) Contributors, http://opensimulator.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4*
5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission.
15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26*
27*/
28
29using Mono.Addins;
30
31[assembly : AddinRoot("OpenSim", "0.5")]
32
33namespace OpenSim.Grid.GridServer
34{
35 [TypeExtensionPoint("/OpenSim/GridServer")]
36 public interface IGridPlugin
37 {
38 void Initialise(GridServerBase gridServer);
39 void Close();
40 }
41}