Ejemplo n.º 1
0
        private void ValidatePackage(Package collectPackage)
        {
            var validateSchematron      = ModsicConfigurationHelper.IsSchematronValidationSet();
            var collectRequestValidator = new CollectRequestValidator(collectPackage);

            collectRequestValidator.ValidateOvalDefinitions(validateSchematron);
        }
Ejemplo n.º 2
0
 private void Wait()
 {
     try
     {
         if (ModsicConfigurationHelper.IsSchedulerIntervalSet())
         {
             System.Threading.Thread.Sleep(1000);
         }
     }
     catch
     {
     }
 }
Ejemplo n.º 3
0
        private void CheckForTimeout()
        {
            try
            {
                var collectiontimeout = ModsicConfigurationHelper.GetCollectionTimeout();
                if (collectiontimeout != null)
                {
                    using (var session = Repository.GetSession())
                    {
                        var collectRequestsInExecution = session.Query <CollectRequest>().Where(x => x.Status == CollectRequestStatus.Executing).ToList();
                        var runningCollections         = this.ScheduleController.GetCollectRequestIdRunning().ToList();
                        foreach (var collectRequest in collectRequestsInExecution)
                        {
                            if (!runningCollections.Contains(collectRequest.Oid))
                            {
                                var collectionStartDate         = GetCollectionStartDate(session, collectRequest);
                                var collectionDurationInMinutes = GetCollectionDurationInMinutes(collectionStartDate);
                                if (collectionDurationInMinutes > collectiontimeout)
                                {
                                    LogInfo("The {0} timeout expired ({1} minutes) and it will be reschedule...\r\nCurrent time: {2}\r\nCollection started on {3}",
                                            collectRequest.Oid,
                                            collectionDurationInMinutes,
                                            String.Format("{0} ( {1} )", DateTime.UtcNow.ToLongDateString(), DateTime.UtcNow.ToLongTimeString()),
                                            String.Format("{0} ( {1} )", collectionStartDate.ToLongDateString(), collectionStartDate.ToLongTimeString()));

                                    this.ScheduleController.CancelCollection(collectRequest.Oid);
                                    this.ScheduleController.ScheduleCollection(collectRequest.Oid, collectRequest.Target.Address, DateTime.UtcNow);
                                    LogInfo("  The {0} was scheduled.", collectRequest.Oid);
                                    System.Threading.Thread.Sleep(5000);
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                LogError("An error occurred while trying to check timeout: '{0}'\r\nStack:\r\n{1}", ex.Message, ex.StackTrace);
            }
        }