// TODO (CR Jun 2012): Move to a helper class?

		#region Implementation of IStorageConfiguration

		public GetStorageConfigurationResult GetConfiguration(GetStorageConfigurationRequest request)
		{
			var storageSettings = new StorageSettings();
			var deletionSettings = new StudyDeletionSettings();

			var configuration = new StorageConfiguration
			                    	{
			                    		FileStoreDirectory = storageSettings.FileStoreDirectory,
			                    		MinimumFreeSpacePercent = storageSettings.MinimumFreeSpacePercent,
			                    		DefaultDeletionRule = new StorageConfiguration.DeletionRule
			                    		                      	{
			                    		                      		Enabled = deletionSettings.Enabled,
			                    		                      		TimeUnit = deletionSettings.TimeUnit,
			                    		                      		TimeValue = deletionSettings.TimeValue
			                    		                      	}
			                    	};

			Complete(configuration);
			return new GetStorageConfigurationResult {Configuration = configuration};
		}
Exemplo n.º 2
0
        // TODO (CR Jun 2012): Move to a helper class?

        #region Implementation of IStorageConfiguration

        public GetStorageConfigurationResult GetConfiguration(GetStorageConfigurationRequest request)
        {
            var storageSettings  = new StorageSettings();
            var deletionSettings = new StudyDeletionSettings();

            var configuration = new StorageConfiguration
            {
                FileStoreDirectory      = storageSettings.FileStoreDirectory,
                MinimumFreeSpacePercent = storageSettings.MinimumFreeSpacePercent,
                DefaultDeletionRule     = new StorageConfiguration.DeletionRule
                {
                    Enabled   = deletionSettings.Enabled,
                    TimeUnit  = deletionSettings.TimeUnit,
                    TimeValue = deletionSettings.TimeValue
                }
            };

            Complete(configuration);
            return(new GetStorageConfigurationResult {
                Configuration = configuration
            });
        }
Exemplo n.º 3
0
        public UpdateStorageConfigurationResult UpdateConfiguration(UpdateStorageConfigurationRequest request)
        {
            Platform.CheckForNullReference(request, "request");
            Platform.CheckForNullReference(request.Configuration, "Configuration");
            Platform.CheckForEmptyString(request.Configuration.FileStoreDirectory, "FileStoreDirectory");

            var newConfiguration = request.Configuration.Clone();

            //Trim before saving.
            newConfiguration.FileStoreDirectory = request.Configuration.FileStoreDirectory.Trim();
            Complete(newConfiguration);

            var storageSettings  = new StorageSettings();
            var deletionSettings = new StudyDeletionSettings();
            var storageProxy     = storageSettings.GetProxy();

            storageProxy.FileStoreDirectory      = newConfiguration.FileStoreDirectory;
            storageProxy.MinimumFreeSpacePercent = newConfiguration.MinimumFreeSpacePercent;
            storageProxy.Save();

            if (newConfiguration.DefaultDeletionRule == null)
            {
                deletionSettings.Reset();
                deletionSettings.Save();
            }
            else
            {
                var rule          = newConfiguration.DefaultDeletionRule;
                var deletionProxy = deletionSettings.GetProxy();
                deletionProxy.Enabled   = rule.Enabled;
                deletionProxy.TimeUnit  = rule.TimeUnit;
                deletionProxy.TimeValue = rule.TimeValue;
                deletionProxy.Save();
            }

            return(new UpdateStorageConfigurationResult());
        }
        public UpdateStorageConfigurationResult UpdateConfiguration(UpdateStorageConfigurationRequest request)
        {
            Platform.CheckForNullReference(request, "request");
            Platform.CheckForNullReference(request.Configuration, "Configuration");
            Platform.CheckForEmptyString(request.Configuration.FileStoreDirectory, "FileStoreDirectory");

            var newConfiguration = request.Configuration.Clone();

            //Trim before saving.
            newConfiguration.FileStoreDirectory = request.Configuration.FileStoreDirectory.Trim();
            Complete(newConfiguration);

            var storageSettings = new StorageSettings();
            var deletionSettings = new StudyDeletionSettings();
            var storageProxy = storageSettings.GetProxy();
            storageProxy.FileStoreDirectory = newConfiguration.FileStoreDirectory;
            storageProxy.MinimumFreeSpacePercent = newConfiguration.MinimumFreeSpacePercent;
            storageProxy.Save();

            if (newConfiguration.DefaultDeletionRule == null)
            {
                deletionSettings.Reset();
                deletionSettings.Save();
            }
            else
            {
                var rule = newConfiguration.DefaultDeletionRule;
                var deletionProxy = deletionSettings.GetProxy();
                deletionProxy.Enabled = rule.Enabled;
                deletionProxy.TimeUnit = rule.TimeUnit;
                deletionProxy.TimeValue = rule.TimeValue;
                deletionProxy.Save();
            }

            return new UpdateStorageConfigurationResult();
        }
Exemplo n.º 5
0
 public Proxy(StorageSettings settings)
 {
     _settings = settings;
 }
Exemplo n.º 6
0
 public Proxy(StorageSettings settings)
 {
     _settings = settings;
 }