public FileSystemDTO updateFileSystemAvailability(
     String dirPath, String availability, String availabilityOfExternalRetrievable)
     throws Exception {
   String fsGroupID = getFileSystemGroupID();
   FileSystemMgt2 fsMgt = fileSystemMgt();
   return fsMgt.updateFileSystemAvailability(fsGroupID, dirPath, Availability.toInt(availability))
       ? fsMgt.updateAvailabilityForStudyOnFileSystem(
           fsGroupID,
           dirPath,
           Availability.toInt(availabilityOfExternalRetrievable),
           updateStudiesBatchSize)
       : fsMgt.getFileSystemOfGroup(fsGroupID, dirPath);
 }
 public StringBuffer toString(StringBuffer sb) {
   sb.append("FileSystem[pk=").append(pk);
   sb.append(", ").append(directoryPath);
   sb.append(", groupID=").append(groupID);
   sb.append(", aet=").append(retrieveAET);
   sb.append(", ").append(Availability.toString(availability));
   sb.append(", ").append(FileSystemStatus.toString(status));
   sb.append(", userinfo=").append(userInfo);
   if (next != null) sb.append(", next=").append(next);
   sb.append("]");
   return sb;
 }
 private boolean switchFileSystem(FileSystemMgt2 fsMgt, FileSystemDTO fsDTO) throws Exception {
   synchronized (switchFileSystemMonitor) {
     if (!updateStorageFileSystem(fsMgt)) {
       return selectStorageFileSystem() != null;
     }
     if (storageFileSystem == null || fsDTO == null) {
       log.info("Storage filesystem not set! No RW filesystem configured or no space left!");
       return false;
     } else if (storageFileSystem.getPk() != fsDTO.getPk()) {
       log.info(
           "Storage file system has already been switched from "
               + fsDTO
               + " to "
               + storageFileSystem
               + " by another thread.");
       return true;
     }
     FileSystemDTO tmp = storageFileSystem;
     String next;
     while ((next = tmp.getNext()) != null && !next.equals(storageFileSystem.getDirectoryPath())) {
       tmp = fsMgt.getFileSystemOfGroup(getFileSystemGroupID(), next);
       if (minFreeDiskSpaceRatio > 0) {
         minFreeDiskSpace = calcFreeDiskSpace(tmp);
       }
       if (tmp.getStatus() == FileSystemStatus.RW
           && tmp.getAvailability() == Availability.toInt(getDefAvailability())
           && checkFreeDiskSpace(tmp)) {
         storageFileSystem = fsMgt.updateFileSystemStatus(tmp.getPk(), FileSystemStatus.DEF_RW);
         log.info("Switch storage file system from " + fsDTO + " to " + storageFileSystem);
         sendJMXNotification(new StorageFileSystemSwitched(fsDTO, storageFileSystem));
         return true;
       }
     }
     return false;
   }
 }
 public void setDefAvailability(String availability) {
   this.defAvailability = Availability.toInt(availability);
 }
 public String getDefAvailability() {
   return Availability.toString(defAvailability);
 }