1
|
package eu.dnetlib.msro.openaireplus.workflows.nodes.stats;
|
2
|
|
3
|
import com.googlecode.sarasvati.NodeToken;
|
4
|
import eu.dnetlib.enabling.tools.blackboard.BlackboardJob;
|
5
|
import org.apache.commons.lang.StringUtils;
|
6
|
import org.apache.commons.logging.Log;
|
7
|
import org.apache.commons.logging.LogFactory;
|
8
|
|
9
|
/**
|
10
|
* Ask the StatsManagerService to promote the shadow stats db and cache to public for the portal specified by the additional BB parameter
|
11
|
* <code>StatsManagerServiceBBAction.PROMOTE_SHADOW_STATS.getTargetPortalParamName()</code>.
|
12
|
* <p>
|
13
|
* <p>
|
14
|
* According to the StatsManagerService specifications in https://issue.openaire.research-infrastructures.eu/issues/914#note-49, this BB
|
15
|
* action will:
|
16
|
* <ol>
|
17
|
* <li>promote the shadow cache to public</li>
|
18
|
* <li>make a backup of the current stats db schema under the name 'backup'</li>
|
19
|
* <li>replace it with the new one</li>
|
20
|
* </ol>
|
21
|
* </p>
|
22
|
*
|
23
|
* @author alessia
|
24
|
*/
|
25
|
public class PromoteShadowStatsJobNode extends AbstractStatsJobNode {
|
26
|
|
27
|
private static final Log log = LogFactory.getLog(PromoteShadowStatsJobNode.class); // NOPMD by marko on 11/24/08 5:02 PM
|
28
|
|
29
|
@Override
|
30
|
protected void prepareJob(final BlackboardJob job, final NodeToken token) throws Exception {
|
31
|
job.setAction(StatsManagerServiceBBAction.PROMOTE_SHADOW_STATS.action());
|
32
|
String portal = getPortalName(token);
|
33
|
if (StringUtils.isNotBlank(portal)) {
|
34
|
job.getParameters().put(StatsManagerServiceBBAction.PROMOTE_SHADOW_STATS.getTargetPortalParamName(), portal);
|
35
|
} else {
|
36
|
log.warn(StatsManagerServiceBBAction.PROMOTE_SHADOW_STATS.getTargetPortalParamName() + " not set. The StatsManagerService will use its default.");
|
37
|
}
|
38
|
}
|
39
|
|
40
|
}
|