From 918c0a482663cbda9f75901e894d463b7f7c2b0b Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Thu, 24 Jul 2008 17:10:07 +0000 Subject: * refactor: move remaining user service -> inventory service OGS1 calls into the specific inter service class --- .../OGS1/OGS1InterServiceInventoryService.cs | 10 +++++--- OpenSim/Grid/UserServer/Main.cs | 6 ++--- OpenSim/Grid/UserServer/UserLoginService.cs | 30 ++++++++-------------- 3 files changed, 21 insertions(+), 25 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Grid/Communications/OGS1/OGS1InterServiceInventoryService.cs b/OpenSim/Grid/Communications/OGS1/OGS1InterServiceInventoryService.cs index 92a6ad8..6aa1440 100755 --- a/OpenSim/Grid/Communications/OGS1/OGS1InterServiceInventoryService.cs +++ b/OpenSim/Grid/Communications/OGS1/OGS1InterServiceInventoryService.cs @@ -46,6 +46,11 @@ namespace OpenSim.Grid.Communications.OGS1 m_inventoryServerUrl = inventoryServerUrl; } + /// + /// + /// + /// + /// public bool CreateNewUserInventory(LLUUID userId) { return SynchronousRestObjectPoster.BeginPostObject( @@ -59,9 +64,8 @@ namespace OpenSim.Grid.Communications.OGS1 /// public List GetInventorySkeleton(LLUUID userId) { - //m_log.ErrorFormat("[OGS1 INVENTORY SERVICE]: The GetInventorySkeleton() method here should never be called!"); - - return new List(); + return SynchronousRestObjectPoster.BeginPostObject>( + "POST", m_inventoryServerUrl + "RootFolders/", userId.UUID); } } } diff --git a/OpenSim/Grid/UserServer/Main.cs b/OpenSim/Grid/UserServer/Main.cs index 6e970d5..1338d68 100644 --- a/OpenSim/Grid/UserServer/Main.cs +++ b/OpenSim/Grid/UserServer/Main.cs @@ -100,10 +100,10 @@ namespace OpenSim.Grid.UserServer m_userManager._config = Cfg; m_userManager.AddPlugin(Cfg.DatabaseProvider, Cfg.DatabaseConnect); - m_loginService = new UserLoginService( - m_userManager, new LibraryRootFolder(), Cfg, Cfg.DefaultStartupMsg); + m_interServiceInventoryService = new OGS1InterServiceInventoryService(m_userManager._config.InventoryUrl); - m_interServiceInventoryService = new OGS1InterServiceInventoryService(m_userManager._config.InventoryUrl); + m_loginService = new UserLoginService( + m_userManager, m_interServiceInventoryService, new LibraryRootFolder(), Cfg, Cfg.DefaultStartupMsg); m_messagesService = new MessageServersConnector(); diff --git a/OpenSim/Grid/UserServer/UserLoginService.cs b/OpenSim/Grid/UserServer/UserLoginService.cs index 78f6e7c..6575b13 100644 --- a/OpenSim/Grid/UserServer/UserLoginService.cs +++ b/OpenSim/Grid/UserServer/UserLoginService.cs @@ -46,6 +46,8 @@ namespace OpenSim.Grid.UserServer public class UserLoginService : LoginService { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + + protected IInterServiceInventoryServices m_inventoryService; public event UserLoggedInAtLocation OnUserLoggedInAtLocation; @@ -54,12 +56,14 @@ namespace OpenSim.Grid.UserServer public UserConfig m_config; public UserLoginService( - UserManagerBase userManager, LibraryRootFolder libraryRootFolder, + UserManagerBase userManager, IInterServiceInventoryServices inventoryService, LibraryRootFolder libraryRootFolder, UserConfig config, string welcomeMess) : base(userManager, libraryRootFolder, welcomeMess) { m_config = config; + m_inventoryService = inventoryService; } + public override void LogOffUser(UserProfileData theUser, string message) { RegionProfileData SimInfo = null; @@ -96,6 +100,7 @@ namespace OpenSim.Grid.UserServer m_log.InfoFormat( "[ASSUMED CRASH]: Telling region {0} @ {1},{2} ({3}) that their agent is dead: {4}", SimInfo.regionName, SimInfo.regionLocX, SimInfo.regionLocY, SimInfo.httpServerURI, theUser.FirstName + " " + theUser.SurName); + try { XmlRpcRequest GridReq = new XmlRpcRequest("logoff_user", SendParams); @@ -420,20 +425,12 @@ namespace OpenSim.Grid.UserServer // See LoginService protected override InventoryData GetInventorySkeleton(LLUUID userID, string serverUrl) - { - string invUrl = m_config.InventoryUrl; - //if (!String.IsNullOrEmpty(serverUrl)) - //{ - // invUrl = serverUrl+"/"; - //} - + { m_log.DebugFormat( "[LOGIN]: Contacting inventory service at {0} for inventory skeleton of user {1}", m_config.InventoryUrl, userID); - - List folders - = SynchronousRestObjectPoster.BeginPostObject>( - "POST", invUrl + "RootFolders/", userID.UUID); + + List folders = m_inventoryService.GetInventorySkeleton(userID); if (null == folders || folders.Count == 0) { @@ -444,11 +441,7 @@ namespace OpenSim.Grid.UserServer // tools are creating the user profile directly in the database without creating the inventory. At // this time we'll accomodate them by lazily creating the user inventory now if it doesn't already // exist. - bool created = - SynchronousRestObjectPoster.BeginPostObject( - "POST", invUrl + "CreateInventory/", userID.UUID); - - if (!created) + if (!m_inventoryService.CreateNewUserInventory(userID)) { throw new Exception( String.Format( @@ -461,8 +454,7 @@ namespace OpenSim.Grid.UserServer m_log.InfoFormat("[LOGIN]: A new inventory skeleton was successfully created for user {0}", userID); } - folders = SynchronousRestObjectPoster.BeginPostObject>( - "POST", invUrl + "RootFolders/", userID.UUID); + folders = m_inventoryService.GetInventorySkeleton(userID); } if (folders != null && folders.Count > 0) -- cgit v1.1