[mapguide-commits] r6210 - trunk/Tools/Maestro/Maestro.Packaging
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Tue Nov 8 10:36:41 EST 2011
Author: jng
Date: 2011-11-08 07:36:41 -0800 (Tue, 08 Nov 2011)
New Revision: 6210
Modified:
trunk/Tools/Maestro/Maestro.Packaging/PackageBuilder.cs
trunk/Tools/Maestro/Maestro.Packaging/PackageUploadResultDialog.cs
trunk/Tools/Maestro/Maestro.Packaging/UploadPackageResult.cs
Log:
#1820: Non-transactional package loading fixes:
- Skip any SETRESOURCE package operations where there is non-existent content
- Include exception details in failed package operations
Modified: trunk/Tools/Maestro/Maestro.Packaging/PackageBuilder.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Packaging/PackageBuilder.cs 2011-11-08 15:08:40 UTC (rev 6209)
+++ trunk/Tools/Maestro/Maestro.Packaging/PackageBuilder.cs 2011-11-08 15:36:41 UTC (rev 6210)
@@ -211,42 +211,49 @@
case "SETRESOURCE":
{
SetResourcePackageOperation sop = (SetResourcePackageOperation)op;
- ZipEntry contentEntry = package.GetEntry(sop.Content);
- ZipEntry headerEntry = null;
+ if (sop.Content == null)
+ {
+ skipOps[sop] = sop;
+ }
+ else
+ {
+ ZipEntry contentEntry = package.GetEntry(sop.Content);
+ ZipEntry headerEntry = null;
- if (!string.IsNullOrEmpty(sop.Header))
- headerEntry = package.GetEntry(sop.Header);
+ if (!string.IsNullOrEmpty(sop.Header))
+ headerEntry = package.GetEntry(sop.Header);
- try
- {
- using (var s = package.GetInputStream(contentEntry))
+ try
{
- m_connection.ResourceService.SetResourceXmlData(op.ResourceId, s);
- progress(ProgressType.SetResource, op.ResourceId, 100, step);
- }
+ using (var s = package.GetInputStream(contentEntry))
+ {
+ m_connection.ResourceService.SetResourceXmlData(op.ResourceId, s);
+ progress(ProgressType.SetResource, op.ResourceId, 100, step);
+ }
- if (headerEntry != null)
- {
- using (var s = package.GetInputStream(headerEntry))
+ if (headerEntry != null)
{
- using (var sr = new StreamReader(s))
+ using (var s = package.GetInputStream(headerEntry))
{
- ResourceDocumentHeaderType header = ResourceDocumentHeaderType.Deserialize(sr.ReadToEnd());
- m_connection.ResourceService.SetResourceHeader(op.ResourceId, header);
- progress(ProgressType.SetResource, op.ResourceId, 100, step);
+ using (var sr = new StreamReader(s))
+ {
+ ResourceDocumentHeaderType header = ResourceDocumentHeaderType.Deserialize(sr.ReadToEnd());
+ m_connection.ResourceService.SetResourceHeader(op.ResourceId, header);
+ progress(ProgressType.SetResource, op.ResourceId, 100, step);
+ }
}
}
+
+ result.Successful.Add(op);
}
-
- result.Successful.Add(op);
+ catch (Exception ex)
+ {
+ //We don't really care about the header. We consider failure if the
+ //content upload did not succeed
+ if (!m_connection.ResourceService.ResourceExists(op.ResourceId))
+ result.Failed.Add(op, ex);
+ }
}
- catch (Exception)
- {
- //We don't really care about the header. We consider failure if the
- //content upload did not succeed
- if (!m_connection.ResourceService.ResourceExists(op.ResourceId))
- result.Failed.Add(op);
- }
}
break;
case "SETRESOURCEDATA":
@@ -264,7 +271,7 @@
result.Successful.Add(op);
}
- catch (Exception)
+ catch (Exception ex)
{
var resData = m_connection.ResourceService.EnumerateResourceData(sop.ResourceId);
bool found = false;
@@ -279,7 +286,7 @@
}
if (!found)
- result.Failed.Add(sop);
+ result.Failed.Add(sop, ex);
}
}
break;
@@ -1180,7 +1187,7 @@
unchecked
{
int hash = 17;
- hash = hash * 23 + this.Content.GetHashCode();
+ hash = hash * 23 + (this.Content ?? "").GetHashCode();
if (this.Header != null)
hash = hash * 23 + this.Header.GetHashCode();
hash = hash * 23 + this.OperationName.GetHashCode();
Modified: trunk/Tools/Maestro/Maestro.Packaging/PackageUploadResultDialog.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Packaging/PackageUploadResultDialog.cs 2011-11-08 15:08:40 UTC (rev 6209)
+++ trunk/Tools/Maestro/Maestro.Packaging/PackageUploadResultDialog.cs 2011-11-08 15:36:41 UTC (rev 6210)
@@ -43,7 +43,14 @@
lblFailed.Text = string.Format(Properties.Resources.PackageOperationsFailed, result.Failed.Count);
lblSkipped.Text = string.Format(Properties.Resources.PackageOperationsSkipped, result.SkipOperations.Count);
lblSucceeded.Text = string.Format(Properties.Resources.PackageOperationsSucceeded, result.Successful.Count);
- grdFailed.DataSource = result.Failed;
+ //grdFailed.DataSource = result.Failed;
+ grdFailed.Columns.Add("Resource ID", "Resource ID");
+ grdFailed.Columns.Add("Operation", "Operation");
+ grdFailed.Columns.Add("Error", "Error");
+ foreach (var op in result.Failed.Keys)
+ {
+ grdFailed.Rows.Add(op.ResourceId, op.OperationName, result.Failed[op].ToString());
+ }
}
private void btnClose_Click(object sender, EventArgs e)
Modified: trunk/Tools/Maestro/Maestro.Packaging/UploadPackageResult.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Packaging/UploadPackageResult.cs 2011-11-08 15:08:40 UTC (rev 6209)
+++ trunk/Tools/Maestro/Maestro.Packaging/UploadPackageResult.cs 2011-11-08 15:36:41 UTC (rev 6210)
@@ -27,7 +27,7 @@
{
public ICollection<PackageOperation> Successful { get; private set; }
- public ICollection<PackageOperation> Failed { get; private set; }
+ public Dictionary<PackageOperation, Exception> Failed { get; private set; }
public ICollection<PackageOperation> SkipOperations { get; private set; }
@@ -36,7 +36,7 @@
public UploadPackageResult(IEnumerable<PackageOperation> skip)
{
this.Successful = new List<PackageOperation>();
- this.Failed = new List<PackageOperation>();
+ this.Failed = new Dictionary<PackageOperation, Exception>();
this.SkipOperations = new List<PackageOperation>(skip);
}
}
More information about the mapguide-commits
mailing list