diff options
Diffstat (limited to 'OpenSim/Grid')
47 files changed, 5297 insertions, 0 deletions
diff --git a/OpenSim/Grid/AssetServer/AssetHttpServer.cs b/OpenSim/Grid/AssetServer/AssetHttpServer.cs new file mode 100644 index 0000000..ad8733f --- /dev/null +++ b/OpenSim/Grid/AssetServer/AssetHttpServer.cs | |||
@@ -0,0 +1,130 @@ | |||
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.Generic; | ||
30 | using System.Net; | ||
31 | using System.Text; | ||
32 | using System.Text.RegularExpressions; | ||
33 | using System.Threading; | ||
34 | //using OpenSim.CAPS; | ||
35 | using Nwc.XmlRpc; | ||
36 | using System.Collections; | ||
37 | using OpenSim.Framework.Console; | ||
38 | using OpenSim.Framework.Servers; | ||
39 | |||
40 | namespace OpenSim.Grid.AssetServer | ||
41 | { | ||
42 | /// <summary> | ||
43 | /// An HTTP server for sending assets | ||
44 | /// </summary> | ||
45 | public class AssetHttpServer :BaseHttpServer | ||
46 | { | ||
47 | /// <summary> | ||
48 | /// Creates the new asset server | ||
49 | /// </summary> | ||
50 | /// <param name="port">Port to initalise on</param> | ||
51 | public AssetHttpServer(int port) | ||
52 | : base(port) | ||
53 | { | ||
54 | } | ||
55 | |||
56 | /// <summary> | ||
57 | /// Handles an HTTP request | ||
58 | /// </summary> | ||
59 | /// <param name="stateinfo">HTTP State Info</param> | ||
60 | public override void HandleRequest(Object stateinfo) | ||
61 | { | ||
62 | try | ||
63 | { | ||
64 | HttpListenerContext context = (HttpListenerContext)stateinfo; | ||
65 | |||
66 | HttpListenerRequest request = context.Request; | ||
67 | HttpListenerResponse response = context.Response; | ||
68 | |||
69 | response.KeepAlive = false; | ||
70 | response.SendChunked = false; | ||
71 | |||
72 | System.IO.Stream body = request.InputStream; | ||
73 | System.Text.Encoding encoding = System.Text.Encoding.UTF8; | ||
74 | System.IO.StreamReader reader = new System.IO.StreamReader(body, encoding); | ||
75 | |||
76 | string requestBody = reader.ReadToEnd(); | ||
77 | body.Close(); | ||
78 | reader.Close(); | ||
79 | |||
80 | //Console.WriteLine(request.HttpMethod + " " + request.RawUrl + " Http/" + request.ProtocolVersion.ToString() + " content type: " + request.ContentType); | ||
81 | //Console.WriteLine(requestBody); | ||
82 | |||
83 | string responseString = ""; | ||
84 | switch (request.ContentType) | ||
85 | { | ||
86 | case "text/xml": | ||
87 | // must be XML-RPC, so pass to the XML-RPC parser | ||
88 | |||
89 | responseString = ParseXMLRPC(requestBody); | ||
90 | responseString = Regex.Replace(responseString, "utf-16", "utf-8"); | ||
91 | |||
92 | response.AddHeader("Content-type", "text/xml"); | ||
93 | break; | ||
94 | |||
95 | case "application/xml": | ||
96 | // probably LLSD we hope, otherwise it should be ignored by the parser | ||
97 | responseString = ParseLLSDXML(requestBody); | ||
98 | response.AddHeader("Content-type", "application/xml"); | ||
99 | break; | ||
100 | |||
101 | case "application/x-www-form-urlencoded": | ||
102 | // a form data POST so send to the REST parser | ||
103 | responseString = ParseREST(requestBody, request.RawUrl, request.HttpMethod); | ||
104 | response.AddHeader("Content-type", "text/plain"); | ||
105 | break; | ||
106 | |||
107 | case null: | ||
108 | // must be REST or invalid crap, so pass to the REST parser | ||
109 | responseString = ParseREST(requestBody, request.RawUrl, request.HttpMethod); | ||
110 | response.AddHeader("Content-type", "text/plain"); | ||
111 | break; | ||
112 | |||
113 | } | ||
114 | |||
115 | Encoding Windows1252Encoding = Encoding.GetEncoding(1252); | ||
116 | byte[] buffer = Windows1252Encoding.GetBytes(responseString); | ||
117 | System.IO.Stream output = response.OutputStream; | ||
118 | response.SendChunked = false; | ||
119 | response.ContentLength64 = buffer.Length; | ||
120 | output.Write(buffer, 0, buffer.Length); | ||
121 | output.Close(); | ||
122 | } | ||
123 | catch (Exception e) | ||
124 | { | ||
125 | Console.WriteLine(e.ToString()); | ||
126 | } | ||
127 | } | ||
128 | |||
129 | } | ||
130 | } | ||
diff --git a/OpenSim/Grid/AssetServer/Main.cs b/OpenSim/Grid/AssetServer/Main.cs new file mode 100644 index 0000000..d06998d --- /dev/null +++ b/OpenSim/Grid/AssetServer/Main.cs | |||
@@ -0,0 +1,337 @@ | |||
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 System.Timers; | ||
33 | using System.Net; | ||
34 | using System.Reflection; | ||
35 | using System.Threading; | ||
36 | using libsecondlife; | ||
37 | using OpenSim.Framework; | ||
38 | using OpenSim.Framework.Sims; | ||
39 | using OpenSim.Framework.Console; | ||
40 | using OpenSim.Framework.Types; | ||
41 | using OpenSim.Framework.Interfaces; | ||
42 | using OpenSim.Framework.Utilities; | ||
43 | using OpenSim.Framework.Servers; | ||
44 | using Db4objects.Db4o; | ||
45 | using Db4objects.Db4o.Query; | ||
46 | |||
47 | namespace OpenSim.Grid.AssetServer | ||
48 | { | ||
49 | /// <summary> | ||
50 | /// An asset server | ||
51 | /// </summary> | ||
52 | public class OpenAsset_Main : conscmd_callback | ||
53 | { | ||
54 | private IObjectContainer db; | ||
55 | |||
56 | public static OpenAsset_Main assetserver; | ||
57 | |||
58 | private LogBase m_console; | ||
59 | |||
60 | [STAThread] | ||
61 | public static void Main(string[] args) | ||
62 | { | ||
63 | Console.WriteLine("Starting...\n"); | ||
64 | |||
65 | assetserver = new OpenAsset_Main(); | ||
66 | assetserver.Startup(); | ||
67 | |||
68 | assetserver.Work(); | ||
69 | } | ||
70 | |||
71 | private void Work() | ||
72 | { | ||
73 | m_console.Notice("Enter help for a list of commands"); | ||
74 | |||
75 | while (true) | ||
76 | { | ||
77 | m_console.MainLogPrompt(); | ||
78 | } | ||
79 | } | ||
80 | |||
81 | private OpenAsset_Main() | ||
82 | { | ||
83 | m_console = new LogBase("opengrid-AssetServer-console.log", "OpenAsset", this, false); | ||
84 | OpenSim.Framework.Console.MainLog.Instance = m_console; | ||
85 | } | ||
86 | |||
87 | public void Startup() | ||
88 | { | ||
89 | m_console.Verbose( "Main.cs:Startup() - Setting up asset DB"); | ||
90 | setupDB(); | ||
91 | |||
92 | m_console.Verbose( "Main.cs:Startup() - Starting HTTP process"); | ||
93 | AssetHttpServer httpServer = new AssetHttpServer(8003); | ||
94 | |||
95 | |||
96 | httpServer.AddRestHandler("GET", "/assets/", this.assetGetMethod); | ||
97 | httpServer.AddRestHandler("POST", "/assets/", this.assetPostMethod); | ||
98 | |||
99 | httpServer.Start(); | ||
100 | |||
101 | } | ||
102 | |||
103 | public string assetPostMethod(string requestBody, string path, string param) | ||
104 | { | ||
105 | AssetBase asset = new AssetBase(); | ||
106 | asset.Name = ""; | ||
107 | asset.FullID = new LLUUID(param); | ||
108 | Encoding Windows1252Encoding = Encoding.GetEncoding(1252); | ||
109 | byte[] buffer = Windows1252Encoding.GetBytes(requestBody); | ||
110 | asset.Data = buffer; | ||
111 | AssetStorage store = new AssetStorage(); | ||
112 | store.Data = asset.Data; | ||
113 | store.Name = asset.Name; | ||
114 | store.UUID = asset.FullID; | ||
115 | db.Set(store); | ||
116 | db.Commit(); | ||
117 | return ""; | ||
118 | } | ||
119 | |||
120 | public string assetGetMethod(string request, string path, string param) | ||
121 | { | ||
122 | Console.WriteLine("got a request " + param); | ||
123 | byte[] assetdata = getAssetData(new LLUUID(param), false); | ||
124 | if (assetdata != null) | ||
125 | { | ||
126 | Encoding Windows1252Encoding = Encoding.GetEncoding(1252); | ||
127 | string ret = Windows1252Encoding.GetString(assetdata); | ||
128 | //string ret = System.Text.Encoding.Unicode.GetString(assetdata); | ||
129 | |||
130 | return ret; | ||
131 | |||
132 | } | ||
133 | else | ||
134 | { | ||
135 | return ""; | ||
136 | } | ||
137 | |||
138 | } | ||
139 | |||
140 | public byte[] getAssetData(LLUUID assetID, bool isTexture) | ||
141 | { | ||
142 | bool found = false; | ||
143 | AssetStorage foundAsset = null; | ||
144 | |||
145 | IObjectSet result = db.Get(new AssetStorage(assetID)); | ||
146 | if (result.Count > 0) | ||
147 | { | ||
148 | foundAsset = (AssetStorage)result.Next(); | ||
149 | found = true; | ||
150 | } | ||
151 | |||
152 | if (found) | ||
153 | { | ||
154 | return foundAsset.Data; | ||
155 | } | ||
156 | else | ||
157 | { | ||
158 | return null; | ||
159 | } | ||
160 | } | ||
161 | |||
162 | public void setupDB() | ||
163 | { | ||
164 | bool yapfile = System.IO.File.Exists("assets.yap"); | ||
165 | try | ||
166 | { | ||
167 | db = Db4oFactory.OpenFile("assets.yap"); | ||
168 | OpenSim.Framework.Console.MainLog.Instance.Verbose( "Main.cs:setupDB() - creation"); | ||
169 | } | ||
170 | catch (Exception e) | ||
171 | { | ||
172 | db.Close(); | ||
173 | OpenSim.Framework.Console.MainLog.Instance.Warn("Main.cs:setupDB() - Exception occured"); | ||
174 | OpenSim.Framework.Console.MainLog.Instance.Warn(e.ToString()); | ||
175 | } | ||
176 | if (!yapfile) | ||
177 | { | ||
178 | this.LoadDB(); | ||
179 | } | ||
180 | } | ||
181 | |||
182 | public void LoadDB() | ||
183 | { | ||
184 | try | ||
185 | { | ||
186 | |||
187 | Console.WriteLine("setting up Asset database"); | ||
188 | |||
189 | AssetBase Image = new AssetBase(); | ||
190 | Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000001"); | ||
191 | Image.Name = "Bricks"; | ||
192 | this.LoadAsset(Image, true, "bricks.jp2"); | ||
193 | AssetStorage store = new AssetStorage(); | ||
194 | store.Data = Image.Data; | ||
195 | store.Name = Image.Name; | ||
196 | store.UUID = Image.FullID; | ||
197 | db.Set(store); | ||
198 | db.Commit(); | ||
199 | |||
200 | Image = new AssetBase(); | ||
201 | Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000002"); | ||
202 | Image.Name = "Plywood"; | ||
203 | this.LoadAsset(Image, true, "plywood.jp2"); | ||
204 | store = new AssetStorage(); | ||
205 | store.Data = Image.Data; | ||
206 | store.Name = Image.Name; | ||
207 | store.UUID = Image.FullID; | ||
208 | db.Set(store); | ||
209 | db.Commit(); | ||
210 | |||
211 | Image = new AssetBase(); | ||
212 | Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000003"); | ||
213 | Image.Name = "Rocks"; | ||
214 | this.LoadAsset(Image, true, "rocks.jp2"); | ||
215 | store = new AssetStorage(); | ||
216 | store.Data = Image.Data; | ||
217 | store.Name = Image.Name; | ||
218 | store.UUID = Image.FullID; | ||
219 | db.Set(store); | ||
220 | db.Commit(); | ||
221 | |||
222 | Image = new AssetBase(); | ||
223 | Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000004"); | ||
224 | Image.Name = "Granite"; | ||
225 | this.LoadAsset(Image, true, "granite.jp2"); | ||
226 | store = new AssetStorage(); | ||
227 | store.Data = Image.Data; | ||
228 | store.Name = Image.Name; | ||
229 | store.UUID = Image.FullID; | ||
230 | db.Set(store); | ||
231 | db.Commit(); | ||
232 | |||
233 | Image = new AssetBase(); | ||
234 | Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000005"); | ||
235 | Image.Name = "Hardwood"; | ||
236 | this.LoadAsset(Image, true, "hardwood.jp2"); | ||
237 | store = new AssetStorage(); | ||
238 | store.Data = Image.Data; | ||
239 | store.Name = Image.Name; | ||
240 | store.UUID = Image.FullID; | ||
241 | db.Set(store); | ||
242 | db.Commit(); | ||
243 | |||
244 | Image = new AssetBase(); | ||
245 | Image.FullID = new LLUUID("00000000-0000-0000-5005-000000000005"); | ||
246 | Image.Name = "Prim Base Texture"; | ||
247 | this.LoadAsset(Image, true, "plywood.jp2"); | ||
248 | store = new AssetStorage(); | ||
249 | store.Data = Image.Data; | ||
250 | store.Name = Image.Name; | ||
251 | store.UUID = Image.FullID; | ||
252 | db.Set(store); | ||
253 | db.Commit(); | ||
254 | |||
255 | Image = new AssetBase(); | ||
256 | Image.FullID = new LLUUID("66c41e39-38f9-f75a-024e-585989bfab73"); | ||
257 | Image.Name = "Shape"; | ||
258 | this.LoadAsset(Image, false, "base_shape.dat"); | ||
259 | store = new AssetStorage(); | ||
260 | store.Data = Image.Data; | ||
261 | store.Name = Image.Name; | ||
262 | store.UUID = Image.FullID; | ||
263 | db.Set(store); | ||
264 | db.Commit(); | ||
265 | } | ||
266 | catch (Exception e) | ||
267 | { | ||
268 | Console.WriteLine(e.Message); | ||
269 | } | ||
270 | } | ||
271 | |||
272 | private void LoadAsset(AssetBase info, bool image, string filename) | ||
273 | { | ||
274 | |||
275 | |||
276 | string dataPath = Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory, "assets"); //+ folder; | ||
277 | string fileName = Path.Combine(dataPath, filename); | ||
278 | FileInfo fInfo = new FileInfo(fileName); | ||
279 | long numBytes = fInfo.Length; | ||
280 | FileStream fStream = new FileStream(fileName, FileMode.Open, FileAccess.Read); | ||
281 | byte[] idata = new byte[numBytes]; | ||
282 | BinaryReader br = new BinaryReader(fStream); | ||
283 | idata = br.ReadBytes((int)numBytes); | ||
284 | br.Close(); | ||
285 | fStream.Close(); | ||
286 | info.Data = idata; | ||
287 | //info.loaded=true; | ||
288 | } | ||
289 | |||
290 | /*private GridConfig LoadConfigDll(string dllName) | ||
291 | { | ||
292 | Assembly pluginAssembly = Assembly.LoadFrom(dllName); | ||
293 | GridConfig config = null; | ||
294 | |||
295 | foreach (Type pluginType in pluginAssembly.GetTypes()) | ||
296 | { | ||
297 | if (pluginType.IsPublic) | ||
298 | { | ||
299 | if (!pluginType.IsAbstract) | ||
300 | { | ||
301 | Type typeInterface = pluginType.GetInterface("IGridConfig", true); | ||
302 | |||
303 | if (typeInterface != null) | ||
304 | { | ||
305 | IGridConfig plug = (IGridConfig)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); | ||
306 | config = plug.GetConfigObject(); | ||
307 | break; | ||
308 | } | ||
309 | |||
310 | typeInterface = null; | ||
311 | } | ||
312 | } | ||
313 | } | ||
314 | pluginAssembly = null; | ||
315 | return config; | ||
316 | }*/ | ||
317 | |||
318 | public void RunCmd(string cmd, string[] cmdparams) | ||
319 | { | ||
320 | switch (cmd) | ||
321 | { | ||
322 | case "help": | ||
323 | m_console.Notice("shutdown - shutdown this asset server (USE CAUTION!)"); | ||
324 | break; | ||
325 | |||
326 | case "shutdown": | ||
327 | m_console.Close(); | ||
328 | Environment.Exit(0); | ||
329 | break; | ||
330 | } | ||
331 | } | ||
332 | |||
333 | public void Show(string ShowWhat) | ||
334 | { | ||
335 | } | ||
336 | } | ||
337 | } | ||
diff --git a/OpenSim/Grid/AssetServer/OpenSim.Grid.AssetServer.csproj b/OpenSim/Grid/AssetServer/OpenSim.Grid.AssetServer.csproj new file mode 100644 index 0000000..caebca3 --- /dev/null +++ b/OpenSim/Grid/AssetServer/OpenSim.Grid.AssetServer.csproj | |||
@@ -0,0 +1,118 @@ | |||
1 | <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
2 | <PropertyGroup> | ||
3 | <ProjectType>Local</ProjectType> | ||
4 | <ProductVersion>8.0.50727</ProductVersion> | ||
5 | <SchemaVersion>2.0</SchemaVersion> | ||
6 | <ProjectGuid>{E5F1A03B-0000-0000-0000-000000000000}</ProjectGuid> | ||
7 | <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
8 | <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
9 | <ApplicationIcon></ApplicationIcon> | ||
10 | <AssemblyKeyContainerName> | ||
11 | </AssemblyKeyContainerName> | ||
12 | <AssemblyName>OpenSim.Grid.AssetServer</AssemblyName> | ||
13 | <DefaultClientScript>JScript</DefaultClientScript> | ||
14 | <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout> | ||
15 | <DefaultTargetSchema>IE50</DefaultTargetSchema> | ||
16 | <DelaySign>false</DelaySign> | ||
17 | <OutputType>Exe</OutputType> | ||
18 | <AppDesignerFolder></AppDesignerFolder> | ||
19 | <RootNamespace>OpenSim.Grid.AssetServer</RootNamespace> | ||
20 | <StartupObject></StartupObject> | ||
21 | <FileUpgradeFlags> | ||
22 | </FileUpgradeFlags> | ||
23 | </PropertyGroup> | ||
24 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
25 | <AllowUnsafeBlocks>False</AllowUnsafeBlocks> | ||
26 | <BaseAddress>285212672</BaseAddress> | ||
27 | <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> | ||
28 | <ConfigurationOverrideFile> | ||
29 | </ConfigurationOverrideFile> | ||
30 | <DefineConstants>TRACE;DEBUG</DefineConstants> | ||
31 | <DocumentationFile></DocumentationFile> | ||
32 | <DebugSymbols>True</DebugSymbols> | ||
33 | <FileAlignment>4096</FileAlignment> | ||
34 | <Optimize>False</Optimize> | ||
35 | <OutputPath>..\..\..\bin\</OutputPath> | ||
36 | <RegisterForComInterop>False</RegisterForComInterop> | ||
37 | <RemoveIntegerChecks>False</RemoveIntegerChecks> | ||
38 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> | ||
39 | <WarningLevel>4</WarningLevel> | ||
40 | <NoWarn></NoWarn> | ||
41 | </PropertyGroup> | ||
42 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
43 | <AllowUnsafeBlocks>False</AllowUnsafeBlocks> | ||
44 | <BaseAddress>285212672</BaseAddress> | ||
45 | <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> | ||
46 | <ConfigurationOverrideFile> | ||
47 | </ConfigurationOverrideFile> | ||
48 | <DefineConstants>TRACE</DefineConstants> | ||
49 | <DocumentationFile></DocumentationFile> | ||
50 | <DebugSymbols>False</DebugSymbols> | ||
51 | <FileAlignment>4096</FileAlignment> | ||
52 | <Optimize>True</Optimize> | ||
53 | <OutputPath>..\..\..\bin\</OutputPath> | ||
54 | <RegisterForComInterop>False</RegisterForComInterop> | ||
55 | <RemoveIntegerChecks>False</RemoveIntegerChecks> | ||
56 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> | ||
57 | <WarningLevel>4</WarningLevel> | ||
58 | <NoWarn></NoWarn> | ||
59 | </PropertyGroup> | ||
60 | <ItemGroup> | ||
61 | <Reference Include="Db4objects.Db4o.dll" > | ||
62 | <HintPath>..\..\..\bin\Db4objects.Db4o.dll</HintPath> | ||
63 | <Private>False</Private> | ||
64 | </Reference> | ||
65 | <Reference Include="libsecondlife.dll" > | ||
66 | <HintPath>..\..\..\bin\libsecondlife.dll</HintPath> | ||
67 | <Private>False</Private> | ||
68 | </Reference> | ||
69 | <Reference Include="OpenSim.Framework" > | ||
70 | <HintPath>OpenSim.Framework.dll</HintPath> | ||
71 | <Private>False</Private> | ||
72 | </Reference> | ||
73 | <Reference Include="OpenSim.Framework.Console" > | ||
74 | <HintPath>OpenSim.Framework.Console.dll</HintPath> | ||
75 | <Private>False</Private> | ||
76 | </Reference> | ||
77 | <Reference Include="OpenSim.Framework.Servers" > | ||
78 | <HintPath>OpenSim.Framework.Servers.dll</HintPath> | ||
79 | <Private>False</Private> | ||
80 | </Reference> | ||
81 | <Reference Include="System" > | ||
82 | <HintPath>System.dll</HintPath> | ||
83 | <Private>False</Private> | ||
84 | </Reference> | ||
85 | <Reference Include="System.Data" > | ||
86 | <HintPath>System.Data.dll</HintPath> | ||
87 | <Private>False</Private> | ||
88 | </Reference> | ||
89 | <Reference Include="System.Xml" > | ||
90 | <HintPath>System.Xml.dll</HintPath> | ||
91 | <Private>False</Private> | ||
92 | </Reference> | ||
93 | <Reference Include="XMLRPC.dll" > | ||
94 | <HintPath>..\..\..\bin\XMLRPC.dll</HintPath> | ||
95 | <Private>False</Private> | ||
96 | </Reference> | ||
97 | </ItemGroup> | ||
98 | <ItemGroup> | ||
99 | </ItemGroup> | ||
100 | <ItemGroup> | ||
101 | <Compile Include="AssetHttpServer.cs"> | ||
102 | <SubType>Code</SubType> | ||
103 | </Compile> | ||
104 | <Compile Include="Main.cs"> | ||
105 | <SubType>Code</SubType> | ||
106 | </Compile> | ||
107 | <Compile Include="Properties\AssemblyInfo.cs"> | ||
108 | <SubType>Code</SubType> | ||
109 | </Compile> | ||
110 | </ItemGroup> | ||
111 | <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" /> | ||
112 | <PropertyGroup> | ||
113 | <PreBuildEvent> | ||
114 | </PreBuildEvent> | ||
115 | <PostBuildEvent> | ||
116 | </PostBuildEvent> | ||
117 | </PropertyGroup> | ||
118 | </Project> | ||
diff --git a/OpenSim/Grid/AssetServer/OpenSim.Grid.AssetServer.exe.build b/OpenSim/Grid/AssetServer/OpenSim.Grid.AssetServer.exe.build new file mode 100644 index 0000000..0f9540e --- /dev/null +++ b/OpenSim/Grid/AssetServer/OpenSim.Grid.AssetServer.exe.build | |||
@@ -0,0 +1,49 @@ | |||
1 | <?xml version="1.0" ?> | ||
2 | <project name="OpenSim.Grid.AssetServer" default="build"> | ||
3 | <target name="build"> | ||
4 | <echo message="Build Directory is ${project::get-base-directory()}/${build.dir}" /> | ||
5 | <mkdir dir="${project::get-base-directory()}/${build.dir}" /> | ||
6 | <copy todir="${project::get-base-directory()}/${build.dir}"> | ||
7 | <fileset basedir="${project::get-base-directory()}"> | ||
8 | </fileset> | ||
9 | </copy> | ||
10 | <csc target="exe" debug="${build.debug}" unsafe="False" define="TRACE;DEBUG" output="${project::get-base-directory()}/${build.dir}/${project::get-name()}.exe"> | ||
11 | <resources prefix="OpenSim.Grid.AssetServer" dynamicprefix="true" > | ||
12 | </resources> | ||
13 | <sources failonempty="true"> | ||
14 | <include name="AssetHttpServer.cs" /> | ||
15 | <include name="Main.cs" /> | ||
16 | <include name="Properties/AssemblyInfo.cs" /> | ||
17 | </sources> | ||
18 | <references basedir="${project::get-base-directory()}"> | ||
19 | <lib> | ||
20 | <include name="${project::get-base-directory()}" /> | ||
21 | <include name="${project::get-base-directory()}/${build.dir}" /> | ||
22 | </lib> | ||
23 | <include name="../../../bin/Db4objects.Db4o.dll" /> | ||
24 | <include name="../../../bin/libsecondlife.dll" /> | ||
25 | <include name="OpenSim.Framework.dll" /> | ||
26 | <include name="OpenSim.Framework.Console.dll" /> | ||
27 | <include name="OpenSim.Framework.Servers.dll" /> | ||
28 | <include name="System.dll" /> | ||
29 | <include name="System.Data.dll" /> | ||
30 | <include name="System.Xml.dll" /> | ||
31 | <include name="../../../bin/XMLRPC.dll" /> | ||
32 | </references> | ||
33 | </csc> | ||
34 | <echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../../../bin/" /> | ||
35 | <mkdir dir="${project::get-base-directory()}/../../../bin/"/> | ||
36 | <copy todir="${project::get-base-directory()}/../../../bin/"> | ||
37 | <fileset basedir="${project::get-base-directory()}/${build.dir}/" > | ||
38 | <include name="*.dll"/> | ||
39 | <include name="*.exe"/> | ||
40 | </fileset> | ||
41 | </copy> | ||
42 | </target> | ||
43 | <target name="clean"> | ||
44 | <delete dir="${bin.dir}" failonerror="false" /> | ||
45 | <delete dir="${obj.dir}" failonerror="false" /> | ||
46 | </target> | ||
47 | <target name="doc" description="Creates documentation."> | ||
48 | </target> | ||
49 | </project> | ||
diff --git a/OpenSim/Grid/AssetServer/Properties/AssemblyInfo.cs b/OpenSim/Grid/AssetServer/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..f9a18a8 --- /dev/null +++ b/OpenSim/Grid/AssetServer/Properties/AssemblyInfo.cs | |||
@@ -0,0 +1,60 @@ | |||
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.CompilerServices; | ||
30 | using System.Runtime.InteropServices; | ||
31 | |||
32 | // General Information about an assembly is controlled through the following | ||
33 | // set of attributes. Change these attribute values to modify the information | ||
34 | // associated with an assembly. | ||
35 | [assembly: AssemblyTitle("OGS-AssetServer")] | ||
36 | [assembly: AssemblyDescription("")] | ||
37 | [assembly: AssemblyConfiguration("")] | ||
38 | [assembly: AssemblyCompany("")] | ||
39 | [assembly: AssemblyProduct("OGS-AssetServer")] | ||
40 | [assembly: AssemblyCopyright("Copyright © 2007")] | ||
41 | [assembly: AssemblyTrademark("")] | ||
42 | [assembly: AssemblyCulture("")] | ||
43 | |||
44 | // Setting ComVisible to false makes the types in this assembly not visible | ||
45 | // to COM components. If you need to access a type in this assembly from | ||
46 | // COM, set the ComVisible attribute to true on that type. | ||
47 | [assembly: ComVisible(false)] | ||
48 | |||
49 | // The following GUID is for the ID of the typelib if this project is exposed to COM | ||
50 | [assembly: Guid("b541b244-3d1d-4625-9003-bc2a3a6a39a4")] | ||
51 | |||
52 | // Version information for an assembly consists of the following four values: | ||
53 | // | ||
54 | // Major Version | ||
55 | // Minor Version | ||
56 | // Build Number | ||
57 | // Revision | ||
58 | // | ||
59 | [assembly: AssemblyVersion("1.0.0.0")] | ||
60 | [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..3f5d7dd --- /dev/null +++ b/OpenSim/Grid/Framework.Manager/GridManagementAgent.cs | |||
@@ -0,0 +1,140 @@ | |||
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 Nwc.XmlRpc; | ||
29 | using OpenSim.Framework; | ||
30 | using OpenSim.Framework.Servers; | ||
31 | using System.Collections; | ||
32 | using System.Collections.Generic; | ||
33 | using libsecondlife; | ||
34 | |||
35 | namespace OpenSim.Framework.Manager | ||
36 | { | ||
37 | /// <summary> | ||
38 | /// Used to pass messages to the gridserver | ||
39 | /// </summary> | ||
40 | /// <param name="param">Pass this argument</param> | ||
41 | public delegate void GridManagerCallback(string param); | ||
42 | |||
43 | /// <summary> | ||
44 | /// Serverside listener for grid commands | ||
45 | /// </summary> | ||
46 | public class GridManagementAgent | ||
47 | { | ||
48 | /// <summary> | ||
49 | /// Passes grid server messages | ||
50 | /// </summary> | ||
51 | private GridManagerCallback thecallback; | ||
52 | |||
53 | /// <summary> | ||
54 | /// Security keys | ||
55 | /// </summary> | ||
56 | private string sendkey; | ||
57 | private string recvkey; | ||
58 | |||
59 | /// <summary> | ||
60 | /// Our component type | ||
61 | /// </summary> | ||
62 | private string component_type; | ||
63 | |||
64 | /// <summary> | ||
65 | /// List of active sessions | ||
66 | /// </summary> | ||
67 | private static ArrayList Sessions; | ||
68 | |||
69 | /// <summary> | ||
70 | /// Initialises a new GridManagementAgent | ||
71 | /// </summary> | ||
72 | /// <param name="app_httpd">HTTP Daemon for this server</param> | ||
73 | /// <param name="component_type">What component type are we?</param> | ||
74 | /// <param name="sendkey">Security send key</param> | ||
75 | /// <param name="recvkey">Security recieve key</param> | ||
76 | /// <param name="thecallback">Message callback</param> | ||
77 | public GridManagementAgent(BaseHttpServer app_httpd, string component_type, string sendkey, string recvkey, GridManagerCallback thecallback) | ||
78 | { | ||
79 | this.sendkey = sendkey; | ||
80 | this.recvkey = recvkey; | ||
81 | this.component_type = component_type; | ||
82 | this.thecallback = thecallback; | ||
83 | Sessions = new ArrayList(); | ||
84 | |||
85 | app_httpd.AddXmlRPCHandler("manager_login", XmlRpcLoginMethod); | ||
86 | |||
87 | switch (component_type) | ||
88 | { | ||
89 | case "gridserver": | ||
90 | GridServerManager.sendkey = this.sendkey; | ||
91 | GridServerManager.recvkey = this.recvkey; | ||
92 | GridServerManager.thecallback = thecallback; | ||
93 | app_httpd.AddXmlRPCHandler("shutdown", GridServerManager.XmlRpcShutdownMethod); | ||
94 | break; | ||
95 | } | ||
96 | } | ||
97 | |||
98 | /// <summary> | ||
99 | /// Checks if a session exists | ||
100 | /// </summary> | ||
101 | /// <param name="sessionID">The session ID</param> | ||
102 | /// <returns>Exists?</returns> | ||
103 | public static bool SessionExists(LLUUID sessionID) | ||
104 | { | ||
105 | return Sessions.Contains(sessionID); | ||
106 | } | ||
107 | |||
108 | /// <summary> | ||
109 | /// Logs a new session to the grid manager | ||
110 | /// </summary> | ||
111 | /// <param name="request">the XMLRPC request</param> | ||
112 | /// <returns>An XMLRPC reply</returns> | ||
113 | public static XmlRpcResponse XmlRpcLoginMethod(XmlRpcRequest request) | ||
114 | { | ||
115 | XmlRpcResponse response = new XmlRpcResponse(); | ||
116 | Hashtable requestData = (Hashtable)request.Params[0]; | ||
117 | Hashtable responseData = new Hashtable(); | ||
118 | |||
119 | // TODO: Switch this over to using OpenSim.Framework.Data | ||
120 | if (requestData["username"].Equals("admin") && requestData["password"].Equals("supersecret")) | ||
121 | { | ||
122 | response.IsFault = false; | ||
123 | LLUUID new_session = LLUUID.Random(); | ||
124 | Sessions.Add(new_session); | ||
125 | responseData["session_id"] = new_session.ToString(); | ||
126 | responseData["msg"] = "Login OK"; | ||
127 | } | ||
128 | else | ||
129 | { | ||
130 | response.IsFault = true; | ||
131 | responseData["error"] = "Invalid username or password"; | ||
132 | } | ||
133 | |||
134 | response.Value = responseData; | ||
135 | return response; | ||
136 | |||
137 | } | ||
138 | |||
139 | } | ||
140 | } | ||
diff --git a/OpenSim/Grid/Framework.Manager/GridServerManager.cs b/OpenSim/Grid/Framework.Manager/GridServerManager.cs new file mode 100644 index 0000000..d5eaf6f --- /dev/null +++ b/OpenSim/Grid/Framework.Manager/GridServerManager.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 | |||
29 | using System; | ||
30 | using System.Collections; | ||
31 | using System.Collections.Generic; | ||
32 | using Nwc.XmlRpc; | ||
33 | using System.Threading; | ||
34 | using libsecondlife; | ||
35 | |||
36 | namespace OpenSim.Framework.Manager { | ||
37 | |||
38 | /// <summary> | ||
39 | /// A remote management system for the grid server | ||
40 | /// </summary> | ||
41 | public class GridServerManager | ||
42 | { | ||
43 | /// <summary> | ||
44 | /// Triggers events from the grid manager | ||
45 | /// </summary> | ||
46 | public static GridManagerCallback thecallback; | ||
47 | |||
48 | /// <summary> | ||
49 | /// Security keys | ||
50 | /// </summary> | ||
51 | public static string sendkey; | ||
52 | public static string recvkey; | ||
53 | |||
54 | /// <summary> | ||
55 | /// Disconnects the grid server and shuts it down | ||
56 | /// </summary> | ||
57 | /// <param name="request">XmlRpc Request</param> | ||
58 | /// <returns>An XmlRpc response containing either a "msg" or an "error"</returns> | ||
59 | public static XmlRpcResponse XmlRpcShutdownMethod(XmlRpcRequest request) | ||
60 | { | ||
61 | XmlRpcResponse response = new XmlRpcResponse(); | ||
62 | Hashtable requestData = (Hashtable)request.Params[0]; | ||
63 | Hashtable responseData = new Hashtable(); | ||
64 | |||
65 | if(requestData.ContainsKey("session_id")) { | ||
66 | if(GridManagementAgent.SessionExists(new LLUUID((string)requestData["session_id"]))) { | ||
67 | responseData["msg"]="Shutdown command accepted"; | ||
68 | (new Thread(new ThreadStart(ShutdownServer))).Start(); | ||
69 | } else { | ||
70 | response.IsFault=true; | ||
71 | responseData["error"]="bad session ID"; | ||
72 | } | ||
73 | } else { | ||
74 | response.IsFault=true; | ||
75 | responseData["error"]="no session ID"; | ||
76 | } | ||
77 | |||
78 | response.Value = responseData; | ||
79 | return response; | ||
80 | } | ||
81 | |||
82 | /// <summary> | ||
83 | /// Shuts down the grid server | ||
84 | /// </summary> | ||
85 | public static void ShutdownServer() | ||
86 | { | ||
87 | Console.WriteLine("Shutting down the grid server - recieved a grid manager request"); | ||
88 | Console.WriteLine("Terminating in three seconds..."); | ||
89 | Thread.Sleep(3000); | ||
90 | thecallback("shutdown"); | ||
91 | } | ||
92 | } | ||
93 | } | ||
94 | |||
diff --git a/OpenSim/Grid/Framework.Manager/OpenSim.Grid.Framework.Manager.csproj b/OpenSim/Grid/Framework.Manager/OpenSim.Grid.Framework.Manager.csproj new file mode 100644 index 0000000..9a98ff4 --- /dev/null +++ b/OpenSim/Grid/Framework.Manager/OpenSim.Grid.Framework.Manager.csproj | |||
@@ -0,0 +1,99 @@ | |||
1 | <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
2 | <PropertyGroup> | ||
3 | <ProjectType>Local</ProjectType> | ||
4 | <ProductVersion>8.0.50727</ProductVersion> | ||
5 | <SchemaVersion>2.0</SchemaVersion> | ||
6 | <ProjectGuid>{4B7BFD1C-0000-0000-0000-000000000000}</ProjectGuid> | ||
7 | <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
8 | <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
9 | <ApplicationIcon></ApplicationIcon> | ||
10 | <AssemblyKeyContainerName> | ||
11 | </AssemblyKeyContainerName> | ||
12 | <AssemblyName>OpenSim.Grid.Framework.Manager</AssemblyName> | ||
13 | <DefaultClientScript>JScript</DefaultClientScript> | ||
14 | <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout> | ||
15 | <DefaultTargetSchema>IE50</DefaultTargetSchema> | ||
16 | <DelaySign>false</DelaySign> | ||
17 | <OutputType>Library</OutputType> | ||
18 | <AppDesignerFolder></AppDesignerFolder> | ||
19 | <RootNamespace>OpenSim.Grid.Framework.Manager</RootNamespace> | ||
20 | <StartupObject></StartupObject> | ||
21 | <FileUpgradeFlags> | ||
22 | </FileUpgradeFlags> | ||
23 | </PropertyGroup> | ||
24 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
25 | <AllowUnsafeBlocks>False</AllowUnsafeBlocks> | ||
26 | <BaseAddress>285212672</BaseAddress> | ||
27 | <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> | ||
28 | <ConfigurationOverrideFile> | ||
29 | </ConfigurationOverrideFile> | ||
30 | <DefineConstants>TRACE;DEBUG</DefineConstants> | ||
31 | <DocumentationFile></DocumentationFile> | ||
32 | <DebugSymbols>True</DebugSymbols> | ||
33 | <FileAlignment>4096</FileAlignment> | ||
34 | <Optimize>False</Optimize> | ||
35 | <OutputPath>..\..\..\bin\</OutputPath> | ||
36 | <RegisterForComInterop>False</RegisterForComInterop> | ||
37 | <RemoveIntegerChecks>False</RemoveIntegerChecks> | ||
38 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> | ||
39 | <WarningLevel>4</WarningLevel> | ||
40 | <NoWarn></NoWarn> | ||
41 | </PropertyGroup> | ||
42 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
43 | <AllowUnsafeBlocks>False</AllowUnsafeBlocks> | ||
44 | <BaseAddress>285212672</BaseAddress> | ||
45 | <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> | ||
46 | <ConfigurationOverrideFile> | ||
47 | </ConfigurationOverrideFile> | ||
48 | <DefineConstants>TRACE</DefineConstants> | ||
49 | <DocumentationFile></DocumentationFile> | ||
50 | <DebugSymbols>False</DebugSymbols> | ||
51 | <FileAlignment>4096</FileAlignment> | ||
52 | <Optimize>True</Optimize> | ||
53 | <OutputPath>..\..\..\bin\</OutputPath> | ||
54 | <RegisterForComInterop>False</RegisterForComInterop> | ||
55 | <RemoveIntegerChecks>False</RemoveIntegerChecks> | ||
56 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> | ||
57 | <WarningLevel>4</WarningLevel> | ||
58 | <NoWarn></NoWarn> | ||
59 | </PropertyGroup> | ||
60 | <ItemGroup> | ||
61 | <Reference Include="libsecondlife.dll" > | ||
62 | <HintPath>..\..\..\bin\libsecondlife.dll</HintPath> | ||
63 | <Private>False</Private> | ||
64 | </Reference> | ||
65 | <Reference Include="OpenSim.Framework" > | ||
66 | <HintPath>OpenSim.Framework.dll</HintPath> | ||
67 | <Private>False</Private> | ||
68 | </Reference> | ||
69 | <Reference Include="OpenSim.Framework.Servers" > | ||
70 | <HintPath>OpenSim.Framework.Servers.dll</HintPath> | ||
71 | <Private>False</Private> | ||
72 | </Reference> | ||
73 | <Reference Include="System" > | ||
74 | <HintPath>System.dll</HintPath> | ||
75 | <Private>False</Private> | ||
76 | </Reference> | ||
77 | <Reference Include="XMLRPC.dll" > | ||
78 | <HintPath>..\..\..\bin\XMLRPC.dll</HintPath> | ||
79 | <Private>False</Private> | ||
80 | </Reference> | ||
81 | </ItemGroup> | ||
82 | <ItemGroup> | ||
83 | </ItemGroup> | ||
84 | <ItemGroup> | ||
85 | <Compile Include="GridManagementAgent.cs"> | ||
86 | <SubType>Code</SubType> | ||
87 | </Compile> | ||
88 | <Compile Include="GridServerManager.cs"> | ||
89 | <SubType>Code</SubType> | ||
90 | </Compile> | ||
91 | </ItemGroup> | ||
92 | <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" /> | ||
93 | <PropertyGroup> | ||
94 | <PreBuildEvent> | ||
95 | </PreBuildEvent> | ||
96 | <PostBuildEvent> | ||
97 | </PostBuildEvent> | ||
98 | </PropertyGroup> | ||
99 | </Project> | ||
diff --git a/OpenSim/Grid/Framework.Manager/OpenSim.Grid.Framework.Manager.dll.build b/OpenSim/Grid/Framework.Manager/OpenSim.Grid.Framework.Manager.dll.build new file mode 100644 index 0000000..119967d --- /dev/null +++ b/OpenSim/Grid/Framework.Manager/OpenSim.Grid.Framework.Manager.dll.build | |||
@@ -0,0 +1,44 @@ | |||
1 | <?xml version="1.0" ?> | ||
2 | <project name="OpenSim.Grid.Framework.Manager" default="build"> | ||
3 | <target name="build"> | ||
4 | <echo message="Build Directory is ${project::get-base-directory()}/${build.dir}" /> | ||
5 | <mkdir dir="${project::get-base-directory()}/${build.dir}" /> | ||
6 | <copy todir="${project::get-base-directory()}/${build.dir}"> | ||
7 | <fileset basedir="${project::get-base-directory()}"> | ||
8 | </fileset> | ||
9 | </copy> | ||
10 | <csc target="library" debug="${build.debug}" unsafe="False" define="TRACE;DEBUG" output="${project::get-base-directory()}/${build.dir}/${project::get-name()}.dll"> | ||
11 | <resources prefix="OpenSim.Grid.Framework.Manager" dynamicprefix="true" > | ||
12 | </resources> | ||
13 | <sources failonempty="true"> | ||
14 | <include name="GridManagementAgent.cs" /> | ||
15 | <include name="GridServerManager.cs" /> | ||
16 | </sources> | ||
17 | <references basedir="${project::get-base-directory()}"> | ||
18 | <lib> | ||
19 | <include name="${project::get-base-directory()}" /> | ||
20 | <include name="${project::get-base-directory()}/${build.dir}" /> | ||
21 | </lib> | ||
22 | <include name="../../../bin/libsecondlife.dll" /> | ||
23 | <include name="OpenSim.Framework.dll" /> | ||
24 | <include name="OpenSim.Framework.Servers.dll" /> | ||
25 | <include name="System.dll" /> | ||
26 | <include name="../../../bin/XMLRPC.dll" /> | ||
27 | </references> | ||
28 | </csc> | ||
29 | <echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../../../bin/" /> | ||
30 | <mkdir dir="${project::get-base-directory()}/../../../bin/"/> | ||
31 | <copy todir="${project::get-base-directory()}/../../../bin/"> | ||
32 | <fileset basedir="${project::get-base-directory()}/${build.dir}/" > | ||
33 | <include name="*.dll"/> | ||
34 | <include name="*.exe"/> | ||
35 | </fileset> | ||
36 | </copy> | ||
37 | </target> | ||
38 | <target name="clean"> | ||
39 | <delete dir="${bin.dir}" failonerror="false" /> | ||
40 | <delete dir="${obj.dir}" failonerror="false" /> | ||
41 | </target> | ||
42 | <target name="doc" description="Creates documentation."> | ||
43 | </target> | ||
44 | </project> | ||
diff --git a/OpenSim/Grid/GridServer.Config/AssemblyInfo.cs b/OpenSim/Grid/GridServer.Config/AssemblyInfo.cs new file mode 100644 index 0000000..c9701d6 --- /dev/null +++ b/OpenSim/Grid/GridServer.Config/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.CompilerServices; | ||
30 | using System.Runtime.InteropServices; | ||
31 | |||
32 | // Information about this assembly is defined by the following | ||
33 | // attributes. | ||
34 | // | ||
35 | // change them to the information which is associated with the assembly | ||
36 | // you compile. | ||
37 | |||
38 | [assembly: AssemblyTitle("GridConfig")] | ||
39 | [assembly: AssemblyDescription("")] | ||
40 | [assembly: AssemblyConfiguration("")] | ||
41 | [assembly: AssemblyCompany("")] | ||
42 | [assembly: AssemblyProduct("GridConfig")] | ||
43 | [assembly: AssemblyCopyright("")] | ||
44 | [assembly: AssemblyTrademark("")] | ||
45 | [assembly: AssemblyCulture("")] | ||
46 | |||
47 | // This sets the default COM visibility of types in the assembly to invisible. | ||
48 | // If you need to expose a type to COM, use [ComVisible(true)] on that type. | ||
49 | [assembly: ComVisible(false)] | ||
50 | |||
51 | // The assembly version has following format : | ||
52 | // | ||
53 | // Major.Minor.Build.Revision | ||
54 | // | ||
55 | // You can specify all values by your own or you can build default build and revision | ||
56 | // numbers with the '*' character (the default): | ||
57 | |||
58 | [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..2218004 --- /dev/null +++ b/OpenSim/Grid/GridServer.Config/DbGridConfig.cs | |||
@@ -0,0 +1,161 @@ | |||
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.Generic; | ||
30 | using OpenSim.Framework.Console; | ||
31 | using OpenSim.Framework.Interfaces; | ||
32 | using Db4objects.Db4o; | ||
33 | |||
34 | namespace OpenGrid.Config.GridConfigDb4o | ||
35 | { | ||
36 | /// <summary> | ||
37 | /// A grid configuration interface for returning the DB4o Config Provider | ||
38 | /// </summary> | ||
39 | public class Db40ConfigPlugin: IGridConfig | ||
40 | { | ||
41 | /// <summary> | ||
42 | /// Loads and returns a configuration objeect | ||
43 | /// </summary> | ||
44 | /// <returns>A grid configuration object</returns> | ||
45 | public GridConfig GetConfigObject() | ||
46 | { | ||
47 | OpenSim.Framework.Console.MainLog.Instance.Verbose("Loading Db40Config dll"); | ||
48 | return ( new DbGridConfig()); | ||
49 | } | ||
50 | } | ||
51 | |||
52 | /// <summary> | ||
53 | /// A DB4o based Gridserver configuration object | ||
54 | /// </summary> | ||
55 | public class DbGridConfig : GridConfig | ||
56 | { | ||
57 | /// <summary> | ||
58 | /// The DB4o Database | ||
59 | /// </summary> | ||
60 | private IObjectContainer db; | ||
61 | |||
62 | /// <summary> | ||
63 | /// User configuration for the Grid Config interfaces | ||
64 | /// </summary> | ||
65 | public void LoadDefaults() { | ||
66 | OpenSim.Framework.Console.MainLog.Instance.Notice("Config.cs:LoadDefaults() - Please press enter to retain default or enter new settings"); | ||
67 | |||
68 | // About the grid options | ||
69 | this.GridOwner = OpenSim.Framework.Console.MainLog.Instance.CmdPrompt("Grid owner", "OGS development team"); | ||
70 | |||
71 | // Asset Options | ||
72 | this.DefaultAssetServer = OpenSim.Framework.Console.MainLog.Instance.CmdPrompt("Default asset server","http://127.0.0.1:8003/"); | ||
73 | this.AssetSendKey = OpenSim.Framework.Console.MainLog.Instance.CmdPrompt("Key to send to asset server","null"); | ||
74 | this.AssetRecvKey = OpenSim.Framework.Console.MainLog.Instance.CmdPrompt("Key to expect from asset server","null"); | ||
75 | |||
76 | // User Server Options | ||
77 | this.DefaultUserServer = OpenSim.Framework.Console.MainLog.Instance.CmdPrompt("Default user server","http://127.0.0.1:8002/"); | ||
78 | this.UserSendKey = OpenSim.Framework.Console.MainLog.Instance.CmdPrompt("Key to send to user server","null"); | ||
79 | this.UserRecvKey = OpenSim.Framework.Console.MainLog.Instance.CmdPrompt("Key to expect from user server","null"); | ||
80 | |||
81 | // Region Server Options | ||
82 | this.SimSendKey = OpenSim.Framework.Console.MainLog.Instance.CmdPrompt("Key to send to sims","null"); | ||
83 | this.SimRecvKey = OpenSim.Framework.Console.MainLog.Instance.CmdPrompt("Key to expect from sims","null"); | ||
84 | } | ||
85 | |||
86 | /// <summary> | ||
87 | /// Initialises a new configuration object | ||
88 | /// </summary> | ||
89 | public override void InitConfig() { | ||
90 | try { | ||
91 | // Perform Db4o initialisation | ||
92 | db = Db4oFactory.OpenFile("opengrid.yap"); | ||
93 | |||
94 | // Locate the grid configuration object | ||
95 | IObjectSet result = db.Get(typeof(DbGridConfig)); | ||
96 | // Found? | ||
97 | if(result.Count==1) { | ||
98 | OpenSim.Framework.Console.MainLog.Instance.Verbose("Config.cs:InitConfig() - Found a GridConfig object in the local database, loading"); | ||
99 | foreach (DbGridConfig cfg in result) { | ||
100 | // Import each setting into this class | ||
101 | // Grid Settings | ||
102 | this.GridOwner=cfg.GridOwner; | ||
103 | // Asset Settings | ||
104 | this.DefaultAssetServer=cfg.DefaultAssetServer; | ||
105 | this.AssetSendKey=cfg.AssetSendKey; | ||
106 | this.AssetRecvKey=cfg.AssetRecvKey; | ||
107 | // User Settings | ||
108 | this.DefaultUserServer=cfg.DefaultUserServer; | ||
109 | this.UserSendKey=cfg.UserSendKey; | ||
110 | this.UserRecvKey=cfg.UserRecvKey; | ||
111 | // Region Settings | ||
112 | this.SimSendKey=cfg.SimSendKey; | ||
113 | this.SimRecvKey=cfg.SimRecvKey; | ||
114 | } | ||
115 | // Create a new configuration object from this class | ||
116 | } else { | ||
117 | OpenSim.Framework.Console.MainLog.Instance.Verbose("Config.cs:InitConfig() - Could not find object in database, loading precompiled defaults"); | ||
118 | |||
119 | // Load default settings into this class | ||
120 | LoadDefaults(); | ||
121 | |||
122 | // Saves to the database file... | ||
123 | OpenSim.Framework.Console.MainLog.Instance.Verbose( "Writing out default settings to local database"); | ||
124 | db.Set(this); | ||
125 | |||
126 | // Closes file locks | ||
127 | db.Close(); | ||
128 | } | ||
129 | } catch(Exception e) { | ||
130 | OpenSim.Framework.Console.MainLog.Instance.Warn("Config.cs:InitConfig() - Exception occured"); | ||
131 | OpenSim.Framework.Console.MainLog.Instance.Warn(e.ToString()); | ||
132 | } | ||
133 | |||
134 | // Grid Settings | ||
135 | OpenSim.Framework.Console.MainLog.Instance.Verbose("Grid settings loaded:"); | ||
136 | OpenSim.Framework.Console.MainLog.Instance.Verbose("Grid owner: " + this.GridOwner); | ||
137 | |||
138 | // Asset Settings | ||
139 | OpenSim.Framework.Console.MainLog.Instance.Verbose("Default asset server: " + this.DefaultAssetServer); | ||
140 | OpenSim.Framework.Console.MainLog.Instance.Verbose("Key to send to asset server: " + this.AssetSendKey); | ||
141 | OpenSim.Framework.Console.MainLog.Instance.Verbose("Key to expect from asset server: " + this.AssetRecvKey); | ||
142 | |||
143 | // User Settings | ||
144 | OpenSim.Framework.Console.MainLog.Instance.Verbose("Default user server: " + this.DefaultUserServer); | ||
145 | OpenSim.Framework.Console.MainLog.Instance.Verbose("Key to send to user server: " + this.UserSendKey); | ||
146 | OpenSim.Framework.Console.MainLog.Instance.Verbose("Key to expect from user server: " + this.UserRecvKey); | ||
147 | |||
148 | // Region Settings | ||
149 | OpenSim.Framework.Console.MainLog.Instance.Verbose("Key to send to sims: " + this.SimSendKey); | ||
150 | OpenSim.Framework.Console.MainLog.Instance.Verbose("Key to expect from sims: " + this.SimRecvKey); | ||
151 | } | ||
152 | |||
153 | /// <summary> | ||
154 | /// Closes down the database and releases filesystem locks | ||
155 | /// </summary> | ||
156 | public void Shutdown() { | ||
157 | db.Close(); | ||
158 | } | ||
159 | } | ||
160 | |||
161 | } | ||
diff --git a/OpenSim/Grid/GridServer.Config/OpenSim.Grid.GridServer.Config.csproj b/OpenSim/Grid/GridServer.Config/OpenSim.Grid.GridServer.Config.csproj new file mode 100644 index 0000000..24e845c --- /dev/null +++ b/OpenSim/Grid/GridServer.Config/OpenSim.Grid.GridServer.Config.csproj | |||
@@ -0,0 +1,107 @@ | |||
1 | <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
2 | <PropertyGroup> | ||
3 | <ProjectType>Local</ProjectType> | ||
4 | <ProductVersion>8.0.50727</ProductVersion> | ||
5 | <SchemaVersion>2.0</SchemaVersion> | ||
6 | <ProjectGuid>{1442B635-0000-0000-0000-000000000000}</ProjectGuid> | ||
7 | <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
8 | <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
9 | <ApplicationIcon></ApplicationIcon> | ||
10 | <AssemblyKeyContainerName> | ||
11 | </AssemblyKeyContainerName> | ||
12 | <AssemblyName>OpenSim.Grid.GridServer.Config</AssemblyName> | ||
13 | <DefaultClientScript>JScript</DefaultClientScript> | ||
14 | <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout> | ||
15 | <DefaultTargetSchema>IE50</DefaultTargetSchema> | ||
16 | <DelaySign>false</DelaySign> | ||
17 | <OutputType>Library</OutputType> | ||
18 | <AppDesignerFolder></AppDesignerFolder> | ||
19 | <RootNamespace>OpenSim.Grid.GridServer.Config</RootNamespace> | ||
20 | <StartupObject></StartupObject> | ||
21 | <FileUpgradeFlags> | ||
22 | </FileUpgradeFlags> | ||
23 | </PropertyGroup> | ||
24 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
25 | <AllowUnsafeBlocks>False</AllowUnsafeBlocks> | ||
26 | <BaseAddress>285212672</BaseAddress> | ||
27 | <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> | ||
28 | <ConfigurationOverrideFile> | ||
29 | </ConfigurationOverrideFile> | ||
30 | <DefineConstants>TRACE;DEBUG</DefineConstants> | ||
31 | <DocumentationFile></DocumentationFile> | ||
32 | <DebugSymbols>True</DebugSymbols> | ||
33 | <FileAlignment>4096</FileAlignment> | ||
34 | <Optimize>False</Optimize> | ||
35 | <OutputPath>..\..\..\bin\</OutputPath> | ||
36 | <RegisterForComInterop>False</RegisterForComInterop> | ||
37 | <RemoveIntegerChecks>False</RemoveIntegerChecks> | ||
38 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> | ||
39 | <WarningLevel>4</WarningLevel> | ||
40 | <NoWarn></NoWarn> | ||
41 | </PropertyGroup> | ||
42 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
43 | <AllowUnsafeBlocks>False</AllowUnsafeBlocks> | ||
44 | <BaseAddress>285212672</BaseAddress> | ||
45 | <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> | ||
46 | <ConfigurationOverrideFile> | ||
47 | </ConfigurationOverrideFile> | ||
48 | <DefineConstants>TRACE</DefineConstants> | ||
49 | <DocumentationFile></DocumentationFile> | ||
50 | <DebugSymbols>False</DebugSymbols> | ||
51 | <FileAlignment>4096</FileAlignment> | ||
52 | <Optimize>True</Optimize> | ||
53 | <OutputPath>..\..\..\bin\</OutputPath> | ||
54 | <RegisterForComInterop>False</RegisterForComInterop> | ||
55 | <RemoveIntegerChecks>False</RemoveIntegerChecks> | ||
56 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> | ||
57 | <WarningLevel>4</WarningLevel> | ||
58 | <NoWarn></NoWarn> | ||
59 | </PropertyGroup> | ||
60 | <ItemGroup> | ||
61 | <Reference Include="Db4objects.Db4o.dll" > | ||
62 | <HintPath>..\..\..\bin\Db4objects.Db4o.dll</HintPath> | ||
63 | <Private>False</Private> | ||
64 | </Reference> | ||
65 | <Reference Include="libsecondlife.dll" > | ||
66 | <HintPath>..\..\..\bin\libsecondlife.dll</HintPath> | ||
67 | <Private>False</Private> | ||
68 | </Reference> | ||
69 | <Reference Include="OpenSim.Framework" > | ||
70 | <HintPath>OpenSim.Framework.dll</HintPath> | ||
71 | <Private>False</Private> | ||
72 | </Reference> | ||
73 | <Reference Include="OpenSim.Framework.Console" > | ||
74 | <HintPath>OpenSim.Framework.Console.dll</HintPath> | ||
75 | <Private>False</Private> | ||
76 | </Reference> | ||
77 | <Reference Include="System" > | ||
78 | <HintPath>System.dll</HintPath> | ||
79 | <Private>False</Private> | ||
80 | </Reference> | ||
81 | <Reference Include="System.Data.dll" > | ||
82 | <HintPath>..\..\..\bin\System.Data.dll</HintPath> | ||
83 | <Private>False</Private> | ||
84 | </Reference> | ||
85 | <Reference Include="System.Xml" > | ||
86 | <HintPath>System.Xml.dll</HintPath> | ||
87 | <Private>False</Private> | ||
88 | </Reference> | ||
89 | </ItemGroup> | ||
90 | <ItemGroup> | ||
91 | </ItemGroup> | ||
92 | <ItemGroup> | ||
93 | <Compile Include="AssemblyInfo.cs"> | ||
94 | <SubType>Code</SubType> | ||
95 | </Compile> | ||
96 | <Compile Include="DbGridConfig.cs"> | ||
97 | <SubType>Code</SubType> | ||
98 | </Compile> | ||
99 | </ItemGroup> | ||
100 | <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" /> | ||
101 | <PropertyGroup> | ||
102 | <PreBuildEvent> | ||
103 | </PreBuildEvent> | ||
104 | <PostBuildEvent> | ||
105 | </PostBuildEvent> | ||
106 | </PropertyGroup> | ||
107 | </Project> | ||
diff --git a/OpenSim/Grid/GridServer.Config/OpenSim.Grid.GridServer.Config.dll.build b/OpenSim/Grid/GridServer.Config/OpenSim.Grid.GridServer.Config.dll.build new file mode 100644 index 0000000..ff57dac --- /dev/null +++ b/OpenSim/Grid/GridServer.Config/OpenSim.Grid.GridServer.Config.dll.build | |||
@@ -0,0 +1,46 @@ | |||
1 | <?xml version="1.0" ?> | ||
2 | <project name="OpenSim.Grid.GridServer.Config" default="build"> | ||
3 | <target name="build"> | ||
4 | <echo message="Build Directory is ${project::get-base-directory()}/${build.dir}" /> | ||
5 | <mkdir dir="${project::get-base-directory()}/${build.dir}" /> | ||
6 | <copy todir="${project::get-base-directory()}/${build.dir}"> | ||
7 | <fileset basedir="${project::get-base-directory()}"> | ||
8 | </fileset> | ||
9 | </copy> | ||
10 | <csc target="library" debug="${build.debug}" unsafe="False" define="TRACE;DEBUG" output="${project::get-base-directory()}/${build.dir}/${project::get-name()}.dll"> | ||
11 | <resources prefix="OpenSim.Grid.GridServer.Config" dynamicprefix="true" > | ||
12 | </resources> | ||
13 | <sources failonempty="true"> | ||
14 | <include name="AssemblyInfo.cs" /> | ||
15 | <include name="DbGridConfig.cs" /> | ||
16 | </sources> | ||
17 | <references basedir="${project::get-base-directory()}"> | ||
18 | <lib> | ||
19 | <include name="${project::get-base-directory()}" /> | ||
20 | <include name="${project::get-base-directory()}/${build.dir}" /> | ||
21 | </lib> | ||
22 | <include name="../../../bin/Db4objects.Db4o.dll" /> | ||
23 | <include name="../../../bin/libsecondlife.dll" /> | ||
24 | <include name="OpenSim.Framework.dll" /> | ||
25 | <include name="OpenSim.Framework.Console.dll" /> | ||
26 | <include name="System.dll" /> | ||
27 | <include name="System.Data.dll.dll" /> | ||
28 | <include name="System.Xml.dll" /> | ||
29 | </references> | ||
30 | </csc> | ||
31 | <echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../../../bin/" /> | ||
32 | <mkdir dir="${project::get-base-directory()}/../../../bin/"/> | ||
33 | <copy todir="${project::get-base-directory()}/../../../bin/"> | ||
34 | <fileset basedir="${project::get-base-directory()}/${build.dir}/" > | ||
35 | <include name="*.dll"/> | ||
36 | <include name="*.exe"/> | ||
37 | </fileset> | ||
38 | </copy> | ||
39 | </target> | ||
40 | <target name="clean"> | ||
41 | <delete dir="${bin.dir}" failonerror="false" /> | ||
42 | <delete dir="${obj.dir}" failonerror="false" /> | ||
43 | </target> | ||
44 | <target name="doc" description="Creates documentation."> | ||
45 | </target> | ||
46 | </project> | ||
diff --git a/OpenSim/Grid/GridServer/GridManager.cs b/OpenSim/Grid/GridServer/GridManager.cs new file mode 100644 index 0000000..c78d14a --- /dev/null +++ b/OpenSim/Grid/GridServer/GridManager.cs | |||
@@ -0,0 +1,599 @@ | |||
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 System.Reflection; | ||
33 | using OpenSim.Framework.Data; | ||
34 | using OpenSim.Framework.Utilities; | ||
35 | using OpenSim.Framework.Console; | ||
36 | using OpenSim.Framework.Sims; | ||
37 | using libsecondlife; | ||
38 | using Nwc.XmlRpc; | ||
39 | using System.Xml; | ||
40 | |||
41 | namespace OpenSim.Grid.GridServer | ||
42 | { | ||
43 | class GridManager | ||
44 | { | ||
45 | Dictionary<string, IGridData> _plugins = new Dictionary<string, IGridData>(); | ||
46 | Dictionary<string, ILogData> _logplugins = new Dictionary<string, ILogData>(); | ||
47 | |||
48 | public OpenSim.Framework.Interfaces.GridConfig config; | ||
49 | |||
50 | /// <summary> | ||
51 | /// Adds a new grid server plugin - grid servers will be requested in the order they were loaded. | ||
52 | /// </summary> | ||
53 | /// <param name="FileName">The filename to the grid server plugin DLL</param> | ||
54 | public void AddPlugin(string FileName) | ||
55 | { | ||
56 | OpenSim.Framework.Console.MainLog.Instance.Verbose("Storage: Attempting to load " + FileName); | ||
57 | Assembly pluginAssembly = Assembly.LoadFrom(FileName); | ||
58 | |||
59 | OpenSim.Framework.Console.MainLog.Instance.Verbose("Storage: Found " + pluginAssembly.GetTypes().Length + " interfaces."); | ||
60 | foreach (Type pluginType in pluginAssembly.GetTypes()) | ||
61 | { | ||
62 | if (!pluginType.IsAbstract) | ||
63 | { | ||
64 | // Regions go here | ||
65 | Type typeInterface = pluginType.GetInterface("IGridData", true); | ||
66 | |||
67 | if (typeInterface != null) | ||
68 | { | ||
69 | IGridData plug = (IGridData)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); | ||
70 | plug.Initialise(); | ||
71 | this._plugins.Add(plug.getName(), plug); | ||
72 | OpenSim.Framework.Console.MainLog.Instance.Verbose("Storage: Added IGridData Interface"); | ||
73 | } | ||
74 | |||
75 | typeInterface = null; | ||
76 | |||
77 | // Logs go here | ||
78 | typeInterface = pluginType.GetInterface("ILogData", true); | ||
79 | |||
80 | if (typeInterface != null) | ||
81 | { | ||
82 | ILogData plug = (ILogData)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); | ||
83 | plug.Initialise(); | ||
84 | this._logplugins.Add(plug.getName(), plug); | ||
85 | OpenSim.Framework.Console.MainLog.Instance.Verbose( "Storage: Added ILogData Interface"); | ||
86 | } | ||
87 | |||
88 | typeInterface = null; | ||
89 | } | ||
90 | } | ||
91 | |||
92 | pluginAssembly = null; | ||
93 | } | ||
94 | |||
95 | /// <summary> | ||
96 | /// Logs a piece of information to the database | ||
97 | /// </summary> | ||
98 | /// <param name="target">What you were operating on (in grid server, this will likely be the region UUIDs)</param> | ||
99 | /// <param name="method">Which method is being called?</param> | ||
100 | /// <param name="args">What arguments are being passed?</param> | ||
101 | /// <param name="priority">How high priority is this? 1 = Max, 6 = Verbose</param> | ||
102 | /// <param name="message">The message to log</param> | ||
103 | private void logToDB(string target, string method, string args, int priority, string message) | ||
104 | { | ||
105 | foreach (KeyValuePair<string, ILogData> kvp in _logplugins) | ||
106 | { | ||
107 | try | ||
108 | { | ||
109 | kvp.Value.saveLog("Gridserver", target, method, args, priority, message); | ||
110 | } | ||
111 | catch (Exception e) | ||
112 | { | ||
113 | OpenSim.Framework.Console.MainLog.Instance.Warn("Storage: unable to write log via " + kvp.Key); | ||
114 | } | ||
115 | } | ||
116 | } | ||
117 | |||
118 | /// <summary> | ||
119 | /// Returns a region by argument | ||
120 | /// </summary> | ||
121 | /// <param name="uuid">A UUID key of the region to return</param> | ||
122 | /// <returns>A SimProfileData for the region</returns> | ||
123 | public SimProfileData getRegion(libsecondlife.LLUUID uuid) | ||
124 | { | ||
125 | foreach(KeyValuePair<string,IGridData> kvp in _plugins) { | ||
126 | try | ||
127 | { | ||
128 | return kvp.Value.GetProfileByLLUUID(uuid); | ||
129 | } | ||
130 | catch (Exception e) | ||
131 | { | ||
132 | OpenSim.Framework.Console.MainLog.Instance.Warn("Storage: Unable to find region " + uuid.ToStringHyphenated() + " via " + kvp.Key); | ||
133 | } | ||
134 | } | ||
135 | return null; | ||
136 | } | ||
137 | |||
138 | /// <summary> | ||
139 | /// Returns a region by argument | ||
140 | /// </summary> | ||
141 | /// <param name="uuid">A regionHandle of the region to return</param> | ||
142 | /// <returns>A SimProfileData for the region</returns> | ||
143 | public SimProfileData getRegion(ulong handle) | ||
144 | { | ||
145 | foreach (KeyValuePair<string, IGridData> kvp in _plugins) | ||
146 | { | ||
147 | try | ||
148 | { | ||
149 | return kvp.Value.GetProfileByHandle(handle); | ||
150 | } | ||
151 | catch (Exception e) | ||
152 | { | ||
153 | OpenSim.Framework.Console.MainLog.Instance.Warn("Storage: Unable to find region " + handle.ToString() + " via " + kvp.Key); | ||
154 | } | ||
155 | } | ||
156 | return null; | ||
157 | } | ||
158 | |||
159 | public Dictionary<ulong, SimProfileData> getRegions(uint xmin, uint ymin, uint xmax, uint ymax) | ||
160 | { | ||
161 | Dictionary<ulong, SimProfileData> regions = new Dictionary<ulong, SimProfileData>(); | ||
162 | |||
163 | SimProfileData[] neighbours; | ||
164 | |||
165 | foreach (KeyValuePair<string, IGridData> kvp in _plugins) | ||
166 | { | ||
167 | try | ||
168 | { | ||
169 | neighbours = kvp.Value.GetProfilesInRange(xmin, ymin, xmax, ymax); | ||
170 | foreach (SimProfileData neighbour in neighbours) | ||
171 | { | ||
172 | regions[neighbour.regionHandle] = neighbour; | ||
173 | } | ||
174 | } | ||
175 | catch (Exception e) | ||
176 | { | ||
177 | OpenSim.Framework.Console.MainLog.Instance.Warn("Storage: Unable to query regionblock via " + kvp.Key); | ||
178 | } | ||
179 | } | ||
180 | |||
181 | return regions; | ||
182 | } | ||
183 | |||
184 | /// <summary> | ||
185 | /// Returns a XML String containing a list of the neighbouring regions | ||
186 | /// </summary> | ||
187 | /// <param name="reqhandle">The regionhandle for the center sim</param> | ||
188 | /// <returns>An XML string containing neighbour entities</returns> | ||
189 | public string GetXMLNeighbours(ulong reqhandle) | ||
190 | { | ||
191 | string response = ""; | ||
192 | SimProfileData central_region = getRegion(reqhandle); | ||
193 | SimProfileData neighbour; | ||
194 | for (int x = -1; x < 2; x++) for (int y = -1; y < 2; y++) | ||
195 | { | ||
196 | if (getRegion(Util.UIntsToLong((uint)((central_region.regionLocX + x) * 256), (uint)(central_region.regionLocY + y) * 256)) != null) | ||
197 | { | ||
198 | neighbour = getRegion(Util.UIntsToLong((uint)((central_region.regionLocX + x) * 256), (uint)(central_region.regionLocY + y) * 256)); | ||
199 | response += "<neighbour>"; | ||
200 | response += "<sim_ip>" + neighbour.serverIP + "</sim_ip>"; | ||
201 | response += "<sim_port>" + neighbour.serverPort.ToString() + "</sim_port>"; | ||
202 | response += "<locx>" + neighbour.regionLocX.ToString() + "</locx>"; | ||
203 | response += "<locy>" + neighbour.regionLocY.ToString() + "</locy>"; | ||
204 | response += "<regionhandle>" + neighbour.regionHandle.ToString() + "</regionhandle>"; | ||
205 | response += "</neighbour>"; | ||
206 | |||
207 | } | ||
208 | } | ||
209 | return response; | ||
210 | } | ||
211 | |||
212 | /// <summary> | ||
213 | /// Performed when a region connects to the grid server initially. | ||
214 | /// </summary> | ||
215 | /// <param name="request">The XMLRPC Request</param> | ||
216 | /// <returns>Startup parameters</returns> | ||
217 | public XmlRpcResponse XmlRpcLoginToSimulatorMethod(XmlRpcRequest request) | ||
218 | { | ||
219 | XmlRpcResponse response = new XmlRpcResponse(); | ||
220 | Hashtable responseData = new Hashtable(); | ||
221 | response.Value = responseData; | ||
222 | |||
223 | SimProfileData TheSim = null; | ||
224 | Hashtable requestData = (Hashtable)request.Params[0]; | ||
225 | |||
226 | if (requestData.ContainsKey("UUID")) | ||
227 | { | ||
228 | TheSim = getRegion(new LLUUID((string)requestData["UUID"])); | ||
229 | logToDB((new LLUUID((string)requestData["UUID"])).ToStringHyphenated(),"XmlRpcLoginToSimulatorMethod","", 5,"Region attempting login with UUID."); | ||
230 | } | ||
231 | else if (requestData.ContainsKey("region_handle")) | ||
232 | { | ||
233 | TheSim = getRegion((ulong)Convert.ToUInt64(requestData["region_handle"])); | ||
234 | logToDB((string)requestData["region_handle"], "XmlRpcLoginToSimulatorMethod", "", 5, "Region attempting login with regionHandle."); | ||
235 | } | ||
236 | else | ||
237 | { | ||
238 | responseData["error"] = "No UUID or region_handle passed to grid server - unable to connect you"; | ||
239 | return response; | ||
240 | } | ||
241 | |||
242 | if (TheSim == null) | ||
243 | { | ||
244 | responseData["error"] = "sim not found"; | ||
245 | return response; | ||
246 | } | ||
247 | else | ||
248 | { | ||
249 | |||
250 | ArrayList SimNeighboursData = new ArrayList(); | ||
251 | |||
252 | SimProfileData neighbour; | ||
253 | Hashtable NeighbourBlock; | ||
254 | |||
255 | bool fastMode = false; // Only compatible with MySQL right now | ||
256 | |||
257 | if (fastMode) | ||
258 | { | ||
259 | Dictionary<ulong, SimProfileData> neighbours = getRegions(TheSim.regionLocX - 1, TheSim.regionLocY - 1, TheSim.regionLocX + 1, TheSim.regionLocY + 1); | ||
260 | |||
261 | foreach (KeyValuePair<ulong, SimProfileData> aSim in neighbours) | ||
262 | { | ||
263 | NeighbourBlock = new Hashtable(); | ||
264 | NeighbourBlock["sim_ip"] = aSim.Value.serverIP.ToString(); | ||
265 | NeighbourBlock["sim_port"] = aSim.Value.serverPort.ToString(); | ||
266 | NeighbourBlock["region_locx"] = aSim.Value.regionLocX.ToString(); | ||
267 | NeighbourBlock["region_locy"] = aSim.Value.regionLocY.ToString(); | ||
268 | NeighbourBlock["UUID"] = aSim.Value.UUID.ToString(); | ||
269 | |||
270 | if (aSim.Value.UUID != TheSim.UUID) | ||
271 | SimNeighboursData.Add(NeighbourBlock); | ||
272 | } | ||
273 | } | ||
274 | else | ||
275 | { | ||
276 | for (int x = -1; x < 2; x++) for (int y = -1; y < 2; y++) | ||
277 | { | ||
278 | if (getRegion(Helpers.UIntsToLong((uint)((TheSim.regionLocX + x) * 256), (uint)(TheSim.regionLocY + y) * 256)) != null) | ||
279 | { | ||
280 | neighbour = getRegion(Helpers.UIntsToLong((uint)((TheSim.regionLocX + x) * 256), (uint)(TheSim.regionLocY + y) * 256)); | ||
281 | |||
282 | NeighbourBlock = new Hashtable(); | ||
283 | NeighbourBlock["sim_ip"] = neighbour.serverIP; | ||
284 | NeighbourBlock["sim_port"] = neighbour.serverPort.ToString(); | ||
285 | NeighbourBlock["region_locx"] = neighbour.regionLocX.ToString(); | ||
286 | NeighbourBlock["region_locy"] = neighbour.regionLocY.ToString(); | ||
287 | NeighbourBlock["UUID"] = neighbour.UUID.ToString(); | ||
288 | |||
289 | if (neighbour.UUID != TheSim.UUID) SimNeighboursData.Add(NeighbourBlock); | ||
290 | } | ||
291 | } | ||
292 | } | ||
293 | |||
294 | responseData["UUID"] = TheSim.UUID.ToString(); | ||
295 | responseData["region_locx"] = TheSim.regionLocX.ToString(); | ||
296 | responseData["region_locy"] = TheSim.regionLocY.ToString(); | ||
297 | responseData["regionname"] = TheSim.regionName; | ||
298 | responseData["estate_id"] = "1"; | ||
299 | responseData["neighbours"] = SimNeighboursData; | ||
300 | |||
301 | responseData["sim_ip"] = TheSim.serverIP; | ||
302 | responseData["sim_port"] = TheSim.serverPort.ToString(); | ||
303 | responseData["asset_url"] = TheSim.regionAssetURI; | ||
304 | responseData["asset_sendkey"] = TheSim.regionAssetSendKey; | ||
305 | responseData["asset_recvkey"] = TheSim.regionAssetRecvKey; | ||
306 | responseData["user_url"] = TheSim.regionUserURI; | ||
307 | responseData["user_sendkey"] = TheSim.regionUserSendKey; | ||
308 | responseData["user_recvkey"] = TheSim.regionUserRecvKey; | ||
309 | responseData["authkey"] = TheSim.regionSecret; | ||
310 | |||
311 | // New! If set, use as URL to local sim storage (ie http://remotehost/region.yap) | ||
312 | responseData["data_uri"] = TheSim.regionDataURI; | ||
313 | } | ||
314 | |||
315 | return response; | ||
316 | } | ||
317 | |||
318 | public XmlRpcResponse XmlRpcMapBlockMethod(XmlRpcRequest request) | ||
319 | { | ||
320 | int xmin=980, ymin=980, xmax=1020, ymax=1020; | ||
321 | |||
322 | Hashtable requestData = (Hashtable)request.Params[0]; | ||
323 | if (requestData.ContainsKey("xmin")) | ||
324 | { | ||
325 | xmin = (Int32)requestData["xmin"]; | ||
326 | } | ||
327 | if (requestData.ContainsKey("ymin")) | ||
328 | { | ||
329 | ymin = (Int32)requestData["ymin"]; | ||
330 | } | ||
331 | if (requestData.ContainsKey("xmax")) | ||
332 | { | ||
333 | xmax = (Int32)requestData["xmax"]; | ||
334 | } | ||
335 | if (requestData.ContainsKey("ymax")) | ||
336 | { | ||
337 | ymax = (Int32)requestData["ymax"]; | ||
338 | } | ||
339 | |||
340 | XmlRpcResponse response = new XmlRpcResponse(); | ||
341 | Hashtable responseData = new Hashtable(); | ||
342 | response.Value = responseData; | ||
343 | IList simProfileList = new ArrayList(); | ||
344 | |||
345 | bool fastMode = true; // MySQL Only | ||
346 | |||
347 | if (fastMode) | ||
348 | { | ||
349 | Dictionary<ulong, SimProfileData> neighbours = getRegions((uint)xmin, (uint)ymin, (uint)xmax, (uint)ymax); | ||
350 | |||
351 | foreach (KeyValuePair<ulong, SimProfileData> aSim in neighbours) | ||
352 | { | ||
353 | Hashtable simProfileBlock = new Hashtable(); | ||
354 | simProfileBlock["x"] = aSim.Value.regionLocX.ToString(); | ||
355 | simProfileBlock["y"] = aSim.Value.regionLocY.ToString(); | ||
356 | simProfileBlock["name"] = aSim.Value.regionName; | ||
357 | simProfileBlock["access"] = 21; | ||
358 | simProfileBlock["region-flags"] = 512; | ||
359 | simProfileBlock["water-height"] = 0; | ||
360 | simProfileBlock["agents"] = 1; | ||
361 | simProfileBlock["map-image-id"] = aSim.Value.regionMapTextureID.ToString(); | ||
362 | |||
363 | // For Sugilite compatibility | ||
364 | simProfileBlock["regionhandle"] = aSim.Value.regionHandle.ToString(); | ||
365 | simProfileBlock["sim_ip"] = aSim.Value.serverIP.ToString(); | ||
366 | simProfileBlock["sim_port"] = aSim.Value.serverPort.ToString(); | ||
367 | simProfileBlock["sim_uri"] = aSim.Value.serverURI.ToString(); | ||
368 | simProfileBlock["uuid"] = aSim.Value.UUID.ToStringHyphenated(); | ||
369 | |||
370 | simProfileList.Add(simProfileBlock); | ||
371 | } | ||
372 | OpenSim.Framework.Console.MainLog.Instance.Verbose("World map request processed, returned " + simProfileList.Count.ToString() + " region(s) in range via FastMode"); | ||
373 | } | ||
374 | else | ||
375 | { | ||
376 | SimProfileData simProfile; | ||
377 | for (int x = xmin; x < xmax; x++) | ||
378 | { | ||
379 | for (int y = ymin; y < ymax; y++) | ||
380 | { | ||
381 | simProfile = getRegion(Helpers.UIntsToLong((uint)(x * 256), (uint)(y * 256))); | ||
382 | if (simProfile != null) | ||
383 | { | ||
384 | Hashtable simProfileBlock = new Hashtable(); | ||
385 | simProfileBlock["x"] = x; | ||
386 | simProfileBlock["y"] = y; | ||
387 | simProfileBlock["name"] = simProfile.regionName; | ||
388 | simProfileBlock["access"] = 0; | ||
389 | simProfileBlock["region-flags"] = 0; | ||
390 | simProfileBlock["water-height"] = 20; | ||
391 | simProfileBlock["agents"] = 1; | ||
392 | simProfileBlock["map-image-id"] = simProfile.regionMapTextureID.ToString(); | ||
393 | |||
394 | // For Sugilite compatibility | ||
395 | simProfileBlock["regionhandle"] = simProfile.regionHandle.ToString(); | ||
396 | simProfileBlock["sim_ip"] = simProfile.serverIP.ToString(); | ||
397 | simProfileBlock["sim_port"] = simProfile.serverPort.ToString(); | ||
398 | simProfileBlock["sim_uri"] = simProfile.serverURI.ToString(); | ||
399 | simProfileBlock["uuid"] = simProfile.UUID.ToStringHyphenated(); | ||
400 | |||
401 | simProfileList.Add(simProfileBlock); | ||
402 | } | ||
403 | } | ||
404 | } | ||
405 | OpenSim.Framework.Console.MainLog.Instance.Verbose("World map request processed, returned " + simProfileList.Count.ToString() + " region(s) in range via Standard Mode"); | ||
406 | } | ||
407 | |||
408 | responseData["sim-profiles"] = simProfileList; | ||
409 | |||
410 | return response; | ||
411 | } | ||
412 | |||
413 | |||
414 | |||
415 | /// <summary> | ||
416 | /// Performs a REST Get Operation | ||
417 | /// </summary> | ||
418 | /// <param name="request"></param> | ||
419 | /// <param name="path"></param> | ||
420 | /// <param name="param"></param> | ||
421 | /// <returns></returns> | ||
422 | public string RestGetRegionMethod(string request, string path, string param) | ||
423 | { | ||
424 | return RestGetSimMethod("", "/sims/", param); | ||
425 | } | ||
426 | |||
427 | /// <summary> | ||
428 | /// Performs a REST Set Operation | ||
429 | /// </summary> | ||
430 | /// <param name="request"></param> | ||
431 | /// <param name="path"></param> | ||
432 | /// <param name="param"></param> | ||
433 | /// <returns></returns> | ||
434 | public string RestSetRegionMethod(string request, string path, string param) | ||
435 | { | ||
436 | return RestSetSimMethod("", "/sims/", param); | ||
437 | } | ||
438 | |||
439 | /// <summary> | ||
440 | /// Returns information about a sim via a REST Request | ||
441 | /// </summary> | ||
442 | /// <param name="request"></param> | ||
443 | /// <param name="path"></param> | ||
444 | /// <param name="param"></param> | ||
445 | /// <returns>Information about the sim in XML</returns> | ||
446 | public string RestGetSimMethod(string request, string path, string param) | ||
447 | { | ||
448 | string respstring = String.Empty; | ||
449 | |||
450 | SimProfileData TheSim; | ||
451 | LLUUID UUID = new LLUUID(param); | ||
452 | TheSim = getRegion(UUID); | ||
453 | |||
454 | if (!(TheSim == null)) | ||
455 | { | ||
456 | respstring = "<Root>"; | ||
457 | respstring += "<authkey>" + TheSim.regionSendKey + "</authkey>"; | ||
458 | respstring += "<sim>"; | ||
459 | respstring += "<uuid>" + TheSim.UUID.ToString() + "</uuid>"; | ||
460 | respstring += "<regionname>" + TheSim.regionName + "</regionname>"; | ||
461 | respstring += "<sim_ip>" + TheSim.serverIP + "</sim_ip>"; | ||
462 | respstring += "<sim_port>" + TheSim.serverPort.ToString() + "</sim_port>"; | ||
463 | respstring += "<region_locx>" + TheSim.regionLocX.ToString() + "</region_locx>"; | ||
464 | respstring += "<region_locy>" + TheSim.regionLocY.ToString() + "</region_locy>"; | ||
465 | respstring += "<estate_id>1</estate_id>"; | ||
466 | respstring += "</sim>"; | ||
467 | respstring += "</Root>"; | ||
468 | } | ||
469 | |||
470 | return respstring; | ||
471 | } | ||
472 | |||
473 | /// <summary> | ||
474 | /// Creates or updates a sim via a REST Method Request | ||
475 | /// BROKEN with SQL Update | ||
476 | /// </summary> | ||
477 | /// <param name="request"></param> | ||
478 | /// <param name="path"></param> | ||
479 | /// <param name="param"></param> | ||
480 | /// <returns>"OK" or an error</returns> | ||
481 | public string RestSetSimMethod(string request, string path, string param) | ||
482 | { | ||
483 | Console.WriteLine("Processing region update"); | ||
484 | SimProfileData TheSim; | ||
485 | TheSim = getRegion(new LLUUID(param)); | ||
486 | if ((TheSim) == null) | ||
487 | { | ||
488 | TheSim = new SimProfileData(); | ||
489 | LLUUID UUID = new LLUUID(param); | ||
490 | TheSim.UUID = UUID; | ||
491 | TheSim.regionRecvKey = config.SimRecvKey; | ||
492 | } | ||
493 | |||
494 | XmlDocument doc = new XmlDocument(); | ||
495 | doc.LoadXml(request); | ||
496 | XmlNode rootnode = doc.FirstChild; | ||
497 | XmlNode authkeynode = rootnode.ChildNodes[0]; | ||
498 | if (authkeynode.Name != "authkey") | ||
499 | { | ||
500 | return "ERROR! bad XML - expected authkey tag"; | ||
501 | } | ||
502 | |||
503 | XmlNode simnode = rootnode.ChildNodes[1]; | ||
504 | if (simnode.Name != "sim") | ||
505 | { | ||
506 | return "ERROR! bad XML - expected sim tag"; | ||
507 | } | ||
508 | |||
509 | if (authkeynode.InnerText != TheSim.regionRecvKey) | ||
510 | { | ||
511 | return "ERROR! invalid key"; | ||
512 | } | ||
513 | |||
514 | //TheSim.regionSendKey = Cfg; | ||
515 | TheSim.regionRecvKey = config.SimRecvKey; | ||
516 | TheSim.regionSendKey = config.SimSendKey; | ||
517 | TheSim.regionSecret = config.SimRecvKey; | ||
518 | TheSim.regionDataURI = ""; | ||
519 | TheSim.regionAssetURI = config.DefaultAssetServer; | ||
520 | TheSim.regionAssetRecvKey = config.AssetRecvKey; | ||
521 | TheSim.regionAssetSendKey = config.AssetSendKey; | ||
522 | TheSim.regionUserURI = config.DefaultUserServer; | ||
523 | TheSim.regionUserSendKey = config.UserSendKey; | ||
524 | TheSim.regionUserRecvKey = config.UserRecvKey; | ||
525 | |||
526 | |||
527 | for (int i = 0; i < simnode.ChildNodes.Count; i++) | ||
528 | { | ||
529 | switch (simnode.ChildNodes[i].Name) | ||
530 | { | ||
531 | case "regionname": | ||
532 | TheSim.regionName = simnode.ChildNodes[i].InnerText; | ||
533 | break; | ||
534 | |||
535 | case "sim_ip": | ||
536 | TheSim.serverIP = simnode.ChildNodes[i].InnerText; | ||
537 | break; | ||
538 | |||
539 | case "sim_port": | ||
540 | TheSim.serverPort = Convert.ToUInt32(simnode.ChildNodes[i].InnerText); | ||
541 | break; | ||
542 | |||
543 | case "region_locx": | ||
544 | TheSim.regionLocX = Convert.ToUInt32((string)simnode.ChildNodes[i].InnerText); | ||
545 | TheSim.regionHandle = Helpers.UIntsToLong((TheSim.regionLocX * 256), (TheSim.regionLocY * 256)); | ||
546 | break; | ||
547 | |||
548 | case "region_locy": | ||
549 | TheSim.regionLocY = Convert.ToUInt32((string)simnode.ChildNodes[i].InnerText); | ||
550 | TheSim.regionHandle = Helpers.UIntsToLong((TheSim.regionLocX * 256), (TheSim.regionLocY * 256)); | ||
551 | break; | ||
552 | } | ||
553 | } | ||
554 | |||
555 | TheSim.serverURI = "http://" + TheSim.serverIP + ":" + TheSim.serverPort + "/"; | ||
556 | |||
557 | bool requirePublic = false; | ||
558 | |||
559 | if (requirePublic && (TheSim.serverIP.StartsWith("172.16") || TheSim.serverIP.StartsWith("192.168") || TheSim.serverIP.StartsWith("10.") || TheSim.serverIP.StartsWith("0.") || TheSim.serverIP.StartsWith("255."))) | ||
560 | { | ||
561 | return "ERROR! Servers must register with public addresses."; | ||
562 | } | ||
563 | |||
564 | |||
565 | try | ||
566 | { | ||
567 | OpenSim.Framework.Console.MainLog.Instance.Verbose("Updating / adding via " + _plugins.Count + " storage provider(s) registered."); | ||
568 | foreach (KeyValuePair<string, IGridData> kvp in _plugins) | ||
569 | { | ||
570 | try | ||
571 | { | ||
572 | //Check reservations | ||
573 | ReservationData reserveData = kvp.Value.GetReservationAtPoint(TheSim.regionLocX, TheSim.regionLocY); | ||
574 | if ((reserveData != null && reserveData.gridRecvKey == TheSim.regionRecvKey) || (reserveData == null)) | ||
575 | { | ||
576 | kvp.Value.AddProfile(TheSim); | ||
577 | OpenSim.Framework.Console.MainLog.Instance.Verbose("New sim added to grid (" + TheSim.regionName + ")"); | ||
578 | logToDB(TheSim.UUID.ToStringHyphenated(), "RestSetSimMethod", "", 5, "Region successfully updated and connected to grid."); | ||
579 | } | ||
580 | else | ||
581 | { | ||
582 | return "Unable to update region (RestSetSimMethod): Incorrect auth key."; | ||
583 | } | ||
584 | } | ||
585 | catch (Exception e) | ||
586 | { | ||
587 | OpenSim.Framework.Console.MainLog.Instance.Verbose("getRegionPlugin Handle " + kvp.Key + " unable to add new sim: " + e.ToString()); | ||
588 | } | ||
589 | } | ||
590 | return "OK"; | ||
591 | } | ||
592 | catch (Exception e) | ||
593 | { | ||
594 | return "ERROR! Could not save to database! (" + e.ToString() + ")"; | ||
595 | } | ||
596 | } | ||
597 | |||
598 | } | ||
599 | } | ||
diff --git a/OpenSim/Grid/GridServer/Main.cs b/OpenSim/Grid/GridServer/Main.cs new file mode 100644 index 0000000..b225214 --- /dev/null +++ b/OpenSim/Grid/GridServer/Main.cs | |||
@@ -0,0 +1,271 @@ | |||
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 System.Timers; | ||
33 | using System.Net; | ||
34 | using System.Threading; | ||
35 | using System.Reflection; | ||
36 | using libsecondlife; | ||
37 | using OpenSim.Framework.Manager; | ||
38 | using OpenSim.Framework; | ||
39 | using OpenSim.Framework.Sims; | ||
40 | using OpenSim.Framework.Console; | ||
41 | using OpenSim.Framework.Interfaces; | ||
42 | using OpenSim.Framework.Servers; | ||
43 | using OpenSim.GenericConfig; | ||
44 | |||
45 | namespace OpenSim.Grid.GridServer | ||
46 | { | ||
47 | /// <summary> | ||
48 | /// </summary> | ||
49 | public class OpenGrid_Main : conscmd_callback | ||
50 | { | ||
51 | private string ConfigDll = "OpenGrid.Config.GridConfigDb4o.dll"; | ||
52 | private string GridDll = "OpenSim.Framework.Data.MySQL.dll"; | ||
53 | public GridConfig Cfg; | ||
54 | |||
55 | public static OpenGrid_Main thegrid; | ||
56 | protected IGenericConfig localXMLConfig; | ||
57 | |||
58 | public static bool setuponly; | ||
59 | |||
60 | //public LLUUID highestUUID; | ||
61 | |||
62 | // private SimProfileManager m_simProfileManager; | ||
63 | |||
64 | private GridManager m_gridManager; | ||
65 | |||
66 | private LogBase m_console; | ||
67 | |||
68 | [STAThread] | ||
69 | public static void Main(string[] args) | ||
70 | { | ||
71 | if (args.Length > 0) | ||
72 | { | ||
73 | if (args[0] == "-setuponly") setuponly = true; | ||
74 | } | ||
75 | Console.WriteLine("Starting...\n"); | ||
76 | |||
77 | thegrid = new OpenGrid_Main(); | ||
78 | thegrid.Startup(); | ||
79 | |||
80 | thegrid.Work(); | ||
81 | } | ||
82 | |||
83 | private void Work() | ||
84 | { | ||
85 | while (true) | ||
86 | { | ||
87 | Thread.Sleep(5000); | ||
88 | // should flush the DB etc here | ||
89 | } | ||
90 | } | ||
91 | |||
92 | private OpenGrid_Main() | ||
93 | { | ||
94 | m_console = new LogBase("opengrid-gridserver-console.log", "OpenGrid", this, false); | ||
95 | MainLog.Instance = m_console; | ||
96 | |||
97 | |||
98 | } | ||
99 | |||
100 | public void managercallback(string cmd) | ||
101 | { | ||
102 | switch (cmd) | ||
103 | { | ||
104 | case "shutdown": | ||
105 | RunCmd("shutdown", new string[0]); | ||
106 | break; | ||
107 | } | ||
108 | } | ||
109 | |||
110 | |||
111 | public void Startup() | ||
112 | { | ||
113 | this.localXMLConfig = new XmlConfig("GridServerConfig.xml"); | ||
114 | this.localXMLConfig.LoadData(); | ||
115 | this.ConfigDB(this.localXMLConfig); | ||
116 | this.localXMLConfig.Close(); | ||
117 | |||
118 | m_console.Verbose( "Main.cs:Startup() - Loading configuration"); | ||
119 | Cfg = this.LoadConfigDll(this.ConfigDll); | ||
120 | Cfg.InitConfig(); | ||
121 | if (setuponly) Environment.Exit(0); | ||
122 | |||
123 | m_console.Verbose( "Main.cs:Startup() - Connecting to Storage Server"); | ||
124 | m_gridManager = new GridManager(); | ||
125 | m_gridManager.AddPlugin(GridDll); // Made of win | ||
126 | m_gridManager.config = Cfg; | ||
127 | |||
128 | m_console.Verbose( "Main.cs:Startup() - Starting HTTP process"); | ||
129 | BaseHttpServer httpServer = new BaseHttpServer(8001); | ||
130 | //GridManagementAgent GridManagerAgent = new GridManagementAgent(httpServer, "gridserver", Cfg.SimSendKey, Cfg.SimRecvKey, managercallback); | ||
131 | |||
132 | httpServer.AddXmlRPCHandler("simulator_login", m_gridManager.XmlRpcLoginToSimulatorMethod); | ||
133 | httpServer.AddXmlRPCHandler("map_block", m_gridManager.XmlRpcMapBlockMethod); | ||
134 | |||
135 | httpServer.AddRestHandler("GET", "/sims/", m_gridManager.RestGetSimMethod); | ||
136 | httpServer.AddRestHandler("POST", "/sims/", m_gridManager.RestSetSimMethod); | ||
137 | httpServer.AddRestHandler("GET", "/regions/", m_gridManager.RestGetRegionMethod); | ||
138 | httpServer.AddRestHandler("POST", "/regions/", m_gridManager.RestSetRegionMethod); | ||
139 | |||
140 | |||
141 | // lbsa71 : This code snippet taken from old http server. | ||
142 | // I have no idea what this was supposed to do - looks like an infinite recursion to me. | ||
143 | // case "regions": | ||
144 | //// DIRTY HACK ALERT | ||
145 | //Console.Notice("/regions/ accessed"); | ||
146 | //TheSim = OpenGrid_Main.thegrid._regionmanager.GetProfileByHandle((ulong)Convert.ToUInt64(rest_params[1])); | ||
147 | //respstring = ParseREST("/regions/" + rest_params[1], requestBody, HTTPmethod); | ||
148 | //break; | ||
149 | |||
150 | // lbsa71 : I guess these were never used? | ||
151 | //Listener.Prefixes.Add("http://+:8001/gods/"); | ||
152 | //Listener.Prefixes.Add("http://+:8001/highestuuid/"); | ||
153 | //Listener.Prefixes.Add("http://+:8001/uuidblocks/"); | ||
154 | |||
155 | httpServer.Start(); | ||
156 | |||
157 | m_console.Verbose( "Main.cs:Startup() - Starting sim status checker"); | ||
158 | |||
159 | System.Timers.Timer simCheckTimer = new System.Timers.Timer(3600000 * 3); // 3 Hours between updates. | ||
160 | simCheckTimer.Elapsed += new ElapsedEventHandler(CheckSims); | ||
161 | simCheckTimer.Enabled = true; | ||
162 | } | ||
163 | |||
164 | private GridConfig LoadConfigDll(string dllName) | ||
165 | { | ||
166 | Assembly pluginAssembly = Assembly.LoadFrom(dllName); | ||
167 | GridConfig config = null; | ||
168 | |||
169 | foreach (Type pluginType in pluginAssembly.GetTypes()) | ||
170 | { | ||
171 | if (pluginType.IsPublic) | ||
172 | { | ||
173 | if (!pluginType.IsAbstract) | ||
174 | { | ||
175 | Type typeInterface = pluginType.GetInterface("IGridConfig", true); | ||
176 | |||
177 | if (typeInterface != null) | ||
178 | { | ||
179 | IGridConfig plug = (IGridConfig)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); | ||
180 | config = plug.GetConfigObject(); | ||
181 | break; | ||
182 | } | ||
183 | |||
184 | typeInterface = null; | ||
185 | } | ||
186 | } | ||
187 | } | ||
188 | pluginAssembly = null; | ||
189 | return config; | ||
190 | } | ||
191 | |||
192 | public void CheckSims(object sender, ElapsedEventArgs e) | ||
193 | { | ||
194 | /* | ||
195 | foreach (SimProfileBase sim in m_simProfileManager.SimProfiles.Values) | ||
196 | { | ||
197 | string SimResponse = ""; | ||
198 | try | ||
199 | { | ||
200 | WebRequest CheckSim = WebRequest.Create("http://" + sim.sim_ip + ":" + sim.sim_port.ToString() + "/checkstatus/"); | ||
201 | CheckSim.Method = "GET"; | ||
202 | CheckSim.ContentType = "text/plaintext"; | ||
203 | CheckSim.ContentLength = 0; | ||
204 | |||
205 | StreamWriter stOut = new StreamWriter(CheckSim.GetRequestStream(), System.Text.Encoding.ASCII); | ||
206 | stOut.Write(""); | ||
207 | stOut.Close(); | ||
208 | |||
209 | StreamReader stIn = new StreamReader(CheckSim.GetResponse().GetResponseStream()); | ||
210 | SimResponse = stIn.ReadToEnd(); | ||
211 | stIn.Close(); | ||
212 | } | ||
213 | catch | ||
214 | { | ||
215 | } | ||
216 | |||
217 | if (SimResponse == "OK") | ||
218 | { | ||
219 | m_simProfileManager.SimProfiles[sim.UUID].online = true; | ||
220 | } | ||
221 | else | ||
222 | { | ||
223 | m_simProfileManager.SimProfiles[sim.UUID].online = false; | ||
224 | } | ||
225 | } | ||
226 | */ | ||
227 | } | ||
228 | |||
229 | public void RunCmd(string cmd, string[] cmdparams) | ||
230 | { | ||
231 | switch (cmd) | ||
232 | { | ||
233 | case "help": | ||
234 | m_console.Notice("shutdown - shutdown the grid (USE CAUTION!)"); | ||
235 | break; | ||
236 | |||
237 | case "shutdown": | ||
238 | m_console.Close(); | ||
239 | Environment.Exit(0); | ||
240 | break; | ||
241 | } | ||
242 | } | ||
243 | |||
244 | public void Show(string ShowWhat) | ||
245 | { | ||
246 | } | ||
247 | |||
248 | private void ConfigDB(IGenericConfig configData) | ||
249 | { | ||
250 | try | ||
251 | { | ||
252 | string attri = ""; | ||
253 | attri = configData.GetAttribute("DataBaseProvider"); | ||
254 | if (attri == "") | ||
255 | { | ||
256 | GridDll = "OpenSim.Framework.Data.DB4o.dll"; | ||
257 | configData.SetAttribute("DataBaseProvider", "OpenSim.Framework.Data.DB4o.dll"); | ||
258 | } | ||
259 | else | ||
260 | { | ||
261 | GridDll = attri; | ||
262 | } | ||
263 | configData.Commit(); | ||
264 | } | ||
265 | catch (Exception e) | ||
266 | { | ||
267 | |||
268 | } | ||
269 | } | ||
270 | } | ||
271 | } | ||
diff --git a/OpenSim/Grid/GridServer/OpenSim.Grid.GridServer.csproj b/OpenSim/Grid/GridServer/OpenSim.Grid.GridServer.csproj new file mode 100644 index 0000000..424072e --- /dev/null +++ b/OpenSim/Grid/GridServer/OpenSim.Grid.GridServer.csproj | |||
@@ -0,0 +1,134 @@ | |||
1 | <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
2 | <PropertyGroup> | ||
3 | <ProjectType>Local</ProjectType> | ||
4 | <ProductVersion>8.0.50727</ProductVersion> | ||
5 | <SchemaVersion>2.0</SchemaVersion> | ||
6 | <ProjectGuid>{60FCC3A6-0000-0000-0000-000000000000}</ProjectGuid> | ||
7 | <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
8 | <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
9 | <ApplicationIcon></ApplicationIcon> | ||
10 | <AssemblyKeyContainerName> | ||
11 | </AssemblyKeyContainerName> | ||
12 | <AssemblyName>OpenSim.Grid.GridServer</AssemblyName> | ||
13 | <DefaultClientScript>JScript</DefaultClientScript> | ||
14 | <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout> | ||
15 | <DefaultTargetSchema>IE50</DefaultTargetSchema> | ||
16 | <DelaySign>false</DelaySign> | ||
17 | <OutputType>Exe</OutputType> | ||
18 | <AppDesignerFolder></AppDesignerFolder> | ||
19 | <RootNamespace>OpenSim.Grid.GridServer</RootNamespace> | ||
20 | <StartupObject></StartupObject> | ||
21 | <FileUpgradeFlags> | ||
22 | </FileUpgradeFlags> | ||
23 | </PropertyGroup> | ||
24 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
25 | <AllowUnsafeBlocks>False</AllowUnsafeBlocks> | ||
26 | <BaseAddress>285212672</BaseAddress> | ||
27 | <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> | ||
28 | <ConfigurationOverrideFile> | ||
29 | </ConfigurationOverrideFile> | ||
30 | <DefineConstants>TRACE;DEBUG</DefineConstants> | ||
31 | <DocumentationFile></DocumentationFile> | ||
32 | <DebugSymbols>True</DebugSymbols> | ||
33 | <FileAlignment>4096</FileAlignment> | ||
34 | <Optimize>False</Optimize> | ||
35 | <OutputPath>..\..\..\bin\</OutputPath> | ||
36 | <RegisterForComInterop>False</RegisterForComInterop> | ||
37 | <RemoveIntegerChecks>False</RemoveIntegerChecks> | ||
38 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> | ||
39 | <WarningLevel>4</WarningLevel> | ||
40 | <NoWarn></NoWarn> | ||
41 | </PropertyGroup> | ||
42 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
43 | <AllowUnsafeBlocks>False</AllowUnsafeBlocks> | ||
44 | <BaseAddress>285212672</BaseAddress> | ||
45 | <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> | ||
46 | <ConfigurationOverrideFile> | ||
47 | </ConfigurationOverrideFile> | ||
48 | <DefineConstants>TRACE</DefineConstants> | ||
49 | <DocumentationFile></DocumentationFile> | ||
50 | <DebugSymbols>False</DebugSymbols> | ||
51 | <FileAlignment>4096</FileAlignment> | ||
52 | <Optimize>True</Optimize> | ||
53 | <OutputPath>..\..\..\bin\</OutputPath> | ||
54 | <RegisterForComInterop>False</RegisterForComInterop> | ||
55 | <RemoveIntegerChecks>False</RemoveIntegerChecks> | ||
56 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> | ||
57 | <WarningLevel>4</WarningLevel> | ||
58 | <NoWarn></NoWarn> | ||
59 | </PropertyGroup> | ||
60 | <ItemGroup> | ||
61 | <Reference Include="Db4objects.Db4o.dll" > | ||
62 | <HintPath>..\..\..\bin\Db4objects.Db4o.dll</HintPath> | ||
63 | <Private>False</Private> | ||
64 | </Reference> | ||
65 | <Reference Include="libsecondlife.dll" > | ||
66 | <HintPath>..\..\..\bin\libsecondlife.dll</HintPath> | ||
67 | <Private>False</Private> | ||
68 | </Reference> | ||
69 | <Reference Include="OpenSim.Framework" > | ||
70 | <HintPath>OpenSim.Framework.dll</HintPath> | ||
71 | <Private>False</Private> | ||
72 | </Reference> | ||
73 | <Reference Include="OpenSim.Framework.Console" > | ||
74 | <HintPath>OpenSim.Framework.Console.dll</HintPath> | ||
75 | <Private>False</Private> | ||
76 | </Reference> | ||
77 | <Reference Include="OpenSim.Framework.GenericConfig.Xml" > | ||
78 | <HintPath>OpenSim.Framework.GenericConfig.Xml.dll</HintPath> | ||
79 | <Private>False</Private> | ||
80 | </Reference> | ||
81 | <Reference Include="OpenSim.Framework.Servers" > | ||
82 | <HintPath>OpenSim.Framework.Servers.dll</HintPath> | ||
83 | <Private>False</Private> | ||
84 | </Reference> | ||
85 | <Reference Include="System" > | ||
86 | <HintPath>System.dll</HintPath> | ||
87 | <Private>False</Private> | ||
88 | </Reference> | ||
89 | <Reference Include="System.Data" > | ||
90 | <HintPath>System.Data.dll</HintPath> | ||
91 | <Private>False</Private> | ||
92 | </Reference> | ||
93 | <Reference Include="System.Xml" > | ||
94 | <HintPath>System.Xml.dll</HintPath> | ||
95 | <Private>False</Private> | ||
96 | </Reference> | ||
97 | <Reference Include="XMLRPC.dll" > | ||
98 | <HintPath>..\..\..\bin\XMLRPC.dll</HintPath> | ||
99 | <Private>False</Private> | ||
100 | </Reference> | ||
101 | </ItemGroup> | ||
102 | <ItemGroup> | ||
103 | <ProjectReference Include="..\..\Framework\Data\OpenSim.Framework.Data.csproj"> | ||
104 | <Name>OpenSim.Framework.Data</Name> | ||
105 | <Project>{36B72A9B-0000-0000-0000-000000000000}</Project> | ||
106 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> | ||
107 | <Private>False</Private> | ||
108 | </ProjectReference> | ||
109 | <ProjectReference Include="..\Framework.Manager\OpenSim.Grid.Framework.Manager.csproj"> | ||
110 | <Name>OpenSim.Grid.Framework.Manager</Name> | ||
111 | <Project>{4B7BFD1C-0000-0000-0000-000000000000}</Project> | ||
112 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> | ||
113 | <Private>False</Private> | ||
114 | </ProjectReference> | ||
115 | </ItemGroup> | ||
116 | <ItemGroup> | ||
117 | <Compile Include="GridManager.cs"> | ||
118 | <SubType>Code</SubType> | ||
119 | </Compile> | ||
120 | <Compile Include="Main.cs"> | ||
121 | <SubType>Code</SubType> | ||
122 | </Compile> | ||
123 | <Compile Include="Properties\AssemblyInfo.cs"> | ||
124 | <SubType>Code</SubType> | ||
125 | </Compile> | ||
126 | </ItemGroup> | ||
127 | <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" /> | ||
128 | <PropertyGroup> | ||
129 | <PreBuildEvent> | ||
130 | </PreBuildEvent> | ||
131 | <PostBuildEvent> | ||
132 | </PostBuildEvent> | ||
133 | </PropertyGroup> | ||
134 | </Project> | ||
diff --git a/OpenSim/Grid/GridServer/OpenSim.Grid.GridServer.exe.build b/OpenSim/Grid/GridServer/OpenSim.Grid.GridServer.exe.build new file mode 100644 index 0000000..3573e89 --- /dev/null +++ b/OpenSim/Grid/GridServer/OpenSim.Grid.GridServer.exe.build | |||
@@ -0,0 +1,52 @@ | |||
1 | <?xml version="1.0" ?> | ||
2 | <project name="OpenSim.Grid.GridServer" default="build"> | ||
3 | <target name="build"> | ||
4 | <echo message="Build Directory is ${project::get-base-directory()}/${build.dir}" /> | ||
5 | <mkdir dir="${project::get-base-directory()}/${build.dir}" /> | ||
6 | <copy todir="${project::get-base-directory()}/${build.dir}"> | ||
7 | <fileset basedir="${project::get-base-directory()}"> | ||
8 | </fileset> | ||
9 | </copy> | ||
10 | <csc target="exe" debug="${build.debug}" unsafe="False" define="TRACE;DEBUG" output="${project::get-base-directory()}/${build.dir}/${project::get-name()}.exe"> | ||
11 | <resources prefix="OpenSim.Grid.GridServer" dynamicprefix="true" > | ||
12 | </resources> | ||
13 | <sources failonempty="true"> | ||
14 | <include name="GridManager.cs" /> | ||
15 | <include name="Main.cs" /> | ||
16 | <include name="Properties/AssemblyInfo.cs" /> | ||
17 | </sources> | ||
18 | <references basedir="${project::get-base-directory()}"> | ||
19 | <lib> | ||
20 | <include name="${project::get-base-directory()}" /> | ||
21 | <include name="${project::get-base-directory()}/${build.dir}" /> | ||
22 | </lib> | ||
23 | <include name="../../../bin/Db4objects.Db4o.dll" /> | ||
24 | <include name="../../../bin/libsecondlife.dll" /> | ||
25 | <include name="OpenSim.Framework.dll" /> | ||
26 | <include name="OpenSim.Framework.Console.dll" /> | ||
27 | <include name="../../../bin/OpenSim.Framework.Data.dll" /> | ||
28 | <include name="OpenSim.Framework.GenericConfig.Xml.dll" /> | ||
29 | <include name="OpenSim.Framework.Servers.dll" /> | ||
30 | <include name="../../../bin/OpenSim.Grid.Framework.Manager.dll" /> | ||
31 | <include name="System.dll" /> | ||
32 | <include name="System.Data.dll" /> | ||
33 | <include name="System.Xml.dll" /> | ||
34 | <include name="../../../bin/XMLRPC.dll" /> | ||
35 | </references> | ||
36 | </csc> | ||
37 | <echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../../../bin/" /> | ||
38 | <mkdir dir="${project::get-base-directory()}/../../../bin/"/> | ||
39 | <copy todir="${project::get-base-directory()}/../../../bin/"> | ||
40 | <fileset basedir="${project::get-base-directory()}/${build.dir}/" > | ||
41 | <include name="*.dll"/> | ||
42 | <include name="*.exe"/> | ||
43 | </fileset> | ||
44 | </copy> | ||
45 | </target> | ||
46 | <target name="clean"> | ||
47 | <delete dir="${bin.dir}" failonerror="false" /> | ||
48 | <delete dir="${obj.dir}" failonerror="false" /> | ||
49 | </target> | ||
50 | <target name="doc" description="Creates documentation."> | ||
51 | </target> | ||
52 | </project> | ||
diff --git a/OpenSim/Grid/GridServer/Properties/AssemblyInfo.cs b/OpenSim/Grid/GridServer/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..303dddf --- /dev/null +++ b/OpenSim/Grid/GridServer/Properties/AssemblyInfo.cs | |||
@@ -0,0 +1,60 @@ | |||
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.CompilerServices; | ||
30 | using System.Runtime.InteropServices; | ||
31 | |||
32 | // General Information about an assembly is controlled through the following | ||
33 | // set of attributes. Change these attribute values to modify the information | ||
34 | // associated with an assembly. | ||
35 | [assembly: AssemblyTitle("OGS-GridServer")] | ||
36 | [assembly: AssemblyDescription("")] | ||
37 | [assembly: AssemblyConfiguration("")] | ||
38 | [assembly: AssemblyCompany("")] | ||
39 | [assembly: AssemblyProduct("OGS-GridServer")] | ||
40 | [assembly: AssemblyCopyright("Copyright © 2007")] | ||
41 | [assembly: AssemblyTrademark("")] | ||
42 | [assembly: AssemblyCulture("")] | ||
43 | |||
44 | // Setting ComVisible to false makes the types in this assembly not visible | ||
45 | // to COM components. If you need to access a type in this assembly from | ||
46 | // COM, set the ComVisible attribute to true on that type. | ||
47 | [assembly: ComVisible(false)] | ||
48 | |||
49 | // The following GUID is for the ID of the typelib if this project is exposed to COM | ||
50 | [assembly: Guid("b541b244-3d1d-4625-9003-bc2a3a6a39a4")] | ||
51 | |||
52 | // Version information for an assembly consists of the following four values: | ||
53 | // | ||
54 | // Major Version | ||
55 | // Minor Version | ||
56 | // Build Number | ||
57 | // Revision | ||
58 | // | ||
59 | [assembly: AssemblyVersion("1.0.0.0")] | ||
60 | [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..25e0211 --- /dev/null +++ b/OpenSim/Grid/UserServer.Config/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.CompilerServices; | ||
30 | using System.Runtime.InteropServices; | ||
31 | |||
32 | // Information about this assembly is defined by the following | ||
33 | // attributes. | ||
34 | // | ||
35 | // change them to the information which is associated with the assembly | ||
36 | // you compile. | ||
37 | |||
38 | [assembly: AssemblyTitle("UserConfig")] | ||
39 | [assembly: AssemblyDescription("")] | ||
40 | [assembly: AssemblyConfiguration("")] | ||
41 | [assembly: AssemblyCompany("")] | ||
42 | [assembly: AssemblyProduct("UserConfig")] | ||
43 | [assembly: AssemblyCopyright("")] | ||
44 | [assembly: AssemblyTrademark("")] | ||
45 | [assembly: AssemblyCulture("")] | ||
46 | |||
47 | // This sets the default COM visibility of types in the assembly to invisible. | ||
48 | // If you need to expose a type to COM, use [ComVisible(true)] on that type. | ||
49 | [assembly: ComVisible(false)] | ||
50 | |||
51 | // The assembly version has following format : | ||
52 | // | ||
53 | // Major.Minor.Build.Revision | ||
54 | // | ||
55 | // You can specify all values by your own or you can build default build and revision | ||
56 | // numbers with the '*' character (the default): | ||
57 | |||
58 | [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..770a6b9 --- /dev/null +++ b/OpenSim/Grid/UserServer.Config/DbUserConfig.cs | |||
@@ -0,0 +1,96 @@ | |||
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.Generic; | ||
30 | using OpenSim.Framework.Console; | ||
31 | using OpenSim.Framework.Interfaces; | ||
32 | using Db4objects.Db4o; | ||
33 | |||
34 | namespace OpenUser.Config.UserConfigDb4o | ||
35 | { | ||
36 | public class Db4oConfigPlugin: IUserConfig | ||
37 | { | ||
38 | public UserConfig GetConfigObject() | ||
39 | { | ||
40 | OpenSim.Framework.Console.MainLog.Instance.Verbose("Loading Db40Config dll"); | ||
41 | return ( new DbUserConfig()); | ||
42 | } | ||
43 | } | ||
44 | |||
45 | public class DbUserConfig : UserConfig | ||
46 | { | ||
47 | private IObjectContainer db; | ||
48 | |||
49 | public void LoadDefaults() { | ||
50 | OpenSim.Framework.Console.MainLog.Instance.Notice("Config.cs:LoadDefaults() - Please press enter to retain default or enter new settings"); | ||
51 | |||
52 | this.DefaultStartupMsg = OpenSim.Framework.Console.MainLog.Instance.CmdPrompt("Default startup message", "Welcome to OGS"); | ||
53 | |||
54 | this.GridServerURL = OpenSim.Framework.Console.MainLog.Instance.CmdPrompt("Grid server URL","http://127.0.0.1:8001/"); | ||
55 | this.GridSendKey = OpenSim.Framework.Console.MainLog.Instance.CmdPrompt("Key to send to grid server","null"); | ||
56 | this.GridRecvKey = OpenSim.Framework.Console.MainLog.Instance.CmdPrompt("Key to expect from grid server","null"); | ||
57 | } | ||
58 | |||
59 | public override void InitConfig() { | ||
60 | try { | ||
61 | db = Db4oFactory.OpenFile("openuser.yap"); | ||
62 | IObjectSet result = db.Get(typeof(DbUserConfig)); | ||
63 | if(result.Count==1) { | ||
64 | OpenSim.Framework.Console.MainLog.Instance.Verbose("Config.cs:InitConfig() - Found a UserConfig object in the local database, loading"); | ||
65 | foreach (DbUserConfig cfg in result) { | ||
66 | this.GridServerURL=cfg.GridServerURL; | ||
67 | this.GridSendKey=cfg.GridSendKey; | ||
68 | this.GridRecvKey=cfg.GridRecvKey; | ||
69 | this.DefaultStartupMsg=cfg.DefaultStartupMsg; | ||
70 | } | ||
71 | } else { | ||
72 | OpenSim.Framework.Console.MainLog.Instance.Verbose("Config.cs:InitConfig() - Could not find object in database, loading precompiled defaults"); | ||
73 | LoadDefaults(); | ||
74 | OpenSim.Framework.Console.MainLog.Instance.Verbose("Writing out default settings to local database"); | ||
75 | db.Set(this); | ||
76 | db.Close(); | ||
77 | } | ||
78 | } catch(Exception e) { | ||
79 | OpenSim.Framework.Console.MainLog.Instance.Warn("Config.cs:InitConfig() - Exception occured"); | ||
80 | OpenSim.Framework.Console.MainLog.Instance.Warn(e.ToString()); | ||
81 | } | ||
82 | |||
83 | OpenSim.Framework.Console.MainLog.Instance.Verbose("User settings loaded:"); | ||
84 | OpenSim.Framework.Console.MainLog.Instance.Verbose("Default startup message: " + this.DefaultStartupMsg); | ||
85 | OpenSim.Framework.Console.MainLog.Instance.Verbose("Grid server URL: " + this.GridServerURL); | ||
86 | OpenSim.Framework.Console.MainLog.Instance.Verbose("Key to send to grid: " + this.GridSendKey); | ||
87 | OpenSim.Framework.Console.MainLog.Instance.Verbose("Key to expect from grid: " + this.GridRecvKey); | ||
88 | } | ||
89 | |||
90 | |||
91 | public void Shutdown() { | ||
92 | db.Close(); | ||
93 | } | ||
94 | } | ||
95 | |||
96 | } | ||
diff --git a/OpenSim/Grid/UserServer.Config/OpenSim.Grid.UserServer.Config.csproj b/OpenSim/Grid/UserServer.Config/OpenSim.Grid.UserServer.Config.csproj new file mode 100644 index 0000000..1ae9589 --- /dev/null +++ b/OpenSim/Grid/UserServer.Config/OpenSim.Grid.UserServer.Config.csproj | |||
@@ -0,0 +1,107 @@ | |||
1 | <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
2 | <PropertyGroup> | ||
3 | <ProjectType>Local</ProjectType> | ||
4 | <ProductVersion>8.0.50727</ProductVersion> | ||
5 | <SchemaVersion>2.0</SchemaVersion> | ||
6 | <ProjectGuid>{08F87229-0000-0000-0000-000000000000}</ProjectGuid> | ||
7 | <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
8 | <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
9 | <ApplicationIcon></ApplicationIcon> | ||
10 | <AssemblyKeyContainerName> | ||
11 | </AssemblyKeyContainerName> | ||
12 | <AssemblyName>OpenSim.Grid.UserServer.Config</AssemblyName> | ||
13 | <DefaultClientScript>JScript</DefaultClientScript> | ||
14 | <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout> | ||
15 | <DefaultTargetSchema>IE50</DefaultTargetSchema> | ||
16 | <DelaySign>false</DelaySign> | ||
17 | <OutputType>Library</OutputType> | ||
18 | <AppDesignerFolder></AppDesignerFolder> | ||
19 | <RootNamespace>OpenSim.Grid.UserServer.Config</RootNamespace> | ||
20 | <StartupObject></StartupObject> | ||
21 | <FileUpgradeFlags> | ||
22 | </FileUpgradeFlags> | ||
23 | </PropertyGroup> | ||
24 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
25 | <AllowUnsafeBlocks>False</AllowUnsafeBlocks> | ||
26 | <BaseAddress>285212672</BaseAddress> | ||
27 | <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> | ||
28 | <ConfigurationOverrideFile> | ||
29 | </ConfigurationOverrideFile> | ||
30 | <DefineConstants>TRACE;DEBUG</DefineConstants> | ||
31 | <DocumentationFile></DocumentationFile> | ||
32 | <DebugSymbols>True</DebugSymbols> | ||
33 | <FileAlignment>4096</FileAlignment> | ||
34 | <Optimize>False</Optimize> | ||
35 | <OutputPath>..\..\..\bin\</OutputPath> | ||
36 | <RegisterForComInterop>False</RegisterForComInterop> | ||
37 | <RemoveIntegerChecks>False</RemoveIntegerChecks> | ||
38 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> | ||
39 | <WarningLevel>4</WarningLevel> | ||
40 | <NoWarn></NoWarn> | ||
41 | </PropertyGroup> | ||
42 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
43 | <AllowUnsafeBlocks>False</AllowUnsafeBlocks> | ||
44 | <BaseAddress>285212672</BaseAddress> | ||
45 | <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> | ||
46 | <ConfigurationOverrideFile> | ||
47 | </ConfigurationOverrideFile> | ||
48 | <DefineConstants>TRACE</DefineConstants> | ||
49 | <DocumentationFile></DocumentationFile> | ||
50 | <DebugSymbols>False</DebugSymbols> | ||
51 | <FileAlignment>4096</FileAlignment> | ||
52 | <Optimize>True</Optimize> | ||
53 | <OutputPath>..\..\..\bin\</OutputPath> | ||
54 | <RegisterForComInterop>False</RegisterForComInterop> | ||
55 | <RemoveIntegerChecks>False</RemoveIntegerChecks> | ||
56 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> | ||
57 | <WarningLevel>4</WarningLevel> | ||
58 | <NoWarn></NoWarn> | ||
59 | </PropertyGroup> | ||
60 | <ItemGroup> | ||
61 | <Reference Include="Db4objects.Db4o.dll" > | ||
62 | <HintPath>..\..\..\bin\Db4objects.Db4o.dll</HintPath> | ||
63 | <Private>False</Private> | ||
64 | </Reference> | ||
65 | <Reference Include="libsecondlife.dll" > | ||
66 | <HintPath>..\..\..\bin\libsecondlife.dll</HintPath> | ||
67 | <Private>False</Private> | ||
68 | </Reference> | ||
69 | <Reference Include="OpenSim.Framework" > | ||
70 | <HintPath>OpenSim.Framework.dll</HintPath> | ||
71 | <Private>False</Private> | ||
72 | </Reference> | ||
73 | <Reference Include="OpenSim.Framework.Console" > | ||
74 | <HintPath>OpenSim.Framework.Console.dll</HintPath> | ||
75 | <Private>False</Private> | ||
76 | </Reference> | ||
77 | <Reference Include="System" > | ||
78 | <HintPath>System.dll</HintPath> | ||
79 | <Private>False</Private> | ||
80 | </Reference> | ||
81 | <Reference Include="System.Data.dll" > | ||
82 | <HintPath>..\..\..\bin\System.Data.dll</HintPath> | ||
83 | <Private>False</Private> | ||
84 | </Reference> | ||
85 | <Reference Include="System.Xml" > | ||
86 | <HintPath>System.Xml.dll</HintPath> | ||
87 | <Private>False</Private> | ||
88 | </Reference> | ||
89 | </ItemGroup> | ||
90 | <ItemGroup> | ||
91 | </ItemGroup> | ||
92 | <ItemGroup> | ||
93 | <Compile Include="AssemblyInfo.cs"> | ||
94 | <SubType>Code</SubType> | ||
95 | </Compile> | ||
96 | <Compile Include="DbUserConfig.cs"> | ||
97 | <SubType>Code</SubType> | ||
98 | </Compile> | ||
99 | </ItemGroup> | ||
100 | <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" /> | ||
101 | <PropertyGroup> | ||
102 | <PreBuildEvent> | ||
103 | </PreBuildEvent> | ||
104 | <PostBuildEvent> | ||
105 | </PostBuildEvent> | ||
106 | </PropertyGroup> | ||
107 | </Project> | ||
diff --git a/OpenSim/Grid/UserServer.Config/OpenSim.Grid.UserServer.Config.dll.build b/OpenSim/Grid/UserServer.Config/OpenSim.Grid.UserServer.Config.dll.build new file mode 100644 index 0000000..fc7e00b --- /dev/null +++ b/OpenSim/Grid/UserServer.Config/OpenSim.Grid.UserServer.Config.dll.build | |||
@@ -0,0 +1,46 @@ | |||
1 | <?xml version="1.0" ?> | ||
2 | <project name="OpenSim.Grid.UserServer.Config" default="build"> | ||
3 | <target name="build"> | ||
4 | <echo message="Build Directory is ${project::get-base-directory()}/${build.dir}" /> | ||
5 | <mkdir dir="${project::get-base-directory()}/${build.dir}" /> | ||
6 | <copy todir="${project::get-base-directory()}/${build.dir}"> | ||
7 | <fileset basedir="${project::get-base-directory()}"> | ||
8 | </fileset> | ||
9 | </copy> | ||
10 | <csc target="library" debug="${build.debug}" unsafe="False" define="TRACE;DEBUG" output="${project::get-base-directory()}/${build.dir}/${project::get-name()}.dll"> | ||
11 | <resources prefix="OpenSim.Grid.UserServer.Config" dynamicprefix="true" > | ||
12 | </resources> | ||
13 | <sources failonempty="true"> | ||
14 | <include name="AssemblyInfo.cs" /> | ||
15 | <include name="DbUserConfig.cs" /> | ||
16 | </sources> | ||
17 | <references basedir="${project::get-base-directory()}"> | ||
18 | <lib> | ||
19 | <include name="${project::get-base-directory()}" /> | ||
20 | <include name="${project::get-base-directory()}/${build.dir}" /> | ||
21 | </lib> | ||
22 | <include name="../../../bin/Db4objects.Db4o.dll" /> | ||
23 | <include name="../../../bin/libsecondlife.dll" /> | ||
24 | <include name="OpenSim.Framework.dll" /> | ||
25 | <include name="OpenSim.Framework.Console.dll" /> | ||
26 | <include name="System.dll" /> | ||
27 | <include name="System.Data.dll.dll" /> | ||
28 | <include name="System.Xml.dll" /> | ||
29 | </references> | ||
30 | </csc> | ||
31 | <echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../../../bin/" /> | ||
32 | <mkdir dir="${project::get-base-directory()}/../../../bin/"/> | ||
33 | <copy todir="${project::get-base-directory()}/../../../bin/"> | ||
34 | <fileset basedir="${project::get-base-directory()}/${build.dir}/" > | ||
35 | <include name="*.dll"/> | ||
36 | <include name="*.exe"/> | ||
37 | </fileset> | ||
38 | </copy> | ||
39 | </target> | ||
40 | <target name="clean"> | ||
41 | <delete dir="${bin.dir}" failonerror="false" /> | ||
42 | <delete dir="${obj.dir}" failonerror="false" /> | ||
43 | </target> | ||
44 | <target name="doc" description="Creates documentation."> | ||
45 | </target> | ||
46 | </project> | ||
diff --git a/OpenSim/Grid/UserServer/Main.cs b/OpenSim/Grid/UserServer/Main.cs new file mode 100644 index 0000000..640f91a --- /dev/null +++ b/OpenSim/Grid/UserServer/Main.cs | |||
@@ -0,0 +1,219 @@ | |||
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.Collections.Generic; | ||
32 | using System.Reflection; | ||
33 | using System.IO; | ||
34 | using System.Text; | ||
35 | using libsecondlife; | ||
36 | using OpenSim.Framework.User; | ||
37 | using OpenSim.Framework.Sims; | ||
38 | using OpenSim.Framework.Inventory; | ||
39 | using OpenSim.Framework.Interfaces; | ||
40 | using OpenSim.Framework.Console; | ||
41 | using OpenSim.Framework.Servers; | ||
42 | using OpenSim.Framework.Utilities; | ||
43 | using OpenSim.GenericConfig; | ||
44 | |||
45 | namespace OpenSim.Grid.UserServer | ||
46 | { | ||
47 | /// <summary> | ||
48 | /// </summary> | ||
49 | public class OpenUser_Main : conscmd_callback | ||
50 | { | ||
51 | private string ConfigDll = "OpenSim.Grid.UserServer.Config.dll"; | ||
52 | private string StorageDll = "OpenSim.Framework.Data.MySQL.dll"; | ||
53 | private UserConfig Cfg; | ||
54 | protected IGenericConfig localXMLConfig; | ||
55 | |||
56 | public UserManager m_userManager; | ||
57 | |||
58 | public Dictionary<LLUUID, UserProfile> UserSessions = new Dictionary<LLUUID, UserProfile>(); | ||
59 | |||
60 | LogBase m_console; | ||
61 | |||
62 | [STAThread] | ||
63 | public static void Main(string[] args) | ||
64 | { | ||
65 | Console.WriteLine("Launching UserServer..."); | ||
66 | |||
67 | OpenUser_Main userserver = new OpenUser_Main(); | ||
68 | |||
69 | userserver.Startup(); | ||
70 | userserver.Work(); | ||
71 | } | ||
72 | |||
73 | private OpenUser_Main() | ||
74 | { | ||
75 | m_console = new LogBase("opengrid-userserver-console.log", "OpenUser", this , false); | ||
76 | OpenSim.Framework.Console.MainLog.Instance = m_console; | ||
77 | } | ||
78 | |||
79 | private void Work() | ||
80 | { | ||
81 | m_console.Notice("Enter help for a list of commands\n"); | ||
82 | |||
83 | while (true) | ||
84 | { | ||
85 | m_console.MainLogPrompt(); | ||
86 | } | ||
87 | } | ||
88 | |||
89 | public void Startup() | ||
90 | { | ||
91 | this.localXMLConfig = new XmlConfig("UserServerConfig.xml"); | ||
92 | this.localXMLConfig.LoadData(); | ||
93 | this.ConfigDB(this.localXMLConfig); | ||
94 | this.localXMLConfig.Close(); | ||
95 | |||
96 | OpenSim.Framework.Console.MainLog.Instance.Verbose("Main.cs:Startup() - Loading configuration"); | ||
97 | Cfg = this.LoadConfigDll(this.ConfigDll); | ||
98 | Cfg.InitConfig(); | ||
99 | |||
100 | OpenSim.Framework.Console.MainLog.Instance.Verbose("Main.cs:Startup() - Establishing data connection"); | ||
101 | m_userManager = new UserManager(); | ||
102 | m_userManager._config = Cfg; | ||
103 | m_userManager.AddPlugin(StorageDll); | ||
104 | |||
105 | OpenSim.Framework.Console.MainLog.Instance.Verbose("Main.cs:Startup() - Starting HTTP process"); | ||
106 | BaseHttpServer httpServer = new BaseHttpServer(8002); | ||
107 | |||
108 | httpServer.AddXmlRPCHandler("login_to_simulator", m_userManager.XmlRpcLoginMethod); | ||
109 | |||
110 | httpServer.AddXmlRPCHandler("get_user_by_name", m_userManager.XmlRPCGetUserMethodName); | ||
111 | httpServer.AddXmlRPCHandler("get_user_by_uuid", m_userManager.XmlRPCGetUserMethodUUID); | ||
112 | |||
113 | httpServer.AddRestHandler("DELETE", "/usersessions/", m_userManager.RestDeleteUserSessionMethod); | ||
114 | |||
115 | httpServer.Start(); | ||
116 | m_console.Status("Userserver 0.3 - Startup complete"); | ||
117 | } | ||
118 | |||
119 | |||
120 | public void do_create(string what) | ||
121 | { | ||
122 | switch (what) | ||
123 | { | ||
124 | case "user": | ||
125 | string tempfirstname; | ||
126 | string templastname; | ||
127 | string tempMD5Passwd; | ||
128 | uint regX = 997; | ||
129 | uint regY = 996; | ||
130 | |||
131 | tempfirstname = m_console.CmdPrompt("First name"); | ||
132 | templastname = m_console.CmdPrompt("Last name"); | ||
133 | tempMD5Passwd = m_console.PasswdPrompt("Password"); | ||
134 | regX = Convert.ToUInt32(m_console.CmdPrompt("Start Region X")); | ||
135 | regY = Convert.ToUInt32(m_console.CmdPrompt("Start Region Y")); | ||
136 | |||
137 | tempMD5Passwd = Util.Md5Hash(Util.Md5Hash(tempMD5Passwd) + ":" + ""); | ||
138 | |||
139 | m_userManager.AddUserProfile(tempfirstname, templastname, tempMD5Passwd, regX, regY); | ||
140 | break; | ||
141 | } | ||
142 | } | ||
143 | |||
144 | public void RunCmd(string cmd, string[] cmdparams) | ||
145 | { | ||
146 | switch (cmd) | ||
147 | { | ||
148 | case "help": | ||
149 | m_console.Notice("create user - create a new user"); | ||
150 | m_console.Notice("shutdown - shutdown the grid (USE CAUTION!)"); | ||
151 | break; | ||
152 | |||
153 | case "create": | ||
154 | do_create(cmdparams[0]); | ||
155 | break; | ||
156 | |||
157 | case "shutdown": | ||
158 | m_console.Close(); | ||
159 | Environment.Exit(0); | ||
160 | break; | ||
161 | } | ||
162 | } | ||
163 | |||
164 | private void ConfigDB(IGenericConfig configData) | ||
165 | { | ||
166 | try | ||
167 | { | ||
168 | string attri = ""; | ||
169 | attri = configData.GetAttribute("DataBaseProvider"); | ||
170 | if (attri == "") | ||
171 | { | ||
172 | StorageDll = "OpenSim.Framework.Data.DB4o.dll"; | ||
173 | configData.SetAttribute("DataBaseProvider", "OpenSim.Framework.Data.DB4o.dll"); | ||
174 | } | ||
175 | else | ||
176 | { | ||
177 | StorageDll = attri; | ||
178 | } | ||
179 | configData.Commit(); | ||
180 | } | ||
181 | catch (Exception e) | ||
182 | { | ||
183 | |||
184 | } | ||
185 | } | ||
186 | |||
187 | private UserConfig LoadConfigDll(string dllName) | ||
188 | { | ||
189 | Assembly pluginAssembly = Assembly.LoadFrom(dllName); | ||
190 | UserConfig config = null; | ||
191 | |||
192 | foreach (Type pluginType in pluginAssembly.GetTypes()) | ||
193 | { | ||
194 | if (pluginType.IsPublic) | ||
195 | { | ||
196 | if (!pluginType.IsAbstract) | ||
197 | { | ||
198 | Type typeInterface = pluginType.GetInterface("IUserConfig", true); | ||
199 | |||
200 | if (typeInterface != null) | ||
201 | { | ||
202 | IUserConfig plug = (IUserConfig)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); | ||
203 | config = plug.GetConfigObject(); | ||
204 | break; | ||
205 | } | ||
206 | |||
207 | typeInterface = null; | ||
208 | } | ||
209 | } | ||
210 | } | ||
211 | pluginAssembly = null; | ||
212 | return config; | ||
213 | } | ||
214 | |||
215 | public void Show(string ShowWhat) | ||
216 | { | ||
217 | } | ||
218 | } | ||
219 | } | ||
diff --git a/OpenSim/Grid/UserServer/OpenSim.Grid.UserServer.csproj b/OpenSim/Grid/UserServer/OpenSim.Grid.UserServer.csproj new file mode 100644 index 0000000..1146b17 --- /dev/null +++ b/OpenSim/Grid/UserServer/OpenSim.Grid.UserServer.csproj | |||
@@ -0,0 +1,134 @@ | |||
1 | <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
2 | <PropertyGroup> | ||
3 | <ProjectType>Local</ProjectType> | ||
4 | <ProductVersion>8.0.50727</ProductVersion> | ||
5 | <SchemaVersion>2.0</SchemaVersion> | ||
6 | <ProjectGuid>{2FC96F92-0000-0000-0000-000000000000}</ProjectGuid> | ||
7 | <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
8 | <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
9 | <ApplicationIcon></ApplicationIcon> | ||
10 | <AssemblyKeyContainerName> | ||
11 | </AssemblyKeyContainerName> | ||
12 | <AssemblyName>OpenSim.Grid.UserServer</AssemblyName> | ||
13 | <DefaultClientScript>JScript</DefaultClientScript> | ||
14 | <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout> | ||
15 | <DefaultTargetSchema>IE50</DefaultTargetSchema> | ||
16 | <DelaySign>false</DelaySign> | ||
17 | <OutputType>Exe</OutputType> | ||
18 | <AppDesignerFolder></AppDesignerFolder> | ||
19 | <RootNamespace>OpenSim.Grid.UserServer</RootNamespace> | ||
20 | <StartupObject></StartupObject> | ||
21 | <FileUpgradeFlags> | ||
22 | </FileUpgradeFlags> | ||
23 | </PropertyGroup> | ||
24 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
25 | <AllowUnsafeBlocks>False</AllowUnsafeBlocks> | ||
26 | <BaseAddress>285212672</BaseAddress> | ||
27 | <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> | ||
28 | <ConfigurationOverrideFile> | ||
29 | </ConfigurationOverrideFile> | ||
30 | <DefineConstants>TRACE;DEBUG</DefineConstants> | ||
31 | <DocumentationFile></DocumentationFile> | ||
32 | <DebugSymbols>True</DebugSymbols> | ||
33 | <FileAlignment>4096</FileAlignment> | ||
34 | <Optimize>False</Optimize> | ||
35 | <OutputPath>..\..\..\bin\</OutputPath> | ||
36 | <RegisterForComInterop>False</RegisterForComInterop> | ||
37 | <RemoveIntegerChecks>False</RemoveIntegerChecks> | ||
38 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> | ||
39 | <WarningLevel>4</WarningLevel> | ||
40 | <NoWarn></NoWarn> | ||
41 | </PropertyGroup> | ||
42 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
43 | <AllowUnsafeBlocks>False</AllowUnsafeBlocks> | ||
44 | <BaseAddress>285212672</BaseAddress> | ||
45 | <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> | ||
46 | <ConfigurationOverrideFile> | ||
47 | </ConfigurationOverrideFile> | ||
48 | <DefineConstants>TRACE</DefineConstants> | ||
49 | <DocumentationFile></DocumentationFile> | ||
50 | <DebugSymbols>False</DebugSymbols> | ||
51 | <FileAlignment>4096</FileAlignment> | ||
52 | <Optimize>True</Optimize> | ||
53 | <OutputPath>..\..\..\bin\</OutputPath> | ||
54 | <RegisterForComInterop>False</RegisterForComInterop> | ||
55 | <RemoveIntegerChecks>False</RemoveIntegerChecks> | ||
56 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> | ||
57 | <WarningLevel>4</WarningLevel> | ||
58 | <NoWarn></NoWarn> | ||
59 | </PropertyGroup> | ||
60 | <ItemGroup> | ||
61 | <Reference Include="Db4objects.Db4o.dll" > | ||
62 | <HintPath>..\..\..\bin\Db4objects.Db4o.dll</HintPath> | ||
63 | <Private>False</Private> | ||
64 | </Reference> | ||
65 | <Reference Include="libsecondlife.dll" > | ||
66 | <HintPath>..\..\..\bin\libsecondlife.dll</HintPath> | ||
67 | <Private>False</Private> | ||
68 | </Reference> | ||
69 | <Reference Include="OpenSim.Framework" > | ||
70 | <HintPath>OpenSim.Framework.dll</HintPath> | ||
71 | <Private>False</Private> | ||
72 | </Reference> | ||
73 | <Reference Include="OpenSim.Framework.Console" > | ||
74 | <HintPath>OpenSim.Framework.Console.dll</HintPath> | ||
75 | <Private>False</Private> | ||
76 | </Reference> | ||
77 | <Reference Include="OpenSim.Framework.GenericConfig.Xml" > | ||
78 | <HintPath>OpenSim.Framework.GenericConfig.Xml.dll</HintPath> | ||
79 | <Private>False</Private> | ||
80 | </Reference> | ||
81 | <Reference Include="OpenSim.Framework.Servers" > | ||
82 | <HintPath>OpenSim.Framework.Servers.dll</HintPath> | ||
83 | <Private>False</Private> | ||
84 | </Reference> | ||
85 | <Reference Include="System" > | ||
86 | <HintPath>System.dll</HintPath> | ||
87 | <Private>False</Private> | ||
88 | </Reference> | ||
89 | <Reference Include="System.Data" > | ||
90 | <HintPath>System.Data.dll</HintPath> | ||
91 | <Private>False</Private> | ||
92 | </Reference> | ||
93 | <Reference Include="System.Xml" > | ||
94 | <HintPath>System.Xml.dll</HintPath> | ||
95 | <Private>False</Private> | ||
96 | </Reference> | ||
97 | <Reference Include="XMLRPC.dll" > | ||
98 | <HintPath>..\..\..\bin\XMLRPC.dll</HintPath> | ||
99 | <Private>False</Private> | ||
100 | </Reference> | ||
101 | </ItemGroup> | ||
102 | <ItemGroup> | ||
103 | <ProjectReference Include="..\..\Framework\Data\OpenSim.Framework.Data.csproj"> | ||
104 | <Name>OpenSim.Framework.Data</Name> | ||
105 | <Project>{36B72A9B-0000-0000-0000-000000000000}</Project> | ||
106 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> | ||
107 | <Private>False</Private> | ||
108 | </ProjectReference> | ||
109 | <ProjectReference Include="..\..\Framework\UserManager\OpenSim.Framework.UserManagement.csproj"> | ||
110 | <Name>OpenSim.Framework.UserManagement</Name> | ||
111 | <Project>{586E2916-0000-0000-0000-000000000000}</Project> | ||
112 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> | ||
113 | <Private>False</Private> | ||
114 | </ProjectReference> | ||
115 | </ItemGroup> | ||
116 | <ItemGroup> | ||
117 | <Compile Include="Main.cs"> | ||
118 | <SubType>Code</SubType> | ||
119 | </Compile> | ||
120 | <Compile Include="UserManager.cs"> | ||
121 | <SubType>Code</SubType> | ||
122 | </Compile> | ||
123 | <Compile Include="Properties\AssemblyInfo.cs"> | ||
124 | <SubType>Code</SubType> | ||
125 | </Compile> | ||
126 | </ItemGroup> | ||
127 | <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" /> | ||
128 | <PropertyGroup> | ||
129 | <PreBuildEvent> | ||
130 | </PreBuildEvent> | ||
131 | <PostBuildEvent> | ||
132 | </PostBuildEvent> | ||
133 | </PropertyGroup> | ||
134 | </Project> | ||
diff --git a/OpenSim/Grid/UserServer/OpenSim.Grid.UserServer.exe.build b/OpenSim/Grid/UserServer/OpenSim.Grid.UserServer.exe.build new file mode 100644 index 0000000..8bc1fc1 --- /dev/null +++ b/OpenSim/Grid/UserServer/OpenSim.Grid.UserServer.exe.build | |||
@@ -0,0 +1,52 @@ | |||
1 | <?xml version="1.0" ?> | ||
2 | <project name="OpenSim.Grid.UserServer" default="build"> | ||
3 | <target name="build"> | ||
4 | <echo message="Build Directory is ${project::get-base-directory()}/${build.dir}" /> | ||
5 | <mkdir dir="${project::get-base-directory()}/${build.dir}" /> | ||
6 | <copy todir="${project::get-base-directory()}/${build.dir}"> | ||
7 | <fileset basedir="${project::get-base-directory()}"> | ||
8 | </fileset> | ||
9 | </copy> | ||
10 | <csc target="exe" debug="${build.debug}" unsafe="False" define="TRACE;DEBUG" output="${project::get-base-directory()}/${build.dir}/${project::get-name()}.exe"> | ||
11 | <resources prefix="OpenSim.Grid.UserServer" dynamicprefix="true" > | ||
12 | </resources> | ||
13 | <sources failonempty="true"> | ||
14 | <include name="Main.cs" /> | ||
15 | <include name="UserManager.cs" /> | ||
16 | <include name="Properties/AssemblyInfo.cs" /> | ||
17 | </sources> | ||
18 | <references basedir="${project::get-base-directory()}"> | ||
19 | <lib> | ||
20 | <include name="${project::get-base-directory()}" /> | ||
21 | <include name="${project::get-base-directory()}/${build.dir}" /> | ||
22 | </lib> | ||
23 | <include name="../../../bin/Db4objects.Db4o.dll" /> | ||
24 | <include name="../../../bin/libsecondlife.dll" /> | ||
25 | <include name="OpenSim.Framework.dll" /> | ||
26 | <include name="OpenSim.Framework.Console.dll" /> | ||
27 | <include name="../../../bin/OpenSim.Framework.Data.dll" /> | ||
28 | <include name="OpenSim.Framework.GenericConfig.Xml.dll" /> | ||
29 | <include name="OpenSim.Framework.Servers.dll" /> | ||
30 | <include name="../../../bin/OpenSim.Framework.UserManagement.dll" /> | ||
31 | <include name="System.dll" /> | ||
32 | <include name="System.Data.dll" /> | ||
33 | <include name="System.Xml.dll" /> | ||
34 | <include name="../../../bin/XMLRPC.dll" /> | ||
35 | </references> | ||
36 | </csc> | ||
37 | <echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../../../bin/" /> | ||
38 | <mkdir dir="${project::get-base-directory()}/../../../bin/"/> | ||
39 | <copy todir="${project::get-base-directory()}/../../../bin/"> | ||
40 | <fileset basedir="${project::get-base-directory()}/${build.dir}/" > | ||
41 | <include name="*.dll"/> | ||
42 | <include name="*.exe"/> | ||
43 | </fileset> | ||
44 | </copy> | ||
45 | </target> | ||
46 | <target name="clean"> | ||
47 | <delete dir="${bin.dir}" failonerror="false" /> | ||
48 | <delete dir="${obj.dir}" failonerror="false" /> | ||
49 | </target> | ||
50 | <target name="doc" description="Creates documentation."> | ||
51 | </target> | ||
52 | </project> | ||
diff --git a/OpenSim/Grid/UserServer/Properties/AssemblyInfo.cs b/OpenSim/Grid/UserServer/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..5d5ce8d --- /dev/null +++ b/OpenSim/Grid/UserServer/Properties/AssemblyInfo.cs | |||
@@ -0,0 +1,33 @@ | |||
1 | using System.Reflection; | ||
2 | using System.Runtime.CompilerServices; | ||
3 | using System.Runtime.InteropServices; | ||
4 | |||
5 | // General Information about an assembly is controlled through the following | ||
6 | // set of attributes. Change these attribute values to modify the information | ||
7 | // associated with an assembly. | ||
8 | [assembly: AssemblyTitle("OGS-UserServer")] | ||
9 | [assembly: AssemblyDescription("")] | ||
10 | [assembly: AssemblyConfiguration("")] | ||
11 | [assembly: AssemblyCompany("")] | ||
12 | [assembly: AssemblyProduct("OGS-UserServer")] | ||
13 | [assembly: AssemblyCopyright("Copyright © 2007")] | ||
14 | [assembly: AssemblyTrademark("")] | ||
15 | [assembly: AssemblyCulture("")] | ||
16 | |||
17 | // Setting ComVisible to false makes the types in this assembly not visible | ||
18 | // to COM components. If you need to access a type in this assembly from | ||
19 | // COM, set the ComVisible attribute to true on that type. | ||
20 | [assembly: ComVisible(false)] | ||
21 | |||
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM | ||
23 | [assembly: Guid("e266513a-090b-4d38-80f6-8599eef68c8c")] | ||
24 | |||
25 | // Version information for an assembly consists of the following four values: | ||
26 | // | ||
27 | // Major Version | ||
28 | // Minor Version | ||
29 | // Build Number | ||
30 | // Revision | ||
31 | // | ||
32 | [assembly: AssemblyVersion("1.0.0.0")] | ||
33 | [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..c99cf87 --- /dev/null +++ b/OpenSim/Grid/UserServer/UserManager.cs | |||
@@ -0,0 +1,104 @@ | |||
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 OpenSim.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 OpenSim.Framework.UserManagement; | ||
43 | |||
44 | using System.Security.Cryptography; | ||
45 | |||
46 | namespace OpenSim.Grid.UserServer | ||
47 | { | ||
48 | public class UserManager : UserManagerBase | ||
49 | { | ||
50 | public UserManager() | ||
51 | { | ||
52 | } | ||
53 | |||
54 | /// <summary> | ||
55 | /// Customises the login response and fills in missing values. | ||
56 | /// </summary> | ||
57 | /// <param name="response">The existing response</param> | ||
58 | /// <param name="theUser">The user profile</param> | ||
59 | public override void CustomiseResponse(ref LoginResponse response, ref UserProfileData theUser) | ||
60 | { | ||
61 | // Load information from the gridserver | ||
62 | SimProfile SimInfo = new SimProfile(); | ||
63 | SimInfo = SimInfo.LoadFromGrid(theUser.currentAgent.currentHandle, _config.GridServerURL, _config.GridSendKey, _config.GridRecvKey); | ||
64 | |||
65 | // Customise the response | ||
66 | // Home Location | ||
67 | response.Home = "{'region_handle':[r" + (SimInfo.RegionLocX * 256).ToString() + ",r" + (SimInfo.RegionLocY * 256).ToString() + "], " + | ||
68 | "'position':[r" + theUser.homeLocation.X.ToString() + ",r" + theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "], " + | ||
69 | "'look_at':[r" + theUser.homeLocation.X.ToString() + ",r" + theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "]}"; | ||
70 | |||
71 | // Destination | ||
72 | response.SimAddress = SimInfo.sim_ip; | ||
73 | response.SimPort = (Int32)SimInfo.sim_port; | ||
74 | response.RegionX = SimInfo.RegionLocY ; | ||
75 | response.RegionY = SimInfo.RegionLocX ; | ||
76 | |||
77 | // Notify the target of an incoming user | ||
78 | Console.WriteLine("Notifying " + SimInfo.regionname + " (" + SimInfo.caps_url + ")"); | ||
79 | |||
80 | // Prepare notification | ||
81 | Hashtable SimParams = new Hashtable(); | ||
82 | SimParams["session_id"] = theUser.currentAgent.sessionID.ToString(); | ||
83 | SimParams["secure_session_id"] = theUser.currentAgent.secureSessionID.ToString(); | ||
84 | SimParams["firstname"] = theUser.username; | ||
85 | SimParams["lastname"] = theUser.surname; | ||
86 | SimParams["agent_id"] = theUser.UUID.ToString(); | ||
87 | SimParams["circuit_code"] = (Int32)Convert.ToUInt32(response.CircuitCode); | ||
88 | SimParams["startpos_x"] = theUser.currentAgent.currentPos.X.ToString(); | ||
89 | SimParams["startpos_y"] = theUser.currentAgent.currentPos.Y.ToString(); | ||
90 | SimParams["startpos_z"] = theUser.currentAgent.currentPos.Z.ToString(); | ||
91 | SimParams["regionhandle"] = theUser.currentAgent.currentHandle.ToString(); | ||
92 | ArrayList SendParams = new ArrayList(); | ||
93 | SendParams.Add(SimParams); | ||
94 | |||
95 | // Update agent with target sim | ||
96 | theUser.currentAgent.currentRegion = SimInfo.UUID; | ||
97 | theUser.currentAgent.currentHandle = SimInfo.regionhandle; | ||
98 | |||
99 | // Send | ||
100 | XmlRpcRequest GridReq = new XmlRpcRequest("expect_user", SendParams); | ||
101 | XmlRpcResponse GridResp = GridReq.Send(SimInfo.caps_url, 3000); | ||
102 | } | ||
103 | } | ||
104 | } | ||