Skip to content

Commit

Permalink
Renamed actionlog to tasklog to better capture the intent that a task…
Browse files Browse the repository at this point in the history
… can be checked off by default if it was not necessary for the particular deposit-bag
  • Loading branch information
janvanmansum committed Jan 18, 2025
1 parent 83457a3 commit 1d3c737
Show file tree
Hide file tree
Showing 14 changed files with 39 additions and 39 deletions.
20 changes: 10 additions & 10 deletions docs/description.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
20 changes: 10 additions & 10 deletions src/main/java/nl/knaw/dans/dvingest/core/DataverseIngestBag.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -49,7 +49,7 @@ public class DataverseIngestBag implements Comparable<DataverseIngestBag> {
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;
Expand All @@ -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);
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -22,6 +22,6 @@
@Data
@AllArgsConstructor
@NoArgsConstructor
public class ActionLogRoot {
private ActionLog actionLog = new ActionLog();
public class TaskLogRoot {
private TaskLog taskLog = new TaskLog();
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
package nl.knaw.dans.dvingest.core.yaml.tasklog;
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 1d3c737

Please sign in to comment.