aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Grid/GridServer
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Grid/GridServer')
-rw-r--r--OpenSim/Grid/GridServer/GridServerBase.cs170
-rw-r--r--OpenSim/Grid/GridServer/IGridPlugin.cs49
-rw-r--r--OpenSim/Grid/GridServer/Properties/AssemblyInfo.cs63
3 files changed, 0 insertions, 282 deletions
diff --git a/OpenSim/Grid/GridServer/GridServerBase.cs b/OpenSim/Grid/GridServer/GridServerBase.cs
deleted file mode 100644
index 9b0d7ea..0000000
--- a/OpenSim/Grid/GridServer/GridServerBase.cs
+++ /dev/null
@@ -1,170 +0,0 @@
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 OpenSimulator 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
28using System;
29using System.Collections.Generic;
30using System.IO;
31using System.Reflection;
32using log4net;
33using Nini.Config;
34using OpenSim.Framework;
35using OpenSim.Framework.Console;
36using OpenSim.Framework.Servers;
37using OpenSim.Framework.Servers.HttpServer;
38using OpenSim.Grid.Framework;
39
40namespace OpenSim.Grid.GridServer
41{
42 /// <summary>
43 /// </summary>
44 public class GridServerBase : BaseOpenSimServer, IGridServiceCore
45 {
46 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
47
48 protected GridConfig m_config;
49 public string m_consoleType = "local";
50 public IConfigSource m_configSource = null;
51 public string m_configFile = "GridServer_Config.xml";
52
53 public GridConfig Config
54 {
55 get { return m_config; }
56 }
57
58 public string Version
59 {
60 get { return m_version; }
61 }
62
63 protected List<IGridPlugin> m_plugins = new List<IGridPlugin>();
64
65 public void Work()
66 {
67 m_console.Output("Enter help for a list of commands\n");
68
69 while (true)
70 {
71 m_console.Prompt();
72 }
73 }
74
75 public GridServerBase()
76 {
77 }
78
79 protected override void StartupSpecific()
80 {
81 switch (m_consoleType)
82 {
83 case "rest":
84 m_console = new RemoteConsole("Grid");
85 break;
86 case "basic":
87 m_console = new CommandConsole("Grid");
88 break;
89 default:
90 m_console = new LocalConsole("Grid");
91 break;
92 }
93 MainConsole.Instance = m_console;
94 m_config = new GridConfig("GRID SERVER", (Path.Combine(Util.configDir(), m_configFile)));
95
96 m_log.Info("[GRID]: Starting HTTP process");
97 m_httpServer = new BaseHttpServer(m_config.HttpPort);
98 if (m_console is RemoteConsole)
99 {
100 RemoteConsole c = (RemoteConsole)m_console;
101 c.SetServer(m_httpServer);
102 IConfig netConfig = m_configSource.AddConfig("Network");
103 netConfig.Set("ConsoleUser", m_config.ConsoleUser);
104 netConfig.Set("ConsolePass", m_config.ConsolePass);
105 c.ReadConfig(m_configSource);
106 }
107
108 LoadPlugins();
109
110 m_httpServer.Start();
111
112 base.StartupSpecific();
113 }
114
115 protected virtual void LoadPlugins()
116 {
117 using (PluginLoader<IGridPlugin> loader = new PluginLoader<IGridPlugin>(new GridPluginInitialiser(this)))
118 {
119 loader.Load("/OpenSim/GridServer");
120 m_plugins = loader.Plugins;
121 }
122 }
123
124 public override void ShutdownSpecific()
125 {
126 foreach (IGridPlugin plugin in m_plugins) plugin.Dispose();
127 }
128
129 #region IServiceCore
130 protected Dictionary<Type, object> m_moduleInterfaces = new Dictionary<Type, object>();
131
132 /// <summary>
133 /// Register an Module interface.
134 /// </summary>
135 /// <typeparam name="T"></typeparam>
136 /// <param name="iface"></param>
137 public void RegisterInterface<T>(T iface)
138 {
139 lock (m_moduleInterfaces)
140 {
141 if (!m_moduleInterfaces.ContainsKey(typeof(T)))
142 {
143 m_moduleInterfaces.Add(typeof(T), iface);
144 }
145 }
146 }
147
148 public bool TryGet<T>(out T iface)
149 {
150 if (m_moduleInterfaces.ContainsKey(typeof(T)))
151 {
152 iface = (T)m_moduleInterfaces[typeof(T)];
153 return true;
154 }
155 iface = default(T);
156 return false;
157 }
158
159 public T Get<T>()
160 {
161 return (T)m_moduleInterfaces[typeof(T)];
162 }
163
164 public BaseHttpServer GetHttpServer()
165 {
166 return m_httpServer;
167 }
168 #endregion
169 }
170}
diff --git a/OpenSim/Grid/GridServer/IGridPlugin.cs b/OpenSim/Grid/GridServer/IGridPlugin.cs
deleted file mode 100644
index bd0feb6..0000000
--- a/OpenSim/Grid/GridServer/IGridPlugin.cs
+++ /dev/null
@@ -1,49 +0,0 @@
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 OpenSimulator 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 OpenSim.Framework;
30
31namespace OpenSim.Grid.GridServer
32{
33 public interface IGridPlugin : IPlugin
34 {
35 void Initialise(GridServerBase gridServer);
36 void PostInitialise();
37 }
38
39 public class GridPluginInitialiser : PluginInitialiserBase
40 {
41 private GridServerBase server;
42 public GridPluginInitialiser (GridServerBase s) { server = s; }
43 public override void Initialise (IPlugin plugin)
44 {
45 IGridPlugin p = plugin as IGridPlugin;
46 p.Initialise (server);
47 }
48 }
49}
diff --git a/OpenSim/Grid/GridServer/Properties/AssemblyInfo.cs b/OpenSim/Grid/GridServer/Properties/AssemblyInfo.cs
deleted file mode 100644
index 24c4bd7..0000000
--- a/OpenSim/Grid/GridServer/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,63 +0,0 @@
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 OpenSimulator 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
28using System.Reflection;
29using System.Runtime.InteropServices;
30
31// General information about an assembly is controlled through the following
32// set of attributes. Change these attribute values to modify the information
33// associated with an assembly.
34
35[assembly : AssemblyTitle("OGS-GridServer")]
36[assembly : AssemblyDescription("")]
37[assembly : AssemblyConfiguration("")]
38[assembly : AssemblyCompany("http://opensimulator.org")]
39[assembly : AssemblyProduct("OGS-GridServer")]
40[assembly : AssemblyCopyright("Copyright (c) OpenSimulator.org Developers 2007-2009")]
41[assembly : AssemblyTrademark("")]
42[assembly : AssemblyCulture("")]
43
44// Setting ComVisible to false makes the types in this assembly not visible
45// to COM components. If you need to access a type in this assembly from
46// COM, set the ComVisible attribute to true on that type.
47
48[assembly : ComVisible(false)]
49
50// The following GUID is for the ID of the typelib if this project is exposed to COM
51
52[assembly : Guid("b541b244-3d1d-4625-9003-bc2a3a6a39a4")]
53
54// Version information for an assembly consists of the following four values:
55//
56// Major Version
57// Minor Version
58// Build Number
59// Revision
60//
61
62[assembly : AssemblyVersion("0.6.5.*")]
63[assembly : AssemblyFileVersion("0.6.5.0")]