Revision 56978
Added by Michele Artini over 4 years ago
AbstractIstiMDStorePlugin.java | ||
---|---|---|
11 | 11 |
|
12 | 12 |
import eu.dnetlib.data.mdstore.modular.MDStoreFeeder; |
13 | 13 |
import eu.dnetlib.data.mdstore.modular.action.DoneCallback; |
14 |
import eu.dnetlib.data.mdstore.modular.action.FailedCallback; |
|
14 | 15 |
import eu.dnetlib.data.mdstore.modular.action.MDStorePlugin; |
15 | 16 |
import eu.dnetlib.data.mdstore.modular.connector.MDStore; |
16 | 17 |
import eu.dnetlib.data.mdstore.modular.connector.MDStoreDao; |
... | ... | |
36 | 37 |
private static final Log log = LogFactory.getLog(AbstractIstiMDStorePlugin.class); |
37 | 38 |
|
38 | 39 |
@Override |
39 |
public final void run(final MDStoreDao dao, final Map<String, String> params, final DoneCallback doneCallback) throws MDStoreServiceException {
|
|
40 |
public final void run(final MDStoreDao dao, final Map<String, String> params, final DoneCallback doneCallback, final FailedCallback failedCallback) {
|
|
40 | 41 |
|
41 | 42 |
if (dao instanceof MDStoreDaoImpl) { |
42 | 43 |
setDao((MDStoreDaoImpl) dao); |
43 | 44 |
} else { |
44 | 45 |
log.error("a mongo mdStore service is required"); |
45 |
throw new MDStoreServiceException("a mongo mdStore service is required");
|
|
46 |
failedCallback.call(new MDStoreServiceException("a mongo mdStore service is required"));
|
|
46 | 47 |
} |
47 | 48 |
|
48 | 49 |
final LocalDateTime start = LocalDateTime.now(); |
49 |
process(resolveStore(params, "mdId"), params); |
|
50 |
|
|
51 |
log.info("Plugin Execution Time: " + ChronoUnit.SECONDS.between(start, LocalDateTime.now())); |
|
52 |
|
|
53 |
doneCallback.call(params); |
|
50 |
try { |
|
51 |
process(resolveStore(params, "mdId"), params); |
|
52 |
log.info("Plugin Execution Time: " + ChronoUnit.SECONDS.between(start, LocalDateTime.now())); |
|
53 |
doneCallback.call(params); |
|
54 |
} catch (final Throwable e) { |
|
55 |
log.error(e.getMessage(), e); |
|
56 |
failedCallback.call(e); |
|
57 |
} |
|
54 | 58 |
} |
55 | 59 |
|
56 | 60 |
protected abstract void process(final MongoMDStore store, final Map<String, String> params) throws MDStoreServiceException; |
Also available in: Unified diff
- failedCallback
- update of dli objects
- WorkAround for duplicated sets from people repository