public bugzilla_properties CheckConnection(BugzillaProfile profile)
		{
			var errors = new PluginProfileErrorCollection();
			try
			{
				SetServerCertificateValidationCallback(profile);

				var validators = new Queue<Validator>();

				var connectionValidator = new ConnectionValidator(profile);
				validators.Enqueue(connectionValidator);

				var scriptValidator = new ScriptValidator(profile);
				validators.Enqueue(scriptValidator);

				var responseValidator = new ResponseValidator(profile, scriptValidator);
				validators.Enqueue(responseValidator);

				var deserializeValidator = new DeserializeValidator(profile, responseValidator);
				validators.Enqueue(deserializeValidator);

				var settingsValidator = new SettingsValidator(profile, deserializeValidator);
				validators.Enqueue(settingsValidator);

				var savedQueryValidator = new SavedQueryValidator(profile);
				validators.Enqueue(savedQueryValidator);

				while (validators.Count > 0)
				{
					var validator = validators.Dequeue();
					validator.Execute(errors);
				}

				if (errors.Any())
				{
					throw new BugzillaPluginProfileException(profile, errors);
				}

				return deserializeValidator.Data;
			}
			catch (BugzillaPluginProfileException)
			{
				throw;
			}
			catch (Exception ex)
			{
				errors.Add(new PluginProfileError
				           	{
				           		FieldName = BugzillaProfile.ProfileField,
				           		Message = string.Format("The connection with {0} is failed. {1}", profile, ex.Message)
				           	});
				throw new BugzillaPluginProfileException(profile, errors);
			}
		}
        public IHttpActionResult GetScriptTextValidator(decimal id)
        {
            ScriptValidator scriptTextValidator = db.ScriptValidators.Find(id);

            if (scriptTextValidator == null)
            {
                return(NotFound());
            }

            return(Ok(scriptTextValidator));
        }
        public bugzilla_properties CheckConnection(BugzillaProfile profile)
        {
            var errors = new PluginProfileErrorCollection();

            try
            {
                var validators = new Queue <Validator>();

                var connectionValidator = new ConnectionValidator(profile);
                validators.Enqueue(connectionValidator);

                var scriptValidator = new ScriptValidator(profile);
                validators.Enqueue(scriptValidator);

                var responseValidator = new ResponseValidator(profile, scriptValidator);
                validators.Enqueue(responseValidator);

                var deserializeValidator = new DeserializeValidator(profile, responseValidator);
                validators.Enqueue(deserializeValidator);

                var settingsValidator = new SettingsValidator(profile, deserializeValidator);
                validators.Enqueue(settingsValidator);

                var savedQueryValidator = new SavedQueryValidator(profile);
                validators.Enqueue(savedQueryValidator);

                while (validators.Count > 0)
                {
                    var validator = validators.Dequeue();
                    validator.Execute(errors);
                }

                if (errors.Any())
                {
                    throw new BugzillaPluginProfileException(profile, errors);
                }

                return(deserializeValidator.Data);
            }
            catch (BugzillaPluginProfileException)
            {
                throw;
            }
            catch (Exception ex)
            {
                errors.Add(new PluginProfileError
                {
                    FieldName = BugzillaProfile.ProfileField,
                    Message   = string.Format("The connection with {0} is failed. {1}", profile, ex.Message)
                });
                throw new BugzillaPluginProfileException(profile, errors);
            }
        }
Ejemplo n.º 4
0
        public ChainStateBuilder(ChainBuilder chain, Utxo parentUtxo, Logger logger, IKernel kernel, IBlockchainRules rules, BlockHeaderCache blockHeaderCache, BlockCache blockCache, SpentTransactionsCache spentTransactionsCache, SpentOutputsCache spentOutputsCache)
        {
            this.logger                 = logger;
            this.sha256                 = new SHA256Managed();
            this.rules                  = rules;
            this.blockHeaderCache       = blockHeaderCache;
            this.blockCache             = blockCache;
            this.spentTransactionsCache = spentTransactionsCache;
            this.spentOutputsCache      = spentOutputsCache;

            this.chainStateMonitor = new ChainStateMonitor(this.logger);
            this.scriptValidator   = new ScriptValidator(this.logger, this.rules);
            this.chainStateMonitor.Subscribe(this.scriptValidator);

            this.chain = chain;
            this.chainStateBuilderStorage = kernel.Get <IChainStateBuilderStorage>(new ConstructorArgument("parentUtxo", parentUtxo.Storage));

            this.spentTransactions = ImmutableList.CreateBuilder <KeyValuePair <UInt256, SpentTx> >();
            this.spentOutputs      = ImmutableList.CreateBuilder <KeyValuePair <TxOutputKey, TxOutput> >();

            this.stats = new BuilderStats();
        }