Skip to content

Commit 75d99d0

Browse files
committed
another experimental iteration of the updated export data spi. #11766
1 parent 0500d7e commit 75d99d0

File tree

4 files changed

+49
-15
lines changed

4 files changed

+49
-15
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/*
2+
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
3+
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
4+
*/
5+
package io.gdcc.spi.export;
6+
7+
/**
8+
*
9+
* @author landreev
10+
*/
11+
public class ExportDataContext {
12+
13+
}

modules/dataverse-spi/src/main/java/io/gdcc/spi/export/ExportDataOption.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
* options going forward with minimal or no changes to the existing code in
99
* export plugins.
1010
*/
11+
@Deprecated
1112
public class ExportDataOption {
1213

1314
public enum SupportedOptions {

modules/dataverse-spi/src/main/java/io/gdcc/spi/export/ExportDataProvider.java

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,14 @@ public interface ExportDataProvider {
2121
* OAI_ORE export are the only two that provide 'complete'
2222
* dataset-level metadata along with basic file metadata for each file
2323
* in the dataset.
24-
* @param options - optional argument(s). needs to support ExportDataOption.DatasetMetadataOnly:
25-
* in a situation where we need to generate a format like DC,
26-
* that has no use for file-level metadata, it makes sense to
27-
* skip retrieving and formatting it, since there can be quite a few
24+
* @param context - supplies optional parameters. Needs to support
25+
* context.isDatasetMetadataOnly(). In a situation where we
26+
* need to generate a format like DC that has no use for the
27+
* file-level metadata, it makes sense to skip retrieving and
28+
* formatting it, since there can be a very large number of
2829
* files in a dataset.
2930
*/
30-
JsonObject getDatasetJson(ExportDataOption... options);
31+
JsonObject getDatasetJson(ExportDataContext... context);
3132

3233
/**
3334
*
@@ -37,8 +38,9 @@ public interface ExportDataProvider {
3738
* @apiNote - THis, and the JSON format are the only two that provide complete
3839
* dataset-level metadata along with basic file metadata for each file
3940
* in the dataset.
41+
* @param context - supplies optional parameters.
4042
*/
41-
JsonObject getDatasetORE(ExportDataOption... options);
43+
JsonObject getDatasetORE(ExportDataContext... context);
4244

4345
/**
4446
* Dataverse is capable of extracting DDI-centric metadata from tabular
@@ -52,22 +54,25 @@ public interface ExportDataProvider {
5254
* edu.harvard.iq.dataverse.export.DDIExporter and the @see
5355
* edu.harvard.iq.dataverse.util.json.JSONPrinter classes where this
5456
* output is used/generated (respectively).
57+
* @param context - supplies optional parameters.
5558
*/
56-
JsonArray getDatasetFileDetails(ExportDataOption... options);
59+
JsonArray getDatasetFileDetails(ExportDataContext... context);
5760

5861
/**
5962
* Similar to the above, but
6063
* a) retrieves the information for the ingested/tabular data files _only_
6164
* b) provides an option for retrieving this stuff in batches
6265
* c) provides an option for skipping restricted/embargoed etc. files.
6366
* Intended for datasets with massive numbers of tabular files and datavariables.
64-
* @param offset (can be null)
65-
* @param length (can be null)
66-
* @param options (optional) current use case is ExportDataOption.PublicFilesOnly;
67+
* @param context - supplies optional parameters.
68+
* current (2.1.0) known use cases:
69+
* context.isPublicFilesOnly();
70+
* context.getOffset();
71+
* context.getLength();
6772
* @return json array containing the datafile/filemetadata->datatable->datavariable metadata
6873
* @throws ExportException
6974
*/
70-
JsonArray getTabularDataDetails(Integer offset, Integer length, ExportDataOption ... options) throws ExportException;
75+
JsonArray getTabularDataDetails(ExportDataContext ... context) throws ExportException;
7176

7277
/**
7378
*
@@ -77,8 +82,9 @@ public interface ExportDataProvider {
7782
* @apiNote - as this metadata export is not complete, it should only be used as
7883
* a starting point for an Exporter if it simplifies your exporter
7984
* relative to using the JSON or OAI_ORE exports.
85+
* @param context - supplies optional parameters.
8086
*/
81-
JsonObject getDatasetSchemaDotOrg(ExportDataOption... options);
87+
JsonObject getDatasetSchemaDotOrg(ExportDataContext... context);
8288

8389
/**
8490
*
@@ -87,8 +93,9 @@ public interface ExportDataProvider {
8793
* @apiNote - as this metadata export is not complete, it should only be used as
8894
* a starting point for an Exporter if it simplifies your exporter
8995
* relative to using the JSON or OAI_ORE exports.
96+
* @param context - supplies optional parameters.
9097
*/
91-
String getDataCiteXml(ExportDataOption... options);
98+
String getDataCiteXml(ExportDataContext... context);
9299

93100
/**
94101
* If an Exporter has specified a prerequisite format name via the
@@ -107,8 +114,9 @@ public interface ExportDataProvider {
107114
* malfunction, e.g. if you depend on format "ddi" and a third party
108115
* Exporter is configured to replace the internal ddi Exporter in
109116
* Dataverse.
117+
* @param context - supplies optional parameters.
110118
*/
111-
default Optional<InputStream> getPrerequisiteInputStream(ExportDataOption... options) {
119+
default Optional<InputStream> getPrerequisiteInputStream(ExportDataContext... context) {
112120
return Optional.empty();
113121
}
114122

modules/dataverse-spi/src/main/java/io/gdcc/spi/export/Exporter.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,19 @@ public interface Exporter {
8484
default Optional<String> getPrerequisiteFormatName() {
8585
return Optional.empty();
8686
}
87-
87+
88+
/**
89+
* Most metadata formats do not require tabular metadata to be generated.
90+
* (the 2 known cases that encode variable-level information, as of Dataverse 6.7,
91+
* are rich DDI and Croissant). In order to serve it more efficiently,
92+
* the data provider may need to be initialized in a special way (with access
93+
* to EJBs that in most cases isn't needed), so it may help to know
94+
* programmatically whether it's required for this format.
95+
* @return Optional<Boolean>
96+
*/
97+
default Optional<Boolean> isNeedsTabularMetadata() {
98+
return Optional.of(false);
99+
}
88100

89101
/**
90102
* Harvestable Exporters will be available as options in Dataverse's Harvesting mechanism.

0 commit comments

Comments
 (0)