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

prebuild-update
Melanie 2010-07-14 23:04:25 +01:00
commit 466254105c
5 changed files with 215 additions and 168 deletions

View File

@ -3,19 +3,10 @@
<Import assembly="OpenSim.Data.dll" /> <Import assembly="OpenSim.Data.dll" />
<Import assembly="OpenSim.Framework.dll" /> <Import assembly="OpenSim.Framework.dll" />
</Runtime> </Runtime>
<ExtensionPoint path = "/OpenSim/GridData">
<ExtensionNode name="Plugin" type="OpenSim.Framework.PluginExtensionNode" objectType="OpenSim.Data.IGridDataPlugin" />
</ExtensionPoint>
<ExtensionPoint path = "/OpenSim/LogData">
<ExtensionNode name="Plugin" type="OpenSim.Framework.PluginExtensionNode" objectType="OpenSim.Data.ILogDataPlugin" />
</ExtensionPoint>
<ExtensionPoint path = "/OpenSim/AssetData"> <ExtensionPoint path = "/OpenSim/AssetData">
<ExtensionNode name="Plugin" type="OpenSim.Framework.PluginExtensionNode" objectType="OpenSim.Data.IAssetDataPlugin" /> <ExtensionNode name="Plugin" type="OpenSim.Framework.PluginExtensionNode" objectType="OpenSim.Data.IAssetDataPlugin" />
</ExtensionPoint> </ExtensionPoint>
<ExtensionPoint path = "/OpenSim/InventoryData"> <ExtensionPoint path = "/OpenSim/InventoryData">
<ExtensionNode name="Plugin" type="OpenSim.Framework.PluginExtensionNode" objectType="OpenSim.Data.IInventoryDataPlugin" /> <ExtensionNode name="Plugin" type="OpenSim.Framework.PluginExtensionNode" objectType="OpenSim.Data.IInventoryDataPlugin" />
</ExtensionPoint> </ExtensionPoint>
<ExtensionPoint path = "/OpenSim/UserData">
<ExtensionNode name="Plugin" type="OpenSim.Framework.PluginExtensionNode" objectType="OpenSim.Data.IUserDataPlugin" />
</ExtensionPoint>
</Addin> </Addin>

View File

@ -92,6 +92,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
/// returned /// returned
/// </returns> /// </returns>
public List<InventoryNodeBase> Execute() public List<InventoryNodeBase> Execute()
{
try
{ {
string filePath = "ERROR"; string filePath = "ERROR";
int successfulAssetRestores = 0; int successfulAssetRestores = 0;
@ -122,8 +124,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
byte[] data; byte[] data;
TarArchiveReader.TarEntryType entryType; TarArchiveReader.TarEntryType entryType;
try
{
while ((data = archive.ReadEntry(out filePath, out entryType)) != null) while ((data = archive.ReadEntry(out filePath, out entryType)) != null)
{ {
if (filePath.StartsWith(ArchiveConstants.ASSETS_PATH)) if (filePath.StartsWith(ArchiveConstants.ASSETS_PATH))
@ -166,11 +166,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
} }
} }
} }
}
finally
{
archive.Close(); archive.Close();
}
m_log.DebugFormat( m_log.DebugFormat(
"[INVENTORY ARCHIVER]: Successfully loaded {0} assets with {1} failures", "[INVENTORY ARCHIVER]: Successfully loaded {0} assets with {1} failures",
@ -179,6 +176,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
return loadedNodes; return loadedNodes;
} }
finally
{
m_loadStream.Close();
}
}
public void Close() public void Close()
{ {
@ -247,7 +249,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
ref string archivePath, ref string archivePath,
Dictionary <string, InventoryFolderBase> resolvedFolders) Dictionary <string, InventoryFolderBase> resolvedFolders)
{ {
string originalArchivePath = archivePath; // string originalArchivePath = archivePath;
InventoryFolderBase destFolder = null; InventoryFolderBase destFolder = null;

View File

@ -126,15 +126,17 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
// We're almost done. Just need to write out the control file now // We're almost done. Just need to write out the control file now
m_archiveWriter.WriteFile(ArchiveConstants.CONTROL_FILE_PATH, Create0p1ControlFile()); m_archiveWriter.WriteFile(ArchiveConstants.CONTROL_FILE_PATH, Create0p1ControlFile());
m_log.InfoFormat("[ARCHIVER]: Added control file to archive."); m_log.InfoFormat("[ARCHIVER]: Added control file to archive.");
m_archiveWriter.Close(); m_archiveWriter.Close();
} }
catch (Exception e) catch (Exception e)
{ {
m_saveStream.Close();
reportedException = e; reportedException = e;
succeeded = false; succeeded = false;
} }
finally
{
m_saveStream.Close();
}
m_module.TriggerInventoryArchiveSaved( m_module.TriggerInventoryArchiveSaved(
m_id, succeeded, m_userInfo, m_invPath, m_saveStream, reportedException); m_id, succeeded, m_userInfo, m_invPath, m_saveStream, reportedException);
@ -212,6 +214,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
/// Execute the inventory write request /// Execute the inventory write request
/// </summary> /// </summary>
public void Execute() public void Execute()
{
try
{ {
InventoryFolderBase inventoryFolder = null; InventoryFolderBase inventoryFolder = null;
InventoryItemBase inventoryItem = null; InventoryItemBase inventoryItem = null;
@ -266,17 +270,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
{ {
// We couldn't find the path indicated // We couldn't find the path indicated
string errorMessage = string.Format("Aborted save. Could not find inventory path {0}", m_invPath); string errorMessage = string.Format("Aborted save. Could not find inventory path {0}", m_invPath);
m_log.ErrorFormat("[INVENTORY ARCHIVER]: {0}", errorMessage); Exception e = new InventoryArchiverException(errorMessage);
m_module.TriggerInventoryArchiveSaved( m_module.TriggerInventoryArchiveSaved(m_id, false, m_userInfo, m_invPath, m_saveStream, e);
m_id, false, m_userInfo, m_invPath, m_saveStream, throw e;
new Exception(errorMessage));
return;
} }
m_archiveWriter = new TarArchiveWriter(m_saveStream); m_archiveWriter = new TarArchiveWriter(m_saveStream);
try
{
if (inventoryFolder != null) if (inventoryFolder != null)
{ {
m_log.DebugFormat( m_log.DebugFormat(
@ -297,16 +297,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
// Don't put all this profile information into the archive right now. // Don't put all this profile information into the archive right now.
//SaveUsers(); //SaveUsers();
new AssetsRequest(
new AssetsArchiver(m_archiveWriter), m_assetUuids, m_scene.AssetService, ReceivedAllAssets).Execute();
} }
catch (Exception) catch (Exception)
{ {
m_archiveWriter.Close(); m_saveStream.Close();
throw; throw;
} }
new AssetsRequest(
new AssetsArchiver(m_archiveWriter), m_assetUuids,
m_scene.AssetService, ReceivedAllAssets).Execute();
} }
/// <summary> /// <summary>

View File

@ -0,0 +1,40 @@
/*
* 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;
namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
{
/// <summary>
/// Signals an inventory archiving problem
/// </summary>
public class InventoryArchiverException : Exception
{
public InventoryArchiverException(string message) : base(message) {}
public InventoryArchiverException(string message, Exception e) : base(message, e) {}
}
}

View File

@ -321,6 +321,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
/// </summary> /// </summary>
/// <param name="cmdparams"></param> /// <param name="cmdparams"></param>
protected void HandleLoadInvConsoleCommand(string module, string[] cmdparams) protected void HandleLoadInvConsoleCommand(string module, string[] cmdparams)
{
try
{ {
m_log.Info("[INVENTORY ARCHIVER]: PLEASE NOTE THAT THIS FACILITY IS EXPERIMENTAL. BUG REPORTS WELCOME."); m_log.Info("[INVENTORY ARCHIVER]: PLEASE NOTE THAT THIS FACILITY IS EXPERIMENTAL. BUG REPORTS WELCOME.");
@ -351,12 +353,21 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
"[INVENTORY ARCHIVER]: Loaded archive {0} for {1} {2}", "[INVENTORY ARCHIVER]: Loaded archive {0} for {1} {2}",
loadPath, firstName, lastName); loadPath, firstName, lastName);
} }
catch (InventoryArchiverException e)
{
m_log.ErrorFormat("[INVENTORY ARCHIVER]: {0}", e.Message);
}
}
/// <summary> /// <summary>
/// Save inventory to a file archive /// Save inventory to a file archive
/// </summary> /// </summary>
/// <param name="cmdparams"></param> /// <param name="cmdparams"></param>
protected void HandleSaveInvConsoleCommand(string module, string[] cmdparams) protected void HandleSaveInvConsoleCommand(string module, string[] cmdparams)
{
Guid id = Guid.NewGuid();
try
{ {
if (cmdparams.Length < 6) if (cmdparams.Length < 6)
{ {
@ -377,8 +388,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
"[INVENTORY ARCHIVER]: Saving archive {0} using inventory path {1} for {2} {3}", "[INVENTORY ARCHIVER]: Saving archive {0} using inventory path {1} for {2} {3}",
savePath, invPath, firstName, lastName); savePath, invPath, firstName, lastName);
Guid id = Guid.NewGuid();
ArchiveInventory(id, firstName, lastName, invPath, pass, savePath, new Dictionary<string, object>()); ArchiveInventory(id, firstName, lastName, invPath, pass, savePath, new Dictionary<string, object>());
}
catch (InventoryArchiverException e)
{
m_log.ErrorFormat("[INVENTORY ARCHIVER]: {0}", e.Message);
}
lock (m_pendingConsoleSaves) lock (m_pendingConsoleSaves)
m_pendingConsoleSaves.Add(id); m_pendingConsoleSaves.Add(id);