Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,13 @@
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>3.8.0</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
Expand Down
2 changes: 2 additions & 0 deletions src/main/config/run.properties.example
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ sizeCheckIntervalSeconds = 60
reader = db username root password password
!readOnly = true
maxIdsInQuery = 1000
!allowRestoreFailures = true
!missingFilesZipEntryName = path/to/FILENAME.txt

# Properties for archive storage
plugin.archive.class = org.icatproject.ids.storage.ArchiveFileStorage
Expand Down
24 changes: 20 additions & 4 deletions src/main/java/org/icatproject/ids/FiniteStateMachine.java
Original file line number Diff line number Diff line change
Expand Up @@ -624,10 +624,26 @@ public void recordFailure(Long id) {
}
}

public void checkFailure(Long id) throws InternalException {
/**
* Check whether the Dataset/Datafile ID (depending on the StorageUnit set)
* is in the list of IDs that failed to restore. The behaviour then depends
* on whether the property allowRestoreFailures is set.
*
* @param id a Dataset or Datafile ID
* @return true if the ID is found in the list of failures and
* allowRestoreFailures is set, false if the ID is not found
* @throws InternalException if the ID is found in the list of failures
* and allowRestoreFailures is not set
*/
public boolean checkFailure(Long id) throws InternalException {
if (failures.contains(id)) {
throw new InternalException("Restore failed");
}
}
if (propertyHandler.getAllowRestoreFailures()) {
return true;
} else {
throw new InternalException("Restore failed");
}
}
return false;
}

}
Loading