Example #1
0
        public static IEnumerable <T> VerifyAnyRegistrations <T>(this IServiceLocator services, IPackageLog log)
        {
            try
            {
                var holder = services.GetInstance <Holder <T> >();
                holder.List.Each(x => {
                    log.Trace("Using {0} for {1}", x.GetType().FullName, typeof(T).FullName);
                });


                if (!holder.List.Any())
                {
                    log.MarkFailure("No implementations of {0} are registered", typeof(T).FullName);
                }

                return(holder.List);
            }
            catch (Exception ex)
            {
                log.MarkFailure("Could not resolve the list of " + typeof(T).FullName);
                log.MarkFailure(ex);

                return(Enumerable.Empty <T>());
            }
        }
Example #2
0
 public void Activate(IEnumerable<IPackageInfo> packages, IPackageLog log)
 {
     if (!_strategies.Any())
     {
         log.MarkFailure("There are no IAuthenticationStrategy services registered.  Either register an IAuthenticationStrategy or remove FubuMVC.Authentication from your application");
     }
 }
 public void Activate(IEnumerable <IPackageInfo> packages, IPackageLog log)
 {
     if (!_strategies.Any())
     {
         log.MarkFailure("There are no IAuthenticationStrategy services registered.  Either register an IAuthenticationStrategy or remove FubuMVC.Authentication from your application");
     }
 }
Example #4
0
        public static T VerifyRegistration <T>(this IServiceLocator services, IPackageLog log)
        {
            try
            {
                var service = services.GetInstance <T>();
                log.Trace("Using {0} for {1}", service.GetType().FullName, typeof(T).FullName);

                return(service);
            }
            catch (Exception ex)
            {
                log.MarkFailure("Could not resolve " + typeof(T).FullName);
                log.MarkFailure(ex);

                return(default(T));
            }
        }
Example #5
0
        public void Activate(IEnumerable<IPackageInfo> packages, IPackageLog log)
        {
            log.Trace("Trying to resolve chains to the navigation graph");
            _graph.Navigation.AllNodes().OfType<MenuNode>().Each(x =>
            {
                try
                {
                    x.Resolve(_resolver);
                }
                catch (Exception ex)
                {
                    log.MarkFailure("Failed to resolve a BehaviorChain for navigation element " + x.Key);
                    log.MarkFailure(ex);
                }

            });
        }
        private void checkCertificates(ISamlCertificateRepository repository, IPackageLog log)
        {
            var loader = _services.GetInstance<ICertificateLoader>();

            repository.AllKnownCertificates().Each(samlCertificate => {
                try
                {
                    var certificate = loader.Load(samlCertificate.Thumbprint);
                    if (certificate == null)
                    {
                        log.MarkFailure("Could not load Certificate for Issuer " + samlCertificate.Issuer);
                    }
                }
                catch (Exception ex)
                {
                    log.MarkFailure("Could not load Certificate for Issuer " + samlCertificate.Issuer);
                    log.MarkFailure(ex);
                }
            });
        }
Example #7
0
 public void Check(IPackageLog log)
 {
     if (File.Exists(_file))
     {
         log.Trace(SuccessMessage, _file);
     }
     else
     {
         log.MarkFailure(FailureMessage, _file);
     }
 }
Example #8
0
 public void Check(IPackageLog log)
 {
     if (Directory.Exists(_folder))
     {
         log.Trace(SuccessMessage, _folder);
     }
     else
     {
         log.MarkFailure(FailureMessage, _folder);
     }
 }
Example #9
0
 public void Check(IPackageLog log)
 {
     if (File.Exists(_file))
     {
         log.Trace(SuccessMessage, _file);
     }
     else
     {
         log.MarkFailure(FailureMessage, _file);
     }
 }
Example #10
0
        private void checkCertificates(ISamlCertificateRepository repository, IPackageLog log)
        {
            var loader = _services.GetInstance <ICertificateLoader>();

            repository.AllKnownCertificates().Each(samlCertificate => {
                try
                {
                    var certificate = loader.Load(samlCertificate.Thumbprint);
                    if (certificate == null)
                    {
                        log.MarkFailure("Could not load Certificate for Issuer " + samlCertificate.Issuer);
                    }
                }
                catch (Exception ex)
                {
                    log.MarkFailure("Could not load Certificate for Issuer " + samlCertificate.Issuer);
                    log.MarkFailure(ex);
                }
            });
        }
Example #11
0
 public static void TrapErrors(this IPackageLog log, Action action)
 {
     try
     {
         action();
     }
     catch (Exception e)
     {
         log.MarkFailure(e);
     }
 }
Example #12
0
 public void Check(IPackageLog log)
 {
     if (Directory.Exists(_folder))
     {
         log.Trace(SuccessMessage, _folder);
     }
     else
     {
         log.MarkFailure(FailureMessage, _folder);
     }
 }
        public void Check(IPackageLog log)
        {
            WasCalled = true;

            if (!_success)
            {
                log.MarkFailure(_message);
            }
            else
            {
                log.Trace(_message);
            }
        }
Example #14
0
        public void Check(IPackageLog log)
        {
            WasCalled = true;

            if (!_success)
            {
                log.MarkFailure(_message);
            }
            else
            {
                log.Trace(_message);
            }
        }
 public void Activate(IEnumerable<IPackageInfo> packages, IPackageLog log)
 {
     _jobs.Each(x => {
         try
         {
             log.Trace("Starting " + Description.For(x).Title);
             x.Start();
         }
         catch (Exception ex)
         {
             log.MarkFailure(ex);
         }
     });
 }
Example #16
0
        // TODO -- would be nice if we could log the provenance of the file dependency.
        // i.e. -- which file had the wrong stuff
        public void VerifyFileDependency(string name)
        {
            var file = _pipeline.Find(name);

            if (file == null)
            {
                // Guard clause to allow automated tests with faked up data work
                if (AssetDeclarationVerificationActivator.Latched)
                {
                    return;
                }
                _log.MarkFailure(GetErrorMessage(name, _assetLogs));
            }
        }
 public void Activate(IEnumerable<IPackageInfo> packages, IPackageLog log)
 {
     _jobs.Where(x => x.ScheduledExecution != ScheduledExecution.Disabled).Each(x => {
         try
         {
             log.Trace("Starting " + x.JobType.GetFullName());
             x.Start();
         }
         catch (Exception ex)
         {
             log.MarkFailure(ex);
         }
     });
 }
Example #18
0
 public void Activate(IEnumerable <IPackageInfo> packages, IPackageLog log)
 {
     _jobs.Where(x => x.ScheduledExecution != ScheduledExecution.Disabled).Each(x => {
         try
         {
             log.Trace("Starting " + x.JobType.GetFullName());
             x.Start();
         }
         catch (Exception ex)
         {
             log.MarkFailure(ex);
         }
     });
 }
Example #19
0
        public void Deactivate(IPackageLog log)
        {
            _latch.Latched = true;

            _jobs.Each(x => {
                try
                {
                    x.Dispose();
                }
                catch (Exception ex)
                {
                    log.MarkFailure(ex);
                }
            });
        }
Example #20
0
        public void Deactivate(IPackageLog log)
        {
            _latch.Latched = true;

            _jobs.Each(x => {
                try
                {
                    x.Dispose();
                }
                catch (Exception ex)
                {
                    log.MarkFailure(ex);
                }
            });
        }
Example #21
0
        public void Check(IPackageLog log)
        {
            var file = _folder.AppendPath(TracerFile);
            try
            {
                var system = new FileSystem();
                system.WriteStringToFile(file, "just a test of whether or not a process can write to a folder");
                system.DeleteFile(file);

                log.Trace(SuccessMessage.ToFormat(_folder));
            }
            catch (Exception)
            {
                log.MarkFailure(FailureMessage.ToFormat(_folder));
            }
        }
Example #22
0
 public static void WithLog(IPackageLog log, Action action)
 {
     _status.PushLog(log);
     try
     {
         log.Execute(action);
     }
     catch (Exception ex)
     {
         log.MarkFailure(ex);
     }
     finally
     {
         _status.PopLog();
     }
 }
        public void Deactivate(IPackageLog log)
        {
            _latch.Latched = true;

            _jobs.Each(x => {
                try
                {
                    x.Stop();
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex);
                    log.MarkFailure(ex);
                }
            });
        }
Example #24
0
 public static void WithLog(IPackageLog log, Action action)
 {
     _status.PushLog(log);
     try
     {
         log.Execute(action);
     }
     catch (Exception ex)
     {
         log.MarkFailure(ex);
     }
     finally
     {
         _status.PopLog();
     }
 }
Example #25
0
        public void Check(IPackageLog log)
        {
            var file = _folder.AppendPath(TracerFile);

            try
            {
                var system = new FileSystem();
                system.WriteStringToFile(file, "just a test of whether or not a process can write to a folder");
                system.DeleteFile(file);

                log.Trace(SuccessMessage.ToFormat(_folder));
            }
            catch (Exception)
            {
                log.MarkFailure(FailureMessage.ToFormat(_folder));
            }
        }
Example #26
0
        private static void startTheEnvironment(IList <LogEntry> list, IEnvironment environment, IPackageLog log, params Action <IInstaller, IPackageLog>[] actions)
        {
            try
            {
                var installers = environment.StartUp(log);

                // This needs to happen regardless, but we want these logs put in before
                // logs for the installers, so we don't do it in the finally{}
                addPackagingLogEntries(list);

                executeInstallers(list, installers, actions);
            }
            catch (Exception ex)
            {
                addPackagingLogEntries(list);
                log.MarkFailure(ex.ToString());
            }
            finally
            {
                list.Add(LogEntry.FromPackageLog(environment, log));
                environment.SafeDispose();
            }
        }
        private static void startTheEnvironment(IList<LogEntry> list, IEnvironment environment, IPackageLog log, params Action<IInstaller, IPackageLog>[] actions)
        {          
            try
            {
                var installers = environment.StartUp(log);

                // This needs to happen regardless, but we want these logs put in before
                // logs for the installers, so we don't do it in the finally{}
                addPackagingLogEntries(list);

                executeInstallers(list, installers, actions);
            }
            catch (Exception ex)
            {
                addPackagingLogEntries(list);
                log.MarkFailure(ex.ToString());
            }
            finally
            {
                list.Add(LogEntry.FromPackageLog(environment, log));
                environment.SafeDispose();
            }
        }
Example #28
0
 public override void CheckEnvironment(IPackageLog log)
 {
     log.MarkFailure("I detected a problem during CheckEnvironment");
 }
Example #29
0
 public override void Install(IPackageLog log)
 {
     log.MarkFailure("I detected a problem during Install");
 }
Example #30
0
 public IEnumerable<IInstaller> StartUp(IPackageLog log)
 {
     log.MarkFailure("I found a problem in StartUp");
     return new IInstaller[0];
 }
Example #31
0
 public static void LogMissingDependency(this IPackageLog log, string dependencyName)
 {
     log.MarkFailure("Missing required Bottle/Package dependency named '{0}'".ToFormat(dependencyName));
 }
Example #32
0
 public IEnumerable <IInstaller> StartUp(IPackageLog log)
 {
     log.MarkFailure("I found a problem in StartUp");
     return(new IInstaller[0]);
 }
Example #33
0
 public override void Install(IPackageLog log)
 {
     log.MarkFailure("I detected a problem during Install");
 }
Example #34
0
 public override void CheckEnvironment(IPackageLog log)
 {
     log.MarkFailure("I detected a problem during CheckEnvironment");
 }