use of edu.harvard.iq.dataverse.export.spi.Exporter in project dataverse by IQSS.
the class FilePage method getExporters.
public List<String[]> getExporters() {
List<String[]> retList = new ArrayList<>();
String myHostURL = systemConfig.getDataverseSiteUrl();
for (String[] provider : ExportService.getInstance(settingsService).getExportersLabels()) {
String formatName = provider[1];
String formatDisplayName = provider[0];
Exporter exporter = null;
try {
exporter = ExportService.getInstance(settingsService).getExporter(formatName);
} catch (ExportException ex) {
exporter = null;
}
if (exporter != null && exporter.isAvailableToUsers()) {
// Not all metadata exports should be presented to the web users!
// Some are only for harvesting clients.
String[] temp = new String[2];
temp[0] = formatDisplayName;
temp[1] = myHostURL + "/api/datasets/export?exporter=" + formatName + "&persistentId=" + fileMetadata.getDatasetVersion().getDataset().getGlobalId();
retList.add(temp);
}
}
return retList;
}
use of edu.harvard.iq.dataverse.export.spi.Exporter in project dataverse by IQSS.
the class ExportService method clearAllCachedFormats.
public void clearAllCachedFormats(Dataset dataset) throws IOException {
try {
Iterator<Exporter> exporters = loader.iterator();
while (exporters.hasNext()) {
Exporter e = exporters.next();
String formatName = e.getProviderName();
clearCachedExport(dataset, formatName);
}
dataset.setLastExportTime(null);
} catch (IOException ex) {
// not fatal
}
}
use of edu.harvard.iq.dataverse.export.spi.Exporter in project dataverse by IQSS.
the class ExportService method getExportersLabels.
public List<String[]> getExportersLabels() {
List<String[]> retList = new ArrayList<>();
Iterator<Exporter> exporters = ExportService.getInstance().loader.iterator();
while (exporters.hasNext()) {
Exporter e = exporters.next();
String[] temp = new String[2];
temp[0] = e.getDisplayName();
temp[1] = e.getProviderName();
retList.add(temp);
}
return retList;
}
use of edu.harvard.iq.dataverse.export.spi.Exporter in project dataverse by IQSS.
the class DatasetPage method getExporters.
public List<String[]> getExporters() {
List<String[]> retList = new ArrayList<>();
String myHostURL = getDataverseSiteUrl();
for (String[] provider : ExportService.getInstance(settingsService).getExportersLabels()) {
String formatName = provider[1];
String formatDisplayName = provider[0];
Exporter exporter = null;
try {
exporter = ExportService.getInstance(settingsService).getExporter(formatName);
} catch (ExportException ex) {
exporter = null;
}
if (exporter != null && exporter.isAvailableToUsers()) {
// Not all metadata exports should be presented to the web users!
// Some are only for harvesting clients.
String[] temp = new String[2];
temp[0] = formatDisplayName;
temp[1] = myHostURL + "/api/datasets/export?exporter=" + formatName + "&persistentId=" + dataset.getGlobalId();
retList.add(temp);
}
}
return retList;
}
use of edu.harvard.iq.dataverse.export.spi.Exporter in project dataverse by IQSS.
the class OAIServlet method addSupportedMetadataFormats.
private void addSupportedMetadataFormats(Context context) {
for (String[] provider : ExportService.getInstance(settingsService).getExportersLabels()) {
String formatName = provider[1];
Exporter exporter;
try {
exporter = ExportService.getInstance(settingsService).getExporter(formatName);
} catch (ExportException ex) {
exporter = null;
}
if (exporter != null && exporter.isXMLFormat() && exporter.isHarvestable()) {
MetadataFormat metadataFormat;
try {
metadataFormat = MetadataFormat.metadataFormat(formatName);
metadataFormat.withNamespace(exporter.getXMLNameSpace());
metadataFormat.withSchemaLocation(exporter.getXMLSchemaLocation());
} catch (ExportException ex) {
metadataFormat = null;
}
if (metadataFormat != null) {
context.withMetadataFormat(metadataFormat);
}
}
}
// return context;
}
Aggregations