Exemplo n.º 1
0
        public void Execute(WebServiceActivityConfig config)
        {
            var tracker = new ActivityTracker();

            Container.RegisterInstance(tracker);
            Container.RegisterAsSingleton <IWebServiceExtender>(typeof(CoreServicesExtender));

            if (!Container.IsRegistered <IWebServiceReceiverStrategy>())
            {
                if (!Container.IsRegistered <INotificationRepository>())
                {
                    var repoConfig = new FileSystemNotificationRepositoryConfig
                    {
                        BaseFolder = SmartLocation.GetLocation("_notifications")
                    };
                    Container.RegisterInstance(repoConfig);
                    Container.RegisterAsTransient <INotificationRepository>(
                        typeof(FileSystemNotificationRepository));
                }

                if (!Container.IsRegistered <MessageStalenessCheckConfig>())
                {
                    Container.RegisterAsSingleton(typeof(MessageStalenessCheckConfig));
                }

                Container.RegisterAll <IPipelineStep <WebServiceReceiverContext> >();
                Container.RegisterAsTransient <IWebServiceReceiverStrategy>(typeof(WebServiceReceiverStrategy));
            }
        }
Exemplo n.º 2
0
        public override void ProcessResource(IResource source, Castle.MicroKernel.SubSystems.Configuration.IConfigurationStore store)
        {
            // default stuff...
            base.ProcessResource(source, store);

            // custom stuff..auto register all config\*.castle.config files
            var configFilesLocation = SmartLocation.GetLocation("config");

            foreach (var extraConfig in Directory.GetFiles(configFilesLocation, "*.castle.config"))
            {
                try
                {
                    var interpreter = new XmlInterpreter(extraConfig)
                    {
                        Kernel = Kernel
                    };
                    interpreter.ProcessResource(interpreter.Source, store);
                }
                catch (ConfigurationErrorsException)
                {
                    throw;
                }
                catch (Exception ex)
                {
                    throw new InvalidOperationException("Failed to load configuration: " + extraConfig, ex);
                }
            }
        }
Exemplo n.º 3
0
 /// <summary>
 /// default ctor
 /// </summary>
 public FileInfoCheck(FileInfoCheckConfig config)
 {
     myConfig       = config;
     myFileLocation = new SmartLocation(config.FileLocation);
     myIdentity     = new PluginDescriptor
     {
         Description = string.Format("Reports information about file {0}", myFileLocation.Location),
         TypeId      = new Guid("E0DDCF22-25B6-4d05-B2C4-D1EBFBEBB681"),
         Name        = myConfig.FriendlyId
     };
 }
 private IQueryable <NotificationEvent> LoadAll()
 {
     // Serializer throws if multiple instances read same file concurrently
     lock (LockObject)
     {
         return
             (Directory.GetFiles(SmartLocation.GetLocation(_config.BaseFolder), "*.*",
                                 SearchOption.TopDirectoryOnly)
              .ToList().Select(Serialiser.FromJsonInFile <NotificationEvent>).AsQueryable());
     }
 }
Exemplo n.º 5
0
 public override int GetHashCode()
 {
     return
         (Id.GetHashCode() ^
          Name.GetHashCode() ^
          ZipCode.GetHashCode() ^
          SmartLocation.GetHashCode() ^
          Country.GetHashCode() ^
          Latitude.GetHashCode() ^
          Longitude.GetHashCode());
 }
Exemplo n.º 6
0
 /// <summary>
 /// default ctor
 /// </summary>
 public FolderInfoCheck(FolderInfoCheckConfig config)
 {
     myConfig         = config;
     myFolderLocation = new SmartLocation(config.FolderLocation);
     myIdentity       = new PluginDescriptor
     {
         Description = string.Format("Reports information about folder {0}", myFolderLocation.Location),
         TypeId      = new Guid("5A3F5E7D-28B6-4ce9-A77A-66E83FEB888A"),
         Name        = myConfig.FriendlyId
     };
 }
        public void Initialise()
        {
            Container.RegisterAll <IArtifactFormatter>();

            if (!Container.IsRegistered <IArtifactManager>())
            {
                Container.RegisterInstance <IArtifactManager>(new FileSystemArtifactManager(
                                                                  SmartLocation.GetLocation("_artifacts"),
                                                                  Container.ResolveAll <IArtifactFormatter>()));
            }

            ArtifactManager.Initialise(Container.Resolve <IArtifactManager>());
        }
Exemplo n.º 8
0
        public override void ProcessResource(IResource source,
                                             Castle.MicroKernel.SubSystems.Configuration.IConfigurationStore store,
                                             Castle.MicroKernel.IKernel kernel)
        {
            // default stuff...
            base.ProcessResource(source, store, kernel);

            // custom stuff..auto register all config\*.castle.config files
            var configFilesLocation = SmartLocation.GetLocation("config");

            if (!Directory.Exists(configFilesLocation))
            {
                return;
            }

            ProcessFolder(store, kernel, configFilesLocation);
        }
Exemplo n.º 9
0
        public bool Load(out BindingConfiguration[] components)
        {
            BindingConfiguration[] configs;
            var items = new List <BindingConfiguration>();

            if (ContainerLoader <BindingConfiguration> .Resolve(out configs))
            {
                items.AddRange(configs);
            }

            // now try to build binding configurations with convention
            // any subfolder of the config\checks folder is assumed to
            // the name of a schedule component.
            var folders = Directory.GetDirectories(SmartLocation.GetLocation(@"config\checks"));

            folders.ForEach(folder =>
            {
                // assume each file is a health check config file.
                // parse it for component ids
                var files = from file in Directory.GetFiles(folder, "*.config",
                                                            SearchOption.TopDirectoryOnly)
                            select file;

                var dirInfo    = new DirectoryInfo(folder);
                var scheduleId = dirInfo.Name;

                files.ForEach(file =>
                {
                    string[] ids;

                    if (ParseConfigFile(file, out ids))
                    {
                        ids.ForEach(checkId => items.Add(new BindingConfiguration
                        {
                            HealthCheckConfigurationName = checkId,
                            ScheduleConfigurationName    = scheduleId
                        }));
                    }
                });
            });

            components = items.ToArray();
            return(components.Length > 0);
        }
Exemplo n.º 10
0
        /// <summary>
        /// Initializes a new instance of the <see cref="T:System.Object"/> class.
        /// </summary>
        public GrowlConnection(GrowlConfiguration config)
        {
            myConfig = config;

            // create the growl connection and register it
            if (!string.IsNullOrEmpty(config.Password))
            {
                myConnector = !string.IsNullOrEmpty(config.Hostname)
                                  ? new GrowlConnector(config.Password, config.Hostname, config.Port)
                                  : new GrowlConnector(config.Password);
            }
            else
            {
                myConnector = new GrowlConnector();
            }

            var application = new Application(config.AppId);

            // use the defaul icon if no override set
            if (string.IsNullOrEmpty(config.IconFile))
            {
                config.IconFile = DEFAULT_ICON;
            }
            var icon = new SmartLocation(config.IconFile);

            if (File.Exists(icon.Location))
            {
                application.Icon = icon.Location;
            }

            var healthCheck = new NotificationType(config.NotificationId, config.NotificationTitle);

            myConnector.Register(application,
                                 new[]
            {
                healthCheck
            });
        }
Exemplo n.º 11
0
 /// <summary>
 /// default ctor
 /// </summary>
 public FolderInfoCheck(FolderInfoCheckConfig config) : base(config)
 {
     FolderLocation = new SmartLocation(config.FolderLocation);
 }
Exemplo n.º 12
0
 /// <summary>
 /// default ctor
 /// </summary>
 public FileInfoCheck(FileInfoCheckConfig config) : base(config)
 {
     FileLocation = new SmartLocation(config.FileLocation);
 }
 private string MakeItemFilename(Guid id)
 {
     return(Path.Combine(SmartLocation.GetLocation(_config.BaseFolder),
                         Path.ChangeExtension(id.ToString(), "txt")));
 }
 public FileSystemNotificationRepository(FileSystemNotificationRepositoryConfig config)
 {
     _config = config;
     Directory.CreateDirectory(SmartLocation.GetLocation(_config.BaseFolder));
 }
Exemplo n.º 15
0
 protected FileSystemConfigurationRepository(string baseFolder)
 {
     BaseFolder = SmartLocation.GetLocation(baseFolder);
 }
Exemplo n.º 16
0
 public FileSystemArtifactManager(string baseFolder, IEnumerable <IArtifactFormatter> formatters)
 {
     _baseFolder = SmartLocation.GetLocation(baseFolder);
     _formatters = formatters;
 }