1
|
package eu.dnetlib.msro.workflows.nodes.stats;
|
2
|
|
3
|
import eu.dnetlib.enabling.tools.blackboard.BlackboardJob;
|
4
|
import eu.dnetlib.msro.workflows.procs.Token;
|
5
|
import org.apache.commons.lang3.StringUtils;
|
6
|
import org.apache.commons.logging.Log;
|
7
|
import org.apache.commons.logging.LogFactory;
|
8
|
|
9
|
/**
|
10
|
* Ask the StatsManagerService to restore the cache of the portal specified by the additional BB parameter
|
11
|
* <code>StatsManagerServiceBBAction.RESTORE_CACHE.getTargetPortalParamName()</code> to the last available backup.
|
12
|
* <p>
|
13
|
* To create a backup you must send a "backup" BB message.
|
14
|
* </p>
|
15
|
*
|
16
|
* @author alessia
|
17
|
* @see BackupStatsCacheJobNode
|
18
|
*/
|
19
|
public class RestoreStatsCacheJobNode extends AbstractStatsJobNode {
|
20
|
|
21
|
private static final Log log = LogFactory.getLog(RestoreStatsCacheJobNode.class); // NOPMD by marko on 11/24/08 5:02 PM
|
22
|
|
23
|
@Override
|
24
|
protected void prepareJob(final BlackboardJob job, final Token token) throws Exception {
|
25
|
job.setAction(StatsManagerServiceBBAction.RESTORE_CACHE.action());
|
26
|
final String portal = getPortalName(token.getEnv());
|
27
|
if (StringUtils.isNotBlank(portal)) {
|
28
|
job.getParameters().put(StatsManagerServiceBBAction.RESTORE_CACHE.getTargetPortalParamName(), portal);
|
29
|
} else {
|
30
|
log.warn(StatsManagerServiceBBAction.RESTORE_CACHE.getTargetPortalParamName() + " not set. The StatsManagerService will use its default.");
|
31
|
}
|
32
|
}
|
33
|
|
34
|
}
|