Bug fix: change HGBroker to a INonSharedRegionModule
parent
42f978a478
commit
a0d79e621c
|
@ -183,7 +183,10 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||||
public bool IsForeignUser(UUID userID, out string assetServerURL)
|
public bool IsForeignUser(UUID userID, out string assetServerURL)
|
||||||
{
|
{
|
||||||
assetServerURL = string.Empty;
|
assetServerURL = string.Empty;
|
||||||
UserAccount account = m_Scene.UserAccountService.GetUserAccount(m_Scene.RegionInfo.ScopeID, userID);
|
UserAccount account = null;
|
||||||
|
if (m_Scene.UserAccountService != null)
|
||||||
|
account = m_Scene.UserAccountService.GetUserAccount(m_Scene.RegionInfo.ScopeID, userID);
|
||||||
|
|
||||||
if (account == null) // foreign
|
if (account == null) // foreign
|
||||||
{
|
{
|
||||||
ScenePresence sp = null;
|
ScenePresence sp = null;
|
||||||
|
@ -193,7 +196,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||||
if (aCircuit.ServiceURLs.ContainsKey("AssetServerURI"))
|
if (aCircuit.ServiceURLs.ContainsKey("AssetServerURI"))
|
||||||
{
|
{
|
||||||
assetServerURL = aCircuit.ServiceURLs["AssetServerURI"].ToString();
|
assetServerURL = aCircuit.ServiceURLs["AssetServerURI"].ToString();
|
||||||
return true;
|
assetServerURL = assetServerURL.Trim(new char[] { '/' }); return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,12 +40,17 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
||||||
{
|
{
|
||||||
public abstract class BaseInventoryConnector : IInventoryService
|
public abstract class BaseInventoryConnector : IInventoryService
|
||||||
{
|
{
|
||||||
protected InventoryCache m_cache;
|
protected static InventoryCache m_cache;
|
||||||
|
private static bool m_Initialized;
|
||||||
|
|
||||||
protected virtual void Init(IConfigSource source)
|
protected virtual void Init(IConfigSource source)
|
||||||
{
|
{
|
||||||
m_cache = new InventoryCache();
|
if (!m_Initialized)
|
||||||
m_cache.Init(source, this);
|
{
|
||||||
|
m_cache = new InventoryCache();
|
||||||
|
m_cache.Init(source, this);
|
||||||
|
m_Initialized = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -41,20 +41,21 @@ using OpenMetaverse;
|
||||||
|
|
||||||
namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
||||||
{
|
{
|
||||||
public class HGInventoryBroker : BaseInventoryConnector, ISharedRegionModule, IInventoryService
|
public class HGInventoryBroker : BaseInventoryConnector, INonSharedRegionModule, IInventoryService
|
||||||
{
|
{
|
||||||
private static readonly ILog m_log =
|
private static readonly ILog m_log =
|
||||||
LogManager.GetLogger(
|
LogManager.GetLogger(
|
||||||
MethodBase.GetCurrentMethod().DeclaringType);
|
MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
private bool m_Enabled = false;
|
private static bool m_Initialized = false;
|
||||||
private bool m_Initialized = false;
|
private static bool m_Enabled = false;
|
||||||
|
|
||||||
|
private static IInventoryService m_GridService;
|
||||||
|
private static ISessionAuthInventoryService m_HGService;
|
||||||
|
|
||||||
private Scene m_Scene;
|
private Scene m_Scene;
|
||||||
private IUserAccountService m_UserAccountService;
|
private IUserAccountService m_UserAccountService;
|
||||||
|
|
||||||
private IInventoryService m_GridService;
|
|
||||||
private ISessionAuthInventoryService m_HGService;
|
|
||||||
|
|
||||||
public Type ReplaceableInterface
|
public Type ReplaceableInterface
|
||||||
{
|
{
|
||||||
get { return null; }
|
get { return null; }
|
||||||
|
@ -67,63 +68,67 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
||||||
|
|
||||||
public void Initialise(IConfigSource source)
|
public void Initialise(IConfigSource source)
|
||||||
{
|
{
|
||||||
IConfig moduleConfig = source.Configs["Modules"];
|
if (!m_Initialized)
|
||||||
if (moduleConfig != null)
|
|
||||||
{
|
{
|
||||||
string name = moduleConfig.GetString("InventoryServices", "");
|
IConfig moduleConfig = source.Configs["Modules"];
|
||||||
if (name == Name)
|
if (moduleConfig != null)
|
||||||
{
|
{
|
||||||
IConfig inventoryConfig = source.Configs["InventoryService"];
|
string name = moduleConfig.GetString("InventoryServices", "");
|
||||||
if (inventoryConfig == null)
|
if (name == Name)
|
||||||
{
|
{
|
||||||
m_log.Error("[HG INVENTORY CONNECTOR]: InventoryService missing from OpenSim.ini");
|
IConfig inventoryConfig = source.Configs["InventoryService"];
|
||||||
return;
|
if (inventoryConfig == null)
|
||||||
|
{
|
||||||
|
m_log.Error("[HG INVENTORY CONNECTOR]: InventoryService missing from OpenSim.ini");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
string localDll = inventoryConfig.GetString("LocalGridInventoryService",
|
||||||
|
String.Empty);
|
||||||
|
string HGDll = inventoryConfig.GetString("HypergridInventoryService",
|
||||||
|
String.Empty);
|
||||||
|
|
||||||
|
if (localDll == String.Empty)
|
||||||
|
{
|
||||||
|
m_log.Error("[HG INVENTORY CONNECTOR]: No LocalGridInventoryService named in section InventoryService");
|
||||||
|
//return;
|
||||||
|
throw new Exception("Unable to proceed. Please make sure your ini files in config-include are updated according to .example's");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (HGDll == String.Empty)
|
||||||
|
{
|
||||||
|
m_log.Error("[HG INVENTORY CONNECTOR]: No HypergridInventoryService named in section InventoryService");
|
||||||
|
//return;
|
||||||
|
throw new Exception("Unable to proceed. Please make sure your ini files in config-include are updated according to .example's");
|
||||||
|
}
|
||||||
|
|
||||||
|
Object[] args = new Object[] { source };
|
||||||
|
m_GridService =
|
||||||
|
ServerUtils.LoadPlugin<IInventoryService>(localDll,
|
||||||
|
args);
|
||||||
|
|
||||||
|
m_HGService =
|
||||||
|
ServerUtils.LoadPlugin<ISessionAuthInventoryService>(HGDll,
|
||||||
|
args);
|
||||||
|
|
||||||
|
if (m_GridService == null)
|
||||||
|
{
|
||||||
|
m_log.Error("[HG INVENTORY CONNECTOR]: Can't load local inventory service");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (m_HGService == null)
|
||||||
|
{
|
||||||
|
m_log.Error("[HG INVENTORY CONNECTOR]: Can't load hypergrid inventory service");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Init(source);
|
||||||
|
|
||||||
|
m_Enabled = true;
|
||||||
|
m_log.Info("[HG INVENTORY CONNECTOR]: HG inventory broker enabled");
|
||||||
}
|
}
|
||||||
|
|
||||||
string localDll = inventoryConfig.GetString("LocalGridInventoryService",
|
|
||||||
String.Empty);
|
|
||||||
string HGDll = inventoryConfig.GetString("HypergridInventoryService",
|
|
||||||
String.Empty);
|
|
||||||
|
|
||||||
if (localDll == String.Empty)
|
|
||||||
{
|
|
||||||
m_log.Error("[HG INVENTORY CONNECTOR]: No LocalGridInventoryService named in section InventoryService");
|
|
||||||
//return;
|
|
||||||
throw new Exception("Unable to proceed. Please make sure your ini files in config-include are updated according to .example's");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (HGDll == String.Empty)
|
|
||||||
{
|
|
||||||
m_log.Error("[HG INVENTORY CONNECTOR]: No HypergridInventoryService named in section InventoryService");
|
|
||||||
//return;
|
|
||||||
throw new Exception("Unable to proceed. Please make sure your ini files in config-include are updated according to .example's");
|
|
||||||
}
|
|
||||||
|
|
||||||
Object[] args = new Object[] { source };
|
|
||||||
m_GridService =
|
|
||||||
ServerUtils.LoadPlugin<IInventoryService>(localDll,
|
|
||||||
args);
|
|
||||||
|
|
||||||
m_HGService =
|
|
||||||
ServerUtils.LoadPlugin<ISessionAuthInventoryService>(HGDll,
|
|
||||||
args);
|
|
||||||
|
|
||||||
if (m_GridService == null)
|
|
||||||
{
|
|
||||||
m_log.Error("[HG INVENTORY CONNECTOR]: Can't load local inventory service");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (m_HGService == null)
|
|
||||||
{
|
|
||||||
m_log.Error("[HG INVENTORY CONNECTOR]: Can't load hypergrid inventory service");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Init(source);
|
|
||||||
|
|
||||||
m_Enabled = true;
|
|
||||||
m_log.Info("[HG INVENTORY CONNECTOR]: HG inventory broker enabled");
|
|
||||||
}
|
}
|
||||||
|
m_Initialized = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -140,13 +145,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
||||||
if (!m_Enabled)
|
if (!m_Enabled)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!m_Initialized)
|
m_Scene = scene;
|
||||||
{
|
m_UserAccountService = m_Scene.UserAccountService;
|
||||||
m_Scene = scene;
|
|
||||||
m_UserAccountService = m_Scene.UserAccountService;
|
|
||||||
|
|
||||||
m_Initialized = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
scene.RegisterModuleInterface<IInventoryService>(this);
|
scene.RegisterModuleInterface<IInventoryService>(this);
|
||||||
m_cache.AddRegion(scene);
|
m_cache.AddRegion(scene);
|
||||||
|
@ -514,7 +514,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
||||||
private bool IsForeignUser(UUID userID, out string inventoryURL)
|
private bool IsForeignUser(UUID userID, out string inventoryURL)
|
||||||
{
|
{
|
||||||
inventoryURL = string.Empty;
|
inventoryURL = string.Empty;
|
||||||
UserAccount account = m_Scene.UserAccountService.GetUserAccount(m_Scene.RegionInfo.ScopeID, userID);
|
UserAccount account = null;
|
||||||
|
if (m_Scene.UserAccountService != null)
|
||||||
|
account = m_Scene.UserAccountService.GetUserAccount(m_Scene.RegionInfo.ScopeID, userID);
|
||||||
|
|
||||||
if (account == null) // foreign user
|
if (account == null) // foreign user
|
||||||
{
|
{
|
||||||
ScenePresence sp = null;
|
ScenePresence sp = null;
|
||||||
|
|
Loading…
Reference in New Issue