diff options
author | Adam Frisby | 2007-07-11 08:10:25 +0000 |
---|---|---|
committer | Adam Frisby | 2007-07-11 08:10:25 +0000 |
commit | e2ff441e31328e60c8bb1d4bb32fa4ac64f91978 (patch) | |
tree | 8405b6cef57b66a58f31a24c859846085d0b81f7 /OpenSim/Grid | |
parent | * Wiping trunk in prep for Sugilite (diff) | |
parent | * Applying dalien's patches from bug#177 and #179 (diff) | |
download | opensim-SC_OLD-e2ff441e31328e60c8bb1d4bb32fa4ac64f91978.zip opensim-SC_OLD-e2ff441e31328e60c8bb1d4bb32fa4ac64f91978.tar.gz opensim-SC_OLD-e2ff441e31328e60c8bb1d4bb32fa4ac64f91978.tar.bz2 opensim-SC_OLD-e2ff441e31328e60c8bb1d4bb32fa4ac64f91978.tar.xz |
* Bringing Sugilite in to trunk
Diffstat (limited to 'OpenSim/Grid')
34 files changed, 4309 insertions, 0 deletions
diff --git a/OpenSim/Grid/AssetServer/Main.cs b/OpenSim/Grid/AssetServer/Main.cs new file mode 100644 index 0000000..3e302d8 --- /dev/null +++ b/OpenSim/Grid/AssetServer/Main.cs | |||
@@ -0,0 +1,406 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.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 | |||
29 | using System; | ||
30 | using System.IO; | ||
31 | using System.Text; | ||
32 | using Db4objects.Db4o; | ||
33 | using libsecondlife; | ||
34 | using OpenSim.Framework.Console; | ||
35 | using OpenSim.Framework.Types; | ||
36 | using OpenSim.Framework.Servers; | ||
37 | |||
38 | namespace OpenSim.Grid.AssetServer | ||
39 | { | ||
40 | /// <summary> | ||
41 | /// An asset server | ||
42 | /// </summary> | ||
43 | public class OpenAsset_Main : conscmd_callback | ||
44 | { | ||
45 | private IObjectContainer db; | ||
46 | |||
47 | public static OpenAsset_Main assetserver; | ||
48 | |||
49 | private LogBase m_console; | ||
50 | |||
51 | [STAThread] | ||
52 | public static void Main(string[] args) | ||
53 | { | ||
54 | Console.WriteLine("Starting...\n"); | ||
55 | |||
56 | assetserver = new OpenAsset_Main(); | ||
57 | assetserver.Startup(); | ||
58 | |||
59 | assetserver.Work(); | ||
60 | } | ||
61 | |||
62 | private void Work() | ||
63 | { | ||
64 | m_console.Notice("Enter help for a list of commands"); | ||
65 | |||
66 | while (true) | ||
67 | { | ||
68 | m_console.MainLogPrompt(); | ||
69 | } | ||
70 | } | ||
71 | |||
72 | private OpenAsset_Main() | ||
73 | { | ||
74 | m_console = new LogBase("opengrid-AssetServer-console.log", "OpenAsset", this, false); | ||
75 | MainLog.Instance = m_console; | ||
76 | } | ||
77 | |||
78 | public void Startup() | ||
79 | { | ||
80 | m_console.Verbose("Main.cs:Startup() - Setting up asset DB"); | ||
81 | setupDB(); | ||
82 | |||
83 | m_console.Verbose("Main.cs:Startup() - Starting HTTP process"); | ||
84 | BaseHttpServer httpServer = new BaseHttpServer(8003); | ||
85 | |||
86 | httpServer.AddStreamHandler( new GetAssetStreamHandler(this)); | ||
87 | httpServer.AddStreamHandler(new PostAssetStreamHandler( this )); | ||
88 | |||
89 | //httpServer.AddRestHandler("GET", "/assets/", this.assetGetMethod); | ||
90 | //httpServer.AddRestHandler("POST", "/assets/", this.assetPostMethod); | ||
91 | |||
92 | httpServer.Start(); | ||
93 | |||
94 | } | ||
95 | |||
96 | //public string AssetPostMethod(string requestBody, string path, string param) | ||
97 | //{ | ||
98 | // AssetBase asset = new AssetBase(); | ||
99 | // asset.Name = ""; | ||
100 | // asset.FullID = new LLUUID(param); | ||
101 | // Encoding Windows1252Encoding = Encoding.GetEncoding(1252); | ||
102 | // byte[] buffer = Windows1252Encoding.GetBytes(requestBody); | ||
103 | // asset.Data = buffer; | ||
104 | // AssetStorage store = new AssetStorage(); | ||
105 | // store.Data = asset.Data; | ||
106 | // store.Name = asset.Name; | ||
107 | // store.UUID = asset.FullID; | ||
108 | // db.Set(store); | ||
109 | // db.Commit(); | ||
110 | // return ""; | ||
111 | //} | ||
112 | |||
113 | //public string AssetGetMethod(string request, string path, string param) | ||
114 | //{ | ||
115 | // Console.WriteLine("got a request " + param); | ||
116 | // byte[] assetdata = GetAssetData(new LLUUID(param), false); | ||
117 | // if (assetdata != null) | ||
118 | // { | ||
119 | // Encoding Windows1252Encoding = Encoding.GetEncoding(1252); | ||
120 | // string ret = Windows1252Encoding.GetString(assetdata); | ||
121 | // //string ret = System.Text.Encoding.Unicode.GetString(assetdata); | ||
122 | |||
123 | // return ret; | ||
124 | |||
125 | // } | ||
126 | // else | ||
127 | // { | ||
128 | // return ""; | ||
129 | // } | ||
130 | |||
131 | //} | ||
132 | |||
133 | public byte[] GetAssetData(LLUUID assetID, bool isTexture) | ||
134 | { | ||
135 | bool found = false; | ||
136 | AssetStorage foundAsset = null; | ||
137 | |||
138 | IObjectSet result = db.Get(new AssetStorage(assetID)); | ||
139 | if (result.Count > 0) | ||
140 | { | ||
141 | foundAsset = (AssetStorage)result.Next(); | ||
142 | found = true; | ||
143 | } | ||
144 | |||
145 | if (found) | ||
146 | { | ||
147 | return foundAsset.Data; | ||
148 | } | ||
149 | else | ||
150 | { | ||
151 | return null; | ||
152 | } | ||
153 | } | ||
154 | |||
155 | public void setupDB() | ||
156 | { | ||
157 | bool yapfile = File.Exists("assets.yap"); | ||
158 | try | ||
159 | { | ||
160 | db = Db4oFactory.OpenFile("assets.yap"); | ||
161 | MainLog.Instance.Verbose("Main.cs:setupDB() - creation"); | ||
162 | } | ||
163 | catch (Exception e) | ||
164 | { | ||
165 | db.Close(); | ||
166 | MainLog.Instance.Warn("Main.cs:setupDB() - Exception occured"); | ||
167 | MainLog.Instance.Warn(e.ToString()); | ||
168 | } | ||
169 | if (!yapfile) | ||
170 | { | ||
171 | this.LoadDB(); | ||
172 | } | ||
173 | } | ||
174 | |||
175 | public void LoadDB() | ||
176 | { | ||
177 | try | ||
178 | { | ||
179 | |||
180 | Console.WriteLine("setting up Asset database"); | ||
181 | |||
182 | AssetBase Image = new AssetBase(); | ||
183 | Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000001"); | ||
184 | Image.Name = "Bricks"; | ||
185 | this.LoadAsset(Image, true, "bricks.jp2"); | ||
186 | AssetStorage store = new AssetStorage(); | ||
187 | store.Data = Image.Data; | ||
188 | store.Name = Image.Name; | ||
189 | store.UUID = Image.FullID; | ||
190 | db.Set(store); | ||
191 | db.Commit(); | ||
192 | |||
193 | Image = new AssetBase(); | ||
194 | Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000002"); | ||
195 | Image.Name = "Plywood"; | ||
196 | this.LoadAsset(Image, true, "plywood.jp2"); | ||
197 | store = new AssetStorage(); | ||
198 | store.Data = Image.Data; | ||
199 | store.Name = Image.Name; | ||
200 | store.UUID = Image.FullID; | ||
201 | db.Set(store); | ||
202 | db.Commit(); | ||
203 | |||
204 | Image = new AssetBase(); | ||
205 | Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000003"); | ||
206 | Image.Name = "Rocks"; | ||
207 | this.LoadAsset(Image, true, "rocks.jp2"); | ||
208 | store = new AssetStorage(); | ||
209 | store.Data = Image.Data; | ||
210 | store.Name = Image.Name; | ||
211 | store.UUID = Image.FullID; | ||
212 | db.Set(store); | ||
213 | db.Commit(); | ||
214 | |||
215 | Image = new AssetBase(); | ||
216 | Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000004"); | ||
217 | Image.Name = "Granite"; | ||
218 | this.LoadAsset(Image, true, "granite.jp2"); | ||
219 | store = new AssetStorage(); | ||
220 | store.Data = Image.Data; | ||
221 | store.Name = Image.Name; | ||
222 | store.UUID = Image.FullID; | ||
223 | db.Set(store); | ||
224 | db.Commit(); | ||
225 | |||
226 | Image = new AssetBase(); | ||
227 | Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000005"); | ||
228 | Image.Name = "Hardwood"; | ||
229 | this.LoadAsset(Image, true, "hardwood.jp2"); | ||
230 | store = new AssetStorage(); | ||
231 | store.Data = Image.Data; | ||
232 | store.Name = Image.Name; | ||
233 | store.UUID = Image.FullID; | ||
234 | db.Set(store); | ||
235 | db.Commit(); | ||
236 | |||
237 | Image = new AssetBase(); | ||
238 | Image.FullID = new LLUUID("00000000-0000-0000-5005-000000000005"); | ||
239 | Image.Name = "Prim Base Texture"; | ||
240 | this.LoadAsset(Image, true, "plywood.jp2"); | ||
241 | store = new AssetStorage(); | ||
242 | store.Data = Image.Data; | ||
243 | store.Name = Image.Name; | ||
244 | store.UUID = Image.FullID; | ||
245 | db.Set(store); | ||
246 | db.Commit(); | ||
247 | |||
248 | Image = new AssetBase(); | ||
249 | Image.FullID = new LLUUID("66c41e39-38f9-f75a-024e-585989bfab73"); | ||
250 | Image.Name = "Shape"; | ||
251 | this.LoadAsset(Image, false, "base_shape.dat"); | ||
252 | store = new AssetStorage(); | ||
253 | store.Data = Image.Data; | ||
254 | store.Name = Image.Name; | ||
255 | store.UUID = Image.FullID; | ||
256 | db.Set(store); | ||
257 | db.Commit(); | ||
258 | } | ||
259 | catch (Exception e) | ||
260 | { | ||
261 | Console.WriteLine(e.Message); | ||
262 | } | ||
263 | } | ||
264 | |||
265 | private void LoadAsset(AssetBase info, bool image, string filename) | ||
266 | { | ||
267 | |||
268 | |||
269 | string dataPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "assets"); //+ folder; | ||
270 | string fileName = Path.Combine(dataPath, filename); | ||
271 | FileInfo fInfo = new FileInfo(fileName); | ||
272 | long numBytes = fInfo.Length; | ||
273 | FileStream fStream = new FileStream(fileName, FileMode.Open, FileAccess.Read); | ||
274 | byte[] idata = new byte[numBytes]; | ||
275 | BinaryReader br = new BinaryReader(fStream); | ||
276 | idata = br.ReadBytes((int)numBytes); | ||
277 | br.Close(); | ||
278 | fStream.Close(); | ||
279 | info.Data = idata; | ||
280 | //info.loaded=true; | ||
281 | } | ||
282 | |||
283 | /*private GridConfig LoadConfigDll(string dllName) | ||
284 | { | ||
285 | Assembly pluginAssembly = Assembly.LoadFrom(dllName); | ||
286 | GridConfig config = null; | ||
287 | |||
288 | foreach (Type pluginType in pluginAssembly.GetTypes()) | ||
289 | { | ||
290 | if (pluginType.IsPublic) | ||
291 | { | ||
292 | if (!pluginType.IsAbstract) | ||
293 | { | ||
294 | Type typeInterface = pluginType.GetInterface("IGridConfig", true); | ||
295 | |||
296 | if (typeInterface != null) | ||
297 | { | ||
298 | IGridConfig plug = (IGridConfig)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); | ||
299 | config = plug.GetConfigObject(); | ||
300 | break; | ||
301 | } | ||
302 | |||
303 | typeInterface = null; | ||
304 | } | ||
305 | } | ||
306 | } | ||
307 | pluginAssembly = null; | ||
308 | return config; | ||
309 | }*/ | ||
310 | |||
311 | public void CreateAsset(LLUUID assetId, byte[] assetData) | ||
312 | { | ||
313 | AssetBase asset = new AssetBase(); | ||
314 | asset.Name = ""; | ||
315 | asset.FullID = assetId; | ||
316 | asset.Data = assetData; | ||
317 | |||
318 | AssetStorage store = new AssetStorage(); | ||
319 | store.Data = asset.Data; | ||
320 | store.Name = asset.Name; | ||
321 | store.UUID = asset.FullID; | ||
322 | db.Set(store); | ||
323 | db.Commit(); | ||
324 | } | ||
325 | |||
326 | public void RunCmd(string cmd, string[] cmdparams) | ||
327 | { | ||
328 | switch (cmd) | ||
329 | { | ||
330 | case "help": | ||
331 | m_console.Notice("shutdown - shutdown this asset server (USE CAUTION!)"); | ||
332 | break; | ||
333 | |||
334 | case "shutdown": | ||
335 | m_console.Close(); | ||
336 | Environment.Exit(0); | ||
337 | break; | ||
338 | } | ||
339 | } | ||
340 | |||
341 | public void Show(string ShowWhat) | ||
342 | { | ||
343 | } | ||
344 | } | ||
345 | |||
346 | public class GetAssetStreamHandler : BaseStreamHandler | ||
347 | { | ||
348 | OpenAsset_Main m_assetManager; | ||
349 | |||
350 | override public byte[] Handle(string path, Stream request) | ||
351 | { | ||
352 | string param = GetParam(path); | ||
353 | |||
354 | byte[] assetdata = m_assetManager.GetAssetData(new LLUUID(param), false); | ||
355 | if (assetdata != null) | ||
356 | { | ||
357 | return assetdata; | ||
358 | } | ||
359 | else | ||
360 | { | ||
361 | return new byte[]{}; | ||
362 | } | ||
363 | } | ||
364 | |||
365 | public GetAssetStreamHandler(OpenAsset_Main assetManager):base( "/assets/", "GET") | ||
366 | { | ||
367 | m_assetManager = assetManager; | ||
368 | } | ||
369 | } | ||
370 | |||
371 | public class PostAssetStreamHandler : BaseStreamHandler | ||
372 | { | ||
373 | OpenAsset_Main m_assetManager; | ||
374 | |||
375 | override public byte[] Handle(string path, Stream request) | ||
376 | { | ||
377 | string param = GetParam(path); | ||
378 | LLUUID assetId = new LLUUID(param); | ||
379 | byte[] txBuffer = new byte[4096]; | ||
380 | |||
381 | using( BinaryReader binReader = new BinaryReader( request ) ) | ||
382 | { | ||
383 | using (MemoryStream memoryStream = new MemoryStream(4096)) | ||
384 | { | ||
385 | int count; | ||
386 | while ((count = binReader.Read(txBuffer, 0, 4096)) > 0) | ||
387 | { | ||
388 | memoryStream.Write(txBuffer, 0, count); | ||
389 | } | ||
390 | |||
391 | byte[] assetData = memoryStream.ToArray(); | ||
392 | |||
393 | m_assetManager.CreateAsset(assetId, assetData); | ||
394 | } | ||
395 | } | ||
396 | |||
397 | return new byte[]{}; | ||
398 | } | ||
399 | |||
400 | public PostAssetStreamHandler( OpenAsset_Main assetManager ) | ||
401 | : base("/assets/", "POST") | ||
402 | { | ||
403 | m_assetManager = assetManager; | ||
404 | } | ||
405 | } | ||
406 | } | ||
diff --git a/OpenSim/Grid/AssetServer/Properties/AssemblyInfo.cs b/OpenSim/Grid/AssetServer/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..dc39ce2 --- /dev/null +++ b/OpenSim/Grid/AssetServer/Properties/AssemblyInfo.cs | |||
@@ -0,0 +1,58 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.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 | using System.Reflection; | ||
29 | using System.Runtime.InteropServices; | ||
30 | // General Information about an assembly is controlled through the following | ||
31 | // set of attributes. Change these attribute values to modify the information | ||
32 | // associated with an assembly. | ||
33 | [assembly: AssemblyTitle("OGS-AssetServer")] | ||
34 | [assembly: AssemblyDescription("")] | ||
35 | [assembly: AssemblyConfiguration("")] | ||
36 | [assembly: AssemblyCompany("")] | ||
37 | [assembly: AssemblyProduct("OGS-AssetServer")] | ||
38 | [assembly: AssemblyCopyright("Copyright © 2007")] | ||
39 | [assembly: AssemblyTrademark("")] | ||
40 | [assembly: AssemblyCulture("")] | ||
41 | |||
42 | // Setting ComVisible to false makes the types in this assembly not visible | ||
43 | // to COM components. If you need to access a type in this assembly from | ||
44 | // COM, set the ComVisible attribute to true on that type. | ||
45 | [assembly: ComVisible(false)] | ||
46 | |||
47 | // The following GUID is for the ID of the typelib if this project is exposed to COM | ||
48 | [assembly: Guid("b541b244-3d1d-4625-9003-bc2a3a6a39a4")] | ||
49 | |||
50 | // Version information for an assembly consists of the following four values: | ||
51 | // | ||
52 | // Major Version | ||
53 | // Minor Version | ||
54 | // Build Number | ||
55 | // Revision | ||
56 | // | ||
57 | [assembly: AssemblyVersion("1.0.0.0")] | ||
58 | [assembly: AssemblyFileVersion("1.0.0.0")] | ||
diff --git a/OpenSim/Grid/Framework.Manager/GridManagementAgent.cs b/OpenSim/Grid/Framework.Manager/GridManagementAgent.cs new file mode 100644 index 0000000..6c916a2 --- /dev/null +++ b/OpenSim/Grid/Framework.Manager/GridManagementAgent.cs | |||
@@ -0,0 +1,138 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.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 | using System.Collections; | ||
29 | using libsecondlife; | ||
30 | using Nwc.XmlRpc; | ||
31 | using OpenSim.Framework.Servers; | ||
32 | |||
33 | namespace OpenSim.Framework.Manager | ||
34 | { | ||
35 | /// <summary> | ||
36 | /// Used to pass messages to the gridserver | ||
37 | /// </summary> | ||
38 | /// <param name="param">Pass this argument</param> | ||
39 | public delegate void GridManagerCallback(string param); | ||
40 | |||
41 | /// <summary> | ||
42 | /// Serverside listener for grid commands | ||
43 | /// </summary> | ||
44 | public class GridManagementAgent | ||
45 | { | ||
46 | /// <summary> | ||
47 | /// Passes grid server messages | ||
48 | /// </summary> | ||
49 | private GridManagerCallback thecallback; | ||
50 | |||
51 | /// <summary> | ||
52 | /// Security keys | ||
53 | /// </summary> | ||
54 | private string sendkey; | ||
55 | private string recvkey; | ||
56 | |||
57 | /// <summary> | ||
58 | /// Our component type | ||
59 | /// </summary> | ||
60 | private string component_type; | ||
61 | |||
62 | /// <summary> | ||
63 | /// List of active sessions | ||
64 | /// </summary> | ||
65 | private static ArrayList Sessions; | ||
66 | |||
67 | /// <summary> | ||
68 | /// Initialises a new GridManagementAgent | ||
69 | /// </summary> | ||
70 | /// <param name="app_httpd">HTTP Daemon for this server</param> | ||
71 | /// <param name="component_type">What component type are we?</param> | ||
72 | /// <param name="sendkey">Security send key</param> | ||
73 | /// <param name="recvkey">Security recieve key</param> | ||
74 | /// <param name="thecallback">Message callback</param> | ||
75 | public GridManagementAgent(BaseHttpServer app_httpd, string component_type, string sendkey, string recvkey, GridManagerCallback thecallback) | ||
76 | { | ||
77 | this.sendkey = sendkey; | ||
78 | this.recvkey = recvkey; | ||
79 | this.component_type = component_type; | ||
80 | this.thecallback = thecallback; | ||
81 | Sessions = new ArrayList(); | ||
82 | |||
83 | app_httpd.AddXmlRPCHandler("manager_login", XmlRpcLoginMethod); | ||
84 | |||
85 | switch (component_type) | ||
86 | { | ||
87 | case "gridserver": | ||
88 | GridServerManager.sendkey = this.sendkey; | ||
89 | GridServerManager.recvkey = this.recvkey; | ||
90 | GridServerManager.thecallback = thecallback; | ||
91 | app_httpd.AddXmlRPCHandler("shutdown", GridServerManager.XmlRpcShutdownMethod); | ||
92 | break; | ||
93 | } | ||
94 | } | ||
95 | |||
96 | /// <summary> | ||
97 | /// Checks if a session exists | ||
98 | /// </summary> | ||
99 | /// <param name="sessionID">The session ID</param> | ||
100 | /// <returns>Exists?</returns> | ||
101 | public static bool SessionExists(LLUUID sessionID) | ||
102 | { | ||
103 | return Sessions.Contains(sessionID); | ||
104 | } | ||
105 | |||
106 | /// <summary> | ||
107 | /// Logs a new session to the grid manager | ||
108 | /// </summary> | ||
109 | /// <param name="request">the XMLRPC request</param> | ||
110 | /// <returns>An XMLRPC reply</returns> | ||
111 | public static XmlRpcResponse XmlRpcLoginMethod(XmlRpcRequest request) | ||
112 | { | ||
113 | XmlRpcResponse response = new XmlRpcResponse(); | ||
114 | Hashtable requestData = (Hashtable)request.Params[0]; | ||
115 | Hashtable responseData = new Hashtable(); | ||
116 | |||
117 | // TODO: Switch this over to using OpenSim.Framework.Data | ||
118 | if (requestData["username"].Equals("admin") && requestData["password"].Equals("supersecret")) | ||
119 | { | ||
120 | response.IsFault = false; | ||
121 | LLUUID new_session = LLUUID.Random(); | ||
122 | Sessions.Add(new_session); | ||
123 | responseData["session_id"] = new_session.ToString(); | ||
124 | responseData["msg"] = "Login OK"; | ||
125 | } | ||
126 | else | ||
127 | { | ||
128 | response.IsFault = true; | ||
129 | responseData["error"] = "Invalid username or password"; | ||
130 | } | ||
131 | |||
132 | response.Value = responseData; | ||
133 | return response; | ||
134 | |||
135 | } | ||
136 | |||
137 | } | ||
138 | } | ||
diff --git a/OpenSim/Grid/Framework.Manager/GridServerManager.cs b/OpenSim/Grid/Framework.Manager/GridServerManager.cs new file mode 100644 index 0000000..67cd35d --- /dev/null +++ b/OpenSim/Grid/Framework.Manager/GridServerManager.cs | |||
@@ -0,0 +1,93 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.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 | |||
29 | using System; | ||
30 | using System.Collections; | ||
31 | using System.Threading; | ||
32 | using libsecondlife; | ||
33 | using Nwc.XmlRpc; | ||
34 | |||
35 | namespace OpenSim.Framework.Manager { | ||
36 | |||
37 | /// <summary> | ||
38 | /// A remote management system for the grid server | ||
39 | /// </summary> | ||
40 | public class GridServerManager | ||
41 | { | ||
42 | /// <summary> | ||
43 | /// Triggers events from the grid manager | ||
44 | /// </summary> | ||
45 | public static GridManagerCallback thecallback; | ||
46 | |||
47 | /// <summary> | ||
48 | /// Security keys | ||
49 | /// </summary> | ||
50 | public static string sendkey; | ||
51 | public static string recvkey; | ||
52 | |||
53 | /// <summary> | ||
54 | /// Disconnects the grid server and shuts it down | ||
55 | /// </summary> | ||
56 | /// <param name="request">XmlRpc Request</param> | ||
57 | /// <returns>An XmlRpc response containing either a "msg" or an "error"</returns> | ||
58 | public static XmlRpcResponse XmlRpcShutdownMethod(XmlRpcRequest request) | ||
59 | { | ||
60 | XmlRpcResponse response = new XmlRpcResponse(); | ||
61 | Hashtable requestData = (Hashtable)request.Params[0]; | ||
62 | Hashtable responseData = new Hashtable(); | ||
63 | |||
64 | if(requestData.ContainsKey("session_id")) { | ||
65 | if(GridManagementAgent.SessionExists(new LLUUID((string)requestData["session_id"]))) { | ||
66 | responseData["msg"]="Shutdown command accepted"; | ||
67 | (new Thread(new ThreadStart(ShutdownServer))).Start(); | ||
68 | } else { | ||
69 | response.IsFault=true; | ||
70 | responseData["error"]="bad session ID"; | ||
71 | } | ||
72 | } else { | ||
73 | response.IsFault=true; | ||
74 | responseData["error"]="no session ID"; | ||
75 | } | ||
76 | |||
77 | response.Value = responseData; | ||
78 | return response; | ||
79 | } | ||
80 | |||
81 | /// <summary> | ||
82 | /// Shuts down the grid server | ||
83 | /// </summary> | ||
84 | public static void ShutdownServer() | ||
85 | { | ||
86 | Console.WriteLine("Shutting down the grid server - recieved a grid manager request"); | ||
87 | Console.WriteLine("Terminating in three seconds..."); | ||
88 | Thread.Sleep(3000); | ||
89 | thecallback("shutdown"); | ||
90 | } | ||
91 | } | ||
92 | } | ||
93 | |||
diff --git a/OpenSim/Grid/GridServer.Config/AssemblyInfo.cs b/OpenSim/Grid/GridServer.Config/AssemblyInfo.cs new file mode 100644 index 0000000..39c9e8f --- /dev/null +++ b/OpenSim/Grid/GridServer.Config/AssemblyInfo.cs | |||
@@ -0,0 +1,56 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.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 | using System.Reflection; | ||
29 | using System.Runtime.InteropServices; | ||
30 | // Information about this assembly is defined by the following | ||
31 | // attributes. | ||
32 | // | ||
33 | // change them to the information which is associated with the assembly | ||
34 | // you compile. | ||
35 | |||
36 | [assembly: AssemblyTitle("GridConfig")] | ||
37 | [assembly: AssemblyDescription("")] | ||
38 | [assembly: AssemblyConfiguration("")] | ||
39 | [assembly: AssemblyCompany("")] | ||
40 | [assembly: AssemblyProduct("GridConfig")] | ||
41 | [assembly: AssemblyCopyright("")] | ||
42 | [assembly: AssemblyTrademark("")] | ||
43 | [assembly: AssemblyCulture("")] | ||
44 | |||
45 | // This sets the default COM visibility of types in the assembly to invisible. | ||
46 | // If you need to expose a type to COM, use [ComVisible(true)] on that type. | ||
47 | [assembly: ComVisible(false)] | ||
48 | |||
49 | // The assembly version has following format : | ||
50 | // | ||
51 | // Major.Minor.Build.Revision | ||
52 | // | ||
53 | // You can specify all values by your own or you can build default build and revision | ||
54 | // numbers with the '*' character (the default): | ||
55 | |||
56 | [assembly: AssemblyVersion("1.0.*")] | ||
diff --git a/OpenSim/Grid/GridServer.Config/DbGridConfig.cs b/OpenSim/Grid/GridServer.Config/DbGridConfig.cs new file mode 100644 index 0000000..4acf81d --- /dev/null +++ b/OpenSim/Grid/GridServer.Config/DbGridConfig.cs | |||
@@ -0,0 +1,160 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.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 | using System; | ||
29 | using Db4objects.Db4o; | ||
30 | using OpenSim.Framework.Console; | ||
31 | using OpenSim.Framework.Interfaces; | ||
32 | |||
33 | namespace OpenGrid.Config.GridConfigDb4o | ||
34 | { | ||
35 | /// <summary> | ||
36 | /// A grid configuration interface for returning the DB4o Config Provider | ||
37 | /// </summary> | ||
38 | public class Db40ConfigPlugin: IGridConfig | ||
39 | { | ||
40 | /// <summary> | ||
41 | /// Loads and returns a configuration objeect | ||
42 | /// </summary> | ||
43 | /// <returns>A grid configuration object</returns> | ||
44 | public GridConfig GetConfigObject() | ||
45 | { | ||
46 | MainLog.Instance.Verbose("Loading Db40Config dll"); | ||
47 | return ( new DbGridConfig()); | ||
48 | } | ||
49 | } | ||
50 | |||
51 | /// <summary> | ||
52 | /// A DB4o based Gridserver configuration object | ||
53 | /// </summary> | ||
54 | public class DbGridConfig : GridConfig | ||
55 | { | ||
56 | /// <summary> | ||
57 | /// The DB4o Database | ||
58 | /// </summary> | ||
59 | private IObjectContainer db; | ||
60 | |||
61 | /// <summary> | ||
62 | /// User configuration for the Grid Config interfaces | ||
63 | /// </summary> | ||
64 | public void LoadDefaults() { | ||
65 | MainLog.Instance.Notice("Config.cs:LoadDefaults() - Please press enter to retain default or enter new settings"); | ||
66 | |||
67 | // About the grid options | ||
68 | this.GridOwner = MainLog.Instance.CmdPrompt("Grid owner", "OGS development team"); | ||
69 | |||
70 | // Asset Options | ||
71 | this.DefaultAssetServer = MainLog.Instance.CmdPrompt("Default asset server","http://127.0.0.1:8003/"); | ||
72 | this.AssetSendKey = MainLog.Instance.CmdPrompt("Key to send to asset server","null"); | ||
73 | this.AssetRecvKey = MainLog.Instance.CmdPrompt("Key to expect from asset server","null"); | ||
74 | |||
75 | // User Server Options | ||
76 | this.DefaultUserServer = MainLog.Instance.CmdPrompt("Default user server","http://127.0.0.1:8002/"); | ||
77 | this.UserSendKey = MainLog.Instance.CmdPrompt("Key to send to user server","null"); | ||
78 | this.UserRecvKey = MainLog.Instance.CmdPrompt("Key to expect from user server","null"); | ||
79 | |||
80 | // Region Server Options | ||
81 | this.SimSendKey = MainLog.Instance.CmdPrompt("Key to send to sims","null"); | ||
82 | this.SimRecvKey = MainLog.Instance.CmdPrompt("Key to expect from sims","null"); | ||
83 | } | ||
84 | |||
85 | /// <summary> | ||
86 | /// Initialises a new configuration object | ||
87 | /// </summary> | ||
88 | public override void InitConfig() { | ||
89 | try { | ||
90 | // Perform Db4o initialisation | ||
91 | db = Db4oFactory.OpenFile("opengrid.yap"); | ||
92 | |||
93 | // Locate the grid configuration object | ||
94 | IObjectSet result = db.Get(typeof(DbGridConfig)); | ||
95 | // Found? | ||
96 | if(result.Count==1) { | ||
97 | MainLog.Instance.Verbose("Config.cs:InitConfig() - Found a GridConfig object in the local database, loading"); | ||
98 | foreach (DbGridConfig cfg in result) { | ||
99 | // Import each setting into this class | ||
100 | // Grid Settings | ||
101 | this.GridOwner=cfg.GridOwner; | ||
102 | // Asset Settings | ||
103 | this.DefaultAssetServer=cfg.DefaultAssetServer; | ||
104 | this.AssetSendKey=cfg.AssetSendKey; | ||
105 | this.AssetRecvKey=cfg.AssetRecvKey; | ||
106 | // User Settings | ||
107 | this.DefaultUserServer=cfg.DefaultUserServer; | ||
108 | this.UserSendKey=cfg.UserSendKey; | ||
109 | this.UserRecvKey=cfg.UserRecvKey; | ||
110 | // Region Settings | ||
111 | this.SimSendKey=cfg.SimSendKey; | ||
112 | this.SimRecvKey=cfg.SimRecvKey; | ||
113 | } | ||
114 | // Create a new configuration object from this class | ||
115 | } else { | ||
116 | MainLog.Instance.Verbose("Config.cs:InitConfig() - Could not find object in database, loading precompiled defaults"); | ||
117 | |||
118 | // Load default settings into this class | ||
119 | LoadDefaults(); | ||
120 | |||
121 | // Saves to the database file... | ||
122 | MainLog.Instance.Verbose( "Writing out default settings to local database"); | ||
123 | db.Set(this); | ||
124 | |||
125 | // Closes file locks | ||
126 | db.Close(); | ||
127 | } | ||
128 | } catch(Exception e) { | ||
129 | MainLog.Instance.Warn("Config.cs:InitConfig() - Exception occured"); | ||
130 | MainLog.Instance.Warn(e.ToString()); | ||
131 | } | ||
132 | |||
133 | // Grid Settings | ||
134 | MainLog.Instance.Verbose("Grid settings loaded:"); | ||
135 | MainLog.Instance.Verbose("Grid owner: " + this.GridOwner); | ||
136 | |||
137 | // Asset Settings | ||
138 | MainLog.Instance.Verbose("Default asset server: " + this.DefaultAssetServer); | ||
139 | MainLog.Instance.Verbose("Key to send to asset server: " + this.AssetSendKey); | ||
140 | MainLog.Instance.Verbose("Key to expect from asset server: " + this.AssetRecvKey); | ||
141 | |||
142 | // User Settings | ||
143 | MainLog.Instance.Verbose("Default user server: " + this.DefaultUserServer); | ||
144 | MainLog.Instance.Verbose("Key to send to user server: " + this.UserSendKey); | ||
145 | MainLog.Instance.Verbose("Key to expect from user server: " + this.UserRecvKey); | ||
146 | |||
147 | // Region Settings | ||
148 | MainLog.Instance.Verbose("Key to send to sims: " + this.SimSendKey); | ||
149 | MainLog.Instance.Verbose("Key to expect from sims: " + this.SimRecvKey); | ||
150 | } | ||
151 | |||
152 | /// <summary> | ||
153 | /// Closes down the database and releases filesystem locks | ||
154 | /// </summary> | ||
155 | public void Shutdown() { | ||
156 | db.Close(); | ||
157 | } | ||
158 | } | ||
159 | |||
160 | } | ||
diff --git a/OpenSim/Grid/GridServer/GridManager.cs b/OpenSim/Grid/GridServer/GridManager.cs new file mode 100644 index 0000000..1f97f53 --- /dev/null +++ b/OpenSim/Grid/GridServer/GridManager.cs | |||
@@ -0,0 +1,703 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.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 | using System; | ||
29 | using System.Collections; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Reflection; | ||
32 | using System.Xml; | ||
33 | using libsecondlife; | ||
34 | using Nwc.XmlRpc; | ||
35 | using OpenSim.Framework.Console; | ||
36 | using OpenSim.Framework.Data; | ||
37 | using OpenSim.Framework.Interfaces; | ||
38 | using OpenSim.Framework.Utilities; | ||
39 | |||
40 | namespace OpenSim.Grid.GridServer | ||
41 | { | ||
42 | class GridManager | ||
43 | { | ||
44 | Dictionary<string, IGridData> _plugins = new Dictionary<string, IGridData>(); | ||
45 | Dictionary<string, ILogData> _logplugins = new Dictionary<string, ILogData>(); | ||
46 | |||
47 | public GridConfig config; | ||
48 | |||
49 | /// <summary> | ||
50 | /// Adds a new grid server plugin - grid servers will be requested in the order they were loaded. | ||
51 | /// </summary> | ||
52 | /// <param name="FileName">The filename to the grid server plugin DLL</param> | ||
53 | public void AddPlugin(string FileName) | ||
54 | { | ||
55 | MainLog.Instance.Verbose("Storage: Attempting to load " + FileName); | ||
56 | Assembly pluginAssembly = Assembly.LoadFrom(FileName); | ||
57 | |||
58 | MainLog.Instance.Verbose("Storage: Found " + pluginAssembly.GetTypes().Length + " interfaces."); | ||
59 | foreach (Type pluginType in pluginAssembly.GetTypes()) | ||
60 | { | ||
61 | if (!pluginType.IsAbstract) | ||
62 | { | ||
63 | // Regions go here | ||
64 | Type typeInterface = pluginType.GetInterface("IGridData", true); | ||
65 | |||
66 | if (typeInterface != null) | ||
67 | { | ||
68 | IGridData plug = (IGridData)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); | ||
69 | plug.Initialise(); | ||
70 | this._plugins.Add(plug.getName(), plug); | ||
71 | MainLog.Instance.Verbose("Storage: Added IGridData Interface"); | ||
72 | } | ||
73 | |||
74 | typeInterface = null; | ||
75 | |||
76 | // Logs go here | ||
77 | typeInterface = pluginType.GetInterface("ILogData", true); | ||
78 | |||
79 | if (typeInterface != null) | ||
80 | { | ||
81 | ILogData plug = (ILogData)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); | ||
82 | plug.Initialise(); | ||
83 | this._logplugins.Add(plug.getName(), plug); | ||
84 | MainLog.Instance.Verbose( "Storage: Added ILogData Interface"); | ||
85 | } | ||
86 | |||
87 | typeInterface = null; | ||
88 | } | ||
89 | } | ||
90 | |||
91 | pluginAssembly = null; | ||
92 | } | ||
93 | |||
94 | /// <summary> | ||
95 | /// Logs a piece of information to the database | ||
96 | /// </summary> | ||
97 | /// <param name="target">What you were operating on (in grid server, this will likely be the region UUIDs)</param> | ||
98 | /// <param name="method">Which method is being called?</param> | ||
99 | /// <param name="args">What arguments are being passed?</param> | ||
100 | /// <param name="priority">How high priority is this? 1 = Max, 6 = Verbose</param> | ||
101 | /// <param name="message">The message to log</param> | ||
102 | private void logToDB(string target, string method, string args, int priority, string message) | ||
103 | { | ||
104 | foreach (KeyValuePair<string, ILogData> kvp in _logplugins) | ||
105 | { | ||
106 | try | ||
107 | { | ||
108 | kvp.Value.saveLog("Gridserver", target, method, args, priority, message); | ||
109 | } | ||
110 | catch (Exception) | ||
111 | { | ||
112 | MainLog.Instance.Warn("Storage: unable to write log via " + kvp.Key); | ||
113 | } | ||
114 | } | ||
115 | } | ||
116 | |||
117 | /// <summary> | ||
118 | /// Returns a region by argument | ||
119 | /// </summary> | ||
120 | /// <param name="uuid">A UUID key of the region to return</param> | ||
121 | /// <returns>A SimProfileData for the region</returns> | ||
122 | public SimProfileData getRegion(LLUUID uuid) | ||
123 | { | ||
124 | foreach(KeyValuePair<string,IGridData> kvp in _plugins) { | ||
125 | try | ||
126 | { | ||
127 | return kvp.Value.GetProfileByLLUUID(uuid); | ||
128 | } | ||
129 | catch (Exception e) | ||
130 | { | ||
131 | MainLog.Instance.Warn("Message from Storage: " + e.Message); | ||
132 | } | ||
133 | } | ||
134 | return null; | ||
135 | } | ||
136 | |||
137 | /// <summary> | ||
138 | /// Returns a region by argument | ||
139 | /// </summary> | ||
140 | /// <param name="uuid">A regionHandle of the region to return</param> | ||
141 | /// <returns>A SimProfileData for the region</returns> | ||
142 | public SimProfileData getRegion(ulong handle) | ||
143 | { | ||
144 | foreach (KeyValuePair<string, IGridData> kvp in _plugins) | ||
145 | { | ||
146 | try | ||
147 | { | ||
148 | return kvp.Value.GetProfileByHandle(handle); | ||
149 | } | ||
150 | catch | ||
151 | { | ||
152 | MainLog.Instance.Warn("Storage: Unable to find region " + handle.ToString() + " via " + kvp.Key); | ||
153 | } | ||
154 | } | ||
155 | return null; | ||
156 | } | ||
157 | |||
158 | public Dictionary<ulong, SimProfileData> getRegions(uint xmin, uint ymin, uint xmax, uint ymax) | ||
159 | { | ||
160 | Dictionary<ulong, SimProfileData> regions = new Dictionary<ulong, SimProfileData>(); | ||
161 | |||
162 | SimProfileData[] neighbours; | ||
163 | |||
164 | foreach (KeyValuePair<string, IGridData> kvp in _plugins) | ||
165 | { | ||
166 | try | ||
167 | { | ||
168 | neighbours = kvp.Value.GetProfilesInRange(xmin, ymin, xmax, ymax); | ||
169 | foreach (SimProfileData neighbour in neighbours) | ||
170 | { | ||
171 | regions[neighbour.regionHandle] = neighbour; | ||
172 | } | ||
173 | } | ||
174 | catch | ||
175 | { | ||
176 | MainLog.Instance.Warn("Storage: Unable to query regionblock via " + kvp.Key); | ||
177 | } | ||
178 | } | ||
179 | |||
180 | return regions; | ||
181 | } | ||
182 | |||
183 | |||
184 | |||
185 | /// <summary> | ||
186 | /// Returns a XML String containing a list of the neighbouring regions | ||
187 | /// </summary> | ||
188 | /// <param name="reqhandle">The regionhandle for the center sim</param> | ||
189 | /// <returns>An XML string containing neighbour entities</returns> | ||
190 | public string GetXMLNeighbours(ulong reqhandle) | ||
191 | { | ||
192 | string response = ""; | ||
193 | SimProfileData central_region = getRegion(reqhandle); | ||
194 | SimProfileData neighbour; | ||
195 | for (int x = -1; x < 2; x++) for (int y = -1; y < 2; y++) | ||
196 | { | ||
197 | if (getRegion(Util.UIntsToLong((uint)((central_region.regionLocX + x) * 256), (uint)(central_region.regionLocY + y) * 256)) != null) | ||
198 | { | ||
199 | neighbour = getRegion(Util.UIntsToLong((uint)((central_region.regionLocX + x) * 256), (uint)(central_region.regionLocY + y) * 256)); | ||
200 | response += "<neighbour>"; | ||
201 | response += "<sim_ip>" + neighbour.serverIP + "</sim_ip>"; | ||
202 | response += "<sim_port>" + neighbour.serverPort.ToString() + "</sim_port>"; | ||
203 | response += "<locx>" + neighbour.regionLocX.ToString() + "</locx>"; | ||
204 | response += "<locy>" + neighbour.regionLocY.ToString() + "</locy>"; | ||
205 | response += "<regionhandle>" + neighbour.regionHandle.ToString() + "</regionhandle>"; | ||
206 | response += "</neighbour>"; | ||
207 | |||
208 | } | ||
209 | } | ||
210 | return response; | ||
211 | } | ||
212 | |||
213 | /// <summary> | ||
214 | /// Performed when a region connects to the grid server initially. | ||
215 | /// </summary> | ||
216 | /// <param name="request">The XMLRPC Request</param> | ||
217 | /// <returns>Startup parameters</returns> | ||
218 | public XmlRpcResponse XmlRpcSimulatorLoginMethod(XmlRpcRequest request) | ||
219 | { | ||
220 | |||
221 | XmlRpcResponse response = new XmlRpcResponse(); | ||
222 | Hashtable responseData = new Hashtable(); | ||
223 | response.Value = responseData; | ||
224 | |||
225 | SimProfileData TheSim = null; | ||
226 | Hashtable requestData = (Hashtable)request.Params[0]; | ||
227 | |||
228 | if (requestData.ContainsKey("UUID")) | ||
229 | { | ||
230 | TheSim = getRegion(new LLUUID((string)requestData["UUID"])); | ||
231 | |||
232 | logToDB((new LLUUID((string)requestData["UUID"])).ToStringHyphenated(),"XmlRpcSimulatorLoginMethod","", 5,"Region attempting login with UUID."); | ||
233 | } | ||
234 | else if (requestData.ContainsKey("region_handle")) | ||
235 | { | ||
236 | |||
237 | TheSim = getRegion((ulong)Convert.ToUInt64(requestData["region_handle"])); | ||
238 | logToDB((string)requestData["region_handle"], "XmlRpcSimulatorLoginMethod", "", 5, "Region attempting login with regionHandle."); | ||
239 | } | ||
240 | else | ||
241 | { | ||
242 | responseData["error"] = "No UUID or region_handle passed to grid server - unable to connect you"; | ||
243 | return response; | ||
244 | } | ||
245 | |||
246 | if (TheSim == null) // Shouldnt this be in the REST Simulator Set method? | ||
247 | { | ||
248 | //NEW REGION | ||
249 | TheSim = new SimProfileData(); | ||
250 | |||
251 | TheSim.regionRecvKey = config.SimRecvKey; | ||
252 | TheSim.regionSendKey = config.SimSendKey; | ||
253 | TheSim.regionSecret = config.SimRecvKey; | ||
254 | TheSim.regionDataURI = ""; | ||
255 | TheSim.regionAssetURI = config.DefaultAssetServer; | ||
256 | TheSim.regionAssetRecvKey = config.AssetRecvKey; | ||
257 | TheSim.regionAssetSendKey = config.AssetSendKey; | ||
258 | TheSim.regionUserURI = config.DefaultUserServer; | ||
259 | TheSim.regionUserSendKey = config.UserSendKey; | ||
260 | TheSim.regionUserRecvKey = config.UserRecvKey; | ||
261 | |||
262 | TheSim.serverIP = (string)requestData["sim_ip"]; | ||
263 | TheSim.serverPort = Convert.ToUInt32((string)requestData["sim_port"]); | ||
264 | TheSim.httpPort = Convert.ToUInt32((string)requestData["http_port"]); | ||
265 | TheSim.remotingPort = Convert.ToUInt32((string)requestData["remoting_port"]); | ||
266 | TheSim.regionLocX = Convert.ToUInt32((string)requestData["region_locx"]); | ||
267 | TheSim.regionLocY = Convert.ToUInt32((string)requestData["region_locy"]); | ||
268 | TheSim.regionLocZ = 0; | ||
269 | TheSim.regionMapTextureID = new LLUUID((string)requestData["map-image-id"]); | ||
270 | |||
271 | TheSim.regionHandle = Helpers.UIntsToLong((TheSim.regionLocX * 256), (TheSim.regionLocY * 256)); | ||
272 | System.Console.WriteLine("adding region " + TheSim.regionLocX + " , " + TheSim.regionLocY + " , " + TheSim.regionHandle); | ||
273 | TheSim.serverURI = "http://" + TheSim.serverIP + ":" + TheSim.serverPort + "/"; | ||
274 | TheSim.httpServerURI = "http://" + TheSim.serverIP + ":" + TheSim.httpPort + "/"; | ||
275 | |||
276 | Console.WriteLine("NEW SIM: " + TheSim.serverURI); | ||
277 | TheSim.regionName = (string)requestData["sim_name"]; | ||
278 | TheSim.UUID = new LLUUID((string)requestData["UUID"]); | ||
279 | |||
280 | foreach (KeyValuePair<string, IGridData> kvp in _plugins) | ||
281 | { | ||
282 | try | ||
283 | { | ||
284 | DataResponse insertResponse = kvp.Value.AddProfile(TheSim); | ||
285 | switch(insertResponse) | ||
286 | { | ||
287 | case DataResponse.RESPONSE_OK: | ||
288 | OpenSim.Framework.Console.MainLog.Instance.Verbose("New sim creation successful: " + TheSim.regionName); | ||
289 | break; | ||
290 | case DataResponse.RESPONSE_ERROR: | ||
291 | OpenSim.Framework.Console.MainLog.Instance.Warn("New sim creation failed (Error): " + TheSim.regionName); | ||
292 | break; | ||
293 | case DataResponse.RESPONSE_INVALIDCREDENTIALS: | ||
294 | OpenSim.Framework.Console.MainLog.Instance.Warn("New sim creation failed (Invalid Credentials): " + TheSim.regionName); | ||
295 | break; | ||
296 | case DataResponse.RESPONSE_AUTHREQUIRED: | ||
297 | OpenSim.Framework.Console.MainLog.Instance.Warn("New sim creation failed (Authentication Required): " + TheSim.regionName); | ||
298 | break; | ||
299 | } | ||
300 | |||
301 | } | ||
302 | catch (Exception e) | ||
303 | { | ||
304 | OpenSim.Framework.Console.MainLog.Instance.Warn("Storage: Unable to add region " + TheSim.UUID.ToStringHyphenated() + " via " + kvp.Key); | ||
305 | } | ||
306 | } | ||
307 | |||
308 | |||
309 | if (getRegion(TheSim.regionHandle) == null) | ||
310 | { | ||
311 | responseData["error"] = "Unable to add new region"; | ||
312 | return response; | ||
313 | } | ||
314 | } | ||
315 | |||
316 | |||
317 | ArrayList SimNeighboursData = new ArrayList(); | ||
318 | |||
319 | SimProfileData neighbour; | ||
320 | Hashtable NeighbourBlock; | ||
321 | |||
322 | bool fastMode = false; // Only compatible with MySQL right now | ||
323 | |||
324 | if (fastMode) | ||
325 | { | ||
326 | Dictionary<ulong, SimProfileData> neighbours = getRegions(TheSim.regionLocX - 1, TheSim.regionLocY - 1, TheSim.regionLocX + 1, TheSim.regionLocY + 1); | ||
327 | |||
328 | foreach (KeyValuePair<ulong, SimProfileData> aSim in neighbours) | ||
329 | { | ||
330 | NeighbourBlock = new Hashtable(); | ||
331 | NeighbourBlock["sim_ip"] = aSim.Value.serverIP.ToString(); | ||
332 | NeighbourBlock["sim_port"] = aSim.Value.serverPort.ToString(); | ||
333 | NeighbourBlock["region_locx"] = aSim.Value.regionLocX.ToString(); | ||
334 | NeighbourBlock["region_locy"] = aSim.Value.regionLocY.ToString(); | ||
335 | NeighbourBlock["UUID"] = aSim.Value.UUID.ToString(); | ||
336 | |||
337 | if (aSim.Value.UUID != TheSim.UUID) | ||
338 | SimNeighboursData.Add(NeighbourBlock); | ||
339 | } | ||
340 | } | ||
341 | else | ||
342 | { | ||
343 | for (int x = -1; x < 2; x++) for (int y = -1; y < 2; y++) | ||
344 | { | ||
345 | if (getRegion(Helpers.UIntsToLong((uint)((TheSim.regionLocX + x) * 256), (uint)(TheSim.regionLocY + y) * 256)) != null) | ||
346 | { | ||
347 | neighbour = getRegion(Helpers.UIntsToLong((uint)((TheSim.regionLocX + x) * 256), (uint)(TheSim.regionLocY + y) * 256)); | ||
348 | |||
349 | NeighbourBlock = new Hashtable(); | ||
350 | NeighbourBlock["sim_ip"] = neighbour.serverIP; | ||
351 | NeighbourBlock["sim_port"] = neighbour.serverPort.ToString(); | ||
352 | NeighbourBlock["region_locx"] = neighbour.regionLocX.ToString(); | ||
353 | NeighbourBlock["region_locy"] = neighbour.regionLocY.ToString(); | ||
354 | NeighbourBlock["UUID"] = neighbour.UUID.ToString(); | ||
355 | |||
356 | if (neighbour.UUID != TheSim.UUID) SimNeighboursData.Add(NeighbourBlock); | ||
357 | } | ||
358 | } | ||
359 | } | ||
360 | |||
361 | responseData["UUID"] = TheSim.UUID.ToString(); | ||
362 | responseData["region_locx"] = TheSim.regionLocX.ToString(); | ||
363 | responseData["region_locy"] = TheSim.regionLocY.ToString(); | ||
364 | responseData["regionname"] = TheSim.regionName; | ||
365 | responseData["estate_id"] = "1"; | ||
366 | responseData["neighbours"] = SimNeighboursData; | ||
367 | |||
368 | responseData["sim_ip"] = TheSim.serverIP; | ||
369 | responseData["sim_port"] = TheSim.serverPort.ToString(); | ||
370 | responseData["asset_url"] = TheSim.regionAssetURI; | ||
371 | responseData["asset_sendkey"] = TheSim.regionAssetSendKey; | ||
372 | responseData["asset_recvkey"] = TheSim.regionAssetRecvKey; | ||
373 | responseData["user_url"] = TheSim.regionUserURI; | ||
374 | responseData["user_sendkey"] = TheSim.regionUserSendKey; | ||
375 | responseData["user_recvkey"] = TheSim.regionUserRecvKey; | ||
376 | responseData["authkey"] = TheSim.regionSecret; | ||
377 | |||
378 | // New! If set, use as URL to local sim storage (ie http://remotehost/region.yap) | ||
379 | responseData["data_uri"] = TheSim.regionDataURI; | ||
380 | |||
381 | |||
382 | return response; | ||
383 | } | ||
384 | |||
385 | public XmlRpcResponse XmlRpcSimulatorDataRequestMethod(XmlRpcRequest request) | ||
386 | { | ||
387 | Hashtable requestData = (Hashtable)request.Params[0]; | ||
388 | Hashtable responseData = new Hashtable(); | ||
389 | SimProfileData simData = null; | ||
390 | if (requestData.ContainsKey("region_UUID")) | ||
391 | { | ||
392 | simData = getRegion(new LLUUID((string)requestData["region_UUID"])); | ||
393 | } | ||
394 | else if (requestData.ContainsKey("region_handle")) | ||
395 | { | ||
396 | Console.WriteLine("requesting data for region " + (string)requestData["region_handle"]); | ||
397 | simData = getRegion(Convert.ToUInt64((string)requestData["region_handle"])); | ||
398 | } | ||
399 | |||
400 | if (simData == null) | ||
401 | { | ||
402 | //Sim does not exist | ||
403 | Console.WriteLine("region not found"); | ||
404 | responseData["error"] = "Sim does not exist"; | ||
405 | } | ||
406 | else | ||
407 | { | ||
408 | Console.WriteLine("found region"); | ||
409 | responseData["sim_ip"] = simData.serverIP; | ||
410 | responseData["sim_port"] = simData.serverPort.ToString(); | ||
411 | responseData["http_port"] = simData.httpPort.ToString(); | ||
412 | responseData["remoting_port"] = simData.remotingPort.ToString(); | ||
413 | responseData["region_locx"] = simData.regionLocX.ToString() ; | ||
414 | responseData["region_locy"] = simData.regionLocY.ToString(); | ||
415 | responseData["region_UUID"] = simData.UUID.UUID.ToString(); | ||
416 | responseData["region_name"] = simData.regionName; | ||
417 | } | ||
418 | |||
419 | XmlRpcResponse response = new XmlRpcResponse(); | ||
420 | response.Value = responseData; | ||
421 | return response; | ||
422 | } | ||
423 | |||
424 | public XmlRpcResponse XmlRpcMapBlockMethod(XmlRpcRequest request) | ||
425 | { | ||
426 | int xmin=980, ymin=980, xmax=1020, ymax=1020; | ||
427 | |||
428 | Hashtable requestData = (Hashtable)request.Params[0]; | ||
429 | if (requestData.ContainsKey("xmin")) | ||
430 | { | ||
431 | xmin = (Int32)requestData["xmin"]; | ||
432 | } | ||
433 | if (requestData.ContainsKey("ymin")) | ||
434 | { | ||
435 | ymin = (Int32)requestData["ymin"]; | ||
436 | } | ||
437 | if (requestData.ContainsKey("xmax")) | ||
438 | { | ||
439 | xmax = (Int32)requestData["xmax"]; | ||
440 | } | ||
441 | if (requestData.ContainsKey("ymax")) | ||
442 | { | ||
443 | ymax = (Int32)requestData["ymax"]; | ||
444 | } | ||
445 | |||
446 | XmlRpcResponse response = new XmlRpcResponse(); | ||
447 | Hashtable responseData = new Hashtable(); | ||
448 | response.Value = responseData; | ||
449 | IList simProfileList = new ArrayList(); | ||
450 | |||
451 | bool fastMode = false; // MySQL Only | ||
452 | |||
453 | if (fastMode) | ||
454 | { | ||
455 | Dictionary<ulong, SimProfileData> neighbours = getRegions((uint)xmin, (uint)ymin, (uint)xmax, (uint)ymax); | ||
456 | |||
457 | foreach (KeyValuePair<ulong, SimProfileData> aSim in neighbours) | ||
458 | { | ||
459 | Hashtable simProfileBlock = new Hashtable(); | ||
460 | simProfileBlock["x"] = aSim.Value.regionLocX.ToString(); | ||
461 | simProfileBlock["y"] = aSim.Value.regionLocY.ToString(); | ||
462 | System.Console.WriteLine("send neighbour info for " + aSim.Value.regionLocX.ToString() + " , " + aSim.Value.regionLocY.ToString()); | ||
463 | simProfileBlock["name"] = aSim.Value.regionName; | ||
464 | simProfileBlock["access"] = 21; | ||
465 | simProfileBlock["region-flags"] = 512; | ||
466 | simProfileBlock["water-height"] = 0; | ||
467 | simProfileBlock["agents"] = 1; | ||
468 | simProfileBlock["map-image-id"] = aSim.Value.regionMapTextureID.ToString(); | ||
469 | |||
470 | // For Sugilite compatibility | ||
471 | simProfileBlock["regionhandle"] = aSim.Value.regionHandle.ToString(); | ||
472 | simProfileBlock["sim_ip"] = aSim.Value.serverIP.ToString(); | ||
473 | simProfileBlock["sim_port"] = aSim.Value.serverPort.ToString(); | ||
474 | simProfileBlock["sim_uri"] = aSim.Value.serverURI.ToString(); | ||
475 | simProfileBlock["uuid"] = aSim.Value.UUID.ToStringHyphenated(); | ||
476 | |||
477 | simProfileList.Add(simProfileBlock); | ||
478 | } | ||
479 | MainLog.Instance.Verbose("World map request processed, returned " + simProfileList.Count.ToString() + " region(s) in range via FastMode"); | ||
480 | } | ||
481 | else | ||
482 | { | ||
483 | SimProfileData simProfile; | ||
484 | for (int x = xmin; x < xmax+1; x++) | ||
485 | { | ||
486 | for (int y = ymin; y < ymax+1; y++) | ||
487 | { | ||
488 | ulong regHandle = Helpers.UIntsToLong((uint)(x * 256), (uint)(y * 256)); | ||
489 | simProfile = getRegion(regHandle); | ||
490 | if (simProfile != null) | ||
491 | { | ||
492 | Hashtable simProfileBlock = new Hashtable(); | ||
493 | simProfileBlock["x"] = x; | ||
494 | simProfileBlock["y"] = y; | ||
495 | simProfileBlock["name"] = simProfile.regionName; | ||
496 | simProfileBlock["access"] = 0; | ||
497 | simProfileBlock["region-flags"] = 0; | ||
498 | simProfileBlock["water-height"] = 20; | ||
499 | simProfileBlock["agents"] = 1; | ||
500 | simProfileBlock["map-image-id"] = simProfile.regionMapTextureID.ToStringHyphenated(); | ||
501 | |||
502 | // For Sugilite compatibility | ||
503 | simProfileBlock["regionhandle"] = simProfile.regionHandle.ToString(); | ||
504 | simProfileBlock["sim_ip"] = simProfile.serverIP.ToString(); | ||
505 | simProfileBlock["sim_port"] = simProfile.serverPort.ToString(); | ||
506 | simProfileBlock["sim_uri"] = simProfile.serverURI.ToString(); | ||
507 | simProfileBlock["uuid"] = simProfile.UUID.ToStringHyphenated(); | ||
508 | |||
509 | simProfileList.Add(simProfileBlock); | ||
510 | } | ||
511 | } | ||
512 | } | ||
513 | MainLog.Instance.Verbose("World map request processed, returned " + simProfileList.Count.ToString() + " region(s) in range via Standard Mode"); | ||
514 | } | ||
515 | |||
516 | responseData["sim-profiles"] = simProfileList; | ||
517 | |||
518 | return response; | ||
519 | } | ||
520 | |||
521 | |||
522 | |||
523 | /// <summary> | ||
524 | /// Performs a REST Get Operation | ||
525 | /// </summary> | ||
526 | /// <param name="request"></param> | ||
527 | /// <param name="path"></param> | ||
528 | /// <param name="param"></param> | ||
529 | /// <returns></returns> | ||
530 | public string RestGetRegionMethod(string request, string path, string param) | ||
531 | { | ||
532 | return RestGetSimMethod("", "/sims/", param); | ||
533 | } | ||
534 | |||
535 | /// <summary> | ||
536 | /// Performs a REST Set Operation | ||
537 | /// </summary> | ||
538 | /// <param name="request"></param> | ||
539 | /// <param name="path"></param> | ||
540 | /// <param name="param"></param> | ||
541 | /// <returns></returns> | ||
542 | public string RestSetRegionMethod(string request, string path, string param) | ||
543 | { | ||
544 | return RestSetSimMethod("", "/sims/", param); | ||
545 | } | ||
546 | |||
547 | /// <summary> | ||
548 | /// Returns information about a sim via a REST Request | ||
549 | /// </summary> | ||
550 | /// <param name="request"></param> | ||
551 | /// <param name="path"></param> | ||
552 | /// <param name="param"></param> | ||
553 | /// <returns>Information about the sim in XML</returns> | ||
554 | public string RestGetSimMethod(string request, string path, string param) | ||
555 | { | ||
556 | string respstring = String.Empty; | ||
557 | |||
558 | SimProfileData TheSim; | ||
559 | LLUUID UUID = new LLUUID(param); | ||
560 | TheSim = getRegion(UUID); | ||
561 | |||
562 | if (!(TheSim == null)) | ||
563 | { | ||
564 | respstring = "<Root>"; | ||
565 | respstring += "<authkey>" + TheSim.regionSendKey + "</authkey>"; | ||
566 | respstring += "<sim>"; | ||
567 | respstring += "<uuid>" + TheSim.UUID.ToString() + "</uuid>"; | ||
568 | respstring += "<regionname>" + TheSim.regionName + "</regionname>"; | ||
569 | respstring += "<sim_ip>" + TheSim.serverIP + "</sim_ip>"; | ||
570 | respstring += "<sim_port>" + TheSim.serverPort.ToString() + "</sim_port>"; | ||
571 | respstring += "<region_locx>" + TheSim.regionLocX.ToString() + "</region_locx>"; | ||
572 | respstring += "<region_locy>" + TheSim.regionLocY.ToString() + "</region_locy>"; | ||
573 | respstring += "<estate_id>1</estate_id>"; | ||
574 | respstring += "</sim>"; | ||
575 | respstring += "</Root>"; | ||
576 | } | ||
577 | |||
578 | return respstring; | ||
579 | } | ||
580 | |||
581 | /// <summary> | ||
582 | /// Creates or updates a sim via a REST Method Request | ||
583 | /// BROKEN with SQL Update | ||
584 | /// </summary> | ||
585 | /// <param name="request"></param> | ||
586 | /// <param name="path"></param> | ||
587 | /// <param name="param"></param> | ||
588 | /// <returns>"OK" or an error</returns> | ||
589 | public string RestSetSimMethod(string request, string path, string param) | ||
590 | { | ||
591 | Console.WriteLine("Processing region update via REST method"); | ||
592 | SimProfileData TheSim; | ||
593 | TheSim = getRegion(new LLUUID(param)); | ||
594 | if ((TheSim) == null) | ||
595 | { | ||
596 | TheSim = new SimProfileData(); | ||
597 | LLUUID UUID = new LLUUID(param); | ||
598 | TheSim.UUID = UUID; | ||
599 | TheSim.regionRecvKey = config.SimRecvKey; | ||
600 | } | ||
601 | |||
602 | XmlDocument doc = new XmlDocument(); | ||
603 | doc.LoadXml(request); | ||
604 | XmlNode rootnode = doc.FirstChild; | ||
605 | XmlNode authkeynode = rootnode.ChildNodes[0]; | ||
606 | if (authkeynode.Name != "authkey") | ||
607 | { | ||
608 | return "ERROR! bad XML - expected authkey tag"; | ||
609 | } | ||
610 | |||
611 | XmlNode simnode = rootnode.ChildNodes[1]; | ||
612 | if (simnode.Name != "sim") | ||
613 | { | ||
614 | return "ERROR! bad XML - expected sim tag"; | ||
615 | } | ||
616 | |||
617 | //TheSim.regionSendKey = Cfg; | ||
618 | TheSim.regionRecvKey = config.SimRecvKey; | ||
619 | TheSim.regionSendKey = config.SimSendKey; | ||
620 | TheSim.regionSecret = config.SimRecvKey; | ||
621 | TheSim.regionDataURI = ""; | ||
622 | TheSim.regionAssetURI = config.DefaultAssetServer; | ||
623 | TheSim.regionAssetRecvKey = config.AssetRecvKey; | ||
624 | TheSim.regionAssetSendKey = config.AssetSendKey; | ||
625 | TheSim.regionUserURI = config.DefaultUserServer; | ||
626 | TheSim.regionUserSendKey = config.UserSendKey; | ||
627 | TheSim.regionUserRecvKey = config.UserRecvKey; | ||
628 | |||
629 | |||
630 | for (int i = 0; i < simnode.ChildNodes.Count; i++) | ||
631 | { | ||
632 | switch (simnode.ChildNodes[i].Name) | ||
633 | { | ||
634 | case "regionname": | ||
635 | TheSim.regionName = simnode.ChildNodes[i].InnerText; | ||
636 | break; | ||
637 | |||
638 | case "sim_ip": | ||
639 | TheSim.serverIP = simnode.ChildNodes[i].InnerText; | ||
640 | break; | ||
641 | |||
642 | case "sim_port": | ||
643 | TheSim.serverPort = Convert.ToUInt32(simnode.ChildNodes[i].InnerText); | ||
644 | break; | ||
645 | |||
646 | case "region_locx": | ||
647 | TheSim.regionLocX = Convert.ToUInt32((string)simnode.ChildNodes[i].InnerText); | ||
648 | TheSim.regionHandle = Helpers.UIntsToLong((TheSim.regionLocX * 256), (TheSim.regionLocY * 256)); | ||
649 | break; | ||
650 | |||
651 | case "region_locy": | ||
652 | TheSim.regionLocY = Convert.ToUInt32((string)simnode.ChildNodes[i].InnerText); | ||
653 | TheSim.regionHandle = Helpers.UIntsToLong((TheSim.regionLocX * 256), (TheSim.regionLocY * 256)); | ||
654 | break; | ||
655 | } | ||
656 | } | ||
657 | |||
658 | TheSim.serverURI = "http://" + TheSim.serverIP + ":" + TheSim.serverPort + "/"; | ||
659 | |||
660 | bool requirePublic = false; | ||
661 | |||
662 | if (requirePublic && (TheSim.serverIP.StartsWith("172.16") || TheSim.serverIP.StartsWith("192.168") || TheSim.serverIP.StartsWith("10.") || TheSim.serverIP.StartsWith("0.") || TheSim.serverIP.StartsWith("255."))) | ||
663 | { | ||
664 | return "ERROR! Servers must register with public addresses."; | ||
665 | } | ||
666 | |||
667 | |||
668 | try | ||
669 | { | ||
670 | MainLog.Instance.Verbose("Updating / adding via " + _plugins.Count + " storage provider(s) registered."); | ||
671 | foreach (KeyValuePair<string, IGridData> kvp in _plugins) | ||
672 | { | ||
673 | try | ||
674 | { | ||
675 | //Check reservations | ||
676 | ReservationData reserveData = kvp.Value.GetReservationAtPoint(TheSim.regionLocX, TheSim.regionLocY); | ||
677 | if ((reserveData != null && reserveData.gridRecvKey == TheSim.regionRecvKey) || (reserveData == null && authkeynode.InnerText != TheSim.regionRecvKey)) | ||
678 | { | ||
679 | kvp.Value.AddProfile(TheSim); | ||
680 | MainLog.Instance.Verbose("New sim added to grid (" + TheSim.regionName + ")"); | ||
681 | logToDB(TheSim.UUID.ToStringHyphenated(), "RestSetSimMethod", "", 5, "Region successfully updated and connected to grid."); | ||
682 | } | ||
683 | else | ||
684 | { | ||
685 | MainLog.Instance.Warn("Unable to update region (RestSetSimMethod): Incorrect reservation auth key.");// Wanted: " + reserveData.gridRecvKey + ", Got: " + TheSim.regionRecvKey + "."); | ||
686 | return "Unable to update region (RestSetSimMethod): Incorrect auth key."; | ||
687 | } | ||
688 | } | ||
689 | catch (Exception e) | ||
690 | { | ||
691 | MainLog.Instance.Verbose("getRegionPlugin Handle " + kvp.Key + " unable to add new sim: " + e.ToString()); | ||
692 | } | ||
693 | } | ||
694 | return "OK"; | ||
695 | } | ||
696 | catch (Exception e) | ||
697 | { | ||
698 | return "ERROR! Could not save to database! (" + e.ToString() + ")"; | ||
699 | } | ||
700 | } | ||
701 | |||
702 | } | ||
703 | } | ||
diff --git a/OpenSim/Grid/GridServer/Main.cs b/OpenSim/Grid/GridServer/Main.cs new file mode 100644 index 0000000..dc5e4fa --- /dev/null +++ b/OpenSim/Grid/GridServer/Main.cs | |||
@@ -0,0 +1,258 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.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 | |||
29 | using System; | ||
30 | using System.Reflection; | ||
31 | using System.Threading; | ||
32 | using System.Timers; | ||
33 | using OpenSim.Framework.Console; | ||
34 | using OpenSim.Framework.Interfaces; | ||
35 | using OpenSim.Framework.Servers; | ||
36 | using OpenSim.GenericConfig; | ||
37 | using Timer=System.Timers.Timer; | ||
38 | |||
39 | namespace OpenSim.Grid.GridServer | ||
40 | { | ||
41 | /// <summary> | ||
42 | /// </summary> | ||
43 | public class OpenGrid_Main : conscmd_callback | ||
44 | { | ||
45 | private string ConfigDll = "OpenSim.Grid.GridServer.Config.dll"; | ||
46 | private string GridDll = "OpenSim.Framework.Data.MySQL.dll"; | ||
47 | public GridConfig Cfg; | ||
48 | |||
49 | public static OpenGrid_Main thegrid; | ||
50 | protected IGenericConfig localXMLConfig; | ||
51 | |||
52 | public static bool setuponly; | ||
53 | |||
54 | //public LLUUID highestUUID; | ||
55 | |||
56 | // private SimProfileManager m_simProfileManager; | ||
57 | |||
58 | private GridManager m_gridManager; | ||
59 | |||
60 | private LogBase m_console; | ||
61 | |||
62 | [STAThread] | ||
63 | public static void Main(string[] args) | ||
64 | { | ||
65 | if (args.Length > 0) | ||
66 | { | ||
67 | if (args[0] == "-setuponly") setuponly = true; | ||
68 | } | ||
69 | Console.WriteLine("Starting...\n"); | ||
70 | |||
71 | thegrid = new OpenGrid_Main(); | ||
72 | thegrid.Startup(); | ||
73 | |||
74 | thegrid.Work(); | ||
75 | } | ||
76 | |||
77 | private void Work() | ||
78 | { | ||
79 | m_console.Notice("Enter help for a list of commands\n"); | ||
80 | |||
81 | while (true) | ||
82 | { | ||
83 | m_console.MainLogPrompt(); | ||
84 | } | ||
85 | } | ||
86 | |||
87 | private OpenGrid_Main() | ||
88 | { | ||
89 | m_console = new LogBase("opengrid-gridserver-console.log", "OpenGrid", this, false); | ||
90 | MainLog.Instance = m_console; | ||
91 | |||
92 | |||
93 | } | ||
94 | |||
95 | public void managercallback(string cmd) | ||
96 | { | ||
97 | switch (cmd) | ||
98 | { | ||
99 | case "shutdown": | ||
100 | RunCmd("shutdown", new string[0]); | ||
101 | break; | ||
102 | } | ||
103 | } | ||
104 | |||
105 | |||
106 | public void Startup() | ||
107 | { | ||
108 | this.localXMLConfig = new XmlConfig("GridServerConfig.xml"); | ||
109 | this.localXMLConfig.LoadData(); | ||
110 | this.ConfigDB(this.localXMLConfig); | ||
111 | this.localXMLConfig.Close(); | ||
112 | |||
113 | m_console.Verbose( "Main.cs:Startup() - Loading configuration"); | ||
114 | Cfg = this.LoadConfigDll(this.ConfigDll); | ||
115 | Cfg.InitConfig(); | ||
116 | if (setuponly) Environment.Exit(0); | ||
117 | |||
118 | m_console.Verbose( "Main.cs:Startup() - Connecting to Storage Server"); | ||
119 | m_gridManager = new GridManager(); | ||
120 | m_gridManager.AddPlugin(GridDll); // Made of win | ||
121 | m_gridManager.config = Cfg; | ||
122 | |||
123 | m_console.Verbose( "Main.cs:Startup() - Starting HTTP process"); | ||
124 | BaseHttpServer httpServer = new BaseHttpServer(8001); | ||
125 | //GridManagementAgent GridManagerAgent = new GridManagementAgent(httpServer, "gridserver", Cfg.SimSendKey, Cfg.SimRecvKey, managercallback); | ||
126 | |||
127 | httpServer.AddXmlRPCHandler("simulator_login", m_gridManager.XmlRpcSimulatorLoginMethod); | ||
128 | httpServer.AddXmlRPCHandler("simulator_data_request", m_gridManager.XmlRpcSimulatorDataRequestMethod); | ||
129 | httpServer.AddXmlRPCHandler("map_block", m_gridManager.XmlRpcMapBlockMethod); | ||
130 | |||
131 | httpServer.AddStreamHandler(new RestStreamHandler("GET", "/sims/", m_gridManager.RestGetSimMethod )); | ||
132 | httpServer.AddStreamHandler(new RestStreamHandler("POST", "/sims/", m_gridManager.RestSetSimMethod )); | ||
133 | |||
134 | httpServer.AddStreamHandler( new RestStreamHandler("GET", "/regions/", m_gridManager.RestGetRegionMethod )); | ||
135 | httpServer.AddStreamHandler( new RestStreamHandler("POST","/regions/", m_gridManager.RestSetRegionMethod )); | ||
136 | |||
137 | //httpServer.AddRestHandler("GET", "/sims/", m_gridManager.RestGetSimMethod); | ||
138 | //httpServer.AddRestHandler("POST", "/sims/", m_gridManager.RestSetSimMethod); | ||
139 | //httpServer.AddRestHandler("GET", "/regions/", m_gridManager.RestGetRegionMethod); | ||
140 | //httpServer.AddRestHandler("POST", "/regions/", m_gridManager.RestSetRegionMethod); | ||
141 | |||
142 | httpServer.Start(); | ||
143 | |||
144 | m_console.Verbose( "Main.cs:Startup() - Starting sim status checker"); | ||
145 | |||
146 | Timer simCheckTimer = new Timer(3600000 * 3); // 3 Hours between updates. | ||
147 | simCheckTimer.Elapsed += new ElapsedEventHandler(CheckSims); | ||
148 | simCheckTimer.Enabled = true; | ||
149 | } | ||
150 | |||
151 | private GridConfig LoadConfigDll(string dllName) | ||
152 | { | ||
153 | Assembly pluginAssembly = Assembly.LoadFrom(dllName); | ||
154 | GridConfig config = null; | ||
155 | |||
156 | foreach (Type pluginType in pluginAssembly.GetTypes()) | ||
157 | { | ||
158 | if (pluginType.IsPublic) | ||
159 | { | ||
160 | if (!pluginType.IsAbstract) | ||
161 | { | ||
162 | Type typeInterface = pluginType.GetInterface("IGridConfig", true); | ||
163 | |||
164 | if (typeInterface != null) | ||
165 | { | ||
166 | IGridConfig plug = (IGridConfig)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); | ||
167 | config = plug.GetConfigObject(); | ||
168 | break; | ||
169 | } | ||
170 | |||
171 | typeInterface = null; | ||
172 | } | ||
173 | } | ||
174 | } | ||
175 | pluginAssembly = null; | ||
176 | return config; | ||
177 | } | ||
178 | |||
179 | public void CheckSims(object sender, ElapsedEventArgs e) | ||
180 | { | ||
181 | /* | ||
182 | foreach (SimProfileBase sim in m_simProfileManager.SimProfiles.Values) | ||
183 | { | ||
184 | string SimResponse = ""; | ||
185 | try | ||
186 | { | ||
187 | WebRequest CheckSim = WebRequest.Create("http://" + sim.sim_ip + ":" + sim.sim_port.ToString() + "/checkstatus/"); | ||
188 | CheckSim.Method = "GET"; | ||
189 | CheckSim.ContentType = "text/plaintext"; | ||
190 | CheckSim.ContentLength = 0; | ||
191 | |||
192 | StreamWriter stOut = new StreamWriter(CheckSim.GetRequestStream(), System.Text.Encoding.ASCII); | ||
193 | stOut.Write(""); | ||
194 | stOut.Close(); | ||
195 | |||
196 | StreamReader stIn = new StreamReader(CheckSim.GetResponse().GetResponseStream()); | ||
197 | SimResponse = stIn.ReadToEnd(); | ||
198 | stIn.Close(); | ||
199 | } | ||
200 | catch | ||
201 | { | ||
202 | } | ||
203 | |||
204 | if (SimResponse == "OK") | ||
205 | { | ||
206 | m_simProfileManager.SimProfiles[sim.UUID].online = true; | ||
207 | } | ||
208 | else | ||
209 | { | ||
210 | m_simProfileManager.SimProfiles[sim.UUID].online = false; | ||
211 | } | ||
212 | } | ||
213 | */ | ||
214 | } | ||
215 | |||
216 | public void RunCmd(string cmd, string[] cmdparams) | ||
217 | { | ||
218 | switch (cmd) | ||
219 | { | ||
220 | case "help": | ||
221 | m_console.Notice("shutdown - shutdown the grid (USE CAUTION!)"); | ||
222 | break; | ||
223 | |||
224 | case "shutdown": | ||
225 | m_console.Close(); | ||
226 | Environment.Exit(0); | ||
227 | break; | ||
228 | } | ||
229 | } | ||
230 | |||
231 | public void Show(string ShowWhat) | ||
232 | { | ||
233 | } | ||
234 | |||
235 | private void ConfigDB(IGenericConfig configData) | ||
236 | { | ||
237 | try | ||
238 | { | ||
239 | string attri = ""; | ||
240 | attri = configData.GetAttribute("DataBaseProvider"); | ||
241 | if (attri == "") | ||
242 | { | ||
243 | GridDll = "OpenSim.Framework.Data.DB4o.dll"; | ||
244 | configData.SetAttribute("DataBaseProvider", "OpenSim.Framework.Data.DB4o.dll"); | ||
245 | } | ||
246 | else | ||
247 | { | ||
248 | GridDll = attri; | ||
249 | } | ||
250 | configData.Commit(); | ||
251 | } | ||
252 | catch | ||
253 | { | ||
254 | |||
255 | } | ||
256 | } | ||
257 | } | ||
258 | } | ||
diff --git a/OpenSim/Grid/GridServer/Properties/AssemblyInfo.cs b/OpenSim/Grid/GridServer/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..62a68a8 --- /dev/null +++ b/OpenSim/Grid/GridServer/Properties/AssemblyInfo.cs | |||
@@ -0,0 +1,58 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.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 | using System.Reflection; | ||
29 | using System.Runtime.InteropServices; | ||
30 | // General Information about an assembly is controlled through the following | ||
31 | // set of attributes. Change these attribute values to modify the information | ||
32 | // associated with an assembly. | ||
33 | [assembly: AssemblyTitle("OGS-GridServer")] | ||
34 | [assembly: AssemblyDescription("")] | ||
35 | [assembly: AssemblyConfiguration("")] | ||
36 | [assembly: AssemblyCompany("")] | ||
37 | [assembly: AssemblyProduct("OGS-GridServer")] | ||
38 | [assembly: AssemblyCopyright("Copyright © 2007")] | ||
39 | [assembly: AssemblyTrademark("")] | ||
40 | [assembly: AssemblyCulture("")] | ||
41 | |||
42 | // Setting ComVisible to false makes the types in this assembly not visible | ||
43 | // to COM components. If you need to access a type in this assembly from | ||
44 | // COM, set the ComVisible attribute to true on that type. | ||
45 | [assembly: ComVisible(false)] | ||
46 | |||
47 | // The following GUID is for the ID of the typelib if this project is exposed to COM | ||
48 | [assembly: Guid("b541b244-3d1d-4625-9003-bc2a3a6a39a4")] | ||
49 | |||
50 | // Version information for an assembly consists of the following four values: | ||
51 | // | ||
52 | // Major Version | ||
53 | // Minor Version | ||
54 | // Build Number | ||
55 | // Revision | ||
56 | // | ||
57 | [assembly: AssemblyVersion("1.0.0.0")] | ||
58 | [assembly: AssemblyFileVersion("1.0.0.0")] | ||
diff --git a/OpenSim/Grid/InventoryServer/InventoryManager.cs b/OpenSim/Grid/InventoryServer/InventoryManager.cs new file mode 100644 index 0000000..9ca9b5e --- /dev/null +++ b/OpenSim/Grid/InventoryServer/InventoryManager.cs | |||
@@ -0,0 +1,125 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.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 | using System; | ||
29 | using System.Collections; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Text; | ||
32 | using OpenGrid.Framework.Data; | ||
33 | using libsecondlife; | ||
34 | using System.Reflection; | ||
35 | |||
36 | using System.Xml; | ||
37 | using Nwc.XmlRpc; | ||
38 | using OpenSim.Framework.Sims; | ||
39 | using OpenSim.Framework.Inventory; | ||
40 | using OpenSim.Framework.Utilities; | ||
41 | |||
42 | using System.Security.Cryptography; | ||
43 | |||
44 | namespace OpenGridServices.InventoryServer | ||
45 | { | ||
46 | class InventoryManager | ||
47 | { | ||
48 | Dictionary<string, IInventoryData> _plugins = new Dictionary<string, IInventoryData>(); | ||
49 | |||
50 | /// <summary> | ||
51 | /// Adds a new inventory server plugin - user servers will be requested in the order they were loaded. | ||
52 | /// </summary> | ||
53 | /// <param name="FileName">The filename to the inventory server plugin DLL</param> | ||
54 | public void AddPlugin(string FileName) | ||
55 | { | ||
56 | OpenSim.Framework.Console.MainConsole.Instance.Verbose( "Invenstorage: Attempting to load " + FileName); | ||
57 | Assembly pluginAssembly = Assembly.LoadFrom(FileName); | ||
58 | |||
59 | OpenSim.Framework.Console.MainConsole.Instance.Verbose( "Invenstorage: Found " + pluginAssembly.GetTypes().Length + " interfaces."); | ||
60 | foreach (Type pluginType in pluginAssembly.GetTypes()) | ||
61 | { | ||
62 | if (!pluginType.IsAbstract) | ||
63 | { | ||
64 | Type typeInterface = pluginType.GetInterface("IInventoryData", true); | ||
65 | |||
66 | if (typeInterface != null) | ||
67 | { | ||
68 | IInventoryData plug = (IInventoryData)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); | ||
69 | plug.Initialise(); | ||
70 | this._plugins.Add(plug.getName(), plug); | ||
71 | OpenSim.Framework.Console.MainConsole.Instance.Verbose( "Invenstorage: Added IUserData Interface"); | ||
72 | } | ||
73 | |||
74 | typeInterface = null; | ||
75 | } | ||
76 | } | ||
77 | |||
78 | pluginAssembly = null; | ||
79 | } | ||
80 | |||
81 | public List<InventoryFolderBase> getRootFolders(LLUUID user) | ||
82 | { | ||
83 | foreach (KeyValuePair<string, IInventoryData> kvp in _plugins) | ||
84 | { | ||
85 | try | ||
86 | { | ||
87 | return kvp.Value.getUserRootFolders(user); | ||
88 | } | ||
89 | catch (Exception e) | ||
90 | { | ||
91 | OpenSim.Framework.Console.MainConsole.Instance.Notice("Unable to get root folders via " + kvp.Key + " (" + e.ToString() + ")"); | ||
92 | } | ||
93 | } | ||
94 | return null; | ||
95 | } | ||
96 | |||
97 | public XmlRpcResponse XmlRpcInventoryRequest(XmlRpcRequest request) | ||
98 | { | ||
99 | XmlRpcResponse response = new XmlRpcResponse(); | ||
100 | Hashtable requestData = (Hashtable)request.Params[0]; | ||
101 | |||
102 | Hashtable responseData = new Hashtable(); | ||
103 | |||
104 | // Stuff happens here | ||
105 | |||
106 | if (requestData.ContainsKey("Access-type")) | ||
107 | { | ||
108 | if (requestData["access-type"] == "rootfolders") | ||
109 | { | ||
110 | // responseData["rootfolders"] = | ||
111 | } | ||
112 | } | ||
113 | else | ||
114 | { | ||
115 | responseData["error"] = "No access-type specified."; | ||
116 | } | ||
117 | |||
118 | |||
119 | // Stuff stops happening here | ||
120 | |||
121 | response.Value = responseData; | ||
122 | return response; | ||
123 | } | ||
124 | } | ||
125 | } | ||
diff --git a/OpenSim/Grid/InventoryServer/Main.cs b/OpenSim/Grid/InventoryServer/Main.cs new file mode 100644 index 0000000..f479a79 --- /dev/null +++ b/OpenSim/Grid/InventoryServer/Main.cs | |||
@@ -0,0 +1,87 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.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 | using System; | ||
29 | using System.Collections; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Reflection; | ||
32 | using System.IO; | ||
33 | using System.Text; | ||
34 | using libsecondlife; | ||
35 | using OpenSim.Framework.User; | ||
36 | using OpenSim.Framework.Sims; | ||
37 | using OpenSim.Framework.Inventory; | ||
38 | using OpenSim.Framework.Interfaces; | ||
39 | using OpenSim.Framework.Console; | ||
40 | using OpenSim.Servers; | ||
41 | using OpenSim.Framework.Utilities; | ||
42 | |||
43 | namespace OpenGridServices.InventoryServer | ||
44 | { | ||
45 | public class OpenInventory_Main : BaseServer, conscmd_callback | ||
46 | { | ||
47 | ConsoleBase m_console; | ||
48 | InventoryManager m_inventoryManager; | ||
49 | |||
50 | public static void Main(string[] args) | ||
51 | { | ||
52 | } | ||
53 | |||
54 | public OpenInventory_Main() | ||
55 | { | ||
56 | m_console = new ConsoleBase("opengrid-inventory-console.log", "OpenInventory", this, false); | ||
57 | MainConsole.Instance = m_console; | ||
58 | } | ||
59 | |||
60 | public void Startup() | ||
61 | { | ||
62 | MainConsole.Instance.Notice("Initialising inventory manager..."); | ||
63 | m_inventoryManager = new InventoryManager(); | ||
64 | |||
65 | MainConsole.Instance.Notice("Starting HTTP server"); | ||
66 | BaseHttpServer httpServer = new BaseHttpServer(8004); | ||
67 | |||
68 | httpServer.AddXmlRPCHandler("rootfolders", m_inventoryManager.XmlRpcInventoryRequest); | ||
69 | //httpServer.AddRestHandler("GET","/rootfolders/",Rest | ||
70 | } | ||
71 | |||
72 | public void RunCmd(string cmd, string[] cmdparams) | ||
73 | { | ||
74 | switch (cmd) | ||
75 | { | ||
76 | case "shutdown": | ||
77 | m_console.Close(); | ||
78 | Environment.Exit(0); | ||
79 | break; | ||
80 | } | ||
81 | } | ||
82 | |||
83 | public void Show(string ShowWhat) | ||
84 | { | ||
85 | } | ||
86 | } | ||
87 | } | ||
diff --git a/OpenSim/Grid/Manager/OpenGridServices.Manager.mds b/OpenSim/Grid/Manager/OpenGridServices.Manager.mds new file mode 100644 index 0000000..ed7bc24 --- /dev/null +++ b/OpenSim/Grid/Manager/OpenGridServices.Manager.mds | |||
@@ -0,0 +1,16 @@ | |||
1 | <Combine name="OpenGridServices.Manager" fileversion="2.0" outputpath="../../mono-1.2.3.1/lib/monodevelop/bin" MakePkgConfig="False" MakeLibPC="True"> | ||
2 | <Configurations active="Debug"> | ||
3 | <Configuration name="Debug" ctype="CombineConfiguration"> | ||
4 | <Entry build="True" name="OpenGridServices.Manager" configuration="Debug" /> | ||
5 | </Configuration> | ||
6 | <Configuration name="Release" ctype="CombineConfiguration"> | ||
7 | <Entry build="True" name="OpenGridServices.Manager" configuration="Release" /> | ||
8 | </Configuration> | ||
9 | </Configurations> | ||
10 | <StartMode startupentry="OpenGridServices.Manager" single="True"> | ||
11 | <Execute type="None" entry="OpenGridServices.Manager" /> | ||
12 | </StartMode> | ||
13 | <Entries> | ||
14 | <Entry filename="./OpenGridServices.Manager/OpenGridServices.Manager.mdp" /> | ||
15 | </Entries> | ||
16 | </Combine> \ No newline at end of file | ||
diff --git a/OpenSim/Grid/Manager/OpenGridServices.Manager.userprefs b/OpenSim/Grid/Manager/OpenGridServices.Manager.userprefs new file mode 100644 index 0000000..f221509 --- /dev/null +++ b/OpenSim/Grid/Manager/OpenGridServices.Manager.userprefs | |||
@@ -0,0 +1,39 @@ | |||
1 | <?xml version="1.0"?> | ||
2 | <UserCombinePreferences filename="/home/gareth/OpenGridServices.Manager/OpenGridServices.Manager.mds"> | ||
3 | <Files> | ||
4 | <File filename="Welcome" /> | ||
5 | <File filename="./OpenGridServices.Manager/MainWindow.cs" /> | ||
6 | <File filename="./OpenGridServices.Manager/ConnectToGridServerDialog.cs" /> | ||
7 | <File filename="./OpenGridServices.Manager/Main.cs" /> | ||
8 | </Files> | ||
9 | <Views> | ||
10 | <ViewMemento Id="MonoDevelop.Ide.Gui.Pads.ProjectPad"> | ||
11 | <TreeView> | ||
12 | <Node expanded="True"> | ||
13 | <Node name="OpenGridServices.Manager" expanded="True"> | ||
14 | <Node name="References" expanded="True" /> | ||
15 | <Node name="Resources" expanded="True" /> | ||
16 | <Node name="UserInterface" expanded="True" /> | ||
17 | <Node name="ConnectToGridServerDialog.cs" expanded="False" selected="True" /> | ||
18 | </Node> | ||
19 | </Node> | ||
20 | </TreeView> | ||
21 | </ViewMemento> | ||
22 | <ViewMemento Id="MonoDevelop.Ide.Gui.Pads.ClassPad"> | ||
23 | <TreeView> | ||
24 | <Node expanded="True" /> | ||
25 | </TreeView> | ||
26 | </ViewMemento> | ||
27 | <ViewMemento Id="MonoDevelop.NUnit.TestPad"> | ||
28 | <TreeView> | ||
29 | <Node expanded="False" /> | ||
30 | </TreeView> | ||
31 | </ViewMemento> | ||
32 | </Views> | ||
33 | <Properties> | ||
34 | <Properties> | ||
35 | <Property key="ActiveConfiguration" value="Debug" /> | ||
36 | <Property key="ActiveWindow" value="/home/gareth/OpenGridServices.Manager/OpenGridServices.Manager/ConnectToGridServerDialog.cs" /> | ||
37 | </Properties> | ||
38 | </Properties> | ||
39 | </UserCombinePreferences> \ No newline at end of file | ||
diff --git a/OpenSim/Grid/Manager/OpenGridServices.Manager.usertasks b/OpenSim/Grid/Manager/OpenGridServices.Manager.usertasks new file mode 100644 index 0000000..d887d0e --- /dev/null +++ b/OpenSim/Grid/Manager/OpenGridServices.Manager.usertasks | |||
@@ -0,0 +1,2 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | ||
2 | <ArrayOfUserTask xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" /> \ No newline at end of file | ||
diff --git a/OpenSim/Grid/Manager/OpenGridServices.Manager/AssemblyInfo.cs b/OpenSim/Grid/Manager/OpenGridServices.Manager/AssemblyInfo.cs new file mode 100644 index 0000000..af4e275 --- /dev/null +++ b/OpenSim/Grid/Manager/OpenGridServices.Manager/AssemblyInfo.cs | |||
@@ -0,0 +1,32 @@ | |||
1 | using System.Reflection; | ||
2 | using System.Runtime.CompilerServices; | ||
3 | |||
4 | // Information about this assembly is defined by the following | ||
5 | // attributes. | ||
6 | // | ||
7 | // change them to the information which is associated with the assembly | ||
8 | // you compile. | ||
9 | |||
10 | [assembly: AssemblyTitle("")] | ||
11 | [assembly: AssemblyDescription("")] | ||
12 | [assembly: AssemblyConfiguration("")] | ||
13 | [assembly: AssemblyCompany("")] | ||
14 | [assembly: AssemblyProduct("")] | ||
15 | [assembly: AssemblyCopyright("")] | ||
16 | [assembly: AssemblyTrademark("")] | ||
17 | [assembly: AssemblyCulture("")] | ||
18 | |||
19 | // The assembly version has following format : | ||
20 | // | ||
21 | // Major.Minor.Build.Revision | ||
22 | // | ||
23 | // You can specify all values by your own or you can build default build and revision | ||
24 | // numbers with the '*' character (the default): | ||
25 | |||
26 | [assembly: AssemblyVersion("1.0.*")] | ||
27 | |||
28 | // The following attributes specify the key for the sign of your assembly. See the | ||
29 | // .NET Framework documentation for more information about signing. | ||
30 | // This is not required, if you don't want signing let these attributes like they're. | ||
31 | [assembly: AssemblyDelaySign(false)] | ||
32 | [assembly: AssemblyKeyFile("")] | ||
diff --git a/OpenSim/Grid/Manager/OpenGridServices.Manager/BlockingQueue.cs b/OpenSim/Grid/Manager/OpenGridServices.Manager/BlockingQueue.cs new file mode 100644 index 0000000..83685fc --- /dev/null +++ b/OpenSim/Grid/Manager/OpenGridServices.Manager/BlockingQueue.cs | |||
@@ -0,0 +1,33 @@ | |||
1 | using System; | ||
2 | using System.Threading; | ||
3 | using System.Collections.Generic; | ||
4 | using System.Text; | ||
5 | |||
6 | namespace OpenGridServices.Manager | ||
7 | { | ||
8 | public class BlockingQueue<T> | ||
9 | { | ||
10 | private Queue<T> _queue = new Queue<T>(); | ||
11 | private object _queueSync = new object(); | ||
12 | |||
13 | public void Enqueue(T value) | ||
14 | { | ||
15 | lock (_queueSync) | ||
16 | { | ||
17 | _queue.Enqueue(value); | ||
18 | Monitor.Pulse(_queueSync); | ||
19 | } | ||
20 | } | ||
21 | |||
22 | public T Dequeue() | ||
23 | { | ||
24 | lock (_queueSync) | ||
25 | { | ||
26 | if (_queue.Count < 1) | ||
27 | Monitor.Wait(_queueSync); | ||
28 | |||
29 | return _queue.Dequeue(); | ||
30 | } | ||
31 | } | ||
32 | } | ||
33 | } | ||
diff --git a/OpenSim/Grid/Manager/OpenGridServices.Manager/Connect to grid server.cs b/OpenSim/Grid/Manager/OpenGridServices.Manager/Connect to grid server.cs new file mode 100644 index 0000000..0d509ef --- /dev/null +++ b/OpenSim/Grid/Manager/OpenGridServices.Manager/Connect to grid server.cs | |||
@@ -0,0 +1,16 @@ | |||
1 | |||
2 | using System; | ||
3 | |||
4 | namespace OpenGridServices.Manager | ||
5 | { | ||
6 | |||
7 | |||
8 | public partial class Connect to grid server : Gtk.Dialog | ||
9 | { | ||
10 | |||
11 | public Connect to grid server() | ||
12 | { | ||
13 | this.Build(); | ||
14 | } | ||
15 | } | ||
16 | } | ||
diff --git a/OpenSim/Grid/Manager/OpenGridServices.Manager/ConnectToGridServerDialog.cs b/OpenSim/Grid/Manager/OpenGridServices.Manager/ConnectToGridServerDialog.cs new file mode 100644 index 0000000..8a80b1d --- /dev/null +++ b/OpenSim/Grid/Manager/OpenGridServices.Manager/ConnectToGridServerDialog.cs | |||
@@ -0,0 +1,29 @@ | |||
1 | using Gtk; | ||
2 | using System; | ||
3 | |||
4 | namespace OpenGridServices.Manager { | ||
5 | public partial class ConnectToGridServerDialog : Gtk.Dialog | ||
6 | { | ||
7 | |||
8 | public ConnectToGridServerDialog() | ||
9 | { | ||
10 | this.Build(); | ||
11 | } | ||
12 | |||
13 | protected virtual void OnResponse(object o, Gtk.ResponseArgs args) | ||
14 | { | ||
15 | switch(args.ResponseId) { | ||
16 | case Gtk.ResponseType.Ok: | ||
17 | MainClass.PendingOperations.Enqueue("connect_to_gridserver " + this.entry1.Text + " " + this.entry2.Text + " " + this.entry3.Text); | ||
18 | break; | ||
19 | |||
20 | case Gtk.ResponseType.Cancel: | ||
21 | break; | ||
22 | } | ||
23 | this.Hide(); | ||
24 | |||
25 | } | ||
26 | |||
27 | } | ||
28 | |||
29 | } \ No newline at end of file | ||
diff --git a/OpenSim/Grid/Manager/OpenGridServices.Manager/GridServerConnectionManager.cs b/OpenSim/Grid/Manager/OpenGridServices.Manager/GridServerConnectionManager.cs new file mode 100644 index 0000000..6b632d6 --- /dev/null +++ b/OpenSim/Grid/Manager/OpenGridServices.Manager/GridServerConnectionManager.cs | |||
@@ -0,0 +1,106 @@ | |||
1 | using Nwc.XmlRpc; | ||
2 | using System; | ||
3 | using System.Net; | ||
4 | using System.IO; | ||
5 | using System.Xml; | ||
6 | using System.Collections; | ||
7 | using System.Collections.Generic; | ||
8 | using libsecondlife; | ||
9 | |||
10 | namespace OpenGridServices.Manager | ||
11 | { | ||
12 | public class GridServerConnectionManager | ||
13 | { | ||
14 | private string ServerURL; | ||
15 | public LLUUID SessionID; | ||
16 | public bool connected=false; | ||
17 | |||
18 | public RegionBlock[][] WorldMap; | ||
19 | |||
20 | public bool Connect(string GridServerURL, string username, string password) | ||
21 | { | ||
22 | try { | ||
23 | this.ServerURL=GridServerURL; | ||
24 | Hashtable LoginParamsHT = new Hashtable(); | ||
25 | LoginParamsHT["username"]=username; | ||
26 | LoginParamsHT["password"]=password; | ||
27 | ArrayList LoginParams = new ArrayList(); | ||
28 | LoginParams.Add(LoginParamsHT); | ||
29 | XmlRpcRequest GridLoginReq = new XmlRpcRequest("manager_login",LoginParams); | ||
30 | XmlRpcResponse GridResp = GridLoginReq.Send(ServerURL,3000); | ||
31 | if(GridResp.IsFault) { | ||
32 | connected=false; | ||
33 | return false; | ||
34 | } else { | ||
35 | Hashtable gridrespData = (Hashtable)GridResp.Value; | ||
36 | this.SessionID = new LLUUID((string)gridrespData["session_id"]); | ||
37 | connected=true; | ||
38 | return true; | ||
39 | } | ||
40 | } catch(Exception e) { | ||
41 | Console.WriteLine(e.ToString()); | ||
42 | connected=false; | ||
43 | return false; | ||
44 | } | ||
45 | } | ||
46 | |||
47 | public void DownloadMap() | ||
48 | { | ||
49 | System.Net.WebClient mapdownloader = new WebClient(); | ||
50 | Stream regionliststream = mapdownloader.OpenRead(ServerURL + "/regionlist"); | ||
51 | |||
52 | RegionBlock TempRegionData; | ||
53 | |||
54 | XmlDocument doc = new XmlDocument(); | ||
55 | doc.Load(regionliststream); | ||
56 | regionliststream.Close(); | ||
57 | XmlNode rootnode = doc.FirstChild; | ||
58 | if (rootnode.Name != "regions") | ||
59 | { | ||
60 | // TODO - ERROR! | ||
61 | } | ||
62 | |||
63 | for(int i=0; i<=rootnode.ChildNodes.Count; i++) | ||
64 | { | ||
65 | if(rootnode.ChildNodes.Item(i).Name != "region") { | ||
66 | // TODO - ERROR! | ||
67 | } else { | ||
68 | TempRegionData = new RegionBlock(); | ||
69 | |||
70 | |||
71 | } | ||
72 | } | ||
73 | } | ||
74 | |||
75 | public bool RestartServer() | ||
76 | { | ||
77 | return true; | ||
78 | } | ||
79 | |||
80 | public bool ShutdownServer() | ||
81 | { | ||
82 | try { | ||
83 | Hashtable ShutdownParamsHT = new Hashtable(); | ||
84 | ArrayList ShutdownParams = new ArrayList(); | ||
85 | ShutdownParamsHT["session_id"]=this.SessionID.ToString(); | ||
86 | ShutdownParams.Add(ShutdownParamsHT); | ||
87 | XmlRpcRequest GridShutdownReq = new XmlRpcRequest("shutdown",ShutdownParams); | ||
88 | XmlRpcResponse GridResp = GridShutdownReq.Send(this.ServerURL,3000); | ||
89 | if(GridResp.IsFault) { | ||
90 | return false; | ||
91 | } else { | ||
92 | connected=false; | ||
93 | return true; | ||
94 | } | ||
95 | } catch(Exception e) { | ||
96 | Console.WriteLine(e.ToString()); | ||
97 | return false; | ||
98 | } | ||
99 | } | ||
100 | |||
101 | public void DisconnectServer() | ||
102 | { | ||
103 | this.connected=false; | ||
104 | } | ||
105 | } | ||
106 | } | ||
diff --git a/OpenSim/Grid/Manager/OpenGridServices.Manager/Main.cs b/OpenSim/Grid/Manager/OpenGridServices.Manager/Main.cs new file mode 100644 index 0000000..42e09e0 --- /dev/null +++ b/OpenSim/Grid/Manager/OpenGridServices.Manager/Main.cs | |||
@@ -0,0 +1,96 @@ | |||
1 | // project created on 5/14/2007 at 2:04 PM | ||
2 | using System; | ||
3 | using System.Threading; | ||
4 | using Gtk; | ||
5 | |||
6 | namespace OpenGridServices.Manager | ||
7 | { | ||
8 | class MainClass | ||
9 | { | ||
10 | |||
11 | public static bool QuitReq=false; | ||
12 | public static BlockingQueue<string> PendingOperations = new BlockingQueue<string>(); | ||
13 | |||
14 | private static Thread OperationsRunner; | ||
15 | |||
16 | private static GridServerConnectionManager gridserverConn; | ||
17 | |||
18 | private static MainWindow win; | ||
19 | |||
20 | public static void DoMainLoop() | ||
21 | { | ||
22 | while(!QuitReq) | ||
23 | { | ||
24 | Application.RunIteration(); | ||
25 | } | ||
26 | } | ||
27 | |||
28 | public static void RunOperations() | ||
29 | { | ||
30 | string operation; | ||
31 | string cmd; | ||
32 | char[] sep = new char[1]; | ||
33 | sep[0]=' '; | ||
34 | while(!QuitReq) | ||
35 | { | ||
36 | operation=PendingOperations.Dequeue(); | ||
37 | Console.WriteLine(operation); | ||
38 | cmd = operation.Split(sep)[0]; | ||
39 | switch(cmd) { | ||
40 | case "connect_to_gridserver": | ||
41 | win.SetStatus("Connecting to grid server..."); | ||
42 | if(gridserverConn.Connect(operation.Split(sep)[1],operation.Split(sep)[2],operation.Split(sep)[3])) { | ||
43 | win.SetStatus("Connected OK with session ID:" + gridserverConn.SessionID); | ||
44 | win.SetGridServerConnected(true); | ||
45 | Thread.Sleep(3000); | ||
46 | win.SetStatus("Downloading region maps..."); | ||
47 | gridserverConn.DownloadMap(); | ||
48 | } else { | ||
49 | win.SetStatus("Could not connect"); | ||
50 | } | ||
51 | break; | ||
52 | |||
53 | case "restart_gridserver": | ||
54 | win.SetStatus("Restarting grid server..."); | ||
55 | if(gridserverConn.RestartServer()) { | ||
56 | win.SetStatus("Restarted server OK"); | ||
57 | Thread.Sleep(3000); | ||
58 | win.SetStatus(""); | ||
59 | } else { | ||
60 | win.SetStatus("Error restarting grid server!!!"); | ||
61 | } | ||
62 | break; | ||
63 | |||
64 | case "shutdown_gridserver": | ||
65 | win.SetStatus("Shutting down grid server..."); | ||
66 | if(gridserverConn.ShutdownServer()) { | ||
67 | win.SetStatus("Grid server shutdown"); | ||
68 | win.SetGridServerConnected(false); | ||
69 | Thread.Sleep(3000); | ||
70 | win.SetStatus(""); | ||
71 | } else { | ||
72 | win.SetStatus("Could not shutdown grid server!!!"); | ||
73 | } | ||
74 | break; | ||
75 | |||
76 | case "disconnect_gridserver": | ||
77 | gridserverConn.DisconnectServer(); | ||
78 | win.SetGridServerConnected(false); | ||
79 | break; | ||
80 | } | ||
81 | } | ||
82 | } | ||
83 | |||
84 | public static void Main (string[] args) | ||
85 | { | ||
86 | gridserverConn = new GridServerConnectionManager(); | ||
87 | Application.Init (); | ||
88 | win = new MainWindow (); | ||
89 | win.Show (); | ||
90 | OperationsRunner = new Thread(new ThreadStart(RunOperations)); | ||
91 | OperationsRunner.IsBackground=true; | ||
92 | OperationsRunner.Start(); | ||
93 | DoMainLoop(); | ||
94 | } | ||
95 | } | ||
96 | } \ No newline at end of file | ||
diff --git a/OpenSim/Grid/Manager/OpenGridServices.Manager/MainWindow.cs b/OpenSim/Grid/Manager/OpenGridServices.Manager/MainWindow.cs new file mode 100644 index 0000000..1db38f0 --- /dev/null +++ b/OpenSim/Grid/Manager/OpenGridServices.Manager/MainWindow.cs | |||
@@ -0,0 +1,76 @@ | |||
1 | using System; | ||
2 | using Gtk; | ||
3 | |||
4 | namespace OpenGridServices.Manager { | ||
5 | public partial class MainWindow: Gtk.Window | ||
6 | { | ||
7 | public MainWindow (): base (Gtk.WindowType.Toplevel) | ||
8 | { | ||
9 | Build (); | ||
10 | } | ||
11 | |||
12 | public void SetStatus(string statustext) | ||
13 | { | ||
14 | this.statusbar1.Pop(0); | ||
15 | this.statusbar1.Push(0,statustext); | ||
16 | } | ||
17 | |||
18 | public void DrawGrid(RegionBlock[][] regions) | ||
19 | { | ||
20 | for(int x=0; x<=regions.GetUpperBound(0); x++) { | ||
21 | for(int y=0; y<=regions.GetUpperBound(1); y++) { | ||
22 | Gdk.Image themap = new Gdk.Image(Gdk.ImageType.Fastest,Gdk.Visual.System,256,256); | ||
23 | this.drawingarea1.GdkWindow.DrawImage(new Gdk.GC(this.drawingarea1.GdkWindow),themap,0,0,x*256,y*256,256,256); | ||
24 | } | ||
25 | } | ||
26 | } | ||
27 | |||
28 | public void SetGridServerConnected(bool connected) | ||
29 | { | ||
30 | if(connected) { | ||
31 | this.ConnectToGridserver.Visible=false; | ||
32 | this.DisconnectFromGridServer.Visible=true; | ||
33 | } else { | ||
34 | this.ConnectToGridserver.Visible=true; | ||
35 | this.DisconnectFromGridServer.Visible=false; | ||
36 | } | ||
37 | } | ||
38 | |||
39 | protected void OnDeleteEvent (object sender, DeleteEventArgs a) | ||
40 | { | ||
41 | Application.Quit (); | ||
42 | MainClass.QuitReq=true; | ||
43 | a.RetVal = true; | ||
44 | } | ||
45 | |||
46 | protected virtual void QuitMenu(object sender, System.EventArgs e) | ||
47 | { | ||
48 | MainClass.QuitReq=true; | ||
49 | Application.Quit(); | ||
50 | } | ||
51 | |||
52 | protected virtual void ConnectToGridServerMenu(object sender, System.EventArgs e) | ||
53 | { | ||
54 | ConnectToGridServerDialog griddialog = new ConnectToGridServerDialog (); | ||
55 | griddialog.Show(); | ||
56 | } | ||
57 | |||
58 | protected virtual void RestartGridserverMenu(object sender, System.EventArgs e) | ||
59 | { | ||
60 | MainClass.PendingOperations.Enqueue("restart_gridserver"); | ||
61 | } | ||
62 | |||
63 | protected virtual void ShutdownGridserverMenu(object sender, System.EventArgs e) | ||
64 | { | ||
65 | MainClass.PendingOperations.Enqueue("shutdown_gridserver"); | ||
66 | } | ||
67 | |||
68 | protected virtual void DisconnectGridServerMenu(object sender, System.EventArgs e) | ||
69 | { | ||
70 | MainClass.PendingOperations.Enqueue("disconnect_gridserver"); | ||
71 | } | ||
72 | |||
73 | } | ||
74 | } | ||
75 | |||
76 | \ No newline at end of file | ||
diff --git a/OpenSim/Grid/Manager/OpenGridServices.Manager/OpenGridServices.Manager.mdp b/OpenSim/Grid/Manager/OpenGridServices.Manager/OpenGridServices.Manager.mdp new file mode 100644 index 0000000..cfdc085 --- /dev/null +++ b/OpenSim/Grid/Manager/OpenGridServices.Manager/OpenGridServices.Manager.mdp | |||
@@ -0,0 +1,43 @@ | |||
1 | <Project name="OpenGridServices.Manager" fileversion="2.0" language="C#" clr-version="Net_2_0" ctype="DotNetProject"> | ||
2 | <Configurations active="Debug"> | ||
3 | <Configuration name="Debug" ctype="DotNetProjectConfiguration"> | ||
4 | <Output directory="./bin/Debug" assembly="OpenGridServices.Manager" /> | ||
5 | <Build debugmode="True" target="Exe" /> | ||
6 | <Execution runwithwarnings="True" consolepause="True" runtime="MsNet" clr-version="Net_2_0" /> | ||
7 | <CodeGeneration compiler="Mcs" warninglevel="4" optimize="True" unsafecodeallowed="False" generateoverflowchecks="True" generatexmldocumentation="False" ctype="CSharpCompilerParameters" /> | ||
8 | </Configuration> | ||
9 | <Configuration name="Release" ctype="DotNetProjectConfiguration"> | ||
10 | <Output directory="./bin/Release" assembly="OpenGridServices.Manager" /> | ||
11 | <Build debugmode="False" target="Exe" /> | ||
12 | <Execution runwithwarnings="True" consolepause="True" runtime="MsNet" clr-version="Net_2_0" /> | ||
13 | <CodeGeneration compiler="Mcs" warninglevel="4" optimize="True" unsafecodeallowed="False" generateoverflowchecks="True" generatexmldocumentation="False" ctype="CSharpCompilerParameters" /> | ||
14 | </Configuration> | ||
15 | </Configurations> | ||
16 | <Contents> | ||
17 | <File name="./gtk-gui/gui.stetic" subtype="Code" buildaction="EmbedAsResource" /> | ||
18 | <File name="./gtk-gui/generated.cs" subtype="Code" buildaction="Compile" /> | ||
19 | <File name="./MainWindow.cs" subtype="Code" buildaction="Compile" /> | ||
20 | <File name="./Main.cs" subtype="Code" buildaction="Compile" /> | ||
21 | <File name="./AssemblyInfo.cs" subtype="Code" buildaction="Compile" /> | ||
22 | <File name="./ConnectToGridServerDialog.cs" subtype="Code" buildaction="Compile" /> | ||
23 | <File name="./Util.cs" subtype="Code" buildaction="Compile" /> | ||
24 | <File name="./gtk-gui/OpenGridServices.Manager.MainWindow.cs" subtype="Code" buildaction="Compile" /> | ||
25 | <File name="./BlockingQueue.cs" subtype="Code" buildaction="Compile" /> | ||
26 | <File name="./gtk-gui/OpenGridServices.Manager.ConnectToGridServerDialog.cs" subtype="Code" buildaction="Compile" /> | ||
27 | <File name="./GridServerConnectionManager.cs" subtype="Code" buildaction="Compile" /> | ||
28 | <File name="./RegionBlock.cs" subtype="Code" buildaction="Compile" /> | ||
29 | </Contents> | ||
30 | <References> | ||
31 | <ProjectReference type="Gac" localcopy="True" refto="gtk-sharp, Version=2.4.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> | ||
32 | <ProjectReference type="Gac" localcopy="True" refto="gdk-sharp, Version=2.4.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> | ||
33 | <ProjectReference type="Gac" localcopy="True" refto="glib-sharp, Version=2.4.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> | ||
34 | <ProjectReference type="Gac" localcopy="True" refto="glade-sharp, Version=2.4.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> | ||
35 | <ProjectReference type="Gac" localcopy="True" refto="pango-sharp, Version=2.4.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> | ||
36 | <ProjectReference type="Assembly" localcopy="True" refto="../../bin/libsecondlife.dll" /> | ||
37 | <ProjectReference type="Gac" localcopy="True" refto="System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> | ||
38 | <ProjectReference type="Gac" localcopy="True" refto="Mono.Posix, Version=2.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" /> | ||
39 | <ProjectReference type="Assembly" localcopy="True" refto="../../bin/XMLRPC.dll" /> | ||
40 | <ProjectReference type="Gac" localcopy="True" refto="System.Xml, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> | ||
41 | </References> | ||
42 | <GtkDesignInfo partialTypes="True" /> | ||
43 | </Project> \ No newline at end of file | ||
diff --git a/OpenSim/Grid/Manager/OpenGridServices.Manager/OpenGridServices.Manager.pidb b/OpenSim/Grid/Manager/OpenGridServices.Manager/OpenGridServices.Manager.pidb new file mode 100644 index 0000000..44e7a61 --- /dev/null +++ b/OpenSim/Grid/Manager/OpenGridServices.Manager/OpenGridServices.Manager.pidb | |||
Binary files differ | |||
diff --git a/OpenSim/Grid/Manager/OpenGridServices.Manager/RegionBlock.cs b/OpenSim/Grid/Manager/OpenGridServices.Manager/RegionBlock.cs new file mode 100644 index 0000000..00f7c65 --- /dev/null +++ b/OpenSim/Grid/Manager/OpenGridServices.Manager/RegionBlock.cs | |||
@@ -0,0 +1,37 @@ | |||
1 | using System; | ||
2 | using System.Xml; | ||
3 | using libsecondlife; | ||
4 | using OpenSim.Framework.Utilities; | ||
5 | |||
6 | namespace OpenGridServices.Manager | ||
7 | { | ||
8 | |||
9 | |||
10 | public class RegionBlock | ||
11 | { | ||
12 | public uint regloc_x; | ||
13 | public uint regloc_y; | ||
14 | |||
15 | public string httpd_url; | ||
16 | |||
17 | public string region_name; | ||
18 | |||
19 | public ulong regionhandle { | ||
20 | get { return Util.UIntsToLong(regloc_x*256,regloc_y*256); } | ||
21 | } | ||
22 | |||
23 | public Gdk.Pixbuf MiniMap; | ||
24 | |||
25 | public RegionBlock() | ||
26 | { | ||
27 | } | ||
28 | |||
29 | public void LoadFromXmlNode(XmlNode sourcenode) | ||
30 | { | ||
31 | this.regloc_x=Convert.ToUInt32(sourcenode.Attributes.GetNamedItem("loc_x").Value); | ||
32 | this.regloc_y=Convert.ToUInt32(sourcenode.Attributes.GetNamedItem("loc_y").Value); | ||
33 | this.region_name=sourcenode.Attributes.GetNamedItem("region_name").Value; | ||
34 | this.httpd_url=sourcenode.Attributes.GetNamedItem("httpd_url").Value; | ||
35 | } | ||
36 | } | ||
37 | } | ||
diff --git a/OpenSim/Grid/Manager/OpenGridServices.Manager/Util.cs b/OpenSim/Grid/Manager/OpenGridServices.Manager/Util.cs new file mode 100644 index 0000000..5bf7ff9 --- /dev/null +++ b/OpenSim/Grid/Manager/OpenGridServices.Manager/Util.cs | |||
@@ -0,0 +1,133 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | using libsecondlife; | ||
5 | using libsecondlife.Packets; | ||
6 | |||
7 | namespace OpenSim.Framework.Utilities | ||
8 | { | ||
9 | public class Util | ||
10 | { | ||
11 | private static Random randomClass = new Random(); | ||
12 | private static uint nextXferID = 5000; | ||
13 | private static object XferLock = new object(); | ||
14 | |||
15 | public static ulong UIntsToLong(uint X, uint Y) | ||
16 | { | ||
17 | return Helpers.UIntsToLong(X, Y); | ||
18 | } | ||
19 | |||
20 | public static Random RandomClass | ||
21 | { | ||
22 | get | ||
23 | { | ||
24 | return randomClass; | ||
25 | } | ||
26 | } | ||
27 | |||
28 | public static uint GetNextXferID() | ||
29 | { | ||
30 | uint id = 0; | ||
31 | lock(XferLock) | ||
32 | { | ||
33 | id = nextXferID; | ||
34 | nextXferID++; | ||
35 | } | ||
36 | return id; | ||
37 | } | ||
38 | |||
39 | //public static int fast_distance2d(int x, int y) | ||
40 | //{ | ||
41 | // x = System.Math.Abs(x); | ||
42 | // y = System.Math.Abs(y); | ||
43 | |||
44 | // int min = System.Math.Min(x, y); | ||
45 | |||
46 | // return (x + y - (min >> 1) - (min >> 2) + (min >> 4)); | ||
47 | //} | ||
48 | |||
49 | public static string FieldToString(byte[] bytes) | ||
50 | { | ||
51 | return FieldToString(bytes, String.Empty); | ||
52 | } | ||
53 | |||
54 | /// <summary> | ||
55 | /// Convert a variable length field (byte array) to a string, with a | ||
56 | /// field name prepended to each line of the output | ||
57 | /// </summary> | ||
58 | /// <remarks>If the byte array has unprintable characters in it, a | ||
59 | /// hex dump will be put in the string instead</remarks> | ||
60 | /// <param name="bytes">The byte array to convert to a string</param> | ||
61 | /// <param name="fieldName">A field name to prepend to each line of output</param> | ||
62 | /// <returns>An ASCII string or a string containing a hex dump, minus | ||
63 | /// the null terminator</returns> | ||
64 | public static string FieldToString(byte[] bytes, string fieldName) | ||
65 | { | ||
66 | // Check for a common case | ||
67 | if (bytes.Length == 0) return String.Empty; | ||
68 | |||
69 | StringBuilder output = new StringBuilder(); | ||
70 | bool printable = true; | ||
71 | |||
72 | for (int i = 0; i < bytes.Length; ++i) | ||
73 | { | ||
74 | // Check if there are any unprintable characters in the array | ||
75 | if ((bytes[i] < 0x20 || bytes[i] > 0x7E) && bytes[i] != 0x09 | ||
76 | && bytes[i] != 0x0D && bytes[i] != 0x0A && bytes[i] != 0x00) | ||
77 | { | ||
78 | printable = false; | ||
79 | break; | ||
80 | } | ||
81 | } | ||
82 | |||
83 | if (printable) | ||
84 | { | ||
85 | if (fieldName.Length > 0) | ||
86 | { | ||
87 | output.Append(fieldName); | ||
88 | output.Append(": "); | ||
89 | } | ||
90 | |||
91 | if (bytes[bytes.Length - 1] == 0x00) | ||
92 | output.Append(UTF8Encoding.UTF8.GetString(bytes, 0, bytes.Length - 1)); | ||
93 | else | ||
94 | output.Append(UTF8Encoding.UTF8.GetString(bytes)); | ||
95 | } | ||
96 | else | ||
97 | { | ||
98 | for (int i = 0; i < bytes.Length; i += 16) | ||
99 | { | ||
100 | if (i != 0) | ||
101 | output.Append(Environment.NewLine); | ||
102 | if (fieldName.Length > 0) | ||
103 | { | ||
104 | output.Append(fieldName); | ||
105 | output.Append(": "); | ||
106 | } | ||
107 | |||
108 | for (int j = 0; j < 16; j++) | ||
109 | { | ||
110 | if ((i + j) < bytes.Length) | ||
111 | output.Append(String.Format("{0:X2} ", bytes[i + j])); | ||
112 | else | ||
113 | output.Append(" "); | ||
114 | } | ||
115 | |||
116 | for (int j = 0; j < 16 && (i + j) < bytes.Length; j++) | ||
117 | { | ||
118 | if (bytes[i + j] >= 0x20 && bytes[i + j] < 0x7E) | ||
119 | output.Append((char)bytes[i + j]); | ||
120 | else | ||
121 | output.Append("."); | ||
122 | } | ||
123 | } | ||
124 | } | ||
125 | |||
126 | return output.ToString(); | ||
127 | } | ||
128 | public Util() | ||
129 | { | ||
130 | |||
131 | } | ||
132 | } | ||
133 | } | ||
diff --git a/OpenSim/Grid/Manager/OpenGridServices.Manager/gtk-gui/OpenGridServices.Manager.ConnectToGridServerDialog.cs b/OpenSim/Grid/Manager/OpenGridServices.Manager/gtk-gui/OpenGridServices.Manager.ConnectToGridServerDialog.cs new file mode 100644 index 0000000..da6739e --- /dev/null +++ b/OpenSim/Grid/Manager/OpenGridServices.Manager/gtk-gui/OpenGridServices.Manager.ConnectToGridServerDialog.cs | |||
@@ -0,0 +1,226 @@ | |||
1 | // ------------------------------------------------------------------------------ | ||
2 | // <autogenerated> | ||
3 | // This code was generated by a tool. | ||
4 | // Mono Runtime Version: 2.0.50727.42 | ||
5 | // | ||
6 | // Changes to this file may cause incorrect behavior and will be lost if | ||
7 | // the code is regenerated. | ||
8 | // </autogenerated> | ||
9 | // ------------------------------------------------------------------------------ | ||
10 | |||
11 | namespace OpenGridServices.Manager { | ||
12 | |||
13 | |||
14 | public partial class ConnectToGridServerDialog { | ||
15 | |||
16 | private Gtk.VBox vbox2; | ||
17 | |||
18 | private Gtk.VBox vbox3; | ||
19 | |||
20 | private Gtk.HBox hbox1; | ||
21 | |||
22 | private Gtk.Label label1; | ||
23 | |||
24 | private Gtk.Entry entry1; | ||
25 | |||
26 | private Gtk.HBox hbox2; | ||
27 | |||
28 | private Gtk.Label label2; | ||
29 | |||
30 | private Gtk.Entry entry2; | ||
31 | |||
32 | private Gtk.HBox hbox3; | ||
33 | |||
34 | private Gtk.Label label3; | ||
35 | |||
36 | private Gtk.Entry entry3; | ||
37 | |||
38 | private Gtk.Button button2; | ||
39 | |||
40 | private Gtk.Button button8; | ||
41 | |||
42 | protected virtual void Build() { | ||
43 | Stetic.Gui.Initialize(); | ||
44 | // Widget OpenGridServices.Manager.ConnectToGridServerDialog | ||
45 | this.Events = ((Gdk.EventMask)(256)); | ||
46 | this.Name = "OpenGridServices.Manager.ConnectToGridServerDialog"; | ||
47 | this.Title = Mono.Unix.Catalog.GetString("Connect to Grid server"); | ||
48 | this.WindowPosition = ((Gtk.WindowPosition)(4)); | ||
49 | this.HasSeparator = false; | ||
50 | // Internal child OpenGridServices.Manager.ConnectToGridServerDialog.VBox | ||
51 | Gtk.VBox w1 = this.VBox; | ||
52 | w1.Events = ((Gdk.EventMask)(256)); | ||
53 | w1.Name = "dialog_VBox"; | ||
54 | w1.BorderWidth = ((uint)(2)); | ||
55 | // Container child dialog_VBox.Gtk.Box+BoxChild | ||
56 | this.vbox2 = new Gtk.VBox(); | ||
57 | this.vbox2.Name = "vbox2"; | ||
58 | // Container child vbox2.Gtk.Box+BoxChild | ||
59 | this.vbox3 = new Gtk.VBox(); | ||
60 | this.vbox3.Name = "vbox3"; | ||
61 | // Container child vbox3.Gtk.Box+BoxChild | ||
62 | this.hbox1 = new Gtk.HBox(); | ||
63 | this.hbox1.Name = "hbox1"; | ||
64 | // Container child hbox1.Gtk.Box+BoxChild | ||
65 | this.label1 = new Gtk.Label(); | ||
66 | this.label1.Name = "label1"; | ||
67 | this.label1.Xalign = 1F; | ||
68 | this.label1.LabelProp = Mono.Unix.Catalog.GetString("Grid server URL: "); | ||
69 | this.label1.Justify = ((Gtk.Justification)(1)); | ||
70 | this.hbox1.Add(this.label1); | ||
71 | Gtk.Box.BoxChild w2 = ((Gtk.Box.BoxChild)(this.hbox1[this.label1])); | ||
72 | w2.Position = 0; | ||
73 | // Container child hbox1.Gtk.Box+BoxChild | ||
74 | this.entry1 = new Gtk.Entry(); | ||
75 | this.entry1.CanFocus = true; | ||
76 | this.entry1.Name = "entry1"; | ||
77 | this.entry1.Text = Mono.Unix.Catalog.GetString("http://gridserver:8001"); | ||
78 | this.entry1.IsEditable = true; | ||
79 | this.entry1.MaxLength = 255; | ||
80 | this.entry1.InvisibleChar = '•'; | ||
81 | this.hbox1.Add(this.entry1); | ||
82 | Gtk.Box.BoxChild w3 = ((Gtk.Box.BoxChild)(this.hbox1[this.entry1])); | ||
83 | w3.Position = 1; | ||
84 | this.vbox3.Add(this.hbox1); | ||
85 | Gtk.Box.BoxChild w4 = ((Gtk.Box.BoxChild)(this.vbox3[this.hbox1])); | ||
86 | w4.Position = 0; | ||
87 | w4.Expand = false; | ||
88 | w4.Fill = false; | ||
89 | // Container child vbox3.Gtk.Box+BoxChild | ||
90 | this.hbox2 = new Gtk.HBox(); | ||
91 | this.hbox2.Name = "hbox2"; | ||
92 | // Container child hbox2.Gtk.Box+BoxChild | ||
93 | this.label2 = new Gtk.Label(); | ||
94 | this.label2.Name = "label2"; | ||
95 | this.label2.Xalign = 1F; | ||
96 | this.label2.LabelProp = Mono.Unix.Catalog.GetString("Username:"); | ||
97 | this.label2.Justify = ((Gtk.Justification)(1)); | ||
98 | this.hbox2.Add(this.label2); | ||
99 | Gtk.Box.BoxChild w5 = ((Gtk.Box.BoxChild)(this.hbox2[this.label2])); | ||
100 | w5.Position = 0; | ||
101 | // Container child hbox2.Gtk.Box+BoxChild | ||
102 | this.entry2 = new Gtk.Entry(); | ||
103 | this.entry2.CanFocus = true; | ||
104 | this.entry2.Name = "entry2"; | ||
105 | this.entry2.IsEditable = true; | ||
106 | this.entry2.InvisibleChar = '•'; | ||
107 | this.hbox2.Add(this.entry2); | ||
108 | Gtk.Box.BoxChild w6 = ((Gtk.Box.BoxChild)(this.hbox2[this.entry2])); | ||
109 | w6.Position = 1; | ||
110 | this.vbox3.Add(this.hbox2); | ||
111 | Gtk.Box.BoxChild w7 = ((Gtk.Box.BoxChild)(this.vbox3[this.hbox2])); | ||
112 | w7.Position = 1; | ||
113 | w7.Expand = false; | ||
114 | w7.Fill = false; | ||
115 | // Container child vbox3.Gtk.Box+BoxChild | ||
116 | this.hbox3 = new Gtk.HBox(); | ||
117 | this.hbox3.Name = "hbox3"; | ||
118 | // Container child hbox3.Gtk.Box+BoxChild | ||
119 | this.label3 = new Gtk.Label(); | ||
120 | this.label3.Name = "label3"; | ||
121 | this.label3.Xalign = 1F; | ||
122 | this.label3.LabelProp = Mono.Unix.Catalog.GetString("Password:"); | ||
123 | this.label3.Justify = ((Gtk.Justification)(1)); | ||
124 | this.hbox3.Add(this.label3); | ||
125 | Gtk.Box.BoxChild w8 = ((Gtk.Box.BoxChild)(this.hbox3[this.label3])); | ||
126 | w8.Position = 0; | ||
127 | // Container child hbox3.Gtk.Box+BoxChild | ||
128 | this.entry3 = new Gtk.Entry(); | ||
129 | this.entry3.CanFocus = true; | ||
130 | this.entry3.Name = "entry3"; | ||
131 | this.entry3.IsEditable = true; | ||
132 | this.entry3.InvisibleChar = '•'; | ||
133 | this.hbox3.Add(this.entry3); | ||
134 | Gtk.Box.BoxChild w9 = ((Gtk.Box.BoxChild)(this.hbox3[this.entry3])); | ||
135 | w9.Position = 1; | ||
136 | this.vbox3.Add(this.hbox3); | ||
137 | Gtk.Box.BoxChild w10 = ((Gtk.Box.BoxChild)(this.vbox3[this.hbox3])); | ||
138 | w10.Position = 2; | ||
139 | w10.Expand = false; | ||
140 | w10.Fill = false; | ||
141 | this.vbox2.Add(this.vbox3); | ||
142 | Gtk.Box.BoxChild w11 = ((Gtk.Box.BoxChild)(this.vbox2[this.vbox3])); | ||
143 | w11.Position = 2; | ||
144 | w11.Expand = false; | ||
145 | w11.Fill = false; | ||
146 | w1.Add(this.vbox2); | ||
147 | Gtk.Box.BoxChild w12 = ((Gtk.Box.BoxChild)(w1[this.vbox2])); | ||
148 | w12.Position = 0; | ||
149 | // Internal child OpenGridServices.Manager.ConnectToGridServerDialog.ActionArea | ||
150 | Gtk.HButtonBox w13 = this.ActionArea; | ||
151 | w13.Events = ((Gdk.EventMask)(256)); | ||
152 | w13.Name = "OpenGridServices.Manager.ConnectToGridServerDialog_ActionArea"; | ||
153 | w13.Spacing = 6; | ||
154 | w13.BorderWidth = ((uint)(5)); | ||
155 | w13.LayoutStyle = ((Gtk.ButtonBoxStyle)(4)); | ||
156 | // Container child OpenGridServices.Manager.ConnectToGridServerDialog_ActionArea.Gtk.ButtonBox+ButtonBoxChild | ||
157 | this.button2 = new Gtk.Button(); | ||
158 | this.button2.CanDefault = true; | ||
159 | this.button2.CanFocus = true; | ||
160 | this.button2.Name = "button2"; | ||
161 | this.button2.UseUnderline = true; | ||
162 | // Container child button2.Gtk.Container+ContainerChild | ||
163 | Gtk.Alignment w14 = new Gtk.Alignment(0.5F, 0.5F, 0F, 0F); | ||
164 | w14.Name = "GtkAlignment"; | ||
165 | // Container child GtkAlignment.Gtk.Container+ContainerChild | ||
166 | Gtk.HBox w15 = new Gtk.HBox(); | ||
167 | w15.Name = "GtkHBox"; | ||
168 | w15.Spacing = 2; | ||
169 | // Container child GtkHBox.Gtk.Container+ContainerChild | ||
170 | Gtk.Image w16 = new Gtk.Image(); | ||
171 | w16.Name = "image1"; | ||
172 | w16.Pixbuf = Gtk.IconTheme.Default.LoadIcon("gtk-apply", 16, 0); | ||
173 | w15.Add(w16); | ||
174 | // Container child GtkHBox.Gtk.Container+ContainerChild | ||
175 | Gtk.Label w18 = new Gtk.Label(); | ||
176 | w18.Name = "GtkLabel"; | ||
177 | w18.LabelProp = Mono.Unix.Catalog.GetString("Connect"); | ||
178 | w18.UseUnderline = true; | ||
179 | w15.Add(w18); | ||
180 | w14.Add(w15); | ||
181 | this.button2.Add(w14); | ||
182 | this.AddActionWidget(this.button2, -5); | ||
183 | Gtk.ButtonBox.ButtonBoxChild w22 = ((Gtk.ButtonBox.ButtonBoxChild)(w13[this.button2])); | ||
184 | w22.Expand = false; | ||
185 | w22.Fill = false; | ||
186 | // Container child OpenGridServices.Manager.ConnectToGridServerDialog_ActionArea.Gtk.ButtonBox+ButtonBoxChild | ||
187 | this.button8 = new Gtk.Button(); | ||
188 | this.button8.CanDefault = true; | ||
189 | this.button8.CanFocus = true; | ||
190 | this.button8.Name = "button8"; | ||
191 | this.button8.UseUnderline = true; | ||
192 | // Container child button8.Gtk.Container+ContainerChild | ||
193 | Gtk.Alignment w23 = new Gtk.Alignment(0.5F, 0.5F, 0F, 0F); | ||
194 | w23.Name = "GtkAlignment1"; | ||
195 | // Container child GtkAlignment1.Gtk.Container+ContainerChild | ||
196 | Gtk.HBox w24 = new Gtk.HBox(); | ||
197 | w24.Name = "GtkHBox1"; | ||
198 | w24.Spacing = 2; | ||
199 | // Container child GtkHBox1.Gtk.Container+ContainerChild | ||
200 | Gtk.Image w25 = new Gtk.Image(); | ||
201 | w25.Name = "image2"; | ||
202 | w25.Pixbuf = Gtk.IconTheme.Default.LoadIcon("gtk-cancel", 16, 0); | ||
203 | w24.Add(w25); | ||
204 | // Container child GtkHBox1.Gtk.Container+ContainerChild | ||
205 | Gtk.Label w27 = new Gtk.Label(); | ||
206 | w27.Name = "GtkLabel1"; | ||
207 | w27.LabelProp = Mono.Unix.Catalog.GetString("Cancel"); | ||
208 | w27.UseUnderline = true; | ||
209 | w24.Add(w27); | ||
210 | w23.Add(w24); | ||
211 | this.button8.Add(w23); | ||
212 | this.AddActionWidget(this.button8, -6); | ||
213 | Gtk.ButtonBox.ButtonBoxChild w31 = ((Gtk.ButtonBox.ButtonBoxChild)(w13[this.button8])); | ||
214 | w31.Position = 1; | ||
215 | w31.Expand = false; | ||
216 | w31.Fill = false; | ||
217 | if ((this.Child != null)) { | ||
218 | this.Child.ShowAll(); | ||
219 | } | ||
220 | this.DefaultWidth = 476; | ||
221 | this.DefaultHeight = 137; | ||
222 | this.Show(); | ||
223 | this.Response += new Gtk.ResponseHandler(this.OnResponse); | ||
224 | } | ||
225 | } | ||
226 | } | ||
diff --git a/OpenSim/Grid/Manager/OpenGridServices.Manager/gtk-gui/OpenGridServices.Manager.MainWindow.cs b/OpenSim/Grid/Manager/OpenGridServices.Manager/gtk-gui/OpenGridServices.Manager.MainWindow.cs new file mode 100644 index 0000000..8798dac --- /dev/null +++ b/OpenSim/Grid/Manager/OpenGridServices.Manager/gtk-gui/OpenGridServices.Manager.MainWindow.cs | |||
@@ -0,0 +1,256 @@ | |||
1 | // ------------------------------------------------------------------------------ | ||
2 | // <autogenerated> | ||
3 | // This code was generated by a tool. | ||
4 | // Mono Runtime Version: 2.0.50727.42 | ||
5 | // | ||
6 | // Changes to this file may cause incorrect behavior and will be lost if | ||
7 | // the code is regenerated. | ||
8 | // </autogenerated> | ||
9 | // ------------------------------------------------------------------------------ | ||
10 | |||
11 | namespace OpenGridServices.Manager { | ||
12 | |||
13 | |||
14 | public partial class MainWindow { | ||
15 | |||
16 | private Gtk.Action Grid; | ||
17 | |||
18 | private Gtk.Action User; | ||
19 | |||
20 | private Gtk.Action Asset; | ||
21 | |||
22 | private Gtk.Action Region; | ||
23 | |||
24 | private Gtk.Action Services; | ||
25 | |||
26 | private Gtk.Action ConnectToGridserver; | ||
27 | |||
28 | private Gtk.Action RestartWholeGrid; | ||
29 | |||
30 | private Gtk.Action ShutdownWholeGrid; | ||
31 | |||
32 | private Gtk.Action ExitGridManager; | ||
33 | |||
34 | private Gtk.Action ConnectToUserserver; | ||
35 | |||
36 | private Gtk.Action AccountManagment; | ||
37 | |||
38 | private Gtk.Action GlobalNotice; | ||
39 | |||
40 | private Gtk.Action DisableAllLogins; | ||
41 | |||
42 | private Gtk.Action DisableNonGodUsersOnly; | ||
43 | |||
44 | private Gtk.Action ShutdownUserServer; | ||
45 | |||
46 | private Gtk.Action ShutdownGridserverOnly; | ||
47 | |||
48 | private Gtk.Action RestartGridserverOnly; | ||
49 | |||
50 | private Gtk.Action DefaultLocalGridUserserver; | ||
51 | |||
52 | private Gtk.Action CustomUserserver; | ||
53 | |||
54 | private Gtk.Action RemoteGridDefaultUserserver; | ||
55 | |||
56 | private Gtk.Action DisconnectFromGridServer; | ||
57 | |||
58 | private Gtk.Action UploadAsset; | ||
59 | |||
60 | private Gtk.Action AssetManagement; | ||
61 | |||
62 | private Gtk.Action ConnectToAssetServer; | ||
63 | |||
64 | private Gtk.Action ConnectToDefaultAssetServerForGrid; | ||
65 | |||
66 | private Gtk.Action DefaultForLocalGrid; | ||
67 | |||
68 | private Gtk.Action DefaultForRemoteGrid; | ||
69 | |||
70 | private Gtk.Action CustomAssetServer; | ||
71 | |||
72 | private Gtk.VBox vbox1; | ||
73 | |||
74 | private Gtk.MenuBar menubar2; | ||
75 | |||
76 | private Gtk.HBox hbox1; | ||
77 | |||
78 | private Gtk.ScrolledWindow scrolledwindow1; | ||
79 | |||
80 | private Gtk.DrawingArea drawingarea1; | ||
81 | |||
82 | private Gtk.TreeView treeview1; | ||
83 | |||
84 | private Gtk.Statusbar statusbar1; | ||
85 | |||
86 | protected virtual void Build() { | ||
87 | Stetic.Gui.Initialize(); | ||
88 | // Widget OpenGridServices.Manager.MainWindow | ||
89 | Gtk.UIManager w1 = new Gtk.UIManager(); | ||
90 | Gtk.ActionGroup w2 = new Gtk.ActionGroup("Default"); | ||
91 | this.Grid = new Gtk.Action("Grid", Mono.Unix.Catalog.GetString("Grid"), null, null); | ||
92 | this.Grid.HideIfEmpty = false; | ||
93 | this.Grid.ShortLabel = Mono.Unix.Catalog.GetString("Grid"); | ||
94 | w2.Add(this.Grid, "<Alt><Mod2>g"); | ||
95 | this.User = new Gtk.Action("User", Mono.Unix.Catalog.GetString("User"), null, null); | ||
96 | this.User.HideIfEmpty = false; | ||
97 | this.User.ShortLabel = Mono.Unix.Catalog.GetString("User"); | ||
98 | w2.Add(this.User, null); | ||
99 | this.Asset = new Gtk.Action("Asset", Mono.Unix.Catalog.GetString("Asset"), null, null); | ||
100 | this.Asset.HideIfEmpty = false; | ||
101 | this.Asset.ShortLabel = Mono.Unix.Catalog.GetString("Asset"); | ||
102 | w2.Add(this.Asset, null); | ||
103 | this.Region = new Gtk.Action("Region", Mono.Unix.Catalog.GetString("Region"), null, null); | ||
104 | this.Region.ShortLabel = Mono.Unix.Catalog.GetString("Region"); | ||
105 | w2.Add(this.Region, null); | ||
106 | this.Services = new Gtk.Action("Services", Mono.Unix.Catalog.GetString("Services"), null, null); | ||
107 | this.Services.ShortLabel = Mono.Unix.Catalog.GetString("Services"); | ||
108 | w2.Add(this.Services, null); | ||
109 | this.ConnectToGridserver = new Gtk.Action("ConnectToGridserver", Mono.Unix.Catalog.GetString("Connect to gridserver..."), null, "gtk-connect"); | ||
110 | this.ConnectToGridserver.HideIfEmpty = false; | ||
111 | this.ConnectToGridserver.ShortLabel = Mono.Unix.Catalog.GetString("Connect to gridserver"); | ||
112 | w2.Add(this.ConnectToGridserver, null); | ||
113 | this.RestartWholeGrid = new Gtk.Action("RestartWholeGrid", Mono.Unix.Catalog.GetString("Restart whole grid"), null, "gtk-refresh"); | ||
114 | this.RestartWholeGrid.ShortLabel = Mono.Unix.Catalog.GetString("Restart whole grid"); | ||
115 | w2.Add(this.RestartWholeGrid, null); | ||
116 | this.ShutdownWholeGrid = new Gtk.Action("ShutdownWholeGrid", Mono.Unix.Catalog.GetString("Shutdown whole grid"), null, "gtk-stop"); | ||
117 | this.ShutdownWholeGrid.ShortLabel = Mono.Unix.Catalog.GetString("Shutdown whole grid"); | ||
118 | w2.Add(this.ShutdownWholeGrid, null); | ||
119 | this.ExitGridManager = new Gtk.Action("ExitGridManager", Mono.Unix.Catalog.GetString("Exit grid manager"), null, "gtk-close"); | ||
120 | this.ExitGridManager.ShortLabel = Mono.Unix.Catalog.GetString("Exit grid manager"); | ||
121 | w2.Add(this.ExitGridManager, null); | ||
122 | this.ConnectToUserserver = new Gtk.Action("ConnectToUserserver", Mono.Unix.Catalog.GetString("Connect to userserver"), null, "gtk-connect"); | ||
123 | this.ConnectToUserserver.ShortLabel = Mono.Unix.Catalog.GetString("Connect to userserver"); | ||
124 | w2.Add(this.ConnectToUserserver, null); | ||
125 | this.AccountManagment = new Gtk.Action("AccountManagment", Mono.Unix.Catalog.GetString("Account managment"), null, "gtk-properties"); | ||
126 | this.AccountManagment.ShortLabel = Mono.Unix.Catalog.GetString("Account managment"); | ||
127 | w2.Add(this.AccountManagment, null); | ||
128 | this.GlobalNotice = new Gtk.Action("GlobalNotice", Mono.Unix.Catalog.GetString("Global notice"), null, "gtk-network"); | ||
129 | this.GlobalNotice.ShortLabel = Mono.Unix.Catalog.GetString("Global notice"); | ||
130 | w2.Add(this.GlobalNotice, null); | ||
131 | this.DisableAllLogins = new Gtk.Action("DisableAllLogins", Mono.Unix.Catalog.GetString("Disable all logins"), null, "gtk-no"); | ||
132 | this.DisableAllLogins.ShortLabel = Mono.Unix.Catalog.GetString("Disable all logins"); | ||
133 | w2.Add(this.DisableAllLogins, null); | ||
134 | this.DisableNonGodUsersOnly = new Gtk.Action("DisableNonGodUsersOnly", Mono.Unix.Catalog.GetString("Disable non-god users only"), null, "gtk-no"); | ||
135 | this.DisableNonGodUsersOnly.ShortLabel = Mono.Unix.Catalog.GetString("Disable non-god users only"); | ||
136 | w2.Add(this.DisableNonGodUsersOnly, null); | ||
137 | this.ShutdownUserServer = new Gtk.Action("ShutdownUserServer", Mono.Unix.Catalog.GetString("Shutdown user server"), null, "gtk-stop"); | ||
138 | this.ShutdownUserServer.ShortLabel = Mono.Unix.Catalog.GetString("Shutdown user server"); | ||
139 | w2.Add(this.ShutdownUserServer, null); | ||
140 | this.ShutdownGridserverOnly = new Gtk.Action("ShutdownGridserverOnly", Mono.Unix.Catalog.GetString("Shutdown gridserver only"), null, "gtk-stop"); | ||
141 | this.ShutdownGridserverOnly.ShortLabel = Mono.Unix.Catalog.GetString("Shutdown gridserver only"); | ||
142 | w2.Add(this.ShutdownGridserverOnly, null); | ||
143 | this.RestartGridserverOnly = new Gtk.Action("RestartGridserverOnly", Mono.Unix.Catalog.GetString("Restart gridserver only"), null, "gtk-refresh"); | ||
144 | this.RestartGridserverOnly.ShortLabel = Mono.Unix.Catalog.GetString("Restart gridserver only"); | ||
145 | w2.Add(this.RestartGridserverOnly, null); | ||
146 | this.DefaultLocalGridUserserver = new Gtk.Action("DefaultLocalGridUserserver", Mono.Unix.Catalog.GetString("Default local grid userserver"), null, null); | ||
147 | this.DefaultLocalGridUserserver.ShortLabel = Mono.Unix.Catalog.GetString("Default local grid userserver"); | ||
148 | w2.Add(this.DefaultLocalGridUserserver, null); | ||
149 | this.CustomUserserver = new Gtk.Action("CustomUserserver", Mono.Unix.Catalog.GetString("Custom userserver..."), null, null); | ||
150 | this.CustomUserserver.ShortLabel = Mono.Unix.Catalog.GetString("Custom userserver"); | ||
151 | w2.Add(this.CustomUserserver, null); | ||
152 | this.RemoteGridDefaultUserserver = new Gtk.Action("RemoteGridDefaultUserserver", Mono.Unix.Catalog.GetString("Remote grid default userserver..."), null, null); | ||
153 | this.RemoteGridDefaultUserserver.ShortLabel = Mono.Unix.Catalog.GetString("Remote grid default userserver"); | ||
154 | w2.Add(this.RemoteGridDefaultUserserver, null); | ||
155 | this.DisconnectFromGridServer = new Gtk.Action("DisconnectFromGridServer", Mono.Unix.Catalog.GetString("Disconnect from grid server"), null, "gtk-disconnect"); | ||
156 | this.DisconnectFromGridServer.ShortLabel = Mono.Unix.Catalog.GetString("Disconnect from grid server"); | ||
157 | this.DisconnectFromGridServer.Visible = false; | ||
158 | w2.Add(this.DisconnectFromGridServer, null); | ||
159 | this.UploadAsset = new Gtk.Action("UploadAsset", Mono.Unix.Catalog.GetString("Upload asset"), null, null); | ||
160 | this.UploadAsset.ShortLabel = Mono.Unix.Catalog.GetString("Upload asset"); | ||
161 | w2.Add(this.UploadAsset, null); | ||
162 | this.AssetManagement = new Gtk.Action("AssetManagement", Mono.Unix.Catalog.GetString("Asset management"), null, null); | ||
163 | this.AssetManagement.ShortLabel = Mono.Unix.Catalog.GetString("Asset management"); | ||
164 | w2.Add(this.AssetManagement, null); | ||
165 | this.ConnectToAssetServer = new Gtk.Action("ConnectToAssetServer", Mono.Unix.Catalog.GetString("Connect to asset server"), null, null); | ||
166 | this.ConnectToAssetServer.ShortLabel = Mono.Unix.Catalog.GetString("Connect to asset server"); | ||
167 | w2.Add(this.ConnectToAssetServer, null); | ||
168 | this.ConnectToDefaultAssetServerForGrid = new Gtk.Action("ConnectToDefaultAssetServerForGrid", Mono.Unix.Catalog.GetString("Connect to default asset server for grid"), null, null); | ||
169 | this.ConnectToDefaultAssetServerForGrid.ShortLabel = Mono.Unix.Catalog.GetString("Connect to default asset server for grid"); | ||
170 | w2.Add(this.ConnectToDefaultAssetServerForGrid, null); | ||
171 | this.DefaultForLocalGrid = new Gtk.Action("DefaultForLocalGrid", Mono.Unix.Catalog.GetString("Default for local grid"), null, null); | ||
172 | this.DefaultForLocalGrid.ShortLabel = Mono.Unix.Catalog.GetString("Default for local grid"); | ||
173 | w2.Add(this.DefaultForLocalGrid, null); | ||
174 | this.DefaultForRemoteGrid = new Gtk.Action("DefaultForRemoteGrid", Mono.Unix.Catalog.GetString("Default for remote grid..."), null, null); | ||
175 | this.DefaultForRemoteGrid.ShortLabel = Mono.Unix.Catalog.GetString("Default for remote grid..."); | ||
176 | w2.Add(this.DefaultForRemoteGrid, null); | ||
177 | this.CustomAssetServer = new Gtk.Action("CustomAssetServer", Mono.Unix.Catalog.GetString("Custom asset server..."), null, null); | ||
178 | this.CustomAssetServer.ShortLabel = Mono.Unix.Catalog.GetString("Custom asset server..."); | ||
179 | w2.Add(this.CustomAssetServer, null); | ||
180 | w1.InsertActionGroup(w2, 0); | ||
181 | this.AddAccelGroup(w1.AccelGroup); | ||
182 | this.WidthRequest = 800; | ||
183 | this.HeightRequest = 600; | ||
184 | this.Name = "OpenGridServices.Manager.MainWindow"; | ||
185 | this.Title = Mono.Unix.Catalog.GetString("Open Grid Services Manager"); | ||
186 | this.Icon = Gtk.IconTheme.Default.LoadIcon("gtk-network", 48, 0); | ||
187 | // Container child OpenGridServices.Manager.MainWindow.Gtk.Container+ContainerChild | ||
188 | this.vbox1 = new Gtk.VBox(); | ||
189 | this.vbox1.Name = "vbox1"; | ||
190 | // Container child vbox1.Gtk.Box+BoxChild | ||
191 | w1.AddUiFromString("<ui><menubar name='menubar2'><menu action='Grid'><menuitem action='ConnectToGridserver'/><menuitem action='DisconnectFromGridServer'/><separator/><menuitem action='RestartWholeGrid'/><menuitem action='RestartGridserverOnly'/><separator/><menuitem action='ShutdownWholeGrid'/><menuitem action='ShutdownGridserverOnly'/><separator/><menuitem action='ExitGridManager'/></menu><menu action='User'><menu action='ConnectToUserserver'><menuitem action='DefaultLocalGridUserserver'/><menuitem action='CustomUserserver'/><menuitem action='RemoteGridDefaultUserserver'/></menu><separator/><menuitem action='AccountManagment'/><menuitem action='GlobalNotice'/><separator/><menuitem action='DisableAllLogins'/><menuitem action='DisableNonGodUsersOnly'/><separator/><menuitem action='ShutdownUserServer'/></menu><menu action='Asset'><menuitem action='UploadAsset'/><menuitem action='AssetManagement'/><menu action='ConnectToAssetServer'><menuitem action='DefaultForLocalGrid'/><menuitem action='DefaultForRemoteGrid'/><menuitem action='CustomAssetServer'/></menu></menu><menu action='Region'/><menu action='Services'/></menubar></ui>"); | ||
192 | this.menubar2 = ((Gtk.MenuBar)(w1.GetWidget("/menubar2"))); | ||
193 | this.menubar2.HeightRequest = 25; | ||
194 | this.menubar2.Name = "menubar2"; | ||
195 | this.vbox1.Add(this.menubar2); | ||
196 | Gtk.Box.BoxChild w3 = ((Gtk.Box.BoxChild)(this.vbox1[this.menubar2])); | ||
197 | w3.Position = 0; | ||
198 | w3.Expand = false; | ||
199 | w3.Fill = false; | ||
200 | // Container child vbox1.Gtk.Box+BoxChild | ||
201 | this.hbox1 = new Gtk.HBox(); | ||
202 | this.hbox1.Name = "hbox1"; | ||
203 | // Container child hbox1.Gtk.Box+BoxChild | ||
204 | this.scrolledwindow1 = new Gtk.ScrolledWindow(); | ||
205 | this.scrolledwindow1.CanFocus = true; | ||
206 | this.scrolledwindow1.Name = "scrolledwindow1"; | ||
207 | this.scrolledwindow1.VscrollbarPolicy = ((Gtk.PolicyType)(1)); | ||
208 | this.scrolledwindow1.HscrollbarPolicy = ((Gtk.PolicyType)(1)); | ||
209 | // Container child scrolledwindow1.Gtk.Container+ContainerChild | ||
210 | Gtk.Viewport w4 = new Gtk.Viewport(); | ||
211 | w4.Name = "GtkViewport"; | ||
212 | w4.ShadowType = ((Gtk.ShadowType)(0)); | ||
213 | // Container child GtkViewport.Gtk.Container+ContainerChild | ||
214 | this.drawingarea1 = new Gtk.DrawingArea(); | ||
215 | this.drawingarea1.Name = "drawingarea1"; | ||
216 | w4.Add(this.drawingarea1); | ||
217 | this.scrolledwindow1.Add(w4); | ||
218 | this.hbox1.Add(this.scrolledwindow1); | ||
219 | Gtk.Box.BoxChild w7 = ((Gtk.Box.BoxChild)(this.hbox1[this.scrolledwindow1])); | ||
220 | w7.Position = 1; | ||
221 | // Container child hbox1.Gtk.Box+BoxChild | ||
222 | this.treeview1 = new Gtk.TreeView(); | ||
223 | this.treeview1.CanFocus = true; | ||
224 | this.treeview1.Name = "treeview1"; | ||
225 | this.hbox1.Add(this.treeview1); | ||
226 | Gtk.Box.BoxChild w8 = ((Gtk.Box.BoxChild)(this.hbox1[this.treeview1])); | ||
227 | w8.Position = 2; | ||
228 | this.vbox1.Add(this.hbox1); | ||
229 | Gtk.Box.BoxChild w9 = ((Gtk.Box.BoxChild)(this.vbox1[this.hbox1])); | ||
230 | w9.Position = 1; | ||
231 | // Container child vbox1.Gtk.Box+BoxChild | ||
232 | this.statusbar1 = new Gtk.Statusbar(); | ||
233 | this.statusbar1.Name = "statusbar1"; | ||
234 | this.statusbar1.Spacing = 5; | ||
235 | this.vbox1.Add(this.statusbar1); | ||
236 | Gtk.Box.BoxChild w10 = ((Gtk.Box.BoxChild)(this.vbox1[this.statusbar1])); | ||
237 | w10.PackType = ((Gtk.PackType)(1)); | ||
238 | w10.Position = 2; | ||
239 | w10.Expand = false; | ||
240 | w10.Fill = false; | ||
241 | this.Add(this.vbox1); | ||
242 | if ((this.Child != null)) { | ||
243 | this.Child.ShowAll(); | ||
244 | } | ||
245 | this.DefaultWidth = 800; | ||
246 | this.DefaultHeight = 800; | ||
247 | this.Show(); | ||
248 | this.DeleteEvent += new Gtk.DeleteEventHandler(this.OnDeleteEvent); | ||
249 | this.ConnectToGridserver.Activated += new System.EventHandler(this.ConnectToGridServerMenu); | ||
250 | this.ExitGridManager.Activated += new System.EventHandler(this.QuitMenu); | ||
251 | this.ShutdownGridserverOnly.Activated += new System.EventHandler(this.ShutdownGridserverMenu); | ||
252 | this.RestartGridserverOnly.Activated += new System.EventHandler(this.RestartGridserverMenu); | ||
253 | this.DisconnectFromGridServer.Activated += new System.EventHandler(this.DisconnectGridServerMenu); | ||
254 | } | ||
255 | } | ||
256 | } | ||
diff --git a/OpenSim/Grid/Manager/OpenGridServices.Manager/gtk-gui/generated.cs b/OpenSim/Grid/Manager/OpenGridServices.Manager/gtk-gui/generated.cs new file mode 100644 index 0000000..dd4abdd --- /dev/null +++ b/OpenSim/Grid/Manager/OpenGridServices.Manager/gtk-gui/generated.cs | |||
@@ -0,0 +1,35 @@ | |||
1 | // ------------------------------------------------------------------------------ | ||
2 | // <autogenerated> | ||
3 | // This code was generated by a tool. | ||
4 | // Mono Runtime Version: 2.0.50727.42 | ||
5 | // | ||
6 | // Changes to this file may cause incorrect behavior and will be lost if | ||
7 | // the code is regenerated. | ||
8 | // </autogenerated> | ||
9 | // ------------------------------------------------------------------------------ | ||
10 | |||
11 | namespace Stetic { | ||
12 | |||
13 | |||
14 | internal class Gui { | ||
15 | |||
16 | private static bool initialized; | ||
17 | |||
18 | internal static void Initialize() { | ||
19 | if ((Stetic.Gui.initialized == false)) { | ||
20 | Stetic.Gui.initialized = true; | ||
21 | } | ||
22 | } | ||
23 | } | ||
24 | |||
25 | internal class ActionGroups { | ||
26 | |||
27 | public static Gtk.ActionGroup GetActionGroup(System.Type type) { | ||
28 | return Stetic.ActionGroups.GetActionGroup(type.FullName); | ||
29 | } | ||
30 | |||
31 | public static Gtk.ActionGroup GetActionGroup(string name) { | ||
32 | return null; | ||
33 | } | ||
34 | } | ||
35 | } | ||
diff --git a/OpenSim/Grid/Manager/OpenGridServices.Manager/gtk-gui/gui.stetic b/OpenSim/Grid/Manager/OpenGridServices.Manager/gtk-gui/gui.stetic new file mode 100644 index 0000000..c883f08 --- /dev/null +++ b/OpenSim/Grid/Manager/OpenGridServices.Manager/gtk-gui/gui.stetic | |||
@@ -0,0 +1,502 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | ||
2 | <stetic-interface> | ||
3 | <widget class="Gtk.Window" id="OpenGridServices.Manager.MainWindow" design-size="800 800"> | ||
4 | <action-group name="Default"> | ||
5 | <action id="Grid"> | ||
6 | <property name="Type">Action</property> | ||
7 | <property name="Accelerator"><Alt><Mod2>g</property> | ||
8 | <property name="HideIfEmpty">False</property> | ||
9 | <property name="Label" translatable="yes">Grid</property> | ||
10 | <property name="ShortLabel" translatable="yes">Grid</property> | ||
11 | </action> | ||
12 | <action id="User"> | ||
13 | <property name="Type">Action</property> | ||
14 | <property name="HideIfEmpty">False</property> | ||
15 | <property name="Label" translatable="yes">User</property> | ||
16 | <property name="ShortLabel" translatable="yes">User</property> | ||
17 | </action> | ||
18 | <action id="Asset"> | ||
19 | <property name="Type">Action</property> | ||
20 | <property name="HideIfEmpty">False</property> | ||
21 | <property name="Label" translatable="yes">Asset</property> | ||
22 | <property name="ShortLabel" translatable="yes">Asset</property> | ||
23 | </action> | ||
24 | <action id="Region"> | ||
25 | <property name="Type">Action</property> | ||
26 | <property name="Label" translatable="yes">Region</property> | ||
27 | <property name="ShortLabel" translatable="yes">Region</property> | ||
28 | </action> | ||
29 | <action id="Services"> | ||
30 | <property name="Type">Action</property> | ||
31 | <property name="Label" translatable="yes">Services</property> | ||
32 | <property name="ShortLabel" translatable="yes">Services</property> | ||
33 | </action> | ||
34 | <action id="ConnectToGridserver"> | ||
35 | <property name="Type">Action</property> | ||
36 | <property name="HideIfEmpty">False</property> | ||
37 | <property name="Label" translatable="yes">Connect to gridserver...</property> | ||
38 | <property name="ShortLabel" translatable="yes">Connect to gridserver</property> | ||
39 | <property name="StockId">gtk-connect</property> | ||
40 | <signal name="Activated" handler="ConnectToGridServerMenu" /> | ||
41 | </action> | ||
42 | <action id="RestartWholeGrid"> | ||
43 | <property name="Type">Action</property> | ||
44 | <property name="Label" translatable="yes">Restart whole grid</property> | ||
45 | <property name="ShortLabel" translatable="yes">Restart whole grid</property> | ||
46 | <property name="StockId">gtk-refresh</property> | ||
47 | </action> | ||
48 | <action id="ShutdownWholeGrid"> | ||
49 | <property name="Type">Action</property> | ||
50 | <property name="Label" translatable="yes">Shutdown whole grid</property> | ||
51 | <property name="ShortLabel" translatable="yes">Shutdown whole grid</property> | ||
52 | <property name="StockId">gtk-stop</property> | ||
53 | </action> | ||
54 | <action id="ExitGridManager"> | ||
55 | <property name="Type">Action</property> | ||
56 | <property name="Label" translatable="yes">Exit grid manager</property> | ||
57 | <property name="ShortLabel" translatable="yes">Exit grid manager</property> | ||
58 | <property name="StockId">gtk-close</property> | ||
59 | <signal name="Activated" handler="QuitMenu" after="yes" /> | ||
60 | </action> | ||
61 | <action id="ConnectToUserserver"> | ||
62 | <property name="Type">Action</property> | ||
63 | <property name="Label" translatable="yes">Connect to userserver</property> | ||
64 | <property name="ShortLabel" translatable="yes">Connect to userserver</property> | ||
65 | <property name="StockId">gtk-connect</property> | ||
66 | </action> | ||
67 | <action id="AccountManagment"> | ||
68 | <property name="Type">Action</property> | ||
69 | <property name="Label" translatable="yes">Account managment</property> | ||
70 | <property name="ShortLabel" translatable="yes">Account managment</property> | ||
71 | <property name="StockId">gtk-properties</property> | ||
72 | </action> | ||
73 | <action id="GlobalNotice"> | ||
74 | <property name="Type">Action</property> | ||
75 | <property name="Label" translatable="yes">Global notice</property> | ||
76 | <property name="ShortLabel" translatable="yes">Global notice</property> | ||
77 | <property name="StockId">gtk-network</property> | ||
78 | </action> | ||
79 | <action id="DisableAllLogins"> | ||
80 | <property name="Type">Action</property> | ||
81 | <property name="Label" translatable="yes">Disable all logins</property> | ||
82 | <property name="ShortLabel" translatable="yes">Disable all logins</property> | ||
83 | <property name="StockId">gtk-no</property> | ||
84 | </action> | ||
85 | <action id="DisableNonGodUsersOnly"> | ||
86 | <property name="Type">Action</property> | ||
87 | <property name="Label" translatable="yes">Disable non-god users only</property> | ||
88 | <property name="ShortLabel" translatable="yes">Disable non-god users only</property> | ||
89 | <property name="StockId">gtk-no</property> | ||
90 | </action> | ||
91 | <action id="ShutdownUserServer"> | ||
92 | <property name="Type">Action</property> | ||
93 | <property name="Label" translatable="yes">Shutdown user server</property> | ||
94 | <property name="ShortLabel" translatable="yes">Shutdown user server</property> | ||
95 | <property name="StockId">gtk-stop</property> | ||
96 | </action> | ||
97 | <action id="ShutdownGridserverOnly"> | ||
98 | <property name="Type">Action</property> | ||
99 | <property name="Label" translatable="yes">Shutdown gridserver only</property> | ||
100 | <property name="ShortLabel" translatable="yes">Shutdown gridserver only</property> | ||
101 | <property name="StockId">gtk-stop</property> | ||
102 | <signal name="Activated" handler="ShutdownGridserverMenu" after="yes" /> | ||
103 | </action> | ||
104 | <action id="RestartGridserverOnly"> | ||
105 | <property name="Type">Action</property> | ||
106 | <property name="Label" translatable="yes">Restart gridserver only</property> | ||
107 | <property name="ShortLabel" translatable="yes">Restart gridserver only</property> | ||
108 | <property name="StockId">gtk-refresh</property> | ||
109 | <signal name="Activated" handler="RestartGridserverMenu" after="yes" /> | ||
110 | </action> | ||
111 | <action id="DefaultLocalGridUserserver"> | ||
112 | <property name="Type">Action</property> | ||
113 | <property name="Label" translatable="yes">Default local grid userserver</property> | ||
114 | <property name="ShortLabel" translatable="yes">Default local grid userserver</property> | ||
115 | </action> | ||
116 | <action id="CustomUserserver"> | ||
117 | <property name="Type">Action</property> | ||
118 | <property name="Label" translatable="yes">Custom userserver...</property> | ||
119 | <property name="ShortLabel" translatable="yes">Custom userserver</property> | ||
120 | </action> | ||
121 | <action id="RemoteGridDefaultUserserver"> | ||
122 | <property name="Type">Action</property> | ||
123 | <property name="Label" translatable="yes">Remote grid default userserver...</property> | ||
124 | <property name="ShortLabel" translatable="yes">Remote grid default userserver</property> | ||
125 | </action> | ||
126 | <action id="DisconnectFromGridServer"> | ||
127 | <property name="Type">Action</property> | ||
128 | <property name="Label" translatable="yes">Disconnect from grid server</property> | ||
129 | <property name="ShortLabel" translatable="yes">Disconnect from grid server</property> | ||
130 | <property name="StockId">gtk-disconnect</property> | ||
131 | <property name="Visible">False</property> | ||
132 | <signal name="Activated" handler="DisconnectGridServerMenu" after="yes" /> | ||
133 | </action> | ||
134 | <action id="UploadAsset"> | ||
135 | <property name="Type">Action</property> | ||
136 | <property name="Label" translatable="yes">Upload asset</property> | ||
137 | <property name="ShortLabel" translatable="yes">Upload asset</property> | ||
138 | </action> | ||
139 | <action id="AssetManagement"> | ||
140 | <property name="Type">Action</property> | ||
141 | <property name="Label" translatable="yes">Asset management</property> | ||
142 | <property name="ShortLabel" translatable="yes">Asset management</property> | ||
143 | </action> | ||
144 | <action id="ConnectToAssetServer"> | ||
145 | <property name="Type">Action</property> | ||
146 | <property name="Label" translatable="yes">Connect to asset server</property> | ||
147 | <property name="ShortLabel" translatable="yes">Connect to asset server</property> | ||
148 | </action> | ||
149 | <action id="ConnectToDefaultAssetServerForGrid"> | ||
150 | <property name="Type">Action</property> | ||
151 | <property name="Label" translatable="yes">Connect to default asset server for grid</property> | ||
152 | <property name="ShortLabel" translatable="yes">Connect to default asset server for grid</property> | ||
153 | </action> | ||
154 | <action id="DefaultForLocalGrid"> | ||
155 | <property name="Type">Action</property> | ||
156 | <property name="Label" translatable="yes">Default for local grid</property> | ||
157 | <property name="ShortLabel" translatable="yes">Default for local grid</property> | ||
158 | </action> | ||
159 | <action id="DefaultForRemoteGrid"> | ||
160 | <property name="Type">Action</property> | ||
161 | <property name="Label" translatable="yes">Default for remote grid...</property> | ||
162 | <property name="ShortLabel" translatable="yes">Default for remote grid...</property> | ||
163 | </action> | ||
164 | <action id="CustomAssetServer"> | ||
165 | <property name="Type">Action</property> | ||
166 | <property name="Label" translatable="yes">Custom asset server...</property> | ||
167 | <property name="ShortLabel" translatable="yes">Custom asset server...</property> | ||
168 | </action> | ||
169 | </action-group> | ||
170 | <property name="MemberName" /> | ||
171 | <property name="WidthRequest">800</property> | ||
172 | <property name="HeightRequest">600</property> | ||
173 | <property name="Title" translatable="yes">Open Grid Services Manager</property> | ||
174 | <property name="Icon">stock:gtk-network Dialog</property> | ||
175 | <signal name="DeleteEvent" handler="OnDeleteEvent" /> | ||
176 | <child> | ||
177 | <widget class="Gtk.VBox" id="vbox1"> | ||
178 | <property name="MemberName" /> | ||
179 | <child> | ||
180 | <widget class="Gtk.MenuBar" id="menubar2"> | ||
181 | <property name="MemberName" /> | ||
182 | <property name="HeightRequest">25</property> | ||
183 | <node name="menubar2" type="Menubar"> | ||
184 | <node type="Menu" action="Grid"> | ||
185 | <node type="Menuitem" action="ConnectToGridserver" /> | ||
186 | <node type="Menuitem" action="DisconnectFromGridServer" /> | ||
187 | <node type="Separator" /> | ||
188 | <node type="Menuitem" action="RestartWholeGrid" /> | ||
189 | <node type="Menuitem" action="RestartGridserverOnly" /> | ||
190 | <node type="Separator" /> | ||
191 | <node type="Menuitem" action="ShutdownWholeGrid" /> | ||
192 | <node type="Menuitem" action="ShutdownGridserverOnly" /> | ||
193 | <node type="Separator" /> | ||
194 | <node type="Menuitem" action="ExitGridManager" /> | ||
195 | </node> | ||
196 | <node type="Menu" action="User"> | ||
197 | <node type="Menu" action="ConnectToUserserver"> | ||
198 | <node type="Menuitem" action="DefaultLocalGridUserserver" /> | ||
199 | <node type="Menuitem" action="CustomUserserver" /> | ||
200 | <node type="Menuitem" action="RemoteGridDefaultUserserver" /> | ||
201 | </node> | ||
202 | <node type="Separator" /> | ||
203 | <node type="Menuitem" action="AccountManagment" /> | ||
204 | <node type="Menuitem" action="GlobalNotice" /> | ||
205 | <node type="Separator" /> | ||
206 | <node type="Menuitem" action="DisableAllLogins" /> | ||
207 | <node type="Menuitem" action="DisableNonGodUsersOnly" /> | ||
208 | <node type="Separator" /> | ||
209 | <node type="Menuitem" action="ShutdownUserServer" /> | ||
210 | </node> | ||
211 | <node type="Menu" action="Asset"> | ||
212 | <node type="Menuitem" action="UploadAsset" /> | ||
213 | <node type="Menuitem" action="AssetManagement" /> | ||
214 | <node type="Menu" action="ConnectToAssetServer"> | ||
215 | <node type="Menuitem" action="DefaultForLocalGrid" /> | ||
216 | <node type="Menuitem" action="DefaultForRemoteGrid" /> | ||
217 | <node type="Menuitem" action="CustomAssetServer" /> | ||
218 | </node> | ||
219 | </node> | ||
220 | <node type="Menu" action="Region" /> | ||
221 | <node type="Menu" action="Services" /> | ||
222 | </node> | ||
223 | </widget> | ||
224 | <packing> | ||
225 | <property name="Position">0</property> | ||
226 | <property name="AutoSize">False</property> | ||
227 | <property name="Expand">False</property> | ||
228 | <property name="Fill">False</property> | ||
229 | </packing> | ||
230 | </child> | ||
231 | <child> | ||
232 | <widget class="Gtk.HBox" id="hbox1"> | ||
233 | <property name="MemberName" /> | ||
234 | <child> | ||
235 | <placeholder /> | ||
236 | </child> | ||
237 | <child> | ||
238 | <widget class="Gtk.ScrolledWindow" id="scrolledwindow1"> | ||
239 | <property name="MemberName" /> | ||
240 | <property name="CanFocus">True</property> | ||
241 | <property name="VscrollbarPolicy">Automatic</property> | ||
242 | <property name="HscrollbarPolicy">Automatic</property> | ||
243 | <child> | ||
244 | <widget class="Gtk.Viewport" id="GtkViewport"> | ||
245 | <property name="MemberName" /> | ||
246 | <property name="ShadowType">None</property> | ||
247 | <child> | ||
248 | <widget class="Gtk.DrawingArea" id="drawingarea1"> | ||
249 | <property name="MemberName" /> | ||
250 | </widget> | ||
251 | </child> | ||
252 | </widget> | ||
253 | </child> | ||
254 | </widget> | ||
255 | <packing> | ||
256 | <property name="Position">1</property> | ||
257 | <property name="AutoSize">True</property> | ||
258 | </packing> | ||
259 | </child> | ||
260 | <child> | ||
261 | <widget class="Gtk.TreeView" id="treeview1"> | ||
262 | <property name="MemberName" /> | ||
263 | <property name="CanFocus">True</property> | ||
264 | </widget> | ||
265 | <packing> | ||
266 | <property name="Position">2</property> | ||
267 | <property name="AutoSize">True</property> | ||
268 | </packing> | ||
269 | </child> | ||
270 | </widget> | ||
271 | <packing> | ||
272 | <property name="Position">1</property> | ||
273 | <property name="AutoSize">True</property> | ||
274 | </packing> | ||
275 | </child> | ||
276 | <child> | ||
277 | <widget class="Gtk.Statusbar" id="statusbar1"> | ||
278 | <property name="MemberName">statusBar1</property> | ||
279 | <property name="Spacing">5</property> | ||
280 | <child> | ||
281 | <placeholder /> | ||
282 | </child> | ||
283 | <child> | ||
284 | <placeholder /> | ||
285 | </child> | ||
286 | </widget> | ||
287 | <packing> | ||
288 | <property name="PackType">End</property> | ||
289 | <property name="Position">2</property> | ||
290 | <property name="AutoSize">False</property> | ||
291 | <property name="Expand">False</property> | ||
292 | <property name="Fill">False</property> | ||
293 | </packing> | ||
294 | </child> | ||
295 | </widget> | ||
296 | </child> | ||
297 | </widget> | ||
298 | <widget class="Gtk.Dialog" id="OpenGridServices.Manager.ConnectToGridServerDialog" design-size="476 137"> | ||
299 | <property name="MemberName" /> | ||
300 | <property name="Events">ButtonPressMask</property> | ||
301 | <property name="Title" translatable="yes">Connect to Grid server</property> | ||
302 | <property name="WindowPosition">CenterOnParent</property> | ||
303 | <property name="Buttons">2</property> | ||
304 | <property name="HelpButton">False</property> | ||
305 | <property name="HasSeparator">False</property> | ||
306 | <signal name="Response" handler="OnResponse" /> | ||
307 | <child internal-child="VBox"> | ||
308 | <widget class="Gtk.VBox" id="dialog_VBox"> | ||
309 | <property name="MemberName" /> | ||
310 | <property name="Events">ButtonPressMask</property> | ||
311 | <property name="BorderWidth">2</property> | ||
312 | <child> | ||
313 | <widget class="Gtk.VBox" id="vbox2"> | ||
314 | <property name="MemberName" /> | ||
315 | <child> | ||
316 | <placeholder /> | ||
317 | </child> | ||
318 | <child> | ||
319 | <placeholder /> | ||
320 | </child> | ||
321 | <child> | ||
322 | <widget class="Gtk.VBox" id="vbox3"> | ||
323 | <property name="MemberName" /> | ||
324 | <child> | ||
325 | <widget class="Gtk.HBox" id="hbox1"> | ||
326 | <property name="MemberName" /> | ||
327 | <child> | ||
328 | <widget class="Gtk.Label" id="label1"> | ||
329 | <property name="MemberName" /> | ||
330 | <property name="Xalign">1</property> | ||
331 | <property name="LabelProp" translatable="yes">Grid server URL: </property> | ||
332 | <property name="Justify">Right</property> | ||
333 | </widget> | ||
334 | <packing> | ||
335 | <property name="Position">0</property> | ||
336 | <property name="AutoSize">False</property> | ||
337 | </packing> | ||
338 | </child> | ||
339 | <child> | ||
340 | <widget class="Gtk.Entry" id="entry1"> | ||
341 | <property name="MemberName" /> | ||
342 | <property name="CanFocus">True</property> | ||
343 | <property name="Text" translatable="yes">http://gridserver:8001</property> | ||
344 | <property name="IsEditable">True</property> | ||
345 | <property name="MaxLength">255</property> | ||
346 | <property name="InvisibleChar">•</property> | ||
347 | </widget> | ||
348 | <packing> | ||
349 | <property name="Position">1</property> | ||
350 | <property name="AutoSize">False</property> | ||
351 | </packing> | ||
352 | </child> | ||
353 | <child> | ||
354 | <placeholder /> | ||
355 | </child> | ||
356 | </widget> | ||
357 | <packing> | ||
358 | <property name="Position">0</property> | ||
359 | <property name="AutoSize">True</property> | ||
360 | <property name="Expand">False</property> | ||
361 | <property name="Fill">False</property> | ||
362 | </packing> | ||
363 | </child> | ||
364 | <child> | ||
365 | <widget class="Gtk.HBox" id="hbox2"> | ||
366 | <property name="MemberName" /> | ||
367 | <child> | ||
368 | <widget class="Gtk.Label" id="label2"> | ||
369 | <property name="MemberName" /> | ||
370 | <property name="Xalign">1</property> | ||
371 | <property name="LabelProp" translatable="yes">Username:</property> | ||
372 | <property name="Justify">Right</property> | ||
373 | </widget> | ||
374 | <packing> | ||
375 | <property name="Position">0</property> | ||
376 | <property name="AutoSize">False</property> | ||
377 | </packing> | ||
378 | </child> | ||
379 | <child> | ||
380 | <widget class="Gtk.Entry" id="entry2"> | ||
381 | <property name="MemberName" /> | ||
382 | <property name="CanFocus">True</property> | ||
383 | <property name="IsEditable">True</property> | ||
384 | <property name="InvisibleChar">•</property> | ||
385 | </widget> | ||
386 | <packing> | ||
387 | <property name="Position">1</property> | ||
388 | <property name="AutoSize">True</property> | ||
389 | </packing> | ||
390 | </child> | ||
391 | <child> | ||
392 | <placeholder /> | ||
393 | </child> | ||
394 | </widget> | ||
395 | <packing> | ||
396 | <property name="Position">1</property> | ||
397 | <property name="AutoSize">False</property> | ||
398 | <property name="Expand">False</property> | ||
399 | <property name="Fill">False</property> | ||
400 | </packing> | ||
401 | </child> | ||
402 | <child> | ||
403 | <widget class="Gtk.HBox" id="hbox3"> | ||
404 | <property name="MemberName" /> | ||
405 | <child> | ||
406 | <widget class="Gtk.Label" id="label3"> | ||
407 | <property name="MemberName" /> | ||
408 | <property name="Xalign">1</property> | ||
409 | <property name="LabelProp" translatable="yes">Password:</property> | ||
410 | <property name="Justify">Right</property> | ||
411 | </widget> | ||
412 | <packing> | ||
413 | <property name="Position">0</property> | ||
414 | <property name="AutoSize">False</property> | ||
415 | </packing> | ||
416 | </child> | ||
417 | <child> | ||
418 | <widget class="Gtk.Entry" id="entry3"> | ||
419 | <property name="MemberName" /> | ||
420 | <property name="CanFocus">True</property> | ||
421 | <property name="IsEditable">True</property> | ||
422 | <property name="InvisibleChar">•</property> | ||
423 | </widget> | ||
424 | <packing> | ||
425 | <property name="Position">1</property> | ||
426 | <property name="AutoSize">True</property> | ||
427 | </packing> | ||
428 | </child> | ||
429 | <child> | ||
430 | <placeholder /> | ||
431 | </child> | ||
432 | </widget> | ||
433 | <packing> | ||
434 | <property name="Position">2</property> | ||
435 | <property name="AutoSize">True</property> | ||
436 | <property name="Expand">False</property> | ||
437 | <property name="Fill">False</property> | ||
438 | </packing> | ||
439 | </child> | ||
440 | </widget> | ||
441 | <packing> | ||
442 | <property name="Position">2</property> | ||
443 | <property name="AutoSize">True</property> | ||
444 | <property name="Expand">False</property> | ||
445 | <property name="Fill">False</property> | ||
446 | </packing> | ||
447 | </child> | ||
448 | </widget> | ||
449 | <packing> | ||
450 | <property name="Position">0</property> | ||
451 | <property name="AutoSize">True</property> | ||
452 | </packing> | ||
453 | </child> | ||
454 | </widget> | ||
455 | </child> | ||
456 | <child internal-child="ActionArea"> | ||
457 | <widget class="Gtk.HButtonBox" id="OpenGridServices.Manager.ConnectToGridServerDialog_ActionArea"> | ||
458 | <property name="MemberName" /> | ||
459 | <property name="Events">ButtonPressMask</property> | ||
460 | <property name="Spacing">6</property> | ||
461 | <property name="BorderWidth">5</property> | ||
462 | <property name="Size">2</property> | ||
463 | <property name="LayoutStyle">End</property> | ||
464 | <child> | ||
465 | <widget class="Gtk.Button" id="button2"> | ||
466 | <property name="MemberName" /> | ||
467 | <property name="CanDefault">True</property> | ||
468 | <property name="CanFocus">True</property> | ||
469 | <property name="Type">TextAndIcon</property> | ||
470 | <property name="Icon">stock:gtk-apply Menu</property> | ||
471 | <property name="Label" translatable="yes">Connect</property> | ||
472 | <property name="UseUnderline">True</property> | ||
473 | <property name="IsDialogButton">True</property> | ||
474 | <property name="ResponseId">-5</property> | ||
475 | </widget> | ||
476 | <packing> | ||
477 | <property name="Expand">False</property> | ||
478 | <property name="Fill">False</property> | ||
479 | </packing> | ||
480 | </child> | ||
481 | <child> | ||
482 | <widget class="Gtk.Button" id="button8"> | ||
483 | <property name="MemberName" /> | ||
484 | <property name="CanDefault">True</property> | ||
485 | <property name="CanFocus">True</property> | ||
486 | <property name="Type">TextAndIcon</property> | ||
487 | <property name="Icon">stock:gtk-cancel Menu</property> | ||
488 | <property name="Label" translatable="yes">Cancel</property> | ||
489 | <property name="UseUnderline">True</property> | ||
490 | <property name="IsDialogButton">True</property> | ||
491 | <property name="ResponseId">-6</property> | ||
492 | </widget> | ||
493 | <packing> | ||
494 | <property name="Position">1</property> | ||
495 | <property name="Expand">False</property> | ||
496 | <property name="Fill">False</property> | ||
497 | </packing> | ||
498 | </child> | ||
499 | </widget> | ||
500 | </child> | ||
501 | </widget> | ||
502 | </stetic-interface> \ No newline at end of file | ||
diff --git a/OpenSim/Grid/UserServer.Config/AssemblyInfo.cs b/OpenSim/Grid/UserServer.Config/AssemblyInfo.cs new file mode 100644 index 0000000..15298e8 --- /dev/null +++ b/OpenSim/Grid/UserServer.Config/AssemblyInfo.cs | |||
@@ -0,0 +1,56 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.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 | using System.Reflection; | ||
29 | using System.Runtime.InteropServices; | ||
30 | // Information about this assembly is defined by the following | ||
31 | // attributes. | ||
32 | // | ||
33 | // change them to the information which is associated with the assembly | ||
34 | // you compile. | ||
35 | |||
36 | [assembly: AssemblyTitle("UserConfig")] | ||
37 | [assembly: AssemblyDescription("")] | ||
38 | [assembly: AssemblyConfiguration("")] | ||
39 | [assembly: AssemblyCompany("")] | ||
40 | [assembly: AssemblyProduct("UserConfig")] | ||
41 | [assembly: AssemblyCopyright("")] | ||
42 | [assembly: AssemblyTrademark("")] | ||
43 | [assembly: AssemblyCulture("")] | ||
44 | |||
45 | // This sets the default COM visibility of types in the assembly to invisible. | ||
46 | // If you need to expose a type to COM, use [ComVisible(true)] on that type. | ||
47 | [assembly: ComVisible(false)] | ||
48 | |||
49 | // The assembly version has following format : | ||
50 | // | ||
51 | // Major.Minor.Build.Revision | ||
52 | // | ||
53 | // You can specify all values by your own or you can build default build and revision | ||
54 | // numbers with the '*' character (the default): | ||
55 | |||
56 | [assembly: AssemblyVersion("1.0.*")] | ||
diff --git a/OpenSim/Grid/UserServer.Config/DbUserConfig.cs b/OpenSim/Grid/UserServer.Config/DbUserConfig.cs new file mode 100644 index 0000000..c7f8255 --- /dev/null +++ b/OpenSim/Grid/UserServer.Config/DbUserConfig.cs | |||
@@ -0,0 +1,95 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.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 | using System; | ||
29 | using Db4objects.Db4o; | ||
30 | using OpenSim.Framework.Console; | ||
31 | using OpenSim.Framework.Interfaces; | ||
32 | |||
33 | namespace OpenUser.Config.UserConfigDb4o | ||
34 | { | ||
35 | public class Db4oConfigPlugin: IUserConfig | ||
36 | { | ||
37 | public UserConfig GetConfigObject() | ||
38 | { | ||
39 | MainLog.Instance.Verbose("Loading Db40Config dll"); | ||
40 | return ( new DbUserConfig()); | ||
41 | } | ||
42 | } | ||
43 | |||
44 | public class DbUserConfig : UserConfig | ||
45 | { | ||
46 | private IObjectContainer db; | ||
47 | |||
48 | public void LoadDefaults() { | ||
49 | MainLog.Instance.Notice("Config.cs:LoadDefaults() - Please press enter to retain default or enter new settings"); | ||
50 | |||
51 | this.DefaultStartupMsg = MainLog.Instance.CmdPrompt("Default startup message", "Welcome to OGS"); | ||
52 | |||
53 | this.GridServerURL = MainLog.Instance.CmdPrompt("Grid server URL","http://127.0.0.1:8001/"); | ||
54 | this.GridSendKey = MainLog.Instance.CmdPrompt("Key to send to grid server","null"); | ||
55 | this.GridRecvKey = MainLog.Instance.CmdPrompt("Key to expect from grid server","null"); | ||
56 | } | ||
57 | |||
58 | public override void InitConfig() { | ||
59 | try { | ||
60 | db = Db4oFactory.OpenFile("openuser.yap"); | ||
61 | IObjectSet result = db.Get(typeof(DbUserConfig)); | ||
62 | if(result.Count==1) { | ||
63 | MainLog.Instance.Verbose("Config.cs:InitConfig() - Found a UserConfig object in the local database, loading"); | ||
64 | foreach (DbUserConfig cfg in result) { | ||
65 | this.GridServerURL=cfg.GridServerURL; | ||
66 | this.GridSendKey=cfg.GridSendKey; | ||
67 | this.GridRecvKey=cfg.GridRecvKey; | ||
68 | this.DefaultStartupMsg=cfg.DefaultStartupMsg; | ||
69 | } | ||
70 | } else { | ||
71 | MainLog.Instance.Verbose("Config.cs:InitConfig() - Could not find object in database, loading precompiled defaults"); | ||
72 | LoadDefaults(); | ||
73 | MainLog.Instance.Verbose("Writing out default settings to local database"); | ||
74 | db.Set(this); | ||
75 | db.Close(); | ||
76 | } | ||
77 | } catch(Exception e) { | ||
78 | MainLog.Instance.Warn("Config.cs:InitConfig() - Exception occured"); | ||
79 | MainLog.Instance.Warn(e.ToString()); | ||
80 | } | ||
81 | |||
82 | MainLog.Instance.Verbose("User settings loaded:"); | ||
83 | MainLog.Instance.Verbose("Default startup message: " + this.DefaultStartupMsg); | ||
84 | MainLog.Instance.Verbose("Grid server URL: " + this.GridServerURL); | ||
85 | MainLog.Instance.Verbose("Key to send to grid: " + this.GridSendKey); | ||
86 | MainLog.Instance.Verbose("Key to expect from grid: " + this.GridRecvKey); | ||
87 | } | ||
88 | |||
89 | |||
90 | public void Shutdown() { | ||
91 | db.Close(); | ||
92 | } | ||
93 | } | ||
94 | |||
95 | } | ||
diff --git a/OpenSim/Grid/UserServer/Main.cs b/OpenSim/Grid/UserServer/Main.cs new file mode 100644 index 0000000..c792918 --- /dev/null +++ b/OpenSim/Grid/UserServer/Main.cs | |||
@@ -0,0 +1,214 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.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 | |||
29 | using System; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Reflection; | ||
32 | using libsecondlife; | ||
33 | using OpenSim.Framework.Console; | ||
34 | using OpenSim.Framework.Interfaces; | ||
35 | using OpenSim.Framework.Servers; | ||
36 | using OpenSim.Framework.User; | ||
37 | using OpenSim.Framework.Utilities; | ||
38 | using OpenSim.GenericConfig; | ||
39 | |||
40 | namespace OpenSim.Grid.UserServer | ||
41 | { | ||
42 | /// <summary> | ||
43 | /// </summary> | ||
44 | public class OpenUser_Main : conscmd_callback | ||
45 | { | ||
46 | private string ConfigDll = "OpenSim.Grid.UserServer.Config.dll"; | ||
47 | private string StorageDll = "OpenSim.Framework.Data.MySQL.dll"; | ||
48 | private UserConfig Cfg; | ||
49 | protected IGenericConfig localXMLConfig; | ||
50 | |||
51 | public UserManager m_userManager; | ||
52 | |||
53 | public Dictionary<LLUUID, UserProfile> UserSessions = new Dictionary<LLUUID, UserProfile>(); | ||
54 | |||
55 | LogBase m_console; | ||
56 | |||
57 | [STAThread] | ||
58 | public static void Main(string[] args) | ||
59 | { | ||
60 | Console.WriteLine("Launching UserServer..."); | ||
61 | |||
62 | OpenUser_Main userserver = new OpenUser_Main(); | ||
63 | |||
64 | userserver.Startup(); | ||
65 | userserver.Work(); | ||
66 | } | ||
67 | |||
68 | private OpenUser_Main() | ||
69 | { | ||
70 | m_console = new LogBase("opengrid-userserver-console.log", "OpenUser", this , false); | ||
71 | MainLog.Instance = m_console; | ||
72 | } | ||
73 | |||
74 | private void Work() | ||
75 | { | ||
76 | m_console.Notice("Enter help for a list of commands\n"); | ||
77 | |||
78 | while (true) | ||
79 | { | ||
80 | m_console.MainLogPrompt(); | ||
81 | } | ||
82 | } | ||
83 | |||
84 | public void Startup() | ||
85 | { | ||
86 | this.localXMLConfig = new XmlConfig("UserServerConfig.xml"); | ||
87 | this.localXMLConfig.LoadData(); | ||
88 | this.ConfigDB(this.localXMLConfig); | ||
89 | this.localXMLConfig.Close(); | ||
90 | |||
91 | MainLog.Instance.Verbose("Main.cs:Startup() - Loading configuration"); | ||
92 | Cfg = this.LoadConfigDll(this.ConfigDll); | ||
93 | Cfg.InitConfig(); | ||
94 | |||
95 | MainLog.Instance.Verbose("Main.cs:Startup() - Establishing data connection"); | ||
96 | m_userManager = new UserManager(); | ||
97 | m_userManager._config = Cfg; | ||
98 | m_userManager.AddPlugin(StorageDll); | ||
99 | |||
100 | MainLog.Instance.Verbose("Main.cs:Startup() - Starting HTTP process"); | ||
101 | BaseHttpServer httpServer = new BaseHttpServer(8002); | ||
102 | |||
103 | httpServer.AddXmlRPCHandler("login_to_simulator", m_userManager.XmlRpcLoginMethod); | ||
104 | |||
105 | httpServer.AddXmlRPCHandler("get_user_by_name", m_userManager.XmlRPCGetUserMethodName); | ||
106 | httpServer.AddXmlRPCHandler("get_user_by_uuid", m_userManager.XmlRPCGetUserMethodUUID); | ||
107 | |||
108 | httpServer.AddStreamHandler( new RestStreamHandler("DELETE", "/usersessions/", m_userManager.RestDeleteUserSessionMethod )); | ||
109 | |||
110 | httpServer.Start(); | ||
111 | m_console.Status("Userserver 0.3 - Startup complete"); | ||
112 | } | ||
113 | |||
114 | |||
115 | public void do_create(string what) | ||
116 | { | ||
117 | switch (what) | ||
118 | { | ||
119 | case "user": | ||
120 | string tempfirstname; | ||
121 | string templastname; | ||
122 | string tempMD5Passwd; | ||
123 | uint regX = 1000; | ||
124 | uint regY = 1000; | ||
125 | |||
126 | tempfirstname = m_console.CmdPrompt("First name"); | ||
127 | templastname = m_console.CmdPrompt("Last name"); | ||
128 | tempMD5Passwd = m_console.PasswdPrompt("Password"); | ||
129 | regX = Convert.ToUInt32(m_console.CmdPrompt("Start Region X")); | ||
130 | regY = Convert.ToUInt32(m_console.CmdPrompt("Start Region Y")); | ||
131 | |||
132 | tempMD5Passwd = Util.Md5Hash(Util.Md5Hash(tempMD5Passwd) + ":" + ""); | ||
133 | |||
134 | m_userManager.AddUserProfile(tempfirstname, templastname, tempMD5Passwd, regX, regY); | ||
135 | break; | ||
136 | } | ||
137 | } | ||
138 | |||
139 | public void RunCmd(string cmd, string[] cmdparams) | ||
140 | { | ||
141 | switch (cmd) | ||
142 | { | ||
143 | case "help": | ||
144 | m_console.Notice("create user - create a new user"); | ||
145 | m_console.Notice("shutdown - shutdown the grid (USE CAUTION!)"); | ||
146 | break; | ||
147 | |||
148 | case "create": | ||
149 | do_create(cmdparams[0]); | ||
150 | break; | ||
151 | |||
152 | case "shutdown": | ||
153 | m_console.Close(); | ||
154 | Environment.Exit(0); | ||
155 | break; | ||
156 | } | ||
157 | } | ||
158 | |||
159 | private void ConfigDB(IGenericConfig configData) | ||
160 | { | ||
161 | try | ||
162 | { | ||
163 | string attri = ""; | ||
164 | attri = configData.GetAttribute("DataBaseProvider"); | ||
165 | if (attri == "") | ||
166 | { | ||
167 | StorageDll = "OpenSim.Framework.Data.DB4o.dll"; | ||
168 | configData.SetAttribute("DataBaseProvider", "OpenSim.Framework.Data.DB4o.dll"); | ||
169 | } | ||
170 | else | ||
171 | { | ||
172 | StorageDll = attri; | ||
173 | } | ||
174 | configData.Commit(); | ||
175 | } | ||
176 | catch | ||
177 | { | ||
178 | |||
179 | } | ||
180 | } | ||
181 | |||
182 | private UserConfig LoadConfigDll(string dllName) | ||
183 | { | ||
184 | Assembly pluginAssembly = Assembly.LoadFrom(dllName); | ||
185 | UserConfig config = null; | ||
186 | |||
187 | foreach (Type pluginType in pluginAssembly.GetTypes()) | ||
188 | { | ||
189 | if (pluginType.IsPublic) | ||
190 | { | ||
191 | if (!pluginType.IsAbstract) | ||
192 | { | ||
193 | Type typeInterface = pluginType.GetInterface("IUserConfig", true); | ||
194 | |||
195 | if (typeInterface != null) | ||
196 | { | ||
197 | IUserConfig plug = (IUserConfig)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); | ||
198 | config = plug.GetConfigObject(); | ||
199 | break; | ||
200 | } | ||
201 | |||
202 | typeInterface = null; | ||
203 | } | ||
204 | } | ||
205 | } | ||
206 | pluginAssembly = null; | ||
207 | return config; | ||
208 | } | ||
209 | |||
210 | public void Show(string ShowWhat) | ||
211 | { | ||
212 | } | ||
213 | } | ||
214 | } | ||
diff --git a/OpenSim/Grid/UserServer/Properties/AssemblyInfo.cs b/OpenSim/Grid/UserServer/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..a0a6f3c --- /dev/null +++ b/OpenSim/Grid/UserServer/Properties/AssemblyInfo.cs | |||
@@ -0,0 +1,31 @@ | |||
1 | using System.Reflection; | ||
2 | using System.Runtime.InteropServices; | ||
3 | // General Information about an assembly is controlled through the following | ||
4 | // set of attributes. Change these attribute values to modify the information | ||
5 | // associated with an assembly. | ||
6 | [assembly: AssemblyTitle("OGS-UserServer")] | ||
7 | [assembly: AssemblyDescription("")] | ||
8 | [assembly: AssemblyConfiguration("")] | ||
9 | [assembly: AssemblyCompany("")] | ||
10 | [assembly: AssemblyProduct("OGS-UserServer")] | ||
11 | [assembly: AssemblyCopyright("Copyright © 2007")] | ||
12 | [assembly: AssemblyTrademark("")] | ||
13 | [assembly: AssemblyCulture("")] | ||
14 | |||
15 | // Setting ComVisible to false makes the types in this assembly not visible | ||
16 | // to COM components. If you need to access a type in this assembly from | ||
17 | // COM, set the ComVisible attribute to true on that type. | ||
18 | [assembly: ComVisible(false)] | ||
19 | |||
20 | // The following GUID is for the ID of the typelib if this project is exposed to COM | ||
21 | [assembly: Guid("e266513a-090b-4d38-80f6-8599eef68c8c")] | ||
22 | |||
23 | // Version information for an assembly consists of the following four values: | ||
24 | // | ||
25 | // Major Version | ||
26 | // Minor Version | ||
27 | // Build Number | ||
28 | // Revision | ||
29 | // | ||
30 | [assembly: AssemblyVersion("1.0.0.0")] | ||
31 | [assembly: AssemblyFileVersion("1.0.0.0")] | ||
diff --git a/OpenSim/Grid/UserServer/UserManager.cs b/OpenSim/Grid/UserServer/UserManager.cs new file mode 100644 index 0000000..04bf64a --- /dev/null +++ b/OpenSim/Grid/UserServer/UserManager.cs | |||
@@ -0,0 +1,94 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.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 | using System; | ||
29 | using System.Collections; | ||
30 | using Nwc.XmlRpc; | ||
31 | using OpenSim.Framework.Data; | ||
32 | using OpenSim.Framework.UserManagement; | ||
33 | |||
34 | namespace OpenSim.Grid.UserServer | ||
35 | { | ||
36 | public class UserManager : UserManagerBase | ||
37 | { | ||
38 | public UserManager() | ||
39 | { | ||
40 | } | ||
41 | |||
42 | /// <summary> | ||
43 | /// Customises the login response and fills in missing values. | ||
44 | /// </summary> | ||
45 | /// <param name="response">The existing response</param> | ||
46 | /// <param name="theUser">The user profile</param> | ||
47 | public override void CustomiseResponse( LoginResponse response, UserProfileData theUser) | ||
48 | { | ||
49 | // Load information from the gridserver | ||
50 | SimProfileData SimInfo = new SimProfileData(); | ||
51 | SimInfo = SimInfo.RequestSimProfileData(theUser.currentAgent.currentHandle, _config.GridServerURL, _config.GridSendKey, _config.GridRecvKey); | ||
52 | |||
53 | // Customise the response | ||
54 | // Home Location | ||
55 | response.Home = "{'region_handle':[r" + (SimInfo.regionLocX * 256).ToString() + ",r" + (SimInfo.regionLocY * 256).ToString() + "], " + | ||
56 | "'position':[r" + theUser.homeLocation.X.ToString() + ",r" + theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "], " + | ||
57 | "'look_at':[r" + theUser.homeLocation.X.ToString() + ",r" + theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "]}"; | ||
58 | |||
59 | // Destination | ||
60 | Console.WriteLine("CUSTOMISERESPONSE: Region X: " + SimInfo.regionLocX + "; Region Y: " + SimInfo.regionLocY); | ||
61 | response.SimAddress = SimInfo.serverIP; | ||
62 | response.SimPort = (Int32)SimInfo.serverPort; | ||
63 | response.RegionX = SimInfo.regionLocX; | ||
64 | response.RegionY = SimInfo.regionLocX; | ||
65 | |||
66 | // Notify the target of an incoming user | ||
67 | Console.WriteLine("Notifying " + SimInfo.regionName + " (" + SimInfo.serverURI+ ")"); | ||
68 | |||
69 | // Prepare notification | ||
70 | Hashtable SimParams = new Hashtable(); | ||
71 | SimParams["session_id"] = theUser.currentAgent.sessionID.ToString(); | ||
72 | SimParams["secure_session_id"] = theUser.currentAgent.secureSessionID.ToString(); | ||
73 | SimParams["firstname"] = theUser.username; | ||
74 | SimParams["lastname"] = theUser.surname; | ||
75 | SimParams["agent_id"] = theUser.UUID.ToString(); | ||
76 | SimParams["circuit_code"] = (Int32)Convert.ToUInt32(response.CircuitCode); | ||
77 | SimParams["startpos_x"] = theUser.currentAgent.currentPos.X.ToString(); | ||
78 | SimParams["startpos_y"] = theUser.currentAgent.currentPos.Y.ToString(); | ||
79 | SimParams["startpos_z"] = theUser.currentAgent.currentPos.Z.ToString(); | ||
80 | SimParams["regionhandle"] = theUser.currentAgent.currentHandle.ToString(); | ||
81 | ArrayList SendParams = new ArrayList(); | ||
82 | SendParams.Add(SimParams); | ||
83 | |||
84 | // Update agent with target sim | ||
85 | theUser.currentAgent.currentRegion = SimInfo.UUID; | ||
86 | theUser.currentAgent.currentHandle = SimInfo.regionHandle; | ||
87 | |||
88 | System.Console.WriteLine("sending reply"); | ||
89 | // Send | ||
90 | XmlRpcRequest GridReq = new XmlRpcRequest("expect_user", SendParams); | ||
91 | XmlRpcResponse GridResp = GridReq.Send(SimInfo.httpServerURI, 3000); | ||
92 | } | ||
93 | } | ||
94 | } | ||