Skip to content

Commit

Permalink
Dependencies for CITS SIARD
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosjepard committed Nov 28, 2024
1 parent 214fe76 commit f137b04
Show file tree
Hide file tree
Showing 14 changed files with 289 additions and 173 deletions.
116 changes: 0 additions & 116 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -200,64 +200,6 @@
<format>json</format>
</configuration>
</plugin>
<plugin>
<groupId>org.jvnet.jaxb</groupId>
<artifactId>jaxb-maven-plugin</artifactId>
<version>4.0.0</version>
<executions>
<execution>
<id>generate-JAXB-METSv1</id>
<phase>generate-sources</phase>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<schemaDirectory>src/main/resources/schemas</schemaDirectory>
<schemaIncludes>
<include>mets1_11.xsd</include>
</schemaIncludes>
<cleanPackageDirectories>true</cleanPackageDirectories>
<generatePackage>org.roda_project.commons_ip.mets_v1_11.beans</generatePackage>
<generateDirectory>${project.build.directory}/generated-sources/xjc1</generateDirectory>
<bindingIncludes>
<include>mets1_11.xjb</include>
</bindingIncludes>
</configuration>
</execution>
<execution>
<id>generate-JAXB</id>
<phase>generate-sources</phase>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<schemaDirectory>src/main/resources/schemas2</schemaDirectory>
<schemaIncludes>
<include>mets1_12.xsd</include>
</schemaIncludes>
<cleanPackageDirectories>true</cleanPackageDirectories>
<generatePackage>org.roda_project.commons_ip2.mets_v1_12.beans</generatePackage>
<generateDirectory>${project.build.directory}/generated-sources/xjc2</generateDirectory>
<bindingIncludes>
<include>mets1_12.xjb</include>
</bindingIncludes>
</configuration>
</execution>
</executions>
<configuration>
<extension>true</extension>
<args>
<arg>-Xsimplify</arg>
</args>
<plugins>
<plugin>
<groupId>org.jvnet.jaxb</groupId>
<artifactId>jaxb-plugins</artifactId>
<version>3.0.0</version>
</plugin>
</plugins>
</configuration>
</plugin>
</plugins>
</build>
</profile>
Expand Down Expand Up @@ -352,64 +294,6 @@
<format>json</format>
</configuration>
</plugin>
<plugin>
<groupId>org.jvnet.jaxb</groupId>
<artifactId>jaxb-maven-plugin</artifactId>
<version>4.0.0</version>
<executions>
<execution>
<id>generate-JAXB-METSv1</id>
<phase>generate-sources</phase>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<schemaDirectory>src/main/resources/schemas</schemaDirectory>
<schemaIncludes>
<include>mets1_11.xsd</include>
</schemaIncludes>
<cleanPackageDirectories>true</cleanPackageDirectories>
<generatePackage>org.roda_project.commons_ip.mets_v1_11.beans</generatePackage>
<generateDirectory>${project.build.directory}/generated-sources/xjc1</generateDirectory>
<bindingIncludes>
<include>mets1_11.xjb</include>
</bindingIncludes>
</configuration>
</execution>
<execution>
<id>generate-JAXB</id>
<phase>generate-sources</phase>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<schemaDirectory>src/main/resources/schemas2</schemaDirectory>
<schemaIncludes>
<include>mets1_12.xsd</include>
</schemaIncludes>
<cleanPackageDirectories>true</cleanPackageDirectories>
<generatePackage>org.roda_project.commons_ip2.mets_v1_12.beans</generatePackage>
<generateDirectory>${project.build.directory}/generated-sources/xjc2</generateDirectory>
<bindingIncludes>
<include>mets1_12.xjb</include>
</bindingIncludes>
</configuration>
</execution>
</executions>
<configuration>
<extension>true</extension>
<args>
<arg>-Xsimplify</arg>
</args>
<plugins>
<plugin>
<groupId>org.jvnet.jaxb</groupId>
<artifactId>jaxb-plugins</artifactId>
<version>3.0.0</version>
</plugin>
</plugins>
</configuration>
</plugin>
</plugins>
</build>
</profile>
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/roda_project/commons_ip/utils/IPEnums.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

public class IPEnums {
public enum IPType {
SIP, AIP, DIP;
SIP, AIP, DIP, SIARD;
}

public enum IPStatus {
Expand All @@ -33,7 +33,7 @@ public static IPStatus parse(String value) {
}

public enum SipType {
EARK2S, EARK2
EARK2S, EARK2, SIARD
}

}
43 changes: 22 additions & 21 deletions src/main/java/org/roda_project/commons_ip2/cli/Validate.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import javax.xml.parsers.ParserConfigurationException;

import org.roda_project.commons_ip2.cli.model.ExitCodes;
import org.roda_project.commons_ip2.cli.model.enums.ReportType;
import org.roda_project.commons_ip2.cli.model.enums.ReportTypeEnums;
import org.roda_project.commons_ip2.cli.model.exception.CLIException;
import org.roda_project.commons_ip2.cli.model.exception.ValidationException;
import org.roda_project.commons_ip2.cli.utils.CLI.ValidateCommandUtils;
Expand All @@ -27,6 +27,9 @@

import picocli.CommandLine;

import static org.roda_project.commons_ip2.cli.model.enums.ReportTypeEnums.ReportType.COMMONS_IP;
import static org.roda_project.commons_ip2.cli.model.enums.ReportTypeEnums.ReportType.PYIP;

/**
* @author Miguel Guimarães <mguimaraes@keep.pt>
*/
Expand All @@ -48,7 +51,7 @@ public class Validate implements Callable<Integer> {

@CommandLine.Option(names = {"-r",
"--reporter-type"}, paramLabel = "<type>", description = "Report type (possible values: ${COMPLETION-CANDIDATES})")
ReportType reportType = ReportType.COMMONS_IP;
ReportTypeEnums.ReportType reportType = COMMONS_IP;

@CommandLine.Option(names = {"-v",
"--verbose"}, description = "Verbose command line output with all validation steps")
Expand All @@ -72,7 +75,7 @@ public Integer call() throws ValidationException, CLIException {
return ExitCodes.EXIT_CODE_OK;
}

private void handleSipValidation(final String sip, final String reportPathDir, final ReportType reportType,
private void handleSipValidation(final String sip, final String reportPathDir, final ReportTypeEnums.ReportType reportType,
final boolean verbose)
throws IOException, ParserConfigurationException, SAXException, CLIException, NoSuchAlgorithmException {
final Path sipPath = Paths.get(sip);
Expand All @@ -83,27 +86,25 @@ private void handleSipValidation(final String sip, final String reportPathDir, f

LogSystem.logOperatingSystemInfo();
LOGGER.debug("command executed: {}", commandLineString);
switch (reportType) {
case COMMONS_IP -> {
final OutputStream outputStream = ValidateCommandUtils.createReportOutputStream(reportPath);
if (outputStream != null) {
final ValidationReportOutputJson jsonReporter = new ValidationReportOutputJson(sipPath, outputStream);
final EARKSIPValidator earksipValidator = new EARKSIPValidator(jsonReporter, version);
if (verbose) {
earksipValidator.addObserver(new ProgressValidationLoggerObserver());
}
earksipValidator.validate(version);
}
}
case PYIP -> {
final ValidationReportOutputJSONPyIP jsonReporter = new ValidationReportOutputJSONPyIP(reportPath, sipPath);
final EARKPyIPValidator earkPyIPValidator = new EARKPyIPValidator(jsonReporter, version);
if (reportType.equals(COMMONS_IP)) {
final OutputStream outputStream = ValidateCommandUtils.createReportOutputStream(reportPath);
if (outputStream != null) {
final ValidationReportOutputJson jsonReporter = new ValidationReportOutputJson(sipPath, outputStream);
final EARKSIPValidator earksipValidator = new EARKSIPValidator(jsonReporter, version);
if (verbose) {
earkPyIPValidator.addObserver(new ProgressValidationLoggerObserver());
earksipValidator.addObserver(new ProgressValidationLoggerObserver());
}
earkPyIPValidator.validate();
earksipValidator.validate(version);
}
} else if (reportType.equals(PYIP)) {
final ValidationReportOutputJSONPyIP jsonReporter = new ValidationReportOutputJSONPyIP(reportPath, sipPath);
final EARKPyIPValidator earkPyIPValidator = new EARKPyIPValidator(jsonReporter, version);
if (verbose) {
earkPyIPValidator.addObserver(new ProgressValidationLoggerObserver());
}
default -> throw new CLIException("Unexpected value: " + reportType);
earkPyIPValidator.validate();
} else {
throw new CLIException("Unexpected value: " + reportType);
}
new CommandLine(this).getOut().printf("E-ARK SIP validation report at '%s'%n",
reportPath.normalize().toAbsolutePath());
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package org.roda_project.commons_ip2.cli.model.enums;

/**
* @author Miguel Guimarães <mguimaraes@keep.pt>
*/
public class ReportTypeEnums {
public enum ReportType {
COMMONS_IP("commons-ip"), PYIP("eark-validator"), SIARD("siard");

private final String type;

ReportType(String type) {
this.type = type;
}

@Override
public String toString() {
return type;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,15 @@ private static void addRepresentationToSIP(SIP sip, final RepresentationGroup re
}
}

public static void addRepresentationGroupsToErmsSIP(SIP sip, final List<RepresentationGroup> representationGroups,
boolean targetOnly) throws IPException {
if (representationGroups != null) {
for (RepresentationGroup representationGroup : representationGroups) {
addRepresentationToSIP(sip, representationGroup, targetOnly);
}
}
}

private static void addFileToRepresentation(final IPRepresentation representation, final boolean targetOnly,
final Path dataPath, final List<String> relativePath) {
if (Files.isDirectory(dataPath)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class IPContentInformationType implements Serializable {
private static final long serialVersionUID = 1191075605637022551L;

public enum IPContentInformationTypeEnum {
ERMS, SIARD1, SIARD2, SIARDDK, GEODATA, MIXED, OTHER;
ERMS, citssiard_v1_0, SIARD1, SIARD2, SIARDDK, GEODATA, MIXED, OTHER, Dataset;
}

private IPContentInformationTypeEnum type;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public enum IPContentTypeEnum {
AUDIO_ON_TANGIBLE_MEDIUM("Audio – On Tangible Medium (digital or analog)"),
AUDIO_MEDIA_INDEPENDENT("Audio – Media-independent (digital)"),
MOTION_PICTURES("Motion Pictures – Digital and Physical Media"), VIDEO("Video – File-based and Physical Media"),
SOFTWARE("Software"), DATASETS("Datasets"), GEOSPATIAL_DATA("Geospatial Data"), DATABASES("Databases"),
SOFTWARE("Software"), DATASETS("Datasets"), DATASET("Dataset"), GEOSPATIAL_DATA("Geospatial Data"), DATABASES("Databases"),
WEBSITES("Websites"), COLLECTION("Collection"), EVENT("Event"), INTERACTIVE_RESOURCE("Interactive resource"),
PHYSICAL_OBJECT("Physical object"), SERVICE("Service"), MIXED("Mixed"), OTHER("Other");

Expand Down Expand Up @@ -131,4 +131,12 @@ public String asString() {
public static IPContentType getMIXED() {
return new IPContentType(IPContentTypeEnum.MIXED);
}
public static IPContentType getDataset() {
return new IPContentType(IPContentTypeEnum.DATASET);
}

public static IPContentType getDatabase() {
return new IPContentType(IPContentTypeEnum.DATABASES);
}

}
Loading

0 comments on commit f137b04

Please sign in to comment.