* refactor: move remaining user service -> inventory service OGS1 calls into the specific inter service class
parent
11385c53e6
commit
918c0a4826
|
@ -46,6 +46,11 @@ namespace OpenSim.Grid.Communications.OGS1
|
||||||
m_inventoryServerUrl = inventoryServerUrl;
|
m_inventoryServerUrl = inventoryServerUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// <see cref="OpenSim.Framework.Communications.IInterServiceInventoryServices"/>
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="userId"></param>
|
||||||
|
/// <returns></returns>
|
||||||
public bool CreateNewUserInventory(LLUUID userId)
|
public bool CreateNewUserInventory(LLUUID userId)
|
||||||
{
|
{
|
||||||
return SynchronousRestObjectPoster.BeginPostObject<Guid, bool>(
|
return SynchronousRestObjectPoster.BeginPostObject<Guid, bool>(
|
||||||
|
@ -59,9 +64,8 @@ namespace OpenSim.Grid.Communications.OGS1
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public List<InventoryFolderBase> GetInventorySkeleton(LLUUID userId)
|
public List<InventoryFolderBase> GetInventorySkeleton(LLUUID userId)
|
||||||
{
|
{
|
||||||
//m_log.ErrorFormat("[OGS1 INVENTORY SERVICE]: The GetInventorySkeleton() method here should never be called!");
|
return SynchronousRestObjectPoster.BeginPostObject<Guid, List<InventoryFolderBase>>(
|
||||||
|
"POST", m_inventoryServerUrl + "RootFolders/", userId.UUID);
|
||||||
return new List<InventoryFolderBase>();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -100,11 +100,11 @@ namespace OpenSim.Grid.UserServer
|
||||||
m_userManager._config = Cfg;
|
m_userManager._config = Cfg;
|
||||||
m_userManager.AddPlugin(Cfg.DatabaseProvider, Cfg.DatabaseConnect);
|
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();
|
m_messagesService = new MessageServersConnector();
|
||||||
|
|
||||||
m_loginService.OnUserLoggedInAtLocation += NotifyMessageServersUserLoggedInToLocation;
|
m_loginService.OnUserLoggedInAtLocation += NotifyMessageServersUserLoggedInToLocation;
|
||||||
|
|
|
@ -47,6 +47,8 @@ namespace OpenSim.Grid.UserServer
|
||||||
{
|
{
|
||||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
|
protected IInterServiceInventoryServices m_inventoryService;
|
||||||
|
|
||||||
public event UserLoggedInAtLocation OnUserLoggedInAtLocation;
|
public event UserLoggedInAtLocation OnUserLoggedInAtLocation;
|
||||||
|
|
||||||
private UserLoggedInAtLocation handlerUserLoggedInAtLocation = null;
|
private UserLoggedInAtLocation handlerUserLoggedInAtLocation = null;
|
||||||
|
@ -54,12 +56,14 @@ namespace OpenSim.Grid.UserServer
|
||||||
public UserConfig m_config;
|
public UserConfig m_config;
|
||||||
|
|
||||||
public UserLoginService(
|
public UserLoginService(
|
||||||
UserManagerBase userManager, LibraryRootFolder libraryRootFolder,
|
UserManagerBase userManager, IInterServiceInventoryServices inventoryService, LibraryRootFolder libraryRootFolder,
|
||||||
UserConfig config, string welcomeMess)
|
UserConfig config, string welcomeMess)
|
||||||
: base(userManager, libraryRootFolder, welcomeMess)
|
: base(userManager, libraryRootFolder, welcomeMess)
|
||||||
{
|
{
|
||||||
m_config = config;
|
m_config = config;
|
||||||
|
m_inventoryService = inventoryService;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void LogOffUser(UserProfileData theUser, string message)
|
public override void LogOffUser(UserProfileData theUser, string message)
|
||||||
{
|
{
|
||||||
RegionProfileData SimInfo = null;
|
RegionProfileData SimInfo = null;
|
||||||
|
@ -96,6 +100,7 @@ namespace OpenSim.Grid.UserServer
|
||||||
m_log.InfoFormat(
|
m_log.InfoFormat(
|
||||||
"[ASSUMED CRASH]: Telling region {0} @ {1},{2} ({3}) that their agent is dead: {4}",
|
"[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);
|
SimInfo.regionName, SimInfo.regionLocX, SimInfo.regionLocY, SimInfo.httpServerURI, theUser.FirstName + " " + theUser.SurName);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
XmlRpcRequest GridReq = new XmlRpcRequest("logoff_user", SendParams);
|
XmlRpcRequest GridReq = new XmlRpcRequest("logoff_user", SendParams);
|
||||||
|
@ -421,19 +426,11 @@ namespace OpenSim.Grid.UserServer
|
||||||
// See LoginService
|
// See LoginService
|
||||||
protected override InventoryData GetInventorySkeleton(LLUUID userID, string serverUrl)
|
protected override InventoryData GetInventorySkeleton(LLUUID userID, string serverUrl)
|
||||||
{
|
{
|
||||||
string invUrl = m_config.InventoryUrl;
|
|
||||||
//if (!String.IsNullOrEmpty(serverUrl))
|
|
||||||
//{
|
|
||||||
// invUrl = serverUrl+"/";
|
|
||||||
//}
|
|
||||||
|
|
||||||
m_log.DebugFormat(
|
m_log.DebugFormat(
|
||||||
"[LOGIN]: Contacting inventory service at {0} for inventory skeleton of user {1}",
|
"[LOGIN]: Contacting inventory service at {0} for inventory skeleton of user {1}",
|
||||||
m_config.InventoryUrl, userID);
|
m_config.InventoryUrl, userID);
|
||||||
|
|
||||||
List<InventoryFolderBase> folders
|
List<InventoryFolderBase> folders = m_inventoryService.GetInventorySkeleton(userID);
|
||||||
= SynchronousRestObjectPoster.BeginPostObject<Guid, List<InventoryFolderBase>>(
|
|
||||||
"POST", invUrl + "RootFolders/", userID.UUID);
|
|
||||||
|
|
||||||
if (null == folders || folders.Count == 0)
|
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
|
// 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
|
// this time we'll accomodate them by lazily creating the user inventory now if it doesn't already
|
||||||
// exist.
|
// exist.
|
||||||
bool created =
|
if (!m_inventoryService.CreateNewUserInventory(userID))
|
||||||
SynchronousRestObjectPoster.BeginPostObject<Guid, bool>(
|
|
||||||
"POST", invUrl + "CreateInventory/", userID.UUID);
|
|
||||||
|
|
||||||
if (!created)
|
|
||||||
{
|
{
|
||||||
throw new Exception(
|
throw new Exception(
|
||||||
String.Format(
|
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);
|
m_log.InfoFormat("[LOGIN]: A new inventory skeleton was successfully created for user {0}", userID);
|
||||||
}
|
}
|
||||||
|
|
||||||
folders = SynchronousRestObjectPoster.BeginPostObject<Guid, List<InventoryFolderBase>>(
|
folders = m_inventoryService.GetInventorySkeleton(userID);
|
||||||
"POST", invUrl + "RootFolders/", userID.UUID);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (folders != null && folders.Count > 0)
|
if (folders != null && folders.Count > 0)
|
||||||
|
|
Loading…
Reference in New Issue