aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenGridServices/ServiceManager/ServiceManager.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenGridServices/ServiceManager/ServiceManager.cs76
-rw-r--r--OpenGridServices/ServiceManager/ServiceManager.csproj187
2 files changed, 163 insertions, 100 deletions
diff --git a/OpenGridServices/ServiceManager/ServiceManager.cs b/OpenGridServices/ServiceManager/ServiceManager.cs
index b21a5b1..2491f39 100644
--- a/OpenGridServices/ServiceManager/ServiceManager.cs
+++ b/OpenGridServices/ServiceManager/ServiceManager.cs
@@ -4,10 +4,17 @@ using System.Threading;
4using System.ServiceProcess; 4using System.ServiceProcess;
5using System.Xml; 5using System.Xml;
6using System.IO; 6using System.IO;
7using libsecondlife;
7 8
8public class OpenGridMasterService : System.ServiceProcess.ServiceBase { 9public class OpenGridMasterService : System.ServiceProcess.ServiceBase {
9 10
10 private Thread ServiceWorkerThread; 11 private Thread ServiceWorkerThread;
12 private static string GridURL;
13 private static string SimSendKey;
14 private static string SimRecvKey;
15 private static string AssetURL;
16 private static string UserSendKey;
17 private static string UserRecvKey;
11 18
12 public OpenGridMasterService() 19 public OpenGridMasterService()
13 { 20 {
@@ -66,13 +73,25 @@ public class OpenGridMasterService : System.ServiceProcess.ServiceBase {
66 private static string SetupGrid() 73 private static string SetupGrid()
67 { 74 {
68 Console.WriteLine("Running external program (OpenGridServices.GridServer.exe) to configure the grid server"); 75 Console.WriteLine("Running external program (OpenGridServices.GridServer.exe) to configure the grid server");
69 Process p = new Process(); 76 try {
77 Process p = new Process();
70 78
71 p.StartInfo.Arguments = "-setuponly"; 79 p.StartInfo.Arguments = "-setuponly";
72 p.StartInfo.FileName = "OpenGridServices.GridServer.exe"; 80 p.StartInfo.FileName = "OpenGridServices.GridServer.exe";
73 p.Start(); 81 p.Start();
74 82
75 return "<gridserver />"; // we let the gridserver handle it's own setup 83 p.StartInfo.Arguments = "-dumpxmlconf";
84 p.Start();
85
86 StreamReader reader=new StreamReader("opengrid-cfgdump.xml");
87 string configxml = reader.ReadToEnd();
88 return configxml;
89 } catch(Exception e) {
90 Console.WriteLine("An error occurred while running the grid server, please rectify it and try again");
91 Console.WriteLine(e.ToString());
92 Environment.Exit(1);
93 }
94 return "";
76 } 95 }
77 96
78 private static string SetupUser() 97 private static string SetupUser()
@@ -87,6 +106,53 @@ public class OpenGridMasterService : System.ServiceProcess.ServiceBase {
87 106
88 private static string SetupRegion() 107 private static string SetupRegion()
89 { 108 {
109 string regionname;
110 ulong regionlocx;
111 ulong regionlocy;
112 string default_terrain;
113 uint terrain_multiplier;
114 uint baseport;
115
116 string listenaddr;
117 string simconfigxml;
118 LLUUID SimUUID;
119
120 Console.WriteLine("Setting up region servers");
121 Console.Write("Please specify a path to store your region data (e.g /etc/opensim/regions: ");
122 string regionpath=Console.ReadLine();
123
124 Console.Write("How many regions would you like to configure now? ");
125 int numofregions=Convert.ToInt16(Console.ReadLine());
126
127 Console.Write("What port should the region servers start listening at (first region is normally 9000, then 9001 the second etc, both TCP+UDP): ");
128 baseport=Convert.ToUInt16(Console.ReadLine());
129
130
131 listenaddr=Console.ReadLine();
132
133 Console.WriteLine("Now ready to configure regions, please answer the questions about each region in turn");
134 for(int i=0; i<=numofregions; i++) {
135 Console.WriteLine("Configuring region number " + i.ToString());
136
137 Console.Write("Region name: ");
138 regionname=Console.ReadLine();
139
140 Console.Write("Region location X: ");
141 regionlocx=(ulong)Convert.ToUInt32(Console.ReadLine());
142
143 Console.Write("Region location Y: ");
144 regionlocy=(ulong)Convert.ToUInt32(Console.ReadLine());
145
146 Console.Write("Default terrain file: ");
147 default_terrain=Console.ReadLine();
148 terrain_multiplier=Convert.ToUInt16(Console.ReadLine());
149
150 SimUUID=LLUUID.Random();
151
152 simconfigxml="<Root><Config SimUUID=\"" + SimUUID.ToString() + "\" SimName=\"" + regionname + "\" SimLocationX=\"" + regionlocx.ToString() + "\" SimLocationY=\"" + regionlocy.ToString() + "\" Datastore=\"" + Path.Combine(regionpath,(SimUUID.ToString()+"localworld.yap")) + "\" SimListenPort=\"" + (baseport+i).ToString() + "\" SimListenAddress=\"" + listenaddr + "\" TerrainFile=\"" + default_terrain + "\" TerrainMultiplier=\"" + terrain_multiplier.ToString() + "\" GridServerURL=\"\" GridSendKey=\"\" GridRecvKey=\"\" AssetServerURL=\"\" /></Root>";
153
154 }
155
90 return "<regions></regions>"; 156 return "<regions></regions>";
91 } 157 }
92 158
diff --git a/OpenGridServices/ServiceManager/ServiceManager.csproj b/OpenGridServices/ServiceManager/ServiceManager.csproj
index 392f560..a35e2c1 100644
--- a/OpenGridServices/ServiceManager/ServiceManager.csproj
+++ b/OpenGridServices/ServiceManager/ServiceManager.csproj
@@ -1,95 +1,92 @@
1<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> 1<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2 <PropertyGroup> 2 <PropertyGroup>
3 <ProjectType>Local</ProjectType> 3 <ProjectType>Local</ProjectType>
4 <ProductVersion>8.0.50727</ProductVersion> 4 <ProductVersion>8.0.50727</ProductVersion>
5 <SchemaVersion>2.0</SchemaVersion> 5 <SchemaVersion>2.0</SchemaVersion>
6 <ProjectGuid>{E141F4EE-0000-0000-0000-000000000000}</ProjectGuid> 6 <ProjectGuid>{7C8EA758-0000-0000-0000-000000000000}</ProjectGuid>
7 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> 7 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
8 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> 8 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
9 <ApplicationIcon> 9 <ApplicationIcon></ApplicationIcon>
10 </ApplicationIcon> 10 <AssemblyKeyContainerName>
11 <AssemblyKeyContainerName> 11 </AssemblyKeyContainerName>
12 </AssemblyKeyContainerName> 12 <AssemblyName>ServiceManager</AssemblyName>
13 <AssemblyName>ServiceManager</AssemblyName> 13 <DefaultClientScript>JScript</DefaultClientScript>
14 <DefaultClientScript>JScript</DefaultClientScript> 14 <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
15 <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout> 15 <DefaultTargetSchema>IE50</DefaultTargetSchema>
16 <DefaultTargetSchema>IE50</DefaultTargetSchema> 16 <DelaySign>false</DelaySign>
17 <DelaySign>false</DelaySign> 17 <OutputType>Exe</OutputType>
18 <OutputType>Exe</OutputType> 18 <AppDesignerFolder></AppDesignerFolder>
19 <AppDesignerFolder> 19 <RootNamespace>ServiceManager</RootNamespace>
20 </AppDesignerFolder> 20 <StartupObject></StartupObject>
21 <RootNamespace>ServiceManager</RootNamespace> 21 <FileUpgradeFlags>
22 <StartupObject> 22 </FileUpgradeFlags>
23 </StartupObject> 23 </PropertyGroup>
24 <FileUpgradeFlags> 24 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
25 </FileUpgradeFlags> 25 <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
26 </PropertyGroup> 26 <BaseAddress>285212672</BaseAddress>
27 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> 27 <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
28 <AllowUnsafeBlocks>False</AllowUnsafeBlocks> 28 <ConfigurationOverrideFile>
29 <BaseAddress>285212672</BaseAddress> 29 </ConfigurationOverrideFile>
30 <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> 30 <DefineConstants>TRACE</DefineConstants>
31 <ConfigurationOverrideFile> 31 <DocumentationFile></DocumentationFile>
32 </ConfigurationOverrideFile> 32 <DebugSymbols>False</DebugSymbols>
33 <DefineConstants>TRACE;DEBUG</DefineConstants> 33 <FileAlignment>4096</FileAlignment>
34 <DocumentationFile> 34 <Optimize>True</Optimize>
35 </DocumentationFile> 35 <OutputPath>../../bin/</OutputPath>
36 <DebugSymbols>True</DebugSymbols> 36 <RegisterForComInterop>False</RegisterForComInterop>
37 <FileAlignment>4096</FileAlignment> 37 <RemoveIntegerChecks>False</RemoveIntegerChecks>
38 <Optimize>False</Optimize> 38 <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
39 <OutputPath>..\..\bin\</OutputPath> 39 <WarningLevel>4</WarningLevel>
40 <RegisterForComInterop>False</RegisterForComInterop> 40 <NoWarn></NoWarn>
41 <RemoveIntegerChecks>False</RemoveIntegerChecks> 41 </PropertyGroup>
42 <TreatWarningsAsErrors>False</TreatWarningsAsErrors> 42 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
43 <WarningLevel>4</WarningLevel> 43 <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
44 <NoWarn> 44 <BaseAddress>285212672</BaseAddress>
45 </NoWarn> 45 <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
46 </PropertyGroup> 46 <ConfigurationOverrideFile>
47 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> 47 </ConfigurationOverrideFile>
48 <AllowUnsafeBlocks>False</AllowUnsafeBlocks> 48 <DefineConstants>TRACE;DEBUG</DefineConstants>
49 <BaseAddress>285212672</BaseAddress> 49 <DocumentationFile></DocumentationFile>
50 <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> 50 <DebugSymbols>True</DebugSymbols>
51 <ConfigurationOverrideFile> 51 <FileAlignment>4096</FileAlignment>
52 </ConfigurationOverrideFile> 52 <Optimize>False</Optimize>
53 <DefineConstants>TRACE</DefineConstants> 53 <OutputPath>../../bin/</OutputPath>
54 <DocumentationFile> 54 <RegisterForComInterop>False</RegisterForComInterop>
55 </DocumentationFile> 55 <RemoveIntegerChecks>False</RemoveIntegerChecks>
56 <DebugSymbols>False</DebugSymbols> 56 <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
57 <FileAlignment>4096</FileAlignment> 57 <WarningLevel>4</WarningLevel>
58 <Optimize>True</Optimize> 58 <NoWarn></NoWarn>
59 <OutputPath>..\..\bin\</OutputPath> 59 </PropertyGroup>
60 <RegisterForComInterop>False</RegisterForComInterop> 60 <ItemGroup>
61 <RemoveIntegerChecks>False</RemoveIntegerChecks> 61 <Reference Include="System" >
62 <TreatWarningsAsErrors>False</TreatWarningsAsErrors> 62 <HintPath>System.dll</HintPath>
63 <WarningLevel>4</WarningLevel> 63 <Private>False</Private>
64 <NoWarn> 64 </Reference>
65 </NoWarn> 65 <Reference Include="System.ServiceProcess" >
66 </PropertyGroup> 66 <HintPath>System.ServiceProcess.dll</HintPath>
67 <ItemGroup> 67 <Private>False</Private>
68 <Reference Include="System"> 68 </Reference>
69 <HintPath>System.dll</HintPath> 69 <Reference Include="System.Xml" >
70 <Private>False</Private> 70 <HintPath>System.Xml.dll</HintPath>
71 </Reference> 71 <Private>False</Private>
72 <Reference Include="System.ServiceProcess"> 72 </Reference>
73 <HintPath>System.ServiceProcess.dll</HintPath> 73 <Reference Include="libsecondlife.dll" >
74 <Private>False</Private> 74 <HintPath>..\..\bin\libsecondlife.dll</HintPath>
75 </Reference> 75 <Private>False</Private>
76 <Reference Include="System.Xml"> 76 </Reference>
77 <HintPath>System.Xml.dll</HintPath> 77 </ItemGroup>
78 <Private>False</Private> 78 <ItemGroup>
79 </Reference> 79 </ItemGroup>
80 </ItemGroup> 80 <ItemGroup>
81 <ItemGroup> 81 <Compile Include="ServiceManager.cs">
82 </ItemGroup> 82 <SubType>Code</SubType>
83 <ItemGroup> 83 </Compile>
84 <Compile Include="ServiceManager.cs"> 84 </ItemGroup>
85 <SubType>Component</SubType> 85 <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
86 </Compile> 86 <PropertyGroup>
87 </ItemGroup> 87 <PreBuildEvent>
88 <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" /> 88 </PreBuildEvent>
89 <PropertyGroup> 89 <PostBuildEvent>
90 <PreBuildEvent> 90 </PostBuildEvent>
91 </PreBuildEvent> 91 </PropertyGroup>
92 <PostBuildEvent> 92</Project>
93 </PostBuildEvent>
94 </PropertyGroup>
95</Project> \ No newline at end of file