Пример #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));
            }
        }
Пример #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);
                }
            }
        }
 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());
     }
 }
        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>());
        }
Пример #5
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);
        }
Пример #6
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);
        }
 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));
 }
Пример #9
0
 protected FileSystemConfigurationRepository(string baseFolder)
 {
     BaseFolder = SmartLocation.GetLocation(baseFolder);
 }
Пример #10
0
 public FileSystemArtifactManager(string baseFolder, IEnumerable <IArtifactFormatter> formatters)
 {
     _baseFolder = SmartLocation.GetLocation(baseFolder);
     _formatters = formatters;
 }