예제 #1
0
        private static void Init()
        {
            if (_list == null)
            {
                lock (_lock)
                {
                    var list = new List <Person>();
                    for (int i = 0; i < TOTAL_PEOPLE; i++)
                    {
                        var person = (Person)null;
                        var type   = (PersonType)_random.Next(1, 5);
                        var age    = _random.Next(1, 99);
                        var name   = "Person #" + i.ToString();
                        switch (type)
                        {
                        case PersonType.Angle:
                            person = new Angle()
                            {
                                Age = age, Name = name
                            };
                            break;

                        case PersonType.Asian:
                            person = new Asian()
                            {
                                Age = age, Name = name
                            };
                            break;

                        case PersonType.Jute:
                            person = new Jute()
                            {
                                Age = age, Name = name
                            };
                            break;

                        case PersonType.Saxon:
                            person = new Saxon()
                            {
                                Age = age, Name = name
                            };
                            break;
                        }
                        list.Add(person);
                    }
                    _list = list.OrderBy(x => x.Age).ToList();
                }
            }
        }
        public IActionResult Polish(Guid guid, [FromBody] Saxon useSaxon)
        {
            if (guid == Guid.Empty)
            {
                return(Problem("Empty GUID is invalid."));
            }

            _logger.LogInformation("Enter Polish.");

            //database process id
            Guid processId = Guid.NewGuid();

            try
            {
                Task.Run(() =>
                {
                    using (PolishHandler handler = new PolishHandler(_settings, _eventHub, _preingestCollection))
                    {
                        handler.Logger = _logger;
                        handler.SetSessionGuid(guid);
                        handler.TransformationSetting = useSaxon;
                        processId = handler.AddProcessAction(processId, typeof(PolishHandler).Name, String.Format("Polish Opex with collection ID: {0}", guid), String.Concat(typeof(PolishHandler).Name, ".json"));
                        _logger.LogInformation("Execute handler ({0}) with GUID {1}.", typeof(PolishHandler).Name, guid.ToString());
                        handler.Execute();
                    }
                });
            }
            catch (Exception e)
            {
                _logger.LogError(e, "An exception was thrown in {0}: '{1}'.", typeof(FilesChecksumHandler).Name, e.Message);
                return(ValidationProblem(e.Message, typeof(FilesChecksumHandler).Name));
            }
            _logger.LogInformation("Exit Polish.");

            return(new JsonResult(new { Message = String.Format("Polish run started."), SessionId = guid, ActionId = processId }));
        }
예제 #3
0
 internal SaxonXsltExecutable(Saxon.Api.XsltExecutable executable, SaxonProcessor processor, Uri staticBaseUri) {
    
    this.executable = executable;
    this._Processor = processor;
    this._StaticBaseUri = staticBaseUri;
 }
예제 #4
0
 XQueryExecutable WrapExecutable(Saxon.Api.XQueryExecutable xqueryExecutable, XQueryCompileOptions options) {
    return new SaxonXQueryExecutable(xqueryExecutable, this, options.BaseUri);
 }
예제 #5
0
 XsltExecutable WrapExecutable(Saxon.Api.XsltExecutable xsltExecutable, XsltCompileOptions options, Uri baseUri) {
    return new SaxonXsltExecutable(xsltExecutable, this, baseUri ?? options.BaseUri);
 }
예제 #6
0
      XsltExecutable WrapExecutable(Saxon.Api.XsltExecutable xsltExecutable, XsltCompileOptions options, string baseUri) {

         Uri parsedBaseUri = null;

         if (!String.IsNullOrEmpty(baseUri)) {
            try {
               parsedBaseUri = new Uri(baseUri);
            } catch (UriFormatException) { }
         }

         return WrapExecutable(xsltExecutable, options, parsedBaseUri);
      }