protected internal virtual ServiceRef CreateServiceRef(IOrchestrationBinding orchestrationBinding)
        {
            // see https://msdn.microsoft.com/en-us/library/microsoft.biztalk.deployment.binding.serviceref.aspx
            var serviceRef = new ServiceRef {
                Description = orchestrationBinding.Description,
                // TODO EndpointInfo =
                Host = new HostRef {
                    Name = orchestrationBinding.Host,
                    // TODO NTGroupName = "",
                    // TODO Trusted = false,
                    // TODO Type = (int) HostType.InProcess
                },
                Name = orchestrationBinding.Type.FullName,
                // TODO allow to change State
                State = ServiceRef.ServiceRefState.Enlisted,
                // TODO allow to change TackingOption
                TrackingOption = OrchestrationTrackingTypes.None
            };
            // ensure service ref port collection is initialized even if there are only direct ports
            var serviceRefPorts = serviceRef.Ports;

            foreach (var portBinding in orchestrationBinding.PortBindings)
            {
                serviceRefPorts.Add(CreateServicePortRef(portBinding));
            }
            // TODO Roles =
            return(serviceRef);
        }
Example #2
0
 public void VisitOrchestration(IOrchestrationBinding orchestrationBinding)
 {
     if (orchestrationBinding == null)
     {
         throw new ArgumentNullException(nameof(orchestrationBinding));
     }
     ((ISupportEnvironmentOverride)orchestrationBinding).ApplyEnvironmentOverrides(Environment);
 }
 public void VisitOrchestration(IOrchestrationBinding orchestrationBinding)
 {
     if (orchestrationBinding == null)
     {
         throw new ArgumentNullException(nameof(orchestrationBinding));
     }
     ((ISupportValidation)orchestrationBinding).Validate();
 }
 public void VisitOrchestration(IOrchestrationBinding orchestrationBinding)
 {
     // skip Orchestration not belonging to this application
     if (!ReferenceEquals(orchestrationBinding.ApplicationBinding, _applicationBinding))
     {
         return;
     }
     _decoratedVisitor.VisitOrchestration(orchestrationBinding);
 }
 void IApplicationBindingVisitor.VisitOrchestration(IOrchestrationBinding orchestrationBinding)
 {
     if (orchestrationBinding == null)
     {
         throw new ArgumentNullException(nameof(orchestrationBinding));
     }
     // visit only Orchestration belonging to this application
     if (ReferenceEquals(orchestrationBinding.ApplicationBinding, _mainApplicationBinding))
     {
         VisitOrchestration(orchestrationBinding);
     }
 }
        public void VisitOrchestration(IOrchestrationBinding orchestrationBinding)
        {
            var moduleRef = CreateOrFindModuleRef(orchestrationBinding);

            // a ModuleRef just created has no ServiceRef in its Services collection yet
            if (moduleRef.Services.Count == 0)
            {
                BindingInfo.ModuleRefCollection.Add(moduleRef);
            }
            var serviceRef = CreateServiceRef(orchestrationBinding);

            moduleRef.Services.Add(serviceRef);
        }
Example #7
0
 protected internal virtual ServiceRef CreateServiceRef(IOrchestrationBinding orchestrationBinding)
 {
     // see https://docs.microsoft.com/en-us/dotnet/api/microsoft.biztalk.deployment.binding.serviceref
     var serviceRef = new ServiceRef {
         Description = orchestrationBinding.Description,
         Host        = new() {
             Name = orchestrationBinding.ResolveHost()
         },
         Name = orchestrationBinding.Type.FullName,
         // Un/Enlisting/Starting/Stopping orchestrations is the responsibility of BizTalkServiceStateInitializer
         State = orchestrationBinding.State switch {
             ServiceState.Unenlisted => ServiceRef.ServiceRefState.Unenlisted,
             ServiceState.Enlisted => ServiceRef.ServiceRefState.Enlisted,
             ServiceState.Started => ServiceRef.ServiceRefState.Started,
             _ => ServiceRef.ServiceRefState.Default
         },
        protected internal virtual ModuleRef CreateOrFindModuleRef(IOrchestrationBinding orchestrationBinding)
        {
            var serviceAssemblyName = orchestrationBinding.Type.Assembly.GetName();
            var name    = serviceAssemblyName.Name;
            var version = serviceAssemblyName.Version.ToString();
            // see BizTalkFactory.Management.Automation.BtsCatalog.ExportBinding, BizTalkFactory.Management.Automation
            var culture = serviceAssemblyName.CultureInfo == null || serviceAssemblyName.CultureInfo.Name.IsNullOrEmpty()
                                ? "neutral"
                                : serviceAssemblyName.CultureInfo.Name;
            var publicKeyTokenBytes = serviceAssemblyName.GetPublicKeyToken();
            // see BizTalkFactory.Management.Automation.BtsCatalog.ExportBinding, BizTalkFactory.Management.Automation
            var publicKeyToken = publicKeyTokenBytes == null || publicKeyTokenBytes.Length == 0
                                ? null
                                : publicKeyTokenBytes.Aggregate(string.Empty, (k, token) => k + token.ToString("x2", CultureInfo.InvariantCulture));
            var module = BindingInfo.ModuleRefCollection.Find(name, version, culture, publicKeyToken);

            return(module ?? new ModuleRef(name, version, culture, publicKeyToken));
        }
Example #9
0
        public void VisitOrchestration(IOrchestrationBinding orchestrationBinding)
        {
            var name          = orchestrationBinding.Type.FullName;
            var orchestration = _application.Orchestrations[name];

            if (_logger.IsDebugEnabled)
            {
                if (orchestrationBinding.State == ServiceState.Unenlisted)
                {
                    _logger.DebugFormat("Unenlisting orchestration '{0}'", name);
                }
                else if (orchestrationBinding.State == ServiceState.Enlisted)
                {
                    _logger.DebugFormat("Enlisting or stopping orchestration '{0}'", name);
                }
                else
                {
                    _logger.DebugFormat("Starting orchestration '{0}'", name);
                }
            }
            orchestration.Status = (OrchestrationStatus)orchestrationBinding.State;
        }
Example #10
0
 public void VisitOrchestration(IOrchestrationBinding orchestrationBinding)
 {
 }
 protected internal abstract void VisitOrchestration(IOrchestrationBinding orchestrationBinding);
 IOrchestrationBindingCollection IOrchestrationBindingCollection.Add(IOrchestrationBinding orchestrationBinding)
 {
     return(((IOrchestrationBindingCollection)this).Add(new[] { orchestrationBinding }));
 }
 public override string ResolveHost(IOrchestrationBinding orchestration)
 {
     return("OrchestrationHost2");
 }
Example #14
0
 internal new string ResolveHost(IOrchestrationBinding orchestration)
 {
     return(base.ResolveHost(orchestration));
 }
Example #15
0
 public override string ResolveHost(IOrchestrationBinding orchestration)
 {
     return(Platform.Settings.HostNameProvider.ProcessingHost);
 }
Example #16
0
 public override string ResolveHost(IOrchestrationBinding orchestration)
 {
     return(orchestration.Type == typeof(Orchestrations.Bound.Process)
                         ? "DummyHost"
                         : "BizTalkServerApplication");
 }
Example #17
0
 public virtual string ResolveHost(IOrchestrationBinding orchestration)
 {
     return(_name);
 }
 public void VisitOrchestration(IOrchestrationBinding orchestrationBinding)
 {
     ((ISupportEnvironmentOverride)orchestrationBinding).ApplyEnvironmentOverrides(Environment);
     ((ISupportValidation)orchestrationBinding).Validate();
 }