diff options
Die ServiceManager! (Not really Gareth, just the old directory, new directory is in OpenGridServices-Source)
Diffstat (limited to 'ServiceManager')
-rw-r--r-- | ServiceManager/ServiceManager.cs | 160 | ||||
-rw-r--r-- | ServiceManager/ServiceManager.csproj | 95 | ||||
-rw-r--r-- | ServiceManager/ServiceManager.exe.build | 41 |
3 files changed, 0 insertions, 296 deletions
diff --git a/ServiceManager/ServiceManager.cs b/ServiceManager/ServiceManager.cs deleted file mode 100644 index b21a5b1..0000000 --- a/ServiceManager/ServiceManager.cs +++ /dev/null | |||
@@ -1,160 +0,0 @@ | |||
1 | using System; | ||
2 | using System.Diagnostics; | ||
3 | using System.Threading; | ||
4 | using System.ServiceProcess; | ||
5 | using System.Xml; | ||
6 | using System.IO; | ||
7 | |||
8 | public 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/ServiceManager/ServiceManager.csproj b/ServiceManager/ServiceManager.csproj deleted file mode 100644 index ac118c3..0000000 --- a/ServiceManager/ServiceManager.csproj +++ /dev/null | |||
@@ -1,95 +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> | ||
10 | </ApplicationIcon> | ||
11 | <AssemblyKeyContainerName> | ||
12 | </AssemblyKeyContainerName> | ||
13 | <AssemblyName>ServiceManager</AssemblyName> | ||
14 | <DefaultClientScript>JScript</DefaultClientScript> | ||
15 | <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout> | ||
16 | <DefaultTargetSchema>IE50</DefaultTargetSchema> | ||
17 | <DelaySign>false</DelaySign> | ||
18 | <OutputType>Exe</OutputType> | ||
19 | <AppDesignerFolder> | ||
20 | </AppDesignerFolder> | ||
21 | <RootNamespace>ServiceManager</RootNamespace> | ||
22 | <StartupObject> | ||
23 | </StartupObject> | ||
24 | <FileUpgradeFlags> | ||
25 | </FileUpgradeFlags> | ||
26 | </PropertyGroup> | ||
27 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
28 | <AllowUnsafeBlocks>False</AllowUnsafeBlocks> | ||
29 | <BaseAddress>285212672</BaseAddress> | ||
30 | <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> | ||
31 | <ConfigurationOverrideFile> | ||
32 | </ConfigurationOverrideFile> | ||
33 | <DefineConstants>TRACE;DEBUG</DefineConstants> | ||
34 | <DocumentationFile> | ||
35 | </DocumentationFile> | ||
36 | <DebugSymbols>True</DebugSymbols> | ||
37 | <FileAlignment>4096</FileAlignment> | ||
38 | <Optimize>False</Optimize> | ||
39 | <OutputPath>..\bin\</OutputPath> | ||
40 | <RegisterForComInterop>False</RegisterForComInterop> | ||
41 | <RemoveIntegerChecks>False</RemoveIntegerChecks> | ||
42 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> | ||
43 | <WarningLevel>4</WarningLevel> | ||
44 | <NoWarn> | ||
45 | </NoWarn> | ||
46 | </PropertyGroup> | ||
47 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
48 | <AllowUnsafeBlocks>False</AllowUnsafeBlocks> | ||
49 | <BaseAddress>285212672</BaseAddress> | ||
50 | <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> | ||
51 | <ConfigurationOverrideFile> | ||
52 | </ConfigurationOverrideFile> | ||
53 | <DefineConstants>TRACE</DefineConstants> | ||
54 | <DocumentationFile> | ||
55 | </DocumentationFile> | ||
56 | <DebugSymbols>False</DebugSymbols> | ||
57 | <FileAlignment>4096</FileAlignment> | ||
58 | <Optimize>True</Optimize> | ||
59 | <OutputPath>..\bin\</OutputPath> | ||
60 | <RegisterForComInterop>False</RegisterForComInterop> | ||
61 | <RemoveIntegerChecks>False</RemoveIntegerChecks> | ||
62 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> | ||
63 | <WarningLevel>4</WarningLevel> | ||
64 | <NoWarn> | ||
65 | </NoWarn> | ||
66 | </PropertyGroup> | ||
67 | <ItemGroup> | ||
68 | <Reference Include="System"> | ||
69 | <HintPath>System.dll</HintPath> | ||
70 | <Private>False</Private> | ||
71 | </Reference> | ||
72 | <Reference Include="System.ServiceProcess"> | ||
73 | <HintPath>System.ServiceProcess.dll</HintPath> | ||
74 | <Private>False</Private> | ||
75 | </Reference> | ||
76 | <Reference Include="System.Xml"> | ||
77 | <HintPath>System.Xml.dll</HintPath> | ||
78 | <Private>False</Private> | ||
79 | </Reference> | ||
80 | </ItemGroup> | ||
81 | <ItemGroup> | ||
82 | </ItemGroup> | ||
83 | <ItemGroup> | ||
84 | <Compile Include="ServiceManager.cs"> | ||
85 | <SubType>Component</SubType> | ||
86 | </Compile> | ||
87 | </ItemGroup> | ||
88 | <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" /> | ||
89 | <PropertyGroup> | ||
90 | <PreBuildEvent> | ||
91 | </PreBuildEvent> | ||
92 | <PostBuildEvent> | ||
93 | </PostBuildEvent> | ||
94 | </PropertyGroup> | ||
95 | </Project> \ No newline at end of file | ||
diff --git a/ServiceManager/ServiceManager.exe.build b/ServiceManager/ServiceManager.exe.build deleted file mode 100644 index 7397f49..0000000 --- a/ServiceManager/ServiceManager.exe.build +++ /dev/null | |||
@@ -1,41 +0,0 @@ | |||
1 | <?xml version="1.0" ?> | ||
2 | <project name="ServiceManager" 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="ServiceManager" dynamicprefix="true" > | ||
12 | </resources> | ||
13 | <sources failonempty="true"> | ||
14 | <include name="ServiceManager.cs" /> | ||
15 | </sources> | ||
16 | <references basedir="${project::get-base-directory()}"> | ||
17 | <lib> | ||
18 | <include name="${project::get-base-directory()}" /> | ||
19 | <include name="${project::get-base-directory()}/${build.dir}" /> | ||
20 | </lib> | ||
21 | <include name="System.dll" /> | ||
22 | <include name="System.ServiceProcess.dll" /> | ||
23 | <include name="System.Xml.dll" /> | ||
24 | </references> | ||
25 | </csc> | ||
26 | <echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../bin/" /> | ||
27 | <mkdir dir="${project::get-base-directory()}/../bin/"/> | ||
28 | <copy todir="${project::get-base-directory()}/../bin/"> | ||
29 | <fileset basedir="${project::get-base-directory()}/${build.dir}/" > | ||
30 | <include name="*.dll"/> | ||
31 | <include name="*.exe"/> | ||
32 | </fileset> | ||
33 | </copy> | ||
34 | </target> | ||
35 | <target name="clean"> | ||
36 | <delete dir="${bin.dir}" failonerror="false" /> | ||
37 | <delete dir="${obj.dir}" failonerror="false" /> | ||
38 | </target> | ||
39 | <target name="doc" description="Creates documentation."> | ||
40 | </target> | ||
41 | </project> | ||