Project

General

Profile

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 refresh the shadow cache according to the content of the shadow stats db for the portal specified by the
11
 * additional BB parameter <code>StatsManagerServiceBBAction.REFRESH_SHADOW_CACHE.getTargetPortalParamName()</code>.
12
 * <p>
13
 * In order for the given portal to actually use the generated cache, we must promote the cache with the BB message 'promoteCache'.
14
 * </p>
15
 *
16
 * @author alessia
17
 * @see eu.dnetlib.msro.openaireplus.workflows.nodes.stats.PromoteShadowCacheStatsJobNode
18
 */
19
public class RefreshShadowCacheJobNode extends AbstractStatsJobNode {
20

    
21
	private static final Log log = LogFactory.getLog(RefreshShadowCacheJobNode.class); // NOPMD by marko on 11/24/08 5:02 PM
22

    
23
	@Override
24
	protected void prepareJob(final BlackboardJob job, final NodeToken token) throws Exception {
25
		job.setAction(StatsManagerServiceBBAction.REFRESH_SHADOW_CACHE.action());
26
		String portal = getPortalName(token);
27
		if (StringUtils.isNotBlank(portal)) {
28
			job.getParameters().put(StatsManagerServiceBBAction.REFRESH_SHADOW_CACHE.getTargetPortalParamName(), portal);
29
		} else {
30
			log.warn(StatsManagerServiceBBAction.REFRESH_SHADOW_CACHE.getTargetPortalParamName() + " not set. The StatsManagerService will use its default.");
31
		}
32
	}
33

    
34
}
(7-7/10)