From f95b6081cba084d1b067acea99c0effa2b3bf42c Mon Sep 17 00:00:00 2001
From: MW
Date: Thu, 24 May 2007 12:35:32 +0000
Subject: Renamed the new Directories. (removed the "-Source" from the end of
them)
---
OpenGridServices/ServiceManager/ServiceManager.cs | 160 +++++++++++++++++++++
.../ServiceManager/ServiceManager.csproj | 95 ++++++++++++
.../ServiceManager/ServiceManager.csproj.user | 12 ++
.../ServiceManager/ServiceManager.exe.build | 41 ++++++
4 files changed, 308 insertions(+)
create mode 100644 OpenGridServices/ServiceManager/ServiceManager.cs
create mode 100644 OpenGridServices/ServiceManager/ServiceManager.csproj
create mode 100644 OpenGridServices/ServiceManager/ServiceManager.csproj.user
create mode 100644 OpenGridServices/ServiceManager/ServiceManager.exe.build
(limited to 'OpenGridServices/ServiceManager')
diff --git a/OpenGridServices/ServiceManager/ServiceManager.cs b/OpenGridServices/ServiceManager/ServiceManager.cs
new file mode 100644
index 0000000..b21a5b1
--- /dev/null
+++ b/OpenGridServices/ServiceManager/ServiceManager.cs
@@ -0,0 +1,160 @@
+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 ""; // we let the gridserver handle it's own setup
+ }
+
+ private static string SetupUser()
+ {
+ return "";
+ }
+
+ private static string SetupAsset()
+ {
+ return "";
+ }
+
+ private static string SetupRegion()
+ {
+ return "";
+ }
+
+ 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());
+ }
+ }
+}
diff --git a/OpenGridServices/ServiceManager/ServiceManager.csproj b/OpenGridServices/ServiceManager/ServiceManager.csproj
new file mode 100644
index 0000000..ac118c3
--- /dev/null
+++ b/OpenGridServices/ServiceManager/ServiceManager.csproj
@@ -0,0 +1,95 @@
+
+
+ Local
+ 8.0.50727
+ 2.0
+ {E141F4EE-0000-0000-0000-000000000000}
+ Debug
+ AnyCPU
+
+
+
+
+ ServiceManager
+ JScript
+ Grid
+ IE50
+ false
+ Exe
+
+
+ ServiceManager
+
+
+
+
+
+
+ False
+ 285212672
+ False
+
+
+ TRACE;DEBUG
+
+
+ True
+ 4096
+ False
+ ..\bin\
+ False
+ False
+ False
+ 4
+
+
+
+
+ False
+ 285212672
+ False
+
+
+ TRACE
+
+
+ False
+ 4096
+ True
+ ..\bin\
+ False
+ False
+ False
+ 4
+
+
+
+
+
+ System.dll
+ False
+
+
+ System.ServiceProcess.dll
+ False
+
+
+ System.Xml.dll
+ False
+
+
+
+
+
+
+ Component
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/OpenGridServices/ServiceManager/ServiceManager.csproj.user b/OpenGridServices/ServiceManager/ServiceManager.csproj.user
new file mode 100644
index 0000000..d47d65d
--- /dev/null
+++ b/OpenGridServices/ServiceManager/ServiceManager.csproj.user
@@ -0,0 +1,12 @@
+
+
+ Debug
+ AnyCPU
+ C:\New Folder\second-life-viewer\opensim-dailys2\opensim15-07\bin\
+ 8.0.50727
+ ProjectFiles
+ 0
+
+
+
+
diff --git a/OpenGridServices/ServiceManager/ServiceManager.exe.build b/OpenGridServices/ServiceManager/ServiceManager.exe.build
new file mode 100644
index 0000000..7397f49
--- /dev/null
+++ b/OpenGridServices/ServiceManager/ServiceManager.exe.build
@@ -0,0 +1,41 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
--
cgit v1.1