Heart surgery no.2: the inventory service hooks.

Several improvements in the connectors themselves.
Several improvements in configurations.
Needed to add a hack in IUserService and UserManagerBase, to be removed when that service is refactored.
0.6.6-post-fixes
diva 2009-06-10 13:18:32 +00:00
parent 8045ed28ec
commit 0f367bd7bb
34 changed files with 726 additions and 437 deletions

View File

@ -1290,15 +1290,15 @@ namespace OpenSim.ApplicationPlugins.RemoteController
UICallback sic = new UICallback();
UICallback dic = new UICallback();
IInventoryServices iserv = m_app.CommunicationsManager.InventoryService;
IInventoryService iserv = m_app.SceneManager.CurrentOrFirstScene.InventoryService;
try
{
Dictionary<UUID,UUID> imap = new Dictionary<UUID,UUID>();
iserv.RequestInventoryForUser(dest, dic.callback);
iserv.RequestInventoryForUser(srca, sic.callback);
iserv.GetUserInventory(dest, dic.callback);
iserv.GetUserInventory(srca, sic.callback);
dic.GetInventory();
sic.GetInventory();
@ -1436,8 +1436,8 @@ namespace OpenSim.ApplicationPlugins.RemoteController
bool select = false;
UICallback uic;
IInventoryServices iserv = m_app.CommunicationsManager.InventoryService;
IAssetService aserv = m_app.SceneManager.CurrentOrFirstScene.AssetService;
IInventoryService iserv = m_app.SceneManager.CurrentOrFirstScene.InventoryService;
IAssetService aserv = m_app.SceneManager.CurrentOrFirstScene.AssetService;
doc.LoadXml(File.ReadAllText(dafn));
@ -1511,7 +1511,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
{
uic = new UICallback();
// Request the inventory
iserv.RequestInventoryForUser(ID, uic.callback);
iserv.GetUserInventory(ID, uic.callback);
// While the inventory is being fetched, setup for appearance processing
if ((mava = m_app.CommunicationsManager.AvatarService.GetUserAppearance(ID)) == null)

View File

@ -97,9 +97,9 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
get { return main.CommunicationsManager; }
}
internal static IInventoryServices InventoryServices
internal static IInventoryService InventoryServices
{
get { return Comms.InventoryService; }
get { return main.SceneManager.CurrentOrFirstScene.InventoryService; }
}
internal static IUserService UserServices

View File

@ -270,7 +270,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
Rest.Log.DebugFormat("{0} Inventory Root retrieved for {1} {2}",
MsgId, rdata.userProfile.FirstName, rdata.userProfile.SurName);
Rest.InventoryServices.RequestInventoryForUser(rdata.uuid, rdata.GetUserInventory);
Rest.InventoryServices.GetUserInventory(rdata.uuid, rdata.GetUserInventory);
Rest.Log.DebugFormat("{0} Inventory catalog requested for {1} {2}",
MsgId, rdata.userProfile.FirstName, rdata.userProfile.SurName);

View File

@ -30,6 +30,7 @@ using System.Collections.Generic;
using System.Reflection;
using log4net;
using OpenMetaverse;
using OpenSim.Services.Interfaces;
namespace OpenSim.Framework.Communications.Cache
{
@ -62,7 +63,7 @@ namespace OpenSim.Framework.Communications.Cache
/// <summary>
/// The comms manager holds references to services (user, grid, inventory, etc.)
/// </summary>
private readonly CommunicationsManager m_commsManager;
private readonly IInventoryService m_InventoryService;
public UserProfileData UserProfile { get { return m_userProfile; } }
private UserProfileData m_userProfile;
@ -96,10 +97,10 @@ namespace OpenSim.Framework.Communications.Cache
/// </summary>
/// <param name="commsManager"></param>
/// <param name="userProfile"></param>
public CachedUserInfo(CommunicationsManager commsManager, UserProfileData userProfile)
public CachedUserInfo(IInventoryService invService, UserProfileData userProfile)
{
m_commsManager = commsManager;
m_userProfile = userProfile;
m_InventoryService = invService;
}
/// <summary>
@ -213,15 +214,7 @@ namespace OpenSim.Framework.Communications.Cache
/// asynchronously otherwise.
public void FetchInventory()
{
if (m_commsManager.SecureInventoryService != null)
{
m_commsManager.SecureInventoryService.RequestInventoryForUser(
UserProfile.ID, SessionID, InventoryReceive);
}
else
{
m_commsManager.InventoryService.RequestInventoryForUser(UserProfile.ID, InventoryReceive);
}
m_InventoryService.GetUserInventory(UserProfile.ID, InventoryReceive);
}
/// <summary>
@ -383,14 +376,8 @@ namespace OpenSim.Framework.Communications.Cache
createdBaseFolder.Type = createdFolder.Type;
createdBaseFolder.Version = createdFolder.Version;
if (m_commsManager.SecureInventoryService != null)
{
m_commsManager.SecureInventoryService.AddFolder(createdBaseFolder, m_session_id);
}
else
{
m_commsManager.InventoryService.AddFolder(createdBaseFolder);
}
m_InventoryService.AddFolder(createdBaseFolder);
return true;
}
else
@ -449,14 +436,7 @@ namespace OpenSim.Framework.Communications.Cache
baseFolder.Type = (short)type;
baseFolder.Version = RootFolder.Version;
if (m_commsManager.SecureInventoryService != null)
{
m_commsManager.SecureInventoryService.UpdateFolder(baseFolder, m_session_id);
}
else
{
m_commsManager.InventoryService.UpdateFolder(baseFolder);
}
m_InventoryService.UpdateFolder(baseFolder);
folder.Name = name;
folder.Type = (short)type;
@ -498,14 +478,7 @@ namespace OpenSim.Framework.Communications.Cache
baseFolder.ID = folderID;
baseFolder.ParentID = parentID;
if (m_commsManager.SecureInventoryService != null)
{
m_commsManager.SecureInventoryService.MoveFolder(baseFolder, m_session_id);
}
else
{
m_commsManager.InventoryService.MoveFolder(baseFolder);
}
m_InventoryService.MoveFolder(baseFolder);
InventoryFolderImpl folder = RootFolder.FindFolder(folderID);
InventoryFolderImpl parentFolder = RootFolder.FindFolder(parentID);
@ -568,14 +541,7 @@ namespace OpenSim.Framework.Communications.Cache
purgedBaseFolder.Type = purgedFolder.Type;
purgedBaseFolder.Version = purgedFolder.Version;
if (m_commsManager.SecureInventoryService != null)
{
m_commsManager.SecureInventoryService.PurgeFolder(purgedBaseFolder, m_session_id);
}
else
{
m_commsManager.InventoryService.PurgeFolder(purgedBaseFolder);
}
m_InventoryService.PurgeFolder(purgedBaseFolder);
purgedFolder.Purge();
@ -615,14 +581,7 @@ namespace OpenSim.Framework.Communications.Cache
}
ItemReceive(item, null);
if (m_commsManager.SecureInventoryService != null)
{
m_commsManager.SecureInventoryService.AddItem(item, m_session_id);
}
else
{
m_commsManager.InventoryService.AddItem(item);
}
m_InventoryService.AddItem(item);
}
else
{
@ -642,14 +601,7 @@ namespace OpenSim.Framework.Communications.Cache
{
if (m_hasReceivedInventory)
{
if (m_commsManager.SecureInventoryService != null)
{
m_commsManager.SecureInventoryService.UpdateItem(item, m_session_id);
}
else
{
m_commsManager.InventoryService.UpdateItem(item);
}
m_InventoryService.UpdateItem(item);
}
else
{
@ -688,14 +640,7 @@ namespace OpenSim.Framework.Communications.Cache
if (RootFolder.DeleteItem(item.ID))
{
if (m_commsManager.SecureInventoryService != null)
{
return m_commsManager.SecureInventoryService.DeleteItem(item, m_session_id);
}
else
{
return m_commsManager.InventoryService.DeleteItem(item);
}
return m_InventoryService.DeleteItem(item);
}
}
else
@ -789,14 +734,7 @@ namespace OpenSim.Framework.Communications.Cache
InventoryItemBase itemInfo = null;
if (m_commsManager.SecureInventoryService != null)
{
itemInfo = m_commsManager.SecureInventoryService.QueryItem(item, m_session_id);
}
else
{
itemInfo = m_commsManager.InventoryService.QueryItem(item);
}
itemInfo = m_InventoryService.QueryItem(item);
if (itemInfo != null)
{
@ -833,14 +771,7 @@ namespace OpenSim.Framework.Communications.Cache
InventoryFolderBase folderInfo = null;
if (m_commsManager.SecureInventoryService != null)
{
folderInfo = m_commsManager.SecureInventoryService.QueryFolder(folder, m_session_id);
}
else
{
folderInfo = m_commsManager.InventoryService.QueryFolder(folder);
}
folderInfo = m_InventoryService.QueryFolder(folder);
if (folderInfo != null)
{

View File

@ -29,6 +29,7 @@ using System.Collections.Generic;
using System.Reflection;
using log4net;
using OpenMetaverse;
using OpenSim.Services.Interfaces;
namespace OpenSim.Framework.Communications.Cache
{
@ -66,6 +67,8 @@ namespace OpenSim.Framework.Communications.Cache
/// </summary>
public readonly InventoryFolderImpl LibraryRoot;
private IInventoryService m_InventoryService;
/// <summary>
/// Constructor
/// </summary>
@ -77,6 +80,11 @@ namespace OpenSim.Framework.Communications.Cache
LibraryRoot = libraryRootFolder;
}
public void SetInventoryService(IInventoryService invService)
{
m_InventoryService = invService;
}
/// <summary>
/// A new user has moved into a region in this instance so retrieve their profile from the user service.
/// </summary>
@ -200,7 +208,7 @@ namespace OpenSim.Framework.Communications.Cache
/// <param name="userProfile"></param>
protected CachedUserInfo AddToCaches(UserProfileData userProfile)
{
CachedUserInfo createdUserInfo = new CachedUserInfo(m_commsManager, userProfile);
CachedUserInfo createdUserInfo = new CachedUserInfo(m_InventoryService, userProfile);
lock (m_userProfilesById)
{

View File

@ -28,6 +28,7 @@
using System;
using System.Collections.Generic;
using OpenMetaverse;
using OpenSim.Services.Interfaces;
namespace OpenSim.Framework.Communications
{
@ -135,5 +136,10 @@ namespace OpenSim.Framework.Communications
// This probably shouldn't be here, it belongs to IAuthentication
// But since Scenes only have IUserService references, I'm placing it here for now.
bool VerifySession(UUID userID, UUID sessionID);
// Temporary Hack until we move everything to the new service model
void SetInventoryService(IInventoryService invService);
}
}

View File

@ -33,6 +33,7 @@ using NUnit.Framework.SyntaxHelpers;
using OpenMetaverse;
using OpenSim.Framework;
using OpenSim.Framework.Communications.Cache;
using OpenSim.Services.Interfaces;
using OpenSim.Tests.Common.Mock;
namespace OpenSim.Framework.Communications.Tests
@ -143,6 +144,11 @@ namespace OpenSim.Framework.Communications.Tests
{
return true;
}
public void SetInventoryService(IInventoryService inv)
{
throw new NotImplementedException();
}
}
}
}

View File

@ -37,6 +37,7 @@ using OpenMetaverse.StructuredData;
using OpenSim.Data;
using OpenSim.Framework.Communications;
using OpenSim.Framework.Statistics;
using OpenSim.Services.Interfaces;
namespace OpenSim.Framework.Communications
{
@ -54,6 +55,7 @@ namespace OpenSim.Framework.Communications
private List<IUserDataPlugin> m_plugins = new List<IUserDataPlugin>();
protected CommunicationsManager m_commsManager;
protected IInventoryService m_InventoryService;
/// <summary>
/// Constructor
@ -64,6 +66,11 @@ namespace OpenSim.Framework.Communications
m_commsManager = commsManager;
}
public virtual void SetInventoryService(IInventoryService invService)
{
m_InventoryService = invService;
}
/// <summary>
/// Add a new user data plugin - plugins will be requested in the order they were added.
/// </summary>
@ -676,7 +683,24 @@ namespace OpenSim.Framework.Communications
}
else
{
m_commsManager.InterServiceInventoryService.CreateNewUserInventory(userProf.ID);
//
// WARNING: This is a horrible hack
// The purpose here is to avoid touching the user server at this point.
// There are dragons there that I can't deal with right now.
// diva 06/09/09
//
if (m_InventoryService != null)
{
// local service (standalone)
m_log.Debug("[USERSTORAGE]: using IInventoryService to create user's inventory");
m_InventoryService.CreateUserInventory(userProf.ID);
}
else
{
// used by the user server
m_log.Debug("[USERSTORAGE]: using m_commsManager.InterServiceInventoryService to create user's inventory");
m_commsManager.InterServiceInventoryService.CreateNewUserInventory(userProf.ID);
}
return userProf.ID;
}

View File

@ -35,6 +35,7 @@ using OpenSim.Framework.Communications.Cache;
using OpenSim.Framework.Communications.Clients;
using OpenSim.Region.Communications.OGS1;
using OpenSim.Region.Communications.Local;
using OpenSim.Services.Interfaces;
namespace OpenSim.Region.Communications.Hypergrid
{
@ -63,6 +64,12 @@ namespace OpenSim.Region.Communications.Hypergrid
m_localUserServices = local;
}
public override void SetInventoryService(IInventoryService invService)
{
base.SetInventoryService(invService);
m_localUserServices.SetInventoryService(invService);
}
public override UUID AddUser(
string firstName, string lastName, string password, string email, uint regX, uint regY, UUID uuid)
{

View File

@ -1,167 +0,0 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSimulator Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.Collections;
using System.Collections.Generic;
using System.Reflection;
using log4net;
using Nini.Config;
using OpenMetaverse;
using OpenSim.Data;
using OpenSim.Framework;
using OpenSim.Framework.Communications;
using OpenSim.Framework.Communications.Cache;
using OpenSim.Framework.Communications.Services;
using Caps = OpenSim.Framework.Communications.Capabilities.Caps;
using LLSDHelpers = OpenSim.Framework.Communications.Capabilities.LLSDHelpers;
using OpenSim.Framework.Servers;
using OpenSim.Framework.Servers.HttpServer;
using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes;
using OpenSim.Region.CoreModules.ServiceConnectors.Interregion;
using OpenMetaverse.StructuredData;
namespace OpenSim.Region.CoreModules.Hypergrid
{
public class HGStandaloneInventoryModule : IRegionModule
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private static bool initialized = false;
private static bool enabled = false;
private static bool safemode = false;
private bool m_doLookup = false;
Scene m_scene;
HGInventoryService m_inventoryService;
InventoryServiceBase m_inventoryBase;
public bool DoLookup
{
get { return m_doLookup; }
set { m_doLookup = value; }
}
#region IRegionModule interface
public void Initialise(Scene scene, IConfigSource config)
{
if (!initialized)
{
initialized = true;
m_scene = scene;
// This module is only on for standalones
enabled = !config.Configs["Startup"].GetBoolean("gridmode", true) && config.Configs["Startup"].GetBoolean("hypergrid", false);
if (config.Configs["Hypergrid"] != null)
safemode = config.Configs["Hypergrid"].GetBoolean("safemode", false);
}
}
public void PostInitialise()
{
if (enabled)
{
m_log.Info("[HGStandaloneInvModule]: Starting...");
//m_inventoryService = new InventoryService(m_scene);
m_inventoryBase = (InventoryServiceBase)m_scene.CommsManager.SecureInventoryService;
m_inventoryService = new HGInventoryService(m_inventoryBase, m_scene.AssetService,
(UserManagerBase)m_scene.CommsManager.UserAdminService, m_scene.CommsManager.HttpServer,
m_scene.CommsManager.NetworkServersInfo.InventoryURL);
AddHttpHandlers(m_scene.CommsManager.HttpServer);
m_inventoryService.AddHttpHandlers();
}
}
public void Close()
{
}
public string Name
{
get { return "HGStandaloneInventoryModule"; }
}
public bool IsSharedModule
{
get { return true; }
}
#endregion
public virtual void AddHttpHandlers(IHttpServer httpServer)
{
if (!safemode)
{
httpServer.AddStreamHandler(
new RestDeserialiseSecureHandler<Guid, InventoryCollection>(
"POST", "/GetInventory/", m_inventoryService.GetUserInventory, CheckAuthSession));
httpServer.AddStreamHandler(
new RestDeserialiseSecureHandler<InventoryItemBase, bool>(
"POST", "/DeleteItem/", m_inventoryBase.DeleteItem, CheckAuthSession));
httpServer.AddStreamHandler(
new RestDeserialiseSecureHandler<InventoryFolderBase, bool>(
"POST", "/UpdateFolder/", m_inventoryBase.UpdateFolder, CheckAuthSession));
httpServer.AddStreamHandler(
new RestDeserialiseSecureHandler<InventoryFolderBase, bool>(
"POST", "/MoveFolder/", m_inventoryBase.MoveFolder, CheckAuthSession));
httpServer.AddStreamHandler(
new RestDeserialiseSecureHandler<InventoryFolderBase, bool>(
"POST", "/PurgeFolder/", m_inventoryBase.PurgeFolder, CheckAuthSession));
}
httpServer.AddStreamHandler(
new RestDeserialiseSecureHandler<InventoryFolderBase, bool>(
"POST", "/NewFolder/", m_inventoryBase.AddFolder, CheckAuthSession));
httpServer.AddStreamHandler(
new RestDeserialiseSecureHandler<InventoryItemBase, bool>(
"POST", "/NewItem/", m_inventoryBase.AddItem, CheckAuthSession));
}
/// <summary>
/// Check that the source of an inventory request for a particular agent is a current session belonging to
/// that agent.
/// </summary>
/// <param name="session_id"></param>
/// <param name="avatar_id"></param>
/// <returns></returns>
public bool CheckAuthSession(string session_id, string avatar_id)
{
return true;
}
}
}

View File

@ -18,8 +18,11 @@
<RegionModule id="RemoteAssetServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectors.Asset.RemoteAssetServicesConnector" />
<RegionModule id="HGAssetBroker" type="OpenSim.Region.CoreModules.ServiceConnectors.Asset.HGAssetBroker" />
<RegionModule id="CoreAssetCache" type="OpenSim.Region.CoreModules.Asset.CoreAssetCache" />
<RegionModule id="CoreAssetCache" type="OpenSim.Region.CoreModules.Asset.GlynnTuckerAssetCache" />
<RegionModule id="GlynnTuckerAssetCache" type="OpenSim.Region.CoreModules.Asset.GlynnTuckerAssetCache" />
<RegionModule id="CenomeMemoryAssetCache" type="OpenSim.Region.CoreModules.Asset.CenomeMemoryAssetCache"/>
<RegionModule id="LocalInventoryServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectors.Inventory.LocalInventoryServicesConnector" />
<RegionModule id="RemoteInventoryServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectors.Inventory.RemoteInventoryServicesConnector" />
<RegionModule id="HGInventoryBroker" type="OpenSim.Region.CoreModules.ServiceConnectors.Inventory.HGInventoryBroker" />
<RegionModule id="UrlModule" type="OpenSim.Region.CoreModules.Scripting.LSLHttp.UrlModule" />
<RegionModule id="Chat" type="OpenSim.Region.CoreModules.Avatar.Chat.ChatModule" />
</Extension>

View File

@ -84,13 +84,15 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Inventory
if (localDll == String.Empty)
{
m_log.Error("[HG INVENTORY CONNECTOR]: No LocalGridInventoryService named in section InventoryService");
return;
//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;
//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 };
@ -116,7 +118,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Inventory
m_LocalGridInventoryURI = inventoryConfig.GetString("InventoryServerURI", string.Empty);
m_Enabled = true;
m_log.Info("[HG INVENTORY CONNECTOR]: HG asset broker enabled");
m_log.Info("[HG INVENTORY CONNECTOR]: HG inventory broker enabled");
}
}
}
@ -139,6 +141,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Inventory
m_Scene = scene;
// HACK for now. Ugh!
m_UserProfileService = m_Scene.CommsManager.UserProfileCacheService;
// ugh!
m_UserProfileService.SetInventoryService(this);
scene.CommsManager.UserService.SetInventoryService(this);
m_Initialized = true;
}
scene.RegisterModuleInterface<IInventoryService>(this);
@ -153,7 +160,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Inventory
if (!m_Enabled)
return;
m_log.InfoFormat("[INVENTORY CONNECTOR]: Enabled remote inventory for region {0}", scene.RegionInfo.RegionName);
m_log.InfoFormat("[INVENTORY CONNECTOR]: Enabled HG inventory for region {0}", scene.RegionInfo.RegionName);
}
@ -161,10 +168,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Inventory
public bool CreateUserInventory(UUID userID)
{
if (IsLocalGridUser(userID))
return m_GridService.CreateUserInventory(userID);
else
return false;
return m_GridService.CreateUserInventory(userID);
}
public List<InventoryFolderBase> GetInventorySkeleton(UUID userId)
@ -187,7 +191,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Inventory
else
{
UUID sessionID = GetSessionID(userID);
string uri = "http://" + GetUserInventoryURI(userID) + "/" + userID.ToString();
string uri = GetUserInventoryURI(userID) + "/" + userID.ToString();
m_HGService.GetUserInventory(uri, sessionID, callback);
}
}
@ -207,7 +211,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Inventory
else
{
UUID sessionID = GetSessionID(folder.Owner);
string uri = "http://" + GetUserInventoryURI(folder.Owner) + "/" + folder.Owner.ToString();
string uri = GetUserInventoryURI(folder.Owner) + "/" + folder.Owner.ToString();
return m_HGService.AddFolder(uri, folder, sessionID);
}
}
@ -222,7 +226,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Inventory
else
{
UUID sessionID = GetSessionID(folder.Owner);
string uri = "http://" + GetUserInventoryURI(folder.Owner) + "/" + folder.Owner.ToString();
string uri = GetUserInventoryURI(folder.Owner) + "/" + folder.Owner.ToString();
return m_HGService.UpdateFolder(uri, folder, sessionID);
}
}
@ -237,7 +241,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Inventory
else
{
UUID sessionID = GetSessionID(folder.Owner);
string uri = "http://" + GetUserInventoryURI(folder.Owner) + "/" + folder.Owner.ToString();
string uri = GetUserInventoryURI(folder.Owner) + "/" + folder.Owner.ToString();
return m_HGService.MoveFolder(uri, folder, sessionID);
}
}
@ -252,7 +256,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Inventory
else
{
UUID sessionID = GetSessionID(folder.Owner);
string uri = "http://" + GetUserInventoryURI(folder.Owner) + "/" + folder.Owner.ToString();
string uri = GetUserInventoryURI(folder.Owner) + "/" + folder.Owner.ToString();
return m_HGService.PurgeFolder(uri, folder, sessionID);
}
}
@ -267,7 +271,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Inventory
else
{
UUID sessionID = GetSessionID(item.Owner);
string uri = "http://" + GetUserInventoryURI(item.Owner) + "/" + item.Owner.ToString();
string uri = GetUserInventoryURI(item.Owner) + "/" + item.Owner.ToString();
return m_HGService.AddItem(uri, item, sessionID);
}
}
@ -282,7 +286,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Inventory
else
{
UUID sessionID = GetSessionID(item.Owner);
string uri = "http://" + GetUserInventoryURI(item.Owner) + "/" + item.Owner.ToString();
string uri = GetUserInventoryURI(item.Owner) + "/" + item.Owner.ToString();
return m_HGService.UpdateItem(uri, item, sessionID);
}
}
@ -297,7 +301,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Inventory
else
{
UUID sessionID = GetSessionID(item.Owner);
string uri = "http://" + GetUserInventoryURI(item.Owner) + "/" + item.Owner.ToString();
string uri = GetUserInventoryURI(item.Owner) + "/" + item.Owner.ToString();
return m_HGService.DeleteItem(uri, item, sessionID);
}
}
@ -312,7 +316,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Inventory
else
{
UUID sessionID = GetSessionID(item.Owner);
string uri = "http://" + GetUserInventoryURI(item.Owner) + "/" + item.Owner.ToString();
string uri = GetUserInventoryURI(item.Owner) + "/" + item.Owner.ToString();
return m_HGService.QueryItem(uri, item, sessionID);
}
}
@ -327,7 +331,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Inventory
else
{
UUID sessionID = GetSessionID(folder.Owner);
string uri = "http://" + GetUserInventoryURI(folder.Owner) + "/" + folder.Owner.ToString();
string uri = GetUserInventoryURI(folder.Owner) + "/" + folder.Owner.ToString();
return m_HGService.QueryFolder(uri, folder, sessionID);
}
}

View File

@ -27,6 +27,7 @@
using log4net;
using Nini.Config;
using System;
using System.Collections.Generic;
using System.Reflection;
@ -38,10 +39,10 @@ using OpenSim.Region.Framework.Scenes;
using OpenSim.Services.Interfaces;
using OpenMetaverse;
namespace OpenSim.Region.CoreModules.ServiceConnectors.Inventory
{
public class LocalInventoryServicesConnector :
ISharedRegionModule, IInventoryService
public class LocalInventoryServicesConnector : ISharedRegionModule, IInventoryService
{
private static readonly ILog m_log =
LogManager.GetLogger(
@ -50,6 +51,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Inventory
private IInventoryService m_InventoryService;
private bool m_Enabled = false;
private bool m_Initialized = false;
public string Name
{
@ -64,15 +66,14 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Inventory
string name = moduleConfig.GetString("InventoryServices", "");
if (name == Name)
{
IConfig assetConfig = source.Configs["InventoryService"];
if (assetConfig == null)
IConfig inventoryConfig = source.Configs["InventoryService"];
if (inventoryConfig == null)
{
m_log.Error("[INVENTORY CONNECTOR]: InventoryService missing from OpenSim.ini");
return;
}
string serviceDll = assetConfig.GetString("LocalServiceModule",
String.Empty);
string serviceDll = inventoryConfig.GetString("LocalServiceModule", String.Empty);
if (serviceDll == String.Empty)
{
@ -81,14 +82,15 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Inventory
}
Object[] args = new Object[] { source };
m_InventoryService =
ServerUtils.LoadPlugin<IInventoryService>(serviceDll,
args);
m_log.DebugFormat("[INVENTORY CONNECTOR]: Service dll = {0}", serviceDll);
m_InventoryService = ServerUtils.LoadPlugin<IInventoryService>(serviceDll, args);
if (m_InventoryService == null)
{
m_log.Error("[INVENTORY CONNECTOR]: Can't load asset service");
return;
m_log.Error("[INVENTORY CONNECTOR]: Can't load inventory service");
//return;
throw new Exception("Unable to proceed. Please make sure your ini files in config-include are updated according to .example's");
}
//List<IInventoryDataPlugin> plugins
@ -121,7 +123,16 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Inventory
if (!m_Enabled)
return;
if (!m_Initialized)
{
// ugh!
scene.CommsManager.UserProfileCacheService.SetInventoryService(this);
scene.CommsManager.UserService.SetInventoryService(this);
m_Initialized = true;
}
scene.RegisterModuleInterface<IInventoryService>(this);
}
public void RemoveRegion(Scene scene)

View File

@ -40,12 +40,10 @@ using OpenMetaverse;
namespace OpenSim.Region.CoreModules.ServiceConnectors.Inventory
{
public class RemoteInventoryServicesConnector :
ISharedRegionModule, IInventoryService
public class RemoteInventoryServicesConnector : ISharedRegionModule, IInventoryService
{
private static readonly ILog m_log =
LogManager.GetLogger(
MethodBase.GetCurrentMethod().DeclaringType);
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private bool m_Enabled = false;
private bool m_Initialized = false;
@ -57,6 +55,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Inventory
get { return "RemoteInventoryServicesConnector"; }
}
public RemoteInventoryServicesConnector()
{
}
public RemoteInventoryServicesConnector(IConfigSource source)
{
Init(source);
@ -100,7 +102,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Inventory
return;
if (!m_Initialized)
{
m_Scene = scene;
// ugh!
scene.CommsManager.UserProfileCacheService.SetInventoryService(this);
scene.CommsManager.UserService.SetInventoryService(this);
m_Initialized = true;
}
scene.RegisterModuleInterface<IInventoryService>(this);
}

View File

@ -146,6 +146,26 @@ namespace OpenSim.Region.Framework.Scenes
}
}
protected IInventoryService m_InventoryService = null;
public IInventoryService InventoryService
{
get
{
if (m_InventoryService == null)
{
m_InventoryService = RequestModuleInterface<IInventoryService>();
if (m_InventoryService == null)
{
throw new Exception("No IInventoryService available.");
}
}
return m_InventoryService;
}
}
protected IXMLRPC m_xmlrpcModule;
protected IWorldComm m_worldCommModule;
protected IAvatarFactory m_AvatarFactory;

View File

@ -128,13 +128,20 @@ namespace OpenSim.Server.Base
pluginType.ToString() !=
pluginType.Namespace + "." + className)
continue;
Type typeInterface =
pluginType.GetInterface(interfaceName, true);
if (typeInterface != null)
{
T plug = (T)Activator.CreateInstance(pluginType,
args);
T plug = null;
try
{
plug = (T)Activator.CreateInstance(pluginType,
args);
}
catch (Exception e)
{
m_log.ErrorFormat("Error loading plugin from {0}, exception {1}", dllName, e.InnerException);
}
return plug;
}

View File

@ -42,19 +42,35 @@ namespace OpenSim.Services.AssetService
public AssetServiceBase(IConfigSource config) : base(config)
{
string dllName = String.Empty;
string connString = String.Empty;
//
// Try reading the [DatabaseService] section first, if it exists
//
IConfig dbConfig = config.Configs["DatabaseService"];
if (dbConfig != null)
{
dllName = dbConfig.GetString("StorageProvider", String.Empty);
connString = dbConfig.GetString("ConnectionString", String.Empty);
}
//
// Try reading the more specific [AssetService] section, if it exists
//
IConfig assetConfig = config.Configs["AssetService"];
if (assetConfig == null)
throw new Exception("No AssetService configuration");
if (assetConfig != null)
{
dllName = assetConfig.GetString("StorageProvider", dllName);
connString = assetConfig.GetString("ConnectionString", connString);
}
string dllName = assetConfig.GetString("StorageProvider",
String.Empty);
if (dllName == String.Empty)
//
// We tried, but this doesn't exist. We can't proceed.
//
if (dllName.Equals(String.Empty))
throw new Exception("No StorageProvider configured");
string connString = assetConfig.GetString("ConnectionString",
String.Empty);
m_Database = LoadPlugin<IAssetDataPlugin>(dllName);
if (m_Database == null)
throw new Exception("Could not find a storage interface in the given module");

View File

@ -67,7 +67,7 @@ namespace OpenSim.Services.Connectors
IConfig inventoryConfig = source.Configs["InventoryService"];
if (inventoryConfig == null)
{
m_log.Error("[INVENTORY CONNECTOR]: InventoryService missing from OpanSim.ini");
m_log.Error("[INVENTORY CONNECTOR]: InventoryService missing from OpenSim.ini");
throw new Exception("Inventory connector init error");
}
@ -77,7 +77,7 @@ namespace OpenSim.Services.Connectors
if (serviceURI == String.Empty)
{
m_log.Error("[INVENTORY CONNECTOR]: No Server URI named in section InventoryService");
throw new Exception("Inventory connector init error");
throw new Exception("Unable to proceed. Please make sure your ini files in config-include are updated according to .example's");
}
m_ServerURI = serviceURI.TrimEnd('/');
}

View File

@ -0,0 +1,170 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSimulator Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using log4net;
using System;
using System.Collections.Generic;
using System.IO;
using System.Reflection;
using Nini.Config;
using OpenSim.Framework;
using OpenSim.Framework.Servers.HttpServer;
using OpenSim.Services.Interfaces;
using OpenMetaverse;
namespace OpenSim.Services.Connectors
{
/// <summary>
/// This connector is temporary. It's used by the user server, before that server is refactored.
/// </summary>
public class QuickAndDirtyInventoryServiceConnector : IInventoryService
{
private static readonly ILog m_log =
LogManager.GetLogger(
MethodBase.GetCurrentMethod().DeclaringType);
private string m_ServerURI = String.Empty;
private Dictionary<UUID, InventoryReceiptCallback> m_RequestingInventory = new Dictionary<UUID, InventoryReceiptCallback>();
public QuickAndDirtyInventoryServiceConnector()
{
}
public QuickAndDirtyInventoryServiceConnector(string serverURI)
{
m_ServerURI = serverURI.TrimEnd('/');
}
/// <summary>
/// <see cref="OpenSim.Framework.Communications.IInterServiceInventoryServices"/>
/// </summary>
/// <param name="userId"></param>
/// <returns></returns>
public bool CreateUserInventory(UUID userId)
{
return SynchronousRestObjectPoster.BeginPostObject<Guid, bool>(
"POST", m_ServerURI + "CreateInventory/", userId.Guid);
}
/// <summary>
/// <see cref="OpenSim.Framework.Communications.IInterServiceInventoryServices"/>
/// </summary>
/// <param name="userId"></param>
/// <returns></returns>
public List<InventoryFolderBase> GetInventorySkeleton(UUID userId)
{
return SynchronousRestObjectPoster.BeginPostObject<Guid, List<InventoryFolderBase>>(
"POST", m_ServerURI + "RootFolders/", userId.Guid);
}
/// <summary>
/// Returns a list of all the active gestures in a user's inventory.
/// </summary>
/// <param name="userId">
/// The <see cref="UUID"/> of the user
/// </param>
/// <returns>
/// A flat list of the gesture items.
/// </returns>
public List<InventoryItemBase> GetActiveGestures(UUID userId)
{
return SynchronousRestObjectPoster.BeginPostObject<Guid, List<InventoryItemBase>>(
"POST", m_ServerURI + "ActiveGestures/", userId.Guid);
}
public InventoryCollection GetUserInventory(UUID userID)
{
return null;
}
public void GetUserInventory(UUID userID, InventoryReceiptCallback callback)
{
}
public List<InventoryItemBase> GetFolderItems(UUID folderID)
{
return null;
}
public bool AddFolder(InventoryFolderBase folder)
{
return false;
}
public bool UpdateFolder(InventoryFolderBase folder)
{
return false;
}
public bool MoveFolder(InventoryFolderBase folder)
{
return false;
}
public bool PurgeFolder(InventoryFolderBase folder)
{
return false;
}
public bool AddItem(InventoryItemBase item)
{
return false;
}
public bool UpdateItem(InventoryItemBase item)
{
return false;
}
public bool DeleteItem(InventoryItemBase item)
{
return false;
}
public InventoryItemBase QueryItem(InventoryItemBase item)
{
return null;
}
public InventoryFolderBase QueryFolder(InventoryFolderBase folder)
{
return null;
}
public bool HasInventoryForUser(UUID userID)
{
return false;
}
public InventoryFolderBase RequestRootFolder(UUID userID)
{
return null;
}
}
}

View File

@ -109,6 +109,7 @@ namespace OpenSim.Services.InventoryService
public void GetUserInventory(string id, UUID sessionID, InventoryReceiptCallback callback)
{
m_log.Debug("[HGInventory]: GetUserInventory " + id);
string url = string.Empty;
string userID = string.Empty;
@ -120,57 +121,120 @@ namespace OpenSim.Services.InventoryService
}
public bool AddFolder(string userID, InventoryFolderBase folder, UUID sessionID)
public bool AddFolder(string id, InventoryFolderBase folder, UUID sessionID)
{
// TODO
string url = string.Empty;
string userID = string.Empty;
if (StringToUrlAndUserID(id, out url, out userID))
{
ISessionAuthInventoryService connector = GetConnector(url);
return connector.AddFolder(userID, folder, sessionID);
}
return false;
}
public bool UpdateFolder(string userID, InventoryFolderBase folder, UUID sessionID)
public bool UpdateFolder(string id, InventoryFolderBase folder, UUID sessionID)
{
// TODO
string url = string.Empty;
string userID = string.Empty;
if (StringToUrlAndUserID(id, out url, out userID))
{
ISessionAuthInventoryService connector = GetConnector(url);
return connector.UpdateFolder(userID, folder, sessionID);
}
return false;
}
public bool MoveFolder(string userID, InventoryFolderBase folder, UUID sessionID)
public bool MoveFolder(string id, InventoryFolderBase folder, UUID sessionID)
{
// TODO
string url = string.Empty;
string userID = string.Empty;
if (StringToUrlAndUserID(id, out url, out userID))
{
ISessionAuthInventoryService connector = GetConnector(url);
return connector.MoveFolder(userID, folder, sessionID);
}
return false;
}
public bool PurgeFolder(string userID, InventoryFolderBase folder, UUID sessionID)
public bool PurgeFolder(string id, InventoryFolderBase folder, UUID sessionID)
{
// TODO
string url = string.Empty;
string userID = string.Empty;
if (StringToUrlAndUserID(id, out url, out userID))
{
ISessionAuthInventoryService connector = GetConnector(url);
return connector.PurgeFolder(userID, folder, sessionID);
}
return false;
}
public bool AddItem(string userID, InventoryItemBase item, UUID sessionID)
public bool AddItem(string id, InventoryItemBase item, UUID sessionID)
{
// TODO
string url = string.Empty;
string userID = string.Empty;
if (StringToUrlAndUserID(id, out url, out userID))
{
ISessionAuthInventoryService connector = GetConnector(url);
return connector.AddItem(userID, item, sessionID);
}
return false;
}
public bool UpdateItem(string userID, InventoryItemBase item, UUID sessionID)
public bool UpdateItem(string id, InventoryItemBase item, UUID sessionID)
{
// TODO
string url = string.Empty;
string userID = string.Empty;
if (StringToUrlAndUserID(id, out url, out userID))
{
ISessionAuthInventoryService connector = GetConnector(url);
return connector.UpdateItem(userID, item, sessionID);
}
return false;
}
public bool DeleteItem(string userID, InventoryItemBase item, UUID sessionID)
public bool DeleteItem(string id, InventoryItemBase item, UUID sessionID)
{
// TODO
string url = string.Empty;
string userID = string.Empty;
if (StringToUrlAndUserID(id, out url, out userID))
{
ISessionAuthInventoryService connector = GetConnector(url);
return connector.UpdateItem(userID, item, sessionID);
}
return false;
}
public InventoryItemBase QueryItem(string userID, InventoryItemBase item, UUID sessionID)
public InventoryItemBase QueryItem(string id, InventoryItemBase item, UUID sessionID)
{
// TODO
string url = string.Empty;
string userID = string.Empty;
if (StringToUrlAndUserID(id, out url, out userID))
{
ISessionAuthInventoryService connector = GetConnector(url);
return connector.QueryItem(userID, item, sessionID);
}
return null;
}
public InventoryFolderBase QueryFolder(string userID, InventoryFolderBase folder, UUID sessionID)
public InventoryFolderBase QueryFolder(string id, InventoryFolderBase folder, UUID sessionID)
{
// TODO
string url = string.Empty;
string userID = string.Empty;
if (StringToUrlAndUserID(id, out url, out userID))
{
ISessionAuthInventoryService connector = GetConnector(url);
return connector.QueryFolder(userID, folder, sessionID);
}
return null;
}

View File

@ -46,6 +46,7 @@ namespace OpenSim.Services.InventoryService
public InventoryService(IConfigSource config) : base(config)
{
m_log.Debug("[INVENTORY SERVICE]: Initialized.");
}
#region IInventoryServices methods
@ -57,7 +58,7 @@ namespace OpenSim.Services.InventoryService
public List<InventoryFolderBase> GetInventorySkeleton(UUID userId)
{
// m_log.DebugFormat("[AGENT INVENTORY]: Getting inventory skeleton for {0}", userId);
m_log.DebugFormat("[INVENTORY SERVICE]: Getting inventory skeleton for {0}", userId);
InventoryFolderBase rootFolder = RequestRootFolder(userId);
@ -79,7 +80,7 @@ namespace OpenSim.Services.InventoryService
// foreach (InventoryFolderBase folder in userFolders)
// {
// m_log.DebugFormat("[AGENT INVENTORY]: Got folder {0} {1}", folder.name, folder.folderID);
// m_log.DebugFormat("[INVENTORY SERVICE]: Got folder {0} {1}", folder.name, folder.folderID);
// }
return userFolders;
@ -113,7 +114,7 @@ namespace OpenSim.Services.InventoryService
if (null != existingRootFolder)
{
m_log.WarnFormat(
"[AGENT INVENTORY]: Did not create a new inventory for user {0} since they already have "
"[INVENTORY SERVICE]: Did not create a new inventory for user {0} since they already have "
+ "a root inventory folder with id {1}",
user, existingRootFolder.ID);
}
@ -138,7 +139,7 @@ namespace OpenSim.Services.InventoryService
/// <returns>The user's inventory. If an inventory cannot be found then an empty collection is returned.</returns>
public InventoryCollection GetUserInventory(UUID userID)
{
m_log.InfoFormat("[LOCAL INVENTORY SERVICE]: Processing request for inventory of {0}", userID);
m_log.InfoFormat("[INVENTORY SERVICE]: Processing request for inventory of {0}", userID);
// Uncomment me to simulate a slow responding inventory server
//Thread.Sleep(16000);
@ -149,7 +150,7 @@ namespace OpenSim.Services.InventoryService
if (null == allFolders)
{
m_log.WarnFormat("[LOCAL INVENTORY SERVICE]: No inventory found for user {0}", userID);
m_log.WarnFormat("[INVENTORY SERVICE]: No inventory found for user {0}", userID);
return invCollection;
}
@ -172,16 +173,16 @@ namespace OpenSim.Services.InventoryService
// foreach (InventoryFolderBase folder in invCollection.Folders)
// {
// m_log.DebugFormat("[GRID AGENT INVENTORY]: Sending back folder {0} {1}", folder.Name, folder.ID);
// m_log.DebugFormat("[GRID INVENTORY SERVICE]: Sending back folder {0} {1}", folder.Name, folder.ID);
// }
//
// foreach (InventoryItemBase item in invCollection.Items)
// {
// m_log.DebugFormat("[GRID AGENT INVENTORY]: Sending back item {0} {1}, folder {2}", item.Name, item.ID, item.Folder);
// m_log.DebugFormat("[GRID INVENTORY SERVICE]: Sending back item {0} {1}, folder {2}", item.Name, item.ID, item.Folder);
// }
m_log.InfoFormat(
"[LOCAL INVENTORY SERVICE]: Sending back inventory response to user {0} containing {1} folders and {2} items",
"[INVENTORY SERVICE]: Sending back inventory response to user {0} containing {1} folders and {2} items",
invCollection.UserID, invCollection.Folders.Count, invCollection.Items.Count);
return invCollection;
@ -194,7 +195,7 @@ namespace OpenSim.Services.InventoryService
/// <param name="callback"></param>
public void GetUserInventory(UUID userID, InventoryReceiptCallback callback)
{
m_log.InfoFormat("[LOCAL INVENTORY SERVICE]: Requesting inventory for user {0}", userID);
m_log.InfoFormat("[INVENTORY SERVICE]: Requesting inventory for user {0}", userID);
List<InventoryFolderImpl> folders = new List<InventoryFolderImpl>();
List<InventoryItemBase> items = new List<InventoryItemBase>();
@ -231,15 +232,15 @@ namespace OpenSim.Services.InventoryService
}
m_log.InfoFormat(
"[LOCAL INVENTORY SERVICE]: Received inventory response for user {0} containing {1} folders and {2} items",
"[INVENTORY SERVICE]: Received inventory response for user {0} containing {1} folders and {2} items",
userID, folders.Count, items.Count);
}
else
{
m_log.WarnFormat("[LOCAL INVENTORY SERVICE]: User {0} inventory not available", userID);
m_log.WarnFormat("[INVENTORY SERVICE]: User {0} inventory not available", userID);
}
callback(folders, items);
callback.BeginInvoke(folders, items, null, null);
}
public List<InventoryItemBase> GetActiveGestures(UUID userId)
@ -287,7 +288,7 @@ namespace OpenSim.Services.InventoryService
public virtual bool AddFolder(InventoryFolderBase folder)
{
m_log.DebugFormat(
"[AGENT INVENTORY]: Adding folder {0} {1} to folder {2}", folder.Name, folder.ID, folder.ParentID);
"[INVENTORY SERVICE]: Adding folder {0} {1} to folder {2}", folder.Name, folder.ID, folder.ParentID);
foreach (IInventoryDataPlugin plugin in m_plugins)
{
@ -302,7 +303,7 @@ namespace OpenSim.Services.InventoryService
public virtual bool UpdateFolder(InventoryFolderBase folder)
{
m_log.DebugFormat(
"[AGENT INVENTORY]: Updating folder {0} {1} to folder {2}", folder.Name, folder.ID, folder.ParentID);
"[INVENTORY SERVICE]: Updating folder {0} {1} to folder {2}", folder.Name, folder.ID, folder.ParentID);
foreach (IInventoryDataPlugin plugin in m_plugins)
{
@ -317,7 +318,7 @@ namespace OpenSim.Services.InventoryService
public virtual bool MoveFolder(InventoryFolderBase folder)
{
m_log.DebugFormat(
"[AGENT INVENTORY]: Moving folder {0} {1} to folder {2}", folder.Name, folder.ID, folder.ParentID);
"[INVENTORY SERVICE]: Moving folder {0} {1} to folder {2}", folder.Name, folder.ID, folder.ParentID);
foreach (IInventoryDataPlugin plugin in m_plugins)
{
@ -332,7 +333,7 @@ namespace OpenSim.Services.InventoryService
public virtual bool AddItem(InventoryItemBase item)
{
m_log.DebugFormat(
"[AGENT INVENTORY]: Adding item {0} {1} to folder {2}", item.Name, item.ID, item.Folder);
"[INVENTORY SERVICE]: Adding item {0} {1} to folder {2}", item.Name, item.ID, item.Folder);
foreach (IInventoryDataPlugin plugin in m_plugins)
{
@ -347,7 +348,7 @@ namespace OpenSim.Services.InventoryService
public virtual bool UpdateItem(InventoryItemBase item)
{
m_log.InfoFormat(
"[AGENT INVENTORY]: Updating item {0} {1} in folder {2}", item.Name, item.ID, item.Folder);
"[INVENTORY SERVICE]: Updating item {0} {1} in folder {2}", item.Name, item.ID, item.Folder);
foreach (IInventoryDataPlugin plugin in m_plugins)
{
@ -362,7 +363,7 @@ namespace OpenSim.Services.InventoryService
public virtual bool DeleteItem(InventoryItemBase item)
{
m_log.InfoFormat(
"[AGENT INVENTORY]: Deleting item {0} {1} from folder {2}", item.Name, item.ID, item.Folder);
"[INVENTORY SERVICE]: Deleting item {0} {1} from folder {2}", item.Name, item.ID, item.Folder);
foreach (IInventoryDataPlugin plugin in m_plugins)
{
@ -407,13 +408,13 @@ namespace OpenSim.Services.InventoryService
public virtual bool PurgeFolder(InventoryFolderBase folder)
{
m_log.DebugFormat(
"[AGENT INVENTORY]: Purging folder {0} {1} of its contents", folder.Name, folder.ID);
"[INVENTORY SERVICE]: Purging folder {0} {1} of its contents", folder.Name, folder.ID);
List<InventoryFolderBase> subFolders = RequestSubFolders(folder.ID);
foreach (InventoryFolderBase subFolder in subFolders)
{
// m_log.DebugFormat("[AGENT INVENTORY]: Deleting folder {0} {1}", subFolder.Name, subFolder.ID);
// m_log.DebugFormat("[INVENTORY SERVICE]: Deleting folder {0} {1}", subFolder.Name, subFolder.ID);
foreach (IInventoryDataPlugin plugin in m_plugins)
{

View File

@ -44,19 +44,37 @@ namespace OpenSim.Services.InventoryService
public InventoryServiceBase(IConfigSource config) : base(config)
{
IConfig assetConfig = config.Configs["InventoryService"];
if (assetConfig == null)
string dllName = String.Empty;
string connString = String.Empty;
//
// Try reading the [DatabaseService] section first, if it exists
//
IConfig dbConfig = config.Configs["DatabaseService"];
if (dbConfig != null)
{
dllName = dbConfig.GetString("StorageProvider", String.Empty);
connString = dbConfig.GetString("ConnectionString", String.Empty);
}
else
Console.WriteLine("------ dbConfig = null!");
//
// Try reading the more specific [InventoryService] section, if it exists
//
IConfig inventoryConfig = config.Configs["InventoryService"];
if (inventoryConfig != null)
{
dllName = inventoryConfig.GetString("StorageProvider", dllName);
connString = inventoryConfig.GetString("ConnectionString", connString);
}
//
// We tried, but this doesn't exist. We can't proceed.
//
if (dllName.Equals(String.Empty))
throw new Exception("No InventoryService configuration");
string dllName = assetConfig.GetString("StorageProvider",
String.Empty);
if (dllName == String.Empty)
throw new Exception("No StorageProvider configured");
string connString = assetConfig.GetString("ConnectionString",
String.Empty);
m_Database = LoadPlugin<IInventoryDataPlugin>(dllName);
if (m_Database == null)
throw new Exception("Could not find a storage interface in the given module");

View File

@ -0,0 +1,102 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSimulator Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.Reflection;
using System.Collections.Generic;
using log4net;
using Nini.Config;
using OpenSim.Framework;
using OpenSim.Framework.Servers.HttpServer;
using OpenSim.Region.Framework.Scenes;
using OpenSim.Region.Framework.Interfaces;
using OpenSim.Server.Base;
using OpenSim.Server.Handlers.Base;
namespace OpenSim.SimulatorServices
{
public class RegionInventoryService : ISharedRegionModule
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private static bool enabled = false;
private IConfigSource m_Config;
bool m_Registered = false;
#region IRegionModule interface
public void Initialise(IConfigSource config)
{
// This module is only on for standalones in hypergrid mode
enabled = (!config.Configs["Startup"].GetBoolean("gridmode", true)) &&
config.Configs["Startup"].GetBoolean("hypergrid", true);
m_log.DebugFormat("[RegionInventoryService]: enabled? {0}", enabled);
m_Config = config;
}
public void PostInitialise()
{
}
public void Close()
{
}
public string Name
{
get { return "RegionInventoryService"; }
}
public void AddRegion(Scene scene)
{
if (!enabled)
return;
if (!m_Registered)
{
m_Registered = true;
m_log.Info("[RegionInventoryService]: Starting...");
Object[] args = new Object[] { m_Config, scene.CommsManager.HttpServer };
ServerUtils.LoadPlugin<IServiceConnector>("OpenSim.Server.Handlers.dll:InventoryServiceInConnector", args);
}
}
public void RemoveRegion(Scene scene)
{
}
public void RegionLoaded(Scene scene)
{
}
#endregion
}
}

View File

@ -9,6 +9,7 @@
<Extension path = "/OpenSim/RegionModules">
<RegionModule id="RegionAssetService" type="OpenSim.SimulatorServices.RegionAssetService" />
<RegionModule id="RegionInventoryService" type="OpenSim.SimulatorServices.RegionInventoryService" />
</Extension>
</Addin>

View File

@ -0,0 +1,13 @@
[AssetCache]
;;
;; Options for CenmoeAssetCache
;;
; 256 MB (default: 134217728)
MaxSize = 268435456
; How many assets it is possible to store cache (default: 4096)
MaxCount = 16384
; Expiration time - 1 hour (default: 30 minutes)
ExpirationTime = 60

View File

@ -0,0 +1,39 @@
[AssetCache]
;;
;; Options for FlotsamAssetCache
;;
; cache directory can be shared by multiple instances
CacheDirectory = ./assetcache
; Other examples:
;CacheDirectory = /directory/writable/by/OpenSim/instance
; Log level
; 0 - (Error) Errors only
; 1 - (Info) Hit Rate Stats + Level 0
; 2 - (Debug) Cache Activity (Reads/Writes) + Level 1
;
LogLevel = 0
; How often should hit rates be displayed (given in AssetRequests)
; 0 to disable
HitRateDisplay = 100
; Set to false for disk cache only.
MemoryCacheEnabled = true
; How long {in hours} to keep assets cached in memory, .5 == 30 minutes
MemoryCacheTimeout = 2
; How long {in hours} to keep assets cached on disk, .5 == 30 minutes
; Specify 0 if you do not want your disk cache to expire
FileCacheTimeout = 0
; How often {in hours} should the disk be checked for expired filed
; Specify 0 to disable expiration checking
FileCleanupTimer = .166 ;roughly every 10 minutes
; If WAIT_ON_INPROGRESS_REQUESTS has been defined then this specifies how
; long (in miliseconds) to block a request thread while trying to complete
; an existing write to disk.
; WaitOnInprogressTimeout = 3000

View File

@ -1,7 +1,13 @@
;;
;; Please don't change this file.
;; All optional settings are in GridCommon.ini.example,
;; which you can copy and change.
;;
[Includes]
Include-Common = "config-include/GridCommon.ini"
Include-Stable = "config-include/StableSettings.ini"
[Modules]
AssetServices = "RemoteAssetServicesConnector"
InventoryServices = "RemoteInventoryServicesConnector"

View File

@ -1,43 +1,3 @@
[Modules]
;AssetCaching = "CoreAssetCache"
;AssetCaching = "GlynnTuckerAssetCache"
;AssetCaching = "CenomeMemoryAssetCache"
AssetCaching = "FlotsamAssetCache"
[AssetCache]
; cache directory can be shared by multiple instances
CacheDirectory = /directory/writable/by/OpenSim/instance
; Log level
; 0 - (Error) Errors only
; 1 - (Info) Hit Rate Stats + Level 0
; 2 - (Debug) Cache Activity (Reads/Writes) + Level 1
;
LogLevel = 0
; How often should hit rates be displayed (given in AssetRequests)
; 0 to disable
HitRateDisplay = 100
; Set to false for disk cache only.
MemoryCacheEnabled = true
; How long {in hours} to keep assets cached in memory, .5 == 30 minutes
MemoryCacheTimeout = 2
; How long {in hours} to keep assets cached on disk, .5 == 30 minutes
; Specify 0 if you do not want your disk cache to expire
FileCacheTimeout = 0
; How often {in hours} should the disk be checked for expired filed
; Specify 0 to disable expiration checking
FileCleanupTimer = .166 ;roughly every 10 minutes
; If WAIT_ON_INPROGRESS_REQUESTS has been defined then this specifies how
; long (in miliseconds) to block a request thread while trying to complete
; an existing write to disk.
; WaitOnInprogressTimeout = 3000
[AssetService]
DefaultAssetLoader = "OpenSim.Framework.AssetLoader.Filesystem.dll"
@ -48,3 +8,21 @@
;
AssetServerURI = "http://myassetserver.com:8003"
[InventoryService]
;
; change this to your grid-wide asset server
;
InventoryServerURI = "http://myassetserver.com:8004"
[Modules]
;; Choose 0 or 1 cache modules, and the corresponding config file, if it exists.
;; Copy the config .example file into your own .ini file and change configs there
AssetCaching = "FlotsamAssetCache"
Include-FlotsamCache = "config-include/FlotsamCache.ini"
;AssetCaching = "CenomeMemoryAssetCache"
;Include-CenomeCache = "config-include/CenomeCache.ini"
;AssetCaching = "GlynnTuckerAssetCache"

View File

@ -1,11 +1,20 @@
;;
;; Please don't change this file.
;; All optional settings are in GridCommon.ini.example,
;; which you can copy and change.
;;
[Includes]
Include-Common = "config-include/GridCommon.ini"
Include-Stable = "config-include/StableSettings.ini"
[Modules]
AssetServices = "HGAssetBroker"
InventoryServices = "HGInventoryBroker"
[AssetService]
LocalGridAssetService = "OpenSim.Services.Connectors.dll:AssetServicesConnector"
HypergridAssetService = "OpenSim.Services.AssetService.dll:HGAssetService"
[InventoryService]
LocalGridInventoryService = "OpenSim.Services.Connectors.dll:InventoryServicesConnector"
HypergridInventoryService = "OpenSim.Services.InventoryService.dll:HGInventoryService"

View File

@ -1,28 +0,0 @@
[AssetCache]
;; ---- Optional configurations for CoreAssetCache
; Number of buckets for assets
;CacheBuckets = 32768
;; ---- endof CoreAssetCache ----------------
;; ---- Optional configurations for CenomeMemoryAssetCache
; Cache size 128 MB (default: 134217728)
; MaxSize = 134217728
; Maximal asset count
; MaxCount = 4096
; Asset's expiration time (minutes)
; ExpirationTime = 30
;; ---- endof CenomeMemoryAssetCache --------
;; ---- Optional configurations for FlotsamAssetCache
; Set to false for disk cache only.
MemoryCacheEnabled = true
; How long {in hours} to keep assets cached in memory, .5 == 30 minutes
MemoryCacheTimeout = 2
; How often {in hours} should the disk be checked for expired filed
; Specify 0 to disable expiration checking
FileCleanupTimer = .166 ;roughly every 10 minutes
;; ---- endof FlotsamAssetCache --------

View File

@ -1,11 +1,20 @@
;;
;; Please don't change this file.
;; All optional settings are in StandaloneCommon.ini.example,
;; which you can copy and change.
;;
[Includes]
Include-Common = "config-include/StandaloneCommon.ini"
Include-Stable = "config-include/StableSettings.ini"
[Modules]
AssetServices = "LocalAssetServicesConnector"
InventoryServices = "LocalInventoryServicesConnector"
[AssetService]
LocalServiceModule = "OpenSim.Services.AssetService.dll:AssetService"
[InventoryService]
LocalServiceModule = "OpenSim.Services.InventoryService.dll:InventoryService"

View File

@ -1,9 +1,4 @@
[Modules]
;AssetCaching = "CoreAssetCache"
;AssetCaching = "GlynnTuckerAssetCache"
AssetCaching = "CenomeMemoryAssetCache"
[AssetService]
[DatabaseService]
;
;### Choose the DB
;
@ -13,6 +8,20 @@
;StorageProvider = "OpenSim.Data.MySQL.dll"
;ConnectionString = "Data Source=localhost;Database=opensim;User ID=opensim;Password=***;"
[AssetService]
DefaultAssetLoader = "OpenSim.Framework.AssetLoader.Filesystem.dll"
AssetLoaderArgs = "assets/AssetSets.xml"
[Modules]
;; Choose 0 or 1 cache modules, and the corresponding config file, if it exists.
;; Copy the config .example file into your own .ini file and change configs there
;AssetCaching = "GlynnTuckerAssetCache"
;AssetCaching = "FlotsamAssetCache"
;Include-FlotsamCache = "config-include/FlotsamCache.ini"
AssetCaching = "CenomeMemoryAssetCache"
Include-CenomeCache = "config-include/CenomeCache.ini"

View File

@ -1,9 +1,15 @@
;;
;; Please don't change this file.
;; All optional settings are in StandaloneCommon.ini.example,
;; which you can copy and change.
;;
[Includes]
Include-Common = "config-include/StandaloneCommon.ini"
Include-Stable = "config-include/StableSettings.ini"
[Modules]
AssetServices = "HGAssetBroker"
InventoryServices = "HGInventoryBroker"
[AssetService]
@ -14,3 +20,10 @@
LocalGridAssetService = "OpenSim.Services.AssetService.dll:AssetService"
HypergridAssetService = "OpenSim.Services.AssetService.dll:HGAssetService"
[InventoryService]
; For the RegionInventoryService
LocalServiceModule = "OpenSim.Services.InventoryService.dll:InventoryService"
; For HGInventoryBroker
LocalGridInventoryService = "OpenSim.Services.InventoryService.dll:InventoryService"
HypergridInventoryService = "OpenSim.Services.InventoryService.dll:HGInventoryService"

View File

@ -3554,6 +3554,7 @@
<Reference name="OpenSim.Client.Linden"/>
<Reference name="OpenSim.Framework"/>
<Reference name="OpenSim.Framework.Communications"/>
<Reference name="OpenSim.Services.Interfaces"/>
<Reference name="OpenSim.Data"/>
<Reference name="OpenSim.Region.Communications.Local"/>
<Reference name="OpenSim.Tests.Common"/>