Skip to content

Commit 45c8bc2

Browse files
committed
Merge branch 'release-1.5.0.0'
2 parents 2683447 + 8a4adcc commit 45c8bc2

28 files changed

+462
-288
lines changed

Build/Build.proj

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,26 @@
11
<Project DefaultTargets="GenerateMsi" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
22
<Import Project="$(MSBuildExtensionsPath)\BtsMsiTask\BtsMsiTask.targets" />
3+
<Import Project="$(MSBuildExtensionsPath)\ExtensionPack\4.0\MSBuild.ExtensionPack.tasks"/>
34
<PropertyGroup>
45
<DestinationPath>.</DestinationPath>
56
<ApplicationName>BizTalkComponents.PipelineComponents.ManageMessageNamespace</ApplicationName>
67
</PropertyGroup>
78
<ItemGroup>
89
<Resource Include="..\Src\ManageMessageNamespace\bin\Debug\BizTalkComponents.PipelineComponents.ManageMessageNamespace.dll" />
910
</ItemGroup>
10-
11-
<Target Name="GenerateMsi">
12-
<MsiTask
13-
FileName="$(FileName)"
11+
12+
<Target Name="GetVersion">
13+
<MSBuild.ExtensionPack.Framework.Assembly TaskAction="GetInfo" NetAssembly="..\Src\ManageMessageNamespace\bin\Debug\BizTalkComponents.PipelineComponents.ManageMessageNamespace.dll">
14+
<Output TaskParameter="OutputItems" ItemName="Info"/>
15+
</MSBuild.ExtensionPack.Framework.Assembly>
16+
</Target>
17+
18+
<Target Name="GenerateMsi" DependsOnTargets="GetVersion">
19+
<MsiTask
20+
FileName="BizTalkComponents.PipelineComponents.ManageMessageNamespace%(Info.AssemblyInformationalVersion).msi"
1421
DestinationPath="$(DestinationPath)"
1522
ApplicationName="$(ApplicationName)"
23+
SourceLocation="C:\%(Info.AssemblyInformationalVersion)"
1624
Resources="@(Resource)" />
17-
</Target>
25+
</Target>
1826
</Project>

LICENSE.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2015 iBiz Solutions
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

Src/ManageMessageNamespace/AddNamespaceComponent.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using System;
66
using System.ComponentModel;
77
using System.IO;
8+
using BizTalkComponents.PipelineComponents.ManageMessageNamespace.Streams;
89

910
namespace BizTalkComponents.PipelineComponents.ManageMessageNamespace
1011
{
@@ -88,19 +89,21 @@ public IBaseMessage Execute(IPipelineContext pContext, IBaseMessage pInMsg)
8889
var contentReader = new ContentReader();
8990

9091
var data = pInMsg.BodyPart.GetOriginalDataStream();
92+
const int bufferSize = 0x280;
93+
const int thresholdSize = 0x100000;
9194

9295
if (!data.CanSeek || !data.CanRead)
9396
{
94-
const int bufferSize = 0x280;
95-
const int thresholdSize = 0x100000;
97+
9698
data = new ReadOnlySeekableStream(data, new VirtualStream(bufferSize, thresholdSize), bufferSize);
9799
pContext.ResourceTracker.AddResource(data);
98100
}
99101

100102
if (contentReader.IsXmlContent(data))
101103
{
102104
var encoding = contentReader.Encoding(data);
103-
data = new ContentWriter().AddNamespace(data, NewNamespace, NamespaceForm, XPath, encoding);
105+
data = new XmlNamespaceAdder(data, XPath, NamespaceForm, NewNamespace, encoding);
106+
data = new ReadOnlySeekableStream(data, new VirtualStream(bufferSize, thresholdSize), bufferSize);
104107
pContext.ResourceTracker.AddResource(data);
105108
pInMsg.BodyPart.Data = data;
106109

Src/ManageMessageNamespace/BizTalkComponents.ManageMessageNamespace.nuspec

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22
<package>
33
<metadata>
44
<id>BizTalkComponents.PipelineComponents.ManageMessageNamespace</id>
5-
<version>1.0.0.0</version>
6-
<authors>riha</authors>
7-
<owners>ibizsolutions</owners>
8-
<description>Shared.PipelineComponents.ManageMessageNamespace</description>
5+
<version>$version$</version>
6+
<authors>Richard Hallgren</authors>
7+
<requireLicenseAcceptance>false</requireLicenseAcceptance>
8+
<projectUrl>https://github.com/BizTalkComponents/ManageMessageNamespace</projectUrl>
9+
<description>BizTalkComponents.PipelineComponents.ManageMessageNamespace</description>
910
</metadata>
1011
</package>

Src/ManageMessageNamespace/BizTalkComponents.PipelineComponents.ManageMessageNamespace.csproj

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@
4343
<AssemblyOriginatorKeyFile>BizTalkComponents.PipelineComponents.ManageMessageNamespace.snk</AssemblyOriginatorKeyFile>
4444
</PropertyGroup>
4545
<ItemGroup>
46+
<Reference Include="Microsoft.BizTalk.GlobalPropertySchemas, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
47+
<SpecificVersion>False</SpecificVersion>
48+
<HintPath>..\..\..\..\..\Program Files (x86)\Microsoft BizTalk Server 2013\Microsoft.BizTalk.GlobalPropertySchemas.dll</HintPath>
49+
</Reference>
4650
<Reference Include="Microsoft.BizTalk.Pipeline, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
4751
<SpecificVersion>False</SpecificVersion>
4852
<HintPath>..\..\..\..\..\..\Program Files (x86)\Microsoft BizTalk Server 2013\Microsoft.BizTalk.Pipeline.dll</HintPath>
@@ -51,6 +55,10 @@
5155
<SpecificVersion>False</SpecificVersion>
5256
<HintPath>..\..\..\..\..\..\Program Files (x86)\Microsoft BizTalk Server 2013\Microsoft.BizTalk.Streaming.dll</HintPath>
5357
</Reference>
58+
<Reference Include="Microsoft.XLANGs.BaseTypes, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
59+
<SpecificVersion>False</SpecificVersion>
60+
<HintPath>..\..\..\..\..\Program Files (x86)\Microsoft BizTalk Server 2013\Microsoft.XLANGs.BaseTypes.dll</HintPath>
61+
</Reference>
5462
<Reference Include="System" />
5563
<Reference Include="System.ComponentModel.DataAnnotations" />
5664
<Reference Include="System.Core" />
@@ -68,7 +76,6 @@
6876
<Compile Include="BiztalkComponents.Utils\PropertyBagHelper.cs" />
6977
<Compile Include="BiztalkComponents.Utils\RequiredRuntimeAttribute.cs" />
7078
<Compile Include="BiztalkComponents.Utils\ValidationHelper.cs" />
71-
<Compile Include="ContentWriter.cs" />
7279
<Compile Include="ContextReader.cs" />
7380
<Compile Include="AddNamespaceComponent.cs" />
7481
<Compile Include="ContentReader.cs" />
@@ -77,19 +84,24 @@
7784
<SubType>Code</SubType>
7885
</Compile>
7986
<Compile Include="NamespaceFormEnum.cs" />
80-
<Compile Include="NavgiationHistoryItem.cs" />
87+
<Compile Include="NavigationHistoryItem.cs" />
8188
<Compile Include="NavigationHistoryManager.cs" />
8289
<Compile Include="NavigationPath.cs" />
8390
<Compile Include="Properties\AssemblyInfo.cs" />
8491
<Compile Include="RemoveNamespaceComponent.Component.cs" />
8592
<Compile Include="RemoveNamespaceComponent.cs">
8693
<SubType>Code</SubType>
8794
</Compile>
95+
<Compile Include="Streams\XmlNamespaceAdder.cs" />
96+
<Compile Include="Streams\XmlNamespaceModifier.cs" />
97+
<Compile Include="Streams\XmlNamespaceRemover.cs" />
8898
</ItemGroup>
8999
<ItemGroup>
100+
<None Include="BizTalkComponents.ManageMessageNamespace.nuspec" />
90101
<None Include="BizTalkComponents.PipelineComponents.ManageMessageNamespace.snk" />
91102
<None Include="packages.config" />
92103
</ItemGroup>
104+
<ItemGroup />
93105
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
94106
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
95107
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">

Src/ManageMessageNamespace/BiztalkComponents.Utils/ContextExtensions.cs

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,33 @@ namespace BizTalkComponents.Utils
55
{
66
public static class ContextExtensions
77
{
8-
public static bool TryRead(this IBaseMessageContext ctx ,ContextProperty property, out object val)
8+
public static bool TryRead<T>(this IBaseMessageContext ctx, ContextProperty property, out T val)
99
{
1010
if (property == null)
1111
{
1212
throw new ArgumentNullException("property");
1313
}
14+
object content = ctx.Read(property.PropertyName, property.PropertyNamespace);
15+
if (content is T)
16+
{
17+
val = (T)content;
18+
return true;
19+
}
20+
else
21+
{
22+
val = default(T);
23+
return false;
24+
}
25+
}
1426

15-
return ((val = ctx.Read(property.PropertyName, property.PropertyNamespace)) != null);
27+
public static bool TryRead(this IBaseMessageContext ctx, ContextProperty property, out object val)
28+
{
29+
return TryRead<object>(ctx, property, out val);
1630
}
1731

1832
public static bool TryRead(this IBaseMessageContext ctx, ContextProperty property, out string val)
1933
{
20-
if (property == null)
21-
{
22-
throw new ArgumentNullException("property");
23-
}
24-
25-
val = ctx.Read(property.PropertyName, property.PropertyNamespace) as string;
34+
TryRead<string>(ctx, property, out val);
2635

2736
return !string.IsNullOrWhiteSpace(val);
2837
}
Lines changed: 50 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,72 @@
1-
namespace BizTalkComponents.Utils
1+
using Microsoft.XLANGs.BaseTypes;
2+
3+
namespace BizTalkComponents.Utils
24
{
35
public class FileProperties
46
{
5-
public const string ReceivedFileName = "http://schemas.microsoft.com/BizTalk/2003/file-properties#ReceivedFileName";
7+
/// <summary>
8+
/// http://schemas.microsoft.com/BizTalk/2003/file-properties#ReceivedFileName
9+
/// </summary>
10+
public static readonly string ReceivedFileName = SystemProperties.GetFullyQualifiedName(new FILE.ReceivedFileName());
611
}
712

813
public class SSOTicketProperties
914
{
10-
public const string SSOTicket = "http://schemas.microsoft.com/BizTalk/2003/system-properties#SSOTicket";
15+
/// <summary>
16+
/// http://schemas.microsoft.com/BizTalk/2003/system-properties#SSOTicket
17+
/// </summary>
18+
public static readonly string SSOTicket = SystemProperties.GetFullyQualifiedName(new BTS.SSOTicket());
1119
}
1220

1321
public class SystemProperties
1422
{
15-
public const string MessageType = "http://schemas.microsoft.com/BizTalk/2003/system-properties#MessageType";
16-
public const string SchemaStrongName = "http://schemas.microsoft.com/BizTalk/2003/system-properties#SchemaStrongName";
23+
/// <summary>
24+
/// http://schemas.microsoft.com/BizTalk/2003/system-properties#MessageType
25+
/// </summary>
26+
public static readonly string MessageType = GetFullyQualifiedName(new BTS.MessageType());
27+
28+
/// <summary>
29+
/// http://schemas.microsoft.com/BizTalk/2003/system-properties#SchemaStrongName
30+
/// </summary>
31+
public static readonly string SchemaStrongName = GetFullyQualifiedName(new BTS.SchemaStrongName());
32+
33+
/// <summary>
34+
/// http://schemas.microsoft.com/BizTalk/2003/system-properties#RouteDirectToTP
35+
/// </summary>
36+
public static readonly string RouteDirectToTP = GetFullyQualifiedName(new BTS.RouteDirectToTP());
1737

18-
public const string RouteDirectToTP =
19-
"http://schemas.microsoft.com/BizTalk/2003/system-properties#RouteDirectToTP";
38+
/// <summary>
39+
/// http://schemas.microsoft.com/BizTalk/2003/system-properties#EpmRRCorrelationToken
40+
/// </summary>
41+
public static readonly string EpmRRCorrelationToken = GetFullyQualifiedName(new BTS.EpmRRCorrelationToken());
2042

21-
public const string EpmRRCorrelationToken =
22-
"http://schemas.microsoft.com/BizTalk/2003/system-properties#EpmRRCorrelationToken";
43+
/// <summary>
44+
/// http://schemas.microsoft.com/BizTalk/2003/system-properties#CorrelationToken
45+
/// </summary>
46+
public static readonly string CorrelationToken = GetFullyQualifiedName(new BTS.CorrelationToken());
2347

24-
public const string CorrelationToken =
25-
"http://schemas.microsoft.com/BizTalk/2003/system-properties#CorrelationToken";
48+
/// <summary>
49+
/// http://schemas.microsoft.com/BizTalk/2003/system-properties#IsRequestResponse
50+
/// </summary>
51+
public static readonly string IsRequestResponse = GetFullyQualifiedName(new BTS.IsRequestResponse());
2652

27-
public const string IsRequestResponse =
28-
"http://schemas.microsoft.com/BizTalk/2003/system-properties#IsRequestResponse";
53+
/// <summary>
54+
/// http://schemas.microsoft.com/BizTalk/2003/system-properties#ReqRespTransmitPipelineID
55+
/// </summary>
56+
public static readonly string ReqRespTransmitPipelineID = GetFullyQualifiedName(new BTS.ReqRespTransmitPipelineID());
2957

30-
public const string ReqRespTransmitPipelineID =
31-
"http://schemas.microsoft.com/BizTalk/2003/system-properties#ReqRespTransmitPipelineID";
58+
public static string GetFullyQualifiedName(PropertyBase propertyBase)
59+
{
60+
var qName = propertyBase.QName;
61+
return qName.Namespace + "#" + qName.Name;
62+
}
3263
}
3364

3465
public class WCFProperties
3566
{
36-
public const string OutboundHttpStatusCode =
37-
"http://schemas.microsoft.com/BizTalk/2006/01/Adapters/WCF-properties#OutboundHttpStatusCode";
67+
/// <summary>
68+
/// http://schemas.microsoft.com/BizTalk/2006/01/Adapters/WCF-properties#OutboundHttpStatusCode
69+
/// </summary>
70+
public static readonly string OutboundHttpStatusCode = SystemProperties.GetFullyQualifiedName(new WCF.OutboundHttpStatusCode());
3871
}
3972
}

Src/ManageMessageNamespace/BiztalkComponents.Utils/PropertyBagHelper.cs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,25 @@ public static object ReadPropertyBag(IPropertyBag pb, string propName)
3939
return val;
4040
}
4141

42+
public static T ReadPropertyBag<T>(IPropertyBag pb, string propName)
43+
{
44+
try
45+
{
46+
object val;
47+
pb.Read(propName, out val, 0);
48+
49+
return val is T ? (T)val : default(T);
50+
}
51+
catch (ArgumentException)
52+
{
53+
return default(T);
54+
}
55+
catch (Exception e)
56+
{
57+
throw new ApplicationException(e.Message);
58+
}
59+
}
60+
4261
/// <summary>
4362
/// Writes property values into a property bag.
4463
/// </summary>

0 commit comments

Comments
 (0)