33 using System.Collections.Generic;
34 using System.Reflection;
35 using OpenSim.Framework;
36 using OpenSim.Framework.Monitoring;
38 using OpenSim.Server.Base;
39 using OpenSim.Region.Framework.Interfaces;
40 using OpenSim.Region.Framework.Scenes;
41 using OpenSim.Services.Interfaces;
44 namespace OpenSim.
Region.CoreModules.ServiceConnectorsOut.Inventory
46 [Extension(Path =
"/OpenSim/RegionModules", NodeName =
"RegionModule", Id =
"LocalInventoryServicesConnector")]
49 private static readonly ILog m_log =
51 MethodBase.GetCurrentMethod().DeclaringType);
65 if (m_UserManager == null)
73 private bool m_Enabled =
false;
75 public Type ReplaceableInterface
82 get {
return "LocalInventoryServicesConnector"; }
87 IConfig moduleConfig = source.Configs[
"Modules"];
88 if (moduleConfig != null)
90 string name = moduleConfig.GetString(
"InventoryServices",
"");
93 IConfig inventoryConfig = source.Configs[
"InventoryService"];
94 if (inventoryConfig == null)
96 m_log.Error(
"[LOCAL INVENTORY SERVICES CONNECTOR]: InventoryService missing from OpenSim.ini");
100 string serviceDll = inventoryConfig.GetString(
"LocalServiceModule", String.Empty);
102 if (serviceDll ==
String.Empty)
104 m_log.Error(
"[LOCAL INVENTORY SERVICES CONNECTOR]: No LocalServiceModule named in section InventoryService");
109 m_log.DebugFormat(
"[LOCAL INVENTORY SERVICES CONNECTOR]: Service dll = {0}", serviceDll);
111 m_InventoryService = ServerUtils.LoadPlugin<
IInventoryService>(serviceDll, args);
113 if (m_InventoryService == null)
115 m_log.Error(
"[LOCAL INVENTORY SERVICES CONNECTOR]: Can't load inventory service");
116 throw new Exception(
"Unable to proceed. Please make sure your ini files in config-include are updated according to .example's");
120 m_log.Info(
"[LOCAL INVENTORY SERVICES CONNECTOR]: Local inventory connector enabled");
156 #region IInventoryService
160 return m_InventoryService.CreateUserInventory(user);
165 return m_InventoryService.GetInventorySkeleton(userId);
170 return m_InventoryService.GetRootFolder(userID);
175 return m_InventoryService.GetFolderForType(userID, type);
182 if (UserManager != null)
185 List<InventoryItemBase> items =
new List<InventoryItemBase>(invCol.Items);
187 WorkManager.RunInThread(delegate
192 }, null, string.Format(
"GetFolderContent (user {0}, folder {1})", userID, folderID));
202 foreach (
UUID fid
in folderIDs)
204 invColl[i++] = GetFolderContent(principalID, fid);
213 return m_InventoryService.GetFolderItems(userID, folderID);
223 return m_InventoryService.AddFolder(folder);
233 return m_InventoryService.UpdateFolder(folder);
243 return m_InventoryService.MoveFolder(folder);
248 return m_InventoryService.DeleteFolders(ownerID, folderIDs);
258 return m_InventoryService.PurgeFolder(folder);
267 return m_InventoryService.AddItem(item);
277 return m_InventoryService.UpdateItem(item);
280 public bool MoveItems(UUID ownerID, List<InventoryItemBase> items)
282 return m_InventoryService.MoveItems(ownerID, items);
292 return m_InventoryService.DeleteItems(ownerID, itemIDs);
301 item = m_InventoryService.GetItem(item);
312 return m_InventoryService.GetMultipleItems(userID, itemIDs);
317 return m_InventoryService.GetFolder(folder);
327 return m_InventoryService.HasInventoryForUser(userID);
332 return m_InventoryService.GetActiveGestures(userId);
337 return m_InventoryService.GetAssetPermissions(userID, assetID);
339 #endregion IInventoryService
void RegionLoaded(Scene scene)
This will be called once for every scene loaded. In a shared module this will be multiple times in on...
bool AddFolder(InventoryFolderBase folder)
Add a new folder to the user's inventory
bool HasInventoryForUser(UUID userID)
Does the given user have an inventory structure?
InventoryCollection GetFolderContent(UUID userID, UUID folderID)
Gets everything (folders and items) inside a folder
void RemoveRegion(Scene scene)
This is called whenever a Scene is removed. For shared modules, this can happen several times...
List< InventoryItemBase > GetFolderItems(UUID userID, UUID folderID)
Gets the items inside a folder
void PostInitialise()
This is called exactly once after all the shared region-modules have been instanciated and IRegionMod...
InventoryFolderBase GetRootFolder(UUID userID)
Retrieve the root inventory folder for the given user.
InventoryItemBase[] GetMultipleItems(UUID userID, UUID[] itemIDs)
Get multiple items, given by their UUIDs
bool MoveFolder(InventoryFolderBase folder)
Move an inventory folder to a new location
InventoryFolderBase GetFolderForType(UUID userID, FolderType type)
Gets the user folder for the given folder-type
InventoryFolderBase GetFolder(InventoryFolderBase folder)
Get a folder, given by its UUID
bool UpdateFolder(InventoryFolderBase folder)
Update a folder in the user's inventory
int GetAssetPermissions(UUID userID, UUID assetID)
Get the union of permissions of all inventory items that hold the given assetID.
bool AddItem(InventoryItemBase item)
Add a new item to the user's inventory
InventoryItemBase GetItem(InventoryItemBase item)
Get an item, given by its UUID
bool UpdateItem(InventoryItemBase item)
Update an item in the user's inventory
List< InventoryFolderBase > GetInventorySkeleton(UUID userId)
Gets the skeleton of the inventory – folders only
Inventory Item - contains all the properties associated with an individual inventory piece...
string CreatorData
Extended creator information of the form <profile url>="">;<name>
void Initialise(IConfigSource source)
This is called to initialize the region module. For shared modules, this is called exactly once...
void AddRegion(Scene scene)
This is called whenever a Scene is added. For shared modules, this can happen several times...
bool DeleteFolders(UUID ownerID, List< UUID > folderIDs)
Delete an item from the user's inventory
bool DeleteItems(UUID ownerID, List< UUID > itemIDs)
Delete an item from the user's inventory
List< InventoryItemBase > GetActiveGestures(UUID userId)
Get the active gestures of the agent.
void Close()
This is the inverse to Initialise. After a Close(), this instance won't be usable anymore...
bool CreateUserInventory(UUID user)
Create the entire inventory for a given user
bool PurgeFolder(InventoryFolderBase folder)
Purge an inventory folder of all its items and subfolders.
This maintains the relationship between a UUID and a user name.
Used to serialize a whole inventory for transfer over the network.
virtual InventoryCollection[] GetMultipleFoldersContent(UUID principalID, UUID[] folderIDs)
Gets everything (folders and items) inside a folder
bool MoveItems(UUID ownerID, List< InventoryItemBase > items)