Revision 43245
Added by Claudio Atzori almost 8 years ago
OAIStoreSynchronizer.java | ||
---|---|---|
5 | 5 |
import eu.dnetlib.oai.conf.OAIConfigurationExistReader; |
6 | 6 |
import eu.dnetlib.oai.mongo.MongoPublisherStore; |
7 | 7 |
import eu.dnetlib.oai.mongo.MongoPublisherStoreDAO; |
8 |
import eu.dnetlib.rmi.provision.MDFInfo; |
|
9 | 8 |
import eu.dnetlib.rmi.provision.OaiPublisherException; |
10 | 9 |
import eu.dnetlib.rmi.provision.OaiPublisherRuntimeException; |
10 |
import eu.dnetlib.utils.MetadataReference; |
|
11 | 11 |
import org.apache.commons.logging.Log; |
12 | 12 |
import org.apache.commons.logging.LogFactory; |
13 | 13 |
import org.springframework.beans.factory.annotation.Autowired; |
... | ... | |
24 | 24 |
private MongoPublisherStoreDAO publisherStoreDAO; |
25 | 25 |
|
26 | 26 |
public void synchronize(final Iterable<String> records, |
27 |
final MDFInfo sourceMetadataFormat,
|
|
27 |
final MetadataReference sourceMetadataFormat,
|
|
28 | 28 |
final String recordSource, |
29 | 29 |
final String dbName, |
30 | 30 |
final boolean alwaysNewRecord, |
... | ... | |
45 | 45 |
/** |
46 | 46 |
* Gets the OAI store for the given source metadata format. If the store does not exists, then a new one is created. |
47 | 47 |
* |
48 |
* @param sourceMetadataFormat MDFInfo about the metadata format of the store to get
|
|
48 |
* @param mdRef MDFInfo about the metadata format of the store to get
|
|
49 | 49 |
* @return a MongoPublisherStore instance |
50 | 50 |
*/ |
51 |
private MongoPublisherStore getStore(final MDFInfo sourceMetadataFormat, final String dbName, final boolean alwaysNewRecord) {
|
|
51 |
private MongoPublisherStore getStore(final MetadataReference mdRef, final String dbName, final boolean alwaysNewRecord) {
|
|
52 | 52 |
this.publisherStoreDAO.setAlwaysNewRecord(alwaysNewRecord); |
53 |
MongoPublisherStore store = this.publisherStoreDAO.getStore(sourceMetadataFormat.getSourceFormatName(), |
|
54 |
sourceMetadataFormat.getSourceFormatInterpretation(), sourceMetadataFormat.getSourceFormatLayout(), dbName); |
|
53 |
MongoPublisherStore store = this.publisherStoreDAO.getStore(mdRef.getFormat(), mdRef.getInterpretation(), mdRef.getLayout(), dbName); |
|
55 | 54 |
if (store == null) { |
56 |
log.debug("Creating store for metadata format: \n" + sourceMetadataFormat + " in db: " + dbName);
|
|
55 |
log.debug("Creating store for metadata format: \n" + mdRef + " in db: " + dbName);
|
|
57 | 56 |
try { |
58 |
store = this.publisherStoreDAO.createStore(sourceMetadataFormat.getSourceFormatName(), sourceMetadataFormat.getSourceFormatInterpretation(), |
|
59 |
sourceMetadataFormat.getSourceFormatLayout(), dbName); |
|
57 |
store = this.publisherStoreDAO.createStore(mdRef.getFormat(), mdRef.getInterpretation(), mdRef.getLayout(), dbName); |
|
60 | 58 |
log.debug("Created store with id: " + store.getId()); |
61 | 59 |
} catch (OaiPublisherException e) { |
62 | 60 |
throw new OaiPublisherRuntimeException(e); |
Also available in: Unified diff
moved MetadataReference class in common package, it will be used by both index service and oai store service