Die ServiceManager! (Not really Gareth, just the old directory, new directory is in OpenGridServices-Source)

zircon^2
MW 2007-05-24 12:20:42 +00:00
parent 3376b82501
commit ccdd8c0848
3 changed files with 0 additions and 296 deletions

View File

@ -1,160 +0,0 @@
using System;
using System.Diagnostics;
using System.Threading;
using System.ServiceProcess;
using System.Xml;
using System.IO;
public class OpenGridMasterService : System.ServiceProcess.ServiceBase {
private Thread ServiceWorkerThread;
public OpenGridMasterService()
{
CanPauseAndContinue = false;
ServiceName = "OpenGridServices-master";
}
private void InitializeComponent()
{
this.CanPauseAndContinue = false;
this.CanShutdown = true;
this.ServiceName = "OpenGridServices-master";
}
protected override void OnStart(string[] args)
{
ServiceWorkerThread = new Thread(new ThreadStart(MainServiceThread));
ServiceWorkerThread.Start();
}
protected override void OnStop()
{
ServiceWorkerThread.Abort();
}
private void MainServiceThread()
{
try {
StreamReader reader=new StreamReader("opengrid-master-cfg.xml");
string configxml = reader.ReadToEnd();
XmlDocument doc = new XmlDocument();
doc.LoadXml(configxml);
XmlNode rootnode = doc.FirstChild;
if (rootnode.Name != "regions")
{
EventLog.WriteEntry("ERROR! bad XML in opengrid-master-cfg.xml - expected regions tag");
Console.WriteLine("Sorry, could not startup the service - please check your opengrid-master-cfg.xml file: missing regions tag");
(new ServiceController("OpenGridServices-master")).Stop();
}
for(int i=0; i<=rootnode.ChildNodes.Count; i++)
{
if(rootnode.ChildNodes.Item(i).Name != "region") {
EventLog.WriteEntry("nonfatal error - unexpected tag inside regions block of opengrid-master-cfg.xml");
(new ServiceController("OpenGridServices-master")).Stop();
}
}
} catch(Exception e) {
Console.WriteLine(e.ToString());
(new ServiceController("OpenGridServices-master")).Stop();
}
}
private static string SetupGrid()
{
Console.WriteLine("Running external program (OpenGridServices.GridServer.exe) to configure the grid server");
Process p = new Process();
p.StartInfo.Arguments = "-setuponly";
p.StartInfo.FileName = "OpenGridServices.GridServer.exe";
p.Start();
return "<gridserver />"; // we let the gridserver handle it's own setup
}
private static string SetupUser()
{
return "<user></user>";
}
private static string SetupAsset()
{
return "<asset></asset>";
}
private static string SetupRegion()
{
return "<regions></regions>";
}
public static void InitSetup()
{
string choice="";
string GridInfo;
string UserInfo;
string AssetInfo;
string RegionInfo;
bool grid=false;
bool user=false;
bool asset=false;
bool region=false;
while(choice!="OK")
{
Console.Clear();
Console.WriteLine("Please select the components you would like to run on this server:\n");
Console.WriteLine("1 - [" + (grid ? "X" : " ") + "] Grid server - this service handles co-ordinates of regions/sims on the grid");
Console.WriteLine("2 - [" + (user ? "X" : " ") + "] User server - this service handles user login, profiles, inventory and IM");
Console.WriteLine("3 - [" + (asset ? "X" : " ") + "] Asset server - this service handles storage of assets such as textures, objects, sounds, scripts");
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");
Console.Write("Type a number to toggle a choice or type OK to accept your current choices: ");
choice = Console.ReadLine();
switch(choice)
{
case "1":
grid = (!grid);
break;
case "2":
user = (!user);
break;
case "3":
asset = (!asset);
break;
case "4":
region = (!region);
break;
}
}
if(grid) GridInfo = SetupGrid();
if(user) UserInfo = SetupUser();
if(asset) AssetInfo = SetupAsset();
if(region) RegionInfo = SetupRegion();
}
public static void Main()
{
if(!File.Exists("opengrid-master-cfg.xml"))
{
Console.WriteLine("Could not find a config file, running initial setup");
InitSetup();
}
Console.WriteLine("Starting up OGS master service");
try {
ServiceBase.Run(new OpenGridMasterService());
} catch(Exception e) {
Console.WriteLine("THIS SHOULD NEVER HAPPEN!!!!!!!!!!!!!!!!!!!!!");
Console.WriteLine(e.ToString());
}
}
}

View File

@ -1,95 +0,0 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectType>Local</ProjectType>
<ProductVersion>8.0.50727</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{E141F4EE-0000-0000-0000-000000000000}</ProjectGuid>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ApplicationIcon>
</ApplicationIcon>
<AssemblyKeyContainerName>
</AssemblyKeyContainerName>
<AssemblyName>ServiceManager</AssemblyName>
<DefaultClientScript>JScript</DefaultClientScript>
<DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
<DefaultTargetSchema>IE50</DefaultTargetSchema>
<DelaySign>false</DelaySign>
<OutputType>Exe</OutputType>
<AppDesignerFolder>
</AppDesignerFolder>
<RootNamespace>ServiceManager</RootNamespace>
<StartupObject>
</StartupObject>
<FileUpgradeFlags>
</FileUpgradeFlags>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<AllowUnsafeBlocks>False</AllowUnsafeBlocks>
<BaseAddress>285212672</BaseAddress>
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
<ConfigurationOverrideFile>
</ConfigurationOverrideFile>
<DefineConstants>TRACE;DEBUG</DefineConstants>
<DocumentationFile>
</DocumentationFile>
<DebugSymbols>True</DebugSymbols>
<FileAlignment>4096</FileAlignment>
<Optimize>False</Optimize>
<OutputPath>..\bin\</OutputPath>
<RegisterForComInterop>False</RegisterForComInterop>
<RemoveIntegerChecks>False</RemoveIntegerChecks>
<TreatWarningsAsErrors>False</TreatWarningsAsErrors>
<WarningLevel>4</WarningLevel>
<NoWarn>
</NoWarn>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<AllowUnsafeBlocks>False</AllowUnsafeBlocks>
<BaseAddress>285212672</BaseAddress>
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
<ConfigurationOverrideFile>
</ConfigurationOverrideFile>
<DefineConstants>TRACE</DefineConstants>
<DocumentationFile>
</DocumentationFile>
<DebugSymbols>False</DebugSymbols>
<FileAlignment>4096</FileAlignment>
<Optimize>True</Optimize>
<OutputPath>..\bin\</OutputPath>
<RegisterForComInterop>False</RegisterForComInterop>
<RemoveIntegerChecks>False</RemoveIntegerChecks>
<TreatWarningsAsErrors>False</TreatWarningsAsErrors>
<WarningLevel>4</WarningLevel>
<NoWarn>
</NoWarn>
</PropertyGroup>
<ItemGroup>
<Reference Include="System">
<HintPath>System.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="System.ServiceProcess">
<HintPath>System.ServiceProcess.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="System.Xml">
<HintPath>System.Xml.dll</HintPath>
<Private>False</Private>
</Reference>
</ItemGroup>
<ItemGroup>
</ItemGroup>
<ItemGroup>
<Compile Include="ServiceManager.cs">
<SubType>Component</SubType>
</Compile>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
<PropertyGroup>
<PreBuildEvent>
</PreBuildEvent>
<PostBuildEvent>
</PostBuildEvent>
</PropertyGroup>
</Project>

View File

@ -1,41 +0,0 @@
<?xml version="1.0" ?>
<project name="ServiceManager" default="build">
<target name="build">
<echo message="Build Directory is ${project::get-base-directory()}/${build.dir}" />
<mkdir dir="${project::get-base-directory()}/${build.dir}" />
<copy todir="${project::get-base-directory()}/${build.dir}">
<fileset basedir="${project::get-base-directory()}">
</fileset>
</copy>
<csc target="exe" debug="${build.debug}" unsafe="False" define="TRACE;DEBUG" output="${project::get-base-directory()}/${build.dir}/${project::get-name()}.exe">
<resources prefix="ServiceManager" dynamicprefix="true" >
</resources>
<sources failonempty="true">
<include name="ServiceManager.cs" />
</sources>
<references basedir="${project::get-base-directory()}">
<lib>
<include name="${project::get-base-directory()}" />
<include name="${project::get-base-directory()}/${build.dir}" />
</lib>
<include name="System.dll" />
<include name="System.ServiceProcess.dll" />
<include name="System.Xml.dll" />
</references>
</csc>
<echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../bin/" />
<mkdir dir="${project::get-base-directory()}/../bin/"/>
<copy todir="${project::get-base-directory()}/../bin/">
<fileset basedir="${project::get-base-directory()}/${build.dir}/" >
<include name="*.dll"/>
<include name="*.exe"/>
</fileset>
</copy>
</target>
<target name="clean">
<delete dir="${bin.dir}" failonerror="false" />
<delete dir="${obj.dir}" failonerror="false" />
</target>
<target name="doc" description="Creates documentation.">
</target>
</project>