using System;
using System.Resources;
using System.Collections;
using System.Reflection;
using System.ComponentModel;
using System.Text;
using System.IO;
using Microsoft.BizTalk.Message.Interop;
using Microsoft.BizTalk.Component.Interop;
using Microsoft.XLANGs.BaseTypes;
using Microsoft.BizTalk.TransportProxy.Interop;
namespace Lyo.BizTalk.URICustomPipeline.UTIL
{
/// <summary>
/// Summary description for Class1.
/// </summary>
///
[ComponentCategory(CategoryTypes.CATID_PipelineComponent)]
[ComponentCategory(CategoryTypes.CATID_Encoder)]
[ComponentCategory(CategoryTypes.CATID_Validate)]
[System.Runtime.InteropServices.Guid("A969D2BD-DFC1-4ef1-A70C-E6C3213B6DE4")]
public class URIScheme : IBaseComponent,
Microsoft.BizTalk.Component.Interop.IComponent,
Microsoft.BizTalk.Component.Interop.IPersistPropertyBag, IComponentUI,
IBTTransport, IBTTransportConfig, IBTTransportControl
{
private static PropertyBase PropOutboundUrl = new
BTS.OutboundTransportLocation();
public URIScheme()
{
//
// TODO: Add constructor logic here
//
}
#region IBaseComponent Members
public string Description
{
get
{
return "Pipeline component used to change the URI Scheme";
}
}
public string Name
{
get
{
return "URIScheme";
}
}
public string Version
{
get
{
return "1.0.0.0";
}
}
#endregion
#region IComponentUI Members
System.IntPtr Microsoft.BizTalk.Component.Interop.IComponentUI.Icon
{
get
{
return new System.IntPtr ();
}
}
public System.Collections.IEnumerator Validate(object projectSystem)
{
System.Collections.Specialized.StringCollection validationResult =
new System.Collections.Specialized.StringCollection();
return (IEnumerator) validationResult.GetEnumerator();
}
#endregion
#region IComponent Members
public IBaseMessage Execute(IPipelineContext pc, IBaseMessage inmsg)
{
IBaseMessageContext MsgContext = null;
object PropertyValue = null;
string OriginalUrl = string.Empty;
string NewUrl = string.Empty;
string Username = string.Empty;
string Password = string.Empty;
MsgContext = inmsg.Context;
PropertyValue = MsgContext.Read(PropOutboundUrl.Name.Name,
PropOutboundUrl.Name.Namespace);
if (PropertyValue != null && PropertyValue is string)
{
OriginalUrl = ((string) PropertyValue).Trim();
// Verify that the URL is HTTP or HTTPS.
if
(OriginalUrl.ToLower(System.Globalization.CultureInfo.InvariantCulture).StartsWith("soap"))
{
OriginalUrl.Replace("soap","http");
// Update the new outbound URL.
MsgContext.Promote(PropOutboundUrl.Name.Name,
PropOutboundUrl.Name.Namespace, OriginalUrl);//NewUrl);
}
}
return inmsg;
}
// public IBaseMessage Execute(IPipelineContext pContext, IBaseMessage
pInMsg)
// {
// IBaseMessageContext context = pInMsg.Context;
//
// context.
//
// // TODO: Add URIScheme.Execute implementation
// return null;
// }
#endregion
#region IPersistPropertyBag Members
public void InitNew()
{
// TODO: Add URIScheme.InitNew implementation
}
public void GetClassID(out Guid classID)
{
// TODO: Add URIScheme.GetClassID implementation
classID = new Guid ("A969D2BD-DFC1-4ef1-A70C-E6C3213B6DE4");
}
public void Load(IPropertyBag propertyBag, int errorLog)
{
// TODO: Add URIScheme.Load implementation
}
public void Save(IPropertyBag propertyBag, bool clearDirty, bool
saveAllProperties)
{
// TODO: Add URIScheme.Save implementation
}
#endregion
#region IBTTransport Members
public Guid ClassID
{
get
{
return new Guid ("A969D2BD-DFC1-4ef1-A70C-E6C3213B6DE4");
}
}
public string TransportType
{
get
{
// TODO: Add URIScheme.TransportType getter implementation
return null;
}
}
#endregion
#region IBTTransportConfig Members
public void RemoveReceiveEndpoint(string url)
{
// TODO: Add URIScheme.RemoveReceiveEndpoint implementation
}
public void UpdateEndpointConfig(string url, IPropertyBag adapterConfig,
IPropertyBag bizTalkConfig)
{
// TODO: Add URIScheme.UpdateEndpointConfig implementation
}
public void AddReceiveEndpoint(string url, IPropertyBag adapterConfig,
IPropertyBag bizTalkConfig)
{
// TODO: Add URIScheme.AddReceiveEndpoint implementation
}
#endregion
#region IBTTransportControl Members
public void Terminate()
{
// TODO: Add URIScheme.Terminate implementation
}
public void Initialize(IBTTransportProxy transportProxy)
{
// TODO: Add URIScheme.Initialize implementation
}
#endregion
}
}