From 1d3c737f8041922a4e2be2d6afbc38304d4fef5b Mon Sep 17 00:00:00 2001 From: Jan van Mansum Date: Sat, 18 Jan 2025 10:03:13 +0100 Subject: [PATCH] Renamed actionlog to tasklog to better capture the intent that a task can be checked off by default if it was not necessary for the particular deposit-bag --- docs/description.md | 20 +++++++++---------- .../dvingest/core/DataverseIngestBag.java | 20 +++++++++---------- .../bagprocessor/DatasetVersionCreator.java | 4 ++-- .../CompletableItem.java | 2 +- .../CompletableItemWithCount.java | 2 +- .../{actionlog => tasklog}/EditFilesLog.java | 2 +- .../EditMetadataLog.java | 2 +- .../EditPermissionsLog.java | 2 +- .../{actionlog => tasklog}/ExpectLog.java | 2 +- .../yaml/{actionlog => tasklog}/InitLog.java | 2 +- .../ActionLog.java => tasklog/TaskLog.java} | 4 ++-- .../TaskLogRoot.java} | 6 +++--- .../{actionlog => tasklog}/package-info.java | 6 +++--- .../DatasetVersionCreatorTest.java | 4 ++-- 14 files changed, 39 insertions(+), 39 deletions(-) rename src/main/java/nl/knaw/dans/dvingest/core/yaml/{actionlog => tasklog}/CompletableItem.java (93%) rename src/main/java/nl/knaw/dans/dvingest/core/yaml/{actionlog => tasklog}/CompletableItemWithCount.java (93%) rename src/main/java/nl/knaw/dans/dvingest/core/yaml/{actionlog => tasklog}/EditFilesLog.java (96%) rename src/main/java/nl/knaw/dans/dvingest/core/yaml/{actionlog => tasklog}/EditMetadataLog.java (94%) rename src/main/java/nl/knaw/dans/dvingest/core/yaml/{actionlog => tasklog}/EditPermissionsLog.java (94%) rename src/main/java/nl/knaw/dans/dvingest/core/yaml/{actionlog => tasklog}/ExpectLog.java (95%) rename src/main/java/nl/knaw/dans/dvingest/core/yaml/{actionlog => tasklog}/InitLog.java (94%) rename src/main/java/nl/knaw/dans/dvingest/core/yaml/{actionlog/ActionLog.java => tasklog/TaskLog.java} (93%) rename src/main/java/nl/knaw/dans/dvingest/core/yaml/{actionlog/ActionLogRoot.java => tasklog/TaskLogRoot.java} (85%) rename src/main/java/nl/knaw/dans/dvingest/core/yaml/{actionlog => tasklog}/package-info.java (63%) diff --git a/docs/description.md b/docs/description.md index c01b6c2..81c2f6f 100644 --- a/docs/description.md +++ b/docs/description.md @@ -53,24 +53,24 @@ The init file initializes the ingest process. It can be used to verify that an e ```yaml init: expect: - state: 'released' # or 'draft', 'absent'. + state: 'released' # or 'draft' dataverseRoleAssignment: - assignee: '@myuser' - role: ':autenticated-user' + assignee: '@myuser' + role: ':autenticated-user' datasetRoleAssignment: - assignee: '@myuser' - role: 'contributor' + assignee: '@myuser' + role: 'contributor' ``` -If the state of the dataset does not match the expected state, the ingest procedure will be aborted and the deposit will be put in the FAILED state. The -expected state can be either `released`, `draft` or `absent` (meaning that the dataset should not exist). By default, no check will be performed. +If the state of the dataset does not match the expected state, the ingest procedure will be aborted and the deposit will be put in the FAILED state. The +expected state can be either `released` or `draft`. By default, no check will be performed. -If the role assignment in `dataverseRoleAssignment` does not exist on the target dataverse collection (currently always `root`) the ingest procedure will be +If the role assignment in `dataverseRoleAssignment` does not exist on the target dataverse collection (currently always `root`) the ingest procedure will be aborted putting the deposit in a REJECTED state. The same happens if the role assignment in `datasetRoleAssignment` does not exist on the target dataset -(only applicable to update-deposits). +(only applicable to update-deposits). -Note the difference in the resulting deposit state when expectations are not met. The rationale is that an unexpected dataset state is likely an error by the +Note the difference in the resulting deposit state when expectations are not met. The rationale is that an unexpected dataset state is likely an error by the service or Dataverse and the expected role assignments are a kind of authorization check. The `init.yml` file can also be used to instruct the service to import the bag as a dataset with an existing DOI: diff --git a/src/main/java/nl/knaw/dans/dvingest/core/DataverseIngestBag.java b/src/main/java/nl/knaw/dans/dvingest/core/DataverseIngestBag.java index bab844a..f3c5da4 100644 --- a/src/main/java/nl/knaw/dans/dvingest/core/DataverseIngestBag.java +++ b/src/main/java/nl/knaw/dans/dvingest/core/DataverseIngestBag.java @@ -28,8 +28,8 @@ import nl.knaw.dans.dvingest.core.yaml.InitRoot; import nl.knaw.dans.dvingest.core.yaml.UpdateAction; import nl.knaw.dans.dvingest.core.yaml.UpdateStateRoot; -import nl.knaw.dans.dvingest.core.yaml.actionlog.ActionLog; -import nl.knaw.dans.dvingest.core.yaml.actionlog.ActionLogRoot; +import nl.knaw.dans.dvingest.core.yaml.tasklog.TaskLog; +import nl.knaw.dans.dvingest.core.yaml.tasklog.TaskLogRoot; import nl.knaw.dans.lib.dataverse.model.dataset.Dataset; import java.io.IOException; @@ -49,7 +49,7 @@ public class DataverseIngestBag implements Comparable { public static final String ACTION_LOG_YML = "action-log.yml"; private final Path bagDir; - private final ActionLog actionLog; + private final TaskLog taskLog; public DataverseIngestBag(Path bagDir, YamlService yamlService) throws IOException { this.bagDir = bagDir; @@ -59,13 +59,13 @@ public DataverseIngestBag(Path bagDir, YamlService yamlService) throws IOExcepti throw new IllegalStateException("Not a bag: " + bagDir); } if (!Files.exists(bagDir.resolve(ACTION_LOG_YML))) { - actionLog = new ActionLog(); + taskLog = new TaskLog(); saveActionLog(); } else { try { - var actionLogRoot = yamlService.readYaml(bagDir.resolve(ACTION_LOG_YML), ActionLogRoot.class); - actionLog = actionLogRoot.getActionLog(); + var actionLogRoot = yamlService.readYaml(bagDir.resolve(ACTION_LOG_YML), TaskLogRoot.class); + taskLog = actionLogRoot.getTaskLog(); } catch (ConfigurationException e) { throw new IllegalStateException("Error reading action log", e); @@ -126,14 +126,14 @@ public UpdateAction getUpdateState() throws IOException, ConfigurationException return updateStateRoot.getUpdateState(); } - public ActionLog getActionLog() throws IOException, ConfigurationException { + public TaskLog getActionLog() throws IOException, ConfigurationException { - var actionLogRoot = yamService.readYaml(bagDir.resolve(ACTION_LOG_YML), ActionLogRoot.class); - return actionLogRoot.getActionLog(); + var actionLogRoot = yamService.readYaml(bagDir.resolve(ACTION_LOG_YML), TaskLogRoot.class); + return actionLogRoot.getTaskLog(); } public void saveActionLog() throws IOException { - yamService.writeYaml(new ActionLogRoot(actionLog), bagDir.resolve(ACTION_LOG_YML)); + yamService.writeYaml(new TaskLogRoot(taskLog), bagDir.resolve(ACTION_LOG_YML)); } @Override diff --git a/src/main/java/nl/knaw/dans/dvingest/core/bagprocessor/DatasetVersionCreator.java b/src/main/java/nl/knaw/dans/dvingest/core/bagprocessor/DatasetVersionCreator.java index 23089dd..0390ad1 100644 --- a/src/main/java/nl/knaw/dans/dvingest/core/bagprocessor/DatasetVersionCreator.java +++ b/src/main/java/nl/knaw/dans/dvingest/core/bagprocessor/DatasetVersionCreator.java @@ -22,8 +22,8 @@ import nl.knaw.dans.dvingest.core.service.DataverseService; import nl.knaw.dans.dvingest.core.yaml.Expect; import nl.knaw.dans.dvingest.core.yaml.Init; -import nl.knaw.dans.dvingest.core.yaml.actionlog.CompletableItem; -import nl.knaw.dans.dvingest.core.yaml.actionlog.InitLog; +import nl.knaw.dans.dvingest.core.yaml.tasklog.CompletableItem; +import nl.knaw.dans.dvingest.core.yaml.tasklog.InitLog; import nl.knaw.dans.lib.dataverse.DataverseException; import nl.knaw.dans.lib.dataverse.model.RoleAssignment; import nl.knaw.dans.lib.dataverse.model.RoleAssignmentReadOnly; diff --git a/src/main/java/nl/knaw/dans/dvingest/core/yaml/actionlog/CompletableItem.java b/src/main/java/nl/knaw/dans/dvingest/core/yaml/tasklog/CompletableItem.java similarity index 93% rename from src/main/java/nl/knaw/dans/dvingest/core/yaml/actionlog/CompletableItem.java rename to src/main/java/nl/knaw/dans/dvingest/core/yaml/tasklog/CompletableItem.java index 84b6b28..70e2241 100644 --- a/src/main/java/nl/knaw/dans/dvingest/core/yaml/actionlog/CompletableItem.java +++ b/src/main/java/nl/knaw/dans/dvingest/core/yaml/tasklog/CompletableItem.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package nl.knaw.dans.dvingest.core.yaml.actionlog; +package nl.knaw.dans.dvingest.core.yaml.tasklog; import lombok.Data; diff --git a/src/main/java/nl/knaw/dans/dvingest/core/yaml/actionlog/CompletableItemWithCount.java b/src/main/java/nl/knaw/dans/dvingest/core/yaml/tasklog/CompletableItemWithCount.java similarity index 93% rename from src/main/java/nl/knaw/dans/dvingest/core/yaml/actionlog/CompletableItemWithCount.java rename to src/main/java/nl/knaw/dans/dvingest/core/yaml/tasklog/CompletableItemWithCount.java index 2364252..e026846 100644 --- a/src/main/java/nl/knaw/dans/dvingest/core/yaml/actionlog/CompletableItemWithCount.java +++ b/src/main/java/nl/knaw/dans/dvingest/core/yaml/tasklog/CompletableItemWithCount.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package nl.knaw.dans.dvingest.core.yaml.actionlog; +package nl.knaw.dans.dvingest.core.yaml.tasklog; import lombok.Data; diff --git a/src/main/java/nl/knaw/dans/dvingest/core/yaml/actionlog/EditFilesLog.java b/src/main/java/nl/knaw/dans/dvingest/core/yaml/tasklog/EditFilesLog.java similarity index 96% rename from src/main/java/nl/knaw/dans/dvingest/core/yaml/actionlog/EditFilesLog.java rename to src/main/java/nl/knaw/dans/dvingest/core/yaml/tasklog/EditFilesLog.java index 84c1fd1..9e73d20 100644 --- a/src/main/java/nl/knaw/dans/dvingest/core/yaml/actionlog/EditFilesLog.java +++ b/src/main/java/nl/knaw/dans/dvingest/core/yaml/tasklog/EditFilesLog.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package nl.knaw.dans.dvingest.core.yaml.actionlog; +package nl.knaw.dans.dvingest.core.yaml.tasklog; import lombok.Data; diff --git a/src/main/java/nl/knaw/dans/dvingest/core/yaml/actionlog/EditMetadataLog.java b/src/main/java/nl/knaw/dans/dvingest/core/yaml/tasklog/EditMetadataLog.java similarity index 94% rename from src/main/java/nl/knaw/dans/dvingest/core/yaml/actionlog/EditMetadataLog.java rename to src/main/java/nl/knaw/dans/dvingest/core/yaml/tasklog/EditMetadataLog.java index 74be1d1..37e213e 100644 --- a/src/main/java/nl/knaw/dans/dvingest/core/yaml/actionlog/EditMetadataLog.java +++ b/src/main/java/nl/knaw/dans/dvingest/core/yaml/tasklog/EditMetadataLog.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package nl.knaw.dans.dvingest.core.yaml.actionlog; +package nl.knaw.dans.dvingest.core.yaml.tasklog; import lombok.Data; diff --git a/src/main/java/nl/knaw/dans/dvingest/core/yaml/actionlog/EditPermissionsLog.java b/src/main/java/nl/knaw/dans/dvingest/core/yaml/tasklog/EditPermissionsLog.java similarity index 94% rename from src/main/java/nl/knaw/dans/dvingest/core/yaml/actionlog/EditPermissionsLog.java rename to src/main/java/nl/knaw/dans/dvingest/core/yaml/tasklog/EditPermissionsLog.java index 563611b..da649d7 100644 --- a/src/main/java/nl/knaw/dans/dvingest/core/yaml/actionlog/EditPermissionsLog.java +++ b/src/main/java/nl/knaw/dans/dvingest/core/yaml/tasklog/EditPermissionsLog.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package nl.knaw.dans.dvingest.core.yaml.actionlog; +package nl.knaw.dans.dvingest.core.yaml.tasklog; import lombok.Data; diff --git a/src/main/java/nl/knaw/dans/dvingest/core/yaml/actionlog/ExpectLog.java b/src/main/java/nl/knaw/dans/dvingest/core/yaml/tasklog/ExpectLog.java similarity index 95% rename from src/main/java/nl/knaw/dans/dvingest/core/yaml/actionlog/ExpectLog.java rename to src/main/java/nl/knaw/dans/dvingest/core/yaml/tasklog/ExpectLog.java index 2683a71..ee6ebd4 100644 --- a/src/main/java/nl/knaw/dans/dvingest/core/yaml/actionlog/ExpectLog.java +++ b/src/main/java/nl/knaw/dans/dvingest/core/yaml/tasklog/ExpectLog.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package nl.knaw.dans.dvingest.core.yaml.actionlog; +package nl.knaw.dans.dvingest.core.yaml.tasklog; import lombok.Data; diff --git a/src/main/java/nl/knaw/dans/dvingest/core/yaml/actionlog/InitLog.java b/src/main/java/nl/knaw/dans/dvingest/core/yaml/tasklog/InitLog.java similarity index 94% rename from src/main/java/nl/knaw/dans/dvingest/core/yaml/actionlog/InitLog.java rename to src/main/java/nl/knaw/dans/dvingest/core/yaml/tasklog/InitLog.java index 65fd56d..e0d2615 100644 --- a/src/main/java/nl/knaw/dans/dvingest/core/yaml/actionlog/InitLog.java +++ b/src/main/java/nl/knaw/dans/dvingest/core/yaml/tasklog/InitLog.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package nl.knaw.dans.dvingest.core.yaml.actionlog; +package nl.knaw.dans.dvingest.core.yaml.tasklog; import lombok.Data; diff --git a/src/main/java/nl/knaw/dans/dvingest/core/yaml/actionlog/ActionLog.java b/src/main/java/nl/knaw/dans/dvingest/core/yaml/tasklog/TaskLog.java similarity index 93% rename from src/main/java/nl/knaw/dans/dvingest/core/yaml/actionlog/ActionLog.java rename to src/main/java/nl/knaw/dans/dvingest/core/yaml/tasklog/TaskLog.java index 1d45a4a..b436318 100644 --- a/src/main/java/nl/knaw/dans/dvingest/core/yaml/actionlog/ActionLog.java +++ b/src/main/java/nl/knaw/dans/dvingest/core/yaml/tasklog/TaskLog.java @@ -13,12 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package nl.knaw.dans.dvingest.core.yaml.actionlog; +package nl.knaw.dans.dvingest.core.yaml.tasklog; import lombok.Data; @Data -public class ActionLog { +public class TaskLog { private InitLog init = new InitLog(); private CompletableItem dataset = new CompletableItem(); private EditFilesLog editFiles = new EditFilesLog(); diff --git a/src/main/java/nl/knaw/dans/dvingest/core/yaml/actionlog/ActionLogRoot.java b/src/main/java/nl/knaw/dans/dvingest/core/yaml/tasklog/TaskLogRoot.java similarity index 85% rename from src/main/java/nl/knaw/dans/dvingest/core/yaml/actionlog/ActionLogRoot.java rename to src/main/java/nl/knaw/dans/dvingest/core/yaml/tasklog/TaskLogRoot.java index 4ab1cea..20a7cc2 100644 --- a/src/main/java/nl/knaw/dans/dvingest/core/yaml/actionlog/ActionLogRoot.java +++ b/src/main/java/nl/knaw/dans/dvingest/core/yaml/tasklog/TaskLogRoot.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package nl.knaw.dans.dvingest.core.yaml.actionlog; +package nl.knaw.dans.dvingest.core.yaml.tasklog; import lombok.AllArgsConstructor; import lombok.Data; @@ -22,6 +22,6 @@ @Data @AllArgsConstructor @NoArgsConstructor -public class ActionLogRoot { - private ActionLog actionLog = new ActionLog(); +public class TaskLogRoot { + private TaskLog taskLog = new TaskLog(); } diff --git a/src/main/java/nl/knaw/dans/dvingest/core/yaml/actionlog/package-info.java b/src/main/java/nl/knaw/dans/dvingest/core/yaml/tasklog/package-info.java similarity index 63% rename from src/main/java/nl/knaw/dans/dvingest/core/yaml/actionlog/package-info.java rename to src/main/java/nl/knaw/dans/dvingest/core/yaml/tasklog/package-info.java index 8417773..cd6e399 100644 --- a/src/main/java/nl/knaw/dans/dvingest/core/yaml/actionlog/package-info.java +++ b/src/main/java/nl/knaw/dans/dvingest/core/yaml/tasklog/package-info.java @@ -14,7 +14,7 @@ * limitations under the License. */ /** - * Classes for reading and writing the action log in YAML format. The action log keeps track of the actions that have been performed on a dataset. It can be used to resume an ingest process after a - * failure. Optional steps that are absent are assumed to have been completed successfully when the processor reaches them. + * Classes for reading and writing the task log in YAML format. The action log keeps track of the tasks that have been performed on a dataset. If an optional task is not needed in for the particular + * dataset, it is considered done by default (vacuously true). */ -package nl.knaw.dans.dvingest.core.yaml.actionlog; \ No newline at end of file +package nl.knaw.dans.dvingest.core.yaml.tasklog; \ No newline at end of file diff --git a/src/test/java/nl/knaw/dans/dvingest/core/bagprocessor/DatasetVersionCreatorTest.java b/src/test/java/nl/knaw/dans/dvingest/core/bagprocessor/DatasetVersionCreatorTest.java index be70d2d..e3791f6 100644 --- a/src/test/java/nl/knaw/dans/dvingest/core/bagprocessor/DatasetVersionCreatorTest.java +++ b/src/test/java/nl/knaw/dans/dvingest/core/bagprocessor/DatasetVersionCreatorTest.java @@ -21,8 +21,8 @@ import nl.knaw.dans.dvingest.core.service.YamlService; import nl.knaw.dans.dvingest.core.service.YamlServiceImpl; import nl.knaw.dans.dvingest.core.yaml.InitRoot; -import nl.knaw.dans.dvingest.core.yaml.actionlog.CompletableItem; -import nl.knaw.dans.dvingest.core.yaml.actionlog.InitLog; +import nl.knaw.dans.dvingest.core.yaml.tasklog.CompletableItem; +import nl.knaw.dans.dvingest.core.yaml.tasklog.InitLog; import nl.knaw.dans.lib.dataverse.model.RoleAssignmentReadOnly; import nl.knaw.dans.lib.dataverse.model.dataset.Dataset; import org.junit.jupiter.api.BeforeEach;