Skip to content

Commit

Permalink
beacon file script
Browse files Browse the repository at this point in the history
script for generating files according to the beacon standard (see https://gbv.github.io/beaconspec/beacon.html). It get all (visibile) entities of some identifier and prints them into one process result file or optionally dumps them in the handler log. The usage is mainly popular among GLAM-Systems using the gnd-identifier in the DACH-Area. The header lines can be configured in the configuration.
  • Loading branch information
floriangantner committed Oct 26, 2023
1 parent cc63d56 commit dc4cba8
Show file tree
Hide file tree
Showing 5 changed files with 327 additions and 0 deletions.
226 changes: 226 additions & 0 deletions dspace-api/src/main/java/org/dspace/beacon/BeaconFileScript.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,226 @@
/**
* The contents of this file are subject to the license and copyright
* detailed in the LICENSE and NOTICE files at the root of the source
* tree and available online at
*
* http://www.dspace.org/license/
*/
package org.dspace.beacon;

import static org.dspace.core.Constants.READ;
import static org.dspace.eperson.Group.ANONYMOUS;

import java.io.ByteArrayInputStream;
import java.nio.charset.StandardCharsets;
import java.sql.Date;
import java.sql.SQLException;
import java.text.SimpleDateFormat;
import java.time.ZoneId;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.TimeZone;
import java.util.UUID;

import org.apache.commons.cli.ParseException;
import org.dspace.authorize.factory.AuthorizeServiceFactory;
import org.dspace.authorize.service.AuthorizeService;
import org.dspace.content.Item;
import org.dspace.content.MetadataValue;
import org.dspace.content.factory.ContentServiceFactory;
import org.dspace.content.service.ItemService;
import org.dspace.core.Context;
import org.dspace.eperson.EPerson;
import org.dspace.eperson.factory.EPersonServiceFactory;
import org.dspace.scripts.DSpaceRunnable;
import org.dspace.services.ConfigurationService;
import org.dspace.utils.DSpace;

/**
* Script to generate the beacon list
* The configuration for the metadata field and the resolven can be taken from the beacon.cfg file
* It is possible to use one field for some identifier (e.g. dc.identifier.other) and identify the corresponding values
* using their resolver,
* e.g. all values in dc.identifier.other which start with <a href="http://d-nb.info/gnd/">...</a> .
* Alternative resolvers can be
* specifed (optionally) which are later normalized to the main identifier
* Output
* - verbose: on handler log for debugging
* - file: print result as process result file with the given filename from the parameter
* For the specification see: <a href="https://gbv.github.io/beaconspec/beacon.html">...</a>
*
* @author Florian Gantner ([email protected])
*
*/
public class BeaconFileScript extends DSpaceRunnable<BeaconFileScriptConfiguration<BeaconFileScript>> {

Check warning on line 55 in dspace-api/src/main/java/org/dspace/beacon/BeaconFileScript.java

View check run for this annotation

Codecov / codecov/patch

dspace-api/src/main/java/org/dspace/beacon/BeaconFileScript.java#L55

Added line #L55 was not covered by tests

private AuthorizeService authorizeService;

private ItemService itemService;

private ConfigurationService configurationService;

private Context context;

private boolean VERBOSE;

private String PRINTFILE = null;

Check warning on line 67 in dspace-api/src/main/java/org/dspace/beacon/BeaconFileScript.java

View check run for this annotation

Codecov / codecov/patch

dspace-api/src/main/java/org/dspace/beacon/BeaconFileScript.java#L67

Added line #L67 was not covered by tests

private String metadatafield;

@Override
public void setup() throws ParseException {
this.authorizeService = AuthorizeServiceFactory.getInstance().getAuthorizeService();
this.itemService = ContentServiceFactory.getInstance().getItemService();
this.configurationService = new DSpace().getConfigurationService();
this.metadatafield = configurationService.getProperty("beacon.metadatafield");
this.VERBOSE = commandLine.hasOption('v');

Check warning on line 77 in dspace-api/src/main/java/org/dspace/beacon/BeaconFileScript.java

View check run for this annotation

Codecov / codecov/patch

dspace-api/src/main/java/org/dspace/beacon/BeaconFileScript.java#L73-L77

Added lines #L73 - L77 were not covered by tests
if (commandLine.hasOption('f')) {
this.PRINTFILE = commandLine.getOptionValue('f');

Check warning on line 79 in dspace-api/src/main/java/org/dspace/beacon/BeaconFileScript.java

View check run for this annotation

Codecov / codecov/patch

dspace-api/src/main/java/org/dspace/beacon/BeaconFileScript.java#L79

Added line #L79 was not covered by tests
}
}

Check warning on line 81 in dspace-api/src/main/java/org/dspace/beacon/BeaconFileScript.java

View check run for this annotation

Codecov / codecov/patch

dspace-api/src/main/java/org/dspace/beacon/BeaconFileScript.java#L81

Added line #L81 was not covered by tests

@Override
public void internalRun() throws Exception {

if ((!VERBOSE && PRINTFILE == null) ||
(VERBOSE && PRINTFILE != null)) {
throw new Exception("Only one of the output options can be specified");

Check warning on line 88 in dspace-api/src/main/java/org/dspace/beacon/BeaconFileScript.java

View check run for this annotation

Codecov / codecov/patch

dspace-api/src/main/java/org/dspace/beacon/BeaconFileScript.java#L88

Added line #L88 was not covered by tests
}

if (VERBOSE) {
context = new Context(Context.Mode.READ_ONLY);

Check warning on line 92 in dspace-api/src/main/java/org/dspace/beacon/BeaconFileScript.java

View check run for this annotation

Codecov / codecov/patch

dspace-api/src/main/java/org/dspace/beacon/BeaconFileScript.java#L92

Added line #L92 was not covered by tests
} else if (PRINTFILE != null) {
context = new Context(Context.Mode.READ_WRITE);

Check warning on line 94 in dspace-api/src/main/java/org/dspace/beacon/BeaconFileScript.java

View check run for this annotation

Codecov / codecov/patch

dspace-api/src/main/java/org/dspace/beacon/BeaconFileScript.java#L94

Added line #L94 was not covered by tests
}

String mainresolver = configurationService.getProperty("beacon.mainresolver");
String[] additionalresolvers = configurationService.getArrayProperty("beacon.additionalresolver");

Check warning on line 98 in dspace-api/src/main/java/org/dspace/beacon/BeaconFileScript.java

View check run for this annotation

Codecov / codecov/patch

dspace-api/src/main/java/org/dspace/beacon/BeaconFileScript.java#L97-L98

Added lines #L97 - L98 were not covered by tests

assignCurrentUserInContext();
assignSpecialGroupsInContext();

Check warning on line 101 in dspace-api/src/main/java/org/dspace/beacon/BeaconFileScript.java

View check run for this annotation

Codecov / codecov/patch

dspace-api/src/main/java/org/dspace/beacon/BeaconFileScript.java#L100-L101

Added lines #L100 - L101 were not covered by tests

if (!this.authorizeService.isAdmin(context)) {
throw new IllegalArgumentException("The user cannot generate the beacon file");

Check warning on line 104 in dspace-api/src/main/java/org/dspace/beacon/BeaconFileScript.java

View check run for this annotation

Codecov / codecov/patch

dspace-api/src/main/java/org/dspace/beacon/BeaconFileScript.java#L104

Added line #L104 was not covered by tests
}

StringBuilder sb = new StringBuilder();

Check warning on line 107 in dspace-api/src/main/java/org/dspace/beacon/BeaconFileScript.java

View check run for this annotation

Codecov / codecov/patch

dspace-api/src/main/java/org/dspace/beacon/BeaconFileScript.java#L107

Added line #L107 was not covered by tests

sb.append("#FORMAT: Beacon").append(System.lineSeparator());

Check warning on line 109 in dspace-api/src/main/java/org/dspace/beacon/BeaconFileScript.java

View check run for this annotation

Codecov / codecov/patch

dspace-api/src/main/java/org/dspace/beacon/BeaconFileScript.java#L109

Added line #L109 was not covered by tests
for (String propertykey : configurationService.getPropertyKeys("beacon.header")) {
String key = propertykey.replace("beacon.header.", "");
String value = configurationService.getProperty(propertykey);

Check warning on line 112 in dspace-api/src/main/java/org/dspace/beacon/BeaconFileScript.java

View check run for this annotation

Codecov / codecov/patch

dspace-api/src/main/java/org/dspace/beacon/BeaconFileScript.java#L111-L112

Added lines #L111 - L112 were not covered by tests
if (value != null) {
sb.append("#").append(key.toUpperCase()).append(": ").append(value).append(System.lineSeparator());

Check warning on line 114 in dspace-api/src/main/java/org/dspace/beacon/BeaconFileScript.java

View check run for this annotation

Codecov / codecov/patch

dspace-api/src/main/java/org/dspace/beacon/BeaconFileScript.java#L114

Added line #L114 was not covered by tests
}
}

Check warning on line 116 in dspace-api/src/main/java/org/dspace/beacon/BeaconFileScript.java

View check run for this annotation

Codecov / codecov/patch

dspace-api/src/main/java/org/dspace/beacon/BeaconFileScript.java#L116

Added line #L116 was not covered by tests

Date date = new Date(System.currentTimeMillis());

Check warning on line 118 in dspace-api/src/main/java/org/dspace/beacon/BeaconFileScript.java

View check run for this annotation

Codecov / codecov/patch

dspace-api/src/main/java/org/dspace/beacon/BeaconFileScript.java#L118

Added line #L118 was not covered by tests
SimpleDateFormat sdf;
sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssXXX");
sdf.setTimeZone(TimeZone.getTimeZone(ZoneId.of("Europe/Berlin")));
String textdate = sdf.format(date);

Check warning on line 122 in dspace-api/src/main/java/org/dspace/beacon/BeaconFileScript.java

View check run for this annotation

Codecov / codecov/patch

dspace-api/src/main/java/org/dspace/beacon/BeaconFileScript.java#L120-L122

Added lines #L120 - L122 were not covered by tests

sb.append("#TIMESTAMP: ").append(textdate).append(System.lineSeparator());

Check warning on line 124 in dspace-api/src/main/java/org/dspace/beacon/BeaconFileScript.java

View check run for this annotation

Codecov / codecov/patch

dspace-api/src/main/java/org/dspace/beacon/BeaconFileScript.java#L124

Added line #L124 was not covered by tests
try {
Iterator<Item> items = itemService.findArchivedByMetadataField(context, metadatafield, Item.ANY);
List<Item> itemlist = new ArrayList<>();

Check warning on line 127 in dspace-api/src/main/java/org/dspace/beacon/BeaconFileScript.java

View check run for this annotation

Codecov / codecov/patch

dspace-api/src/main/java/org/dspace/beacon/BeaconFileScript.java#L126-L127

Added lines #L126 - L127 were not covered by tests
// filter inactive/hidden profiles

while (items.hasNext()) {
Item item = items.next();

Check warning on line 131 in dspace-api/src/main/java/org/dspace/beacon/BeaconFileScript.java

View check run for this annotation

Codecov / codecov/patch

dspace-api/src/main/java/org/dspace/beacon/BeaconFileScript.java#L131

Added line #L131 was not covered by tests
if (!item.isDiscoverable() || !isVisible(item)) {
continue;

Check warning on line 133 in dspace-api/src/main/java/org/dspace/beacon/BeaconFileScript.java

View check run for this annotation

Codecov / codecov/patch

dspace-api/src/main/java/org/dspace/beacon/BeaconFileScript.java#L133

Added line #L133 was not covered by tests
}
itemlist.add(item);
}

Check warning on line 136 in dspace-api/src/main/java/org/dspace/beacon/BeaconFileScript.java

View check run for this annotation

Codecov / codecov/patch

dspace-api/src/main/java/org/dspace/beacon/BeaconFileScript.java#L135-L136

Added lines #L135 - L136 were not covered by tests

//Normalize identifier. remove resolver or additionalresolver
for (Item item : itemlist) {
List<MetadataValue> mvals = itemService.getMetadataByMetadataString(item, metadatafield);

Check warning on line 140 in dspace-api/src/main/java/org/dspace/beacon/BeaconFileScript.java

View check run for this annotation

Codecov / codecov/patch

dspace-api/src/main/java/org/dspace/beacon/BeaconFileScript.java#L140

Added line #L140 was not covered by tests
for (MetadataValue mval : mvals) {
//filter all values not starting with any of the resolver
String val = mval.getValue();

Check warning on line 143 in dspace-api/src/main/java/org/dspace/beacon/BeaconFileScript.java

View check run for this annotation

Codecov / codecov/patch

dspace-api/src/main/java/org/dspace/beacon/BeaconFileScript.java#L143

Added line #L143 was not covered by tests
if (configurationService.getBooleanProperty("beacon.metadatafield.filterresolver")) {
boolean skip = !val.startsWith(mainresolver);
//check main resolver
//check additional resolvers
if (additionalresolvers != null) {
for (String additionalresolver : additionalresolvers) {
if (val.startsWith(additionalresolver)) {
skip = false;
break;

Check warning on line 152 in dspace-api/src/main/java/org/dspace/beacon/BeaconFileScript.java

View check run for this annotation

Codecov / codecov/patch

dspace-api/src/main/java/org/dspace/beacon/BeaconFileScript.java#L151-L152

Added lines #L151 - L152 were not covered by tests
}
}
}
if (skip) {
continue;

Check warning on line 157 in dspace-api/src/main/java/org/dspace/beacon/BeaconFileScript.java

View check run for this annotation

Codecov / codecov/patch

dspace-api/src/main/java/org/dspace/beacon/BeaconFileScript.java#L157

Added line #L157 was not covered by tests
}
}
//normalize identifiers and replace the values
if (val != null && val.startsWith(mainresolver)) {
val = val.replace(mainresolver, "");

Check warning on line 162 in dspace-api/src/main/java/org/dspace/beacon/BeaconFileScript.java

View check run for this annotation

Codecov / codecov/patch

dspace-api/src/main/java/org/dspace/beacon/BeaconFileScript.java#L162

Added line #L162 was not covered by tests
} else if (val != null && additionalresolvers != null) {
for (String additionalresolver : additionalresolvers) {
if (val.startsWith(additionalresolver)) {
val = val.replace(additionalresolver, "");
break;

Check warning on line 167 in dspace-api/src/main/java/org/dspace/beacon/BeaconFileScript.java

View check run for this annotation

Codecov / codecov/patch

dspace-api/src/main/java/org/dspace/beacon/BeaconFileScript.java#L166-L167

Added lines #L166 - L167 were not covered by tests
}
}
}
sb.append(val).append(System.lineSeparator());
break;

Check warning on line 172 in dspace-api/src/main/java/org/dspace/beacon/BeaconFileScript.java

View check run for this annotation

Codecov / codecov/patch

dspace-api/src/main/java/org/dspace/beacon/BeaconFileScript.java#L171-L172

Added lines #L171 - L172 were not covered by tests
}

}
String result = sb.toString();

Check warning on line 176 in dspace-api/src/main/java/org/dspace/beacon/BeaconFileScript.java

View check run for this annotation

Codecov / codecov/patch

dspace-api/src/main/java/org/dspace/beacon/BeaconFileScript.java#L175-L176

Added lines #L175 - L176 were not covered by tests
if (VERBOSE) {
handler.logInfo(result);

Check warning on line 178 in dspace-api/src/main/java/org/dspace/beacon/BeaconFileScript.java

View check run for this annotation

Codecov / codecov/patch

dspace-api/src/main/java/org/dspace/beacon/BeaconFileScript.java#L178

Added line #L178 was not covered by tests
} else if (PRINTFILE != null) {
try {
handler.writeFilestream(context, PRINTFILE,
new ByteArrayInputStream(result.getBytes(StandardCharsets.UTF_8)), "BEACON");
} catch (Exception e) {
handler.logError(e.getMessage());
}

Check warning on line 185 in dspace-api/src/main/java/org/dspace/beacon/BeaconFileScript.java

View check run for this annotation

Codecov / codecov/patch

dspace-api/src/main/java/org/dspace/beacon/BeaconFileScript.java#L181-L185

Added lines #L181 - L185 were not covered by tests
}
context.complete();
handler.logInfo("Beacon file completed successfully");
} catch (Exception e) {
handler.handleException(e);
context.abort();

Check warning on line 191 in dspace-api/src/main/java/org/dspace/beacon/BeaconFileScript.java

View check run for this annotation

Codecov / codecov/patch

dspace-api/src/main/java/org/dspace/beacon/BeaconFileScript.java#L187-L191

Added lines #L187 - L191 were not covered by tests
} finally {
if (context.isValid()) {
context.close();

Check warning on line 194 in dspace-api/src/main/java/org/dspace/beacon/BeaconFileScript.java

View check run for this annotation

Codecov / codecov/patch

dspace-api/src/main/java/org/dspace/beacon/BeaconFileScript.java#L194

Added line #L194 was not covered by tests
}
}
}

Check warning on line 197 in dspace-api/src/main/java/org/dspace/beacon/BeaconFileScript.java

View check run for this annotation

Codecov / codecov/patch

dspace-api/src/main/java/org/dspace/beacon/BeaconFileScript.java#L197

Added line #L197 was not covered by tests

@Override
@SuppressWarnings("unchecked")
public BeaconFileScriptConfiguration<BeaconFileScript> getScriptConfiguration() {
return new DSpace().getServiceManager().getServiceByName("beacon-file",

Check warning on line 202 in dspace-api/src/main/java/org/dspace/beacon/BeaconFileScript.java

View check run for this annotation

Codecov / codecov/patch

dspace-api/src/main/java/org/dspace/beacon/BeaconFileScript.java#L202

Added line #L202 was not covered by tests
BeaconFileScriptConfiguration.class);
}

private void assignCurrentUserInContext() throws SQLException {
UUID uuid = getEpersonIdentifier();

Check warning on line 207 in dspace-api/src/main/java/org/dspace/beacon/BeaconFileScript.java

View check run for this annotation

Codecov / codecov/patch

dspace-api/src/main/java/org/dspace/beacon/BeaconFileScript.java#L207

Added line #L207 was not covered by tests
if (uuid != null) {
EPerson ePerson = EPersonServiceFactory.getInstance().getEPersonService().find(context, uuid);
context.setCurrentUser(ePerson);

Check warning on line 210 in dspace-api/src/main/java/org/dspace/beacon/BeaconFileScript.java

View check run for this annotation

Codecov / codecov/patch

dspace-api/src/main/java/org/dspace/beacon/BeaconFileScript.java#L209-L210

Added lines #L209 - L210 were not covered by tests
}
}

Check warning on line 212 in dspace-api/src/main/java/org/dspace/beacon/BeaconFileScript.java

View check run for this annotation

Codecov / codecov/patch

dspace-api/src/main/java/org/dspace/beacon/BeaconFileScript.java#L212

Added line #L212 was not covered by tests

private void assignSpecialGroupsInContext() throws SQLException {
for (UUID uuid : handler.getSpecialGroups()) {
context.setSpecialGroup(uuid);
}
}

Check warning on line 218 in dspace-api/src/main/java/org/dspace/beacon/BeaconFileScript.java

View check run for this annotation

Codecov / codecov/patch

dspace-api/src/main/java/org/dspace/beacon/BeaconFileScript.java#L216-L218

Added lines #L216 - L218 were not covered by tests

public boolean isVisible(Item item) {
return item.getResourcePolicies().stream()

Check warning on line 221 in dspace-api/src/main/java/org/dspace/beacon/BeaconFileScript.java

View check run for this annotation

Codecov / codecov/patch

dspace-api/src/main/java/org/dspace/beacon/BeaconFileScript.java#L221

Added line #L221 was not covered by tests
.filter(policy -> policy.getGroup() != null)
.anyMatch(policy -> READ == policy.getAction() && ANONYMOUS.equals(policy.getGroup().getName()));
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
/**
* The contents of this file are subject to the license and copyright
* detailed in the LICENSE and NOTICE files at the root of the source
* tree and available online at
*
* http://www.dspace.org/license/
*/
package org.dspace.beacon;

import java.sql.SQLException;

import org.apache.commons.cli.Options;
import org.dspace.authorize.service.AuthorizeService;
import org.dspace.core.Context;
import org.dspace.scripts.configuration.ScriptConfiguration;
import org.springframework.beans.factory.annotation.Autowired;

/**
* Script configuration for {@link BeaconFileScript}.
*
* @author Florian Gantner ([email protected])
*/
public class BeaconFileScriptConfiguration<T extends BeaconFileScript> extends ScriptConfiguration<T> {

Check warning on line 23 in dspace-api/src/main/java/org/dspace/beacon/BeaconFileScriptConfiguration.java

View check run for this annotation

Codecov / codecov/patch

dspace-api/src/main/java/org/dspace/beacon/BeaconFileScriptConfiguration.java#L23

Added line #L23 was not covered by tests

@Autowired
private AuthorizeService authorizeService;

private Class<T> dspaceRunnableClass;

@Override
public boolean isAllowedToExecute(Context context) {
try {
return authorizeService.isAdmin(context);
} catch (SQLException e) {
throw new RuntimeException("SQLException occurred when checking if the current user is an admin", e);

Check warning on line 35 in dspace-api/src/main/java/org/dspace/beacon/BeaconFileScriptConfiguration.java

View check run for this annotation

Codecov / codecov/patch

dspace-api/src/main/java/org/dspace/beacon/BeaconFileScriptConfiguration.java#L33-L35

Added lines #L33 - L35 were not covered by tests
}
}

@Override
public Options getOptions() {
if (options == null) {
Options options = new Options();

Check warning on line 42 in dspace-api/src/main/java/org/dspace/beacon/BeaconFileScriptConfiguration.java

View check run for this annotation

Codecov / codecov/patch

dspace-api/src/main/java/org/dspace/beacon/BeaconFileScriptConfiguration.java#L42

Added line #L42 was not covered by tests

options.addOption("v", "verbose", false, "print out result on handler log");
options.getOption("v").setType(boolean.class);
options.getOption("v").setRequired(false);

Check warning on line 46 in dspace-api/src/main/java/org/dspace/beacon/BeaconFileScriptConfiguration.java

View check run for this annotation

Codecov / codecov/patch

dspace-api/src/main/java/org/dspace/beacon/BeaconFileScriptConfiguration.java#L44-L46

Added lines #L44 - L46 were not covered by tests

options.addOption("f", "file", true, "print to file and specify filename, e.g. beacon.txt");
options.getOption("f").setType(String.class);
options.getOption("f").setRequired(false);

Check warning on line 50 in dspace-api/src/main/java/org/dspace/beacon/BeaconFileScriptConfiguration.java

View check run for this annotation

Codecov / codecov/patch

dspace-api/src/main/java/org/dspace/beacon/BeaconFileScriptConfiguration.java#L48-L50

Added lines #L48 - L50 were not covered by tests

super.options = options;

Check warning on line 52 in dspace-api/src/main/java/org/dspace/beacon/BeaconFileScriptConfiguration.java

View check run for this annotation

Codecov / codecov/patch

dspace-api/src/main/java/org/dspace/beacon/BeaconFileScriptConfiguration.java#L52

Added line #L52 was not covered by tests
}
return options;

Check warning on line 54 in dspace-api/src/main/java/org/dspace/beacon/BeaconFileScriptConfiguration.java

View check run for this annotation

Codecov / codecov/patch

dspace-api/src/main/java/org/dspace/beacon/BeaconFileScriptConfiguration.java#L54

Added line #L54 was not covered by tests
}

@Override
public void setDspaceRunnableClass(Class<T> dspaceRunnableClass) {
this.dspaceRunnableClass = dspaceRunnableClass;
}

Check warning on line 60 in dspace-api/src/main/java/org/dspace/beacon/BeaconFileScriptConfiguration.java

View check run for this annotation

Codecov / codecov/patch

dspace-api/src/main/java/org/dspace/beacon/BeaconFileScriptConfiguration.java#L59-L60

Added lines #L59 - L60 were not covered by tests

@Override
public Class<T> getDspaceRunnableClass() {
return dspaceRunnableClass;

Check warning on line 64 in dspace-api/src/main/java/org/dspace/beacon/BeaconFileScriptConfiguration.java

View check run for this annotation

Codecov / codecov/patch

dspace-api/src/main/java/org/dspace/beacon/BeaconFileScriptConfiguration.java#L64

Added line #L64 was not covered by tests
}

}
1 change: 1 addition & 0 deletions dspace/config/dspace.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -1997,3 +1997,4 @@ include = ${module_dir}/pushocr.cfg
include = ${module_dir}/pushocr.force.cfg
include = ${module_dir}/cleanup-authority-metadata-relation.cfg
include = ${module_dir}/ror.cfg
include = ${module_dir}/beacon.cfg
28 changes: 28 additions & 0 deletions dspace/config/modules/beacon.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# These Properties fill the header lines in the generated beacon file
# the metadatafield containing the gnd identifier
beacon.metadatafield = dc.identifier.gnd

# if enabled filter the values with those matching the mainresolver or additionalresolver.additionalresolver
# this can be applied when the identifier field contains multiple identifiers, e.g. dc.identifier.other with prefixes
#beacon.metadatafield.filterresolver

# the main resolver
# values from beacon.additionalresolver are normalized to this value
beacon.mainresolver = http://d-nb.info/gnd/
# these are additional resolvers which are normalized. repeatable
#beacon.additionalresolver = https://d-nb.info/gnd/
beacon.additionalresolver = https://d-nb.info/gnd/

## Header Lines
# FORMAT AND TIMESTAMP will always be added.
# the keys under beacon.header will be used for the HEADER Line starting with #
beacon.header.description = Professorinnen- und Professorenkatalog der Otto-Friedrich-Universität Bamberg
beacon.header.homepage = https://professorenkatalog.uni-bamberg.de
#beacon.header.contact = [email protected]
beacon.header.creator = Professorinnen- und Professorenkatalog der Otto-Friedrich-Universität Bamberg
beacon.header.message = Professorinnen- und Professorenkatalog der Otto-Friedrich-Universität Bamberg
beacon.header.prefix = ${beacon.mainresolver}{ID}
# target link. might differ when the gnd can be resolved under some own path, e.g. /gnd/{ID}
beacon.header.target = https://professorenkatalog.uni-bamberg.de/search?configuration\=default&q\=dc.identifier.gnd:{ID}
beacon.header.feed = https://professorenkatalog.uni-bamberg.de/beacon
beacon.header.update = MONTHLY
5 changes: 5 additions & 0 deletions dspace/config/spring/api/scripts.xml
Original file line number Diff line number Diff line change
Expand Up @@ -165,4 +165,9 @@
<property name="dspaceRunnableClass" value="org.dspace.app.metadata.export.MetadataSchemaExportCliScript"/>
</bean>

<bean id="beacon-file" class="org.dspace.beacon.BeaconFileScriptConfiguration">
<property name="description" value="Generate some beacon file of some configured identifier and print it to the specified option (handler, file)"/>
<property name="dspaceRunnableClass" value="org.dspace.beacon.BeaconFileScript"/>
</bean>

</beans>

0 comments on commit dc4cba8

Please sign in to comment.