From d607914f6a7e0ef7890ae229474a1ad90511868f Mon Sep 17 00:00:00 2001 From: MW Date: Sun, 24 Jun 2007 18:40:02 +0000 Subject: [PATCH] Hopefully enabled the OGS commsManager --- .../GridCommsManager.cs | 18 +++++ .../OGSInterSimComms.cs | 19 ++++++ .../OGSUserServices.cs | 25 +++++++ ...nGrid.Framework.Communications.OGS1.csproj | 52 +++++++++------ .../Types/NetworkServersInfo.cs | 54 ++++++++++----- OpenSim/OpenSim.Caches/AssetCache.cs | 1 + OpenSim/OpenSim.Region/Caps.cs | 52 +++++++++++++-- OpenSim/OpenSim/OpenSim.csproj | 65 +++++++++++-------- OpenSim/OpenSim/OpenSimMain.cs | 5 +- 9 files changed, 218 insertions(+), 73 deletions(-) create mode 100644 Common/OpenGrid.Framework.Communications.OGS1/GridCommsManager.cs create mode 100644 Common/OpenGrid.Framework.Communications.OGS1/OGSInterSimComms.cs create mode 100644 Common/OpenGrid.Framework.Communications.OGS1/OGSUserServices.cs diff --git a/Common/OpenGrid.Framework.Communications.OGS1/GridCommsManager.cs b/Common/OpenGrid.Framework.Communications.OGS1/GridCommsManager.cs new file mode 100644 index 0000000000..f151f56caf --- /dev/null +++ b/Common/OpenGrid.Framework.Communications.OGS1/GridCommsManager.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Text; +using OpenGrid.Framework.Communications; +namespace OpenGrid.Framework.Communications.OGS1 +{ + public class GridCommsManager : CommunicationsManager + { + + + public GridCommsManager() + { + GridServer = new OGS1GridServices(); + InterRegion = new OGSInterSimComms(); + UserServer = new OGSUserServices(); + } + } +} diff --git a/Common/OpenGrid.Framework.Communications.OGS1/OGSInterSimComms.cs b/Common/OpenGrid.Framework.Communications.OGS1/OGSInterSimComms.cs new file mode 100644 index 0000000000..0024d1491b --- /dev/null +++ b/Common/OpenGrid.Framework.Communications.OGS1/OGSInterSimComms.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Text; +using OpenSim.Framework.Types; +using OpenGrid.Framework.Communications; +namespace OpenGrid.Framework.Communications.OGS1 +{ + public class OGSInterSimComms : IInterRegionCommunications + { + public bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData) + { + return false; + } + public bool ExpectAvatarCrossing(ulong regionHandle, libsecondlife.LLUUID agentID, libsecondlife.LLVector3 position) + { + return false; + } + } +} diff --git a/Common/OpenGrid.Framework.Communications.OGS1/OGSUserServices.cs b/Common/OpenGrid.Framework.Communications.OGS1/OGSUserServices.cs new file mode 100644 index 0000000000..1667e6be88 --- /dev/null +++ b/Common/OpenGrid.Framework.Communications.OGS1/OGSUserServices.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.Text; +using OpenGrid.Framework.Communications; +using OpenGrid.Framework.Data; +using libsecondlife; + +namespace OpenGrid.Framework.Communications.OGS1 +{ + public class OGSUserServices :IUserServices + { + public UserProfileData GetUserProfile(string firstName, string lastName) + { + return null; + } + public UserProfileData GetUserProfile(string name) + { + return null; + } + public UserProfileData GetUserProfile(LLUUID avatarID) + { + return null; + } + } +} diff --git a/Common/OpenGrid.Framework.Communications.OGS1/OpenGrid.Framework.Communications.OGS1.csproj b/Common/OpenGrid.Framework.Communications.OGS1/OpenGrid.Framework.Communications.OGS1.csproj index fdd056ae1b..4a806358a0 100644 --- a/Common/OpenGrid.Framework.Communications.OGS1/OpenGrid.Framework.Communications.OGS1.csproj +++ b/Common/OpenGrid.Framework.Communications.OGS1/OpenGrid.Framework.Communications.OGS1.csproj @@ -1,12 +1,13 @@ - + Local 8.0.50727 2.0 - {17442AF1-0000-0000-0000-000000000000} + {C1F40DD4-A68B-4233-9142-CE236775A3CE} Debug AnyCPU - + + OpenGrid.Framework.Communications.OGS1 @@ -15,9 +16,11 @@ IE50 false Library - + + OpenGrid.Framework.Communications.OGS1 - + + @@ -28,7 +31,8 @@ TRACE;DEBUG - + + True 4096 False @@ -37,7 +41,8 @@ False False 4 - + + False @@ -46,7 +51,8 @@ TRACE - + + False 4096 True @@ -55,22 +61,23 @@ False False 4 - + + - + ..\..\bin\libsecondlife.dll False - + System.dll False - + System.Data.dll False - + System.Xml.dll False @@ -80,37 +87,44 @@ OpenGrid.Framework.Communications {683344D5-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False + + + {62CDF671-0000-0000-0000-000000000000} + OpenGrid.Framework.Data OpenSim.Framework {8ACA2445-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenSim.Framework.Console {A7CD0630-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenSim.Servers {8BB20F0A-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False XMLRPC {8E81D43C-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False + Code + + Code @@ -122,4 +136,4 @@ - + \ No newline at end of file diff --git a/Common/OpenSim.Framework/Types/NetworkServersInfo.cs b/Common/OpenSim.Framework/Types/NetworkServersInfo.cs index 709b7dd302..9c2e7a62f4 100644 --- a/Common/OpenSim.Framework/Types/NetworkServersInfo.cs +++ b/Common/OpenSim.Framework/Types/NetworkServersInfo.cs @@ -48,6 +48,8 @@ namespace OpenSim.Framework.Types public uint DefaultHomeLocX = 0; public uint DefaultHomeLocY = 0; + public int HttpListenerPort = 9000; + public void InitConfig(bool sandboxMode, IGenericConfig configData) { this.isSandbox = sandboxMode; @@ -55,34 +57,50 @@ namespace OpenSim.Framework.Types try { string attri = ""; - // default home location X + attri = ""; - attri = configData.GetAttribute("DefaultLocationX"); + attri = configData.GetAttribute("HttpListenerPort"); if (attri == "") { - string location = OpenSim.Framework.Console.MainLog.Instance.CmdPrompt("Default Home Location X", "1000"); - configData.SetAttribute("DefaultLocationX", location); - this.DefaultHomeLocX = (uint)Convert.ToUInt32(location); + string location = OpenSim.Framework.Console.MainLog.Instance.CmdPrompt("Http Listener Port", "9000"); + configData.SetAttribute("HttpListenerPort", location); + this.HttpListenerPort = Convert.ToInt32(location); } else { - this.DefaultHomeLocX = (uint)Convert.ToUInt32(attri); + this.HttpListenerPort = Convert.ToInt32(attri); } - // default home location Y - attri = ""; - attri = configData.GetAttribute("DefaultLocationY"); - if (attri == "") + if (sandboxMode) { - string location = OpenSim.Framework.Console.MainLog.Instance.CmdPrompt("Default Home Location Y", "1000"); - configData.SetAttribute("DefaultLocationY", location); - this.DefaultHomeLocY = (uint)Convert.ToUInt32(location); - } - else - { - this.DefaultHomeLocY = (uint)Convert.ToUInt32(attri); - } + // default home location X + attri = ""; + attri = configData.GetAttribute("DefaultLocationX"); + if (attri == "") + { + string location = OpenSim.Framework.Console.MainLog.Instance.CmdPrompt("Default Home Location X", "1000"); + configData.SetAttribute("DefaultLocationX", location); + this.DefaultHomeLocX = (uint)Convert.ToUInt32(location); + } + else + { + this.DefaultHomeLocX = (uint)Convert.ToUInt32(attri); + } + // default home location Y + attri = ""; + attri = configData.GetAttribute("DefaultLocationY"); + if (attri == "") + { + string location = OpenSim.Framework.Console.MainLog.Instance.CmdPrompt("Default Home Location Y", "1000"); + configData.SetAttribute("DefaultLocationY", location); + this.DefaultHomeLocY = (uint)Convert.ToUInt32(location); + } + else + { + this.DefaultHomeLocY = (uint)Convert.ToUInt32(attri); + } + } if (!isSandbox) { //Grid Server diff --git a/OpenSim/OpenSim.Caches/AssetCache.cs b/OpenSim/OpenSim.Caches/AssetCache.cs index f310752b2d..d0cc370e80 100644 --- a/OpenSim/OpenSim.Caches/AssetCache.cs +++ b/OpenSim/OpenSim.Caches/AssetCache.cs @@ -39,6 +39,7 @@ using OpenSim.Framework.Utilities; namespace OpenSim.Caches { public delegate void DownloadComplete(AssetCache.TextureSender sender); + /// /// Manages local cache of assets and their sending to viewers. /// diff --git a/OpenSim/OpenSim.Region/Caps.cs b/OpenSim/OpenSim.Region/Caps.cs index 59f24e3c22..7ec0c75ec7 100644 --- a/OpenSim/OpenSim.Region/Caps.cs +++ b/OpenSim/OpenSim.Region/Caps.cs @@ -22,9 +22,11 @@ namespace OpenSim.Region private string mapLayerPath = "0001/"; private string newInventory = "0002/"; private string requestTexture = "0003/"; + private string eventQueue = "0100/"; private BaseHttpServer httpListener; private LLUUID agentID; private AssetCache assetCache; + private int eventQueueCount = 1; public Caps(AssetCache assetCach, BaseHttpServer httpServer, string httpListen, uint httpPort, string capsPath, LLUUID agent) { @@ -45,6 +47,7 @@ namespace OpenSim.Region httpListener.AddRestHandler("POST", "/CAPS/" + capsObjectPath + requestPath, CapsRequest); httpListener.AddRestHandler("POST", "/CAPS/" + capsObjectPath + mapLayerPath, MapLayer); httpListener.AddRestHandler("POST", "/CAPS/" + capsObjectPath + newInventory, NewAgentInventory); + httpListener.AddRestHandler("POST", "/CAPS/" + capsObjectPath + eventQueue, ProcessEventQueue); } /// @@ -74,6 +77,7 @@ namespace OpenSim.Region capURLS += "MapLayerhttp://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" + capsObjectPath + mapLayerPath + ""; capURLS += "NewFileAgentInventoryhttp://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" + capsObjectPath + newInventory + ""; //capURLS += "RequestTextureDownloadhttp://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" + capsObjectPath + requestTexture + ""; + capURLS += "EventQueueGethttp://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" + capsObjectPath + eventQueue + ""; return capURLS; } @@ -116,6 +120,40 @@ namespace OpenSim.Region return res; } + public string ProcessEventQueue(string request, string path, string param) + { + Console.WriteLine("event queue request " + request); + string res = ""; + res = this.CreateEmptyEventResponse(); + return res; + } + + public string CreateEstablishAgentComms(string caps, string ipAddressPort) + { + string res = "id" + eventQueueCount + ""; + res += "events"; + res += "messageEstablishAgentCommunication"; + res += "body"; + res += "sim-ip-and-port"+ipAddressPort +""; + res += "seed-capability"+caps+""; + res += "agent-id"+this.agentID.ToStringHyphenated()+""; + res += ""; + res += ""; + res += ""; + eventQueueCount++; + return res; + } + + public string CreateEmptyEventResponse() + { + string res = "id" + eventQueueCount + ""; + res += "events"; + res += ""; + res += ""; + eventQueueCount++; + return res; + } + public string NewAgentInventory(string request, string path, string param) { //Console.WriteLine("received upload request:"+ request); @@ -123,13 +161,13 @@ namespace OpenSim.Region LLUUID newAsset = LLUUID.Random(); LLUUID newInvItem = LLUUID.Random(); string uploaderPath = capsObjectPath + Util.RandomClass.Next(5000, 8000).ToString("0000"); - AssetUploader uploader = new AssetUploader(newAsset,newInvItem, uploaderPath, this.httpListener); + AssetUploader uploader = new AssetUploader(newAsset, newInvItem, uploaderPath, this.httpListener); httpListener.AddRestHandler("POST", "/CAPS/" + uploaderPath, uploader.uploaderCaps); string uploaderURL = "http://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" + uploaderPath; Console.WriteLine("uploader url is " + uploaderURL); res += ""; - res += "uploader"+uploaderURL +""; - //res += "successtrue"; + res += "uploader" + uploaderURL + ""; + //res += "successtrue"; res += "stateupload"; res += ""; uploader.OnUpLoad += this.UploadHandler; @@ -138,7 +176,7 @@ namespace OpenSim.Region public void UploadHandler(LLUUID assetID, LLUUID inventoryItem, byte[] data) { - // Console.WriteLine("upload handler called"); + // Console.WriteLine("upload handler called"); AssetBase asset; asset = new AssetBase(); asset.FullID = assetID; @@ -147,7 +185,7 @@ namespace OpenSim.Region asset.Name = "UploadedTexture" + Util.RandomClass.Next(1, 1000).ToString("000"); asset.Data = data; this.assetCache.AddAsset(asset); - + } public class AssetUploader @@ -181,12 +219,12 @@ namespace OpenSim.Region res += ""; Console.WriteLine("asset " + newAssetID.ToStringHyphenated() + " , inventory item " + inv.ToStringHyphenated()); - httpListener.RemoveRestHandler("POST", "/CAPS/"+uploaderPath); + httpListener.RemoveRestHandler("POST", "/CAPS/" + uploaderPath); if (OnUpLoad != null) { OnUpLoad(newAssetID, inv, data); } - + /*FileStream fs = File.Create("upload.jp2"); BinaryWriter bw = new BinaryWriter(fs); bw.Write(data); diff --git a/OpenSim/OpenSim/OpenSim.csproj b/OpenSim/OpenSim/OpenSim.csproj index a8cadc097d..91eb4748a7 100644 --- a/OpenSim/OpenSim/OpenSim.csproj +++ b/OpenSim/OpenSim/OpenSim.csproj @@ -1,4 +1,4 @@ - + Local 8.0.50727 @@ -6,7 +6,8 @@ {438A9556-0000-0000-0000-000000000000} Debug AnyCPU - + + OpenSim @@ -15,9 +16,11 @@ IE50 false Exe - + + OpenSim - + + @@ -28,7 +31,8 @@ TRACE;DEBUG - + + True 4096 False @@ -37,7 +41,8 @@ False False 4 - + + False @@ -46,7 +51,8 @@ TRACE - + + False 4096 True @@ -55,108 +61,113 @@ False False 4 - + + - + ..\..\bin\Axiom.MathLib.dll False - + ..\..\bin\Db4objects.Db4o.dll False - + ..\..\bin\libsecondlife.dll False - + System.dll False - + System.Xml.dll False + + {C1F40DD4-A68B-4233-9142-CE236775A3CE} + OpenGrid.Framework.Communications.OGS1 + OpenGrid.Framework.Communications {683344D5-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenGrid.Framework.UserManagement {DA9A7391-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenSim.Caches {1938EB12-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenSim.Framework {8ACA2445-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenSim.Framework.Console {A7CD0630-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenSim.GenericConfig.Xml {E88EF749-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenSim.LocalCommunications {79CED992-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenSim.Physics.Manager {8BE16150-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenSim.Region {196916AF-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenSim.RegionServer {632E1BFD-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenSim.Servers {8BB20F0A-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenSim.Terrain.BasicTerrain {2270B8FE-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False XMLRPC {8E81D43C-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False @@ -174,4 +185,4 @@ - + \ No newline at end of file diff --git a/OpenSim/OpenSim/OpenSimMain.cs b/OpenSim/OpenSim/OpenSimMain.cs index e2dddafde9..50da5a15df 100644 --- a/OpenSim/OpenSim/OpenSimMain.cs +++ b/OpenSim/OpenSim/OpenSimMain.cs @@ -54,6 +54,7 @@ using OpenSim.Servers; using OpenSim.GenericConfig; using OpenGrid.Framework.Communications; using OpenSim.LocalCommunications; +using OpenGrid.Framework.Communications.OGS1; namespace OpenSim { @@ -114,7 +115,7 @@ namespace OpenSim else { this.SetupRemoteGridServers(); - this.commsManager = new CommunicationsLocal(this.serversData.DefaultHomeLocX, this.serversData.DefaultHomeLocY); //shouldn't be using the local communications manager + this.commsManager = new GridCommsManager(); } startuptime = DateTime.Now; @@ -267,7 +268,7 @@ namespace OpenSim protected override void SetupHttpListener() { - httpServer = new BaseHttpServer(9000); //regionData[0].IPListenPort); + httpServer = new BaseHttpServer(this.serversData.HttpListenerPort); //regionData[0].IPListenPort); if (!this.m_sandbox) {