Package io.gdcc.spi.export
Interface Exporter
- All Superinterfaces:
Plugin
- All Known Subinterfaces:
XMLExporter
Dataverse allows new metadata export formats to be dynamically added a running instance. This is done by
deploying new classes that implement this Exporter interface.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoidexportDataset(ExportDataProvider dataProvider, OutputStream outputStream) When this method is called, the Exporter should write the metadata to the given OutputStream.getDisplayName(Locale locale) This method should return the display name of the metadata format this Exporter provides.This method should return the name of the metadata format this Exporter provides.To support effective downloads of metadata in this Exporter's format, the Exporter should specify an appropriate mime type.Exporters can specify that they require, as input, the output of another exporter.default Stringidentity()Returns the unique, machine-readable identifier for this plugin.If an Exporter is available to users, its format will be generated for every published dataset and made available via the dataset page/metadata tab/Metadata Exports menu item and via the API.Harvestable Exporters will be available as options in Dataverse's Harvesting mechanism.
-
Field Details
-
API_LEVEL
static final int API_LEVEL- See Also:
-
-
Method Details
-
identity
Description copied from interface:PluginReturns the unique, machine-readable identifier for this plugin. This will be the primary key within the core to identify a specific plugin implementation. -
exportDataset
void exportDataset(ExportDataProvider dataProvider, OutputStream outputStream) throws ExportException When this method is called, the Exporter should write the metadata to the given OutputStream.- Parameters:
dataProvider- - the @see ExportDataProvider interface includes several methods that can be used to retrieve the dataset metadata in different formats. An Exporter should use one or more of these to obtain the values needed to generate metadata in the format it supports.outputStream- - the OutputStream to write the metadata to- Throws:
ExportException- - if there is an error writing the metadata- API Note:
- When implementing exportDataset, when done writing content, please make sure to flush() the outputStream, but NOT close() it! This way an exporter can be used to insert the produced metadata into the body of an HTTP response, etc. (for example, to insert it into the body of an OAI response, where more XML needs to be written, for the outer OAI-PMH record). -- L.A. 4.5
-
getFormatName
String getFormatName()This method should return the name of the metadata format this Exporter provides.- Returns:
- - the unique name of the metadata format this Exporter
- API Note:
- Format names are unique identifiers for the formats supported in Dataverse. Reusing the same format name as another Exporter will result only one implementation being available. Exporters packaged as an external Jar file have precedence over the default implementations in Dataverse. Hence re-using one of the existing format names will result in the Exporter replacing the internal one with the same name. The precedence between two external Exporters using the same format name is not defined. Current format names used internally by Dataverse are: Datacite dcterms ddi oai_dc html dataverse_json oai_ddi OAI_ORE oai_datacite schema.org
-
getDisplayName
This method should return the display name of the metadata format this Exporter provides. Display names are used in the UI, specifically in the menu of avaiable Metadata Exports on the dataset page/metadata tab to identify the format. -
getPrerequisiteFormatName
Exporters can specify that they require, as input, the output of another exporter. This is done by providing the name of that format in response to a call to this method.- API Note:
- - The Exporter can expect that the metadata produced by its
prerequisite exporter (as defined with this method) will be
available via the ExportDataProvider.getPrerequisiteInputStream()
method. The default implementation of this method returns an empty
value which means the getPrerequisiteInputStream() method of the
ExportDataProvider sent in the exportDataset method will return an
empty Optional
. - Implementation Note:
- The one current example where this is done is with the html(display name "DDI html codebook") exporter which starts from the XML-based ddi format produced by that exporter.
-
isHarvestable
Boolean isHarvestable()Harvestable Exporters will be available as options in Dataverse's Harvesting mechanism.- Returns:
- true to make this exporter available as a harvesting option.
-
isAvailableToUsers
Boolean isAvailableToUsers()If an Exporter is available to users, its format will be generated for every published dataset and made available via the dataset page/metadata tab/Metadata Exports menu item and via the API.- Returns:
- true to make this exporter available to users.
-
getMediaType
String getMediaType()To support effective downloads of metadata in this Exporter's format, the Exporter should specify an appropriate mime type.- Returns:
- The mime type, e.g. "application/json", "text/plain", etc.
- API Note:
- - It is recommended to used the @see javax.ws.rs.core.MediaType enum to specify the mime type.
-