/// <summary> /// Removes the specified service. /// </summary> /// <param name="service">The service.</param> public void Remove(Identification service) { SubscriptorEntity subscriptorEntity = _repository.FindOne(s => s.Service.Id == service.Id && s.Service.Type == service.Type); if (subscriptorEntity != null) { _repository.Remove(subscriptorEntity); } }
/// <summary> /// Loads the identification. /// </summary> /// <returns></returns> private PublisherConfigurator LoadIdentification() { _identification = new Identification { Id = _publisherConfig.Identification.Id, Type = _publisherConfig.Identification.Type }; return this; }
/// <summary> /// Toes the subscriptor. /// </summary> /// <param name="subscriptorEntity">The subscriptor entity.</param> /// <param name="processor">The processor.</param> /// <returns></returns> public static Subscriptor ToSubscriptor(this SubscriptorEntity subscriptorEntity, Identification processor) { var subscriptor = new Subscriptor { Service = subscriptorEntity.Service, ServiceInputGateway = RouterGatewayFactory.CreateOutputGateway( new Uri(subscriptorEntity.InputGateway.Uri), (TransportType)subscriptorEntity.InputGateway.Transport), ServiceInputControlGateway = AgentGatewayFactory.CreateOutputGateway(processor, new Uri(subscriptorEntity.InputControlGateway.Uri), (TransportType)subscriptorEntity.InputControlGateway.Transport), }; foreach (var subscriptionTypeMessage in subscriptorEntity.SubcriptionTypes) { subscriptor.SubcriptionTypes.Add(subscriptionTypeMessage.ToSubscriptorKey()); } return subscriptor; }
/// <summary> /// Gets the or create service info. /// </summary> /// <param name="serviceIdentification">The service identification.</param> /// <param name="repository">The repository.</param> /// <returns></returns> private static ServiceInfoEntity GetOrCreateServiceInfo(Identification serviceIdentification, IServiceInfoRepository repository) { return repository.FindOne(new { Identification = new { serviceIdentification.Id, serviceIdentification.Type } }) ?? new ServiceInfoEntity { Identification = new Identification { Id = serviceIdentification.Id, Type = serviceIdentification.Type } }; }
/// <summary> /// Initializes a new instance of the <see cref="ControlProcessorConfigurator"/> class. /// </summary> /// <param name="HermEsbServiceConfig">The HermEsb service config.</param> /// <param name="identification">The identification.</param> public ControlProcessorConfigurator(HermEsbServiceConfig HermEsbServiceConfig, Identification identification) { _HermEsbServiceConfig = HermEsbServiceConfig; _identification = identification; }
/// <summary> /// Initializes a new instance of the <see cref="MonitorConfigurator"/> class. /// </summary> /// <param name="monitorConfig">The monitor config.</param> /// <param name="identification">The identification.</param> public MonitorConfigurator(MonitorConfig monitorConfig, Identification identification) { _monitorConfig = monitorConfig; _identification = identification; _assemblies = new List<string>(); }
/// <summary> /// Initializes a new instance of the <see cref="RouterProcessorConfigurator"/> class. /// </summary> /// <param name="hermEsbConfig">The HermEsb bus config.</param> /// <param name="identification">The identification.</param> public RouterProcessorConfigurator(HermEsbConfig hermEsbConfig, Identification identification) { _hermEsbConfig = hermEsbConfig; _identification = identification; }
/// <summary> /// Gets the service info. /// </summary> /// <param name="serviceIdentification">The service info heartBeatEntity.</param> /// <param name="repository">The repository.</param> /// <returns></returns> private ServiceInfoEntity GetServiceInfo(Identification serviceIdentification, IServiceInfoRepository repository) { var infoEntity = repository.FindOne(new {Identification = new {serviceIdentification.Id, serviceIdentification.Type}}); if (infoEntity == null) { InvokeServiceNotExist(new ServiceInfoEventHandlerArgs()); } return infoEntity; }
/// <summary> /// Equalses the specified other. /// </summary> /// <param name="other">The other.</param> /// <returns></returns> public bool Equals(Identification other) { if (ReferenceEquals(null, other)) return false; if (ReferenceEquals(this, other)) return true; return Equals(other.Id, Id) && Equals(other.Type, Type); }
/// <summary> /// Initializes a new instance of the <see cref="ServiceProcessorConfigurator"/> class. /// </summary> /// <param name="serviceProcessorConfig">The service processor config.</param> /// <param name="identification">The identification.</param> public ServiceProcessorConfigurator(ServiceProcessorConfig serviceProcessorConfig, Identification identification) { _serviceProcessorConfig = serviceProcessorConfig; _identification = identification; }
/// <summary> /// Initializes the <see cref="Identification"/> class. /// </summary> static Identification() { Empty = new Identification(); }
/// <summary> /// Loads the identification. /// </summary> /// <returns></returns> private ServiceConfigurator LoadIdentification() { _identification = new Identification { Id = _HermEsbServiceConfig.Identification.Id, Type = _HermEsbServiceConfig.Identification.Type }; return this; }
/// <summary> /// Initializes a new instance of the <see cref="PublisherConfigurator"/> class. /// </summary> /// <param name="publisherConfig">The publisher config.</param> /// <param name="identification">The identification.</param> public ErrorHandlingControllerConfigurator(ErrorHandlingControllerConfig publisherConfig, Identification identification) { _errorHandlingControllerConfig = publisherConfig; _identification = identification; }
/// <summary> /// Determines whether the specified identification is bus. /// </summary> /// <param name="identification">The identification.</param> /// <param name="type">The type.</param> /// <returns> /// <c>true</c> if the specified identification is bus; otherwise, <c>false</c>. /// </returns> private static bool IsBus(Identification identification, ProcessorType type) { return IdentitySpec.Instance.IsSatisfiedBy(identification) && BusTypeSpec.Instance.IsSatisfiedBy(type); }
/// <summary> /// Gets the reopsitory. /// </summary> /// <param name="identification">The identification.</param> /// <param name="type">The type.</param> /// <returns></returns> private IServiceInfoRepository GetReopsitory(Identification identification, ProcessorType type) { return IsBus(identification, type) ? _busRepository : _serviceRepository; }
/// <summary> /// Loads the identification. /// </summary> /// <returns></returns> private BusConfigurator LoadIdentification() { LoggerManager.Instance.Debug("Cargando la identificacion"); _identification = new Identification { Id = _hermEsbConfig.Identification.Id, Type = _hermEsbConfig.Identification.Type }; return this; }
/// <summary> /// Modifies the output messages. /// </summary> /// <param name="identification">The identification.</param> /// <param name="type">The type.</param> /// <param name="messageTypes">The message types.</param> public void ModifyOutputMessages(Identification identification, ProcessorType type, IEnumerable<MessageType> messageTypes) { var repository = GetReopsitory(identification, type); var serviceInfo = GetServiceInfo(identification, repository); Save(serviceInfo, repository, (bd => bd.SetValue(be => be.OutputTypes, messageTypes))); }
/// <summary> /// Gets the subscriptors. /// </summary> /// <returns></returns> public IList<Subscriptor> GetSubscriptors(Identification identification) { IEnumerable<SubscriptorEntity> subscriptorEntities = _repository.Find(new {}); return subscriptorEntities.Select(s => s.ToSubscriptor(identification)).ToList(); }