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>()); } }
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"); } }
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)); } }
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); } }); }
public void Check(IPackageLog log) { if (File.Exists(_file)) { log.Trace(SuccessMessage, _file); } else { log.MarkFailure(FailureMessage, _file); } }
public void Check(IPackageLog log) { if (Directory.Exists(_folder)) { log.Trace(SuccessMessage, _folder); } else { log.MarkFailure(FailureMessage, _folder); } }
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); } }); }
public static void TrapErrors(this IPackageLog log, Action action) { try { action(); } catch (Exception e) { log.MarkFailure(e); } }
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); } }); }
// 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); } }); }
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); } }); }
public void Deactivate(IPackageLog log) { _latch.Latched = true; _jobs.Each(x => { try { x.Dispose(); } catch (Exception ex) { log.MarkFailure(ex); } }); }
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)); } }
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); } }); }
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(); } }
public override void CheckEnvironment(IPackageLog log) { log.MarkFailure("I detected a problem during CheckEnvironment"); }
public override void Install(IPackageLog log) { log.MarkFailure("I detected a problem during Install"); }
public IEnumerable<IInstaller> StartUp(IPackageLog log) { log.MarkFailure("I found a problem in StartUp"); return new IInstaller[0]; }
public static void LogMissingDependency(this IPackageLog log, string dependencyName) { log.MarkFailure("Missing required Bottle/Package dependency named '{0}'".ToFormat(dependencyName)); }
public IEnumerable <IInstaller> StartUp(IPackageLog log) { log.MarkFailure("I found a problem in StartUp"); return(new IInstaller[0]); }