Revision 43245
Added by Claudio Atzori almost 8 years ago
CreateStoreAction.java | ||
---|---|---|
4 | 4 |
import eu.dnetlib.enabling.tools.blackboard.BlackboardServerHandler; |
5 | 5 |
import eu.dnetlib.oai.mongo.MongoPublisherStore; |
6 | 6 |
import eu.dnetlib.oai.mongo.MongoPublisherStoreDAO; |
7 |
import eu.dnetlib.rmi.provision.MDFInfo; |
|
8 |
import eu.dnetlib.utils.MetadataReference; |
|
9 |
import eu.dnetlib.utils.MetadataReferenceFactory; |
|
7 | 10 |
import org.apache.commons.logging.Log; |
8 | 11 |
import org.apache.commons.logging.LogFactory; |
9 | 12 |
import org.springframework.beans.factory.annotation.Autowired; |
... | ... | |
17 | 20 |
|
18 | 21 |
@Override |
19 | 22 |
public void execute(final BlackboardServerHandler handler, final BlackboardJob job) throws Exception { |
20 |
final String mdformat = job.getParameters().get("format"); |
|
21 |
final String layout = job.getParameters().get("layout"); |
|
22 |
final String interp = job.getParameters().get("interpretation"); |
|
23 | 23 |
final String dbName = job.getParameters().get("oai_dbName"); |
24 |
if (this.mongoPublisherStoreDAO.getStore(mdformat, interp, layout, dbName) == null) { |
|
25 |
final MongoPublisherStore store = this.mongoPublisherStoreDAO.createStore(mdformat, interp, layout, dbName); |
|
24 |
|
|
25 |
final String collectionName = job.getParameters().get("oai_collectionName"); |
|
26 |
final MetadataReference mdRef = MetadataReferenceFactory.decode(collectionName, MDREF_SEPARATOR); |
|
27 |
|
|
28 |
if (this.mongoPublisherStoreDAO.getStore(mdRef.getFormat(), mdRef.getInterpretation(), mdRef.getLayout(), dbName) == null) { |
|
29 |
final MongoPublisherStore store = this.mongoPublisherStoreDAO.createStore(mdRef.getFormat(), mdRef.getInterpretation(), mdRef.getLayout(), dbName); |
|
26 | 30 |
log.info("Created store with id: " + store.getId() + "on db " + dbName); |
27 | 31 |
} else { |
28 |
log.info("Store already exists for format=" + mdformat + " layout=" + layout + " interpretation=" + interp + " on db " + dbName);
|
|
32 |
log.info("Store already exist: " + collectionName + " on db " + dbName);
|
|
29 | 33 |
} |
30 | 34 |
handler.done(job); |
31 | 35 |
} |
Also available in: Unified diff
moved MetadataReference class in common package, it will be used by both index service and oai store service