Merge branch 'master' of ssh://melanie@opensimulator.org/var/git/opensim

remotes/origin/0.6.7-post-fixes
Melanie 2009-08-22 20:18:56 +01:00
commit 1e4238af92
21 changed files with 154 additions and 91 deletions

View File

@ -532,6 +532,11 @@ namespace OpenSim.Framework.Communications.Tests
return false; return false;
} }
public bool DeleteFolders(UUID ownerID, List<UUID> ids)
{
return false;
}
public bool PurgeFolder(InventoryFolderBase folder) public bool PurgeFolder(InventoryFolderBase folder)
{ {
return false; return false;

View File

@ -260,7 +260,7 @@ namespace OpenSim.Framework
IClientAPI remoteClient, List<UUID> itemIDs); IClientAPI remoteClient, List<UUID> itemIDs);
public delegate void RemoveInventoryFolder( public delegate void RemoveInventoryFolder(
IClientAPI remoteClient, UUID folderID); IClientAPI remoteClient, List<UUID> folderIDs);
public delegate void RequestAsset(IClientAPI remoteClient, RequestAssetArgs transferRequest); public delegate void RequestAsset(IClientAPI remoteClient, RequestAssetArgs transferRequest);

View File

@ -28,7 +28,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
namespace OpenSim.Framework.Communications.Cache namespace OpenSim.Grid.InventoryServer
{ {
public class AuthedSessionCache public class AuthedSessionCache
{ {

View File

@ -30,8 +30,10 @@ using System.Reflection;
using log4net; using log4net;
using OpenMetaverse; using OpenMetaverse;
using OpenSim.Data; using OpenSim.Data;
using OpenSim.Framework;
using OpenSim.Framework.Communications;
namespace OpenSim.Framework.Communications namespace OpenSim.Grid.InventoryServer
{ {
/// <summary> /// <summary>
/// Abstract base class used by local and grid implementations of an inventory service. /// Abstract base class used by local and grid implementations of an inventory service.

View File

@ -7090,14 +7090,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if (OnRemoveInventoryFolder != null) if (OnRemoveInventoryFolder != null)
{ {
handlerRemoveInventoryFolder = null; handlerRemoveInventoryFolder = null;
List<UUID> uuids = new List<UUID>();
foreach (RemoveInventoryFolderPacket.FolderDataBlock datablock in removeFolder.FolderData) foreach (RemoveInventoryFolderPacket.FolderDataBlock datablock in removeFolder.FolderData)
{ {
uuids.Add(datablock.FolderID);
}
handlerRemoveInventoryFolder = OnRemoveInventoryFolder; handlerRemoveInventoryFolder = OnRemoveInventoryFolder;
if (handlerRemoveInventoryFolder != null) if (handlerRemoveInventoryFolder != null)
{ {
handlerRemoveInventoryFolder(this, datablock.FolderID); handlerRemoveInventoryFolder(this, uuids);
}
} }
} }
break; break;
@ -7114,14 +7115,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if (OnRemoveInventoryFolder != null) if (OnRemoveInventoryFolder != null)
{ {
handlerRemoveInventoryFolder = null; handlerRemoveInventoryFolder = null;
List<UUID> uuids = new List<UUID>();
foreach (RemoveInventoryObjectsPacket.FolderDataBlock datablock in removeObject.FolderData) foreach (RemoveInventoryObjectsPacket.FolderDataBlock datablock in removeObject.FolderData)
{ {
uuids.Add(datablock.FolderID);
}
handlerRemoveInventoryFolder = OnRemoveInventoryFolder; handlerRemoveInventoryFolder = OnRemoveInventoryFolder;
if (handlerRemoveInventoryFolder != null) if (handlerRemoveInventoryFolder != null)
{ {
handlerRemoveInventoryFolder(this, datablock.FolderID); handlerRemoveInventoryFolder(this, uuids);
}
} }
} }

View File

@ -138,6 +138,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
/// <returns>true if the folder was successfully moved</returns> /// <returns>true if the folder was successfully moved</returns>
public abstract bool MoveFolder(InventoryFolderBase folder); public abstract bool MoveFolder(InventoryFolderBase folder);
/// <summary>
/// Delete a list of inventory folders (from trash)
/// </summary>
public abstract bool DeleteFolders(UUID ownerID, List<UUID> folderIDs);
/// <summary> /// <summary>
/// Purge an inventory folder of all its items and subfolders. /// Purge an inventory folder of all its items and subfolders.
/// </summary> /// </summary>

View File

@ -330,6 +330,23 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
} }
} }
public override bool DeleteFolders(UUID ownerID, List<UUID> folderIDs)
{
if (folderIDs == null)
return false;
if (folderIDs.Count == 0)
return false;
if (IsLocalGridUser(ownerID))
return m_GridService.DeleteFolders(ownerID, folderIDs);
else
{
UUID sessionID = GetSessionID(ownerID);
string uri = GetUserInventoryURI(ownerID) + "/" + ownerID.ToString();
return m_HGService.DeleteFolders(uri, folderIDs, sessionID);
}
}
public override bool MoveFolder(InventoryFolderBase folder) public override bool MoveFolder(InventoryFolderBase folder)
{ {
if (folder == null) if (folder == null)

View File

@ -258,6 +258,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
return m_InventoryService.MoveFolder(folder); return m_InventoryService.MoveFolder(folder);
} }
public override bool DeleteFolders(UUID ownerID, List<UUID> folderIDs)
{
return m_InventoryService.DeleteFolders(ownerID, folderIDs);
}
/// <summary> /// <summary>
/// Purge an inventory folder of all its items and subfolders. /// Purge an inventory folder of all its items and subfolders.
/// </summary> /// </summary>

View File

@ -243,6 +243,18 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
return m_RemoteConnector.MoveFolder(folder.Owner.ToString(), folder, sessionID); return m_RemoteConnector.MoveFolder(folder.Owner.ToString(), folder, sessionID);
} }
public override bool DeleteFolders(UUID ownerID, List<UUID> folderIDs)
{
if (folderIDs == null)
return false;
if (folderIDs.Count == 0)
return false;
UUID sessionID = GetSessionID(ownerID);
return m_RemoteConnector.DeleteFolders(ownerID.ToString(), folderIDs, sessionID);
}
public override bool PurgeFolder(InventoryFolderBase folder) public override bool PurgeFolder(InventoryFolderBase folder)
{ {
if (folder == null) if (folder == null)

View File

@ -789,23 +789,15 @@ namespace OpenSim.Region.Framework.Scenes
} }
/// <summary> /// <summary>
/// Removes an inventory folder. Although there is a packet in the Linden protocol for this, it may be /// Removes an inventory folder. This packet is sent when the user
/// legacy and not currently used (purge folder is used to remove folders from trash instead). /// right-clicks a folder that's already in trash and chooses "purge"
/// </summary> /// </summary>
/// <param name="remoteClient"></param> /// <param name="remoteClient"></param>
/// <param name="folderID"></param> /// <param name="folderID"></param>
private void RemoveInventoryFolder(IClientAPI remoteClient, UUID folderID) private void RemoveInventoryFolder(IClientAPI remoteClient, List<UUID> folderIDs)
{ {
// Unclear is this handler is ever called by the Linden client, but it might m_log.DebugFormat("[SCENE INVENTORY]: RemoveInventoryFolders count {0}", folderIDs.Count);
InventoryService.DeleteFolders(remoteClient.AgentId, folderIDs);
InventoryFolderBase folder = new InventoryFolderBase(folderID);
folder.Owner = remoteClient.AgentId;
InventoryFolderBase trash = InventoryService.GetFolderForType(remoteClient.AgentId, AssetType.TrashFolder);
if (trash != null)
{
folder.ParentID = trash.ID;
InventoryService.MoveFolder(folder);
}
} }
private SceneObjectGroup GetGroupByPrim(uint localID) private SceneObjectGroup GetGroupByPrim(uint localID)

View File

@ -552,7 +552,7 @@ namespace OpenSim.Region.Framework.Scenes
public void HandleMoveInventoryFolder(IClientAPI remoteClient, UUID folderID, UUID parentID) public void HandleMoveInventoryFolder(IClientAPI remoteClient, UUID folderID, UUID parentID)
{ {
InventoryFolderBase folder = new InventoryFolderBase(folderID); InventoryFolderBase folder = new InventoryFolderBase(folderID, remoteClient.AgentId);
folder = InventoryService.GetFolder(folder); folder = InventoryService.GetFolder(folder);
if (folder != null) if (folder != null)
{ {

View File

@ -104,6 +104,10 @@ namespace OpenSim.Server.Handlers.Inventory
new RestDeserialiseSecureHandler<InventoryFolderBase, bool>( new RestDeserialiseSecureHandler<InventoryFolderBase, bool>(
"POST", "/PurgeFolder/", m_InventoryService.PurgeFolder, CheckAuthSession)); "POST", "/PurgeFolder/", m_InventoryService.PurgeFolder, CheckAuthSession));
m_httpServer.AddStreamHandler(
new RestDeserialiseSecureHandler<List<Guid>, bool>(
"POST", "/DeleteFolders/", DeleteFolders, CheckAuthSession));
m_httpServer.AddStreamHandler( m_httpServer.AddStreamHandler(
new RestDeserialiseSecureHandler<List<Guid>, bool>( new RestDeserialiseSecureHandler<List<Guid>, bool>(
"POST", "/DeleteItem/", DeleteItems, CheckAuthSession)); "POST", "/DeleteItem/", DeleteItems, CheckAuthSession));
@ -254,6 +258,15 @@ namespace OpenSim.Server.Handlers.Inventory
return m_InventoryService.GetAssetPermissions(item.Owner, item.AssetID); return m_InventoryService.GetAssetPermissions(item.Owner, item.AssetID);
} }
public bool DeleteFolders(List<Guid> items)
{
List<UUID> uuids = new List<UUID>();
foreach (Guid g in items)
uuids.Add(new UUID(g));
// oops we lost the user info here. Bad bad handlers
return m_InventoryService.DeleteFolders(UUID.Zero, uuids);
}
public bool DeleteItems(List<Guid> items) public bool DeleteItems(List<Guid> items)
{ {
List<UUID> uuids = new List<UUID>(); List<UUID> uuids = new List<UUID>();

View File

@ -201,6 +201,19 @@ namespace OpenSim.Services.Connectors.Inventory
return false; return false;
} }
public bool DeleteFolders(string id, List<UUID> folders, UUID sessionID)
{
string url = string.Empty;
string userID = string.Empty;
if (StringToUrlAndUserID(id, out url, out userID))
{
ISessionAuthInventoryService connector = GetConnector(url);
return connector.DeleteFolders(userID, folders, sessionID);
}
return false;
}
public bool PurgeFolder(string id, InventoryFolderBase folder, UUID sessionID) public bool PurgeFolder(string id, InventoryFolderBase folder, UUID sessionID)
{ {
string url = string.Empty; string url = string.Empty;

View File

@ -88,6 +88,11 @@ namespace OpenSim.Services.Connectors
/// <returns>true if the folder was successfully moved</returns> /// <returns>true if the folder was successfully moved</returns>
bool MoveFolder(string userID, InventoryFolderBase folder, UUID session_id); bool MoveFolder(string userID, InventoryFolderBase folder, UUID session_id);
/// <summary>
/// Delete a list of inventory folders (from trash)
/// </summary>
bool DeleteFolders(string userID, List<UUID> folders, UUID session_id);
/// <summary> /// <summary>
/// Purge an inventory folder of all its items and subfolders. /// Purge an inventory folder of all its items and subfolders.
/// </summary> /// </summary>

View File

@ -308,6 +308,25 @@ namespace OpenSim.Services.Connectors
return false; return false;
} }
public bool DeleteFolders(string userID, List<UUID> folderIDs, UUID sessionID)
{
try
{
List<Guid> guids = new List<Guid>();
foreach (UUID u in folderIDs)
guids.Add(u.Guid);
return SynchronousRestSessionObjectPoster<List<Guid>, bool>.BeginPostObject(
"POST", m_ServerURI + "/DeleteFolders/", guids, sessionID.ToString(), userID);
}
catch (Exception e)
{
m_log.ErrorFormat("[INVENTORY CONNECTOR]: Delete inventory folders operation failed, {0} {1}",
e.Source, e.Message);
}
return false;
}
public bool MoveFolder(string userID, InventoryFolderBase folder, UUID sessionID) public bool MoveFolder(string userID, InventoryFolderBase folder, UUID sessionID)
{ {
try try
@ -481,12 +500,12 @@ namespace OpenSim.Services.Connectors
return null; return null;
} }
public InventoryFolderBase QueryFolder(string userID, InventoryFolderBase item, UUID sessionID) public InventoryFolderBase QueryFolder(string userID, InventoryFolderBase folder, UUID sessionID)
{ {
try try
{ {
return SynchronousRestSessionObjectPoster<InventoryFolderBase, InventoryFolderBase>.BeginPostObject( return SynchronousRestSessionObjectPoster<InventoryFolderBase, InventoryFolderBase>.BeginPostObject(
"POST", m_ServerURI + "/QueryFolder/", item, sessionID.ToString(), item.Owner.ToString()); "POST", m_ServerURI + "/QueryFolder/", folder, sessionID.ToString(), userID);
} }
catch (Exception e) catch (Exception e)
{ {

View File

@ -136,6 +136,12 @@ namespace OpenSim.Services.Connectors
return false; return false;
} }
public bool DeleteFolders(UUID ownerID, List<UUID> folderIDs)
{
return false;
}
public bool PurgeFolder(InventoryFolderBase folder) public bool PurgeFolder(InventoryFolderBase folder)
{ {
return false; return false;

View File

@ -121,6 +121,14 @@ namespace OpenSim.Services.Interfaces
/// <returns>true if the folder was successfully moved</returns> /// <returns>true if the folder was successfully moved</returns>
bool MoveFolder(InventoryFolderBase folder); bool MoveFolder(InventoryFolderBase folder);
/// <summary>
/// Delete an item from the user's inventory
/// </summary>
/// <param name="item"></param>
/// <returns>true if the item was successfully deleted</returns>
//bool DeleteItem(InventoryItemBase item);
bool DeleteFolders(UUID userID, List<UUID> folderIDs);
/// <summary> /// <summary>
/// Purge an inventory folder of all its items and subfolders. /// Purge an inventory folder of all its items and subfolders.
/// </summary> /// </summary>

View File

@ -425,15 +425,27 @@ namespace OpenSim.Services.InventoryService
return null; return null;
} }
public virtual InventoryFolderBase GetFolder(InventoryFolderBase item) public virtual InventoryFolderBase GetFolder(InventoryFolderBase folder)
{ {
InventoryFolderBase result = m_Database.getInventoryFolder(item.ID); InventoryFolderBase result = m_Database.getInventoryFolder(folder.ID);
if (result != null) if (result != null)
return result; return result;
m_log.DebugFormat("[INVENTORY SERVICE]: GetFolder failed to find folder {0}", folder.ID);
return null; return null;
} }
public virtual bool DeleteFolders(UUID ownerID, List<UUID> folderIDs)
{
foreach (UUID id in folderIDs)
{
InventoryFolderBase folder = new InventoryFolderBase(id, ownerID);
PurgeFolder(folder);
m_Database.deleteInventoryFolder(id);
}
return true;
}
/// <summary> /// <summary>
/// Purge a folder of all items items and subfolders. /// Purge a folder of all items items and subfolders.
/// ///

View File

@ -128,6 +128,11 @@ namespace OpenSim.Tests.Common.Mock
return false; return false;
} }
public bool DeleteFolders(UUID ownerID, List<UUID> ids)
{
return false;
}
public bool PurgeFolder(InventoryFolderBase folder) public bool PurgeFolder(InventoryFolderBase folder)
{ {
return false; return false;

View File

@ -1,24 +0,0 @@
<Addin id="OpenSim.Grid.AssetInventoryServer" isroot="true" version="0.1">
<Runtime>
<Import assembly="OpenSim.Grid.AssetInventoryServer.exe" />
<Import assembly="OpenSim.Framework.dll" />
</Runtime>
<ExtensionPoint path="/OpenSim/AssetInventoryServer/Frontend">
<ExtensionNode name="Plugin" type="OpenSim.Framework.PluginExtensionNode" objectType="OpenSim.Grid.AssetInventoryServer.IAssetInventoryServerPlugin" />
</ExtensionPoint>
<ExtensionPoint path="/OpenSim/AssetInventoryServer/AssetStorageProvider">
<ExtensionNode name="Plugin" type="OpenSim.Framework.PluginExtensionNode" objectType="OpenSim.Grid.AssetInventoryServer.IAssetStorageProvider" />
</ExtensionPoint>
<ExtensionPoint path="/OpenSim/AssetInventoryServer/InventoryStorageProvider">
<ExtensionNode name="Plugin" type="OpenSim.Framework.PluginExtensionNode" objectType="OpenSim.Grid.AssetInventoryServer.IInventoryStorageProvider" />
</ExtensionPoint>
<ExtensionPoint path="/OpenSim/AssetInventoryServer/AuthenticationProvider">
<ExtensionNode name="Plugin" type="OpenSim.Framework.PluginExtensionNode" objectType="OpenSim.Grid.AssetInventoryServer.IAuthenticationProvider" />
</ExtensionPoint>
<ExtensionPoint path="/OpenSim/AssetInventoryServer/AuthorizationProvider">
<ExtensionNode name="Plugin" type="OpenSim.Framework.PluginExtensionNode" objectType="OpenSim.Grid.AssetInventoryServer.IAuthorizationProvider" />
</ExtensionPoint>
<ExtensionPoint path="/OpenSim/AssetInventoryServer/MetricsProvider">
<ExtensionNode name="Plugin" type="OpenSim.Framework.PluginExtensionNode" objectType="OpenSim.Grid.AssetInventoryServer.IMetricsProvider" />
</ExtensionPoint>
</Addin>

View File

@ -1,34 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" />
</configSections>
<appSettings>
</appSettings>
<log4net>
<appender name="Console" type="OpenSim.Framework.Console.OpenSimAppender, OpenSim.Framework.Console">
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date{HH:mm:ss} - %message%newline" />
</layout>
</appender>
<appender name="LogFileAppender" type="log4net.Appender.FileAppender">
<file value="OpenSim.Grid.AssetInventoryServer.log" />
<appendToFile value="true" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date %-5level - %logger %message%newline" />
</layout>
</appender>
<!-- if you'd like to know what NHibernate is doing more set value="DEBUG" -->
<logger name="NHibernate" additivity="false">
<level value="INFO"/>
<appender-ref ref="NHibernateFileLog"/>
</logger>
<root>
<level value="DEBUG" />
<appender-ref ref="Console" />
<appender-ref ref="LogFileAppender" />
</root>
</log4net>
</configuration>