diff options
author | Melanie | 2010-03-03 02:07:03 +0000 |
---|---|---|
committer | Melanie | 2010-03-03 02:07:03 +0000 |
commit | 028a87fe37002e7a0611f66babf1deee46c83804 (patch) | |
tree | 387aec499fd60c2012bed8148e6a2ddc847c3d95 /OpenSim/Grid/GridServer.Modules/GridServerPlugin.cs | |
parent | Revert "test" (diff) | |
parent | Fixes Region.Framework tests. Although these tests don't fail, they need to b... (diff) | |
download | opensim-SC-028a87fe37002e7a0611f66babf1deee46c83804.zip opensim-SC-028a87fe37002e7a0611f66babf1deee46c83804.tar.gz opensim-SC-028a87fe37002e7a0611f66babf1deee46c83804.tar.bz2 opensim-SC-028a87fe37002e7a0611f66babf1deee46c83804.tar.xz |
Merge branch 'master' into careminster-presence-refactor
This brings careminster on the level of master. To be tested
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Grid/GridServer.Modules/GridServerPlugin.cs | 176 |
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 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Reflection; | ||
31 | using System.Text; | ||
32 | using log4net; | ||
33 | using OpenSim.Framework; | ||
34 | using OpenSim.Framework.Console; | ||
35 | using OpenSim.Grid.Framework; | ||
36 | using OpenSim.Grid; | ||
37 | |||
38 | namespace 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 | } | ||