Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public void startUp(ServletContext servletContext) {
final MCRPIServiceManager serviceManager = MCRPIServiceManager.getInstance();
serviceManager.getServiceList().forEach(service -> {
LOGGER.info(() -> "Check service: " + service.getServiceID());
service.checkConfiguration();
service.checkConfiguration(servletContext != null ? MCRPIService.Context.WEBAPP : MCRPIService.Context.CLI);
});

}
Expand Down
4 changes: 2 additions & 2 deletions mycore-pi/src/main/java/org/mycore/pi/MCRPIJobService.java
Original file line number Diff line number Diff line change
Expand Up @@ -350,8 +350,8 @@ protected PiJobAction getAction(Map<String, String> contextParameters) {
}

@Override
protected void checkConfiguration() throws MCRConfigurationException {
super.checkConfiguration();
protected void checkConfiguration(Context context) throws MCRConfigurationException {
super.checkConfiguration(context);
if (getProperties().containsKey("RegistrationConditionProvider")) {
throw new MCRConfigurationException("The MCRPIService " + getServiceID() +
" uses old property key RegistrationConditionProvider, use " + REGISTRATION_PREDICATE + " instead.");
Expand Down
7 changes: 6 additions & 1 deletion mycore-pi/src/main/java/org/mycore/pi/MCRPIService.java
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ public final String getServiceID() {
*
* @throws MCRConfigurationException if parameter is missing or wrong!
*/
protected void checkConfiguration() throws MCRConfigurationException {
protected void checkConfiguration(Context context) throws MCRConfigurationException {
if (getProperties().containsKey("MetadataManager")) {
throw new MCRConfigurationException("The MCRPIService " + getServiceID() +
" uses old property key MetadataManager");
Expand Down Expand Up @@ -577,4 +577,9 @@ public static Predicate<MCRBase> getPredicateInstance(String predicateProperty)
return MCRConfiguration2.getInstanceOfOrThrow(Predicate.class, predicateProperty);
}

public enum Context {
WEBAPP,
CLI
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ protected String getDefaultSchemaPath() {
}

@Override
protected void checkConfiguration() throws MCRConfigurationException {
super.checkConfiguration();
protected void checkConfiguration(Context context) throws MCRConfigurationException {
super.checkConfiguration(context);
init();
}

Expand Down
14 changes: 8 additions & 6 deletions mycore-pi/src/main/java/org/mycore/pi/doi/MCRDOIService.java
Original file line number Diff line number Diff line change
Expand Up @@ -182,15 +182,17 @@ private void insertDOI(Document datacite, String doi)
}

@Override
protected void checkConfiguration() throws MCRConfigurationException {
super.checkConfiguration();
protected void checkConfiguration(Context context) throws MCRConfigurationException {
super.checkConfiguration(context);
this.initCommonProperties();
init();

try {
getDataciteClient().getDOIList();
} catch (MCRPersistentIdentifierException e) {
LOGGER.error("Error while checking Datacite credentials!", e);
if (context == Context.WEBAPP) {
try {
getDataciteClient().getDOIList();
} catch (MCRPersistentIdentifierException e) {
LOGGER.error("Error while checking Datacite credentials!", e);
}
}
}

Expand Down
Loading