Ejemplo n.º 1
0
        static public PartitionArchive Load(IPersistenceContext read, ServerEntityKey key)
        {
            var broker = read.GetBroker <IPartitionArchiveEntityBroker>();
            PartitionArchive theObject = broker.Load(key);

            return(theObject);
        }
Ejemplo n.º 2
0
		public ArchiveStudyCommand(StudyStorageLocation storageLocation, string hsmPath, string tempPath, PartitionArchive archive)
		{
			_storageLocation = storageLocation;
			_hsmPath = hsmPath;
			_tempPath = tempPath;
			_archive = archive;

			CreateSubCommands();
		}
Ejemplo n.º 3
0
 static public PartitionArchive Insert(PartitionArchive entity)
 {
     using (var update = PersistentStoreRegistry.GetDefaultStore().OpenUpdateContext(UpdateContextSyncMode.Flush))
     {
         PartitionArchive newEntity = Insert(update, entity);
         update.Commit();
         return(newEntity);
     }
 }
        /// <summary>
        /// Update the partition whose GUID and new information are specified in <paramref name="partition"/>.
        /// 
        /// </summary>
        /// <param name="partition"></param>
        /// <returns></returns>
        public bool UpdatePartition(PartitionArchive partition)
        {
            Platform.Log(LogLevel.Info, "Updating partition archive : Type = {0} , Description = {1}", partition.ArchiveTypeEnum.Description, partition.Description);

            bool result = _archiveAdapter.Update(partition);

            if (result)
                Platform.Log(LogLevel.Info, "Updated partition archive : Type = {0} , Description = {1}", partition.ArchiveTypeEnum.Description, partition.Description);
            else
                Platform.Log(LogLevel.Info, "Failed to update partition archive : Type = {0} , Description = {1}", partition.ArchiveTypeEnum.Description, partition.Description);

            return result;
        }
        /// <summary>
        /// Add a partition in the database.
        /// </summary>
        /// <param name="partition"></param>
        public bool AddPartition(PartitionArchive partition)
        {
            Platform.Log(LogLevel.Info, "Adding new partition archive : Type = {0} , Description = {1}", partition.ArchiveTypeEnum.Description, partition.Description);

            bool result = _archiveAdapter.AddPartitionArchive(partition);

            if (result)
                Platform.Log(LogLevel.Info, "Added new partition archive : Type = {0} , Description = {1}", partition.ArchiveTypeEnum.Description, partition.Description);
            else
                Platform.Log(LogLevel.Info, "Failed to add new partition archive : Type = {0} , Description = {1}", partition.ArchiveTypeEnum.Description, partition.Description);

            return result;
        }
Ejemplo n.º 6
0
        static public PartitionArchive Insert(IUpdateContext update, PartitionArchive entity)
        {
            var broker        = update.GetBroker <IPartitionArchiveEntityBroker>();
            var updateColumns = new PartitionArchiveUpdateColumns();

            updateColumns.ServerPartitionKey = entity.ServerPartitionKey;
            updateColumns.ArchiveTypeEnum    = entity.ArchiveTypeEnum;
            updateColumns.Description        = entity.Description;
            updateColumns.Enabled            = entity.Enabled;
            updateColumns.ReadOnly           = entity.ReadOnly;
            updateColumns.ArchiveDelayHours  = entity.ArchiveDelayHours;
            updateColumns.ConfigurationXml   = entity.ConfigurationXml;
            PartitionArchive newEntity = broker.Insert(updateColumns);

            return(newEntity);
        }
Ejemplo n.º 7
0
			public PartitionArchiveService(IImageServerArchivePlugin archive, PartitionArchive partitionArchive, ServerPartition partition)
			{
				_archive = archive;
				_partitionArchive = partitionArchive;
				_serverPartition = partition;
			}
        /// <summary>
        /// Determine if the specified partition can be deleted. If studies are scheduled
        /// to be archived on that partition or studies are already archived on that partition,
        /// then the partition may not be deleted.
        /// 
        /// </summary>
        /// <param name="partition"></param>
        /// <returns></returns>
        public bool CanDelete(PartitionArchive partition)
        {          
            ArchiveQueueAdaptor archiveQueueAdaptor = new ArchiveQueueAdaptor();
            ArchiveQueueSelectCriteria selectCriteria = new ArchiveQueueSelectCriteria();
            selectCriteria.PartitionArchiveKey.EqualTo(partition.GetKey());

            ArchiveStudyStorageAdaptor archiveStudyStorageAdaptor = new ArchiveStudyStorageAdaptor();
            ArchiveStudyStorageSelectCriteria criteria = new ArchiveStudyStorageSelectCriteria();
            criteria.PartitionArchiveKey.EqualTo(partition.GetKey());

            int queueItems = archiveQueueAdaptor.GetCount(selectCriteria);
			int storageItems = 0;
			// only check if we need to.
			if (queueItems == 0) storageItems = archiveStudyStorageAdaptor.GetCount(criteria);

			return !((queueItems > 0) || (storageItems > 0));
        }
		public override void Start(PartitionArchive archive)
		{
			_partitionArchive = archive;

			throw new NotImplementedException();
		}
 /// <summary>
 /// Delete the specified partition
 /// 
 /// </summary>
 /// <param name="partition"></param>
 /// <returns></returns>
 public bool Delete(PartitionArchive partition)
 {
     return _archiveAdapter.Delete(partition.GetKey());
 }
Ejemplo n.º 11
0
		public DeleteAllArchiveQueueItemCommand(StudyStorage studyStorage, PartitionArchive archive)
			:base("Delete Archive Queue items")
		{
			_archive = archive;
			_studyStorage = studyStorage;
		}
Ejemplo n.º 12
0
		/// <summary>
		/// Start the archive.
		/// </summary>
		/// <param name="archive">The <see cref="PartitionArchive"/> to start.</param>
		public override void Start(PartitionArchive archive)
		{
			_partitionArchive = archive;

			LoadServerPartition();
		
			_nasPath = string.Empty;

			//Nas Archive specific Xml data.
			XmlElement element = archive.ConfigurationXml.DocumentElement;
			foreach (XmlElement node in element.ChildNodes)
			{
                switch (node.Name)
                {
                    case "RootDir": _nasPath = node.InnerText; break;
                    case "MinimumAvailableSpace": MinimumAvailableSpace = long.Parse(node.InnerText); break;
                 }
            }
			
			// Start the restore service
			_restoreService = new NasRestoreService("NAS Restore", this);
			_restoreService.StartService();

			// If not "readonly", start the archive service.
			if (!_partitionArchive.ReadOnly)
			{
				_archiveService = new NasArchiveService("NAS Archive", this);	
				_archiveService.StartService();
			}			
		}
Ejemplo n.º 13
0
		public string GetArchivePath(PartitionArchive archive)
		{
			var element = archive.ConfigurationXml.DocumentElement;
			if (element != null)
				foreach (XmlElement node in element.ChildNodes)
					if (node.Name.Equals("RootDir"))
						return node.InnerText;

			return null;
		}
Ejemplo n.º 14
0
 static public PartitionArchive Insert(IUpdateContext update, PartitionArchive entity)
 {
     var broker = update.GetBroker<IPartitionArchiveEntityBroker>();
     var updateColumns = new PartitionArchiveUpdateColumns();
     updateColumns.ServerPartitionKey = entity.ServerPartitionKey;
     updateColumns.ArchiveTypeEnum = entity.ArchiveTypeEnum;
     updateColumns.Description = entity.Description;
     updateColumns.Enabled = entity.Enabled;
     updateColumns.ReadOnly = entity.ReadOnly;
     updateColumns.ArchiveDelayHours = entity.ArchiveDelayHours;
     updateColumns.ConfigurationXml = entity.ConfigurationXml;
     PartitionArchive newEntity = broker.Insert(updateColumns);
     return newEntity;
 }
Ejemplo n.º 15
0
 static public PartitionArchive Insert(PartitionArchive entity)
 {
     using (var update = PersistentStoreRegistry.GetDefaultStore().OpenUpdateContext(UpdateContextSyncMode.Flush))
     {
         PartitionArchive newEntity = Insert(update, entity);
         update.Commit();
         return newEntity;
     }
 }
Ejemplo n.º 16
0
		public abstract void Start(PartitionArchive archive);
Ejemplo n.º 17
0
		/// <summary>
		/// Start the archive.
		/// </summary>
		/// <param name="archive">The <see cref="PartitionArchive"/> to start.</param>
		public override void Start(PartitionArchive archive)
		{
            HsmPath = string.Empty;
            
            PartitionArchive = archive;

			LoadServerPartition();
				
			//Hsm Archive specific Xml data.
			XmlElement element = archive.ConfigurationXml.DocumentElement;
            if (element!=null)
			    foreach (XmlElement node in element.ChildNodes)
				    if (node.Name.Equals("RootDir"))
					    HsmPath = node.InnerText;
			
			// Start the restore service
			_restoreService = new HsmRestoreService("HSM Restore", this);
			_restoreService.StartService();

			// If not "readonly", start the archive service.
			if (!PartitionArchive.ReadOnly)
			{
				_archiveService = new HsmArchiveService("HSM Archive", this);	
				_archiveService.StartService();
			}			
		}