From fa8f143aec69e36ee90fb34e2f144733b66ca951 Mon Sep 17 00:00:00 2001 From: mingchen Date: Sat, 9 Jun 2007 21:04:13 +0000 Subject: *Reorganized RegionServerCommsManager for OGS and local support --- .../GridServer/GridCommsManagerBase.cs | 50 +++++++++ .../GridServer/GridCommsManagerLocal.cs | 104 ++++++++++++++++++ .../GridServer/GridCommsManagerOGS.cs | 36 +++++++ .../OpenGrid.Framework.Communications.csproj | 25 ++++- .../RegionServerCommsLocal.cs | 20 ++++ .../RegionServerCommsManager.cs | 60 +---------- .../RegionServerCommsOGS.cs | 15 +++ .../TestLocalCommsManager.cs | 117 --------------------- .../UserServer/UserCommsManagerBase.cs | 30 ++++++ .../UserServer/UserCommsManagerLocal.cs | 10 ++ .../UserServer/UserCommsManagerOGS.cs | 10 ++ 11 files changed, 301 insertions(+), 176 deletions(-) create mode 100644 Common/OpenGrid.Framework.Communications/GridServer/GridCommsManagerBase.cs create mode 100644 Common/OpenGrid.Framework.Communications/GridServer/GridCommsManagerLocal.cs create mode 100644 Common/OpenGrid.Framework.Communications/GridServer/GridCommsManagerOGS.cs create mode 100644 Common/OpenGrid.Framework.Communications/RegionServerCommsLocal.cs create mode 100644 Common/OpenGrid.Framework.Communications/RegionServerCommsOGS.cs delete mode 100644 Common/OpenGrid.Framework.Communications/TestLocalCommsManager.cs create mode 100644 Common/OpenGrid.Framework.Communications/UserServer/UserCommsManagerBase.cs create mode 100644 Common/OpenGrid.Framework.Communications/UserServer/UserCommsManagerLocal.cs create mode 100644 Common/OpenGrid.Framework.Communications/UserServer/UserCommsManagerOGS.cs (limited to 'Common/OpenGrid.Framework.Communications') diff --git a/Common/OpenGrid.Framework.Communications/GridServer/GridCommsManagerBase.cs b/Common/OpenGrid.Framework.Communications/GridServer/GridCommsManagerBase.cs new file mode 100644 index 0000000..11b5ea7 --- /dev/null +++ b/Common/OpenGrid.Framework.Communications/GridServer/GridCommsManagerBase.cs @@ -0,0 +1,50 @@ +using System; +using System.Collections.Generic; +using System.Text; +using OpenSim.Framework.Types; +using OpenSim.Framework; + +namespace OpenGrid.Framework.Communications.GridServer +{ + public class GridCommsManagerBase + { + public GridCommsManagerBase() + { + } + /// + /// + /// + /// + /// + public virtual RegionCommsHostBase RegisterRegion(RegionInfo regionInfo) + { + return null; + } + + /// + /// + /// + /// + /// + public virtual List RequestNeighbours(RegionInfo regionInfo) + { + return null; + } + + /// + /// + /// + /// + public virtual bool InformNeighbourOfChildAgent(ulong regionHandle, AgentCircuitData agentData) //should change from agentCircuitData + { + return false; + } + + public virtual bool AddNewSession(ulong regionHandle, Login loginData) + { + return false; + } + + + } +} diff --git a/Common/OpenGrid.Framework.Communications/GridServer/GridCommsManagerLocal.cs b/Common/OpenGrid.Framework.Communications/GridServer/GridCommsManagerLocal.cs new file mode 100644 index 0000000..774585a --- /dev/null +++ b/Common/OpenGrid.Framework.Communications/GridServer/GridCommsManagerLocal.cs @@ -0,0 +1,104 @@ +using System; +using System.Collections.Generic; +using System.Text; + +using OpenSim.Framework; +using OpenSim.Framework.Types; + +using libsecondlife; + +namespace OpenGrid.Framework.Communications.GridServer +{ + public class GridCommsManagerLocal : GridCommsManagerBase + { + protected Dictionary regions = new Dictionary(); + protected Dictionary regionHosts = new Dictionary(); + + public GridCommsManagerLocal() + { + + } + + public override RegionCommsHostBase RegisterRegion(RegionInfo regionInfo) + { + //Console.WriteLine("CommsManager - Region " + regionInfo.RegionHandle + " , " + regionInfo.RegionLocX + " , "+ regionInfo.RegionLocY +" is registering"); + if (!this.regions.ContainsKey((uint)regionInfo.RegionHandle)) + { + //Console.WriteLine("CommsManager - Adding Region " + regionInfo.RegionHandle ); + this.regions.Add(regionInfo.RegionHandle, regionInfo); + RegionCommsHostBase regionHost = new RegionCommsHostBase(); + this.regionHosts.Add(regionInfo.RegionHandle, regionHost); + return regionHost; + } + + //already in our list of regions so for now lets return null + return null; + } + + + public override List RequestNeighbours(RegionInfo regionInfo) + { + // Console.WriteLine("Finding Neighbours to " + regionInfo.RegionHandle); + List neighbours = new List(); + + foreach (RegionInfo reg in this.regions.Values) + { + // Console.WriteLine("CommsManager- RequestNeighbours() checking region " + reg.RegionLocX + " , "+ reg.RegionLocY); + if (reg.RegionHandle != regionInfo.RegionHandle) + { + //Console.WriteLine("CommsManager- RequestNeighbours() - found a different region in list, checking location"); + if ((reg.RegionLocX > (regionInfo.RegionLocX - 2)) && (reg.RegionLocX < (regionInfo.RegionLocX + 2))) + { + if ((reg.RegionLocY > (regionInfo.RegionLocY - 2)) && (reg.RegionLocY < (regionInfo.RegionLocY + 2))) + { + neighbours.Add(reg); + } + } + } + } + return neighbours; + } + + public override bool InformNeighbourOfChildAgent(ulong regionHandle, AgentCircuitData agentData) //should change from agentCircuitData + { + //Console.WriteLine("CommsManager- Trying to Inform a region to expect child agent"); + if (this.regionHosts.ContainsKey(regionHandle)) + { + // Console.WriteLine("CommsManager- Informing a region to expect child agent"); + this.regionHosts[regionHandle].TriggerExpectUser(regionHandle, agentData); + return true; + } + return false; + } + + /// + /// Is a Sandbox mode method, used by the local Login server to inform a region of a connection user/session + /// + /// + /// + /// + public override bool AddNewSession(ulong regionHandle, Login loginData) + { + //Console.WriteLine(" comms manager been told to expect new user"); + AgentCircuitData agent = new AgentCircuitData(); + agent.AgentID = loginData.Agent; + agent.firstname = loginData.First; + agent.lastname = loginData.Last; + agent.SessionID = loginData.Session; + agent.SecureSessionID = loginData.SecureSession; + agent.circuitcode = loginData.CircuitCode; + agent.BaseFolder = loginData.BaseFolder; + agent.InventoryFolder = loginData.InventoryFolder; + agent.startpos = new LLVector3(128, 128, 70); + + if (this.regionHosts.ContainsKey(regionHandle)) + { + this.regionHosts[regionHandle].TriggerExpectUser(regionHandle, agent); + return true; + } + + // region not found + return false; + } + } +} diff --git a/Common/OpenGrid.Framework.Communications/GridServer/GridCommsManagerOGS.cs b/Common/OpenGrid.Framework.Communications/GridServer/GridCommsManagerOGS.cs new file mode 100644 index 0000000..415c1d8 --- /dev/null +++ b/Common/OpenGrid.Framework.Communications/GridServer/GridCommsManagerOGS.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using System.Text; + +using OpenSim.Framework; +using OpenSim.Framework.Types; + +namespace OpenGrid.Framework.Communications.GridServer +{ + public class GridCommsManagerOGS : GridCommsManagerBase + { + public GridCommsManagerOGS() + { + } + + public override RegionCommsHostBase RegisterRegion(RegionInfo regionInfo) + { + return null; + } + + public override List RequestNeighbours(RegionInfo regionInfo) + { + return null; + } + + public override bool InformNeighbourOfChildAgent(ulong regionHandle, AgentCircuitData agentData) //should change from agentCircuitData + { + return false; + } + + public override bool AddNewSession(ulong regionHandle, Login loginData) + { + return false; + } + } +} diff --git a/Common/OpenGrid.Framework.Communications/OpenGrid.Framework.Communications.csproj b/Common/OpenGrid.Framework.Communications/OpenGrid.Framework.Communications.csproj index 00b1548..689210b 100644 --- a/Common/OpenGrid.Framework.Communications/OpenGrid.Framework.Communications.csproj +++ b/Common/OpenGrid.Framework.Communications/OpenGrid.Framework.Communications.csproj @@ -80,15 +80,36 @@ - + + Code + + Code - + Code Code + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + diff --git a/Common/OpenGrid.Framework.Communications/RegionServerCommsLocal.cs b/Common/OpenGrid.Framework.Communications/RegionServerCommsLocal.cs new file mode 100644 index 0000000..0743cbf --- /dev/null +++ b/Common/OpenGrid.Framework.Communications/RegionServerCommsLocal.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using libsecondlife; +using OpenSim.Framework; +using OpenSim.Framework.Interfaces; +using OpenSim.Framework.Types; + +namespace OpenGrid.Framework.Communications +{ + public class RegionServerCommsLocal : RegionServerCommsManager + { + public RegionServerCommsLocal() + { + userServer = new UserServer.UserCommsManagerLocal(); //Local User Server + gridServer = new GridServer.GridCommsManagerLocal(); //Locl Grid Server + } + } +} diff --git a/Common/OpenGrid.Framework.Communications/RegionServerCommsManager.cs b/Common/OpenGrid.Framework.Communications/RegionServerCommsManager.cs index fa786d3..38bce42 100644 --- a/Common/OpenGrid.Framework.Communications/RegionServerCommsManager.cs +++ b/Common/OpenGrid.Framework.Communications/RegionServerCommsManager.cs @@ -12,66 +12,12 @@ namespace OpenGrid.Framework.Communications public class RegionServerCommsManager { + public UserServer.UserCommsManagerBase userServer; + public GridServer.GridCommsManagerBase gridServer; public RegionServerCommsManager() { - - } - - /// - /// - /// - /// - public virtual RegionInfo LoadRegionConfigFromGridServer(LLUUID regionID) - { - return null; - } - - /// - /// - /// - /// - /// - public virtual RegionCommsHostBase RegisterRegion(RegionInfo regionInfo) - { - return null; - } - - /// - /// - /// - /// - /// - public virtual List RequestNeighbours(RegionInfo regionInfo) - { - return null; - } - - /// - /// - /// - /// - public virtual bool InformNeighbourOfChildAgent( ulong regionHandle, AgentCircuitData agentData) //should change from agentCircuitData - { - return false; - } - - /// - /// - /// - /// - public virtual bool AvatarCrossingToRegion() - { - return false; - } - - /// - /// - /// - /// - public virtual IList RequestMapBlocks() - { - return null; + } } } diff --git a/Common/OpenGrid.Framework.Communications/RegionServerCommsOGS.cs b/Common/OpenGrid.Framework.Communications/RegionServerCommsOGS.cs new file mode 100644 index 0000000..b0db473 --- /dev/null +++ b/Common/OpenGrid.Framework.Communications/RegionServerCommsOGS.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace OpenGrid.Framework.Communications +{ + public class RegionServerCommsOGS : RegionServerCommsManager + { + public RegionServerCommsOGS() + { + userServer = new UserServer.UserCommsManagerOGS(); //Remote User Server + gridServer = new GridServer.GridCommsManagerOGS(); //Remote Grid Server + } + } +} diff --git a/Common/OpenGrid.Framework.Communications/TestLocalCommsManager.cs b/Common/OpenGrid.Framework.Communications/TestLocalCommsManager.cs deleted file mode 100644 index fad2001..0000000 --- a/Common/OpenGrid.Framework.Communications/TestLocalCommsManager.cs +++ /dev/null @@ -1,117 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Text; -using libsecondlife; -using OpenSim.Framework; -using OpenSim.Framework.Interfaces; -using OpenSim.Framework.Types; - -namespace OpenGrid.Framework.Communications -{ - public class TestLocalCommsManager : RegionServerCommsManager - { - protected Dictionary regions = new Dictionary(); - protected Dictionary regionHosts = new Dictionary(); - - public TestLocalCommsManager() - { - - } - - /// - /// - /// - /// - /// - public override RegionCommsHostBase RegisterRegion(RegionInfo regionInfo) - { - //Console.WriteLine("CommsManager - Region " + regionInfo.RegionHandle + " , " + regionInfo.RegionLocX + " , "+ regionInfo.RegionLocY +" is registering"); - if (!this.regions.ContainsKey((uint)regionInfo.RegionHandle)) - { - //Console.WriteLine("CommsManager - Adding Region " + regionInfo.RegionHandle ); - this.regions.Add(regionInfo.RegionHandle, regionInfo); - RegionCommsHostBase regionHost = new RegionCommsHostBase(); - this.regionHosts.Add(regionInfo.RegionHandle, regionHost); - return regionHost; - } - - //already in our list of regions so for now lets return null - return null; - } - - /// - /// - /// - /// - /// - public override List RequestNeighbours(RegionInfo regionInfo) - { - // Console.WriteLine("Finding Neighbours to " + regionInfo.RegionHandle); - List neighbours = new List(); - - foreach (RegionInfo reg in this.regions.Values) - { - // Console.WriteLine("CommsManager- RequestNeighbours() checking region " + reg.RegionLocX + " , "+ reg.RegionLocY); - if (reg.RegionHandle != regionInfo.RegionHandle) - { - //Console.WriteLine("CommsManager- RequestNeighbours() - found a different region in list, checking location"); - if ((reg.RegionLocX > (regionInfo.RegionLocX - 2)) && (reg.RegionLocX < (regionInfo.RegionLocX + 2))) - { - if ((reg.RegionLocY > (regionInfo.RegionLocY - 2)) && (reg.RegionLocY < (regionInfo.RegionLocY + 2))) - { - neighbours.Add(reg); - } - } - } - } - return neighbours; - } - - /// - /// - /// - /// - public override bool InformNeighbourOfChildAgent(ulong regionHandle, AgentCircuitData agentData) //should change from agentCircuitData - { - //Console.WriteLine("CommsManager- Trying to Inform a region to expect child agent"); - if (this.regionHosts.ContainsKey(regionHandle)) - { - // Console.WriteLine("CommsManager- Informing a region to expect child agent"); - this.regionHosts[regionHandle].TriggerExpectUser(regionHandle, agentData); - return true; - } - return false; - } - - /// - /// Is a Sandbox mode method, used by the local Login server to inform a region of a connection user/session - /// - /// - /// - /// - public bool AddNewSession(ulong regionHandle, Login loginData) - { - //Console.WriteLine(" comms manager been told to expect new user"); - AgentCircuitData agent = new AgentCircuitData(); - agent.AgentID = loginData.Agent; - agent.firstname = loginData.First; - agent.lastname = loginData.Last; - agent.SessionID = loginData.Session; - agent.SecureSessionID = loginData.SecureSession; - agent.circuitcode = loginData.CircuitCode; - agent.BaseFolder = loginData.BaseFolder; - agent.InventoryFolder = loginData.InventoryFolder; - agent.startpos = new LLVector3(128, 128, 70); - - if (this.regionHosts.ContainsKey(regionHandle)) - { - this.regionHosts[regionHandle].TriggerExpectUser(regionHandle, agent); - return true; - } - - // region not found - return false; - } - } -} diff --git a/Common/OpenGrid.Framework.Communications/UserServer/UserCommsManagerBase.cs b/Common/OpenGrid.Framework.Communications/UserServer/UserCommsManagerBase.cs new file mode 100644 index 0000000..9ea4ae8 --- /dev/null +++ b/Common/OpenGrid.Framework.Communications/UserServer/UserCommsManagerBase.cs @@ -0,0 +1,30 @@ +using System; +using System.Collections.Generic; +using System.Text; + +using libsecondlife; +namespace OpenGrid.Framework.Communications.UserServer +{ + public class UserCommsManagerBase + { + public UserCommsManagerBase() + { + } + + public virtual UserProfileData GetUserProfile(string name) + { + return null; + } + public virtual UserProfileData GetUserProfile(LLUUID avatar_id) + { + return null; + } + } + + public class UserProfileData + { + public UserProfileData() + { + } + } +} diff --git a/Common/OpenGrid.Framework.Communications/UserServer/UserCommsManagerLocal.cs b/Common/OpenGrid.Framework.Communications/UserServer/UserCommsManagerLocal.cs new file mode 100644 index 0000000..eb0881a --- /dev/null +++ b/Common/OpenGrid.Framework.Communications/UserServer/UserCommsManagerLocal.cs @@ -0,0 +1,10 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace OpenGrid.Framework.Communications.UserServer +{ + public class UserCommsManagerLocal : UserCommsManagerBase + { + } +} diff --git a/Common/OpenGrid.Framework.Communications/UserServer/UserCommsManagerOGS.cs b/Common/OpenGrid.Framework.Communications/UserServer/UserCommsManagerOGS.cs new file mode 100644 index 0000000..0921535 --- /dev/null +++ b/Common/OpenGrid.Framework.Communications/UserServer/UserCommsManagerOGS.cs @@ -0,0 +1,10 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace OpenGrid.Framework.Communications.UserServer +{ + public class UserCommsManagerOGS : UserCommsManagerBase + { + } +} -- cgit v1.1