Skip to content

Commit

Permalink
Switch OAI-PMH harvester implementation
Browse files Browse the repository at this point in the history
Avoid duplicate log outputs after OAI-PMH harvester ran for the
first time (old library programmatically adds a console appender)

See https://gitlab.com/oersi/oersi-etl/-/issues/40

Remove previous workaround from b2ed6cb

See https://gitlab.com/oersi/oersi-etl/-/issues/53#note_514936670

Long-term solution will be implemented in Metafacture

See metafacture/metafacture-core#360
  • Loading branch information
fsteeg committed Feb 23, 2021
1 parent 38e387c commit 3004be0
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 7 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@ bin

# Ignore checked out dependency repos
metafacture-*
oai-harvest-manager

# Ignore generated output data
*.ndjson
*.json
*.txt
*.xml
!src/**
log

# Ignore local test data
data/test
7 changes: 7 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,16 @@ dependencies {
implementation('org.metafacture:metafacture-biblio:feature-oersi-SNAPSHOT') {
exclude group: 'xml-apis', module: 'xml-apis'
}
implementation('nl.mpi:oai-harvest-manager:1.2.0') {
exclude group: 'xml-apis', module: 'xml-apis'
exclude group: 'org.apache.logging.log4j', module: 'log4j-slf4j-impl'
exclude group: 'org.slf4j', module: 'log4j-over-slf4j'
exclude group: 'ch.qos.logback', module: 'logback-classic'
}
implementation 'com.fasterxml.jackson.core:jackson-databind:2.9.10.4'
implementation 'com.github.java-json-tools:json-schema-validator:2.2.14'
implementation 'org.slf4j:slf4j-api:1.7.30'
implementation 'org.apache.logging.log4j:log4j-core:2.14.0'

// Test frameworks:
testImplementation 'junit:junit:4.12'
Expand Down
4 changes: 4 additions & 0 deletions install_snapshots.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,7 @@ git clone https://github.com/metafacture/metafacture-fix.git -b oersi
cd metafacture-fix
./gradlew install
cd ..
git clone https://github.com/clarin-eric/oai-harvest-manager -b 1.2.0
cd oai-harvest-manager
mvn clean install
cd ..
7 changes: 0 additions & 7 deletions src/main/java/oersi/ETL.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
import java.util.stream.Stream;

import org.antlr.runtime.RecognitionException;
import org.apache.log4j.BasicConfigurator;
import org.apache.log4j.PropertyConfigurator;
import org.metafacture.framework.MetafactureException;
import org.metafacture.runner.Flux;
import org.slf4j.Logger;
Expand Down Expand Up @@ -149,11 +147,6 @@ private static void logSummary(File flux, File invalid, File responses, long end
countSuccess = errored.get(false).size() + "";
}
}
// Workaround for issue in transitive dependency (org.dspace:oclc-harvester2 in
// metafacture-biblio), which calls BasicConfigurator.configure() internally,
// resulting in duplicate log messages:
BasicConfigurator.resetConfiguration();
PropertyConfigurator.configure(ETL.class.getResourceAsStream("/log4j.properties"));
LOG.info(
"Import channel {}, SUCCESS: {}, FAIL-VALIDATION: {}, FAIL-WRITE: {}, DURATION: {}",
flux.getName(), countSuccess, countInvalid, countError, formatTime(end));
Expand Down

0 comments on commit 3004be0

Please sign in to comment.