aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenGridServices/ServiceManager/ServiceManager.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenGridServices/ServiceManager/ServiceManager.cs160
-rw-r--r--OpenGridServices/ServiceManager/ServiceManager.csproj88
-rw-r--r--OpenGridServices/ServiceManager/ServiceManager.csproj.user12
3 files changed, 0 insertions, 260 deletions
diff --git a/OpenGridServices/ServiceManager/ServiceManager.cs b/OpenGridServices/ServiceManager/ServiceManager.cs
deleted file mode 100644
index b21a5b1..0000000
--- a/OpenGridServices/ServiceManager/ServiceManager.cs
+++ /dev/null
@@ -1,160 +0,0 @@
1using System;
2using System.Diagnostics;
3using System.Threading;
4using System.ServiceProcess;
5using System.Xml;
6using System.IO;
7
8public class OpenGridMasterService : System.ServiceProcess.ServiceBase {
9
10 private Thread ServiceWorkerThread;
11
12 public OpenGridMasterService()
13 {
14 CanPauseAndContinue = false;
15 ServiceName = "OpenGridServices-master";
16 }
17
18 private void InitializeComponent()
19 {
20 this.CanPauseAndContinue = false;
21 this.CanShutdown = true;
22 this.ServiceName = "OpenGridServices-master";
23 }
24
25 protected override void OnStart(string[] args)
26 {
27 ServiceWorkerThread = new Thread(new ThreadStart(MainServiceThread));
28 ServiceWorkerThread.Start();
29 }
30
31 protected override void OnStop()
32 {
33 ServiceWorkerThread.Abort();
34 }
35
36 private void MainServiceThread()
37 {
38 try {
39 StreamReader reader=new StreamReader("opengrid-master-cfg.xml");
40
41 string configxml = reader.ReadToEnd();
42 XmlDocument doc = new XmlDocument();
43 doc.LoadXml(configxml);
44 XmlNode rootnode = doc.FirstChild;
45 if (rootnode.Name != "regions")
46 {
47 EventLog.WriteEntry("ERROR! bad XML in opengrid-master-cfg.xml - expected regions tag");
48 Console.WriteLine("Sorry, could not startup the service - please check your opengrid-master-cfg.xml file: missing regions tag");
49 (new ServiceController("OpenGridServices-master")).Stop();
50 }
51
52 for(int i=0; i<=rootnode.ChildNodes.Count; i++)
53 {
54 if(rootnode.ChildNodes.Item(i).Name != "region") {
55 EventLog.WriteEntry("nonfatal error - unexpected tag inside regions block of opengrid-master-cfg.xml");
56 (new ServiceController("OpenGridServices-master")).Stop();
57 }
58 }
59 } catch(Exception e) {
60 Console.WriteLine(e.ToString());
61 (new ServiceController("OpenGridServices-master")).Stop();
62 }
63
64 }
65
66 private static string SetupGrid()
67 {
68 Console.WriteLine("Running external program (OpenGridServices.GridServer.exe) to configure the grid server");
69 Process p = new Process();
70
71 p.StartInfo.Arguments = "-setuponly";
72 p.StartInfo.FileName = "OpenGridServices.GridServer.exe";
73 p.Start();
74
75 return "<gridserver />"; // we let the gridserver handle it's own setup
76 }
77
78 private static string SetupUser()
79 {
80 return "<user></user>";
81 }
82
83 private static string SetupAsset()
84 {
85 return "<asset></asset>";
86 }
87
88 private static string SetupRegion()
89 {
90 return "<regions></regions>";
91 }
92
93 public static void InitSetup()
94 {
95 string choice="";
96
97 string GridInfo;
98 string UserInfo;
99 string AssetInfo;
100 string RegionInfo;
101
102 bool grid=false;
103 bool user=false;
104 bool asset=false;
105 bool region=false;
106 while(choice!="OK")
107 {
108 Console.Clear();
109 Console.WriteLine("Please select the components you would like to run on this server:\n");
110
111 Console.WriteLine("1 - [" + (grid ? "X" : " ") + "] Grid server - this service handles co-ordinates of regions/sims on the grid");
112 Console.WriteLine("2 - [" + (user ? "X" : " ") + "] User server - this service handles user login, profiles, inventory and IM");
113 Console.WriteLine("3 - [" + (asset ? "X" : " ") + "] Asset server - this service handles storage of assets such as textures, objects, sounds, scripts");
114 Console.WriteLine("4 - [" + (region ? "X" : " ") + "] Region server - this is the main opensim server and can run without the above services, it handles physics simulation, terrain, building and other such features");
115
116
117 Console.Write("Type a number to toggle a choice or type OK to accept your current choices: ");
118 choice = Console.ReadLine();
119 switch(choice)
120 {
121 case "1":
122 grid = (!grid);
123 break;
124
125 case "2":
126 user = (!user);
127 break;
128
129 case "3":
130 asset = (!asset);
131 break;
132
133 case "4":
134 region = (!region);
135 break;
136 }
137 }
138
139 if(grid) GridInfo = SetupGrid();
140 if(user) UserInfo = SetupUser();
141 if(asset) AssetInfo = SetupAsset();
142 if(region) RegionInfo = SetupRegion();
143 }
144
145 public static void Main()
146 {
147 if(!File.Exists("opengrid-master-cfg.xml"))
148 {
149 Console.WriteLine("Could not find a config file, running initial setup");
150 InitSetup();
151 }
152 Console.WriteLine("Starting up OGS master service");
153 try {
154 ServiceBase.Run(new OpenGridMasterService());
155 } catch(Exception e) {
156 Console.WriteLine("THIS SHOULD NEVER HAPPEN!!!!!!!!!!!!!!!!!!!!!");
157 Console.WriteLine(e.ToString());
158 }
159 }
160}
diff --git a/OpenGridServices/ServiceManager/ServiceManager.csproj b/OpenGridServices/ServiceManager/ServiceManager.csproj
deleted file mode 100644
index 54d31b2..0000000
--- a/OpenGridServices/ServiceManager/ServiceManager.csproj
+++ /dev/null
@@ -1,88 +0,0 @@
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>{E141F4EE-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>ServiceManager</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>ServiceManager</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="System" >
62 <HintPath>System.dll</HintPath>
63 <Private>False</Private>
64 </Reference>
65 <Reference Include="System.ServiceProcess" >
66 <HintPath>System.ServiceProcess.dll</HintPath>
67 <Private>False</Private>
68 </Reference>
69 <Reference Include="System.Xml" >
70 <HintPath>System.Xml.dll</HintPath>
71 <Private>False</Private>
72 </Reference>
73 </ItemGroup>
74 <ItemGroup>
75 </ItemGroup>
76 <ItemGroup>
77 <Compile Include="ServiceManager.cs">
78 <SubType>Code</SubType>
79 </Compile>
80 </ItemGroup>
81 <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
82 <PropertyGroup>
83 <PreBuildEvent>
84 </PreBuildEvent>
85 <PostBuildEvent>
86 </PostBuildEvent>
87 </PropertyGroup>
88</Project>
diff --git a/OpenGridServices/ServiceManager/ServiceManager.csproj.user b/OpenGridServices/ServiceManager/ServiceManager.csproj.user
deleted file mode 100644
index 9bfaf67..0000000
--- a/OpenGridServices/ServiceManager/ServiceManager.csproj.user
+++ /dev/null
@@ -1,12 +0,0 @@
1<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2 <PropertyGroup>
3 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
4 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
5 <ReferencePath>C:\New Folder\second-life-viewer\opensim-dailys2\opensim26-05\branches\Sugilite\bin\</ReferencePath>
6 <LastOpenVersion>8.0.50727</LastOpenVersion>
7 <ProjectView>ProjectFiles</ProjectView>
8 <ProjectTrust>0</ProjectTrust>
9 </PropertyGroup>
10 <PropertyGroup Condition = " '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' " />
11 <PropertyGroup Condition = " '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
12</Project>