Project

General

Profile

1
package eu.dnetlib.msro.openaireplus.workflows.nodes.stats;
2

    
3
import org.apache.commons.lang.StringUtils;
4
import org.apache.commons.logging.Log;
5
import org.apache.commons.logging.LogFactory;
6

    
7
import com.googlecode.sarasvati.NodeToken;
8

    
9
import eu.dnetlib.enabling.tools.blackboard.BlackboardJob;
10

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

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

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

    
36
}
(7-7/10)