aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Grid/GridServer.Modules/GridServerPlugin.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Grid/GridServer.Modules/GridServerPlugin.cs')
-rw-r--r--OpenSim/Grid/GridServer.Modules/GridServerPlugin.cs176
1 files changed, 0 insertions, 176 deletions
diff --git a/OpenSim/Grid/GridServer.Modules/GridServerPlugin.cs b/OpenSim/Grid/GridServer.Modules/GridServerPlugin.cs
deleted file mode 100644
index f1acaf9..0000000
--- a/OpenSim/Grid/GridServer.Modules/GridServerPlugin.cs
+++ /dev/null
@@ -1,176 +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.Reflection;
31using System.Text;
32using log4net;
33using OpenSim.Framework;
34using OpenSim.Framework.Console;
35using OpenSim.Grid.Framework;
36using OpenSim.Grid;
37
38namespace OpenSim.Grid.GridServer.Modules
39{
40 public class GridServerPlugin : IGridPlugin
41 {
42 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
43
44 protected GridXmlRpcModule m_gridXmlRpcModule;
45 protected GridMessagingModule m_gridMessageModule;
46 protected GridRestModule m_gridRestModule;
47
48 protected GridDBService m_gridDBService;
49
50 protected string m_version;
51
52 protected GridConfig m_config;
53
54 protected IGridServiceCore m_core;
55
56 protected CommandConsole m_console;
57
58 #region IGridPlugin Members
59
60 public void Initialise(GridServerBase gridServer)
61 {
62 m_core = gridServer;
63 m_config = gridServer.Config;
64 m_version = gridServer.Version;
65 m_console = MainConsole.Instance;
66
67 AddConsoleCommands();
68
69 SetupGridServices();
70 }
71
72 public void PostInitialise()
73 {
74
75 }
76
77 #endregion
78
79 #region IPlugin Members
80
81 public string Version
82 {
83 get { return "0.0"; }
84 }
85
86 public string Name
87 {
88 get { return "GridServerPlugin"; }
89 }
90
91 public void Initialise()
92 {
93 }
94
95 #endregion
96
97 protected virtual void SetupGridServices()
98 {
99 // m_log.Info("[DATA]: Connecting to Storage Server");
100 m_gridDBService = new GridDBService();
101 m_gridDBService.AddPlugin(m_config.DatabaseProvider, m_config.DatabaseConnect);
102
103 //Register the database access service so modules can fetch it
104 // RegisterInterface<GridDBService>(m_gridDBService);
105
106 m_gridMessageModule = new GridMessagingModule();
107 m_gridMessageModule.Initialise(m_version, m_gridDBService, m_core, m_config);
108
109 m_gridXmlRpcModule = new GridXmlRpcModule();
110 m_gridXmlRpcModule.Initialise(m_version, m_gridDBService, m_core, m_config);
111
112 m_gridRestModule = new GridRestModule();
113 m_gridRestModule.Initialise(m_version, m_gridDBService, m_core, m_config);
114
115 m_gridMessageModule.PostInitialise();
116 m_gridXmlRpcModule.PostInitialise();
117 m_gridRestModule.PostInitialise();
118 }
119
120 #region Console Command Handlers
121
122 protected virtual void AddConsoleCommands()
123 {
124 m_console.Commands.AddCommand("gridserver", false,
125 "enable registration",
126 "enable registration",
127 "Enable new regions to register", HandleRegistration);
128
129 m_console.Commands.AddCommand("gridserver", false,
130 "disable registration",
131 "disable registration",
132 "Disable registering new regions", HandleRegistration);
133
134 m_console.Commands.AddCommand("gridserver", false, "show status",
135 "show status",
136 "Show registration status", HandleShowStatus);
137 }
138
139 private void HandleRegistration(string module, string[] cmd)
140 {
141 switch (cmd[0])
142 {
143 case "enable":
144 m_config.AllowRegionRegistration = true;
145 m_log.Info("Region registration enabled");
146 break;
147 case "disable":
148 m_config.AllowRegionRegistration = false;
149 m_log.Info("Region registration disabled");
150 break;
151 }
152 }
153
154 private void HandleShowStatus(string module, string[] cmd)
155 {
156 if (m_config.AllowRegionRegistration)
157 {
158 m_log.Info("Region registration enabled.");
159 }
160 else
161 {
162 m_log.Info("Region registration disabled.");
163 }
164 }
165
166 #endregion
167
168 #region IDisposable Members
169
170 public void Dispose()
171 {
172 }
173
174 #endregion
175 }
176}