Merge branch 'master' of ssh://MyConnection/var/git/opensim
commit
f0e2fd426b
|
@ -154,10 +154,10 @@ namespace OpenSim.Data.Tests
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
//[Test]
|
||||||
private void T012_EstateSettingsRandomStorage()
|
// Currently fails occasionally
|
||||||
|
public void T012_EstateSettingsRandomStorage()
|
||||||
{
|
{
|
||||||
|
|
||||||
// Letting estate store generate rows to database for us
|
// Letting estate store generate rows to database for us
|
||||||
EstateSettings originalSettings = db.LoadEstateSettings(REGION_ID);
|
EstateSettings originalSettings = db.LoadEstateSettings(REGION_ID);
|
||||||
new PropertyScrambler<EstateSettings>().Scramble(originalSettings);
|
new PropertyScrambler<EstateSettings>().Scramble(originalSettings);
|
||||||
|
|
|
@ -42,6 +42,7 @@ using OpenSim.Framework.Communications.Osp;
|
||||||
using OpenSim.Framework.Serialization;
|
using OpenSim.Framework.Serialization;
|
||||||
using OpenSim.Framework.Serialization.External;
|
using OpenSim.Framework.Serialization.External;
|
||||||
using OpenSim.Region.CoreModules.World.Archiver;
|
using OpenSim.Region.CoreModules.World.Archiver;
|
||||||
|
using OpenSim.Region.Framework.Scenes;
|
||||||
using OpenSim.Services.Interfaces;
|
using OpenSim.Services.Interfaces;
|
||||||
|
|
||||||
namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||||
|
@ -55,32 +56,33 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||||
private CachedUserInfo m_userInfo;
|
private CachedUserInfo m_userInfo;
|
||||||
private string m_invPath;
|
private string m_invPath;
|
||||||
|
|
||||||
|
/// <value>
|
||||||
|
/// We only use this to request modules
|
||||||
|
/// </value>
|
||||||
|
protected Scene m_scene;
|
||||||
|
|
||||||
/// <value>
|
/// <value>
|
||||||
/// The stream from which the inventory archive will be loaded.
|
/// The stream from which the inventory archive will be loaded.
|
||||||
/// </value>
|
/// </value>
|
||||||
private Stream m_loadStream;
|
private Stream m_loadStream;
|
||||||
|
|
||||||
protected CommunicationsManager m_commsManager;
|
|
||||||
protected IAssetService m_assetService;
|
|
||||||
|
|
||||||
public InventoryArchiveReadRequest(
|
public InventoryArchiveReadRequest(
|
||||||
CachedUserInfo userInfo, string invPath, string loadPath, CommunicationsManager commsManager, IAssetService assetService)
|
Scene scene, CachedUserInfo userInfo, string invPath, string loadPath)
|
||||||
: this(
|
: this(
|
||||||
|
scene,
|
||||||
userInfo,
|
userInfo,
|
||||||
invPath,
|
invPath,
|
||||||
new GZipStream(new FileStream(loadPath, FileMode.Open), CompressionMode.Decompress),
|
new GZipStream(new FileStream(loadPath, FileMode.Open), CompressionMode.Decompress))
|
||||||
commsManager, assetService)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public InventoryArchiveReadRequest(
|
public InventoryArchiveReadRequest(
|
||||||
CachedUserInfo userInfo, string invPath, Stream loadStream, CommunicationsManager commsManager, IAssetService assetService)
|
Scene scene, CachedUserInfo userInfo, string invPath, Stream loadStream)
|
||||||
{
|
{
|
||||||
|
m_scene = scene;
|
||||||
m_userInfo = userInfo;
|
m_userInfo = userInfo;
|
||||||
m_invPath = invPath;
|
m_invPath = invPath;
|
||||||
m_loadStream = loadStream;
|
m_loadStream = loadStream;
|
||||||
m_commsManager = commsManager;
|
|
||||||
m_assetService = assetService;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -98,6 +100,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||||
int successfulItemRestores = 0;
|
int successfulItemRestores = 0;
|
||||||
List<InventoryNodeBase> nodesLoaded = new List<InventoryNodeBase>();
|
List<InventoryNodeBase> nodesLoaded = new List<InventoryNodeBase>();
|
||||||
|
|
||||||
|
/*
|
||||||
if (!m_userInfo.HasReceivedInventory)
|
if (!m_userInfo.HasReceivedInventory)
|
||||||
{
|
{
|
||||||
// If the region server has access to the user admin service (by which users are created),
|
// If the region server has access to the user admin service (by which users are created),
|
||||||
|
@ -106,7 +109,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||||
//
|
//
|
||||||
// FIXME: FetchInventory should probably be assumed to by async anyway, since even standalones might
|
// FIXME: FetchInventory should probably be assumed to by async anyway, since even standalones might
|
||||||
// use a remote inventory service, though this is vanishingly rare at the moment.
|
// use a remote inventory service, though this is vanishingly rare at the moment.
|
||||||
if (null == m_commsManager.UserAdminService)
|
if (null == m_scene.CommsManager.UserAdminService)
|
||||||
{
|
{
|
||||||
m_log.ErrorFormat(
|
m_log.ErrorFormat(
|
||||||
"[INVENTORY ARCHIVER]: Have not yet received inventory info for user {0} {1}",
|
"[INVENTORY ARCHIVER]: Have not yet received inventory info for user {0} {1}",
|
||||||
|
@ -125,8 +128,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
InventoryFolderImpl rootDestinationFolder = m_userInfo.RootFolder.FindFolderByPath(m_invPath);
|
|
||||||
|
//InventoryFolderImpl rootDestinationFolder = m_userInfo.RootFolder.FindFolderByPath(m_invPath);
|
||||||
|
InventoryFolderBase rootDestinationFolder
|
||||||
|
= InventoryArchiveUtils.FindFolderByPath(
|
||||||
|
m_scene.InventoryService, m_userInfo.UserProfile.ID, m_invPath);
|
||||||
|
|
||||||
if (null == rootDestinationFolder)
|
if (null == rootDestinationFolder)
|
||||||
{
|
{
|
||||||
|
@ -140,7 +147,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||||
|
|
||||||
// In order to load identically named folders, we need to keep track of the folders that we have already
|
// In order to load identically named folders, we need to keep track of the folders that we have already
|
||||||
// created
|
// created
|
||||||
Dictionary <string, InventoryFolderImpl> foldersCreated = new Dictionary<string, InventoryFolderImpl>();
|
Dictionary <string, InventoryFolderBase> foldersCreated = new Dictionary<string, InventoryFolderBase>();
|
||||||
|
|
||||||
byte[] data;
|
byte[] data;
|
||||||
TarArchiveReader.TarEntryType entryType;
|
TarArchiveReader.TarEntryType entryType;
|
||||||
|
@ -155,7 +162,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||||
}
|
}
|
||||||
else if (filePath.StartsWith(ArchiveConstants.INVENTORY_PATH))
|
else if (filePath.StartsWith(ArchiveConstants.INVENTORY_PATH))
|
||||||
{
|
{
|
||||||
InventoryFolderImpl foundFolder
|
InventoryFolderBase foundFolder
|
||||||
= ReplicateArchivePathToUserInventory(
|
= ReplicateArchivePathToUserInventory(
|
||||||
filePath, TarArchiveReader.TarEntryType.TYPE_DIRECTORY == entryType,
|
filePath, TarArchiveReader.TarEntryType.TYPE_DIRECTORY == entryType,
|
||||||
rootDestinationFolder, foldersCreated, nodesLoaded);
|
rootDestinationFolder, foldersCreated, nodesLoaded);
|
||||||
|
@ -167,7 +174,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||||
// Don't use the item ID that's in the file
|
// Don't use the item ID that's in the file
|
||||||
item.ID = UUID.Random();
|
item.ID = UUID.Random();
|
||||||
|
|
||||||
UUID ospResolvedId = OspResolver.ResolveOspa(item.CreatorId, m_commsManager);
|
UUID ospResolvedId = OspResolver.ResolveOspa(item.CreatorId, m_scene.CommsManager);
|
||||||
if (UUID.Zero != ospResolvedId)
|
if (UUID.Zero != ospResolvedId)
|
||||||
item.CreatorIdAsUuid = ospResolvedId;
|
item.CreatorIdAsUuid = ospResolvedId;
|
||||||
|
|
||||||
|
@ -176,7 +183,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||||
// Reset folder ID to the one in which we want to load it
|
// Reset folder ID to the one in which we want to load it
|
||||||
item.Folder = foundFolder.ID;
|
item.Folder = foundFolder.ID;
|
||||||
|
|
||||||
m_userInfo.AddItem(item);
|
//m_userInfo.AddItem(item);
|
||||||
|
m_scene.InventoryService.AddItem(item);
|
||||||
successfulItemRestores++;
|
successfulItemRestores++;
|
||||||
|
|
||||||
// If we're loading an item directly into the given destination folder then we need to record
|
// If we're loading an item directly into the given destination folder then we need to record
|
||||||
|
@ -209,11 +217,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||||
/// chain, only the root node needs to be recorded
|
/// chain, only the root node needs to be recorded
|
||||||
/// </param>
|
/// </param>
|
||||||
/// <returns>The last user inventory folder created or found for the archive path</returns>
|
/// <returns>The last user inventory folder created or found for the archive path</returns>
|
||||||
public InventoryFolderImpl ReplicateArchivePathToUserInventory(
|
public InventoryFolderBase ReplicateArchivePathToUserInventory(
|
||||||
string fsPath,
|
string fsPath,
|
||||||
bool isDir,
|
bool isDir,
|
||||||
InventoryFolderImpl rootDestinationFolder,
|
InventoryFolderBase rootDestFolder,
|
||||||
Dictionary <string, InventoryFolderImpl> foldersCreated,
|
Dictionary <string, InventoryFolderBase> foldersCreated,
|
||||||
List<InventoryNodeBase> nodesLoaded)
|
List<InventoryNodeBase> nodesLoaded)
|
||||||
{
|
{
|
||||||
fsPath = fsPath.Substring(ArchiveConstants.INVENTORY_PATH.Length);
|
fsPath = fsPath.Substring(ArchiveConstants.INVENTORY_PATH.Length);
|
||||||
|
@ -226,17 +234,17 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||||
|
|
||||||
m_log.DebugFormat("[INVENTORY ARCHIVER]: Loading to folder {0}", fsPath);
|
m_log.DebugFormat("[INVENTORY ARCHIVER]: Loading to folder {0}", fsPath);
|
||||||
|
|
||||||
InventoryFolderImpl foundFolder = null;
|
InventoryFolderBase destFolder = null;
|
||||||
|
|
||||||
// XXX: Nasty way of dealing with a path that has no directory component
|
// XXX: Nasty way of dealing with a path that has no directory component
|
||||||
if (fsPath.Length > 0)
|
if (fsPath.Length > 0)
|
||||||
{
|
{
|
||||||
while (null == foundFolder && fsPath.Length > 0)
|
while (null == destFolder && fsPath.Length > 0)
|
||||||
{
|
{
|
||||||
if (foldersCreated.ContainsKey(fsPath))
|
if (foldersCreated.ContainsKey(fsPath))
|
||||||
{
|
{
|
||||||
m_log.DebugFormat("[INVENTORY ARCHIVER]: Found previously created fs path {0}", fsPath);
|
m_log.DebugFormat("[INVENTORY ARCHIVER]: Found previously created fs path {0}", fsPath);
|
||||||
foundFolder = foldersCreated[fsPath];
|
destFolder = foldersCreated[fsPath];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -253,14 +261,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||||
"[INVENTORY ARCHIVER]: Found no previously created fs path for {0}",
|
"[INVENTORY ARCHIVER]: Found no previously created fs path for {0}",
|
||||||
originalFsPath);
|
originalFsPath);
|
||||||
fsPath = string.Empty;
|
fsPath = string.Empty;
|
||||||
foundFolder = rootDestinationFolder;
|
destFolder = rootDestFolder;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
foundFolder = rootDestinationFolder;
|
destFolder = rootDestFolder;
|
||||||
}
|
}
|
||||||
|
|
||||||
string fsPathSectionToCreate = originalFsPath.Substring(fsPath.Length);
|
string fsPathSectionToCreate = originalFsPath.Substring(fsPath.Length);
|
||||||
|
@ -275,30 +283,39 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||||
int identicalNameIdentifierIndex
|
int identicalNameIdentifierIndex
|
||||||
= rawDirsToCreate[i].LastIndexOf(
|
= rawDirsToCreate[i].LastIndexOf(
|
||||||
ArchiveConstants.INVENTORY_NODE_NAME_COMPONENT_SEPARATOR);
|
ArchiveConstants.INVENTORY_NODE_NAME_COMPONENT_SEPARATOR);
|
||||||
string folderName = rawDirsToCreate[i].Remove(identicalNameIdentifierIndex);
|
|
||||||
|
|
||||||
|
string newFolderName = rawDirsToCreate[i].Remove(identicalNameIdentifierIndex);
|
||||||
UUID newFolderId = UUID.Random();
|
UUID newFolderId = UUID.Random();
|
||||||
m_userInfo.CreateFolder(
|
|
||||||
folderName, newFolderId, (ushort)AssetType.Folder, foundFolder.ID);
|
destFolder
|
||||||
|
= new InventoryFolderBase(
|
||||||
|
newFolderId, newFolderName, m_userInfo.UserProfile.ID,
|
||||||
|
(short)AssetType.Folder, destFolder.ID, 0);
|
||||||
|
m_scene.InventoryService.AddFolder(destFolder);
|
||||||
|
|
||||||
|
// UUID newFolderId = UUID.Random();
|
||||||
|
// m_scene.InventoryService.AddFolder(
|
||||||
|
// m_userInfo.CreateFolder(
|
||||||
|
// folderName, newFolderId, (ushort)AssetType.Folder, foundFolder.ID);
|
||||||
|
|
||||||
m_log.DebugFormat("[INVENTORY ARCHIVER]: Retrieving newly created folder {0}", folderName);
|
// m_log.DebugFormat("[INVENTORY ARCHIVER]: Retrieving newly created folder {0}", folderName);
|
||||||
foundFolder = foundFolder.GetChildFolder(newFolderId);
|
// foundFolder = foundFolder.GetChildFolder(newFolderId);
|
||||||
m_log.DebugFormat(
|
// m_log.DebugFormat(
|
||||||
"[INVENTORY ARCHIVER]: Retrieved newly created folder {0} with ID {1}",
|
// "[INVENTORY ARCHIVER]: Retrieved newly created folder {0} with ID {1}",
|
||||||
foundFolder.Name, foundFolder.ID);
|
// foundFolder.Name, foundFolder.ID);
|
||||||
|
|
||||||
// Record that we have now created this folder
|
// Record that we have now created this folder
|
||||||
fsPath += rawDirsToCreate[i] + "/";
|
fsPath += rawDirsToCreate[i] + "/";
|
||||||
m_log.DebugFormat("[INVENTORY ARCHIVER]: Recording creation of fs path {0}", fsPath);
|
m_log.DebugFormat("[INVENTORY ARCHIVER]: Recording creation of fs path {0}", fsPath);
|
||||||
foldersCreated[fsPath] = foundFolder;
|
foldersCreated[fsPath] = destFolder;
|
||||||
|
|
||||||
if (0 == i)
|
if (0 == i)
|
||||||
nodesLoaded.Add(foundFolder);
|
nodesLoaded.Add(destFolder);
|
||||||
|
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return foundFolder;
|
return destFolder;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
string[] rawFolders = filePath.Split(new char[] { '/' });
|
string[] rawFolders = filePath.Split(new char[] { '/' });
|
||||||
|
@ -371,7 +388,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||||
asset.Type = assetType;
|
asset.Type = assetType;
|
||||||
asset.Data = data;
|
asset.Data = data;
|
||||||
|
|
||||||
m_assetService.Store(asset);
|
m_scene.AssetService.Store(asset);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,212 @@
|
||||||
|
/*
|
||||||
|
* 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.Generic;
|
||||||
|
using OpenMetaverse;
|
||||||
|
using OpenSim.Framework;
|
||||||
|
using OpenSim.Services.Interfaces;
|
||||||
|
|
||||||
|
namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Utility methods for inventory archiving
|
||||||
|
/// </summary>
|
||||||
|
public static class InventoryArchiveUtils
|
||||||
|
{
|
||||||
|
public static readonly string PATH_DELIMITER = "/";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Find a folder given a PATH_DELIMITER delimited path starting from a user's root folder
|
||||||
|
/// </summary>
|
||||||
|
///
|
||||||
|
/// This method does not handle paths that contain multiple delimitors
|
||||||
|
///
|
||||||
|
/// FIXME: We do not yet handle situations where folders have the same name. We could handle this by some
|
||||||
|
/// XPath like expression
|
||||||
|
///
|
||||||
|
/// FIXME: Delimitors which occur in names themselves are not currently escapable.
|
||||||
|
///
|
||||||
|
/// <param name="inventoryService">
|
||||||
|
/// Inventory service to query
|
||||||
|
/// </param>
|
||||||
|
/// <param name="userId">
|
||||||
|
/// User id to search
|
||||||
|
/// </param>
|
||||||
|
/// <param name="path">
|
||||||
|
/// The path to the required folder.
|
||||||
|
/// It this is empty or consists only of the PATH_DELIMTER then this folder itself is returned.
|
||||||
|
/// </param>
|
||||||
|
/// <returns>null if the folder is not found</returns>
|
||||||
|
public static InventoryFolderBase FindFolderByPath(
|
||||||
|
IInventoryService inventoryService, UUID userId, string path)
|
||||||
|
{
|
||||||
|
InventoryFolderBase rootFolder = inventoryService.GetRootFolder(userId);
|
||||||
|
|
||||||
|
if (null == rootFolder)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
return FindFolderByPath(inventoryService, rootFolder, path);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Find a folder given a PATH_DELIMITER delimited path starting from this folder
|
||||||
|
/// </summary>
|
||||||
|
///
|
||||||
|
/// This method does not handle paths that contain multiple delimitors
|
||||||
|
///
|
||||||
|
/// FIXME: We do not yet handle situations where folders have the same name. We could handle this by some
|
||||||
|
/// XPath like expression
|
||||||
|
///
|
||||||
|
/// FIXME: Delimitors which occur in names themselves are not currently escapable.
|
||||||
|
///
|
||||||
|
/// <param name="inventoryService">
|
||||||
|
/// Inventory service to query
|
||||||
|
/// </param>
|
||||||
|
/// <param name="startFolder">
|
||||||
|
/// The folder from which the path starts
|
||||||
|
/// </param>
|
||||||
|
/// <param name="path">
|
||||||
|
/// The path to the required folder.
|
||||||
|
/// It this is empty or consists only of the PATH_DELIMTER then this folder itself is returned.
|
||||||
|
/// </param>
|
||||||
|
/// <returns>null if the folder is not found</returns>
|
||||||
|
public static InventoryFolderBase FindFolderByPath(
|
||||||
|
IInventoryService inventoryService, InventoryFolderBase startFolder, string path)
|
||||||
|
{
|
||||||
|
if (path == string.Empty)
|
||||||
|
return startFolder;
|
||||||
|
|
||||||
|
path = path.Trim();
|
||||||
|
|
||||||
|
if (path == PATH_DELIMITER)
|
||||||
|
return startFolder;
|
||||||
|
|
||||||
|
InventoryFolderBase foundFolder = null;
|
||||||
|
|
||||||
|
string[] components = path.Split(new string[] { PATH_DELIMITER }, 2, StringSplitOptions.None);
|
||||||
|
InventoryCollection contents = inventoryService.GetFolderContent(startFolder.Owner, startFolder.ID);
|
||||||
|
|
||||||
|
foreach (InventoryFolderBase folder in contents.Folders)
|
||||||
|
{
|
||||||
|
if (folder.Name == components[0])
|
||||||
|
{
|
||||||
|
if (components.Length > 1)
|
||||||
|
return FindFolderByPath(inventoryService, foundFolder, components[1]);
|
||||||
|
else
|
||||||
|
return folder;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// We didn't find a folder with the right name
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Find an item given a PATH_DELIMITOR delimited path starting from the user's root folder.
|
||||||
|
///
|
||||||
|
/// This method does not handle paths that contain multiple delimitors
|
||||||
|
///
|
||||||
|
/// FIXME: We do not yet handle situations where folders or items have the same name. We could handle this by some
|
||||||
|
/// XPath like expression
|
||||||
|
///
|
||||||
|
/// FIXME: Delimitors which occur in names themselves are not currently escapable.
|
||||||
|
/// </summary>
|
||||||
|
///
|
||||||
|
/// <param name="inventoryService">
|
||||||
|
/// Inventory service to query
|
||||||
|
/// </param>
|
||||||
|
/// <param name="userId">
|
||||||
|
/// The user to search
|
||||||
|
/// </param>
|
||||||
|
/// <param name="path">
|
||||||
|
/// The path to the required item.
|
||||||
|
/// </param>
|
||||||
|
/// <returns>null if the item is not found</returns>
|
||||||
|
public static InventoryItemBase FindItemByPath(
|
||||||
|
IInventoryService inventoryService, UUID userId, string path)
|
||||||
|
{
|
||||||
|
InventoryFolderBase rootFolder = inventoryService.GetRootFolder(userId);
|
||||||
|
|
||||||
|
if (null == rootFolder)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
return FindItemByPath(inventoryService, rootFolder, path);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Find an item given a PATH_DELIMITOR delimited path starting from this folder.
|
||||||
|
///
|
||||||
|
/// This method does not handle paths that contain multiple delimitors
|
||||||
|
///
|
||||||
|
/// FIXME: We do not yet handle situations where folders or items have the same name. We could handle this by some
|
||||||
|
/// XPath like expression
|
||||||
|
///
|
||||||
|
/// FIXME: Delimitors which occur in names themselves are not currently escapable.
|
||||||
|
/// </summary>
|
||||||
|
///
|
||||||
|
/// <param name="inventoryService">
|
||||||
|
/// Inventory service to query
|
||||||
|
/// </param>
|
||||||
|
/// <param name="startFolder">
|
||||||
|
/// The folder from which the path starts
|
||||||
|
/// </param>
|
||||||
|
/// <param name="path">
|
||||||
|
/// <param name="path">
|
||||||
|
/// The path to the required item.
|
||||||
|
/// </param>
|
||||||
|
/// <returns>null if the item is not found</returns>
|
||||||
|
public static InventoryItemBase FindItemByPath(
|
||||||
|
IInventoryService inventoryService, InventoryFolderBase startFolder, string path)
|
||||||
|
{
|
||||||
|
string[] components = path.Split(new string[] { PATH_DELIMITER }, 2, StringSplitOptions.None);
|
||||||
|
|
||||||
|
if (components.Length == 1)
|
||||||
|
{
|
||||||
|
List<InventoryItemBase> items = inventoryService.GetFolderItems(startFolder.Owner, startFolder.ID);
|
||||||
|
foreach (InventoryItemBase item in items)
|
||||||
|
{
|
||||||
|
if (item.Name == components[0])
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
InventoryCollection contents = inventoryService.GetFolderContent(startFolder.Owner, startFolder.ID);
|
||||||
|
|
||||||
|
foreach (InventoryFolderBase folder in contents.Folders)
|
||||||
|
{
|
||||||
|
if (folder.Name == components[0])
|
||||||
|
return FindItemByPath(inventoryService, folder, components[1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// We didn't find an item or intermediate folder with the given name
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -59,6 +59,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||||
protected TarArchiveWriter m_archiveWriter;
|
protected TarArchiveWriter m_archiveWriter;
|
||||||
protected UuidGatherer m_assetGatherer;
|
protected UuidGatherer m_assetGatherer;
|
||||||
|
|
||||||
|
/// <value>
|
||||||
|
/// We only use this to request modules
|
||||||
|
/// </value>
|
||||||
|
protected Scene m_scene;
|
||||||
|
|
||||||
/// <value>
|
/// <value>
|
||||||
/// ID of this request
|
/// ID of this request
|
||||||
/// </value>
|
/// </value>
|
||||||
|
@ -83,10 +88,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||||
/// Constructor
|
/// Constructor
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public InventoryArchiveWriteRequest(
|
public InventoryArchiveWriteRequest(
|
||||||
Guid id, InventoryArchiverModule module, CachedUserInfo userInfo, string invPath, string savePath)
|
Guid id, InventoryArchiverModule module, Scene scene,
|
||||||
|
CachedUserInfo userInfo, string invPath, string savePath)
|
||||||
: this(
|
: this(
|
||||||
id,
|
id,
|
||||||
module,
|
module,
|
||||||
|
scene,
|
||||||
userInfo,
|
userInfo,
|
||||||
invPath,
|
invPath,
|
||||||
new GZipStream(new FileStream(savePath, FileMode.Create), CompressionMode.Compress))
|
new GZipStream(new FileStream(savePath, FileMode.Create), CompressionMode.Compress))
|
||||||
|
@ -97,14 +104,16 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||||
/// Constructor
|
/// Constructor
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public InventoryArchiveWriteRequest(
|
public InventoryArchiveWriteRequest(
|
||||||
Guid id, InventoryArchiverModule module, CachedUserInfo userInfo, string invPath, Stream saveStream)
|
Guid id, InventoryArchiverModule module, Scene scene,
|
||||||
|
CachedUserInfo userInfo, string invPath, Stream saveStream)
|
||||||
{
|
{
|
||||||
m_id = id;
|
m_id = id;
|
||||||
m_module = module;
|
m_module = module;
|
||||||
|
m_scene = scene;
|
||||||
m_userInfo = userInfo;
|
m_userInfo = userInfo;
|
||||||
m_invPath = invPath;
|
m_invPath = invPath;
|
||||||
m_saveStream = saveStream;
|
m_saveStream = saveStream;
|
||||||
m_assetGatherer = new UuidGatherer(m_module.AssetService);
|
m_assetGatherer = new UuidGatherer(m_scene.AssetService);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void ReceivedAllAssets(ICollection<UUID> assetsFoundUuids, ICollection<UUID> assetsNotFoundUuids)
|
protected void ReceivedAllAssets(ICollection<UUID> assetsFoundUuids, ICollection<UUID> assetsNotFoundUuids)
|
||||||
|
@ -135,7 +144,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||||
m_userUuids[inventoryItem.CreatorIdAsUuid] = 1;
|
m_userUuids[inventoryItem.CreatorIdAsUuid] = 1;
|
||||||
|
|
||||||
InventoryItemBase saveItem = (InventoryItemBase)inventoryItem.Clone();
|
InventoryItemBase saveItem = (InventoryItemBase)inventoryItem.Clone();
|
||||||
saveItem.CreatorId = OspResolver.MakeOspa(saveItem.CreatorIdAsUuid, m_module.CommsManager);
|
saveItem.CreatorId = OspResolver.MakeOspa(saveItem.CreatorIdAsUuid, m_scene.CommsManager);
|
||||||
|
|
||||||
string serialization = UserInventoryItemSerializer.Serialize(saveItem);
|
string serialization = UserInventoryItemSerializer.Serialize(saveItem);
|
||||||
m_archiveWriter.WriteFile(filename, serialization);
|
m_archiveWriter.WriteFile(filename, serialization);
|
||||||
|
@ -149,7 +158,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||||
/// <param name="inventoryFolder">The inventory folder to save</param>
|
/// <param name="inventoryFolder">The inventory folder to save</param>
|
||||||
/// <param name="path">The path to which the folder should be saved</param>
|
/// <param name="path">The path to which the folder should be saved</param>
|
||||||
/// <param name="saveThisFolderItself">If true, save this folder itself. If false, only saves contents</param>
|
/// <param name="saveThisFolderItself">If true, save this folder itself. If false, only saves contents</param>
|
||||||
protected void SaveInvFolder(InventoryFolderImpl inventoryFolder, string path, bool saveThisFolderItself)
|
protected void SaveInvFolder(InventoryFolderBase inventoryFolder, string path, bool saveThisFolderItself)
|
||||||
{
|
{
|
||||||
if (saveThisFolderItself)
|
if (saveThisFolderItself)
|
||||||
{
|
{
|
||||||
|
@ -164,15 +173,16 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||||
m_archiveWriter.WriteDir(path);
|
m_archiveWriter.WriteDir(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
List<InventoryFolderImpl> childFolders = inventoryFolder.RequestListOfFolderImpls();
|
InventoryCollection contents
|
||||||
List<InventoryItemBase> items = inventoryFolder.RequestListOfItems();
|
= m_scene.InventoryService.GetFolderContent(inventoryFolder.Owner, inventoryFolder.ID);
|
||||||
|
//List<InventoryFolderImpl> childFolders = inventoryFolder.RequestListOfFolderImpls();
|
||||||
|
//List<InventoryItemBase> items = inventoryFolder.RequestListOfItems();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Dictionary identicalFolderNames = new Dictionary<string, int>();
|
Dictionary identicalFolderNames = new Dictionary<string, int>();
|
||||||
|
|
||||||
foreach (InventoryFolderImpl folder in inventories)
|
foreach (InventoryFolderImpl folder in inventories)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (!identicalFolderNames.ContainsKey(folder.Name))
|
if (!identicalFolderNames.ContainsKey(folder.Name))
|
||||||
identicalFolderNames[folder.Name] = 0;
|
identicalFolderNames[folder.Name] = 0;
|
||||||
else
|
else
|
||||||
|
@ -188,12 +198,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
foreach (InventoryFolderImpl childFolder in childFolders)
|
foreach (InventoryFolderBase childFolder in contents.Folders)
|
||||||
{
|
{
|
||||||
SaveInvFolder(childFolder, path, true);
|
SaveInvFolder(childFolder, path, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (InventoryItemBase item in items)
|
foreach (InventoryItemBase item in contents.Items)
|
||||||
{
|
{
|
||||||
SaveInvItem(item, path);
|
SaveInvItem(item, path);
|
||||||
}
|
}
|
||||||
|
@ -204,9 +214,18 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void Execute()
|
public void Execute()
|
||||||
{
|
{
|
||||||
InventoryFolderImpl inventoryFolder = null;
|
InventoryFolderBase inventoryFolder = null;
|
||||||
InventoryItemBase inventoryItem = null;
|
InventoryItemBase inventoryItem = null;
|
||||||
|
InventoryFolderBase rootFolder = m_scene.InventoryService.GetRootFolder(m_userInfo.UserProfile.ID);
|
||||||
|
|
||||||
|
// XXX: Very temporarily, drop and refetch inventory to make sure we have any newly created items in cache
|
||||||
|
// This will disappear very soon once we stop using the old cached inventory.
|
||||||
|
/*
|
||||||
|
m_userInfo.DropInventory();
|
||||||
|
m_userInfo.FetchInventory();
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
if (!m_userInfo.HasReceivedInventory)
|
if (!m_userInfo.HasReceivedInventory)
|
||||||
{
|
{
|
||||||
// If the region server has access to the user admin service (by which users are created),
|
// If the region server has access to the user admin service (by which users are created),
|
||||||
|
@ -215,7 +234,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||||
//
|
//
|
||||||
// FIXME: FetchInventory should probably be assumed to by async anyway, since even standalones might
|
// FIXME: FetchInventory should probably be assumed to by async anyway, since even standalones might
|
||||||
// use a remote inventory service, though this is vanishingly rare at the moment.
|
// use a remote inventory service, though this is vanishingly rare at the moment.
|
||||||
if (null == m_module.CommsManager.UserAdminService)
|
if (null == m_scene.CommsManager.UserAdminService)
|
||||||
{
|
{
|
||||||
m_log.ErrorFormat(
|
m_log.ErrorFormat(
|
||||||
"[INVENTORY ARCHIVER]: Have not yet received inventory info for user {0} {1}",
|
"[INVENTORY ARCHIVER]: Have not yet received inventory info for user {0} {1}",
|
||||||
|
@ -228,11 +247,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||||
m_userInfo.FetchInventory();
|
m_userInfo.FetchInventory();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
bool foundStar = false;
|
bool foundStar = false;
|
||||||
|
|
||||||
// Eliminate double slashes and any leading / on the path. This might be better done within InventoryFolderImpl
|
// Eliminate double slashes and any leading / on the path.
|
||||||
// itself (possibly at a small loss in efficiency).
|
|
||||||
string[] components
|
string[] components
|
||||||
= m_invPath.Split(
|
= m_invPath.Split(
|
||||||
new string[] { InventoryFolderImpl.PATH_DELIMITER }, StringSplitOptions.RemoveEmptyEntries);
|
new string[] { InventoryFolderImpl.PATH_DELIMITER }, StringSplitOptions.RemoveEmptyEntries);
|
||||||
|
@ -257,18 +276,21 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||||
// Therefore if we still start with a / after the split, then we need the root folder
|
// Therefore if we still start with a / after the split, then we need the root folder
|
||||||
if (m_invPath.Length == 0)
|
if (m_invPath.Length == 0)
|
||||||
{
|
{
|
||||||
inventoryFolder = m_userInfo.RootFolder;
|
inventoryFolder = rootFolder;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_invPath = m_invPath.Remove(m_invPath.LastIndexOf(InventoryFolderImpl.PATH_DELIMITER));
|
m_invPath = m_invPath.Remove(m_invPath.LastIndexOf(InventoryFolderImpl.PATH_DELIMITER));
|
||||||
inventoryFolder = m_userInfo.RootFolder.FindFolderByPath(m_invPath);
|
inventoryFolder
|
||||||
|
= InventoryArchiveUtils.FindFolderByPath(m_scene.InventoryService, rootFolder, m_invPath);
|
||||||
|
//inventoryFolder = m_userInfo.RootFolder.FindFolderByPath(m_invPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
// The path may point to an item instead
|
// The path may point to an item instead
|
||||||
if (inventoryFolder == null)
|
if (inventoryFolder == null)
|
||||||
{
|
{
|
||||||
inventoryItem = m_userInfo.RootFolder.FindItemByPath(m_invPath);
|
inventoryItem = InventoryArchiveUtils.FindItemByPath(m_scene.InventoryService, rootFolder, m_invPath);
|
||||||
|
//inventoryItem = m_userInfo.RootFolder.FindItemByPath(m_invPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_archiveWriter = new TarArchiveWriter(m_saveStream);
|
m_archiveWriter = new TarArchiveWriter(m_saveStream);
|
||||||
|
@ -306,7 +328,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||||
SaveUsers();
|
SaveUsers();
|
||||||
new AssetsRequest(
|
new AssetsRequest(
|
||||||
new AssetsArchiver(m_archiveWriter), m_assetUuids.Keys,
|
new AssetsArchiver(m_archiveWriter), m_assetUuids.Keys,
|
||||||
m_module.AssetService, ReceivedAllAssets).Execute();
|
m_scene.AssetService, ReceivedAllAssets).Execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -320,7 +342,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||||
{
|
{
|
||||||
// Record the creator of this item
|
// Record the creator of this item
|
||||||
CachedUserInfo creator
|
CachedUserInfo creator
|
||||||
= m_module.CommsManager.UserProfileCacheService.GetUserDetails(creatorId);
|
= m_scene.CommsManager.UserProfileCacheService.GetUserDetails(creatorId);
|
||||||
|
|
||||||
if (creator != null)
|
if (creator != null)
|
||||||
{
|
{
|
||||||
|
|
|
@ -51,13 +51,18 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||||
public string Name { get { return "Inventory Archiver Module"; } }
|
public string Name { get { return "Inventory Archiver Module"; } }
|
||||||
|
|
||||||
public bool IsSharedModule { get { return true; } }
|
public bool IsSharedModule { get { return true; } }
|
||||||
|
|
||||||
|
/// <value>
|
||||||
|
/// Enable or disable checking whether the iar user is actually logged in
|
||||||
|
/// </value>
|
||||||
|
public bool DisablePresenceChecks { get; set; }
|
||||||
|
|
||||||
public event InventoryArchiveSaved OnInventoryArchiveSaved;
|
public event InventoryArchiveSaved OnInventoryArchiveSaved;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The file to load and save inventory if no filename has been specified
|
/// The file to load and save inventory if no filename has been specified
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected const string DEFAULT_INV_BACKUP_FILENAME = "user-inventory_iar.tar.gz";
|
protected const string DEFAULT_INV_BACKUP_FILENAME = "user-inventory.iar";
|
||||||
|
|
||||||
/// <value>
|
/// <value>
|
||||||
/// Pending save completions initiated from the console
|
/// Pending save completions initiated from the console
|
||||||
|
@ -69,19 +74,19 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||||
/// </value>
|
/// </value>
|
||||||
private Dictionary<UUID, Scene> m_scenes = new Dictionary<UUID, Scene>();
|
private Dictionary<UUID, Scene> m_scenes = new Dictionary<UUID, Scene>();
|
||||||
private Scene m_aScene;
|
private Scene m_aScene;
|
||||||
|
|
||||||
/// <value>
|
public InventoryArchiverModule() {}
|
||||||
/// The comms manager we will use for all comms requests
|
|
||||||
/// </value>
|
public InventoryArchiverModule(bool disablePresenceChecks)
|
||||||
protected internal CommunicationsManager CommsManager;
|
{
|
||||||
protected internal IAssetService AssetService;
|
DisablePresenceChecks = disablePresenceChecks;
|
||||||
|
}
|
||||||
|
|
||||||
public void Initialise(Scene scene, IConfigSource source)
|
public void Initialise(Scene scene, IConfigSource source)
|
||||||
{
|
{
|
||||||
if (m_scenes.Count == 0)
|
if (m_scenes.Count == 0)
|
||||||
{
|
{
|
||||||
scene.RegisterModuleInterface<IInventoryArchiverModule>(this);
|
scene.RegisterModuleInterface<IInventoryArchiverModule>(this);
|
||||||
CommsManager = scene.CommsManager;
|
|
||||||
OnInventoryArchiveSaved += SaveInvConsoleCommandCompleted;
|
OnInventoryArchiveSaved += SaveInvConsoleCommandCompleted;
|
||||||
|
|
||||||
scene.AddCommand(
|
scene.AddCommand(
|
||||||
|
@ -99,11 +104,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||||
|
|
||||||
m_scenes[scene.RegionInfo.RegionID] = scene;
|
m_scenes[scene.RegionInfo.RegionID] = scene;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void PostInitialise()
|
public void PostInitialise() {}
|
||||||
{
|
|
||||||
AssetService = m_aScene.AssetService;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Close() {}
|
public void Close() {}
|
||||||
|
|
||||||
|
@ -119,29 +121,57 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||||
handlerInventoryArchiveSaved(id, succeeded, userInfo, invPath, saveStream, reportedException);
|
handlerInventoryArchiveSaved(id, succeeded, userInfo, invPath, saveStream, reportedException);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ArchiveInventory(Guid id, string firstName, string lastName, string invPath, Stream saveStream)
|
public bool ArchiveInventory(Guid id, string firstName, string lastName, string invPath, Stream saveStream)
|
||||||
{
|
{
|
||||||
if (m_scenes.Count > 0)
|
if (m_scenes.Count > 0)
|
||||||
{
|
{
|
||||||
CachedUserInfo userInfo = GetUserInfo(firstName, lastName);
|
CachedUserInfo userInfo = GetUserInfo(firstName, lastName);
|
||||||
|
|
||||||
if (userInfo != null)
|
if (userInfo != null)
|
||||||
new InventoryArchiveWriteRequest(id, this, userInfo, invPath, saveStream).Execute();
|
{
|
||||||
}
|
if (CheckPresence(userInfo.UserProfile.ID))
|
||||||
|
{
|
||||||
|
new InventoryArchiveWriteRequest(id, this, m_aScene, userInfo, invPath, saveStream).Execute();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_log.ErrorFormat(
|
||||||
|
"[INVENTORY ARCHIVER]: User {0} {1} not logged in to this region simulator",
|
||||||
|
userInfo.UserProfile.Name, userInfo.UserProfile.ID);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ArchiveInventory(Guid id, string firstName, string lastName, string invPath, string savePath)
|
public bool ArchiveInventory(Guid id, string firstName, string lastName, string invPath, string savePath)
|
||||||
{
|
{
|
||||||
if (m_scenes.Count > 0)
|
if (m_scenes.Count > 0)
|
||||||
{
|
{
|
||||||
CachedUserInfo userInfo = GetUserInfo(firstName, lastName);
|
CachedUserInfo userInfo = GetUserInfo(firstName, lastName);
|
||||||
|
|
||||||
if (userInfo != null)
|
if (userInfo != null)
|
||||||
new InventoryArchiveWriteRequest(id, this, userInfo, invPath, savePath).Execute();
|
{
|
||||||
}
|
if (CheckPresence(userInfo.UserProfile.ID))
|
||||||
|
{
|
||||||
|
new InventoryArchiveWriteRequest(id, this, m_aScene, userInfo, invPath, savePath).Execute();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_log.ErrorFormat(
|
||||||
|
"[INVENTORY ARCHIVER]: User {0} {1} not logged in to this region simulator",
|
||||||
|
userInfo.UserProfile.Name, userInfo.UserProfile.ID);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DearchiveInventory(string firstName, string lastName, string invPath, Stream loadStream)
|
public bool DearchiveInventory(string firstName, string lastName, string invPath, Stream loadStream)
|
||||||
{
|
{
|
||||||
if (m_scenes.Count > 0)
|
if (m_scenes.Count > 0)
|
||||||
{
|
{
|
||||||
|
@ -149,14 +179,27 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||||
|
|
||||||
if (userInfo != null)
|
if (userInfo != null)
|
||||||
{
|
{
|
||||||
InventoryArchiveReadRequest request =
|
if (CheckPresence(userInfo.UserProfile.ID))
|
||||||
new InventoryArchiveReadRequest(userInfo, invPath, loadStream, CommsManager, AssetService);
|
{
|
||||||
UpdateClientWithLoadedNodes(userInfo, request.Execute());
|
InventoryArchiveReadRequest request =
|
||||||
|
new InventoryArchiveReadRequest(m_aScene, userInfo, invPath, loadStream);
|
||||||
|
UpdateClientWithLoadedNodes(userInfo, request.Execute());
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_log.ErrorFormat(
|
||||||
|
"[INVENTORY ARCHIVER]: User {0} {1} not logged in to this region simulator",
|
||||||
|
userInfo.UserProfile.Name, userInfo.UserProfile.ID);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DearchiveInventory(string firstName, string lastName, string invPath, string loadPath)
|
public bool DearchiveInventory(string firstName, string lastName, string invPath, string loadPath)
|
||||||
{
|
{
|
||||||
if (m_scenes.Count > 0)
|
if (m_scenes.Count > 0)
|
||||||
{
|
{
|
||||||
|
@ -164,11 +207,24 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||||
|
|
||||||
if (userInfo != null)
|
if (userInfo != null)
|
||||||
{
|
{
|
||||||
InventoryArchiveReadRequest request =
|
if (CheckPresence(userInfo.UserProfile.ID))
|
||||||
new InventoryArchiveReadRequest(userInfo, invPath, loadPath, CommsManager, AssetService);
|
{
|
||||||
UpdateClientWithLoadedNodes(userInfo, request.Execute());
|
InventoryArchiveReadRequest request =
|
||||||
}
|
new InventoryArchiveReadRequest(m_aScene, userInfo, invPath, loadPath);
|
||||||
}
|
UpdateClientWithLoadedNodes(userInfo, request.Execute());
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_log.ErrorFormat(
|
||||||
|
"[INVENTORY ARCHIVER]: User {0} {1} not logged in to this region simulator",
|
||||||
|
userInfo.UserProfile.Name, userInfo.UserProfile.ID);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -193,11 +249,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||||
"[INVENTORY ARCHIVER]: Loading archive {0} to inventory path {1} for {2} {3}",
|
"[INVENTORY ARCHIVER]: Loading archive {0} to inventory path {1} for {2} {3}",
|
||||||
loadPath, invPath, firstName, lastName);
|
loadPath, invPath, firstName, lastName);
|
||||||
|
|
||||||
DearchiveInventory(firstName, lastName, invPath, loadPath);
|
if (DearchiveInventory(firstName, lastName, invPath, loadPath))
|
||||||
|
m_log.InfoFormat(
|
||||||
m_log.InfoFormat(
|
"[INVENTORY ARCHIVER]: Loaded archive {0} for {1} {2}",
|
||||||
"[INVENTORY ARCHIVER]: Loaded archive {0} for {1} {2}",
|
loadPath, firstName, lastName);
|
||||||
loadPath, firstName, lastName);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -261,7 +316,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
protected CachedUserInfo GetUserInfo(string firstName, string lastName)
|
protected CachedUserInfo GetUserInfo(string firstName, string lastName)
|
||||||
{
|
{
|
||||||
CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(firstName, lastName);
|
CachedUserInfo userInfo = m_aScene.CommsManager.UserProfileCacheService.GetUserDetails(firstName, lastName);
|
||||||
if (null == userInfo)
|
if (null == userInfo)
|
||||||
{
|
{
|
||||||
m_log.ErrorFormat(
|
m_log.ErrorFormat(
|
||||||
|
@ -301,5 +356,24 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Check if the given user is present in any of the scenes.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="userId">The user to check</param>
|
||||||
|
/// <returns>true if the user is in any of the scenes, false otherwise</returns>
|
||||||
|
protected bool CheckPresence(UUID userId)
|
||||||
|
{
|
||||||
|
if (DisablePresenceChecks)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
foreach (Scene scene in m_scenes.Values)
|
||||||
|
{
|
||||||
|
if (scene.GetScenePresence(userId) != null)
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,13 +77,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
|
||||||
/// </summary>
|
/// </summary>
|
||||||
// Commenting for now! The mock inventory service needs more beef, at least for
|
// Commenting for now! The mock inventory service needs more beef, at least for
|
||||||
// GetFolderForType
|
// GetFolderForType
|
||||||
//[Test]
|
[Test]
|
||||||
public void TestSaveIarV0_1()
|
public void TestSaveIarV0_1()
|
||||||
{
|
{
|
||||||
TestHelper.InMethod();
|
TestHelper.InMethod();
|
||||||
log4net.Config.XmlConfigurator.Configure();
|
log4net.Config.XmlConfigurator.Configure();
|
||||||
|
|
||||||
InventoryArchiverModule archiverModule = new InventoryArchiverModule();
|
InventoryArchiverModule archiverModule = new InventoryArchiverModule(true);
|
||||||
|
|
||||||
Scene scene = SceneSetupHelpers.SetupScene("Inventory");
|
Scene scene = SceneSetupHelpers.SetupScene("Inventory");
|
||||||
SceneSetupHelpers.SetupSceneModules(scene, archiverModule);
|
SceneSetupHelpers.SetupSceneModules(scene, archiverModule);
|
||||||
|
@ -93,7 +93,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
|
||||||
string userFirstName = "Jock";
|
string userFirstName = "Jock";
|
||||||
string userLastName = "Stirrup";
|
string userLastName = "Stirrup";
|
||||||
UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000020");
|
UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000020");
|
||||||
// CachedUserInfo userInfo;
|
|
||||||
|
|
||||||
lock (this)
|
lock (this)
|
||||||
{
|
{
|
||||||
|
@ -101,9 +100,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
|
||||||
cm, userFirstName, userLastName, userId, InventoryReceived);
|
cm, userFirstName, userLastName, userId, InventoryReceived);
|
||||||
Monitor.Wait(this, 60000);
|
Monitor.Wait(this, 60000);
|
||||||
}
|
}
|
||||||
|
|
||||||
Console.WriteLine("here");
|
|
||||||
|
|
||||||
// Create asset
|
// Create asset
|
||||||
SceneObjectGroup object1;
|
SceneObjectGroup object1;
|
||||||
SceneObjectPart part1;
|
SceneObjectPart part1;
|
||||||
|
@ -136,16 +133,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
|
||||||
item1.Name = "My Little Dog";
|
item1.Name = "My Little Dog";
|
||||||
item1.AssetID = asset1.FullID;
|
item1.AssetID = asset1.FullID;
|
||||||
item1.ID = item1Id;
|
item1.ID = item1Id;
|
||||||
//userInfo.RootFolder.FindFolderByPath("Objects").ID;
|
InventoryFolderBase objsFolder
|
||||||
//InventoryFolderBase objsFolder = scene.InventoryService.GetFolderForType(userId, AssetType.Object);
|
= InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, userId, "Objects");
|
||||||
Console.WriteLine("here2");
|
|
||||||
IInventoryService inventoryService = scene.InventoryService;
|
|
||||||
InventoryFolderBase rootFolder = inventoryService.GetRootFolder(userId);
|
|
||||||
InventoryCollection rootContents = inventoryService.GetFolderContent(userId, rootFolder.ID);
|
|
||||||
InventoryFolderBase objsFolder = null;
|
|
||||||
foreach (InventoryFolderBase folder in rootContents.Folders)
|
|
||||||
if (folder.Name == "Objects")
|
|
||||||
objsFolder = folder;
|
|
||||||
item1.Folder = objsFolder.ID;
|
item1.Folder = objsFolder.ID;
|
||||||
scene.AddInventoryItem(userId, item1);
|
scene.AddInventoryItem(userId, item1);
|
||||||
|
|
||||||
|
@ -155,7 +144,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
|
||||||
mre.Reset();
|
mre.Reset();
|
||||||
archiverModule.ArchiveInventory(
|
archiverModule.ArchiveInventory(
|
||||||
Guid.NewGuid(), userFirstName, userLastName, "Objects", archiveWriteStream);
|
Guid.NewGuid(), userFirstName, userLastName, "Objects", archiveWriteStream);
|
||||||
mre.WaitOne();
|
mre.WaitOne(60000, false);
|
||||||
|
|
||||||
byte[] archive = archiveWriteStream.ToArray();
|
byte[] archive = archiveWriteStream.ToArray();
|
||||||
MemoryStream archiveReadStream = new MemoryStream(archive);
|
MemoryStream archiveReadStream = new MemoryStream(archive);
|
||||||
|
@ -257,7 +246,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
|
||||||
|
|
||||||
MemoryStream archiveReadStream = new MemoryStream(archiveWriteStream.ToArray());
|
MemoryStream archiveReadStream = new MemoryStream(archiveWriteStream.ToArray());
|
||||||
SerialiserModule serialiserModule = new SerialiserModule();
|
SerialiserModule serialiserModule = new SerialiserModule();
|
||||||
InventoryArchiverModule archiverModule = new InventoryArchiverModule();
|
InventoryArchiverModule archiverModule = new InventoryArchiverModule(true);
|
||||||
|
|
||||||
// Annoyingly, we have to set up a scene even though inventory loading has nothing to do with a scene
|
// Annoyingly, we have to set up a scene even though inventory loading has nothing to do with a scene
|
||||||
Scene scene = SceneSetupHelpers.SetupScene("inventory");
|
Scene scene = SceneSetupHelpers.SetupScene("inventory");
|
||||||
|
@ -275,7 +264,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
|
||||||
CachedUserInfo userInfo
|
CachedUserInfo userInfo
|
||||||
= scene.CommsManager.UserProfileCacheService.GetUserDetails(userFirstName, userLastName);
|
= scene.CommsManager.UserProfileCacheService.GetUserDetails(userFirstName, userLastName);
|
||||||
|
|
||||||
InventoryItemBase foundItem = userInfo.RootFolder.FindItemByPath(itemName);
|
InventoryItemBase foundItem
|
||||||
|
= InventoryArchiveUtils.FindItemByPath(scene.InventoryService, userInfo.UserProfile.ID, itemName);
|
||||||
|
|
||||||
Assert.That(foundItem, Is.Not.Null, "Didn't find loaded item");
|
Assert.That(foundItem, Is.Not.Null, "Didn't find loaded item");
|
||||||
Assert.That(
|
Assert.That(
|
||||||
foundItem.CreatorId, Is.EqualTo(item1.CreatorId),
|
foundItem.CreatorId, Is.EqualTo(item1.CreatorId),
|
||||||
|
@ -325,7 +316,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
|
||||||
|
|
||||||
MemoryStream archiveReadStream = new MemoryStream(archiveWriteStream.ToArray());
|
MemoryStream archiveReadStream = new MemoryStream(archiveWriteStream.ToArray());
|
||||||
SerialiserModule serialiserModule = new SerialiserModule();
|
SerialiserModule serialiserModule = new SerialiserModule();
|
||||||
InventoryArchiverModule archiverModule = new InventoryArchiverModule();
|
InventoryArchiverModule archiverModule = new InventoryArchiverModule(true);
|
||||||
|
|
||||||
// Annoyingly, we have to set up a scene even though inventory loading has nothing to do with a scene
|
// Annoyingly, we have to set up a scene even though inventory loading has nothing to do with a scene
|
||||||
Scene scene = SceneSetupHelpers.SetupScene();
|
Scene scene = SceneSetupHelpers.SetupScene();
|
||||||
|
@ -385,9 +376,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
|
||||||
Monitor.Wait(this, 60000);
|
Monitor.Wait(this, 60000);
|
||||||
}
|
}
|
||||||
|
|
||||||
Console.WriteLine("userInfo.RootFolder 1: {0}", userInfo.RootFolder);
|
//Console.WriteLine("userInfo.RootFolder 1: {0}", userInfo.RootFolder);
|
||||||
|
|
||||||
Dictionary <string, InventoryFolderImpl> foldersCreated = new Dictionary<string, InventoryFolderImpl>();
|
Dictionary <string, InventoryFolderBase> foldersCreated = new Dictionary<string, InventoryFolderBase>();
|
||||||
List<InventoryNodeBase> nodesLoaded = new List<InventoryNodeBase>();
|
List<InventoryNodeBase> nodesLoaded = new List<InventoryNodeBase>();
|
||||||
|
|
||||||
string folder1Name = "a";
|
string folder1Name = "a";
|
||||||
|
@ -405,17 +396,20 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
|
||||||
"{0}{1}/{2}/{3}",
|
"{0}{1}/{2}/{3}",
|
||||||
ArchiveConstants.INVENTORY_PATH, folder1ArchiveName, folder2ArchiveName, itemName);
|
ArchiveConstants.INVENTORY_PATH, folder1ArchiveName, folder2ArchiveName, itemName);
|
||||||
|
|
||||||
Console.WriteLine("userInfo.RootFolder 2: {0}", userInfo.RootFolder);
|
//Console.WriteLine("userInfo.RootFolder 2: {0}", userInfo.RootFolder);
|
||||||
|
|
||||||
new InventoryArchiveReadRequest(userInfo, null, (Stream)null, null, null)
|
new InventoryArchiveReadRequest(scene, userInfo, null, (Stream)null)
|
||||||
.ReplicateArchivePathToUserInventory(
|
.ReplicateArchivePathToUserInventory(
|
||||||
itemArchivePath, false, userInfo.RootFolder, foldersCreated, nodesLoaded);
|
itemArchivePath, false, scene.InventoryService.GetRootFolder(userInfo.UserProfile.ID),
|
||||||
|
foldersCreated, nodesLoaded);
|
||||||
|
|
||||||
Console.WriteLine("userInfo.RootFolder 3: {0}", userInfo.RootFolder);
|
//Console.WriteLine("userInfo.RootFolder 3: {0}", userInfo.RootFolder);
|
||||||
InventoryFolderImpl folder1 = userInfo.RootFolder.FindFolderByPath("a");
|
//InventoryFolderImpl folder1 = userInfo.RootFolder.FindFolderByPath("a");
|
||||||
|
InventoryFolderBase folder1
|
||||||
|
= InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, userInfo.UserProfile.ID, "a");
|
||||||
Assert.That(folder1, Is.Not.Null, "Could not find folder a");
|
Assert.That(folder1, Is.Not.Null, "Could not find folder a");
|
||||||
InventoryFolderImpl folder2 = folder1.FindFolderByPath("b");
|
InventoryFolderBase folder2 = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1, "b");
|
||||||
Assert.That(folder2, Is.Not.Null, "Could not find folder b");
|
Assert.That(folder2, Is.Not.Null, "Could not find folder b");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -58,14 +58,14 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
||||||
|
|
||||||
public void Initialise(IConfigSource source)
|
public void Initialise(IConfigSource source)
|
||||||
{
|
{
|
||||||
m_log.Info("[ARCHIVER] Initialising");
|
//m_log.Debug("[ARCHIVER] Initialising");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddRegion(Scene scene)
|
public void AddRegion(Scene scene)
|
||||||
{
|
{
|
||||||
m_scene = scene;
|
m_scene = scene;
|
||||||
m_scene.RegisterModuleInterface<IRegionArchiverModule>(this);
|
m_scene.RegisterModuleInterface<IRegionArchiverModule>(this);
|
||||||
m_log.InfoFormat("[ARCHIVER]: Enabled for region {0}", scene.RegionInfo.RegionName);
|
//m_log.DebugFormat("[ARCHIVER]: Enabled for region {0}", scene.RegionInfo.RegionName);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RegionLoaded(Scene scene)
|
public void RegionLoaded(Scene scene)
|
||||||
|
|
|
@ -56,8 +56,9 @@ namespace OpenSim.Region.Framework.Interfaces
|
||||||
/// <param name="firstName"></param>
|
/// <param name="firstName"></param>
|
||||||
/// <param name="lastName"></param>
|
/// <param name="lastName"></param>
|
||||||
/// <param name="invPath">The inventory path in which to place the loaded folders and items</param>
|
/// <param name="invPath">The inventory path in which to place the loaded folders and items</param>
|
||||||
/// <param name="loadStream">The stream from which the inventory archive will be loaded</param>
|
/// <param name="loadStream">The stream from which the inventory archive will be loaded</param>
|
||||||
void DearchiveInventory(string firstName, string lastName, string invPath, Stream loadStream);
|
/// <returns>true if the first stage of the operation succeeded, false otherwise</returns>
|
||||||
|
bool DearchiveInventory(string firstName, string lastName, string invPath, Stream loadStream);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Archive a user's inventory folder to the given stream
|
/// Archive a user's inventory folder to the given stream
|
||||||
|
@ -67,6 +68,7 @@ namespace OpenSim.Region.Framework.Interfaces
|
||||||
/// <param name="lastName"></param>
|
/// <param name="lastName"></param>
|
||||||
/// <param name="invPath">The inventory path from which the inventory should be saved.</param>
|
/// <param name="invPath">The inventory path from which the inventory should be saved.</param>
|
||||||
/// <param name="saveStream">The stream to which the inventory archive will be saved</param>
|
/// <param name="saveStream">The stream to which the inventory archive will be saved</param>
|
||||||
void ArchiveInventory(Guid id, string firstName, string lastName, string invPath, Stream saveStream);
|
/// <returns>true if the first stage of the operation succeeded, false otherwise</returns>
|
||||||
|
bool ArchiveInventory(Guid id, string firstName, string lastName, string invPath, Stream saveStream);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -476,9 +476,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
// normalize an angle between -PI and PI (-180 to +180 degrees)
|
// normalize an angle between -PI and PI (-180 to +180 degrees)
|
||||||
protected double NormalizeAngle(double angle)
|
protected double NormalizeAngle(double angle)
|
||||||
{
|
{
|
||||||
angle = angle % (Math.PI * 2);
|
if (angle > -Math.PI && angle < Math.PI)
|
||||||
// if (angle < 0) angle = angle + Math.PI * 2;
|
return angle;
|
||||||
return angle;
|
|
||||||
|
int numPis = (int)(Math.PI / angle);
|
||||||
|
double remainder = angle - Math.PI * numPis;
|
||||||
|
if (numPis % 2 == 1)
|
||||||
|
return Math.PI - angle;
|
||||||
|
return remainder;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Old implementation of llRot2Euler, now normalized
|
// Old implementation of llRot2Euler, now normalized
|
||||||
|
@ -497,9 +502,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
NormalizeAngle(Math.Atan2(n, Math.Sqrt(p))),
|
NormalizeAngle(Math.Atan2(n, Math.Sqrt(p))),
|
||||||
NormalizeAngle(Math.Atan2(2.0 * (r.z * r.s - r.x * r.y), (t.x - t.y - t.z + t.s))));
|
NormalizeAngle(Math.Atan2(2.0 * (r.z * r.s - r.x * r.y), (t.x - t.y - t.z + t.s))));
|
||||||
else if (n > 0)
|
else if (n > 0)
|
||||||
return new LSL_Vector(0.0, Math.PI / 2, NormalizeAngle(Math.Atan2((r.z * r.s + r.x * r.y), 0.5 - t.x - t.z)));
|
return new LSL_Vector(0.0, Math.PI * 0.5, NormalizeAngle(Math.Atan2((r.z * r.s + r.x * r.y), 0.5 - t.x - t.z)));
|
||||||
else
|
else
|
||||||
return new LSL_Vector(0.0, -Math.PI / 2, NormalizeAngle(Math.Atan2((r.z * r.s + r.x * r.y), 0.5 - t.x - t.z)));
|
return new LSL_Vector(0.0, -Math.PI * 0.5, NormalizeAngle(Math.Atan2((r.z * r.s + r.x * r.y), 0.5 - t.x - t.z)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* From wiki:
|
/* From wiki:
|
||||||
|
@ -553,12 +558,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
|
|
||||||
double x,y,z,s;
|
double x,y,z,s;
|
||||||
|
|
||||||
double c1 = Math.Cos(v.x/2.0);
|
double c1 = Math.Cos(v.x * 0.5);
|
||||||
double c2 = Math.Cos(v.y/2.0);
|
double c2 = Math.Cos(v.y * 0.5);
|
||||||
double c3 = Math.Cos(v.z/2.0);
|
double c3 = Math.Cos(v.z * 0.5);
|
||||||
double s1 = Math.Sin(v.x/2.0);
|
double s1 = Math.Sin(v.x * 0.5);
|
||||||
double s2 = Math.Sin(v.y/2.0);
|
double s2 = Math.Sin(v.y * 0.5);
|
||||||
double s3 = Math.Sin(v.z/2.0);
|
double s3 = Math.Sin(v.z * 0.5);
|
||||||
|
|
||||||
x = s1*c2*c3+c1*s2*s3;
|
x = s1*c2*c3+c1*s2*s3;
|
||||||
y = c1*s2*c3-s1*c2*s3;
|
y = c1*s2*c3-s1*c2*s3;
|
||||||
|
|
|
@ -112,7 +112,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
|
||||||
if (!inits.ContainsKey(api))
|
if (!inits.ContainsKey(api))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ILease lease = (ILease)RemotingServices.GetLifetimeService(data as MarshalByRefObject);
|
//ILease lease = (ILease)RemotingServices.GetLifetimeService(data as MarshalByRefObject);
|
||||||
|
RemotingServices.GetLifetimeService(data as MarshalByRefObject);
|
||||||
// lease.Register(m_sponser);
|
// lease.Register(m_sponser);
|
||||||
|
|
||||||
MethodInfo mi = inits[api];
|
MethodInfo mi = inits[api];
|
||||||
|
|
|
@ -260,7 +260,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
||||||
Path.GetFileNameWithoutExtension(assembly),
|
Path.GetFileNameWithoutExtension(assembly),
|
||||||
"SecondLife.Script");
|
"SecondLife.Script");
|
||||||
|
|
||||||
ILease lease = (ILease)RemotingServices.GetLifetimeService(m_Script as ScriptBaseClass);
|
//ILease lease = (ILease)RemotingServices.GetLifetimeService(m_Script as ScriptBaseClass);
|
||||||
|
RemotingServices.GetLifetimeService(m_Script as ScriptBaseClass);
|
||||||
// lease.Register(this);
|
// lease.Register(this);
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
|
|
|
@ -84,7 +84,17 @@ namespace OpenSim.Tests.Common.Mock
|
||||||
|
|
||||||
public List<InventoryItemBase> getInventoryInFolder(UUID folderID)
|
public List<InventoryItemBase> getInventoryInFolder(UUID folderID)
|
||||||
{
|
{
|
||||||
return new List<InventoryItemBase>();
|
m_log.DebugFormat("[MOCK INV DB]: Getting items in folder {0}", folderID);
|
||||||
|
|
||||||
|
List<InventoryItemBase> items = new List<InventoryItemBase>();
|
||||||
|
|
||||||
|
foreach (InventoryItemBase item in m_items.Values)
|
||||||
|
{
|
||||||
|
if (item.Folder == folderID)
|
||||||
|
items.Add(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
return items;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<InventoryFolderBase> getUserRootFolders(UUID user) { return null; }
|
public List<InventoryFolderBase> getUserRootFolders(UUID user) { return null; }
|
||||||
|
@ -154,7 +164,13 @@ namespace OpenSim.Tests.Common.Mock
|
||||||
m_folders.Remove(folderId);
|
m_folders.Remove(folderId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addInventoryItem(InventoryItemBase item) { m_items[item.ID] = item; }
|
public void addInventoryItem(InventoryItemBase item)
|
||||||
|
{
|
||||||
|
m_log.DebugFormat(
|
||||||
|
"[MOCK INV DB]: Adding inventory item {0} {1} in {2}", item.Name, item.ID, item.Folder);
|
||||||
|
|
||||||
|
m_items[item.ID] = item;
|
||||||
|
}
|
||||||
|
|
||||||
public void updateInventoryItem(InventoryItemBase item) { addInventoryItem(item); }
|
public void updateInventoryItem(InventoryItemBase item) { addInventoryItem(item); }
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue