public ArtifactDescriptor Save(PluginDescriptor owner, string contentType, object data)
        {
            var folder = Path.Combine(_baseFolder, owner.Name);

            var descriptor = new ArtifactDescriptor
            {
                Location = folder,
                Owner = owner
            };

            Directory.CreateDirectory(folder);

            var formatter = _formatters.Find(contentType);
            var filepath = Path.Combine(folder, Path.ChangeExtension(descriptor.Id.ToString(), DefaultExtension));

            using (var sw = new FileStream(filepath, FileMode.Create, FileAccess.Write, FileShare.None))
            {
                using (var datastream = formatter.Serialize(data))
                {
                    datastream.ChunkedOperation(4000, (buffer, size) =>
                                                          {
                                                              sw.Write(buffer, 0, size);
                                                          });
                }
            }

            return descriptor;
        }
 public FileSystemArtifactManagerDomain()
 {
     _sut = new FileSystemArtifactManager(RootFolder, new IArtifactFormatter[] { new TabSeparatedFormatter(), new JsonFormatter() });
     _pluginDescriptor = new PluginDescriptor
                             {
                                 Name = PluginName,
                                 TypeId = new Guid("D3A6F2A6-63C6-43FF-95F5-010BADAB57A2")
                             };
 }
 public HealthCheckIntervalScheduler(IHealthCheckPlugin check,
     HealthCheckIntervalSchedulerConfig config)
     : base(config)
 {
     HealthCheck = check;
     InternalIdentity = new PluginDescriptor
                      {
                          TypeId = check.Identity.TypeId,
                          Description = check.Identity.Description,
                          Name = check.Identity.Name
                      };
 }
Esempio n. 4
0
        public FastStartAgent(AgentConfiguration config,
            ILoader<INotificationEventPublisher> publisherLoader,
            ILoader<IHealthCheckSchedulerPlugin> checksLoader,
            ILoader<IActivityPlugin> activitiesLoader)
            : base(config, publisherLoader, checksLoader, activitiesLoader)
        {
            InternalIdentity = new PluginDescriptor
                             {
                                 Description = "Fast Startup Agent",
                                 Name = "FastStartAgent",
                                 TypeId = new Guid("F90773BA-C659-4964-B22D-A998719CB1FD")
                             };

            _startingGate = new ManualResetEvent(false);
        }
Esempio n. 5
0
        protected HealthCheckBaseEx(string friendlyId,
            bool enabled,
            string notificationMode,
            Guid typeId,
            string description, 
            params object[] args)
        {
            Enabled = enabled;
            NotificationMode = notificationMode;

            _identity = new PluginDescriptor
                            {
                                Name = friendlyId,
                                Description = string.Format(description, args),
                                TypeId = typeId
                            };
        }
Esempio n. 6
0
        public Agent(AgentConfiguration config,
            ILoader<INotificationEventPublisher> publisherLoader,
            ILoader<IHealthCheckSchedulerPlugin> checksLoader,
            ILoader<IActivityPlugin> activitiesLoader)
        {
            _config = config;
            PublisherLoader = publisherLoader;
            ChecksLoader = checksLoader;
            ActivitiesLoader = activitiesLoader;

            InternalIdentity = new PluginDescriptor
                             {
                                 Description = "Agent description [TODO]",
                                 Name = "Agent",
                                 TypeId = new Guid("649D0AAC-3AA0-4457-B82D-F834EA324CFA")
                             };
        }
Esempio n. 7
0
 public static ArtifactDescriptor Save(PluginDescriptor owner, IArtifactFormatter formatter, object data)
 {
     return _instance.Save(owner, formatter, data);
 }
Esempio n. 8
0
 public static ArtifactDescriptor Save(PluginDescriptor owner, string contentType, object data)
 {
     return _instance.Save(owner, contentType, data);
 }
Esempio n. 9
0
 public static HealthCheckData For(PluginDescriptor identity,
     string info, params object[] args)
 {
     return new HealthCheckData
                {
                    Identity = identity,
                    Info = string.Format(info, args)
                };
 }
 public ArtifactDescriptor Save(PluginDescriptor owner, IArtifactFormatter formatter, object data)
 {
     throw new System.NotImplementedException();
 }